简体   繁体   中英

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" fe

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" />

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.

I had to write a parser that would take the string response that you are provided and convert the number text to digits. If you're doing one digit at a time, it shouldn't be too bad.

You could also try to create a target for each digit/letter since most people would speak them separately. Then, instead of using a PhraseTopic, use a Phraselist and put each digit and letter in the list.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM