2

I'm working with .NET speech recognizer and I'm trying to make an alarm clock.

So I need that the speech recognizer understands dates, and the way I'm doing it is adding to the grammar all the posible values of an hour in a day like this:

private SemanticResultKey GetClockValues()
    {
        DateTime start = new DateTime(1, 1, 1, 0, 0, 0);

        DateTime end = start.AddDays(1);

        Choices choices = new Choices();

        while (start < end)
        {
            choices.Add(start.ToShortTimeString());

            start = start.AddMinutes(1);
        }

        return new SemanticResultKey("value", choices);
    }

Is there a better way? I hope so!

Thanks a lot!

Eric J.
  • 147,927
  • 63
  • 340
  • 553
Coconut
  • 111
  • 1
  • 12
  • see this http://blog.vascooliveira.com/speech-recognition-and-synthesis-with-net-3-0/ - the section Synthesizer.SpeakAsync("It's " + DateTime.Now.Hour + " hours, and " + DateTime.Now.Minute + " minutes."); – Jeremy Thompson Nov 23 '11 at 23:52

0 Answers0