@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-maker
Example:
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.
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 IME -
win-google
- For "Google 日本語入力" on Windows -
mac
- 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