Adding support of lucene 5.0.0

This commit is contained in:
Alexander Kuznetsov
2015-03-21 00:38:55 +03:00
parent 2b5509c825
commit d300938502
6 changed files with 54 additions and 13 deletions

View File

@ -19,7 +19,6 @@ import org.apache.lucene.analysis.Analyzer;
import org.apache.lucene.analysis.tokenattributes.CharTermAttribute;
import org.apache.lucene.morphology.english.EnglishAnalyzer;
import org.apache.lucene.analysis.TokenStream;
import org.apache.lucene.analysis.tokenattributes.TermAttribute;
import org.apache.lucene.morphology.russian.RussianAnalyzer;
import org.junit.Test;
@ -66,6 +65,7 @@ public class AnalyzersTest {
InputStreamReader reader = new InputStreamReader(stream, "UTF-8");
TokenStream tokenStream = morphlogyAnalyzer.tokenStream(null, reader);
tokenStream.reset();
HashSet<String> result = new HashSet<String>();
while (tokenStream.incrementToken()) {
CharTermAttribute attribute1 = tokenStream.getAttribute(CharTermAttribute.class);

View File

@ -25,6 +25,7 @@ import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import static org.hamcrest.CoreMatchers.equalTo;
@ -43,6 +44,8 @@ public class LuceneMorphTest {
@Test
public void russianMorphologyShouldGetCorrectNormalForm() throws IOException {
LuceneMorphology luceneMorph = new RussianLuceneMorphology();
List<String> v = luceneMorph.getMorphInfo("вина");
System.out.println(v);
String pathToTestData = "/russian/russian-morphology-test.txt";
testMorphology(luceneMorph, pathToTestData);
}