working on better interface

git-svn-id: https://russianmorphology.googlecode.com/svn/trunk@91 d817d54c-26ab-11de-abc9-2f7d1455ff7a
This commit is contained in:
alexander.a.kuznetsov 2009-11-25 15:51:55 +00:00
parent ce2e2daf7b
commit 36012f2943
6 changed files with 18 additions and 18 deletions

View File

@ -47,7 +47,7 @@ public class EnglishLuceneMorphTest {
for (int i = 1; i < qa.length; i++) {
result.add(qa[i]);
}
Set<String> stringList = new HashSet<String>(luceneMorph.getMorhInfo(qa[0]));
Set<String> stringList = new HashSet<String>(luceneMorph.getNormalForms(qa[0]));
assertThat(stringList, equalTo(result));
s = bufferedReader.readLine();
}

View File

@ -20,7 +20,6 @@ import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.List;
public class LuceneMorphology extends MorphologyImpl {
@ -33,17 +32,6 @@ public class LuceneMorphology extends MorphologyImpl {
super(inputStream, decoderEncoder);
}
@Override
public List<String> getMorhInfo(String s) {
ArrayList<String> result = new ArrayList<String>();
int[] ints = decoderEncoder.encodeToArray(revertWord(s));
int ruleId = findRuleId(ints);
for (Heuristic h : rules[rulesId[ruleId]]) {
result.add(h.transofrmWord(s));
}
return result;
}
protected void readRules(BufferedReader bufferedReader) throws IOException {
String s;
Integer amount;

View File

@ -20,6 +20,8 @@ import java.util.List;
public interface Morphology {
List<String> getMorhInfo(String s);
List<String> getNormalForms(String s);
List<String> getMorfInfo(String s);
}

View File

@ -63,7 +63,17 @@ public class MorphologyImpl implements Morphology {
return grammaInfo;
}
public List<String> getMorhInfo(String s) {
public List<String> getNormalForms(String s) {
ArrayList<String> result = new ArrayList<String>();
int[] ints = decoderEncoder.encodeToArray(revertWord(s));
int ruleId = findRuleId(ints);
for (Heuristic h : rules[rulesId[ruleId]]) {
result.add(h.transofrmWord(s));
}
return result;
}
public List<String> getMorfInfo(String s) {
ArrayList<String> result = new ArrayList<String>();
int[] ints = decoderEncoder.encodeToArray(revertWord(s));
int ruleId = findRuleId(ints);

View File

@ -56,7 +56,7 @@ public class MorphlogyFilter extends TokenFilter {
if (!luceneMorph.checkString(nextToken.term())) {
return nextToken;
}
stack = luceneMorph.getMorhInfo(nextToken.term());
stack = luceneMorph.getNormalForms(nextToken.term());
index = 0;
current = (Token) nextToken.clone();
nextToken = createToken(stack.get(index++), current, reusableToken);

View File

@ -47,7 +47,7 @@ public class RussianLuceneMorphTest {
for (int i = 1; i < qa.length; i++) {
result.add(qa[i]);
}
Set<String> stringList = new HashSet<String>(luceneMorph.getMorhInfo(qa[0]));
Set<String> stringList = new HashSet<String>(luceneMorph.getNormalForms(qa[0]));
assertThat(stringList, equalTo(result));
s = bufferedReader.readLine();
}