adding some test create a full pacage for morphology
git-svn-id: https://russianmorphology.googlecode.com/svn/trunk@52 d817d54c-26ab-11de-abc9-2f7d1455ff7a
This commit is contained in:
parent
fed6cd480a
commit
b95e7f59d5
@ -34,7 +34,7 @@ public class HeuristicBuilder {
|
|||||||
RussianLetterDecoderEncoder decoderEncoder = new RussianLetterDecoderEncoder();
|
RussianLetterDecoderEncoder decoderEncoder = new RussianLetterDecoderEncoder();
|
||||||
StatiticsCollector statiticsCollector = new StatiticsCollector(grammaInfo, decoderEncoder);
|
StatiticsCollector statiticsCollector = new StatiticsCollector(grammaInfo, decoderEncoder);
|
||||||
dictonaryReader.proccess(statiticsCollector);
|
dictonaryReader.proccess(statiticsCollector);
|
||||||
statiticsCollector.saveHeuristic();
|
statiticsCollector.saveHeuristic("russian/src/main/resources/org/apache/lucene/morphology/russian/morph.info");
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
1607013
russian/src/main/resources/org/apache/lucene/morphology/russian/morph.info
Normal file
1607013
russian/src/main/resources/org/apache/lucene/morphology/russian/morph.info
Normal file
File diff suppressed because it is too large
Load Diff
@ -1,11 +1,26 @@
|
|||||||
|
/**
|
||||||
|
* Copyright 2009 Alexander Kuznetsov
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
package org.apache.lucene.morphology.russian;
|
package org.apache.lucene.morphology.russian;
|
||||||
|
|
||||||
/**
|
import org.junit.Test;
|
||||||
* Created by IntelliJ IDEA.
|
|
||||||
* User: akuznetsov
|
|
||||||
* Date: 03/10/2009
|
|
||||||
* Time: 3:52:43 PM
|
|
||||||
* To change this template use File | Settings | File Templates.
|
|
||||||
*/
|
|
||||||
public class AnalayzerTest {
|
public class AnalayzerTest {
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void shoudGetCorrentTokens() {
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,30 +1,73 @@
|
|||||||
|
/**
|
||||||
|
* Copyright 2009 Alexander Kuznetsov
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
package org.apache.lucene.morphology.russian;
|
package org.apache.lucene.morphology.russian;
|
||||||
|
|
||||||
import junit.framework.TestCase;
|
import org.apache.lucene.morphology.SuffixToLongException;
|
||||||
|
import org.apache.lucene.morphology.WrongCharaterException;
|
||||||
|
import static org.hamcrest.core.IsEqual.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;
|
||||||
|
|
||||||
public class RussianLetterDecoderEncoderTest extends TestCase {
|
public class RussianLetterDecoderEncoderTest {
|
||||||
public void testEncode() {
|
private RussianLetterDecoderEncoder decoderEncoder;
|
||||||
// Add your code here
|
|
||||||
|
@Before
|
||||||
|
public void setUp() {
|
||||||
|
decoderEncoder = new RussianLetterDecoderEncoder();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testEncodeToArray() {
|
@Test
|
||||||
// Add your code here
|
public void testShouldCorretDecodeEncode() throws IOException {
|
||||||
|
InputStream stream = this.getClass().getResourceAsStream("/org/apache/lucene/morphology/russian/decoder-test-data.txt");
|
||||||
|
BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(stream, "UTF-8"));
|
||||||
|
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]));
|
||||||
|
s = bufferedReader.readLine();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testDecodeArray() {
|
@Test
|
||||||
// Add your code here
|
public void testShouldCorretDecodeEncodeStringToArray() throws IOException {
|
||||||
|
InputStream stream = this.getClass().getResourceAsStream("/org/apache/lucene/morphology/russian/decoder-test-data-for-array.txt");
|
||||||
|
BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(stream, "UTF-8"));
|
||||||
|
String s = bufferedReader.readLine();
|
||||||
|
while (s != null) {
|
||||||
|
String[] qa = s.trim().split(" ");
|
||||||
|
int[] ecodedSuffix = decoderEncoder.encodeToArray(qa[0]);
|
||||||
|
assertThat(decoderEncoder.decodeArray(ecodedSuffix), equalTo(qa[1]));
|
||||||
|
s = bufferedReader.readLine();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testDecode() {
|
@Test(expected = SuffixToLongException.class)
|
||||||
// Add your code here
|
public void shouldThrownExeptionIfSuffixToLong() {
|
||||||
|
decoderEncoder.encode("1234567890123");
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testCheckCharacter() {
|
@Test(expected = WrongCharaterException.class)
|
||||||
// Add your code here
|
public void shouldThrownExeptionIfSuffixContainWrongCharater() {
|
||||||
}
|
decoderEncoder.encode("1");
|
||||||
|
|
||||||
public void testCleanString() {
|
|
||||||
// Add your code here
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,11 +1,26 @@
|
|||||||
|
/**
|
||||||
|
* Copyright 2009 Alexander Kuznetsov
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
package org.apache.lucene.morphology.russian;
|
package org.apache.lucene.morphology.russian;
|
||||||
|
|
||||||
/**
|
import org.junit.Test;
|
||||||
* Created by IntelliJ IDEA.
|
|
||||||
* User: akuznetsov
|
|
||||||
* Date: 03/10/2009
|
|
||||||
* Time: 3:52:18 PM
|
|
||||||
* To change this template use File | Settings | File Templates.
|
|
||||||
*/
|
|
||||||
public class RussianMorphTest {
|
public class RussianMorphTest {
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void shoudGetCorrentMorphInfo() {
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user