public List<Match<K,V>> getNonOverlapping(List<Match<K,V>> allMatches, ToDoubleFunction<? super Match<K, V>> scoreFunc) { return IntervalTree.getNonOverlappingMaxScore(allMatches, scoreFunc); }
public static <T extends HasInterval<E>, E extends Comparable<E>> List<T> getNonOverlappingMaxScore( List<? extends T> items, ToDoubleFunction<? super T> scoreFunc) { Function<T,Interval<E>> toIntervalFunc = in -> in.getInterval(); return getNonOverlappingMaxScore(items, toIntervalFunc, scoreFunc); }
/** * Given a sequence, applies our patterns over the sequence and returns * all non overlapping matches. When multiple patterns overlaps, * matched patterns are selected to give the overall maximum score. * * @param elements input sequence to match against * @param scorer scorer for scoring each match * @return list of match results that are non-overlapping */ public List<SequenceMatchResult<T>> findNonOverlappingMaxScore(List<? extends T> elements, ToDoubleFunction<? super SequenceMatchResult> scorer) { Collection<SequencePattern<T>> triggered = getTriggeredPatterns(elements); List<SequenceMatchResult<T>> all = new ArrayList<>(); int i = 0; for (SequencePattern<T> p:triggered) { SequenceMatcher<T> m = p.getMatcher(elements); m.setMatchWithResult(matchWithResult); m.setOrder(i); while (m.find()) { all.add(m.toBasicSequenceMatchResult()); } i++; } List<SequenceMatchResult<T>> res = IntervalTree.getNonOverlappingMaxScore( all, SequenceMatchResult.TO_INTERVAL, scorer); res.sort(SequenceMatchResult.OFFSET_COMPARATOR); return res; }
public static <T extends HasInterval<E>, E extends Comparable<E>> List<T> getNonOverlappingMaxScore( List<? extends T> items, Function<? super T, Double> scoreFunc) { Function<T,Interval<E>> toIntervalFunc = new Function<T, Interval<E>>() { @Override public Interval<E> apply(T in) { return in.getInterval(); } }; return getNonOverlappingMaxScore(items, toIntervalFunc, scoreFunc); }
public List<Match<K,V>> getNonOverlapping(List<Match<K,V>> allMatches, ToDoubleFunction<? super Match<K, V>> scoreFunc) { return IntervalTree.getNonOverlappingMaxScore(allMatches, scoreFunc); }
public List<Match<K,V>> getNonOverlapping(List<Match<K,V>> allMatches, Function<? super Match<K,V>, Double> scoreFunc) { return IntervalTree.getNonOverlappingMaxScore(allMatches, scoreFunc); }
public static <T extends HasInterval<E>, E extends Comparable<E>> List<T> getNonOverlappingMaxScore( List<? extends T> items, ToDoubleFunction<? super T> scoreFunc) { Function<T,Interval<E>> toIntervalFunc = in -> in.getInterval(); return getNonOverlappingMaxScore(items, toIntervalFunc, scoreFunc); }
public static <T extends HasInterval<E>, E extends Comparable<E>> List<T> getNonOverlappingMaxScore( List<? extends T> items, ToDoubleFunction<? super T> scoreFunc) { Function<T,Interval<E>> toIntervalFunc = in -> in.getInterval(); return getNonOverlappingMaxScore(items, toIntervalFunc, scoreFunc); }
/** * Given a sequence, applies our patterns over the sequence and returns * all non overlapping matches. When multiple patterns overlaps, * matched patterns are selected to give the overall maximum score. * * @param elements input sequence to match against * @param scorer scorer for scoring each match * @return list of match results that are non-overlapping */ public List<SequenceMatchResult<T>> findNonOverlappingMaxScore(List<? extends T> elements, ToDoubleFunction<? super SequenceMatchResult> scorer) { Collection<SequencePattern<T>> triggered = getTriggeredPatterns(elements); List<SequenceMatchResult<T>> all = new ArrayList<>(); int i = 0; for (SequencePattern<T> p:triggered) { SequenceMatcher<T> m = p.getMatcher(elements); m.setMatchWithResult(matchWithResult); m.setOrder(i); while (m.find()) { all.add(m.toBasicSequenceMatchResult()); } i++; } List<SequenceMatchResult<T>> res = IntervalTree.getNonOverlappingMaxScore( all, SequenceMatchResult.TO_INTERVAL, scorer); res.sort(SequenceMatchResult.OFFSET_COMPARATOR); return res; }
/** * Given a sequence, applies our patterns over the sequence and returns * all non overlapping matches. When multiple patterns overlaps, * matched patterns are selected to give the overall maximum score. * * @param elements input sequence to match against * @param scorer scorer for scoring each match * @return list of match results that are non-overlapping */ public List<SequenceMatchResult<T>> findNonOverlappingMaxScore(List<? extends T> elements, ToDoubleFunction<? super SequenceMatchResult> scorer) { Collection<SequencePattern<T>> triggered = getTriggeredPatterns(elements); List<SequenceMatchResult<T>> all = new ArrayList<>(); int i = 0; for (SequencePattern<T> p:triggered) { SequenceMatcher<T> m = p.getMatcher(elements); m.setMatchWithResult(matchWithResult); m.setOrder(i); while (m.find()) { all.add(m.toBasicSequenceMatchResult()); } i++; } List<SequenceMatchResult<T>> res = IntervalTree.getNonOverlappingMaxScore( all, SequenceMatchResult.TO_INTERVAL, scorer); res.sort(SequenceMatchResult.OFFSET_COMPARATOR); return res; }