From c2fd0cff5fa80ba1195a7fefa7454bdcca5f0960 Mon Sep 17 00:00:00 2001 From: Chen Gong Date: Mon, 19 Feb 2018 21:23:34 +0800 Subject: [PATCH] fix(dict_compiler): prism should load compiled schema Fixes #176 --- src/rime/dict/dict_compiler.cc | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/rime/dict/dict_compiler.cc b/src/rime/dict/dict_compiler.cc index 56f200bc1..b622a2d6e 100644 --- a/src/rime/dict/dict_compiler.cc +++ b/src/rime/dict/dict_compiler.cc @@ -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"); @@ -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::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);