10 #ifndef _HFST_TRANSITION_H_
11 #define _HFST_TRANSITION_H_
16 #include "../HfstDataTypes.h"
18 #include "../hfstdll.h"
22 namespace implementations {
33 template <
class C>
class HfstTransition
40 static unsigned int get_symbol_number
41 (
const typename C::SymbolType &symbol) {
42 return C::get_symbol_number(symbol);
56 typename C::SymbolType isymbol,
57 typename C::SymbolType osymbol,
58 typename C::WeightType weight):
59 target_state(s), transition_data(isymbol, osymbol, weight)
65 typename C::WeightType weight,
67 target_state(s), transition_data(inumber, onumber, weight)
72 target_state(another.target_state),
73 transition_data(another.transition_data)
80 HFSTDLL
bool operator<(const HfstTransition<C> &another)
const {
81 if (target_state == another.target_state)
82 return (transition_data < another.transition_data);
83 return (target_state < another.target_state);
89 target_state = another.target_state;
90 transition_data = another.transition_data;
100 return transition_data;
105 return transition_data.get_input_symbol();
110 return transition_data.get_output_symbol();
114 HFSTDLL
unsigned int get_input_number()
const {
115 return transition_data.get_input_number();
119 HFSTDLL
unsigned int get_output_number()
const {
120 return transition_data.get_output_number();
125 return transition_data.get_weight();
130 transition_data.set_weight(w);
133 friend class ComposeIntersectFst;
134 friend class ComposeIntersectLexicon;
135 friend class ComposeIntersectRule;
136 friend class ComposeIntersectRulePair;
145 typedef HfstTransition<HfstTropicalTransducerTransitionData>
149 typedef HfstTransition<HfstFastTransitionData> HfstFastTransition;
155 #endif // _HFST_TRANSITION_H_
HFSTDLL C::WeightType get_weight() const
Get the weight of the transition.
Definition: HfstTransition.h:124
unsigned int HfstState
The number of a state in an HfstTransitionGraph.
Definition: HfstDataTypes.h:119
HFSTDLL HfstState get_target_state() const
Get the target state of the transition.
Definition: HfstTransition.h:94
HFSTDLL const C & get_transition_data() const
Get the transition data of the transition.
Definition: HfstTransition.h:99
HFSTDLL C::SymbolType get_output_symbol() const
Get the output symbol of the transition.
Definition: HfstTransition.h:109
HFSTDLL void set_weight(float w)
Set the weight of the transition.
Definition: HfstTransition.h:129
HFSTDLL HfstTransition()
Create a transition leading to state zero with input and output symbols and weight as given by defaul...
Definition: HfstTransition.h:50
HFSTDLL C::SymbolType get_input_symbol() const
Get the input symbol of the transition.
Definition: HfstTransition.h:104
HFSTDLL HfstTransition(const HfstTransition< C > &another)
Create a deep copy of transition another.
Definition: HfstTransition.h:71
HfstTransition< HfstTropicalTransducerTransitionData > HfstBasicTransition
An HfstTransition with transition data of type HfstTropicalTransducerTransitionData.
Definition: HfstDataTypes.h:121
HFSTDLL HfstTransition(HfstState s, typename C::SymbolType isymbol, typename C::SymbolType osymbol, typename C::WeightType weight)
Create a transition leading to state s with input symbol isymbol, output_symbol osymbol and weight we...
Definition: HfstTransition.h:55
A transition that consists of a target state and transition data represented by class C...
Definition: HfstDataTypes.h:121
HFSTDLL void operator=(const HfstTransition< C > &another)
Assign this transition the same value as transition another.
Definition: HfstTransition.h:88