Skip to content

Commit 5c793c9

Browse files
authored
move predict.db to build (#14)
1 parent 4b90e49 commit 5c793c9

File tree

3 files changed

+7
-5
lines changed

3 files changed

+7
-5
lines changed

.github/workflows/ci.yml

+4-3
Original file line numberDiff line numberDiff line change
@@ -42,10 +42,11 @@ jobs:
4242
- name: Build predict.db
4343
working-directory: build/bin
4444
run: |
45+
mkdir build
4546
wget https://github.com/rime/librime-predict/releases/download/data-1.0/predict.txt
46-
wget -O release.db https://github.com/rime/librime-predict/releases/download/data-1.0/predict.db
47-
cat predict.txt | ../plugins/predict/bin/build_predict
48-
diff predict.db release.db
47+
wget -O build/release.db https://github.com/rime/librime-predict/releases/download/data-1.0/predict.db
48+
cat predict.txt | ../plugins/predict/bin/build_predict build/predict.db
49+
diff build/{predict,release}.db
4950
5051
- name: Test
5152
working-directory: build/bin

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
librime plugin. predict next word.
33

44
## Usage
5-
* Put the db file (by default `predict.db`) in rime user directory.
5+
* Put the db file (by default `predict.db`) in `build/` under rime user directory.
66
* In `*.schema.yaml`, add `predictor` to the list of `engine/processors` before `key_binder`,
77
or patch the schema with: `engine/processors/@before 0: predictor`
88
* Add the `prediction` switch:

src/predictor.cc

+2-1
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,8 @@ Predictor* PredictorComponent::Create(const Ticket& ticket) {
136136
}
137137
if (!db_ || db_->file_name() != db_file) {
138138
the<ResourceResolver> res(
139-
Service::instance().CreateResourceResolver({"predict_db", "", ""}));
139+
Service::instance().CreateDeployedResourceResolver(
140+
{"predict_db", "", ""}));
140141
string path = res->ResolvePath(db_file).string();
141142
auto db = std::make_unique<PredictDb>(path);
142143
if (db && db->Load()) {

0 commit comments

Comments
 (0)