Skip to content

Commit

Permalink
fix(dict_compiler): build prism with loaded syllabary when not rebuil…
Browse files Browse the repository at this point in the history
…ding primary table
  • Loading branch information
kionz committed Jul 26, 2020
1 parent 930074c commit 93fe827
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
11 changes: 8 additions & 3 deletions src/rime/dict/dict_compiler.cc
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,6 @@ bool DictCompiler::Compile(const string &schema_file) {
}
if (rebuild_prism &&
!BuildPrism(schema_file,
syllabary,
dict_file_checksum,
schema_file_checksum)) {
return false;
Expand Down Expand Up @@ -289,13 +288,19 @@ bool DictCompiler::BuildReverseDb(DictSettings* settings,
}

bool DictCompiler::BuildPrism(const string &schema_file,
const Syllabary& syllabary,
uint32_t dict_file_checksum,
uint32_t schema_file_checksum) {
LOG(INFO) << "building prism...";
prism_ = New<Prism>(RelocateToUserDirectory(prefix_, prism_->file_name()));

// apply spelling algebra and prepare corrections (if enabled)
// get syllabary from primary table, which may not be rebuilt
Syllabary syllabary;
const auto& primary_table = tables_[0];
if (!primary_table->Load() ||
!primary_table->GetSyllabary(&syllabary) ||
syllabary.empty())
return false;
// apply spelling algebra and prepare corrections (if enabled)
Script script;
if (!schema_file.empty()) {
Config config;
Expand Down
1 change: 0 additions & 1 deletion src/rime/dict/dict_compiler.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ class DictCompiler {
const vector<string>& dict_files,
uint32_t dict_file_checksum);
bool BuildPrism(const string& schema_file,
const Syllabary& syllabary,
uint32_t dict_file_checksum,
uint32_t schema_file_checksum);
bool BuildReverseDb(DictSettings* settings,
Expand Down

0 comments on commit 93fe827

Please sign in to comment.