<commit_before>//
// Copyright RIME Developers
// Distributed under the BSD License
//
// 2011-11-27 <NAME> <<EMAIL>>
//
#ifndef RIME_DICT_COMPILER_H_
#define RIME_DICT_COMPILER_H_

#include <rime_api.h>
#include <rime/common.h>

namespace rime {

class Dictionary;
class Prism;
class Table;
class ReverseDb;
class DictSettings;
class EditDistanceCorrector;
class EntryCollector;
class Vocabulary;
class ResourceResolver;

class DictCompiler {
 public:
  enum Options {
    kRebuildPrism = 1,
    kRebuildTable = 2,
    kRebuild = kRebuildPrism | kRebuildTable,
    kDump = 4,
  };

  RIME_API explicit DictCompiler(Dictionary *dictionary);
  virtual ~DictCompiler();

  RIME_API bool Compile(const string &schema_file);
  void set_options(int options) { options_ = options; }

 private:
  bool BuildTable(int table_index,
                  EntryCollector& collector,
                  DictSettings* settings,
                  const vector<string>& dict_files,
                  uint32_t dict_file_checksum);
  bool BuildPrism(const string& schema_file,
                  uint32_t dict_file_checksum,
                  uint32_t schema_file_checksum);
  bool BuildReverseDb(DictSettings* settings,
                      const EntryCollector& collector,
                      const Vocabulary& vocabulary,
                      uint32_t dict_file_checksum);

  const string& dict_name_;
  const vector<string>& packs_;
  an<Prism> prism_;
  an<EditDistanceCorrector> correction_;
  vector<of<Table>> tables_;
  int options_ = 0;
  the<ResourceResolver> source_resolver_;
  the<ResourceResolver> target_resolver_;
};

}  // namespace rime

#endif  // RIME_DICT_COMPILER_H_
<commit_msg>chore(dict_compoiler): fix link error in rime_test on windows<commit_after>//
// Copyright RIME Developers
// Distributed under the BSD License
//
// 2011-11-27 <NAME> <<EMAIL>>
//
#ifndef RIME_DICT_COMPILER_H_
#define RIME_DICT_COMPILER_H_

#include <rime_api.h>
#include <rime/common.h>

namespace rime {

class Dictionary;
class Prism;
class Table;
class ReverseDb;
class DictSettings;
class EditDistanceCorrector;
class EntryCollector;
class Vocabulary;
class ResourceResolver;

class DictCompiler {
 public:
  enum Options {
    kRebuildPrism = 1,
    kRebuildTable = 2,
    kRebuild = kRebuildPrism | kRebuildTable,
    kDump = 4,
  };

  RIME_API explicit DictCompiler(Dictionary *dictionary);
  RIME_API virtual ~DictCompiler();

  RIME_API bool Compile(const string &schema_file);
  void set_options(int options) { options_ = options; }

 private:
  bool BuildTable(int table_index,
                  EntryCollector& collector,
                  DictSettings* settings,
                  const vector<string>& dict_files,
                  uint32_t dict_file_checksum);
  bool BuildPrism(const string& schema_file,
                  uint32_t dict_file_checksum,
                  uint32_t schema_file_checksum);
  bool BuildReverseDb(DictSettings* settings,
                      const EntryCollector& collector,
                      const Vocabulary& vocabulary,
                      uint32_t dict_file_checksum);

  const string& dict_name_;
  const vector<string>& packs_;
  an<Prism> prism_;
  an<EditDistanceCorrector> correction_;
  vector<of<Table>> tables_;
  int options_ = 0;
  the<ResourceResolver> source_resolver_;
  the<ResourceResolver> target_resolver_;
};

}  // namespace rime

#endif  // RIME_DICT_COMPILER_H_

{'fraction_non_alphanumeric': 0.08092316681273737, 'fraction_numerical': 0.011685655857435, 'mean_word_length': 3.1705237515225333, 'pattern_counts': {'":': 0, '<': 29, '<?xml version=': 0, '>': 29, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6789491', 'n_tokens_mistral': 1127, 'n_tokens_neox': 1050, 'n_words': 258}