Main Page | Modules | Data Structures | Directories | File List | Data Fields | Globals | Related Pages

cpair.c File Reference

Category-pair constraint handling. More...

#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.


Detailed Description

Category-pair constraint handling.

Author:
Akinobu LEE
Date:
Tue Feb 15 13:54:44 2005
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.

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 48 of file cpair.c.

Referenced by cpair_append(), get_back_trellis_proceed(), 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 63 of file cpair.c.

Referenced by cpair_append(), init_nodescore(), 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 78 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 93 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 112 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 131 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 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.

Parameters:
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.

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 193 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 254 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 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().


Generated on Tue Mar 28 16:02:59 2006 for Julius by  doxygen 1.4.2