MyStem
This module contains a wrapper for an excellent morphological analyzer for Russian language Yandex Mystem 3.0 released in June 2014. A morphological analyzer can perform lemmatization of text and derive a set of morphological attributes for each token.
This module start mystem as separate process and commucates with it. This allows to avoid process start overhead.
Example
var MyStem = require('mystem3');
var mystem = new MyStem();
mystem.start(); // Run mystem in separate process
var sentence = 'Морфологический анализатор для русского языка';
mystem.analyze(sentence)
.then(res => {
mystem.stop();
console.log(res.join(',').split(','));
});
Methods
new MyStem(options)
Return myStem object. Supported options are:
- "path" (optional, by default module downloads mystem binary itself) - path to mystem executable. If PATH env variable contains path to the folder with mystem binary then you can write
new MyStem({"path": "mystem"})
myStem.start()
Starts mystem as separate process and establishes commucation with it. This gives huge performance boost. As we do not need to start mystem for every word
myStem.stop()
Stops mystem process. Will be automatically stopped on process.exit();
myStem.analyze(word)
Returns promise with analyzed version for passed word/words
AUTHOR
koorchik (Viktor Turskyi)
TODO
- Add support for all mystem grammemes