sxspell_mngr.c File Reference

#include "sxversion.h"
#include "sxunix.h"
#include "fsa.h"
#include "sxspell.h"
#include "sxstack.h"
#include "varstr.h"
#include "X.h"
Include dependency graph for sxspell_mngr.c:

Go to the source code of this file.

Defines

#define FSA_has_path(p, q)
#define UNDEF_WEIGHT   UNBOUNDED
#define MAKE_KEY(n, p, q)   (((((n)<<KEY_SHIFT)+(p))<<KEY_SHIFT)+(q))
#define CHAR_SET_SIZE   (SXNBLONGS (256)+1)
#define AREA_SHIFT   7
#define AREA_AND   (~((~0)<<AREA_SHIFT))
#define AREA_SIZE   (1<<AREA_SHIFT)
#define AREA_PAGE(n)   ((n)>>AREA_SHIFT)
#define AREA_DELTA(n)   ((n)&AREA_AND)
#define AREA2TRANS(fsa, id)   fsa->area [AREA_PAGE (id)] [AREA_DELTA (id)]
#define AREA_RAZ(fsa)   fsa->area_id = 0
#define SXBA_fdcl(n, l)   SXBA_ELT n [SXNBLONGS (l) + 1] = {l,}
#define unicode   ((SXINT) (unsigned char) '\201')
#define get_total_weight(weight)   ((weight).pos+(weight).neg)
#define WEIGHT_NB_SHIFT   24
#define ID_NB_AND   0XFFFFFF
#define spell_result_erase_bloc(x)   (DTOP (spell_result_id_stack) = (x)-1)

Functions

static void key_hd_oflw (SXINT old_size, SXINT new_size)
static void area_allocate2 (struct FSA *FSA, SXINT i)
static void area_allocate (struct FSA *FSA, SXINT size)
static void area_oflw (SXINT old_size, SXINT new_size)
static void area_free (struct FSA *FSA)
static void words_oflw (SXINT old_size, SXINT new_size)
void sxspell_init (struct sxdfa_comb *dico, struct FSA *FSA, unsigned char kind, SXINT max_weight, SXINT cmp_weight, SXBOOLEAN seek_sub_words, SXINT sub_word_weight)
void sxspell_final (struct FSA *FSA)
void sxspell_init_fsa (char *mot, SXINT lgth, struct FSA *FSA)
void sxspell_final_fsa (struct FSA *FSA)
static SXBA_fdcl (working_char_set, 256)
static SXBA_fdcl (replace_set, 256)
static struct weight get_new_compose_weight (struct weight old_weight, struct weight oper_weight, SXINT oper_nb)
static struct weight get_new_min_weight (struct weight old_weight, struct weight new_weight)
void sxspell_no_repeat (struct FSA *FSA, SXINT p, SXINT nr_weight)
void sxspell_replace (struct FSA *FSA, unsigned char *R[], SXINT R_size, SXINT replace_weight)
void sxspell_replace_n_p (struct FSA *FSA, unsigned char *R[], SXINT R_size, SXINT replace_weight)
void sxspell_suppress_all (struct FSA *FSA, SXINT sup_weight)
void sxspell_suppress_i (struct FSA *FSA, SXINT sup_weight, SXINT i)
void sxspell_swap (struct FSA *FSA, SXINT swp_weight)
void sxspell_add (struct FSA *FSA, SXINT pos, unsigned char *V, SXINT iw)
void sxspell_change (struct FSA *FSA, SXINT pos, unsigned char *V, SXINT cw)
static SXINT spell_result_stack_push (SXINT id)
static void store_sub_word (SXINT id, struct weight weight, SXBOOLEAN is_an_old_id)
void store_word (SXINT code)
static struct weight get_weight (struct weight weight1, struct weight weight2)
static SXBOOLEAN FSA_walk_done (SXINT p, SXINT q)
static void FSA_walk_eps_trans (SXINT p, SXINT q, SXINT code)
static void dico_walk (unsigned char cur_char, struct weight cur_weight, SXINT p, SXINT q)
static SXINT dico_process_base (SXINT p, SXINT q)
static void FSA_walk (SXINT p, SXINT q)
static void call_FSA_walk (SXINT p, SXINT q)
static SXINT merge_compare (SXINT *p1, SXINT *p2)
static void merge_spell_result_stack (SXINT top, SXINT x, SXINT y, SXINT additional_cost)
static SXBOOLEAN memo_is_valid (SXINT x)
static void fill_spell_result_stacks (SXINT top, SXINT x)
static SXINT fill_memo_stacks (SXINT top)
static SXINT get_space_nb (SXINT p, SXINT q)
static SXINT memo_cut_in_subwords (SXINT p, SXINT q, SXINT cut_nb)
static void call_cut (void)
SXBOOLEAN sxspell_do_it (struct FSA *FSA)

Variables

static char ME [] = "sxspell_mngr"
char WHAT_SXSPELL_MNGR [] = "@(#)SYNTAX - $Id: sxspell_mngr.c 1740 2009-06-04 13:09:18Z sagot $" WHAT_DEBUG
static struct FSA * cur_FSA
static struct spell_result * cur_spell_result
static struct sxdfa_comb * cur_dico
static SXINT * spell_result_id_stack
static XH_header * cur_multiple_word_ids_ptr
static struct weight * spell_result_weight_stack
static SXINT cross_id_size
static SXINT * cross_id
static struct weight * cross_weight
static struct weight * ij_weights
static SXINT sorted_size
static SXINT * sorted
static SXINT * ij_total_weights
static SXINT * ij_ids
static SXINT cur_spell_result_stack_bot
static SXINT * fsa_state2local_path
static SXINT local_path_nb
static SXINT * fsa_state2lequiv
static SXINT * fsa_state2requiv
static SXINT fsa_state2equiv_size
static SXINT underflow_nb
static SXBOOLEAN FSA_HAS_EPS_TRANS
static SXINT MEMO_BASE
static SXBOOLEAN WORD_HAS_SPACES
static SXINT * memo_hd
static SXINT * memo_id_stack
static SXINT * memo_weight_limit
static struct weight * memo_weight_stack
static X_header key_hd
static SXINT * key2index
static SXINT KEY_SHIFT
static VARSTR lvstr
static VARSTR rvstr
static struct weight NUL_WEIGHT total_weight
static SXBOOLEAN is_suffix
static SXUINT base
static SXUINT tooth
static SXUINT base_shift
static SXUINT class_mask
static SXUINT stop_mask
static SXUINT last_final_id
static SXUINT * comb_vector
static unsigned charchar2class
static unsigned charreplace_strings [256]

Define Documentation

#define AREA2TRANS ( fsa,
id   )     fsa->area [AREA_PAGE (id)] [AREA_DELTA (id)]
#define AREA_AND   (~((~0)<<AREA_SHIFT))

Definition at line 145 of file sxspell_mngr.c.

#define AREA_DELTA ( n   )     ((n)&AREA_AND)

Definition at line 148 of file sxspell_mngr.c.

#define AREA_PAGE ( n   )     ((n)>>AREA_SHIFT)

Definition at line 147 of file sxspell_mngr.c.

Referenced by area_allocate(), and area_oflw().

#define AREA_RAZ ( fsa   )     fsa->area_id = 0

Definition at line 151 of file sxspell_mngr.c.

Referenced by area_allocate(), and sxspell_init_fsa().

#define AREA_SHIFT   7

Definition at line 144 of file sxspell_mngr.c.

#define AREA_SIZE   (1<<AREA_SHIFT)

Definition at line 146 of file sxspell_mngr.c.

Referenced by area_allocate2().

#define CHAR_SET_SIZE   (SXNBLONGS (256)+1)

Definition at line 141 of file sxspell_mngr.c.

Referenced by area_allocate2().

#define FSA_has_path ( p,
q   ) 
Value:

Definition at line 97 of file sxspell_mngr.c.

Referenced by FSA_walk().

#define get_total_weight ( weight   )     ((weight).pos+(weight).neg)
#define ID_NB_AND   0XFFFFFF
#define MAKE_KEY ( n,
p,
q   )     (((((n)<<KEY_SHIFT)+(p))<<KEY_SHIFT)+(q))

Definition at line 130 of file sxspell_mngr.c.

Referenced by memo_cut_in_subwords().

#define spell_result_erase_bloc (  )     (DTOP (spell_result_id_stack) = (x)-1)

Definition at line 1338 of file sxspell_mngr.c.

Referenced by memo_cut_in_subwords().

#define SXBA_fdcl ( n,
 )     SXBA_ELT n [SXNBLONGS (l) + 1] = {l,}

Definition at line 427 of file sxspell_mngr.c.

#define UNDEF_WEIGHT   UNBOUNDED

Definition at line 104 of file sxspell_mngr.c.

#define unicode   ((SXINT) (unsigned char) '\201')

Definition at line 433 of file sxspell_mngr.c.

Referenced by sxspell_replace(), and sxspell_replace_n_p().

#define WEIGHT_NB_SHIFT   24

Function Documentation

static void area_allocate ( struct FSA *  FSA,
SXINT  size 
) [static]

Definition at line 177 of file sxspell_mngr.c.

References area_allocate2(), AREA_PAGE, and AREA_RAZ.

Referenced by sxspell_init_fsa().

static void area_allocate2 ( struct FSA *  FSA,
SXINT  i 
) [static]

Definition at line 154 of file sxspell_mngr.c.

References AREA_SIZE, CHAR_SET_SIZE, and p.

Referenced by area_allocate(), and area_oflw().

static void area_free ( struct FSA *  FSA  )  [static]

Definition at line 211 of file sxspell_mngr.c.

References p.

Referenced by sxspell_final_fsa().

static void area_oflw ( SXINT  old_size,
SXINT  new_size 
) [static]

Definition at line 192 of file sxspell_mngr.c.

References area_allocate2(), AREA_PAGE, and cur_FSA.

Referenced by sxspell_init_fsa().

static void call_cut ( void   )  [static]
static void call_FSA_walk ( SXINT  p,
SXINT  q 
) [static]

Definition at line 1983 of file sxspell_mngr.c.

References cur_FSA, FSA_walk(), and sxba_scan().

Referenced by sxspell_do_it().

static SXINT dico_process_base ( SXINT  p,
SXINT  q 
) [static]

Definition at line 1743 of file sxspell_mngr.c.

References base, base_shift, class_mask, comb_vector, FSA_walk_done(), last_final_id, stop_mask, store_word(), and tooth.

Referenced by FSA_walk().

static void dico_walk ( unsigned char  cur_char,
struct weight  cur_weight,
SXINT  p,
SXINT  q 
) [static]
static SXINT fill_memo_stacks ( SXINT  top  )  [static]
static void fill_spell_result_stacks ( SXINT  top,
SXINT  x 
) [static]
static void FSA_walk ( SXINT  p,
SXINT  q 
) [static]
static SXBOOLEAN FSA_walk_done ( SXINT  p,
SXINT  q 
) [static]

Definition at line 1675 of file sxspell_mngr.c.

Referenced by dico_process_base(), dico_walk(), FSA_walk(), and FSA_walk_eps_trans().

static void FSA_walk_eps_trans ( SXINT  p,
SXINT  q,
SXINT  code 
) [static]
static struct weight get_new_compose_weight ( struct weight  old_weight,
struct weight  oper_weight,
SXINT  oper_nb 
) [static, read]
static struct weight get_new_min_weight ( struct weight  old_weight,
struct weight  new_weight 
) [static, read]
static SXINT get_space_nb ( SXINT  p,
SXINT  q 
) [static]

Definition at line 2502 of file sxspell_mngr.c.

References cur_FSA.

Referenced by call_cut(), and memo_cut_in_subwords().

static struct weight get_weight ( struct weight  weight1,
struct weight  weight2 
) [static, read]

Definition at line 1660 of file sxspell_mngr.c.

References cur_spell_result.

Referenced by dico_walk(), FSA_walk_eps_trans(), and merge_spell_result_stack().

static void key_hd_oflw ( SXINT  old_size,
SXINT  new_size 
) [static]

Definition at line 133 of file sxspell_mngr.c.

References key2index.

Referenced by sxspell_do_it().

static SXINT memo_cut_in_subwords ( SXINT  p,
SXINT  q,
SXINT  cut_nb 
) [static]
static SXBOOLEAN memo_is_valid ( SXINT  x  )  [static]

Definition at line 2386 of file sxspell_mngr.c.

References cur_spell_result, memo_id_stack, memo_weight_limit, SXTRUE, and WEIGHT_NB_SHIFT.

Referenced by memo_cut_in_subwords().

static SXINT merge_compare ( SXINT *  p1,
SXINT *  p2 
) [static]

Definition at line 2105 of file sxspell_mngr.c.

References ij_total_weights.

Referenced by merge_spell_result_stack().

static void merge_spell_result_stack ( SXINT  top,
SXINT  x,
SXINT  y,
SXINT  additional_cost 
) [static]
static SXINT spell_result_stack_push ( SXINT  id  )  [static]
static void store_sub_word ( SXINT  id,
struct weight  weight,
SXBOOLEAN  is_an_old_id 
) [static]
void store_word ( SXINT  code  ) 
static SXBA_fdcl ( replace_set  ,
256   
) [static]
static SXBA_fdcl ( working_char_set  ,
256   
) [static]
void sxspell_add ( struct FSA *  FSA,
SXINT  pos,
unsigned char V,
SXINT  iw 
)
void sxspell_change ( struct FSA *  FSA,
SXINT  pos,
unsigned char V,
SXINT  cw 
)

Definition at line 1276 of file sxspell_mngr.c.

References AREA2TRANS, get_new_min_weight(), and sxba_scan_reset().

SXBOOLEAN sxspell_do_it ( struct FSA *  FSA  ) 
void sxspell_final ( struct FSA *  FSA  ) 
void sxspell_final_fsa ( struct FSA *  FSA  ) 
void sxspell_init ( struct sxdfa_comb *  dico,
struct FSA *  FSA,
unsigned char  kind,
SXINT  max_weight,
SXINT  cmp_weight,
SXBOOLEAN  seek_sub_words,
SXINT  sub_word_weight 
)

Definition at line 250 of file sxspell_mngr.c.

References is_suffix, ME, and sxtrap().

void sxspell_init_fsa ( char mot,
SXINT  lgth,
struct FSA *  FSA 
)
void sxspell_no_repeat ( struct FSA *  FSA,
SXINT  p,
SXINT  nr_weight 
)
void sxspell_replace ( struct FSA *  FSA,
unsigned char R[],
SXINT  R_size,
SXINT  replace_weight 
)

Definition at line 529 of file sxspell_mngr.c.

References AREA2TRANS, get_new_min_weight(), replace_strings, sxba_empty(), and unicode.

void sxspell_replace_n_p ( struct FSA *  FSA,
unsigned char R[],
SXINT  R_size,
SXINT  replace_weight 
)
void sxspell_suppress_all ( struct FSA *  FSA,
SXINT  sup_weight 
)

Definition at line 943 of file sxspell_mngr.c.

References AREA2TRANS, FSA_HAS_EPS_TRANS, get_new_min_weight(), and SXTRUE.

void sxspell_suppress_i ( struct FSA *  FSA,
SXINT  sup_weight,
SXINT  i 
)
void sxspell_swap ( struct FSA *  FSA,
SXINT  swp_weight 
)
static void words_oflw ( SXINT  old_size,
SXINT  new_size 
) [static]

Definition at line 243 of file sxspell_mngr.c.

References cur_spell_result.

Referenced by sxspell_do_it().


Variable Documentation

SXUINT base [static]
SXUINT base_shift [static]
unsigned char* char2class [static]

Definition at line 237 of file sxspell_mngr.c.

Referenced by dico_walk(), and sxspell_do_it().

SXUINT class_mask [static]
SXUINT* comb_vector [static]
SXINT * cross_id [static]

Definition at line 83 of file sxspell_mngr.c.

Referenced by merge_spell_result_stack(), and sxspell_final().

SXINT cross_id_size [static]

Definition at line 83 of file sxspell_mngr.c.

Referenced by merge_spell_result_stack().

struct weight* cross_weight [static]

Definition at line 84 of file sxspell_mngr.c.

Referenced by merge_spell_result_stack(), and sxspell_final().

struct sxdfa_comb* cur_dico [static]

Definition at line 77 of file sxspell_mngr.c.

Referenced by FSA_walk(), memo_cut_in_subwords(), sxspell_do_it(), and sxspell_init_fsa().

struct FSA* cur_FSA [static]
XH_header* cur_multiple_word_ids_ptr [static]

Definition at line 81 of file sxspell_mngr.c.

Referenced by merge_spell_result_stack(), and sxspell_do_it().

struct spell_result* cur_spell_result [static]
SXBOOLEAN FSA_HAS_EPS_TRANS [static]
SXINT fsa_state2equiv_size [static]

Definition at line 102 of file sxspell_mngr.c.

Referenced by sxspell_add(), sxspell_init_fsa(), sxspell_replace_n_p(), and sxspell_swap().

SXINT* fsa_state2lequiv [static]
SXINT* fsa_state2local_path [static]
SXINT * fsa_state2requiv [static]
SXINT * ij_ids [static]

Definition at line 86 of file sxspell_mngr.c.

Referenced by merge_spell_result_stack(), and sxspell_final().

SXINT * ij_total_weights [static]

Definition at line 86 of file sxspell_mngr.c.

Referenced by merge_compare(), merge_spell_result_stack(), and sxspell_final().

struct weight* ij_weights [static]

Definition at line 85 of file sxspell_mngr.c.

Referenced by merge_spell_result_stack(), and sxspell_final().

SXBOOLEAN is_suffix [static]
SXINT* key2index [static]
X_header key_hd [static]

Definition at line 127 of file sxspell_mngr.c.

Referenced by memo_cut_in_subwords(), sxspell_do_it(), and sxspell_final_fsa().

SXINT KEY_SHIFT [static]

Definition at line 129 of file sxspell_mngr.c.

Referenced by sxspell_do_it().

SXUINT last_final_id [static]
SXINT local_path_nb [static]

Definition at line 101 of file sxspell_mngr.c.

Referenced by sxspell_add(), sxspell_do_it(), sxspell_replace_n_p(), and sxspell_swap().

VARSTR lvstr [static]

Definition at line 228 of file sxspell_mngr.c.

Referenced by dico_walk(), store_word(), sxspell_do_it(), and sxspell_final().

char ME[] = "sxspell_mngr" [static]
SXINT MEMO_BASE [static]

Definition at line 121 of file sxspell_mngr.c.

Referenced by memo_cut_in_subwords(), and sxspell_do_it().

SXINT* memo_hd [static]

Definition at line 124 of file sxspell_mngr.c.

Referenced by memo_cut_in_subwords(), sxspell_do_it(), and sxspell_final_fsa().

SXINT* memo_id_stack [static]
SXINT * memo_weight_limit [static]
struct weight* memo_weight_stack [static]
unsigned char* replace_strings[256] [static]

Definition at line 430 of file sxspell_mngr.c.

Referenced by sxspell_replace().

VARSTR rvstr [static]

Definition at line 228 of file sxspell_mngr.c.

Referenced by dico_walk(), store_word(), sxspell_do_it(), and sxspell_final().

SXINT * sorted [static]

Definition at line 86 of file sxspell_mngr.c.

Referenced by merge_spell_result_stack(), and sxspell_final().

SXINT sorted_size [static]

Definition at line 86 of file sxspell_mngr.c.

Referenced by merge_spell_result_stack().

SXINT* spell_result_id_stack [static]
struct weight* spell_result_weight_stack [static]
SXUINT stop_mask [static]
SXUINT tooth [static]
struct weight NUL_WEIGHT total_weight [static]
SXINT underflow_nb [static]

Definition at line 118 of file sxspell_mngr.c.

Referenced by store_sub_word(), and sxspell_do_it().

char WHAT_SXSPELL_MNGR[] = "@(#)SYNTAX - $Id: sxspell_mngr.c 1740 2009-06-04 13:09:18Z sagot $" WHAT_DEBUG

Definition at line 73 of file sxspell_mngr.c.

SXBOOLEAN WORD_HAS_SPACES [static]

Definition at line 122 of file sxspell_mngr.c.

Referenced by call_cut(), memo_cut_in_subwords(), and sxspell_do_it().


Generated on Wed Apr 21 16:39:39 2010 for syntax-6.0b7 by  doxygen 1.6.1