I'm working on a Speech Recogniser module in my app. Speech recognizer returns a string (maybe some time with garbage string information, closely matching with user's speech) and I have to evaluate specific command from a string.
Here are some speech result string examples, that I'm getting:
- "open case"
- "open case 1234"
- "open case id 3421"
- "open case no 9546"
- "open case number 5241"
- "open case 9552 open case"
- "open case open case 6842"
- "open case bla bla 5415 bla"
- "open case 1234 bla bla"
- "open case number 54675 bla bla 1234 bla" . // first integer should be considered in command
Now, I've a set of command list, one of command is open case <Integer value>
I could easily evaluate the word open case
using substring utility functions of Swift. But the problem is, I've to find out (identify and get) an integer number from a speech string after keyword open case
.
I've looked around the following answer but couldn't find the exact result/solution: