libsent/src/ngram/ngram_access.c File Reference

Get N-gram probability of a word/class sequence. More...

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

Include dependency graph for ngram_access.c:

Go to the source code of this file.

Functions

NNID search_bigram (NGRAM_INFO *ndata, WORD_ID w_l, WORD_ID w_r)
static NNID search_trigram_v3 (NGRAM_INFO *ndata, NNID n2, WORD_ID wkey)
static NNID search_trigram_v4 (NGRAM_INFO *ndata, NNID n2, WORD_ID wkey)
LOGPROB uni_prob (NGRAM_INFO *ndata, WORD_ID w)
LOGPROB bi_prob_lr (NGRAM_INFO *ndata, WORD_ID w1, WORD_ID w2)
LOGPROB bi_prob_rl (NGRAM_INFO *ndata, WORD_ID w1, WORD_ID w2)
LOGPROB tri_prob_rl (NGRAM_INFO *ndata, WORD_ID w1, WORD_ID w2, WORD_ID w3)


Detailed Description

Get N-gram probability of a word/class sequence.

Author:
Akinobu LEE
Date:
Wed Feb 16 07:46:18 2005
Revision
1.5

Definition in file ngram_access.c.


Function Documentation

NNID search_bigram ( NGRAM_INFO ndata,
WORD_ID  w_l,
WORD_ID  w_r 
)

Search for 2-gram tuple (w_l, w_r) in the 2-gram part of N-gram.

Parameters:
ndata [in] word/class N-gram
w_l [in] left word/class ID in N-gram
w_r [in] right word/class ID in N-gram
Returns:
corresponding index to the 2-gram data part if found, or NNID_INVALID if the tuple does not exist in 2-gram.

Definition at line 39 of file ngram_access.c.

Referenced by add_bigram_rl(), bi_prob_lr(), bi_prob_rl(), and tri_prob_rl().

static NNID search_trigram_v3 ( NGRAM_INFO ndata,
NNID  n2,
WORD_ID  wkey 
) [static]

Search for a reverse 3-gram tuple (wkey, w1, w2), where the context 2-gram tuple (w1, w2) should exist on 2-gram data part at n2.

(for v3 struture format)

Parameters:
ndata [in] word/class N-gram
n2 [in] 2-gram data part where context 2-gram data exists.
wkey [in] left word/class ID in N-gram
Returns:
corresponding index to the 3-gram data part if found, or NNID_INVALID if the 3-gram does not exist.

Definition at line 77 of file ngram_access.c.

Referenced by tri_prob_rl().

static NNID search_trigram_v4 ( NGRAM_INFO ndata,
NNID  n2,
WORD_ID  wkey 
) [static]

Search for a reverse 3-gram tuple (wkey, w1, w2), where the context 2-gram tuple (w1, w2) should exist on 2-gram data part at n2.

(for v4 struture format)

Parameters:
ndata [in] word/class N-gram
n2 [in] 2-gram data part where context 2-gram data exists.
wkey [in] left word/class ID in N-gram
Returns:
corresponding index to the 3-gram data part if found, or NNID_INVALID if the 3-gram does not exist.

Definition at line 115 of file ngram_access.c.

Referenced by tri_prob_rl().

LOGPROB uni_prob ( NGRAM_INFO ndata,
WORD_ID  w 
)

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

Parameters:
ndata [in] word/class N-gram
w [in] word/class ID in N-gram
Returns:
log10 probability $\log p(w)$.

Definition at line 154 of file ngram_access.c.

Referenced by get_nbest_uniprob(), max_successor_prob(), and pick_backtrellis_words().

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

Get LR 2-gram probability of word/class sequence $(w_1, w_2)$ in log10

Parameters:
ndata [in] word/class N-gram
w1 [in] left word/class ID in N-gram
w2 [in] right word/class ID in N-gram (to compute probability)
Returns:
log10 probability $\log p(w_2|w_1)$.

Definition at line 175 of file ngram_access.c.

Referenced by max_successor_prob(), and max_successor_prob_iw().

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

Get RL 2-gram probability of word/class sequence $(w_1, w_2)$ in log10.

Parameters:
ndata [in] word/class N-gram
w1 [in] left word/class ID in N-gram (to compute probability)
w2 [in] right word/class ID in N-gram
Returns:
log10 probability $\log p(w_1|w_2)$.

Definition at line 206 of file ngram_access.c.

Referenced by pick_backtrellis_words(), and tri_prob_rl().

LOGPROB tri_prob_rl ( NGRAM_INFO ndata,
WORD_ID  w1,
WORD_ID  w2,
WORD_ID  w3 
)

Get RL 3-gram probability of word/class sequence $(w_1, w_2, w_3)$ in log10.

Parameters:
ndata [in] word/class N-gram
w1 [in] left word/class ID in N-gram (to compute probability)
w2 [in] middle word/class ID in N-gram
w3 [in] right word/class ID in N-gram
Returns:
log10 probability $\log p(w_1|w_2, w_3)$.

Definition at line 239 of file ngram_access.c.

Referenced by pick_backtrellis_words().


Generated on Tue Dec 26 16:18:04 2006 for Julius by  doxygen 1.5.0