libsent/src/dfa/cpair.c File Reference

Category-pair constraint handling. More...

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

Go to the source code of this file.

Functions

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.
void set_dfa_cp (DFA_INFO *dfa, int i, int j, boolean value)
 Set the category-pair matrix bit.
void set_dfa_cp_begin (DFA_INFO *dfa, int i, boolean value)
 Set the category-pair matrix bit at the beginning of sentence.
void set_dfa_cp_end (DFA_INFO *dfa, int i, boolean value)
 Set the category-pair matrix bit at 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)
 Allocate memory for category pair matrix and initialize it.
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.
void free_dfa_cp (DFA_INFO *dfa)
 Free the category pair matrix from DFA grammar.

Variables

static unsigned char cp_table []
 Bit mask to access category-pair matrix.


Detailed Description

Category-pair constraint handling.

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.

Author:
Akinobu LEE
Date:
Tue Feb 15 13:54:44 2005
Revision
1.1.1.1

Definition in file cpair.c.


Function Documentation

boolean dfa_cp ( DFA_INFO dfa,
int  i,
int  j 
)

Return whether the given two category can be connected or not.

Parameters:
dfa [in] DFA grammar holding category pair matrix
i [in] category id of left word
j [in] category id of right word
Returns:
TRUE if connection is allowed by the grammar, FALSE if prohibited.

Definition at line 49 of file cpair.c.

Referenced by cpair_append(), and print_dfa_cp().

boolean dfa_cp_begin ( DFA_INFO dfa,
int  i 
)

Return whether the category can be appear at the beginning of sentence.

Parameters:
dfa [in] DFA grammar holding category pair matrix
i [in] category id of the word
Returns:
TRUE if it can appear at the beginning of sentence, FALSE if not.

Definition at line 64 of file cpair.c.

Referenced by cpair_append(), and print_dfa_cp().

boolean dfa_cp_end ( DFA_INFO dfa,
int  i 
)

Return whether the category can be appear at the end of sentence.

Parameters:
dfa [in] DFA grammar holding category pair matrix
i [in] category id of the word
Returns:
TRUE if it can appear at the end of sentence, FALSE if not.

Definition at line 79 of file cpair.c.

Referenced by cpair_append(), and print_dfa_cp().

void set_dfa_cp ( DFA_INFO dfa,
int  i,
int  j,
boolean  value 
)

Set the category-pair matrix bit.

Parameters:
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 94 of file cpair.c.

Referenced by cpair_append(), extract_cpair(), malloc_dfa_cp(), and realloc_dfa_cp().

void set_dfa_cp_begin ( DFA_INFO dfa,
int  i,
boolean  value 
)

Set the category-pair matrix bit at the beginning of sentence.

Parameters:
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 113 of file cpair.c.

Referenced by cpair_append(), extract_cpair(), malloc_dfa_cp(), and realloc_dfa_cp().

void set_dfa_cp_end ( DFA_INFO dfa,
int  i,
boolean  value 
)

Set the category-pair matrix bit at the end of sentence.

Parameters:
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 132 of file cpair.c.

Referenced by cpair_append(), extract_cpair(), malloc_dfa_cp(), and realloc_dfa_cp().

void init_dfa_cp ( DFA_INFO dfa  ) 

Initialize category pair matrix in the grammar data.

Parameters:
dfa [out] DFA grammar to hold category pair matrix

Definition at line 148 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.

Parameters:
dfa [out] DFA grammar to hold category pair matrix
term_num [in] number of categories in the grammar

Definition at line 163 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.

Parameters:
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 194 of file cpair.c.

Referenced by cpair_append().

void free_dfa_cp ( DFA_INFO dfa  ) 

Free the category pair matrix from DFA grammar.

Parameters:
dfa [i/o] DFA grammar holding category pair matrix

Definition at line 255 of file cpair.c.

Referenced by dfa_info_free().


Variable Documentation

unsigned char cp_table[] [static]

Initial value:

 {
  0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80
}
Bit mask to access category-pair matrix.

Definition at line 35 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().


Generated on Tue Dec 18 16:01:38 2007 for Julius by  doxygen 1.5.4