18 #ifndef FST_SYMBOL_TABLE_OPS_H_ 19 #define FST_SYMBOL_TABLE_OPS_H_ 29 #include <unordered_set> 39 std::unordered_set<typename Arc::Label> seen;
44 const auto sym = (input) ? aiter.Value().ilabel : aiter.Value().olabel;
49 for (
const auto &stitem : syms) {
50 const auto label = stitem.Label();
51 if (seen.count(label)) pruned->
AddSymbol(stitem.Symbol(), label);
77 bool *right_relabel_output =
nullptr);
92 #endif // FST_SYMBOL_TABLE_OPS_H_ const std::string & Name() const
int64_t AddSymbol(std::string_view symbol, int64_t key)
SymbolTable * CompactSymbolTable(const SymbolTable &syms)
SymbolTable * FstReadSymbols(const std::string &source, bool input)
SymbolTable * PruneSymbolTable(const Fst< Arc > &fst, const SymbolTable &syms, bool input)
SymbolTable * MergeSymbolTable(const SymbolTable &left, const SymbolTable &right, bool *right_relabel_output=nullptr)
bool AddAuxiliarySymbols(const std::string &prefix, int64_t start_label, int64_t nlabels, SymbolTable *syms)