Julius 4.2
関数
libsent/src/ngram/ngram_access.c

単語列・クラス列の N-gram 確率を求める [詳細]

#include <sent/stddefs.h>
#include <sent/ngram2.h>

ソースコードを見る。

関数

static NNID search_ngram_core (NGRAM_INFO *ndata, int n, NNID nid_prev, WORD_ID wkey)
 Search for n-gram tuple.
NNID search_ngram (NGRAM_INFO *ndata, int n, WORD_ID *w)
 Search for N-tuples.
LOGPROB ngram_prob (NGRAM_INFO *ndata, int n, WORD_ID *w)
 Get N-gram probability of the last word w_n, given context w_1^n-1.
LOGPROB uni_prob (NGRAM_INFO *ndata, WORD_ID w)
 Get 1-gram probability of $w$ in log10.
static NNID search_bigram (NGRAM_INFO *ndata, WORD_ID w_context, WORD_ID w)
 Find bi-gram entry.
static LOGPROB bi_prob_normal (NGRAM_INFO *ndata, WORD_ID w1, WORD_ID w2)
 Get LR bi-gram prob: for LR N-gram.
static LOGPROB bi_prob_additional_oldbin (NGRAM_INFO *ndata, WORD_ID w1, WORD_ID w2)
 Get LR bi-gram prob: for RL N-gram with additional LR 2-gram, in old bingram format.
static LOGPROB bi_prob_additional (NGRAM_INFO *ndata, WORD_ID w1, WORD_ID w2)
 Get LR bi-gram prob: for RL N-gram with additional LR 2-gram.
static LOGPROB bi_prob_compute (NGRAM_INFO *ndata, WORD_ID w1, WORD_ID w2)
 Get LR bi-gram prob: for RL N-gram with no LR 2-gram.
LOGPROB bi_prob (NGRAM_INFO *ndata, WORD_ID w1, WORD_ID w2)
 Get 2-gram probability This function is not used in Julius, since each function of bi_prob_* will be called directly from the search.
void bi_prob_func_set (NGRAM_INFO *ndata)
 Determinte which bi-gram computation function to be used according to the N-gram type, and set pointer to the proper function into the N-gram data.

説明

単語列・クラス列の N-gram 確率を求める

作者:
Akinobu LEE
日付:
Wed Feb 16 07:46:18 2005
Revision:
1.6

ngram_access.c で定義されています。


関数

static NNID search_ngram_core ( NGRAM_INFO ndata,
int  n,
NNID  nid_prev,
WORD_ID  wkey 
) [static]

Search for n-gram tuple.

引数:
ndata[in] word/class N-gram
n[in] N of N-gram
nid_prev[in] context (N-1)-gram tuple ID
wkey[in] the target word ID
戻り値:
corresponding index to the 2-gram data part if found, or NNID_INVALID if the tuple does not exist in 2-gram.

ngram_access.c43 行で定義されています。

参照元 ngram_prob(), と search_ngram().

NNID search_ngram ( NGRAM_INFO ndata,
int  n,
WORD_ID w 
)

Search for N-tuples.

引数:
ndata[in] word/class N-gram
n[in] N of N-gram (= number of words in w)
w[in] word sequence
戻り値:

ngram_access.c103 行で定義されています。

参照元 add_bigram(), と set_ngram().

LOGPROB ngram_prob ( NGRAM_INFO ndata,
int  n,
WORD_ID w 
)

Get N-gram probability of the last word w_n, given context w_1^n-1.

引数:
ndata[in] word/class N-gram
n[in] N of N-gram (= number of words in w)
w[in] word sequence
戻り値:

ngram_access.c135 行で定義されています。

参照元 ngram_forw2back(), ngram_prob(), と pick_backtrellis_words().

LOGPROB uni_prob ( NGRAM_INFO ndata,
WORD_ID  w 
)

Get 1-gram probability of $w$ in log10.

引数:
ndata[in] word/class N-gram
w[in] word/class ID in N-gram
戻り値:
log10 probability $\log p(w)$.

ngram_access.c229 行で定義されています。

参照元 build_wchmm(), build_wchmm2(), max_successor_prob(), と ngram_firstwords().

static NNID search_bigram ( NGRAM_INFO ndata,
WORD_ID  w_context,
WORD_ID  w 
) [static]

Find bi-gram entry.

Assumes ct_compaction and is24bit is FALSE on 2-gram

引数:
ndata[in] N-gram data that holds the 2-gram
w_context[in] context word ID
w[in] target word ID
戻り値:
the ID of N-gram tuple entry ID where the (w_context, w) exists.

ngram_access.c249 行で定義されています。

参照元 bi_prob_additional(), bi_prob_additional_oldbin(), bi_prob_compute(), と bi_prob_normal().

static LOGPROB bi_prob_normal ( NGRAM_INFO ndata,
WORD_ID  w1,
WORD_ID  w2 
) [static]

Get LR bi-gram prob: for LR N-gram.

引数:
ndata[in] N-gram data that holds the 2-gram
w1[in] left context word
w2[in] right target word
戻り値:
the log N-gram probability P(w2|w1)

ngram_access.c288 行で定義されています。

参照元 bi_prob(), と bi_prob_func_set().

static LOGPROB bi_prob_additional_oldbin ( NGRAM_INFO ndata,
WORD_ID  w1,
WORD_ID  w2 
) [static]

Get LR bi-gram prob: for RL N-gram with additional LR 2-gram, in old bingram format.

The old format has 2-gram index in reversed orfer, so this function is for old bingram formats.

引数:
ndata[in] N-gram data that holds the 2-gram
w1[in] left context word
w2[in] right target word
戻り値:
the log N-gram probability P(w2|w1)

ngram_access.c320 行で定義されています。

参照元 bi_prob(), と bi_prob_func_set().

static LOGPROB bi_prob_additional ( NGRAM_INFO ndata,
WORD_ID  w1,
WORD_ID  w2 
) [static]

Get LR bi-gram prob: for RL N-gram with additional LR 2-gram.

引数:
ndata[in] N-gram data that holds the 2-gram
w1[in] left context word
w2[in] right target word
戻り値:
the log N-gram probability P(w2|w1)

ngram_access.c351 行で定義されています。

参照元 bi_prob(), と bi_prob_func_set().

static LOGPROB bi_prob_compute ( NGRAM_INFO ndata,
WORD_ID  w1,
WORD_ID  w2 
) [static]

Get LR bi-gram prob: for RL N-gram with no LR 2-gram.

This function will compute the LR 2-gram from the RL 2-gram.

引数:
ndata[in] N-gram data that holds the 2-gram
w1[in] left context word
w2[in] right target word
戻り値:
the log N-gram probability P(w2|w1)

ngram_access.c383 行で定義されています。

参照元 bi_prob(), と bi_prob_func_set().

LOGPROB bi_prob ( NGRAM_INFO ndata,
WORD_ID  w1,
WORD_ID  w2 
)

Get 2-gram probability This function is not used in Julius, since each function of bi_prob_* will be called directly from the search.

引数:
ndata[in] N-gram data that holds the 2-gram
w1[in] left context word
w2[in] right target word
戻り値:
the log N-gram probability P(w2|w1)

ngram_access.c419 行で定義されています。

void bi_prob_func_set ( NGRAM_INFO ndata)

Determinte which bi-gram computation function to be used according to the N-gram type, and set pointer to the proper function into the N-gram data.

引数:
ndata[i/o] N-gram information to use

ngram_access.c449 行で定義されています。

参照元 ngram_read_arpa(), と ngram_read_bin().