public static class Util.TopNSearcher<T>
extends java.lang.Object
Constructor and Description |
---|
TopNSearcher(FST<T> fst,
int topN,
int maxQueueDepth,
java.util.Comparator<T> comparator)
Creates an unbounded TopNSearcher
|
TopNSearcher(FST<T> fst,
int topN,
int maxQueueDepth,
java.util.Comparator<T> comparator,
java.util.Comparator<Util.FSTPath<T>> pathComparator) |
Modifier and Type | Method and Description |
---|---|
protected boolean |
acceptPartialPath(Util.FSTPath<T> path)
Override this to prevent considering a path before it's complete
|
protected boolean |
acceptResult(IntsRef input,
T output) |
protected boolean |
acceptResult(Util.FSTPath<T> path) |
protected void |
addIfCompetitive(Util.FSTPath<T> path) |
void |
addStartPaths(FST.Arc<T> node,
T startOutput,
boolean allowEmptyString,
IntsRefBuilder input) |
void |
addStartPaths(FST.Arc<T> node,
T startOutput,
boolean allowEmptyString,
IntsRefBuilder input,
float boost,
java.lang.CharSequence context,
int payload)
Adds all leaving arcs, including 'finished' arc, if
the node is final, from this node into the queue.
|
Util.TopResults<T> |
search() |
public TopNSearcher(FST<T> fst, int topN, int maxQueueDepth, java.util.Comparator<T> comparator)
fst
- the FST
to search ontopN
- the number of top scoring entries to retrievemaxQueueDepth
- the maximum size of the queue of possible top entriescomparator
- the comparator to select the top Npublic TopNSearcher(FST<T> fst, int topN, int maxQueueDepth, java.util.Comparator<T> comparator, java.util.Comparator<Util.FSTPath<T>> pathComparator)
protected void addIfCompetitive(Util.FSTPath<T> path)
public void addStartPaths(FST.Arc<T> node, T startOutput, boolean allowEmptyString, IntsRefBuilder input) throws java.io.IOException
java.io.IOException
public void addStartPaths(FST.Arc<T> node, T startOutput, boolean allowEmptyString, IntsRefBuilder input, float boost, java.lang.CharSequence context, int payload) throws java.io.IOException
java.io.IOException
public Util.TopResults<T> search() throws java.io.IOException
java.io.IOException
protected boolean acceptResult(Util.FSTPath<T> path)
protected boolean acceptPartialPath(Util.FSTPath<T> path)
Copyright © 2000–2019 The Apache Software Foundation. All rights reserved.