fixing problem with bad search of rule id
git-svn-id: https://russianmorphology.googlecode.com/svn/trunk@84 d817d54c-26ab-11de-abc9-2f7d1455ff7a
This commit is contained in:
@ -35,6 +35,22 @@ public class RussianLetterDecoderEncoderTest {
|
||||
decoderEncoder = new RussianLetterDecoderEncoder();
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void testShouldPreserStringComporision() throws IOException {
|
||||
InputStream stream = this.getClass().getResourceAsStream("/org/apache/lucene/morphology/russian/decoder-test-monotonic.txt");
|
||||
BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(stream, "UTF-8"));
|
||||
String s = bufferedReader.readLine();
|
||||
while (s != null) {
|
||||
String[] qa = s.trim().split(" ");
|
||||
if (qa[0].length() <= RussianLetterDecoderEncoder.WORD_PART_LENGHT && qa[1].length() <= RussianLetterDecoderEncoder.WORD_PART_LENGHT) {
|
||||
assertThat(decoderEncoder.encode(qa[1]) > decoderEncoder.encode(qa[0]), equalTo(true));
|
||||
}
|
||||
s = bufferedReader.readLine();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void testShouldCorretDecodeEncode() throws IOException {
|
||||
InputStream stream = this.getClass().getResourceAsStream("/org/apache/lucene/morphology/russian/decoder-test-data.txt");
|
||||
@ -42,8 +58,10 @@ public class RussianLetterDecoderEncoderTest {
|
||||
String s = bufferedReader.readLine();
|
||||
while (s != null) {
|
||||
String[] qa = s.trim().split(" ");
|
||||
Integer ecodedSuffix = decoderEncoder.encode(qa[0]);
|
||||
assertThat(decoderEncoder.decode(ecodedSuffix), equalTo(qa[1]));
|
||||
if (qa[0].length() <= RussianLetterDecoderEncoder.WORD_PART_LENGHT) {
|
||||
Integer ecodedSuffix = decoderEncoder.encode(qa[0]);
|
||||
assertThat(decoderEncoder.decode(ecodedSuffix), equalTo(qa[1]));
|
||||
}
|
||||
s = bufferedReader.readLine();
|
||||
}
|
||||
}
|
||||
|
@ -10,4 +10,6 @@
|
||||
аааааааааааа аааааааааааа
|
||||
аааааааааааааааааа аааааааааааааааааа
|
||||
ааааааааааааааааа ааааааааааааааааа
|
||||
йфячыцувс йфячыцувс
|
||||
йфячыцувс йфячыцувс
|
||||
ёёё еее
|
||||
ёёёе ееее
|
@ -1,3 +1,5 @@
|
||||
яяя яяя
|
||||
юяю юяю
|
||||
тест тест
|
||||
ёж еж
|
||||
естера естера
|
||||
|
@ -0,0 +1,7 @@
|
||||
а аа
|
||||
ааа ббб
|
||||
ммм нннн
|
||||
ммм ммн
|
||||
аа ба
|
||||
ииа к
|
||||
удд уде
|
@ -11,7 +11,7 @@
|
||||
пушек пушка
|
||||
козлов козлов козловый козел
|
||||
жуков жуков жук
|
||||
красив красить
|
||||
красив красить красивый
|
||||
красивая красивый
|
||||
тосклив тоскливый
|
||||
лучший хороший
|
||||
|
Reference in New Issue
Block a user