33 typedef std::unordered_map<unsigned,unsigned> MapType;
35 MapType mapper, rmapper;
37 MapType omapper, romapper;
41 inline unsigned const map (
unsigned idx)
const {
42 MapType::const_iterator itx = mapper.find (idx);
43 if (itx != mapper.end() ) {
49 inline unsigned const rmap (
unsigned idx)
const {
50 MapType::const_iterator itx = rmapper.find (idx);
51 if (itx != rmapper.end() )
57 inline unsigned const mapOutput (
unsigned idx)
const {
58 MapType::const_iterator itx = omapper.find (idx);
59 if (itx != omapper.end() ) {
66 MapType::const_iterator itx = romapper.find (idx);
67 if (itx != romapper.end() )
73 inline void add (
unsigned grammar_idx,
unsigned lm_idx) {
74 LDEBUG (
"grammar idx=" << grammar_idx <<
", lm_idx=" << lm_idx);
75 mapper[grammar_idx] = lm_idx;
77 rmapper[lm_idx] = grammar_idx;
82 inline void addOutput (
unsigned grammar_idx,
unsigned lm_idx) {
83 LDEBUG (
"ovocab: grammar idx=" << grammar_idx <<
", lm_idx=" << lm_idx);
84 omapper[grammar_idx] = lm_idx;
86 romapper[lm_idx] = grammar_idx;