I want to transform any spoken number into integers so that I can perform operation on them for example:
twenty-one >> 21
I managed to do the calculation on small range of numbers I am using.
I am following this strategy (but its not going to work because I need the user to say any number):
string[] numberString =
{
"zero", "one", "two", "three", "four", "five",
"six", "seven", "eight", "nine", "ten",
"eleven", "twelve", "thirteen", "fourteen", "fifteen",
"sixteen", "seventeen", "eighteen", "nineteen", "twenty"
};
Choices numberChoices = new Choices();
for (int i = 0; i < numberString.Length; i++)
{
numberChoices.Add(new SemanticResultValue(numberString[i], i));
}
gb[1].Append(new SemanticResultKey("number1", (GrammarBuilder)numberChoices));
because I am not going to write down all the numbers... so is there any smart way to do that ??
Update 1:
I tried the following:
Choices numberChoices = new Choices();
for (int i = 0; i <= 100; i++)
{
numberChoices.Add(i.ToString());
}
gb[1].Append(new SemanticResultKey("op1", (GrammarBuilder)numberChoices));
Choices choices = new Choices(gb);
now I can have 100 numbers, but if i make it a Million, it takes pretty much time loading, and it takes more than 2GB of the memory and it does not finish the load in real time. Working with the 100 numbers, the accuracy is terrible, it does not recognize twelve correctly and sometimes numbers lower than 10.