1 /*---------------------------------------------------------------------------* 2 * word_lattice.h * 3 * * 4 * Copyright 2007, 2008 Nuance Communciations, Inc. * 5 * * 6 * Licensed under the Apache License, Version 2.0 (the 'License'); * 7 * you may not use this file except in compliance with the License. * 8 * * 9 * You may obtain a copy of the License at * 10 * http://www.apache.org/licenses/LICENSE-2.0 * 11 * * 12 * Unless required by applicable law or agreed to in writing, software * 13 * distributed under the License is distributed on an 'AS IS' BASIS, * 14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * 15 * See the License for the specific language governing permissions and * 16 * limitations under the License. * 17 * * 18 *---------------------------------------------------------------------------*/ 19 20 #ifndef WORD_LATTICE_H 21 #define WORD_LATTICE_H 22 23 #include"srec_sizes.h" 24 #include"srec.h" 25 #include"search_network.h" 26 27 #if defined(__cplusplus) 28 extern "C" 29 { 30 #endif 31 32 void print_word_token(srec* rec, wtokenID wtoken_index, char* msg); 33 void print_word_token_backtrace(srec* rec, wtokenID wtoken_index, char* tail); 34 void print_word_token_list(srec* rec, wtokenID wtoken_index, char* msg); 35 int sprint_bword_token_backtrace(char *buf, int len, srec* rec, wtokenID wtoken_index); 36 37 #define SCOREMODE_EXCLUDE_SILENCE 0 38 #define SCOREMODE_INCLUDE_SILENCE 1 39 #define ERROR_TRANSCRIPTION_TOO_LONG -1 40 #define ERROR_RESULT_IS_LOOPY -2 41 42 int srec_print_results(multi_srec *rec, int max_choices); 43 int srec_get_top_choice_score(multi_srec* rec, bigcostdata *cost, int do_incsil); 44 int srec_get_top_choice_transcription(multi_srec* rec, char *transcription, int len, int whether_strip_slot_markers) ; 45 ESR_ReturnCode srec_get_top_choice_wordIDs(multi_srec* recm, wordID* wordIDs, size_t* len); 46 int sprint_word_token_backtrace(char *transcription, int len, srec* rec, wtokenID wtoken_index); 47 void sort_word_lattice_at_frame(srec* rec, frameID frame); 48 int reprune_word_tokens(srec* rec, costdata current_best_cost); 49 srec_word_lattice *allocate_word_lattice(frameID max_frames); 50 void destroy_word_lattice(srec_word_lattice* wl); 51 void initialize_word_lattice(srec_word_lattice* wl); 52 void lattice_add_word_tokens(srec_word_lattice *wl, frameID frame, 53 wtokenID word_token_list_head); 54 costdata lattice_best_cost_to_frame(srec_word_lattice *wl, word_token* word_token_array, frameID ifr); 55 56 #if defined(__cplusplus) 57 } 58 #endif 59 60 #endif 61