Constructor and Description |
---|
TopNSearcher(FST<T> fst,
int topN,
int maxQueueDepth,
Comparator<T> comparator)
Creates an unbounded TopNSearcher
|
TopNSearcher(FST<T> fst,
int topN,
int maxQueueDepth,
Comparator<T> comparator,
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,
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, 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, Comparator<T> comparator, 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 IOException
IOException
public void addStartPaths(FST.Arc<T> node, T startOutput, boolean allowEmptyString, IntsRefBuilder input, float boost, CharSequence context, int payload) throws IOException
IOException
public Util.TopResults<T> search() throws IOException
IOException
protected boolean acceptResult(Util.FSTPath<T> path)
protected boolean acceptPartialPath(Util.FSTPath<T> path)
Copyright © 2000-2021 Apache Software Foundation. All Rights Reserved.