/** Fill the queue (all pps are already placed */ private void fillQueue() { pq.clear(); for (PhrasePositions pp : phrasePositions) { // iterate cyclic list: done once handled max if (pp.position > end) { end = pp.position; } pq.add(pp); } }
/** no repeats: simplest case, and most common. It is important to keep this piece of the code simple and efficient */ private void initSimple() throws IOException { //System.err.println("initSimple: doc: "+min.doc); pq.clear(); // position pps and build queue from list for (PhrasePositions pp : phrasePositions) { pp.firstPosition(); if (pp.position > end) { end = pp.position; } pq.add(pp); } }
/** Fill the queue (all pps are already placed */ private void fillQueue() { pq.clear(); for (PhrasePositions pp : phrasePositions) { // iterate cyclic list: done once handled max if (pp.position > end) { end = pp.position; } pq.add(pp); } }
/** Fill the queue (all pps are already placed */ private void fillQueue() { pq.clear(); for (PhrasePositions pp : phrasePositions) { // iterate cyclic list: done once handled max if (pp.position > end) { end = pp.position; } pq.add(pp); } }
/** Fill the queue (all pps are already placed */ private void fillQueue() { pq.clear(); for (PhrasePositions pp : phrasePositions) { // iterate cyclic list: done once handled max if (pp.position > end) { end = pp.position; } pq.add(pp); } }
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(); }
/** no repeats: simplest case, and most common. It is important to keep this piece of the code simple and efficient */ private void initSimple() throws IOException { //System.err.println("initSimple: doc: "+min.doc); pq.clear(); // position pps and build queue from list for (PhrasePositions pp : phrasePositions) { pp.firstPosition(); if (pp.position > end) { end = pp.position; } pq.add(pp); } }
/** no repeats: simplest case, and most common. It is important to keep this piece of the code simple and efficient */ private void initSimple() throws IOException { //System.err.println("initSimple: doc: "+min.doc); pq.clear(); // position pps and build queue from list for (PhrasePositions pp : phrasePositions) { pp.firstPosition(); if (pp.position > end) { end = pp.position; } pq.add(pp); } }
/** no repeats: simplest case, and most common. It is important to keep this piece of the code simple and efficient */ private void initSimple() throws IOException { //System.err.println("initSimple: doc: "+min.doc); pq.clear(); // position pps and build queue from list for (PhrasePositions pp : phrasePositions) { pp.firstPosition(); if (pp.position > end) { end = pp.position; } pq.add(pp); } }
private void sort() { pq.clear(); for (PhrasePositions pp = first; pp != null; pp = pp.next) pq.put(pp); pqToList(); }
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; } }
protected final float phraseFreq() throws IOException { pq.clear(); int end = 0; for (PhrasePositions pp = first; pp != null; pp = pp.next) {