Skip to content

Commit

Permalink
fix(dict_compiler): prism should load compiled schema
Browse files Browse the repository at this point in the history
Fixes #176
  • Loading branch information
lotem committed Feb 19, 2018
1 parent f920e4f commit c2fd0cf
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/rime/dict/dict_compiler.cc
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ static string LocateFile(const string& file_name) {
}

bool DictCompiler::Compile(const string &schema_file) {
LOG(INFO) << "compiling:";
LOG(INFO) << "compiling dictionary for " << schema_file;
bool build_table_from_source = true;
DictSettings settings;
string dict_file = LocateFile(dict_name_ + ".dict.yaml");
Expand Down Expand Up @@ -215,9 +215,13 @@ bool DictCompiler::BuildPrism(const string &schema_file,
// apply spelling algebra
Script script;
if (!schema_file.empty()) {
Config config;
if (!config.LoadFromFile(schema_file)) {
LOG(ERROR) << "error loading prism definition from " << schema_file;
return false;
}
Projection p;
the<Config> config(Config::Require("config")->Create(schema_file));
auto algebra = config->GetList("speller/algebra");
auto algebra = config.GetList("speller/algebra");
if (algebra && p.Load(algebra)) {
for (const auto& x : syllabary) {
script.AddSyllable(x);
Expand Down

0 comments on commit c2fd0cf

Please sign in to comment.