10 #ifndef _MY_TRANSDUCER_LIBRARY_TRANSDUCER_H_
11 #define _MY_TRANSDUCER_LIBRARY_TRANSDUCER_H_
25 #include "HfstExtractStrings.h"
28 #ifndef _MY_TRANSDUCER_LIBRARY_LIB_H_
29 #define _MY_TRANSDUCER_LIBRARY_LIB_H_
30 #include "my_transducer_library/MyTransducerLibrary.h"
40 namespace implementations
45 using namespace my_namespace;
89 void stream_unget(
char c);
91 void ignore(
unsigned int n);
95 bool set_implementation_specific_header_data
99 MyFst * read_transducer();
134 void write(
const char &c);
138 void append_implementation_specific_header_data
139 (std::vector<char> &header, MyFst *t);
142 void write_transducer(MyFst * transducer);
154 static MyFst * create_empty_transducer(
void);
156 static MyFst * create_epsilon_transducer(
void);
159 static MyFst * define_transducer(
const std::string &symbol);
162 static MyFst * define_transducer
163 (
const std::string &isymbol,
const std::string &osymbol);
170 static MyFst * define_transducer
174 static MyFst * define_transducer(
const std::vector<StringPairSet> &spsv);
177 static MyFst * copy(MyFst * t);
180 static MyFst * determinize(MyFst * t);
182 static MyFst * minimize(MyFst * t);
185 static MyFst * remove_epsilons(MyFst * t);
189 static MyFst * repeat_star(MyFst * t);
192 static MyFst * repeat_plus(MyFst * t);
195 static MyFst * repeat_n(MyFst * t,
unsigned int n);
198 static MyFst * repeat_le_n(MyFst * t,
unsigned int n);
202 static MyFst * optionalize(MyFst * t);
205 static MyFst * invert(MyFst * t);
208 static MyFst * reverse(MyFst * t);
212 static MyFst * extract_input_language(MyFst * t);
215 static MyFst * extract_output_language(MyFst * t);
218 static std::vector<MyFst*> extract_paths(MyFst *t);
220 static void extract_paths
221 (MyFst * t, hfst::ExtractStringsCb& callback,
222 int cycles=-1, FdTable<unsigned int>* fd=NULL,
bool filter_fd=
false);
228 static MyFst * insert_freely(MyFst *t ,
const StringPair &symbol_pair);
231 static MyFst * substitute
236 static MyFst * substitute
237 (MyFst *t,
const StringPair &symbol_pair, MyFst *tr);
242 static MyFst * compose(MyFst * t1, MyFst * t2);
245 static MyFst * concatenate(MyFst * t1, MyFst * t2);
248 static MyFst * disjunct(MyFst * t1, MyFst * t2);
251 static MyFst * intersect(MyFst * t1, MyFst * t2);
254 static MyFst * subtract(MyFst * t1, MyFst * t2);
272 static std::pair<MyFst*, MyFst*> harmonize
273 (MyFst *t1, MyFst *t2,
bool unknown_symbols_in_use=
true);
276 static bool are_equivalent(MyFst * t1, MyFst * t2);
278 static bool is_cyclic(MyFst * t);
282 static FdTable<unsigned int>* get_flag_diacritics(MyFst * t);
285 static MyFst * remove_from_alphabet(MyFst *t,
const std::string &symbol);
295 static unsigned int number_of_states(MyFst *t);
304 static void initialize_alphabet(MyFst *t);
306 static StringSet get_alphabet(MyFst *t);
314 #endif // #ifndef _MY_TRANSDUCER_LIBRARY_TRANSDUCER_H_
A skeleton library class that contains operations for a new transducer type that is added under the H...
Definition: MyTransducerLibraryTransducer.h:150
std::pair< String, String > StringPair
A symbol pair in a transition.
Definition: HfstSymbolDefs.h:70
std::string String
A UTF-8 symbol in a transition.
Definition: HfstSymbolDefs.h:59
std::vector< std::pair< std::string, std::string > > StringPairVector
A vector of string pairs.
Definition: HfstDataTypes.h:105
A skeleton class for writing a new type of binary transducers to a stream.
Definition: MyTransducerLibraryTransducer.h:112
Class declarations for flag diacritic handling.
std::set< StringPair > StringPairSet
A set of symbol pairs used in substituting symbol pairs and in rule functions.
Definition: HfstSymbolDefs.h:82
Typedefs and functions for symbols, symbol pairs and sets of symbols.