Skip to content
/ jmorphy2 Public
forked from anti-social/jmorphy2

Java port of the pymorphy2

Notifications You must be signed in to change notification settings

OWOX/jmorphy2

 
 

Repository files navigation

Travis Status Appveyor status

Jmorphy2

Java port of the pymorphy2

Clone project:

git clone https://github.com/anti-social/jmorphy2
cd jmorphy2

Compile project, build jars and run tests:

Build with vagga (no java and gradle needed):

vagga build

Same with gradle (minimum gradle version is 3.3):

gradle build

To see all available vagga commands just type vagga

Elasticsearch plugin

Default elasticsearch version against which plugin is built is 5.5.2

To build for specific elastisearch version run build as:

vagga assemble -PesVersion=5.4.1

Or:

gradle assemble -PesVersion=5.4.1

Supported elasticsearch versions: 5.4.x, 5.5.x

Install plugin:

export es_home=/opt/elasticsearch
sudo ${es_home}/bin/elasticsearch-plugin install file:jmorphy2-elasticsearch/build/distributions/analysis-jmorphy2-0.2.0-SNAPSHOT-es-5.5.2.zip

Or just run elasticsearch inside the container:

# build container and run elasticsearch with jmorphy2 plugin
vagga elastic

Test elasticsearch with jmorphy2 plugin

Create index with specific analyzer and test it:

cd ${es_home}
bin/elasticsearch

# open new tab
curl -XPUT 'localhost:9200/test_index' -d '---
settings:
  index:
    analysis:
      filter:
        delimiter:
          type: word_delimiter
          preserve_original: true
        jmorphy2_russian:
          type: jmorphy2_stemmer
          name: ru
        jmorphy2_ukrainian:
          type: jmorphy2_stemmer
          name: uk
      analyzer:
        text_ru:
          tokenizer: whitespace
          filter:
          - delimiter
          - lowercase
          - jmorphy2_russian
        text_uk:
          tokenizer: whitespace
          filter:
          - delimiter
          - lowercase
          - jmorphy2_ukrainian
'

# Test russian analyzer
curl -XGET 'localhost:9200/test_index/_analyze?analyzer=text_ru&pretty' -d 'Привет, лошарики!'
curl -XGET 'localhost:9200/test_index/_analyze?analyzer=text_ru&pretty' -d 'ёж еж ежики'

# Test ukrainian analyzer
curl -XGET 'localhost:9200/test_index/_analyze?analyzer=text_uk&pretty' -d 'Пригоди Котигорошка'
curl -XGET 'localhost:9200/test_index/_analyze?analyzer=text_uk&pretty' -d 'їжаки'
curl -XGET 'localhost:9200/test_index/_analyze?analyzer=text_uk&pretty' -d "комп'ютером"

About

Java port of the pymorphy2

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Java 100.0%