/*---------------------------------------------------------------------------* * vocab.cpp * * * * Copyright 2007, 2008 Nuance Communciations, Inc. * * * * Licensed under the Apache License, Version 2.0 (the 'License'); * * you may not use this file except in compliance with the License. * * * * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * * * Unless required by applicable law or agreed to in writing, software * * distributed under the License is distributed on an 'AS IS' BASIS, * * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * * See the License for the specific language governing permissions and * * limitations under the License. * * * *---------------------------------------------------------------------------*/ #include #include #include #include "ESR_Locale.h" #include "LCHAR.h" #include "pstdio.h" #include "ESR_Session.h" #include "SR_Vocabulary.h" #include "vocab.h" #define MAX_LINE_LENGTH 256 #define MAX_PRONS_LENGTH 1024 #define DEBUG 0 #define GENERIC CONTEXT "#" Vocabulary::Vocabulary( std::string const & vocFileName ) { ESR_ReturnCode rc; rc = SR_VocabularyLoad(vocFileName.c_str(), &m_hVocab); if (rc != ESR_SUCCESS) { std::cout << "Error: " << ESR_rc2str(rc) < idList; // Create storage int numPhonemes = getPhonemeCount(ii); if (1==numPhonemes) { lphon=GENERIC_CONTEXT; rphon=GENERIC_CONTEXT; cphon = pron.at(0); } else for ( int jj=0;jj & stateIDs) { srec_arbdata *allotree = (srec_arbdata*) m_CA_Arbdata; int numStates = allotree->hmm_infos[id].num_states; #if DEBUG std::cout << "getStateIndices: count = " << numStates <hmm_infos[id].state_indices[ii] ); #if DEBUG std::cout << allotree->hmm_infos[id].state_indices[ii] ; #endif } #if DEBUG std::cout << std::endl; #endif return stateIDs.size(); }