00001 #include <iostream>
00002
00003 using std::cin;
00004 using std::cout;
00005
00012
00013
00014
00019
00034 typedef Symbol Symbol;
00035
00037 typedef SymbolSet SymbolSet;
00038
00040 typedef SymbolIterator SymbolIterator;
00041
00043 typedef SymbolPair SymbolPair;
00044
00046 typedef SymbolPairSet SymbolPairSet;
00047
00049 typedef SymbolPairIterator SymbolPairIterator;
00050
00057 typedef KeyTable KeyTable;
00058
00060
00061
00062
00063
00068
00069
00071 Symbol define_symbol( const char *s );
00072
00074 bool is_symbol( const char *s );
00075
00080 Symbol get_symbol( const char *s );
00081
00083 const char * get_symbol_name( Symbol s );
00084
00086 bool is_equal( Symbol s1, Symbol s2 );
00087
00089
00090
00091
00096
00098 SymbolSet *create_empty_symbol_set();
00099
00101 SymbolSet *insert_symbol( Symbol s, SymbolSet *Si );
00102
00104 bool has_symbol( Symbol s, SymbolSet *Si );
00105
00107
00108
00113
00115 SymbolIterator begin_sigma_symbol( SymbolSet *Si );
00116
00118 SymbolIterator end_sigma_symbol( SymbolSet *Si );
00119
00121 size_t size_sigma_symbol( SymbolSet *Si );
00122
00124 Symbol get_sigma_symbol( SymbolIterator Si );
00125
00127
00128
00133
00135 SymbolPair *define_symbolpair( Symbol s1, Symbol s2 );
00136
00138 Symbol get_input_symbol( SymbolPair *s );
00139
00141 Symbol get_output_symbol( SymbolPair *s );
00142
00144
00145
00150
00152 SymbolPairSet *create_empty_symbolpair_set();
00153
00156 SymbolPairSet *insert_symbolpair( SymbolPair *p, SymbolPairSet *Pi );
00157
00159 bool has_symbolpair( SymbolPair *p, SymbolPairSet *Pi );
00160
00162
00163
00168
00170 SymbolPairIterator begin_pi_symbol( SymbolPairSet *Pi );
00171
00173 SymbolPairIterator end_pi_symbol( SymbolPairSet *Pi );
00174
00176 size_t size_pi_symbol( SymbolPairSet *Pi );
00177
00179 SymbolPair *get_pi_symbolpair( SymbolPairIterator pi );
00180
00182
00183
00189
00190
00191
00195 KeyTable *create_key_table();
00196
00198 bool is_key( Key i, KeyTable *T );
00199
00201 bool is_symbol( Symbol s, KeyTable *T );
00202 void associate_key( Key i, KeyTable *T, Symbol s );
00209
00211 Key get_key( Symbol s, KeyTable *T );
00212
00216 Key get_unused_key( KeyTable * T );
00217
00222 Symbol get_key_symbol( Key i, KeyTable *T );
00223
00225 KeySet *get_key_set( KeyTable *T );
00226
00228 SymbolSet *get_symbol_set( KeyTable *T );
00229
00230
00268 KeyTable *read_symbol_table( istream& is, bool binary=false );
00269
00270
00274 void write_symbol_table( KeyTable *T, ostream& os, bool binary=false );
00275
00279 KeyTable * gather_flag_diacritic_table( KeyTable * kt );
00280
00282
00283
00284
00285
00297
00298
00307 TransducerHandle longest_match_tokenizer( KeySet * ks, KeyTable * kt );
00308
00316 TransducerHandle longest_match_tokenizer2( KeyTable * kt );
00317
00330 KeyTable * recode_key_table(KeyTable * kt, const char * epsilon_replacement);
00331
00360 KeyPairVector * tokenize_string_pair(TransducerHandle tokeniser, const
00361 char * upper, const char * lower, KeyTable* inputKeys);
00362
00379 KeyVector * tokenize_string(TransducerHandle tokeniser,
00380 const char * string,
00381 KeyTable* inputKeys);
00382
00390 KeyVector * longest_match_tokenize(TransducerHandle tokenizer,
00391 const char * string,
00392 KeyTable* inputKeys);
00393
00404 KeyPairVector * longest_match_tokenize_pair(TransducerHandle tokenizer,
00405 const char * string1,
00406 const char * string2,
00407 KeyTable* inputKeys);
00408
00425 KeyPairVector * tokenize_pair_string(TransducerHandle tokeniser, char *pairs, KeyTable* inputKeys);
00426 TransducerHandle
00439 pairstring_to_transducer( const char *str, KeyTable *T );
00440
00441
00485 TransducerHandle read_transducer_text( istream& is, KeyTable *T, bool sfst=false );
00486
00487
00493 bool has_symbol_table(istream &is);
00494
00495
00525 TransducerHandle read_transducer( istream &is, KeyTable *T );
00526
00531 TransducerHandle harmonize_transducer( TransducerHandle t, KeyTable *T_old, KeyTable *T_new );
00532
00533
00535
00536
00547
00548
00565 char * transducer_to_pairstring( TransducerHandle t, KeyTable *T, bool spaces=true, bool print_epsilons=true );
00566
00584 void print_transducer( TransducerHandle t, KeyTable *T, bool print_weights=false, ostream &ostr=std::cout, bool old=false );
00585
00586
00594 void write_transducer( TransducerHandle t, KeyTable *T, ostream &os=std::cout, bool backwards_compatibility=false );
00595
00596
00598 void write_runtime_transducer( TransducerHandle t, KeyTable * kt, FILE * output_file);
00599
00601
00604
00605
00606
00607
00608 void write_transducer( TransducerHandle t, const char *filename, KeyTable *T, bool backwards_compatibility=false );
00609
00610
00611 void print_key_table(KeyTable *T);
00612
00613
00614
00615
00616
00617 TransducerHandle read_transducer( const char *filename, KeyTable *T );
00618
00619
00620