@sglkc/kuroshiro-analyzer-kuromoji
Version:
Forked version of kuroshiro-analyzer-kuromoji with TypeScript support and better compatibility for browsers
54 lines (45 loc) • 1.8 kB
Markdown
# kuroshiro-analyzer-kuromoji
[](https://travis-ci.org/hexenq/kuroshiro-analyzer-kuromoji)
[](https://coveralls.io/github/hexenq/kuroshiro-analyzer-kuromoji?branch=master)
[](http://badge.fury.io/js/kuroshiro-analyzer-kuromoji)
<table>
<tr>
<td>Package</td>
<td colspan=2>kuroshiro-analyzer-kuromoji</td>
</tr>
<tr>
<td>Description</td>
<td colspan=2>Kuromoji morphological analyzer for <a href="https://github.com/hexenq/kuroshiro">kuroshiro</a>.</td>
</tr>
<tr>
<td rowspan=2>Compatibility</td>
<td>Node</td>
<td>✓ (>=6)</td>
</tr>
<tr>
<td>Browser</td>
<td>✓</td>
</tr>
</table>
## Install
```sh
$ npm install kuroshiro-analyzer-kuromoji
```
*For legacy frontend workflows, you could include `dist/kuroshiro-analyzer-kuromoji.min.js` in your page and the exported name is `KuromojiAnalyzer`. (you may first build it from source with `npm run build` after `npm install`)*
## Usage with kuroshiro
### Configure analyzer
This analyzer utilizes [kuromoji.js](https://github.com/takuyaa/kuromoji.js).
You could specify the path of your dictionary files with `dictPath` param.
```js
import KuromojiAnalyzer from "kuroshiro-analyzer-kuromoji";
const analyzer = new KuromojiAnalyzer();
await kuroshiro.init(analyzer);
```
### Initialization Parameters
__Example:__
```js
const analyzer = new KuromojiAnalyzer({
dictPath: "url/to/dictionary_files"
});
```
- `dictPath`: *Optional* Path of the dictionary files