searcher = new Util.TopNSearcher<>( fst, count * maxSurfaceFormsPerAnalyzedForm, count * maxSurfaceFormsPerAnalyzedForm, weightComparator); searcher.addStartPaths(scratchArc, fst.outputs.add(path.output, scratchArc.output), false, path.input); Util.TopResults<Pair<Long,BytesRef>> completions = searcher.search(); searcher = new Util.TopNSearcher<Pair<Long,BytesRef>>(fst, num - results.size(), num * maxAnalyzedPathsForOneInput, searcher.addStartPaths(path.fstNode, path.output, true, path.input); TopResults<Pair<Long,BytesRef>> completions = searcher.search();
if (acceptPartialPath(path) == false) { continue; foundZero = true; } else { addIfCompetitive(path); addIfCompetitive(path); if (acceptResult(path)) { results.add(new Result<>(path.input.get(), path.output)); } else { path.input.append(path.arc.label); path.output = fst.outputs.add(path.output, path.arc.output); if (acceptPartialPath(path) == false) { break;
searcher.addStartPaths(arc, prefixOutput, true, new IntsRefBuilder()); completions = searcher.search(); assert completions.isComplete; } catch (IOException bogus) {
searcher = new Util.TopNSearcher<>( fst, count * maxSurfaceFormsPerAnalyzedForm, count * maxSurfaceFormsPerAnalyzedForm, weightComparator); searcher.addStartPaths(scratchArc, fst.outputs.add(path.output, scratchArc.output), false, path.input); Util.TopResults<Pair<Long,BytesRef>> completions = searcher.search(); searcher = new Util.TopNSearcher<Pair<Long,BytesRef>>(fst, num - results.size(), num * maxAnalyzedPathsForOneInput, searcher.addStartPaths(path.fstNode, path.output, true, path.input); TopResults<Pair<Long,BytesRef>> completions = searcher.search();
searcher = new Util.TopNSearcher<>(fst, count * maxSurfaceFormsPerAnalyzedForm, count * maxSurfaceFormsPerAnalyzedForm, weightComparator); searcher.addStartPaths(scratchArc, fst.outputs.add(path.output, scratchArc.output), false, path.input); TopResults<Pair<Long,BytesRef>> completions = searcher.search(); assert completions.isComplete; searcher = new Util.TopNSearcher<Pair<Long,BytesRef>>(fst, num - results.size(), num * maxAnalyzedPathsForOneInput, searcher.addStartPaths(path.fstNode, path.output, true, path.input); TopResults<Pair<Long,BytesRef>> completions = searcher.search(); assert completions.isComplete;
searcher = new Util.TopNSearcher<>( fst, count * maxSurfaceFormsPerAnalyzedForm, count * maxSurfaceFormsPerAnalyzedForm, weightComparator); searcher.addStartPaths(scratchArc, fst.outputs.add(path.output, scratchArc.output), false, path.input); Util.TopResults<Pair<Long,BytesRef>> completions = searcher.search(); searcher = new Util.TopNSearcher<Pair<Long,BytesRef>>(fst, num - results.size(), num * maxAnalyzedPathsForOneInput, searcher.addStartPaths(path.fstNode, path.output, true, path.input); TopResults<Pair<Long,BytesRef>> completions = searcher.search();
searcher = new Util.TopNSearcher<>(fst, count * maxSurfaceFormsPerAnalyzedForm, count * maxSurfaceFormsPerAnalyzedForm, weightComparator); searcher.addStartPaths(scratchArc, fst.outputs.add(path.output, scratchArc.output), false, path.input); Util.TopResults<Pair<Long,BytesRef>> completions = searcher.search(); searcher = new Util.TopNSearcher<Pair<Long,BytesRef>>(fst, num - results.size(), num * maxAnalyzedPathsForOneInput, searcher.addStartPaths(path.fstNode, path.output, true, path.input); TopResults<Pair<Long,BytesRef>> completions = searcher.search();
searcher = new Util.TopNSearcher<>( fst, count * maxSurfaceFormsPerAnalyzedForm, count * maxSurfaceFormsPerAnalyzedForm, weightComparator); searcher.addStartPaths(scratchArc, fst.outputs.add(path.output, scratchArc.output), false, path.input); Util.TopResults<Pair<Long,BytesRef>> completions = searcher.search(); searcher = new Util.TopNSearcher<Pair<Long,BytesRef>>(fst, num - results.size(), num * maxAnalyzedPathsForOneInput, searcher.addStartPaths(path.fstNode, path.output, true, path.input); TopResults<Pair<Long,BytesRef>> completions = searcher.search();
if (acceptPartialPath(path) == false) { continue; foundZero = true; } else { addIfCompetitive(path); addIfCompetitive(path); if (acceptResult(path)) { results.add(new Result<>(path.input.get(), path.output)); } else { path.input.append(path.arc.label); path.output = fst.outputs.add(path.output, path.arc.output); if (acceptPartialPath(path) == false) { break;
foundZero = true; } else { addIfCompetitive(path); addIfCompetitive(path); if (acceptResult(path)) {
foundZero = true; } else { addIfCompetitive(path); addIfCompetitive(path); if (acceptResult(path)) {
searcher.addStartPaths(path.fstNode, path.output, false, path.input, scorer.weight.boost(), scorer.weight.context()); searcher.search();
if (acceptPartialPath(newPath)) { queue.add(newPath); if (queue.size() == maxQueueDepth+1) {
/** Adds all leaving arcs, including 'finished' arc, if * the node is final, from this node into the queue. */ public void addStartPaths(FST.Arc<T> node, T startOutput, boolean allowEmptyString, IntsRefBuilder input, float boost, CharSequence context) throws IOException { // De-dup NO_OUTPUT since it must be a singleton: if (startOutput.equals(fst.outputs.getNoOutput())) { startOutput = fst.outputs.getNoOutput(); } FSTPath<T> path = new FSTPath<>(startOutput, node, input, boost, context); fst.readFirstTargetArc(node, path.arc, bytesReader); //System.out.println("add start paths"); // Bootstrap: find the min starting arc while (true) { if (allowEmptyString || path.arc.label != FST.END_LABEL) { addIfCompetitive(path); } if (path.arc.isLast()) { break; } fst.readNextArc(path.arc, bytesReader); } }
/** Adds all leaving arcs, including 'finished' arc, if * the node is final, from this node into the queue. */ public void addStartPaths(FST.Arc<T> node, T startOutput, boolean allowEmptyString, IntsRefBuilder input, float boost, CharSequence context) throws IOException { // De-dup NO_OUTPUT since it must be a singleton: if (startOutput.equals(fst.outputs.getNoOutput())) { startOutput = fst.outputs.getNoOutput(); } FSTPath<T> path = new FSTPath<>(startOutput, node, input, boost, context); fst.readFirstTargetArc(node, path.arc, bytesReader); //System.out.println("add start paths"); // Bootstrap: find the min starting arc while (true) { if (allowEmptyString || path.arc.label != FST.END_LABEL) { addIfCompetitive(path); } if (path.arc.isLast()) { break; } fst.readNextArc(path.arc, bytesReader); } }
/** Adds all leaving arcs, including 'finished' arc, if * the node is final, from this node into the queue. */ public void addStartPaths(FST.Arc<T> node, T startOutput, boolean allowEmptyString, IntsRefBuilder input, float boost, CharSequence context, int payload) throws IOException { // De-dup NO_OUTPUT since it must be a singleton: if (startOutput.equals(fst.outputs.getNoOutput())) { startOutput = fst.outputs.getNoOutput(); } FSTPath<T> path = new FSTPath<>(startOutput, node, input, boost, context, payload); fst.readFirstTargetArc(node, path.arc, bytesReader); // Bootstrap: find the min starting arc while (true) { if (allowEmptyString || path.arc.label != FST.END_LABEL) { addIfCompetitive(path); } if (path.arc.isLast()) { break; } fst.readNextArc(path.arc, bytesReader); } }
public void addStartPaths(FST.Arc<T> node, T startOutput, boolean allowEmptyString, IntsRefBuilder input) throws IOException { addStartPaths(node, startOutput, allowEmptyString, input, 0, null, -1); }
protected boolean acceptResult(FSTPath<T> path) { return acceptResult(path.input.get(), path.cost); }
protected boolean acceptResult(FSTPath<T> path) { return acceptResult(path.input.get(), path.output); }
public void addStartPaths(FST.Arc<T> node, T startOutput, boolean allowEmptyString, IntsRefBuilder input) throws IOException { addStartPaths(node, startOutput, allowEmptyString, input, 0, null); }