Remove unused varables, remove duplicate tests (both "nonOverlappingWordTransitions" and "nonOverlappingWholeWords" contain exactly the same code)
This commit is contained in:
parent
06675a6074
commit
165f18e581
@ -28,10 +28,6 @@ public class Keyword implements Comparable {
|
||||
this.depth = depth;
|
||||
}
|
||||
|
||||
public void setDepth(int depth) {
|
||||
this.depth = depth;
|
||||
}
|
||||
|
||||
public int getDepth() {
|
||||
return depth;
|
||||
}
|
||||
|
||||
@ -34,10 +34,6 @@ public class Transition<T> {
|
||||
this.length = length;
|
||||
}
|
||||
|
||||
public T transitionToken() {
|
||||
return token;
|
||||
}
|
||||
|
||||
public int getStart() {
|
||||
return start;
|
||||
}
|
||||
|
||||
@ -11,7 +11,6 @@ import org.ahocorasick.trie.handler.FirstMatchHandler;
|
||||
import java.util.Collection;
|
||||
import java.util.Queue;
|
||||
import java.util.LinkedList;
|
||||
import java.util.ListIterator;
|
||||
import java.util.concurrent.LinkedBlockingDeque;
|
||||
|
||||
/**
|
||||
@ -42,9 +41,6 @@ public class Trie {
|
||||
return (position < length) ? input.charAt(position) : '\0';
|
||||
}
|
||||
public abstract Transition nextTransition();
|
||||
public int getPosition() {
|
||||
return position;
|
||||
}
|
||||
}
|
||||
|
||||
private class WordTokenizer extends KeywordTokenizer {
|
||||
@ -186,7 +182,6 @@ public class Trie {
|
||||
for (Keyword emit : emits) {
|
||||
int position = tn.getStart() + tn.getLength();
|
||||
int start = tknHistory.get(depth - emit.getDepth()).getStart();
|
||||
ListIterator<Transition> tns = tknHistory.listIterator();
|
||||
emitCandidateHolder.addCandidate(
|
||||
new Emit(start, position - 1, emit.getText()));
|
||||
}
|
||||
|
||||
@ -262,25 +262,6 @@ public class TrieTest {
|
||||
checkEmit(iterator.next(), 41, 48, "wiel dop");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void nonOverlappingWordTransitions() {
|
||||
Trie trie = Trie.builder()
|
||||
.removeOverlaps()
|
||||
.onlyWholeWords()
|
||||
.addKeyword("peper molen")
|
||||
.addKeyword("molen wiel")
|
||||
.addKeyword("wiel dop")
|
||||
.addKeyword("dop")
|
||||
.build();
|
||||
Collection<Emit> emits = trie.parseText("peper molen wiel dop xwiel dop wiel dopx wiel dop");
|
||||
assertEquals(4, emits.size());
|
||||
Iterator<Emit> iterator = emits.iterator();
|
||||
checkEmit(iterator.next(), 0, 10, "peper molen");
|
||||
checkEmit(iterator.next(), 12, 19, "wiel dop");
|
||||
checkEmit(iterator.next(), 27, 29, "dop");
|
||||
checkEmit(iterator.next(), 41, 48, "wiel dop");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void nonOverlappingWholeWordsWithCustomEmitHandler() {
|
||||
Trie trie = Trie.builder()
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user