Welcome to mirror list, hosted at ThFree Co, Russian Federation.

renumber.hh « common « lm - github.com/kpu/kenlm.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 03e7d48dcc5ec89a1fa542a50fff62977b3f4f84 (plain)
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
/* 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