private void sort() { pq.clear(); for (PhrasePositions pp = first; pp != null; pp = pp.next) pq.put(pp); pqToList(); }
private void sort() { pq.clear(); for (PhrasePositions pp = first; pp != null; pp = pp.next) pq.put(pp); pqToList(); }
private void sort() { pq.clear(); for (PhrasePositions pp = first; pp != null; pp = pp.next) pq.put(pp); pqToList(); }
private PhrasePositions flip(PhrasePositions pp, PhrasePositions pp2) { int n=0; PhrasePositions pp3; //pop until finding pp2 while ((pp3=(PhrasePositions)pq.pop()) != pp2) { tmpPos[n++] = pp3; } //insert back all but pp2 for (n--; n>=0; n--) { pq.insert(tmpPos[n]); } //insert pp back pq.put(pp); return pp2; }
private PhrasePositions flip(PhrasePositions pp, PhrasePositions pp2) { int n=0; PhrasePositions pp3; //pop until finding pp2 while ((pp3=(PhrasePositions)pq.pop()) != pp2) { tmpPos[n++] = pp3; } //insert back all but pp2 for (n--; n>=0; n--) { pq.insert(tmpPos[n]); } //insert pp back pq.put(pp); return pp2; }
protected final float phraseFreq() throws IOException { // sort list with pq for (PhrasePositions pp = first; pp != null; pp = pp.next) { pp.firstPosition(); pq.put(pp); // build pq from list } pqToList(); // rebuild list from pq int freq = 0; do { // find position w/ all terms while (first.position < last.position) { // scan forward in first do { if (!first.nextPosition()) return (float)freq; } while (first.position < last.position); firstToLast(); } freq++; // all equal: a match } while (last.nextPosition()); return (float)freq; } }
protected final float phraseFreq() throws IOException { // sort list with pq pq.clear(); for (PhrasePositions pp = first; pp != null; pp = pp.next) { pp.firstPosition(); pq.put(pp); // build pq from list } pqToList(); // rebuild list from pq // for counting how many times the exact phrase is found in current document, // just count how many times all PhrasePosition's have exactly the same position. int freq = 0; do { // find position w/ all terms while (first.position < last.position) { // scan forward in first do { if (!first.nextPosition()) return (float)freq; } while (first.position < last.position); firstToLast(); } freq++; // all equal: a match } while (last.nextPosition()); return (float)freq; } }
protected final float phraseFreq() throws IOException { // sort list with pq pq.clear(); for (PhrasePositions pp = first; pp != null; pp = pp.next) { pp.firstPosition(); pq.put(pp); // build pq from list } pqToList(); // rebuild list from pq // for counting how many times the exact phrase is found in current document, // just count how many times all PhrasePosition's have exactly the same position. int freq = 0; do { // find position w/ all terms while (first.position < last.position) { // scan forward in first do { if (!first.nextPosition()) return (float)freq; } while (first.position < last.position); firstToLast(); } freq++; // all equal: a match } while (last.nextPosition()); return (float)freq; } }
pq.put(pp); // restore pq
pq.put(pp); // restore pq