Token initialize_word(ISpeechPhraseProperty property)
        {
            if (property.NumberOfElements == 0)
            {
                return(null);
            }

            var result = new Token(this, property.Value.ToString(), property.FirstElement, property.NumberOfElements);

            result.confidence = property.EngineConfidence;

            if (property.Children != null)
            {
                foreach (ISpeechPhraseProperty child in property.Children)
                {
                    if (child.NumberOfElements > 0)
                    {
                        var new_word = initialize_word(child);
                        new_word.parent = result;
                        result.children.Add(new_word);
                    }
                }
            }

            return(result);
        }
Beispiel #2
0
        private XmlElement log_properties(ISpeechPhraseProperty property, XmlDocument writer, ISpeechPhraseInfo info)
        {
            XmlElement element = writer.CreateElement("property");

            element.SetAttribute("name", property.Name);
            element.SetAttribute("value", property.Value.ToString());
            element.SetAttribute("confidence", property.EngineConfidence.ToString());
            string text = info.GetText(property.FirstElement, property.NumberOfElements, true);

            if (text != null)
            {
                XmlElement text_element = writer.CreateElement("text");
                element.AppendChild(text_element);
            }

            if (property.Children != null)
            {
                foreach (ISpeechPhraseProperty child in property.Children)
                {
                    element.AppendChild(log_properties(child, writer, info));
                }
            }
            return(element);
        }