@heppokofrontend/dictionary-file-maker
TypeScript icon, indicating that this package has built-in type declarations

0.2.2 • Public • Published

@heppokofrontend/dictionary-file-maker

MIT License Published on NPM test workflow Maintainability Test Coverage Known Vulnerabilities @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.

⚠️ 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 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

  1. Fork it!
  2. Create your feature branch: git checkout -b my-new-feature
  3. Commit your changes: git commit -am 'Add some feature'
  4. Push to the branch: git push origin my-new-feature
  5. Submit a pull request :D

License

MIT

Package Sidebar

Install

npm i @heppokofrontend/dictionary-file-maker

Weekly Downloads

1

Version

0.2.2

License

MIT

Unpacked Size

11.6 kB

Total Files

9

Last publish

Collaborators

  • heppokofrontend