public MatchSetPositional purgeOccurrencesOccupyingSameSpace() { MatchSetPositional results = new MatchSetPositional(); if (size() > 1) { for (ProximityOccurrence m : this) { ProximityOccurrence s = results.floor(m); if (s == null || s.span + s.pos <= m.pos) { ProximityOccurrence r = results.ceiling(m); if (r == null || m.span + m.pos <= r.pos) { results.add(m); } } } } else if (size() == 1) { results.add(first()); } return results; }
public MatchSetPositional(Collection<ProximityOccurrence> c) { super(comparator); addAll(c); } }
public MatchSetPositional purgeOccurrencesOccupyingSameStart() { MatchSetPositional results = new MatchSetPositional(); if (size() > 1) { for (ProximityOccurrence m : this) { ProximityOccurrence s = results.floor(m); if (s == null || s.pos != m.pos) { results.add(m); } } } else if (size() == 1) { results.add(first()); } return results; } }
@Override public void process(Document doc) { if (termpositions.hasProximityMatches(doc)) { MatchSetLength matches = new MatchSetLength(); do { if (termpositions.tpi[containednodes.size() - 1].current - termpositions.tpi[0].current <= span - termpositions.tpi[containednodes.size() - 1].span) { matches.add(new ProximityOccurrence(termpositions.tpi[0].current, termpositions.tpi[containednodes.size() - 1].current - termpositions.tpi[0].current + 1)); } } while( termpositions.next() ); MatchSetPositional result = matches.purgeOccurrencesOccupyingSameSpace(); pos = new int[result.size()]; dist = new int[result.size()]; int p = 0; for (ProximityOccurrence m : result) { pos[p] = m.pos; dist[p++] = m.span; } frequency = pos.length; } else { pos = ZEROPOS; dist = ZEROPOS; frequency = 0; } }
public MatchSetPositional purgeOccurrencesOccupyingSameStart() { MatchSetPositional results = new MatchSetPositional(); if (size() > 1) { for (ProximityOccurrence m : this) { ProximityOccurrence s = results.floor(m); if (s == null || s.pos != m.pos) { results.add(m); } } } else if (size() == 1) { results.add(first()); } return results; } }
@Override public void process(Document doc) { if (termpositions.hasProximityMatches(doc)) { MatchSetLength matches = new MatchSetLength(); do { if (termpositions.tpi[containednodes.size() - 1].current - termpositions.tpi[0].current <= span - termpositions.tpi[containednodes.size() - 1].span) { matches.add(new ProximityOccurrence(termpositions.tpi[0].current, termpositions.tpi[containednodes.size() - 1].current - termpositions.tpi[0].current + 1)); } } while( termpositions.next() ); MatchSetPositional result = matches.purgeOccurrencesOccupyingSameSpace(); pos = new int[result.size()]; dist = new int[result.size()]; int p = 0; for (ProximityOccurrence m : result) { pos[p] = m.pos; dist[p++] = m.span; } frequency = pos.length; } else { pos = ZEROPOS; dist = ZEROPOS; frequency = 0; } }
public MatchSetPositional purgeOccurrencesOccupyingSameSpace() { MatchSetPositional results = new MatchSetPositional(); if (size() > 1) { for (ProximityOccurrence m : this) { ProximityOccurrence s = results.floor(m); if (s == null || s.span + s.pos <= m.pos) { ProximityOccurrence r = results.ceiling(m); if (r == null || m.span + m.pos <= r.pos) { results.add(m); } } } } else if (size() == 1) { results.add(first()); } return results; }
@Override public void process(Document doc) { if (termpositions.hasProximityMatches(doc)) { MatchSetLength matches = new MatchSetLength(); do { ProximityTerm last = termpositions.proximitytermlist.last(); int firstpos = termpositions.first.current; int lastpos = last.current + last.span; if (lastpos - firstpos <= span) { matches.add(new ProximityOccurrence(firstpos, lastpos - firstpos)); } } while( termpositions.next() ); MatchSetPositional result = matches.purgeOccurrencesOccupyingSameSpace(); pos = new int[result.size()]; dist = new int[result.size()]; int p = 0; for (ProximityOccurrence m : result) { pos[p] = m.pos; dist[p++] = m.span; } frequency = pos.length; } else { frequency = 0; pos = ZEROPOS; dist = ZEROPOS; } }
public MatchSetPositional(Collection<ProximityOccurrence> c) { super(comparator); addAll(c); } }
@Override public void process(Document doc) { if (termpositions.hasProximityMatches(doc)) { MatchSetLength matches = new MatchSetLength(); do { ProximityTerm last = termpositions.proximitytermlist.last(); int firstpos = termpositions.first.current; int lastpos = last.current + last.span; if (lastpos - firstpos <= span) { matches.add(new ProximityOccurrence(firstpos, lastpos - firstpos)); } } while( termpositions.next() ); MatchSetPositional result = matches.purgeOccurrencesOccupyingSameSpace(); pos = new int[result.size()]; dist = new int[result.size()]; int p = 0; for (ProximityOccurrence m : result) { pos[p] = m.pos; dist[p++] = m.span; } frequency = pos.length; } else { frequency = 0; pos = ZEROPOS; dist = ZEROPOS; } }