Code Monkey home page Code Monkey logo

russianmorphology's Introduction

Russian Morphology for lucene

Russian and English morphology for java and lucene 3.0 framework based on open source dictionary from site АОТ. It use dictionary base morphology with some heuristics for unknown words. It support homonym for example for Russian word "вина" it gives two variants "вино" and "вина".

How to use

First download morph-1.0.jar
and add it to your class path. When download Russian or English package.

If you use maven you can add dependency

    <dependency>
        <groupId>org.apache.lucene.morphology</groupId>
        <artifactId>russian</artifactId>
        <version>1.1</version>
    </dependency>


    <dependency>
        <groupId>org.apache.lucene.morphology</groupId>
        <artifactId>english</artifactId>
        <version>1.1</version>
    </dependency>

Don't forget add link to repository

<repositories>
...............
  <repository>
    <snapshots>
      <enabled>false</enabled>
    </snapshots>
    <id>bintray-akuznetsov-russianmorphology</id>
    <name>bintray</name>
    <url>http://dl.bintray.com/akuznetsov/russianmorphology</url>
  </repository>
</repositories>

Now you can create a Lucene Analyzer

  RussianAnalayzer russian = new RussianAnalayzer();
  EnglishAnalayzer english = new EnglishAnalayzer();

You can write you own analyzer using filter that convert word in it's right forms.

  LuceneMorphology luceneMorph = new EnglishLuceneMorphology();
  TokenStream tokenStream = new MorphlogyFilter(result, luceneMorph);

Because usually LuceneMorphology contains a lot data needing for it functionality, it is better didn't create this object for each MorphologyFilter.

Also if you need get a list of base forms of word, you can use following example

 LuceneMorphology luceneMorph = new EnglishLuceneMorphology();
 List<String> wordBaseForms = luceneMorph.getMorphInfo(word);

Restrictions

  • It works only with UTF-8.
  • It assume what letters е and ё are the same.
  • Word forms with prefixes like "наибольший" treated as separate word.

russianmorphology's People

Contributors

akuznetsov avatar imotov avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.