Kujin
Install
# npm $ npm install kujin kuromoji # or yarn $ yarn add kujin kuromoji
Usage
const Kujin = const kujin = ; async { /** * [ [ '古池', 'や' ], [ '蛙', '飛び込む' ], [ '水', 'の', '音' ] ] **/ const ku = await kujin;};
Documents
Kujin Node
Kujin
uses Node which extended kuromoji.js ipadic feature.
const node = word_id: 189220 word_type: 'KNOWN' word_position: 8 surface_form: '句' pos: '名詞' pos_detail_1: '一般' pos_detail_2: '*' pos_detail_3: '*' conjugated_type: '*' conjugated_form: '*' basic_form: '句' reading: 'ク' pronunciation: 'ク' head: true tail: true
Kujin(options)
const kujin = ;
dicPath : string
path to dictionary.
default: node_modules/kuromoji/dict
noHeads : Node[]
default:
noHeads: pos: '助詞' pos: '助動詞' pos: 'フィラー'
noTails : Node[]
default:
noTails: pos: '動詞' conjugated_form: '未然形' pos: '接頭詞'
trims : Node[]
Node filter. trims remove Nodes.
default:
trims: pos: '記号' pos: '名詞' surface_form: '!' pos: '名詞' surface_form: '?' pos: '名詞' surface_form: ')'
rule : number[]
default: [5, 7, 5]
parse rule.
kujin.find(text, [options])
text
:string
options
:object
flat
:boolean
- default is
false
- default is
find out Ku from text.
/** * [ [ '古池', 'や' ], [ '蛙', '飛び込む' ], [ '水', 'の', '音' ] ] **/const ku = await kujin; /** * '古池や 蛙飛び込む 水の音' **/const ku = await kujin;
kujin.findAll(text, [options])
text
:string
optioins
:object
flat
:boolean
- default is
false
- default is
find out all Ku from text.
/** * [ * [ * [ '古池', 'や' ], [ '蛙', '飛び込む' ], [ '水', 'の', '音' ] * ], * [ * [ '柿', 'く', 'へ', 'ば' ], [ '鐘', 'が', '鳴る', 'なり' ], [ '法隆寺' ] * ] * ] **/const ku = await kujin; /** * [ * '古池や 蛙飛び込む 水の音', * '柿くへば 鐘が鳴るなり 法隆寺' * ] **/const ku = await kujin;