Skip to content
/ ebclient Public

A simple CLI program for accessing EPWING dictionaries

License

Notifications You must be signed in to change notification settings

sagan/ebclient

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ebclient is a simple CLI program for accessing EPWING & 電子ブック dictionaries. It accepts queries from stdin and outputs results to stdout. It's used as the backend of EBWeb.

Dependencies

  • libebu. It's a fork of libeb (EB ライブラリ) which adds UTF-8 support to the latter.
  • libmxml. Used for accessing xml format gaiji (外字) - unicode mapping files that some epwing dictioneries provide.
  • libz (apt-get install lib32z1-dev)

Build

Install build tools (apt-get install build-essential libtool-bin) and run make in src/ dir. The dependencies must be compiled priorly and put to corresponding locations which are referenced in Makefile.

Usage

./ebclient <dicts_path>

<dicts_path> is the dir where epwing dictionaries files are put at, e.g.:

dicts_path/
|---dict_A/
|------CATALOGS
|------subbook_1/
|------subbook_2/
|---dict_B/
|------CATALOGS
|------subbook_1/
|------subbook_2/

libeb project provides appendix (補助データ) files for some known dictionaries. For epwing dictionary, put the appendix file in the "subbook" folder (the dir where "honmon" file exists) and rename it to "furoku". For 電子ブック dictionary, put it to the subbook folder (the dir where "start" file exists) and keep the original "appendix" name unchanged.

Communication protocol

When started, ebclient output the flatten list of all subbooks of all dictionaries in dicts_path in json format (with a trailing \n), e.g.:

["広辞苑第六版","付属資料","NHK 日本語発音アクセント辞典"]

Afterwards, it read queries from stdin line by line, and output results to stdout in the same order.

Basic (input) query format:

<subbook_index> <query_type> <keyword>
  • <subbook_index> : the subbook index (0-based) in the flatten list to query
  • <query_type>: 0: prefix match; 1: suffix match; 2: exact match

Basic (output) result format (json):

[heading1, text1, heading2, text2...]

There are other query formats, distinguished by the first char of query line. For example, query line starts with d read an audio (wav) content from dictionary. For more, read the codes.

About

A simple CLI program for accessing EPWING dictionaries

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published