コード例 #1
0
        public SpeechAligner(string amPath, string dictPath, string g2PPath)
        {
            var configuration = new Configuration();

            configuration.AcousticModelPath = amPath;
            configuration.DictionaryPath    = dictPath;

            _context = new Context(configuration);
            if (g2PPath != null)
            {
                _context.SetLocalProperty("dictionary->allowMissingWords", "true");
                _context.SetLocalProperty("dictionary->createMissingWords", "true");
                _context.SetLocalProperty("dictionary->g2pModelPath", g2PPath);
                _context.SetLocalProperty("dictionary->g2pMaxPron", "2");
            }
            _context.SetLocalProperty("lexTreeLinguist->languageModel", "dynamicTrigramModel");
            _recognizer    = (Recognizer)_context.GetInstance(typeof(Recognizer));
            _grammar       = (AlignerGrammar)_context.GetInstance(typeof(AlignerGrammar));
            _languageModel = (DynamicTrigramModel)_context.GetInstance(typeof(DynamicTrigramModel));
            Tokenizer      = new UsEnglishTokenizer();
        }
コード例 #2
0
        /// <summary>
        /// Creates a WordRelation object with the given utterance and TokenToWords.
        /// </summary>
        /// <param name="utterance">the Utterance from which to create a Relation.</param>
        /// <param name="tokenToWords">The TokenToWords object to use.</param>
        /// <returns>a WordRelation object</returns>
        public static WordRelation CreateWordRelation(Utterance utterance, UsEnglishTokenizer tokenToWords)
        {
            var relation = utterance.CreateRelation(Relation.Word);

            return(new WordRelation(relation, tokenToWords));
        }
コード例 #3
0
 private WordRelation(Relation parentRelation, UsEnglishTokenizer tokenToWords)
 {
     _relation     = parentRelation;
     _tokenToWords = tokenToWords;
 }