#include <sent/stddefs.h>
#include <sent/dfa.h>
Include dependency graph for cpair.c:
Go to the source code of this file.
Functions | |
boolean | dfa_cp (DFA_INFO *dfa, int i, int j) |
boolean | dfa_cp_begin (DFA_INFO *dfa, int i) |
boolean | dfa_cp_end (DFA_INFO *dfa, int i) |
void | set_dfa_cp (DFA_INFO *dfa, int i, int j, boolean value) |
void | set_dfa_cp_begin (DFA_INFO *dfa, int i, boolean value) |
void | set_dfa_cp_end (DFA_INFO *dfa, int i, boolean value) |
void | init_dfa_cp (DFA_INFO *dfa) |
void | malloc_dfa_cp (DFA_INFO *dfa, int term_num) |
void | realloc_dfa_cp (DFA_INFO *dfa, int old_term_num, int new_term_num) |
void | free_dfa_cp (DFA_INFO *dfa) |
Variables | |
static unsigned char | cp_table [] |
Bit mask to access category-pair matrix. |
Definition in file cpair.c.
Return whether the given two category can be connected or not.
dfa | [in] DFA grammar holding category pair matrix | |
i | [in] category id of left word | |
j | [in] category id of right word |
Definition at line 48 of file cpair.c.
Referenced by cpair_append(), lcdset_register_with_category(), lcdset_register_with_category_all(), and print_dfa_cp().
Return whether the category can be appear at the beginning of sentence.
dfa | [in] DFA grammar holding category pair matrix | |
i | [in] category id of the word |
Definition at line 63 of file cpair.c.
Referenced by cpair_append(), init_nodescore(), and print_dfa_cp().
Return whether the category can be appear at the end of sentence.
dfa | [in] DFA grammar holding category pair matrix | |
i | [in] category id of the word |
Definition at line 78 of file cpair.c.
Referenced by cpair_append(), and print_dfa_cp().
Set the category-pair matrix bit
dfa | [out] DFA grammar holding category pair matrix | |
i | [in] category id of left word | |
j | [in] category id of right word | |
value | TRUE if connection allowed, FALSE if connection prohibited. |
Definition at line 93 of file cpair.c.
Referenced by cpair_append(), malloc_dfa_cp(), and realloc_dfa_cp().
Set the category-pair matrix bit at the beginning of sentence
dfa | [out] DFA grammar holding category pair matrix | |
i | [in] category id of the word | |
value | TRUE if the category can appear at the beginning of sentence, FALSE if not. |
Definition at line 112 of file cpair.c.
Referenced by cpair_append(), and realloc_dfa_cp().
Set the category-pair matrix bit at the end of sentence
dfa | [out] DFA grammar holding category pair matrix | |
i | [in] category id of the word | |
value | TRUE if the category can appear at the end of sentence, FALSE if not. |
Definition at line 131 of file cpair.c.
Referenced by cpair_append(), extract_cpair(), and realloc_dfa_cp().
void init_dfa_cp | ( | DFA_INFO * | dfa | ) |
Initialize category pair matrix in the grammar data.
dfa | [out] DFA grammar to hold category pair matrix |
Definition at line 147 of file cpair.c.
Referenced by dfa_info_new().
void malloc_dfa_cp | ( | DFA_INFO * | dfa, | |
int | term_num | |||
) |
Allocate memory for category pair matrix and initialize it.
dfa | [out] DFA grammar to hold category pair matrix | |
term_num | [in] number of categories in the grammar |
Definition at line 162 of file cpair.c.
Referenced by extract_cpair(), and realloc_dfa_cp().
void realloc_dfa_cp | ( | DFA_INFO * | dfa, | |
int | old_term_num, | |||
int | new_term_num | |||
) |
Re-allocate memory for category pair matrix, can be called when the number of category is expanded.
dfa | [I/O] DFA grammar holding category pair matrix | |
old_term_num | [in] number of categories when the last category pair matrix was allocated | |
new_term_num | [in] new number of categories in the grammar |
Definition at line 193 of file cpair.c.
Referenced by cpair_append().
void free_dfa_cp | ( | DFA_INFO * | dfa | ) |
Free the category pair matrix from DFA grammar.
dfa | [i/o] DFA grammar holding category pair matrix |
Definition at line 254 of file cpair.c.
Referenced by dfa_info_free().
unsigned char cp_table[] [static] |
Initial value:
{ 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80 }
Definition at line 34 of file cpair.c.
Referenced by dfa_cp(), dfa_cp_begin(), dfa_cp_end(), set_dfa_cp(), set_dfa_cp_begin(), and set_dfa_cp_end().