52 FSTERROR() <<
"Union: Input/output symbol tables of 1st argument " 53 <<
"do not match input/output symbol tables of 2nd argument";
57 const auto numstates1 = fst1->
NumStates();
58 const bool initial_acyclic1 =
62 const auto start2 = fst2.
Start();
69 (initial_acyclic1 ? 0 : 1));
73 const auto s2 = siter.Value();
77 auto arc = aiter.Value();
78 arc.nextstate += numstates1;
79 fst1->
AddArc(s1, std::move(arc));
82 const auto start1 = fst1->
Start();
88 if (initial_acyclic1) {
89 fst1->
AddArc(start1, Arc(0, 0, start2 + numstates1));
91 const auto nstart1 = fst1->
AddState();
93 fst1->
AddArc(nstart1, Arc(0, 0, start1));
94 fst1->
AddArc(nstart1, Arc(0, 0, start2 + numstates1));
105 for (
const auto *fst2 : fsts2)
Union(fst1, *fst2);
182 #endif // FST_UNION_H_
virtual uint64_t Properties(uint64_t mask, bool test) const =0
StateIterator(const UnionFst< Arc > &fst)
virtual size_t NumArcs(StateId) const =0
const SymbolTable * InputSymbols() const override=0
constexpr uint64_t kError
constexpr uint64_t kInitialAcyclic
virtual Weight Final(StateId) const =0
virtual void SetStart(StateId)=0
typename ReplaceFst< Arc >::Arc Arc
CacheOptions RationalFstOptions
virtual void ReserveArcs(StateId, size_t)
UnionFst(const Fst< Arc > &fst1, const Fst< Arc > &fst2)
const SymbolTable * OutputSymbols() const override=0
typename Arc::StateId StateId
uint64_t UnionProperties(uint64_t inprops1, uint64_t inprops2, bool delayed=false)
void Union(RationalFst< Arc > *fst1, const Fst< Arc > &fst2)
constexpr uint64_t kCopyProperties
virtual void SetProperties(uint64_t props, uint64_t mask)=0
typename Arc::StateId StateId
virtual StateId Start() const =0
constexpr uint64_t kFstProperties
virtual void AddArc(StateId, const Arc &)=0
typename ReplaceFst< Arc >::Arc Arc
virtual const SymbolTable * InputSymbols() const =0
Arc::StateId CountStates(const Fst< Arc > &fst)
virtual StateId AddState()=0
virtual void ReserveStates(size_t)
virtual void SetFinal(StateId s, Weight weight=Weight::One())=0
ArcIterator(const UnionFst< Arc > &fst, StateId s)
typename Arc::Weight Weight
UnionFst(const Fst< Arc > &fst1, const Fst< Arc > &fst2, const UnionFstOptions &opts)
bool CompatSymbols(const SymbolTable *syms1, const SymbolTable *syms2, bool warning=true)
UnionFst(const UnionFst &fst, bool safe=false)
internal::RationalFstImpl< A > * GetMutableImpl() const
virtual StateId NumStates() const =0
constexpr uint64_t kExpanded
UnionFst * Copy(bool safe=false) const override
const internal::RationalFstImpl< A > * GetImpl() const
virtual const SymbolTable * OutputSymbols() const =0