File size: 755 Bytes
1ce325b
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
/* Map vocab ids.  This is useful to merge independently collected counts or
 * change the vocab ids to the order used by the trie.
 */
#ifndef LM_COMMON_RENUMBER_H
#define LM_COMMON_RENUMBER_H

#include "../word_index.hh"

#include <cstddef>

namespace util { namespace stream { class ChainPosition; }}

namespace lm {

class Renumber {
  public:
    // Assumes the array is large enough to map all words and stays alive while
    // the thread is active.
    Renumber(const WordIndex *new_numbers, std::size_t order)
      : new_numbers_(new_numbers), order_(order) {}

    void Run(const util::stream::ChainPosition &position);

  private:
    const WordIndex *new_numbers_;
    std::size_t order_;
};

} // namespace lm
#endif // LM_COMMON_RENUMBER_H