简体   繁体   English

NET中的语音识别器日期时间

[英]Speech recognizer datetime in .NET

I'm working with .NET speech recognizer and I'm trying to make an alarm clock. 我正在使用.NET语音识别器,并且正在尝试制作一个闹钟。

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! 非常感谢!

You may have the right idea, maybe you just need to convert the numbers to their word counterparts? 您可能有正确的主意,也许您只需要将数字转换为对应的单词?

converting numbers in to words C# may be of some assistance... 将数字转换为单词C#可能会有所帮助...

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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