Search code examples
uwpwindows-10text-to-speechvoice-recognitioncortana

Create Patterns in Phraselist that Cortana can understand


I'm working on an UWP app which should filter cars by their VehicleIdentificationNumber (VIN). This VIN is a 17-char long string. It can include Numbers and letters on every position.

Do anyone has an idea, how i can let the User dictate this 17-char long string and Cortana will understand this correctly? Some tests showed that Cortana understands sometime the digits, and in a second try she writes it out as "three" f. e.

This are the lines in my VCD-File, which than calls a Background Service. In the BackgroundService the Result i get out of VehicleIdentificationNumber is "...".

<Command Name="selectedSpecificVehicleByVIN">
  <Example>Fahrzeug nach VIN WAUZZZ8V5EA012963 filtern</Example>
  <ListenFor RequireAppName="BeforeOrAfterPhrase">Fahrzeug nach VIN {VehicleIdentificationNumber} filtern</ListenFor>
  <Feedback>Suche nach Fahrzeug mit VIN {VehicleIdentificationNumber}</Feedback>
  <VoiceCommandService Target="VehicleSelectionService"/>
</Command>

And my PhraseTopic looks like this:

<PhraseTopic Label="VehicleIdentificationNumber" Scenario="Dictation" />

Solution

  • I have found an answer for this case. It was quite simple. I only had to add two subjects to my PhraseTopic.

     <PhraseTopic Label="VehicleIdentificationNumber" Scenario="Dictation">
      <Subject>Characters</Subject>
      <Subject>Alphabet</Subject>
    </PhraseTopic>
    

    One small problem is, that Cortana adds some whitespaces inside the spelled VIN. This can be removed with simple string operations.

    Hope I can help somebody, who has the same problem.