A toy SKK skkserv. Just made this for fun.
This is a rewritten of toyskkserv-go in Zig.
- Configurable dictionary via urls.
.gz
,.tar.gz
are supported. - EUC-JIS-2004, UTF-8 dictionaries are supported.
- Google Transliterate API
The following commands are supported:
0
: disconnect1midashi
: request candidates2
: get skkserv version3
: get skkserv host4midashi
: request completion
Some custom protocol for internal us:
5reload
: reload dictionaries without restart- ...
$ zig build -Doptimize=ReleaseSafe && cp ./zig-out/bin/toyskkserv /usr/local/bin
$ brew tap waynezhang/homebrew-tap && brew install toyskkserv
A configuration file is required. toyskkserv tries to find toyskkserv.zon
in the following order:
$HOME/.config
- Current directory
Copy the sample file to the directory and start running:
$ toyskkserv serve [-v]
- Or
brew services start toyskkserv
serve
: Start the serverupdate
: Update dictionaries from internet.reload
: Tell the server to reload all dictionaries from disk--help
: Show help
.dictionary_directory = ""
: The directory where the dictionaries are downloaded to.
.listen_addr = "127.0.0.1:1178"
: The host and port that the server listens to. It's recommended to only listen to localhost.
.fallback_to_google = true
: Enable the request to Google Transliterate API.
If it's enabled, toyskkserv calls this API if there is no candidates found in local directionaries.
Plus, toyskkserv doesn't return any candidates if no candidates are found for exactly the original word segment to avoid the noise. For example, Goolge API returns the following response for ここではきものをぬぐ
:
[
["ここでは",
["ここでは", "個々では", "此処では"],
],
["きものを",
["着物を", "きものを", "キモノを"],
],
["ぬぐ",
["脱ぐ", "ぬぐ", "ヌグ"],
],
]
Since there are no word segment for the original request ここではきものをぬぐ
, no candidates will be returned. However, if the request word is ここでは
and Google API returns the following response:
[
[
"ここでは",
[
"ここでは",
"個々では",
"此処では",
"ココでは",
"ココデは"
]
]
]
toyskkserv returns /ここでは/個々では/此処では/ココでは/ココデは/
as response to SKK client.
.dictionaries = .{
.{ .url = "https://skk-dev.github.io/dict/SKK-JISYO.L.gz" }, // 基本辞書
.{ .url = "https://skk-dev.github.io/dict/zipcode.tar.gz", .files = "zipcode/SKK-JISYO.zipcode, zipcode/SKK-JISYO.office.zipcode" },
.{ .url = "~/skk-dict/some_dict_file" },
},
URL and local file paths are supported. toyskkserv downloads remote dictionaries to the folder that defined above. The local dictionaries are refered directly and not copied to anywhere.