コード例 #1
0
ファイル: JSGFParser.cs プロジェクト: pgrudzien12/syn-speech
        /**
         * extract @keywords from documentation comments
         */
        static void ExtractKeywords(JSGFRuleGrammar grammar, String rname, String comment)
        {
            int i = 0;

            while ((i = comment.IndexOf("@example ", i) + 9) > 9)
            {
                int j = Math.Max(comment.IndexOf('\r', i), comment.IndexOf('\n', i));
                if (j < 0)
                {
                    j = comment.Length;
                    if (comment.EndsWith(("*/")))
                    {
                        j -= 2;
                    }
                }
                grammar.AddSampleSentence(rname, comment.Substring(i, j).Trim());
                i = j + 1;
            }
        }