/** * Get all finite strings that start at {@code startState} and end at {@code endState}. */ public Iterator<TokenStream> getFiniteStrings(int startState, int endState) throws IOException { final FiniteStringsIterator it = new FiniteStringsIterator(det, startState, endState); return new Iterator<TokenStream> () { IntsRef current; boolean finished = false; @Override public boolean hasNext() { if (finished == false && current == null) { current = it.next(); if (current == null) { finished = true; } } return current != null; } @Override public TokenStream next() { if (current == null) { hasNext(); } TokenStream next = new FiniteStringsTokenStream(current); current = null; return next; } }; }
Automaton toLevenshteinAutomata(Automaton automaton) { List<Automaton> subs = new ArrayList<>(); FiniteStringsIterator finiteStrings = new FiniteStringsIterator(automaton); for (IntsRef string; (string = finiteStrings.next()) != null;) { if (string.length <= nonFuzzyPrefix || string.length < minFuzzyLength) {
/** * Get all finite strings that start at {@code startState} and end at {@code endState}. */ public Iterator<TokenStream> getFiniteStrings(int startState, int endState) throws IOException { final FiniteStringsIterator it = new FiniteStringsIterator(det, startState, endState); return new Iterator<TokenStream> () { IntsRef current; boolean finished = false; @Override public boolean hasNext() { if (finished == false && current == null) { current = it.next(); if (current == null) { finished = true; } } return current != null; } @Override public TokenStream next() { if (current == null) { hasNext(); } TokenStream next = new FiniteStringsTokenStream(current); current = null; return next; } }; }
Automaton toLevenshteinAutomata(Automaton automaton) { List<Automaton> subs = new ArrayList<>(); FiniteStringsIterator finiteStrings = new FiniteStringsIterator(automaton); for (IntsRef string; (string = finiteStrings.next()) != null;) { if (string.length <= nonFuzzyPrefix || string.length < minFuzzyLength) {
Automaton toLevenshteinAutomata(Automaton automaton) { List<Automaton> subs = new ArrayList<>(); FiniteStringsIterator finiteStrings = new FiniteStringsIterator(automaton); for (IntsRef string; (string = finiteStrings.next()) != null;) { if (string.length <= nonFuzzyPrefix || string.length < minFuzzyLength) {
Automaton toLevenshteinAutomata(Automaton automaton) { List<Automaton> subs = new ArrayList<>(); FiniteStringsIterator finiteStrings = new FiniteStringsIterator(automaton); for (IntsRef string; (string = finiteStrings.next()) != null;) { if (string.length <= nonFuzzyPrefix || string.length < minFuzzyLength) {
Automaton toLevenshteinAutomata(Automaton automaton) { List<Automaton> subs = new ArrayList<>(); FiniteStringsIterator finiteStrings = new FiniteStringsIterator(automaton); for (IntsRef string; (string = finiteStrings.next()) != null;) { if (string.length <= nonFuzzyPrefix || string.length < minFuzzyLength) {
Automaton toLevenshteinAutomata(Automaton automaton) { List<Automaton> subs = new ArrayList<>(); FiniteStringsIterator finiteStrings = new FiniteStringsIterator(automaton); for (IntsRef string; (string = finiteStrings.next()) != null;) { if (string.length <= nonFuzzyPrefix || string.length < minFuzzyLength) {
private Automaton toLevenshteinAutomata(Automaton automaton, Set<IntsRef> refs) { List<Automaton> subs = new ArrayList<>(); FiniteStringsIterator finiteStrings = new FiniteStringsIterator(automaton); for (IntsRef string; (string = finiteStrings.next()) != null;) { refs.add(IntsRef.deepCopyOf(string));