fixed bug with coding

git-svn-id: https://russianmorphology.googlecode.com/svn/trunk@59 d817d54c-26ab-11de-abc9-2f7d1455ff7a
This commit is contained in:
alexander.a.kuznetsov 2009-10-16 09:56:46 +00:00
parent ad3c9f7ccc
commit 68fd53baff
5 changed files with 236949 additions and 28466 deletions

File diff suppressed because it is too large Load Diff

View File

@ -21,7 +21,7 @@ import org.junit.Test;
import java.io.IOException;
public class RussianLuceneMorphTest {
public class EnglishLuceneMorphTest {
private LuceneMorph luceneMorph;
@Before
@ -34,5 +34,8 @@ public class RussianLuceneMorphTest {
System.out.println(luceneMorph.getMorhInfo("purchases"));
System.out.println(luceneMorph.getMorhInfo("existing"));
System.out.println(luceneMorph.getMorhInfo("was"));
System.out.println(luceneMorph.getMorhInfo("men"));
System.out.println(luceneMorph.getMorhInfo("bore"));
System.out.println(luceneMorph.getMorhInfo("came"));
}
}

View File

@ -16,10 +16,17 @@
package org.apache.lucene.morphology.russian;
import org.apache.lucene.morphology.LuceneMorph;
import static org.hamcrest.Matchers.equalTo;
import static org.junit.Assert.assertThat;
import org.junit.Before;
import org.junit.Test;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.HashSet;
import java.util.Set;
public class RussianLuceneMorphTest {
private LuceneMorph luceneMorph;
@ -31,18 +38,18 @@ public class RussianLuceneMorphTest {
@Test
public void shoudGetCorrentMorphInfo() throws IOException {
// InputStream stream = this.getClass().getResourceAsStream("/org/apache/lucene/morphology/russian/russian-morphology-test.txt");
// BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(stream, "UTF-8"));
// String s = bufferedReader.readLine();
// while (s != null) {
// String[] qa = s.trim().split(" ");
// Set<String> result = new HashSet<String>();
// for (int i = 1; i < qa.length; i++) {
// result.add(qa[i]);
// }
// Set<String> stringList = new HashSet<String>(luceneMorph.getMorhInfo(qa[0]));
// assertThat(stringList, equalTo(result));
// s = bufferedReader.readLine();
// }
InputStream stream = this.getClass().getResourceAsStream("/org/apache/lucene/morphology/russian/russian-morphology-test.txt");
BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(stream, "UTF-8"));
String s = bufferedReader.readLine();
while (s != null) {
String[] qa = s.trim().split(" ");
Set<String> result = new HashSet<String>();
for (int i = 1; i < qa.length; i++) {
result.add(qa[i]);
}
Set<String> stringList = new HashSet<String>(luceneMorph.getMorhInfo(qa[0]));
assertThat(stringList, equalTo(result));
s = bufferedReader.readLine();
}
}
}

View File

@ -1,8 +1,7 @@
тест тест тесто
еду еда ехать
тестов тест
вина вино вина
вино вино
еду еда ехать
ехать ехать
ананасов ананас ананасовый
сухой сухой
@ -16,4 +15,5 @@
красивая красивый
тосклив тоскливый
лучший хороший
на на
на на
тест тест тесто