https://github.com/hexenq/kuroshiro-analyzer-mecab
Mecab morphological analyzer for kuroshiro.
https://github.com/hexenq/kuroshiro-analyzer-mecab
analyzer hiragana japanese kanji katakana kuroshiro language mecab morphology romaji
Last synced: 8 months ago
JSON representation
Mecab morphological analyzer for kuroshiro.
- Host: GitHub
- URL: https://github.com/hexenq/kuroshiro-analyzer-mecab
- Owner: hexenq
- License: mit
- Created: 2018-06-23T01:21:02.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2018-08-15T07:01:07.000Z (almost 8 years ago)
- Last Synced: 2025-05-01T10:08:22.230Z (about 1 year ago)
- Topics: analyzer, hiragana, japanese, kanji, katakana, kuroshiro, language, mecab, morphology, romaji
- Language: JavaScript
- Homepage:
- Size: 14.6 KB
- Stars: 4
- Watchers: 2
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# kuroshiro-analyzer-mecab
[](https://travis-ci.org/hexenq/kuroshiro-analyzer-mecab)
[](http://badge.fury.io/js/kuroshiro-analyzer-mecab)
Package
kuroshiro-analyzer-mecab
Description
mecab morphological analyzer for kuroshiro.
Compatibility
Node
✓ (>=6)
Browser
✗
## Pre-requisite
You should have `mecab` and corresponding dictionary installed in your environment. And make sure that your have added `mecab` command to your `$PATH` environment variable. This analyzer will invoke `mecab` from command line when parsing.
For install instructions of `mecab`, you could check the official website of mecab from [here](http://taku910.github.io/mecab/#install).
## Install
```sh
$ npm install kuroshiro-analyzer-mecab
```
## Usage with kuroshiro
### Configure analyzer
This analyzer utilizes [mecab](http://taku910.github.io/mecab/) morphological analyzer.
The [mecab-ipadic-neologd](https://github.com/neologd/mecab-ipadic-neologd) dictionary is recommanded which includes many neologisms (new word) and periodically updated.
```js
import MecabAnalyzer from "kuroshiro-analyzer-mecab";
const analyzer = new MecabAnalyzer();
await kuroshiro.init(analyzer);
```
### Initialization Parameters
__Example:__
```js
const analyzer = new MecabAnalyzer({
dictPath: "/usr/lib/mecab/dic/mecab-ipadic-neologd/",
execOptions: {
maxBuffer: 200 * 1024,
timeout: 0
}
});
```
- `command`: *Optional* mecab command (may have arguments). If set, the param `dictPath` is ignored
- `dictPath`: *Optional* Path of the dictionary mecab used
- `execOptions`: *Optional* The exec options to run mecab command. Example as below:
```js
{
// Largest amount of data in bytes allowed on stdout or stderr. see https://nodejs.org/api/child_process.html#child_process_child_process_exec_command_options_callback.
maxBuffer: 200 * 1024,
// Timeout. see https://nodejs.org/api/child_process.html#child_process_child_process_exec_command_options_callback.
timeout: 0
}
```