inline SymsIndex countRuleSrcSymbols(Syms const& ngram) { SymsIndex r = 0; for (Syms::const_iterator i = ngram.begin(), e = ngram.end(); i != e; ++i) r += Vocabulary::isRuleSrcSymbol(*i); return r; }
/** convenience. doesn't call finishPhrase. */ void phrase(Syms const& syms, IVocabulary& voc) const { for (Syms::const_iterator i = syms.begin(), e = syms.end(); i != e; ++i) operator()(voc.str(*i)); }
inline bool isLexical(Syms const& syms) { for (Syms::const_iterator i = syms.begin(), e = syms.end(); i != e; ++i) if (!i->isLexical()) return false; return true; }
inline unsigned nLexical(Syms const& syms) { unsigned count = 0; for (Syms::const_iterator i = syms.begin(), e = syms.end(); i != e; ++i) count += i->isLexical(); return count; }
std::size_t operator()( Syms const& sig ) const { return RangeHash(sig.begin(), sig.end()); }