Julius 4.2
|
単語ラティスの生成. [詳細]
#include <julius/julius.h>
関数 | |
void | wordgraph_init (WCHMM_INFO *wchmm) |
Define if you want debugging output for graph generation. | |
static WordGraph * | wordgraph_new (WORD_ID wid, HMM_Logical *headphone, HMM_Logical *tailphone, int leftframe, int rightframe, LOGPROB fscore_head, LOGPROB fscore_tail, LOGPROB gscore_head, LOGPROB gscore_tail, LOGPROB lscore, LOGPROB cm) |
グラフ単語を新たに生成し,そのポインタを返す. | |
void | wordgraph_free (WordGraph *wg) |
あるグラフ単語のメモリ領域を解放する. | |
static void | wordgraph_add_leftword (WordGraph *wg, WordGraph *left, LOGPROB lscore) |
あるグラフ単語の左コンテキストに新たなグラフ単語を追加する. | |
static void | wordgraph_add_rightword (WordGraph *wg, WordGraph *right, LOGPROB lscore) |
あるグラフ単語の右コンテキストに新たなグラフ単語を追加する. | |
boolean | wordgraph_check_and_add_leftword (WordGraph *wg, WordGraph *left, LOGPROB lscore) |
左コンテキストに指定したグラフ単語が既にあるかどうかチェックし, なければ追加する. | |
boolean | wordgraph_check_and_add_rightword (WordGraph *wg, WordGraph *right, LOGPROB lscore) |
右コンテキストに指定したグラフ単語が既にあるかどうかチェックし, なければ追加する. | |
static boolean | merge_contexts (WordGraph *dst, WordGraph *src) |
同一グラフ単語のマージ時に,単語グラフのコンテキストを全て別の単語グラフに 追加する. | |
static void | swap_leftword (WordGraph *wg, WordGraph *from, WordGraph *to, LOGPROB lscore) |
左コンテキスト上のあるグラフ単語を別のグラフ単語に置き換える. | |
static void | swap_rightword (WordGraph *wg, WordGraph *from, WordGraph *to, LOGPROB lscore) |
右コンテキスト上のあるグラフ単語を別のグラフ単語に置き換える. | |
static void | uniq_leftword (WordGraph *wg) |
左コンテキストリスト中の重複を除去する | |
static void | uniq_rightword (WordGraph *wg) |
右コンテキストリスト中の重複を除去する | |
static void | wordgraph_remove_context (WordGraph *wg) |
左右のグラフ単語のコンテキストリストからそのグラフ単語自身を消去する. | |
static void | wordgraph_link_context (WordGraph *wg) |
グラフ単語の左右のコンテキストをリンクする. | |
static int | wordgraph_exec_erase (WordGraph **rootp) |
単語グラフ中の削除マークの付いた単語を削除する. | |
static int | compare_lefttime (WordGraph **x, WordGraph **y) |
グラフソート用 qsort コールバック | |
int | wordgraph_sort_and_annotate_id (WordGraph **rootp, RecogProcess *r) |
単語グラフ内の全単語を開始時間順にソートし,通し番号をつける. | |
void | wordgraph_clean (WordGraph **rootp) |
単語グラフ内の全単語を全て解放する. | |
static int | compare_beam (WordGraph **x, WordGraph **y) |
単語グラフ深さカットのための qsort 用コールバック. | |
void | wordgraph_purge_leaf_nodes (WordGraph **rootp, RecogProcess *r) |
グラフ後処理その1:初期単語グラフの抽出. | |
void | wordgraph_depth_cut (WordGraph **rootp, RecogProcess *r) |
グラフ後処理その1. | |
static boolean | wordgraph_adjust_boundary_sub (WordGraph **rootp, int *mov_num_ret, int *dup_num_ret, int *del_num_ret, int *mod_num_ret, int count, int *maxfnum, int peseqlen, int lmtype, int **p_framelist, LOGPROB **p_framescorelist) |
単語間の境界情報のずれ補正を実行する. | |
static void | wordgraph_compaction_thesame_sub (WordGraph **rootp, int *rest_ret, int *merged_ret) |
グラフ内に境界情報やスコアが全く同一の単語がある場合それらをマージする. | |
void | wordgraph_adjust_boundary (WordGraph **rootp, RecogProcess *r) |
グラフ後処理その2:単語境界情報の調整. | |
void | wordgraph_compaction_thesame (WordGraph **rootp) |
グラフ後処理その3:単語の束ね(完全同一) | |
void | wordgraph_compaction_exacttime (WordGraph **rootp, RecogProcess *r) |
グラフ後処理その4:単語の束ね(区間同一) | |
void | wordgraph_compaction_neighbor (WordGraph **rootp, RecogProcess *r) |
グラフ後処理その5:単語の束ね(近傍区間) | |
WordGraph * | wordgraph_assign (WORD_ID wid, WORD_ID wid_left, WORD_ID wid_right, int leftframe, int rightframe, LOGPROB fscore_head, LOGPROB fscore_tail, LOGPROB gscore_head, LOGPROB gscore_tail, LOGPROB lscore, LOGPROB cm, RecogProcess *r) |
新たな単語グラフ候補を生成して返す. | |
void | wordgraph_save (WordGraph *wg, WordGraph *right, WordGraph **root) |
グラフ単語候補を単語グラフの一部として確定する. | |
void | put_wordgraph (FILE *fp, WordGraph *wg, WORD_INFO *winfo) |
グラフ単語の情報をテキストで出力する. | |
void | wordgraph_dump (FILE *fp, WordGraph *root, WORD_INFO *winfo) |
生成された単語グラフ中の全単語をテキスト出力する. | |
void | wordgraph_check_coherence (WordGraph *rootp, RecogProcess *r) |
デバッグ用:単語グラフの整合性をチェックする. | |
static int | compare_forward (WordGraph **x, WordGraph **y) |
単語を右から左へ並べるための qsort コールバック関数 | |
static int | compare_backward (WordGraph **x, WordGraph **y) |
単語を左から右へ並べるための qsort コールバック関数 | |
static LOGPROB | addlog10 (LOGPROB x, LOGPROB y) |
compute addition of two probabilities in log10 form. | |
void | graph_forward_backward (WordGraph *root, RecogProcess *r) |
生成されたラティス上において,forward-backward アルゴリズムにより 信頼度を計算する. |
void wordgraph_init | ( | WCHMM_INFO * | wchmm | ) |
Define if you want debugging output for graph generation.
Define if you want much more debugging output for graph generation
グラフ出力を初期化する. 現在はデバッグ用処理のみ.
wchmm | [in] 木構造化辞書 |
graphout.c の 54 行で定義されています。
参照元 wchmm_fbs().
static WordGraph* wordgraph_new | ( | WORD_ID | wid, |
HMM_Logical * | headphone, | ||
HMM_Logical * | tailphone, | ||
int | leftframe, | ||
int | rightframe, | ||
LOGPROB | fscore_head, | ||
LOGPROB | fscore_tail, | ||
LOGPROB | gscore_head, | ||
LOGPROB | gscore_tail, | ||
LOGPROB | lscore, | ||
LOGPROB | cm | ||
) | [static] |
グラフ単語を新たに生成し,そのポインタを返す.
wid | [in] 単語ID |
headphone | [in] 単語先頭の音素 |
tailphone | [in] 単語末端の音素 |
leftframe | [in] 始端時刻(フレーム) |
rightframe | [in] 終端時刻(フレーム) |
fscore_head | [in] 始端での部分文スコア (g + h) |
fscore_tail | [in] 終端での部分文スコア (g + h) |
gscore_head | [in] 先頭での入力末端からのViterbiスコア (g) |
gscore_tail | [in] 末尾での入力末端からのViterbiスコア (g) |
lscore | [in] 単語の言語スコア (Julian では値に意味なし) |
cm | [in] 単語の信頼度スコア (探索時に動的に計算されたもの) |
graphout.c の 102 行で定義されています。
void wordgraph_free | ( | WordGraph * | wg | ) |
あるグラフ単語のメモリ領域を解放する.
wg | [in] グラフ単語 |
graphout.c の 181 行で定義されています。
参照元 free_node(), wchmm_fbs(), wordgraph_clean(), と wordgraph_exec_erase().
あるグラフ単語の左コンテキストに新たなグラフ単語を追加する.
wg | [i/o] 追加先のグラフ単語 |
left | [in] wg の左コンテキストとして追加されるグラフ単語 |
lscore | [in] 接続言語スコア |
graphout.c の 210 行で定義されています。
参照元 merge_contexts(), wordgraph_adjust_boundary_sub(), wordgraph_check_and_add_leftword(), と wordgraph_save().
あるグラフ単語の右コンテキストに新たなグラフ単語を追加する.
wg | [i/o] 追加先のグラフ単語 |
right | [in] wg の右コンテキストとして追加されるグラフ単語 |
lscore | [in] 接続言語スコア |
graphout.c の 247 行で定義されています。
参照元 merge_contexts(), wordgraph_adjust_boundary_sub(), wordgraph_check_and_add_rightword(), と wordgraph_save().
左コンテキストに指定したグラフ単語が既にあるかどうかチェックし, なければ追加する.
wg | [i/o] 調べるグラフ単語 |
left | [in] このグラフ単語が wg の左コンテキストにあるかチェックする |
lscore | [in] 接続言語スコア |
graphout.c の 295 行で定義されています。
参照元 wchmm_fbs(), wordgraph_adjust_boundary_sub(), と wordgraph_link_context().
右コンテキストに指定したグラフ単語が既にあるかどうかチェックし, なければ追加する.
wg | [i/o] 調べるグラフ単語 |
right | [in] このグラフ単語が wg の右コンテキストにあるかチェックする |
lscore | [in] 接続言語スコア |
graphout.c の 347 行で定義されています。
参照元 wchmm_fbs(), wordgraph_adjust_boundary_sub(), と wordgraph_link_context().
同一グラフ単語のマージ時に,単語グラフのコンテキストを全て別の単語グラフに 追加する.
dst | [i/o] 追加先のグラフ単語 |
src | [in] 追加元のグラフ単語 |
graphout.c の 390 行で定義されています。
参照元 wordgraph_compaction_exacttime(), wordgraph_compaction_neighbor(), と wordgraph_compaction_thesame_sub().
static void swap_leftword | ( | WordGraph * | wg, |
WordGraph * | from, | ||
WordGraph * | to, | ||
LOGPROB | lscore | ||
) | [static] |
左コンテキスト上のあるグラフ単語を別のグラフ単語に置き換える.
wg | [i/o] 操作対象のグラフ単語 |
from | [in] 置き換え元となる左コンテキスト上のグラフ単語 |
to | [in] 置き換え先のグラフ単語 |
lscore | [in] 接続言語スコア |
graphout.c の 498 行で定義されています。
参照元 wordgraph_compaction_exacttime(), wordgraph_compaction_neighbor(), と wordgraph_compaction_thesame_sub().
static void swap_rightword | ( | WordGraph * | wg, |
WordGraph * | from, | ||
WordGraph * | to, | ||
LOGPROB | lscore | ||
) | [static] |
右コンテキスト上のあるグラフ単語を別のグラフ単語に置き換える.
wg | [i/o] 操作対象のグラフ単語 |
from | [in] 置き換え元となる右コンテキスト上のグラフ単語 |
to | [in] 置き換え先のグラフ単語 |
lscore | [in] 接続言語スコア |
graphout.c の 536 行で定義されています。
参照元 wordgraph_compaction_exacttime(), wordgraph_compaction_neighbor(), と wordgraph_compaction_thesame_sub().
static void uniq_leftword | ( | WordGraph * | wg | ) | [static] |
左コンテキストリスト中の重複を除去する
wg | [i/o] 操作対象のグラフ単語 |
graphout.c の 568 行で定義されています。
参照元 wordgraph_compaction_exacttime(), wordgraph_compaction_neighbor(), と wordgraph_compaction_thesame_sub().
static void uniq_rightword | ( | WordGraph * | wg | ) | [static] |
右コンテキストリスト中の重複を除去する
wg | [i/o] 操作対象のグラフ単語 |
graphout.c の 604 行で定義されています。
参照元 wordgraph_compaction_exacttime(), wordgraph_compaction_neighbor(), と wordgraph_compaction_thesame_sub().
static void wordgraph_remove_context | ( | WordGraph * | wg | ) | [static] |
static void wordgraph_link_context | ( | WordGraph * | wg | ) | [static] |
static int wordgraph_exec_erase | ( | WordGraph ** | rootp | ) | [static] |
単語グラフ中の削除マークの付いた単語を削除する.
rootp | [i/o] 単語グラフのルートノードへのポインタ |
graphout.c の 739 行で定義されています。
参照元 wordgraph_adjust_boundary(), wordgraph_compaction_exacttime(), wordgraph_compaction_neighbor(), wordgraph_compaction_thesame_sub(), wordgraph_depth_cut(), と wordgraph_purge_leaf_nodes().
グラフソート用 qsort コールバック
x | [in] 要素1 |
y | [in] 要素2 |
graphout.c の 786 行で定義されています。
int wordgraph_sort_and_annotate_id | ( | WordGraph ** | rootp, |
RecogProcess * | r | ||
) |
単語グラフ内の全単語を開始時間順にソートし,通し番号をつける.
rootp | [i/o] 単語グラフのルートノードへのポインタ格納場所 |
r | [i/o] 認識処理インスタンス |
graphout.c の 820 行で定義されています。
参照元 find_1pass_result(), と wchmm_fbs().
void wordgraph_clean | ( | WordGraph ** | rootp | ) |
単語グラフ内の全単語を全て解放する.
rootp | [i/o] 単語グラフのルートノードへのポインタ |
graphout.c の 871 行で定義されています。
参照元 clear_result().
単語グラフ深さカットのための qsort 用コールバック.
fscore_head で 降順にソートする.
x | [in] 要素1 |
y | [in] 要素2 |
graphout.c の 909 行で定義されています。
void wordgraph_purge_leaf_nodes | ( | WordGraph ** | rootp, |
RecogProcess * | r | ||
) |
グラフ後処理その1:初期単語グラフの抽出.
探索中に生成された単語候補集合から,末端から始まるパス上に無いleaf単語を 削除することで初期単語グラフを抽出する.
rootp | [i/o] 単語グラフのルートノードへのポインタ |
r | [in] 認識処理インスタンス |
graphout.c の 941 行で定義されています。
参照元 wchmm_fbs().
void wordgraph_depth_cut | ( | WordGraph ** | rootp, |
RecogProcess * | r | ||
) |
グラフ後処理その1.
5:グラフの深さによる単語候補のカット
GRAPHOUT_DEPTHCUT 指定時,グラフの深さによる単語候補のカットを行う.
rootp | [i/o] 単語グラフのルートノードへのポインタ |
r | [in] 認識処理インスタンス |
graphout.c の 1050 行で定義されています。
参照元 wchmm_fbs().
static boolean wordgraph_adjust_boundary_sub | ( | WordGraph ** | rootp, |
int * | mov_num_ret, | ||
int * | dup_num_ret, | ||
int * | del_num_ret, | ||
int * | mod_num_ret, | ||
int | count, | ||
int * | maxfnum, | ||
int | peseqlen, | ||
int | lmtype, | ||
int ** | p_framelist, | ||
LOGPROB ** | p_framescorelist | ||
) | [static] |
単語間の境界情報のずれ補正を実行する.
グラフ中の単語をチェックし, 接続単語間で境界時間情報にずれがあるときは,そのずれを修正する. 複数のコンテキスト間で異なる境界情報が存在する場合は,候補を コピーしてそれぞれに合わせる. またアラインメントが不正な単語を除去する.
rootp | [i/o] グラフ単語リストのルートポインタ |
mov_num_ret | [out] 境界時間が動いた単語数を格納する変数へのポインタ |
dup_num_ret | [out] コピーされた単語数を格納する変数へのポインタ |
del_num_ret | [out] 削除された単語数を格納する変数へのポインタ |
mod_num_ret | [out] 変更された単語数を格納する変数へのポインタ |
count | [in] グラフ上の単語数 |
maxfnum | |
peseqlen | |
lmtype | |
p_framelist | |
p_framescorelist |
graphout.c の 1237 行で定義されています。
static void wordgraph_compaction_thesame_sub | ( | WordGraph ** | rootp, |
int * | rest_ret, | ||
int * | merged_ret | ||
) | [static] |
グラフ内に境界情報やスコアが全く同一の単語がある場合それらをマージする.
rootp | [i/o] グラフ単語リストのルートポインタ |
rest_ret | [out] マージ後のグラフ内の単語数を返すポインタ |
merged_ret | [out] マージされた単語数を返すポインタ |
graphout.c の 1502 行で定義されています。
参照元 wordgraph_adjust_boundary(), と wordgraph_compaction_thesame().
void wordgraph_adjust_boundary | ( | WordGraph ** | rootp, |
RecogProcess * | r | ||
) |
グラフ後処理その2:単語境界情報の調整.
GRAPHOUT_PRECISE_BOUNDARY 定義時,後続単語に依存した正確な単語境界 を得るために,探索中において,グラフ単語を生成したあとに次回展開時に 事後的に単語境界を移動させる. このため,前後の単語のもつ(移動前の) 境界情報との対応がとれなくなるので,探索終了後に各単語の前後の単語へ 正しい単語境界を伝搬させることで整合性をとる.
単語境界のずれは単語間で伝搬するため,すべての単語境界が動かなくなるまで 調整が繰り返される. 巨大なグラフでは短い単語の沸きだしで処理が終わらない 場合があるが,この場合 GRAPHOUT_LIMIT_BOUNDARY_LOOP を指定することで, 繰り返す数の上限を graphout_limit_boundary_loop_num に制限できる.
rootp | [i/o] 単語グラフのルートノードへのポインタ |
r | [i/o] 認識処理インスタンス |
< frame list for adjust_boundary_sub
< frame score list for adjust_boundary_sub
graphout.c の 1595 行で定義されています。
参照元 wchmm_fbs().
void wordgraph_compaction_thesame | ( | WordGraph ** | rootp | ) |
グラフ後処理その3:単語の束ね(完全同一)
単語境界時刻と部分文仮説スコアが完全に一致する同じ単語どうしを一つに束ねる.
rootp | [i/o] 単語グラフのルートノードへのポインタ |
graphout.c の 1671 行で定義されています。
参照元 wchmm_fbs().
void wordgraph_compaction_exacttime | ( | WordGraph ** | rootp, |
RecogProcess * | r | ||
) |
グラフ後処理その4:単語の束ね(区間同一)
単語境界時刻が一致する同じ単語どうしを一つに束ねる. スコアが 同一でなくても束ねられる. この場合,部分文スコアが最も高い候補が 残る. graph_merge_neighbor_range が 負 の場合は実行されない.
rootp | [i/o] 単語グラフのルートノードへのポインタ |
r | [i/o] 認識処理インスタンス |
graphout.c の 1709 行で定義されています。
参照元 wchmm_fbs().
void wordgraph_compaction_neighbor | ( | WordGraph ** | rootp, |
RecogProcess * | r | ||
) |
グラフ後処理その5:単語の束ね(近傍区間)
似た単語境界時刻を持つ同じ単語どうしを一つに束ねる. 許すずれの幅は graph_merge_neighbor_range で与え,これが 0 か負である場合は実行されない.
rootp | [i/o] 単語グラフのルートノードへのポインタ |
r | [i/o] 認識処理インスタンス |
graphout.c の 1795 行で定義されています。
参照元 wchmm_fbs().
WordGraph* wordgraph_assign | ( | WORD_ID | wid, |
WORD_ID | wid_left, | ||
WORD_ID | wid_right, | ||
int | leftframe, | ||
int | rightframe, | ||
LOGPROB | fscore_head, | ||
LOGPROB | fscore_tail, | ||
LOGPROB | gscore_head, | ||
LOGPROB | gscore_tail, | ||
LOGPROB | lscore, | ||
LOGPROB | cm, | ||
RecogProcess * | r | ||
) |
新たな単語グラフ候補を生成して返す.
この時点ではまだ単語グラフ中には 登録されていない.
wid | [in] 単語ID |
wid_left | [in] word ID of left context for determining head phone |
wid_right | [in] word ID of right context for determining tail phone |
leftframe | [in] 始端時刻(フレーム) |
rightframe | [in] 終端時刻(フレーム) |
fscore_head | [in] 始端での部分文スコア (g + h) |
fscore_tail | [in] 終端での部分文スコア (g + h) |
gscore_head | [in] 先頭での入力末端からのViterbiスコア (g) |
gscore_tail | [in] 末尾での入力末端からのViterbiスコア (g) |
lscore | [in] 言語スコア |
cm | [in] 信頼度 |
r | [in] 認識処理インスタンス |
graphout.c の 1901 行で定義されています。
参照元 wchmm_fbs().
グラフ単語候補を単語グラフの一部として確定する.
確定されたグラフ単語には saved に TRUE がセットされる.
wg | [i/o] 登録するグラフ単語候補 |
right | [i/o] wg の右コンテキストとなる単語 |
root | [i/o] 確定済み単語グラフのルートノードへのポインタ |
graphout.c の 1957 行で定義されています。
参照元 wchmm_fbs().
グラフ単語の情報をテキストで出力する.
内容は以下のとおり:
ID: left=左コンテキストのID[,ID,...] right=右コンテキストID[,ID,..] [左端フレーム..右端フレーム] wid=単語ID name="単語名" lname="N-gram 単語名,あるいはカテゴリ番号 (Julian)" f=探索中の左端での部分文スコア(g(n) + h(n+1)) n=この単語 f_prev=探索中の右端での部分文スコア(g(n-1) + h(n)) n=この単語 g_head=左端での累積Viterbiスコア g(n) g_prev=右端での累積Viterbiスコア g(n-1) + LM(n) lscore=言語スコア LM(n) (Julius の場合のみ) AMavg=フレーム平均音響尤度 cmscore=単語信頼度
fp | [in] 出力先のファイルポインタ |
wg | [in] 出力するグラフ単語 |
winfo | [in] 単語辞書 |
graphout.c の 2193 行で定義されています。
参照元 confnet_create(), graph_forward_backward(), result_confnet(), wordgraph_check_coherence(), wordgraph_dump(), と wordgraph_remove_context().
生成された単語グラフ中の全単語をテキスト出力する.
fp | [in] 出力先のファイルポインタ |
root | [in] 単語グラフのルートノードへのポインタ |
winfo | [in] 単語辞書 |
graphout.c の 2252 行で定義されています。
参照元 graph_forward_backward(), と result_graph().
void wordgraph_check_coherence | ( | WordGraph * | rootp, |
RecogProcess * | r | ||
) |
デバッグ用:単語グラフの整合性をチェックする.
rootp | [in] 単語グラフのルートノードへのポインタ |
r | [i/o] 認識処理インスタンス |
graphout.c の 2281 行で定義されています。
参照元 wchmm_fbs().
単語を右から左へ並べるための qsort コールバック関数
x | [in] 1st element |
y | [in] 2nd element |
graphout.c の 2352 行で定義されています。
単語を左から右へ並べるための qsort コールバック関数
x | [in] 1st element |
y | [in] 2nd element |
graphout.c の 2374 行で定義されています。
compute addition of two probabilities in log10 form.
x | [in] first value |
y | [in] second value |
graphout.c の 2396 行で定義されています。
void graph_forward_backward | ( | WordGraph * | root, |
RecogProcess * | r | ||
) |
生成されたラティス上において,forward-backward アルゴリズムにより 信頼度を計算する.
計算された値は各グラフ単語の graph_cm に格納される. 事後確率の計算では,探索中の信頼度計算と同じ α値(r->config->annotate.cm_alpha)が用いられる.
root | [in] root graph node |
r | [in] recognition process instance |
graphout.c の 2430 行で定義されています。
参照元 find_1pass_result(), と wchmm_fbs().