20 #ifndef FST_ARCFILTER_H_ 21 #define FST_ARCFILTER_H_ 42 return arc.ilabel == 0 && arc.olabel == 0;
50 bool operator()(
const Arc &arc)
const {
return arc.ilabel == 0; }
57 bool operator()(
const Arc &arc)
const {
return arc.olabel == 0; }
65 using Label =
typename Arc::Label;
68 bool keep_match =
true)
69 : label_(label), match_input_(match_input), keep_match_(keep_match) {}
72 const bool match = (match_input_ ? arc.ilabel : arc.olabel) == label_;
73 return keep_match_ ? match : !match;
78 const bool match_input_;
79 const bool keep_match_;
86 using Label =
typename Arc::Label;
89 : match_input_(match_input), keep_match_(keep_match) {}
92 const Label label = match_input_ ? arc.ilabel : arc.olabel;
93 const bool match = labels_.Find(label) != labels_.End();
94 return keep_match_ ? match : !match;
101 const bool match_input_;
102 const bool keep_match_;
107 #endif // FST_ARCFILTER_H_ void AddLabel(Label label)
typename Arc::Label Label
MultiLabelArcFilter(bool match_input=true, bool keep_match=true)
LabelArcFilter(Label label, bool match_input=true, bool keep_match=true)
bool operator()(const Arc &arc) const
typename Arc::Label Label
bool operator()(const Arc &arc) const
bool operator()(const Arc &arc) const
bool operator()(const Arc &arc) const
bool operator()(const Arc &arc) const