📄 voca_util.c
字号:
/** * @file voca_util.c * * <JA> * @brief 帽胳辑今の攫鼠をテキストで叫蜗 * </JA> * * <EN> * @brief Output text informations about the grammar * </EN> * * @author Akinobu LEE * @date Fri Feb 18 21:41:41 2005 * * $Revision: 1.2 $ * *//* * Copyright (c) 1991-2007 Kawahara Lab., Kyoto University * Copyright (c) 2000-2005 Shikano Lab., Nara Institute of Science and Technology * Copyright (c) 2005-2007 Julius project team, Nagoya Institute of Technology * All rights reserved */#include <sent/stddefs.h>#include <sent/vocabulary.h>/** * Output overall word dictionary information to stdout. * * @param fp [in] file descriptor * @param winfo [in] word dictionary */voidprint_voca_info(FILE *fp, WORD_INFO *winfo){ if (fp == NULL) return; fprintf(fp, " Vocabulary Info:\n"); fprintf(fp, " vocabulary size = %d words, %d models\n", winfo->num, winfo->totalmodelnum); fprintf(fp, " average word len = %.1f models, %.1f states\n", (float)winfo->totalmodelnum/(float)winfo->num, (float)winfo->totalstatenum/(float)winfo->num); fprintf(fp, " maximum state num = %d nodes per word\n", winfo->maxwn); fprintf(fp, " transparent words = "); if (winfo->totaltransnum > 0) { fprintf(fp, "%d words\n", winfo->totaltransnum); } else { fprintf(fp, "not exist\n"); }#ifdef CLASS_NGRAM fprintf(fp, " words under class = "); if (winfo->cwnum > 0) { fprintf(fp, "%d words\n", winfo->cwnum); } else { fprintf(fp, "not exist\n"); } #endif} /** * Output information of a word in dictionary to stdout. * * @param fp [in] file descriptor * @param winfo [in] word dictionary * @param wid [in] word id to be output */voidput_voca(FILE *fp, WORD_INFO *winfo, WORD_ID wid){ int i; HMM_Logical *lg; if (fp == NULL) return; fprintf(fp, "%d: \"%s", wid, winfo->wname[wid]);#ifdef CLASS_NGRAM fprintf(fp, " @%f", winfo->cprob[wid]);#endif if (winfo->is_transparent[wid]) { fprintf(fp, " {%s}", winfo->woutput[wid]); } else { fprintf(fp, " [%s]", winfo->woutput[wid]); } for(i=0;i<winfo->wlen[wid];i++) { lg = winfo->wseq[wid][i]; fprintf(fp, " %s", lg->name); if (lg->is_pseudo) { fprintf(fp, "(pseudo)"); } else { fprintf(fp, "(%s)", lg->body.defined->name); } } fprintf(fp, "\"\n");}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -