#include <sent/stddefs.h>
#include <sent/dfa.h>
Go to the source code of this file.
Functions | |
static int | cp_find (int *list, int len, int key, int *loc) |
Search for a terminal ID in a cp list. | |
boolean | dfa_cp (DFA_INFO *dfa, int i, int j) |
Return whether the given two category can be connected or not. | |
boolean | dfa_cp_begin (DFA_INFO *dfa, int i) |
Return whether the category can be appear at the beginning of sentence. | |
boolean | dfa_cp_end (DFA_INFO *dfa, int i) |
Return whether the category can be appear at the end of sentence. | |
static boolean | cp_add (int **list, int *len, int *alloclen, int val, int loc) |
Add an terminal ID to a specified location in the cp list. | |
static boolean | cp_remove (int **list, int *len, int loc) |
Remove an element from the cp list. | |
void | set_dfa_cp (DFA_INFO *dfa, int i, int j, boolean value) |
Set a category-pair matrix bit. | |
void | set_dfa_cp_begin (DFA_INFO *dfa, int i, boolean value) |
Set a category-pair matrix bit for the beginning of sentence. | |
void | set_dfa_cp_end (DFA_INFO *dfa, int i, boolean value) |
Set a category-pair matrix bit for the end of sentence. | |
void | init_dfa_cp (DFA_INFO *dfa) |
Initialize category pair matrix in the grammar data. | |
void | malloc_dfa_cp (DFA_INFO *dfa, int term_num, int size) |
Allocate memory for category pair matrix and initialize it. | |
boolean | dfa_cp_append (DFA_INFO *dfa, DFA_INFO *src, int offset) |
Append a categori-pair matrix to another. | |
void | free_dfa_cp (DFA_INFO *dfa) |
Free the category pair matrix from DFA grammar. | |
void | dfa_cp_output_rawdata (FILE *fp, DFA_INFO *dfa) |
void | dfa_cp_count_size (DFA_INFO *dfa, unsigned long *size_ret, unsigned long *allocsize_ret) |
Functions to allocate memory for category-pair constraint, and functions to return whether the given category pairs can be connected or not are defined here.
Definition in file cpair.c.
static int cp_find | ( | int * | list, | |
int | len, | |||
int | key, | |||
int * | loc | |||
) | [static] |
Search for a terminal ID in a cp list.
Set its location to loc. When not found, the location where to insert the key data iwill be set.
list | [in] cp list | |
len | [in] length of list | |
key | [in] a terminal ID value to find | |
loc | [out] return the to-be-inserted location of the key |
Definition at line 47 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().
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 91 of file cpair.c.
Referenced by beam_inter_word(), can_succeed(), lcdset_register_with_category(), and lcdset_register_with_category_all().
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 109 of file cpair.c.
Referenced by can_succeed(), and init_nodescore().
static boolean cp_add | ( | int ** | list, | |
int * | len, | |||
int * | alloclen, | |||
int | val, | |||
int | loc | |||
) | [static] |
Add an terminal ID to a specified location in the cp list.
list | [i/o] cp list | |
len | [i/o] data num in the list | |
alloclen | [i/o] allocated length of the list | |
val | [in] value to be added | |
loc | [in] location where to add the val |
Definition at line 147 of file cpair.c.
Referenced by set_dfa_cp(), set_dfa_cp_begin(), and set_dfa_cp_end().
static boolean cp_remove | ( | int ** | list, | |
int * | len, | |||
int | loc | |||
) | [static] |
Remove an element from the cp list.
list | [i/o] cp list | |
len | [i/o] data num in the list | |
loc | [in] location of removing value |
Definition at line 176 of file cpair.c.
Referenced by set_dfa_cp(), set_dfa_cp_begin(), and set_dfa_cp_end().
Set a category-pair matrix bit for 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 251 of file cpair.c.
Referenced by extract_cpair().
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 274 of file cpair.c.
Referenced by dfa_info_new().
void malloc_dfa_cp | ( | DFA_INFO * | dfa, | |
int | term_num, | |||
int | size | |||
) |
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 | |
size | [in] memory allocation length for each cp list as initial |
Definition at line 287 of file cpair.c.
Referenced by extract_cpair().
Append a categori-pair matrix to another.
This function assumes that other grammar information has been already appended and dfa->term_num contains the new size.
dfa | [i/o] DFA grammar to which the new category pair will be appended | |
src | [in] source DFA | |
offset | [in] appending point at dfa |
Definition at line 319 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 396 of file cpair.c.
Referenced by dfa_info_free().