20 #ifndef FST_ARCFILTER_H_ 21 #define FST_ARCFILTER_H_ 40 return arc.ilabel == 0 && arc.olabel == 0;
48 bool operator()(
const Arc &arc)
const {
return arc.ilabel == 0; }
55 bool operator()(
const Arc &arc)
const {
return arc.olabel == 0; }
63 using Label =
typename Arc::Label;
66 bool keep_match =
true)
67 : label_(label), match_input_(match_input), keep_match_(keep_match) {}
70 const bool match = (match_input_ ? arc.ilabel : arc.olabel) == label_;
71 return keep_match_ ? match : !match;
76 const bool match_input_;
77 const bool keep_match_;
84 using Label =
typename Arc::Label;
87 : match_input_(match_input), keep_match_(keep_match) {}
90 const Label label = match_input_ ? arc.ilabel : arc.olabel;
91 const bool match = labels_.Find(label) != labels_.End();
92 return keep_match_ ? match : !match;
99 const bool match_input_;
100 const bool keep_match_;
105 #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