0.2.2 • Published 3 years ago
@heppokofrontend/dictionary-file-maker v0.2.2
@heppokofrontend/dictionary-file-maker
The dictMaker() method convert object to IME user dictionary tool config file.
See these instructions on how to use the text files exported by this tool.
Usage
Installation:
npm install --save-dev @heppokofrontend/dictionary-file-makerExample:
import { dictMaker } from '@heppokofrontend/dictionary-file-maker';
const obj = [
{
input: 'かな1',
output: '単語A',
},
{
input: 'かな2',
output: '単語B',
},
{
input: 'かな3',
output: '単語C',
},
];
dictMaker(obj, 'win', './result.txt'); // The text file is writen.:warning: The "~" varies depending on the OS.
const windows = json.replace(/〜/g, '~');
const macOS = json.replace(/~/g, '〜');Syntax
dictMaker(src, type, dist);Parameters
src - {input, output [, type]}[]
The dictionary data array object, or parsed JSON.
[
{
"input": "かな",
"output": "単語",
"type": "品詞"
}
]| property | type | default | required | description |
|---|---|---|---|---|
input | string | "" | true | The "yomi" of word in Japanese. |
output | string | "" | true | The word of conversion result. |
type | string | Will be described later | - | It's the parts of speech. Default value varies depending on the export target platform. |
The type prop is able to use those values.
- for Windows
名詞(default)短縮よみ人名地名顔文字
- for macOS
普通名詞(default)サ変名詞人名地名形容詞副詞接尾語動詞
FYI:
https://blogs.windows.com/japan/2017/02/17/imejptips4/
https://support.apple.com/ja-jp/guide/japanese-input-method/jpim10211/6.3/mac/11.0
type - string
The target platform name.
win- For Windows IMEwin-google- For "Google 日本語入力" on Windowsmac- For macOS IME
dist - string
Dictionary text file export destination.
CLI
dict-maker [source] [options]
# sample
dict-maker yourfile.json --mac --win --winGoogle --out ./dictionary -o, --out Specify an output folder for dictionary files. [string]
--win Enable the export of dictionary data for Windows 10 standard IME. [boolean]
--winGoogle Enable the export of dictionary data for Google IME on Windows 10. [boolean]
--mac Enable the export of dictionary data for macOS IME [boolean]Contributing
- Fork it!
- Create your feature branch:
git checkout -b my-new-feature - Commit your changes:
git commit -am 'Add some feature' - Push to the branch:
git push origin my-new-feature - Submit a pull request :D
License
MIT