Newer
Older
* COMMENT -*- mode: org -*-
#+Date: 2019-04-05
#+STARTUP: content
* notes :entry:
** 2019-08-31 ibus-pinyin userdb inference notice.
zero-pinyin-service reuse ibus-pinyin's userdb at
~/.cache/ibus/pinyin/user-1.0.db
This is generally not a problem. But if ibus-pinyin changed their table schema
in the future, zero-pinyin-service may require update.
zero-pinyin-service also store user phrase in this db. So user phrases are
shared between zero-pinyin and ibus-pinyin.
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
** 2019-04-05 zero-pinyin-service file structure :doc:
- zero-pinyin-service
- main.c
a console application based on glib and gio.
provides dbus service. see the zero-pinyin-service spec at
~/c/gtk-im-module/operational :id001:
- zero-pinyin-service.h
zero-pinyin-service.c
zero-pinyin-service-test.c
contains the zero-pinyin-service dbus method C based implementation.
- parse-pinyin.h
parse-pinyin.cpp
parse-pinyin-test.cpp
contains utility functions based on code from libpyzyz. This should be
replaced eventually. I don't want to depend on libpyzy source code.
- utilities
- test-sql.sh
a shell script to experiment SQL commands
- data files
- meson.build
build script. used to create executable.
- com.emacsos.zero.ZeroPinyinService.service
dbus service definition file.
Should be copied to dbus service file dir /usr/share/dbus-1/services/
When dbus client try to talk to service, dbus session bus will start the
service app automatically.
* later :entry:
* current :entry:
**
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
** 2019-10-22 handle a an o en etc differently. only match exactly the character.
no fuzzy matching or incomplete pinyin matching.
if shengmu is 0, always strict match it.
do not allow omit shengmu in zero.
ao men
澳门
e nuo
婀娜
- DONE use different FLAGS for them.
FLAGS doesn't affect pinyin parsing.
if flag support is to be added, just add it in appdata, as property.
then use the property when building SQL.
- DONE test in bogon VM.
- DONE git push
- build on debian 9 and release deb. later.
- problems
- result = parse_pinyin("an", 15, PINYIN_FUZZY_ALL);
this only return 1 result.
not an and ang.
why?
- maybe flag is not used when parsing pinyin string. only used when building
the SQL statement.
build_sql_for_n_pinyin()
build_where_clause(pylist, n);
yes. here. I should pass the flags around.
-
** 2019-08-31 how to format C code? do it before git commit.
see ~/c/gtk-im-module/, it uses myastyle-pre-commit-check in git pre-commit
~/bin/myastyle-pre-commit-check
** 2019-08-31 honor XDG cache dir.
~/.cache/ibus
** 2019-04-17 make flags configurable at runtime.
- add dbus method to set flags.
- make the method work. use gobject property maybe.
- set default flags to my flags. reflect this in UI/config file.
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
** 2019-08-31 choose maindb like my patched libpyzy.
- here is patched libpyzy maindb logic:
files.push_back (m_user_data_dir + "/main.db");
files.push_back (PKGDATADIR"/db/local.db");
files.push_back (PKGDATADIR"/db/open-phrase.db");
files.push_back (PKGDATADIR"/db/android.db");
return first_existing_file (files);
m_user_data_dir default is ~/.cache/ibus/pinyin/
PKGDATADIR default is /usr/share/pyzy/
in zero-pinyin-service, just use the first existing file:
~/.cache/ibus/pinyin/main.db
/usr/share/pyzy/db/open-phrase.db
/usr/share/pyzy/db/android.db
- should I reuse the ibus-pinyin userdb file?
~/.cache/ibus/pinyin/user-1.0.db
yes. ibus-pinyin is not going away.
DONE document this behavior in zero-el and zero-pinyin-service.
- init_userdb()
sqlite3_mprintf()
https://www.sqlite.org/c3ref/mprintf.html
additional non-standard formats (%q, %Q, %w, and %z).
| | in | out | used for |
|----+------+---------+----------------------------------------------------------|
| %q | ab'c | ab''c | SQL string literal |
| %Q | ab'c | 'ab''c' | SQL string literal |
| %w | ab"c | ab""c | SQL identifier name |
| %z | abc | abc | like %s, but sqlite3_free() is called on param after use |