13 #ifndef _MY_TRANSDUCER_LIBRARY_TRANSDUCER_H_
14 #define _MY_TRANSDUCER_LIBRARY_TRANSDUCER_H_
28 #include "HfstExtractStrings.h"
31 #ifndef _MY_TRANSDUCER_LIBRARY_LIB_H_
32 #define _MY_TRANSDUCER_LIBRARY_LIB_H_
33 #include "my_transducer_library/MyTransducerLibrary.h"
43 namespace implementations
48 using namespace my_namespace;
92 void stream_unget(
char c);
94 void ignore(
unsigned int n);
98 bool set_implementation_specific_header_data
102 MyFst * read_transducer();
137 void write(
const char &c);
141 void append_implementation_specific_header_data
142 (std::vector<char> &header, MyFst *t);
145 void write_transducer(MyFst * transducer);
157 static MyFst * create_empty_transducer(
void);
159 static MyFst * create_epsilon_transducer(
void);
162 static MyFst * define_transducer(
const std::string &symbol);
165 static MyFst * define_transducer
166 (
const std::string &isymbol,
const std::string &osymbol);
173 static MyFst * define_transducer
177 static MyFst * define_transducer(
const std::vector<StringPairSet> &spsv);
180 static MyFst * copy(MyFst * t);
183 static MyFst * determinize(MyFst * t);
185 static MyFst * minimize(MyFst * t);
188 static MyFst * remove_epsilons(MyFst * t);
192 static MyFst * repeat_star(MyFst * t);
195 static MyFst * repeat_plus(MyFst * t);
198 static MyFst * repeat_n(MyFst * t,
unsigned int n);
201 static MyFst * repeat_le_n(MyFst * t,
unsigned int n);
205 static MyFst * optionalize(MyFst * t);
208 static MyFst * invert(MyFst * t);
211 static MyFst * reverse(MyFst * t);
215 static MyFst * extract_input_language(MyFst * t);
218 static MyFst * extract_output_language(MyFst * t);
221 static std::vector<MyFst*> extract_paths(MyFst *t);
223 static void extract_paths
224 (MyFst * t, hfst::ExtractStringsCb& callback,
225 int cycles=-1, FdTable<unsigned int>* fd=NULL,
bool filter_fd=
false);
231 static MyFst * insert_freely(MyFst *t ,
const StringPair &symbol_pair);
234 static MyFst * substitute
239 static MyFst * substitute
240 (MyFst *t,
const StringPair &symbol_pair, MyFst *tr);
245 static MyFst * compose(MyFst * t1, MyFst * t2);
248 static MyFst * concatenate(MyFst * t1, MyFst * t2);
251 static MyFst * disjunct(MyFst * t1, MyFst * t2);
254 static MyFst * intersect(MyFst * t1, MyFst * t2);
257 static MyFst * subtract(MyFst * t1, MyFst * t2);
275 static std::pair<MyFst*, MyFst*> harmonize
276 (MyFst *t1, MyFst *t2,
bool unknown_symbols_in_use=
true);
279 static bool are_equivalent(MyFst * t1, MyFst * t2);
281 static bool is_cyclic(MyFst * t);
285 static FdTable<unsigned int>* get_flag_diacritics(MyFst * t);
288 static MyFst * remove_from_alphabet(MyFst *t,
const std::string &symbol);
298 static unsigned int number_of_states(MyFst *t);
307 static void initialize_alphabet(MyFst *t);
309 static StringSet get_alphabet(MyFst *t);
317 #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:153
std::pair< String, String > StringPair
A symbol pair in a transition.
Definition: HfstSymbolDefs.h:71
std::string String
A UTF-8 symbol in a transition.
Definition: HfstSymbolDefs.h:60
std::vector< std::pair< std::string, std::string > > StringPairVector
A vector of string pairs.
Definition: HfstDataTypes.h:106
A skeleton class for writing a new type of binary transducers to a stream.
Definition: MyTransducerLibraryTransducer.h:115
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:83
Typedefs and functions for symbols, symbol pairs and sets of symbols.