简体   繁体   English

如何修复“短语”不能为空字符串。 参数名称:短语'?

[英]how to fix ''phrase' cannot be an empty string. Parameter name: phrase'?

whenever I start debugging this error occur on the gramList.Add(grammarFile);每当我开始调试这个错误发生在 gramList.Add(grammarFile);

System.ArgumentException: ''phrase' cannot be an empty string. System.ArgumentException: ''phrase' 不能是空字符串。 Parameter name: phrase'参数名称:短语'

public Form1()
        {
            //initialize grammarfile
            gramList.Add(grammarFile);
            Grammar grammar = new Grammar(new GrammarBuilder(gramList));

            try
            {
                speechRecognition.RequestRecognizerUpdate();
                speechRecognition.LoadGrammar(grammar);
                speechRecognition.SpeechRecognized += rec_SpeechRecognized;
                speechRecognition.SetInputToDefaultAudioDevice();
                speechRecognition.RecognizeAsync(RecognizeMode.Multiple);
            }
            catch
            {
                return;
            }

if there are some empty lines at the end of all the text or inside the text file it must be considered an empty phrase so just remove these empty lines from the file..如果所有文本的末尾或文本文件中有一些空行,则必须将其视为空短语,因此只需从文件中删除这些空行即可。

open the commands file and check if there are come yellow colored lines or open commands file in notepad and check whether there are empty lines or not.打开命令文件并检查是否有黄色线条或在记事本中打开命令文件并检查是否有空行。

暂无
暂无

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

相关问题 用于短语的正则表达式字符串 - Regex string for phrase 如何修复 MVC 应用程序中的“System.ArgumentException:'值不能为 null 或为空。参数名称:名称'”? - How to fix a "System.ArgumentException: 'Value cannot be null or empty. Parameter name: name'" in a MVC app? System.ArgumentNullException:值不能为空。 参数名称:字符串。 查看堆栈跟踪的输出 - System.ArgumentNullException: Value cannot be null. Parameter name: String. See output for stack trace startIndex不能大于字符串的长度。 参数名称:startIndex MVC4 - startIndex cannot be larger then length of string. Parameter name: startIndex MVC4 弹性搜索:如何提取与查询短语/字符串匹配的所有“字段名称” - Elastic Search: How to extract All “FieldNames” that Match the Query Phrase/String 如何过滤在字符串数组中匹配的特定短语 - How to filter a specific phrase that has a match in a array in a string 如何在字符串数组中的任何位置找到短语? - How can I find a phrase anywhere in a String Array? 如何避免 System.ArgumentOutOfRangeException:索引和长度必须引用字符串中的位置。 参数名称:长度 - How to avoid System.ArgumentOutOfRangeException: Index and length must refer to a location within the string. Parameter name: length 在字符串中搜索引用短语和其他关键字的匹配项 - Searching a string for a match on a quoted phrase and other keywords 将短语翻译与String.Format集成 - Integrating phrase translation with String.Format
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM