#include <sent/stddefs.h>
#include <sent/ngram2.h>
Go to the source code of this file.
Functions | |
static NNID | search_ngram_core (NGRAM_INFO *ndata, int n, int 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 ![]() | |
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. |
Definition in file ngram_access.c.
static NNID search_ngram_core | ( | NGRAM_INFO * | ndata, | |
int | n, | |||
int | 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 |
Definition at line 43 of file ngram_access.c.
Referenced by ngram_prob(), and 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 |
Definition at line 103 of file ngram_access.c.
Referenced by add_bigram(), and 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 |
Definition at line 135 of file ngram_access.c.
Referenced by ngram_forw2back(), ngram_prob(), and pick_backtrellis_words().
LOGPROB uni_prob | ( | NGRAM_INFO * | ndata, | |
WORD_ID | w | |||
) |
Get 1-gram probability of in log10.
ndata | [in] word/class N-gram | |
w | [in] word/class ID in N-gram |
Definition at line 229 of file ngram_access.c.
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 |
Definition at line 249 of file ngram_access.c.
Referenced by bi_prob_additional(), bi_prob_additional_oldbin(), bi_prob_compute(), and 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 |
Definition at line 288 of file ngram_access.c.
Referenced by bi_prob(), and 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 |
Definition at line 320 of file ngram_access.c.
Referenced by bi_prob(), and 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 |
Definition at line 351 of file ngram_access.c.
Referenced by bi_prob(), and 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 |
Definition at line 383 of file ngram_access.c.
Referenced by bi_prob(), and 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 |
Definition at line 419 of file ngram_access.c.
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 |
Definition at line 449 of file ngram_access.c.
Referenced by ngram_read_arpa(), and ngram_read_bin().