10 #ifndef _HFST_TRANSDUCER_H_
11 #define _HFST_TRANSDUCER_H_
17 #include "FormatSpecifiers.h"
22 #include "parsers/LexcCompiler.h"
71 namespace implementations {
72 template <
class T>
class HfstTransitionGraph;
73 class HfstTropicalTransducerTransitionData;
74 typedef HfstTransitionGraph<HfstTropicalTransducerTransitionData>
88 using hfst::implementations::HfstOlTransducer;
91 using hfst::implementations::SfstTransducer;
92 #endif // #if HAVE_SFST
95 using hfst::implementations::TropicalWeightTransducer;
96 using hfst::implementations::TropicalWeightState;
97 using hfst::implementations::TropicalWeightStateIterator;
99 using hfst::implementations::LogWeightTransducer;
100 #endif // #if HAVE_OPENFST_LOG
101 #endif // #if HAVE_OPENFST
104 using hfst::implementations::FomaTransducer;
105 #endif // #if HAVE_FOMA
108 using hfst::implementations::XfsmTransducer;
109 #endif // #if HAVE_XFSM
119 HFSTDLL
void initialize_xfsm();
124 HFSTDLL InitializeXfsm();
128 enum MinimizationAlgorithm { HOPCROFT, BRZOZOWSKI };
132 HFSTDLL
void set_minimization_algorithm(MinimizationAlgorithm);
133 HFSTDLL MinimizationAlgorithm get_minimization_algorithm();
135 HFSTDLL
void set_encode_weights(
bool);
136 HFSTDLL
bool get_encode_weights();
138 HFSTDLL
void set_minimize_even_if_already_minimal(
bool);
139 HFSTDLL
bool get_minimize_even_if_already_minimal();
141 HFSTDLL
void set_xerox_composition(
bool);
142 HFSTDLL
bool get_xerox_composition();
144 HFSTDLL
void set_flag_is_epsilon_in_composition(
bool);
145 HFSTDLL
bool get_flag_is_epsilon_in_composition();
149 HFSTDLL
void set_harmonize_smaller(
bool);
150 HFSTDLL
bool get_harmonize_smaller();
156 HFSTDLL
void set_unknown_symbols_in_use(
bool);
157 HFSTDLL
bool get_unknown_symbols_in_use();
159 void set_warning_stream(std::ostream * os);
160 std::ostream * get_warning_stream();
266 std::map<std::string,std::string> props;
268 union TransducerImplementation
271 hfst::implementations::Transducer * sfst;
274 hfst::implementations::StdVectorFst * tropical_ofst;
276 hfst::implementations::LogFst * log_ofst;
293 #if HAVE_OPENFST // is this needed?
294 hfst::implementations::StdVectorFst *
internal;
299 TransducerImplementation implementation;
303 static hfst::implementations::SfstTransducer sfst_interface;
306 static hfst::implementations::TropicalWeightTransducer
307 tropical_ofst_interface;
309 static hfst::implementations::LogWeightTransducer log_ofst_interface;
313 static hfst::implementations::FomaTransducer foma_interface;
315 static hfst::implementations::HfstOlTransducer hfst_ol_interface;
317 static hfst::implementations::XfsmTransducer xfsm_interface;
341 StringSet &missing_flags,
342 bool return_on_first_miss)
const;
371 HFSTDLL
unsigned int number_of_states()
const;
372 HFSTDLL
unsigned int number_of_arcs()
const;
374 HFSTDLL
void twosided_flag_diacritics();
388 unsigned int get_symbol_number(
const std::string &symbol);
391 std::vector<HfstTransducer*> extract_path_transducers();
431 const std::string &epsilon_symbol);
434 HFSTDLL
static HfstTransducer * prolog_file_to_xfsm_transducer(
const char * filename);
439 HFSTDLL
void print_alphabet();
443 #include "hfst_apply_schemas.h"
519 const std::string& output_utf8_str,
582 HFSTDLL
HfstTransducer(
const std::string &isymbol,
const std::string &osymbol,
659 const std::string &epsilon_symbol,
unsigned int & linecount);
662 const std::string &epsilon_symbol);
670 HFSTDLL HfstTransducer &
operator=(
const HfstTransducer &another);
672 HFSTDLL HfstTransducer &assign(
const HfstTransducer &another);
680 HFSTDLL
void set_name(
const std::string &name);
684 HFSTDLL std::string
get_name()
const;
695 HFSTDLL
void set_property(
const std::string& property,
const std::string& value);
701 HFSTDLL std::string
get_property(
const std::string& property)
const;
705 HFSTDLL
const std::map<std::string,std::string>&
get_properties()
const;
724 HFSTDLL
void harmonize(HfstTransducer &another);
744 HFSTDLL
void remove_symbols_from_alphabet(
const StringSet & symbols);
775 HFSTDLL
bool compare(
const HfstTransducer &another,
bool harmonize=
true)
const;
859 HFSTDLL
void write_xfsm_transducer_in_att_format(
const char * filename)
const;
860 HFSTDLL
void write_xfsm_transducer_in_prolog_format(
const char * filename)
const;
863 HFSTDLL
void write_in_prolog_format(FILE * file,
const std::string & name,
864 bool write_weights=
true);
866 HFSTDLL
void write_in_att_format_number
867 (FILE * ofile,
bool write_weights=
true)
const;
879 bool write_weights=
true)
const;
892 HFSTDLL
void extract_paths(ExtractStringsCb& callback,
int cycles=-1)
const;
975 HFSTDLL
void extract_paths
978 HFSTDLL
void extract_random_paths
981 HFSTDLL
void extract_random_paths_fd
988 HFSTDLL
void extract_paths_fd
989 (ExtractStringsCb& callback,
int cycles=-1,
bool filter_fd=
true)
const;
993 HFSTDLL
void extract_shortest_paths
996 HFSTDLL
bool extract_longest_paths
999 HFSTDLL
int longest_path_size(
bool obey_flags=
true)
const;
1035 HFSTDLL
void extract_paths_fd
1037 bool filter_fd=
true)
const;
1051 double time_cutoff = 0.0)
const;
1060 double time_cutoff = 0.0)
const;
1094 double time_cutoff = 0.0)
const;
1117 double time_cutoff = 0.0)
const;
1128 const std::string &s,
1130 double time_cutoff = 0.0)
const;
1142 const std::string &s, ssize_t limit = -1,
1143 double time_cutoff = 0.0)
const;
1160 ssize_t limit = -1)
const;
1163 ssize_t limit = -1)
const;
1174 ssize_t limit = -1)
const;
1177 ssize_t limit = -1)
const;
1194 HFSTDLL
bool is_infinitely_ambiguous()
const ;
1201 HFSTDLL HfstTransducer &eliminate_flags();
1202 HFSTDLL HfstTransducer &eliminate_flag(
const std::string &flag);
1209 HFSTDLL HfstTransducer &
prune();
1225 HFSTDLL HfstTransducer &
minimize();
1242 HFSTDLL HfstTransducer &
n_best(
unsigned int n);
1258 HFSTDLL HfstTransducer &
repeat_n(
unsigned int n);
1270 HFSTDLL HfstTransducer&
repeat_n_to_k(
unsigned int n,
unsigned int k);
1277 HFSTDLL HfstTransducer &
invert();
1284 HFSTDLL HfstTransducer &
reverse();
1299 HFSTDLL HfstTransducer &
compose(
const HfstTransducer &another,
1300 bool harmonize=
true);
1302 HFSTDLL HfstTransducer &merge(
const HfstTransducer &another,
const std::map<std::string, std::set<std::string> > & list_symbols);
1304 HFSTDLL HfstTransducer &merge(
const HfstTransducer &another,
const struct hfst::xre::XreConstructorArguments & args);
1317 bool invert=
false,
bool harmonize=
true);
1320 HFSTDLL HfstTransducer &
concatenate(
const HfstTransducer &another,
bool harmonize=
true);
1323 HFSTDLL HfstTransducer &
disjunct(
const HfstTransducer &another,
bool harmonize=
true);
1348 HFSTDLL HfstTransducer &
priority_union(
const HfstTransducer &another);
1354 HFSTDLL HfstTransducer &
lenient_composition(
const HfstTransducer &another,
bool harmonize=
true);
1364 HFSTDLL HfstTransducer &
cross_product(
const HfstTransducer &another,
bool harmonize=
true);
1377 HFSTDLL HfstTransducer &shuffle(
const HfstTransducer &another,
bool harmonize=
true);
1405 HFSTDLL HfstTransducer &
intersect(
const HfstTransducer &another,
bool harmonize=
true);
1408 HFSTDLL HfstTransducer &
subtract(
const HfstTransducer &another,
bool harmonize=
true);
1442 HFSTDLL HfstTransducer &
insert_freely(
const HfstTransducer &tr,
bool harmonize=
true);
1503 HFSTDLL HfstTransducer &
substitute(
const std::string &old_symbol,
1504 const std::string &new_symbol,
1505 bool input_side=
true,
1506 bool output_side=
true);
1539 HFSTDLL HfstTransducer & substitute_symbol(
const std::string &old_symbol,
const std::string &new_symbol,
bool input_side=
true,
bool output_side=
true);
1540 HFSTDLL HfstTransducer & substitute_symbol_pair(
const StringPair &old_symbol_pair,
const StringPair &new_symbol_pair);
1541 HFSTDLL HfstTransducer & substitute_symbol_pair_with_set(
const StringPair &old_symbol_pair,
const hfst::StringPairSet &new_symbol_pair_set);
1542 HFSTDLL HfstTransducer & substitute_symbol_pair_with_transducer(
const StringPair &symbol_pair, HfstTransducer &transducer,
bool harmonize=
true);
1589 HfstTransducer &transducer,
bool harmonize=
true);
1640 HFSTDLL
static HfstTransducer *
read_lexc_ptr(
const std::string &filename,
1644 HFSTDLL
static HfstTransducer read_lexc(
const std::string &filename,
1653 HFSTDLL
void insert_freely_missing_flags_from
1654 (
const HfstTransducer &another);
1664 HFSTDLL
void harmonize_flag_diacritics(HfstTransducer &another,
1665 bool insert_renamed_flags=
true);
1667 HFSTDLL
void insert_missing_symbols_to_alphabet_from(
const HfstTransducer &another,
bool only_special_symbols=
false);
1669 HFSTDLL StringSet insert_missing_diacritics_to_alphabet_from(
const HfstTransducer &another);
1671 HFSTDLL
static bool is_special_symbol(
const std::string & symbol);
1675 HFSTDLL
bool check_for_missing_flags_in(
const HfstTransducer &another)
const;
1678 HFSTDLL
bool has_flag_diacritics(
void)
const;
1684 HFSTDLL
friend std::ostream&
operator<<(std::ostream &out,
const HfstTransducer &t);
1685 HFSTDLL
friend std::ostream& redirect(std::ostream &out,
const HfstTransducer &t);
1689 friend class HfstCompiler;
1690 friend class hfst::implementations::ConversionFunctions;
1691 friend class HfstGrammar;
1692 friend class xfst::XfstCompiler;
1704 HFSTDLL std::ostream &redirect(std::ostream &out,
const HfstTransducer &t);
1710 enum ReplaceType {REPL_UP, REPL_DOWN, REPL_RIGHT, REPL_LEFT,
1711 REPL_DOWN_KARTTUNEN};
1712 enum TwolType {twol_right, twol_left, twol_both};
1715 HFSTDLL HfstTransducer universal_fst
1717 HFSTDLL HfstTransducer negation_fst
1720 HFSTDLL HfstTransducer replace
1721 (HfstTransducer &t, ReplaceType repl_type,
bool optional,
1723 HFSTDLL HfstTransducer replace_transducer
1724 (HfstTransducer &t, std::string lm, std::string rm,
1726 HFSTDLL HfstTransducer replace_context
1727 (HfstTransducer &t, std::string m1, std::string m2,
1729 HFSTDLL HfstTransducer replace_in_context
1734 HFSTDLL HfstTransducer restriction
1736 StringPairSet &alphabet, TwolType twol_type,
int direction );
1863 HfstTransducer &mapping,
1874 HfstTransducer &mapping,
1879 HfstTransducer &mapping,
1891 HfstTransducer &mapping,
1903 HfstTransducer &mapping,
1912 HFSTDLL HfstTransducer
replace_up(HfstTransducer &mapping,
1920 HFSTDLL HfstTransducer
replace_down(HfstTransducer &mapping,
1943 HfstTransducer &mapping,
1951 HfstTransducer &mapping,
1960 HfstTransducer &mapping,
1970 HfstTransducer &mapping,
1980 HfstTransducer &mapping,
2000 HfstTransducer &mapping,
2013 HfstTransducer &mapping,
2029 HfstTransducer &mapping,
2045 HfstTransducer &mapping,
2061 HfstTransducer &mapping,
2072 HfstTransducer &mapping,
2087 HfstTransducer &mapping,
2102 HfstTransducer &mapping,
2113 HfstTransducer &mapping,
2121 #endif // #ifndef _HFST_TRANSDUCER_H_
HFSTDLL HfstOneLevelPaths * lookdown(const StringVector &s, ssize_t limit=-1) const
(Not implemented) Lookdown a single string s and return a maximum of limit results.
Definition: HfstTransducer.cc:737
HFSTDLL ImplementationType get_type(void) const
The implementation type of the transducer.
Definition: HfstTransducer.cc:1473
HFSTDLL HfstTransducer & prune()
Make transducer coaccessible.
Definition: HfstTransducer.cc:2090
HFSTDLL bool is_lookdown_infinitely_ambiguous(const StringVector &s) const
(Not implemented) Whether lookdown of path s will have infinite results.
Definition: HfstTransducer.cc:795
HfstTransducer coercion(HfstTransducerPairVector &contexts, HfstTransducer &mapping, StringPairSet &alphabet)
A transducer that requires that one of the mappings defined by mapping must occur in each context in ...
Definition: HfstRules.cc:672
Declaration of class hfst::HfstTokenizer.
Class HfstTransitionGraph.
HFSTDLL HfstTransducer & priority_union(const HfstTransducer &another)
Make priority union of this transducer with another.
Definition: HfstTransducer.cc:4573
HfstTransducer surface_restriction_and_coercion(HfstTransducerPairVector &contexts, HfstTransducer &mapping, StringPairSet &alphabet)
A transducer that is equivalent to the intersection of surface_restriction and surface_coercion.
Definition: HfstRules.cc:698
HFSTDLL HfstTransducer & repeat_n_to_k(unsigned int n, unsigned int k)
A concatenation of N transducers where N is any number from n to k, inclusive.
Definition: HfstTransducer.cc:2259
HFSTDLL HfstTransducer()
Create an uninitialized transducer (use with care).
Definition: HfstTransducer.cc:823
std::pair< String, String > StringPair
A symbol pair in a transition.
Definition: HfstSymbolDefs.h:70
HFSTDLL HfstTransducer & intersect(const HfstTransducer &another, bool harmonize=true)
Intersect this transducer with another.
Definition: HfstTransducer.cc:4890
HFSTDLL HfstTransducer & prune_alphabet(bool force=true)
Remove all symbols that do not occur in transitions of the transducer from its alphabet.
Definition: HfstTransducer.cc:304
HfstTransducer deep_restriction(HfstTransducerPairVector &contexts, HfstTransducer &mapping, StringPairSet &alphabet)
A transducer that specifies that a string from the output language of the transducer mapping may only...
Definition: HfstRules.cc:705
HfstTransducer two_level_if_and_only_if(HfstTransducerPair &context, StringPairSet &mappings, StringPairSet &alphabet)
A transducer that always performs the mappings defined by mappings in the context context and only in...
Definition: HfstRules.cc:258
HFSTDLL HfstOneLevelPaths * lookdown_fd(StringVector &s, ssize_t limit=-1) const
(Not implemented) Lookdown a single string minding flag diacritics properly.
Definition: HfstTransducer.cc:744
HFSTDLL HfstTransducer & subtract(const HfstTransducer &another, bool harmonize=true)
Subtract transducer another from this transducer.
Definition: HfstTransducer.cc:4912
HFSTDLL HfstTransducer & remove_epsilons()
Remove all epsilon:epsilon transitions from the transducer so that the transducer remains equivalent...
Definition: HfstTransducer.cc:2066
A compiled transducer format, suitable for fast lookup operations.
Definition: transducer.h:833
HFSTDLL void harmonize(HfstTransducer &another)
Harmonize transducers this and another.
Definition: HfstTransducer.cc:548
HFSTDLL std::string get_property(const std::string &property) const
Get arbitrary string propert property. get_property("name") works like get_name.
Definition: HfstTransducer.cc:1492
std::vector< std::pair< std::string, std::string > > StringPairVector
A vector of string pairs.
Definition: HfstDataTypes.h:105
HFSTDLL HfstTransducer & push_weights(PushType type)
Push weights towards initial or final state(s) as defined by type.
Definition: HfstTransducer.cc:3811
static HFSTDLL HfstTransducer * read_lexc_ptr(const std::string &filename, ImplementationType type, bool verbose)
Compile a lexc file in file filename into an HfstTransducer of type type and return the transducer...
Definition: HfstTransducer.cc:5767
HFSTDLL HfstTransducer & repeat_n_minus(unsigned int n)
A concatenation of N transducers where N is any number from zero to n, inclusive. ...
Definition: HfstTransducer.cc:2238
HfstTransducer left_replace_down(HfstTransducerPair &context, HfstTransducer &mapping, bool optional, StringPairSet &alphabet)
Inversion of the replace_up and the result needs to be composed on the upper side of the input langua...
Definition: HfstRules.cc:504
A synchronous finite-state transducer.
Definition: HfstTransducer.h:253
HFSTDLL HfstTransducer & repeat_n_plus(unsigned int n)
A concatenation of N transducers where N is any number from n to infinity, inclusive.
Definition: HfstTransducer.cc:2225
HfstTransducer surface_restriction(HfstTransducerPairVector &contexts, HfstTransducer &mapping, StringPairSet &alphabet)
A transducer that specifies that a string from the input language of the transducer mapping may only ...
Definition: HfstRules.cc:685
HFSTDLL HfstTransducer & output_project()
Extract the output language of the transducer.
Definition: HfstTransducer.cc:2364
HfstTransducer two_level_only_if(HfstTransducerPair &context, StringPairSet &mappings, StringPairSet &alphabet)
A transducer that allows the mappings defined by mappings only in the context context, when the alphabet is alphabet.
Definition: HfstRules.cc:214
HFSTDLL HfstTransducer & cross_product(const HfstTransducer &another, bool harmonize=true)
Make cross product of this transducer with . It pairs every string of this with every string of ...
Definition: HfstTransducer.cc:4340
HFSTDLL bool is_lookup_infinitely_ambiguous(const StringVector &s) const
Whether lookup of path s will have infinite results.
Definition: HfstTransducer.cc:766
HFSTDLL HfstTransducer & input_project()
Extract the input language of the transducer.
Definition: HfstTransducer.cc:2343
HfstTransducer deep_coercion(HfstTransducerPairVector &contexts, HfstTransducer &mapping, StringPairSet &alphabet)
A transducer that specifies that a string from the output language of the transducer mapping always h...
Definition: HfstRules.cc:711
HfstTransducer left_replace_down_karttunen(HfstTransducerPair &context, HfstTransducer &mapping, bool optional, StringPairSet &alphabet)
Inversion of the replace_up and the result needs to be composed on the upper side of the input langua...
Definition: HfstRules.cc:488
HFSTDLL bool is_automaton(void) const
Whether the transducer is an automaton.
Definition: HfstTransducer.cc:1583
ImplementationType
The type of an HfstTransducer.
Definition: HfstDataTypes.h:41
Declarations of functions and datatypes that form a bridge between HFST API and foma.
HfstTransducer replace_left(HfstTransducerPair &context, HfstTransducer &mapping, bool optional, StringPairSet &alphabet)
The same as replace_up, but left context matching is done on the input side of mapping and right cont...
Definition: HfstRules.cc:432
HFSTDLL HfstTransducer & minimize()
Minimize the transducer.
Definition: HfstTransducer.cc:2129
HFSTDLL HfstTransducer & concatenate(const HfstTransducer &another, bool harmonize=true)
Concatenate this transducer with another.
Definition: HfstTransducer.cc:4777
HFSTDLL HfstTransducer & reverse()
Reverse the transducer.
Definition: HfstTransducer.cc:2322
HFSTDLL HfstTransducer & optionalize()
Disjunct the transducer with an epsilon transducer.
Definition: HfstTransducer.cc:2280
A simple transition graph format that consists of states and transitions between those states...
Definition: HfstDataTypes.h:112
PushType
The type of a push operation.
Definition: HfstDataTypes.h:64
HFSTDLL bool compare(const HfstTransducer &another, bool harmonize=true) const
Whether this transducer and another are equivalent.
Definition: HfstTransducer.cc:1515
HfstTransducer left_replace_right(HfstTransducerPair &context, HfstTransducer &mapping, bool optional, StringPairSet &alphabet)
Inversion of the replace_up and the result needs to be composed on the upper side of the input langua...
Definition: HfstRules.cc:536
virtual HFSTDLL ~HfstTransducer(void)
Destructor.
Definition: HfstTransducer.cc:1310
HFSTDLL HfstTransducer & repeat_star()
A concatenation of N transducers where N is any number from zero to infinity.
Definition: HfstTransducer.cc:2159
A stream for writing binary transducers.
Definition: HfstOutputStream.h:70
HFSTDLL HfstTransducer & compose_intersect(const HfstTransducerVector &v, bool invert=false, bool harmonize=true)
Compose this transducer with the intersection of transducers in v. If invert is true, then compose the intersection of the transducers in v with this transducer.
Definition: HfstTransducer.cc:4604
std::vector< HfstTransducer > HfstTransducerVector
a vector of transducers for methods applying a cascade of automata
Definition: HfstDataTypes.h:33
std::set< HfstTwoLevelPath > HfstTwoLevelPaths
A set of two-level weighted paths.
Definition: HfstDataTypes.h:109
HFSTDLL HfstTransducer & invert()
Swap the input and output symbols of each transition in the transducer.
Definition: HfstTransducer.cc:2301
HFSTDLL HfstTransducer & compose(const HfstTransducer &another, bool harmonize=true)
Compose this transducer with another.
Definition: HfstTransducer.cc:3959
HFSTDLL HfstTransducer & insert_freely(const StringPair &symbol_pair, bool harmonize=true)
Freely insert symbol pair symbol_pair into the transducer.
Definition: HfstTransducer.cc:3343
HfstTransducer restriction_and_coercion(HfstTransducerPairVector &contexts, HfstTransducer &mapping, StringPairSet &alphabet)
A transducer that is equivalent to the intersection of restriction and coercion and requires that the...
Definition: HfstRules.cc:678
HFSTDLL HfstTransducer & repeat_n(unsigned int n)
A concatenation of n transducers.
Definition: HfstTransducer.cc:2201
Declarations of functions and datatypes that form a bridge between HFST API and OpenFst's transducers...
HFSTDLL const std::map< std::string, std::string > & get_properties() const
Get all properties form transducer.
Definition: HfstTransducer.cc:1504
Declarations of functions and datatypes that form a bridge between HFST API and OpenFst's transducers...
HfstTransducer left_replace_left(HfstTransducerPair &context, HfstTransducer &mapping, bool optional, StringPairSet &alphabet)
Inversion of the replace_up and the result needs to be composed on the upper side of the input langua...
Definition: HfstRules.cc:520
static HFSTDLL HfstTransducer universal_pair(ImplementationType type)
Create universal pair transducer of type.
Definition: HfstTransducer.cc:5580
HFSTDLL HfstTransducer & set_final_weights(float weight, bool increment=false)
Set the weights of all final states to weight. increment defines whether the old weight is incremente...
Definition: HfstTransducer.cc:3789
Datatypes that are needed when using the HFST API.
HFSTDLL HfstTransducer & determinize()
Determinize the transducer.
Definition: HfstTransducer.cc:2104
HfstTransducer replace_right(HfstTransducerPair &context, HfstTransducer &mapping, bool optional, StringPairSet &alphabet)
The same as replace_up, but left context matching is done on the output side of mapping and right con...
Definition: HfstRules.cc:423
Declaration of classes for HFST's optimized lookup transducer format.
A rule that contains mapping and context and replace type (if any). If rule is A -> B || L _ R ...
Definition: HfstXeroxRules.h:45
HfstTransducer replace_down(HfstTransducerPair &context, HfstTransducer &mapping, bool optional, StringPairSet &alphabet)
The same as replace_up, but matching is done on the output side of mapping.
Definition: HfstRules.cc:405
static HFSTDLL HfstTransducer identity_pair(ImplementationType type)
Create identity pair transducer of type.
Definition: HfstTransducer.cc:5595
HFSTDLL HfstTransducer & disjunct(const HfstTransducer &another, bool harmonize=true)
Disjunct this transducer with another.
Definition: HfstTransducer.cc:4867
std::set< StringPair > StringPairSet
A set of symbol pairs used in substituting symbol pairs and in rule functions.
Definition: HfstSymbolDefs.h:82
HFSTDLL StringSet get_first_input_symbols() const
Get first input level symbols of strings recognized (or rejected, if they end in a non-final state) b...
Definition: HfstTransducer.cc:312
HFSTDLL bool is_cyclic(void) const
Whether the transducer is cyclic.
Definition: HfstTransducer.cc:1618
std::set< HfstOneLevelPath > HfstOneLevelPaths
A set of simple paths.
Definition: HfstDataTypes.h:100
std::pair< HfstTransducer, HfstTransducer > HfstTransducerPair
A pair of transducers.
Definition: HfstDataTypes.h:78
HFSTDLL void write_in_att_format(FILE *ofile, bool write_weights=true) const
Write the transducer in AT&T format to FILE ofile. write_weights defines whether weights are written...
Definition: HfstTransducer.cc:5320
HFSTDLL void remove_from_alphabet(const std::string &symbol)
Remove symbol from the alphabet of the transducer. CURRENTLY NOT IMPLEMENTED.
Definition: HfstTransducer.cc:269
HFSTDLL HfstTransducer & operator=(const HfstTransducer &another)
Assign this transducer a new value equivalent to transducer another.
Definition: HfstTransducer.cc:5612
Declaration of class HfstOutputStream.
HFSTDLL friend std::ostream & operator<<(std::ostream &out, const HfstTransducer &t)
Write transducer t in AT&T format to ostream out.
Definition: HfstTransducer.cc:5847
HFSTDLL HfstTransducer & substitute(bool(*func)(const StringPair &sp, StringPairSet &sps))
Substitute all transition sp with transitions sps as defined by function func.
Definition: HfstTransducer.cc:3504
std::ostream & operator<<(std::ostream &out, const HfstTransducer &t)
Write transducer t in AT&T format to ostream out.
Definition: HfstTransducer.cc:5847
std::map< String, String > HfstSymbolSubstitutions
A map of substitutions used when performing multiple symbol-to-symbol substitutions.
Definition: HfstSymbolDefs.h:88
std::vector< HfstTransducerPair > HfstTransducerPairVector
A vector of transducer pairs.
Definition: HfstDataTypes.h:82
HfstTransducer two_level_if(HfstTransducerPair &context, StringPairSet &mappings, StringPairSet &alphabet)
A transducer that obligatorily performs the mappings defined by mappings in the context context when ...
Definition: HfstRules.cc:154
HFSTDLL HfstTransducer & n_best(unsigned int n)
Extract n best paths of the transducer.
Definition: HfstTransducer.cc:2780
HFSTDLL HfstTransducer & transform_weights(float(*func)(float))
Transform all transition and state weights as defined in func.
Definition: HfstTransducer.cc:3841
HfstTransducer replace_up(HfstTransducerPair &context, HfstTransducer &mapping, bool optional, StringPairSet &alphabet)
A transducer that performs an upward mapping mapping in the context context when the alphabet is alph...
Definition: HfstRules.cc:397
HFSTDLL HfstOneLevelPaths * lookup_fd(const StringVector &s, ssize_t limit=-1, double time_cutoff=0.0) const
Lookup or apply a single string s minding flag diacritics properly and store a maximum of limit resul...
Definition: HfstTransducer.cc:673
HFSTDLL std::string get_name() const
Get the name of the transducer.
Definition: HfstTransducer.cc:1478
HfstTransitionGraph< HfstTropicalTransducerTransitionData > HfstBasicTransducer
An HfstTransitionGraph with transitions of type HfstTropicalTransducerTransitionData and weight type ...
Definition: HfstDataTypes.h:113
HfstTransducer deep_restriction_and_coercion(HfstTransducerPairVector &contexts, HfstTransducer &mapping, StringPairSet &alphabet)
A transducer that is equivalent to the intersection of deep_restriction and deep_coercion.
Definition: HfstRules.cc:718
HfstTransducer surface_coercion(HfstTransducerPairVector &contexts, HfstTransducer &mapping, StringPairSet &alphabet)
A transducer that specifies that a string from the input language of the transducer mapping always ha...
Definition: HfstRules.cc:691
HfstTransducer left_replace_up(HfstTransducer &mapping, bool optional, StringPairSet &alphabet)
Inversion of the replace_up and the result needs to be composed on the upper side of the input langua...
Definition: HfstRules.cc:456
A tokenizer for creating transducers from UTF-8 strings.
Definition: HfstTokenizer.h:84
HFSTDLL void set_name(const std::string &name)
Rename the transducer name.
Definition: HfstTransducer.cc:1475
HFSTDLL void set_property(const std::string &property, const std::string &value)
Set arbitrary string property property to value. set_property("name") equals set_name(string&).
Definition: HfstTransducer.cc:1482
Declarations of functions and datatypes that form a bridge between HFST API and SFST.
std::map< StringPair, StringPair > HfstSymbolPairSubstitutions
A map of substitutions used when performing multiple symbol pair-to-symbol pair substitutions.
Definition: HfstSymbolDefs.h:94
HFSTDLL HfstOneLevelPaths * lookup(const StringVector &s, ssize_t limit=-1, double time_cutoff=0.0) const
Lookup or apply a single tokenized string s and return a maximum of limit results.
Definition: HfstTransducer.cc:661
Declarations of functions and datatypes that form a bridge between HFST API and xfsm.
Typedefs and functions for symbols, symbol pairs and sets of symbols.
HfstTransducer bracketedReplace(const Rule &rule, bool optional)
Unconditional replace, in multiple contexts first: (.* T
T .*) - [( .* L1 TT R1 ...Definition: HfstXeroxRules.cc:575
std::vector< std::string > StringVector
A vector of strings.
Definition: HfstDataTypes.h:87
HFSTDLL StringSet get_alphabet() const
Get the alphabet of the transducer.
Definition: HfstTransducer.cc:345
HFSTDLL HfstTransducer & lenient_composition(const HfstTransducer &another, bool harmonize=true)
Make lenient composition of this transducer with . A .O. B = [ A .o. B ] .P. A.
Definition: HfstTransducer.cc:4319
HFSTDLL void insert_to_alphabet(const std::string &symbol)
Explicitly insert symbol to the alphabet of the transducer.
Definition: HfstTransducer.cc:216
HFSTDLL HfstTransducer & repeat_plus()
A concatenation of N transducers where N is any number from one to infinity.
Definition: HfstTransducer.cc:2180