Examples of tf()


Examples of org.apache.lucene.search.similarities.DefaultSimilarity.tf()

    @Test
    public void testTF() {
        DefaultSimilarity sim = new BinarySimilarity();
        assertEquals("big positive number", 1, (int)Math.round(sim.tf(999)));
        assertEquals("slightly more than 1", 1, (int)Math.round(sim.tf(2)));
        assertEquals("just 1", 1, (int)Math.round(sim.tf(1)));
        assertEquals("slightly less than 1", 0, (int)Math.round(sim.tf(0)));
        assertEquals("big negative number", 0, (int)Math.round(sim.tf(-999)));
    }

}
View Full Code Here

Examples of org.apache.lucene.search.similarities.DefaultSimilarity.tf()

    public void testTF() {
        DefaultSimilarity sim = new BinarySimilarity();
        assertEquals("big positive number", 1, (int)Math.round(sim.tf(999)));
        assertEquals("slightly more than 1", 1, (int)Math.round(sim.tf(2)));
        assertEquals("just 1", 1, (int)Math.round(sim.tf(1)));
        assertEquals("slightly less than 1", 0, (int)Math.round(sim.tf(0)));
        assertEquals("big negative number", 0, (int)Math.round(sim.tf(-999)));
    }

}
View Full Code Here

Examples of org.apache.lucene.search.similarities.DefaultSimilarity.tf()

        DefaultSimilarity sim = new BinarySimilarity();
        assertEquals("big positive number", 1, (int)Math.round(sim.tf(999)));
        assertEquals("slightly more than 1", 1, (int)Math.round(sim.tf(2)));
        assertEquals("just 1", 1, (int)Math.round(sim.tf(1)));
        assertEquals("slightly less than 1", 0, (int)Math.round(sim.tf(0)));
        assertEquals("big negative number", 0, (int)Math.round(sim.tf(-999)));
    }

}
View Full Code Here

Examples of org.apache.lucene.search.similarities.DefaultSimilarity.tf()

    ss.setBaselineTfFactors(0.0f, 0.0f);
 
    for (int i = 1; i < 1000; i++) {
      assertEquals("tf: i="+i,
                   d.tf(i), s.tf(i), 0.0f);
    }

    // tf higher
 
    ss.setBaselineTfFactors(1.0f, 0.0f);
View Full Code Here

Examples of org.apache.lucene.search.similarities.DefaultSimilarity.tf()

    // tf higher
 
    ss.setBaselineTfFactors(1.0f, 0.0f);
 
    for (int i = 1; i < 1000; i++) {
      assertTrue("tf: i="+i+" : d="+d.tf(i)+
                 " < s="+s.tf(i),
                 d.tf(i) < s.tf(i));
    }

    // tf flat
View Full Code Here

Examples of org.apache.lucene.search.similarities.TFIDFSimilarity.tf()

          }

          if (atDoc > doc) {
            // term doesn't match this document... either because we hit the
            // end, or because the next doc is after this doc.
            return similarity.tf(0);
          }

          // a match!
          return similarity.tf(docs.freq());
        } catch (IOException e) {
View Full Code Here

Examples of org.apache.lucene.search.similarities.TFIDFSimilarity.tf()

            // end, or because the next doc is after this doc.
            return similarity.tf(0);
          }

          // a match!
          return similarity.tf(docs.freq());
        } catch (IOException e) {
          throw new RuntimeException("caught exception in function "+description()+" : doc="+doc, e);
        }
      }
    };
View Full Code Here

Examples of org.apache.lucene.search.similarities.TFIDFSimilarity.tf()

          }

          if (atDoc > doc) {
            // term doesn't match this document... either because we hit the
            // end, or because the next doc is after this doc.
            return similarity.tf(0);
          }

          // a match!
          return similarity.tf(docs.freq());
        } catch (IOException e) {
View Full Code Here

Examples of org.apache.lucene.search.similarities.TFIDFSimilarity.tf()

            // end, or because the next doc is after this doc.
            return similarity.tf(0);
          }

          // a match!
          return similarity.tf(docs.freq());
        } catch (IOException e) {
          throw new RuntimeException("caught exception in function "+description()+" : doc="+doc, e);
        }
      }
    };
View Full Code Here

Examples of org.apache.lucene.search.similarities.TFIDFSimilarity.tf()

          }

          if (atDoc > doc) {
            // term doesn't match this document... either because we hit the
            // end, or because the next doc is after this doc.
            return similarity.tf(0);
          }

          // a match!
          return similarity.tf(docs.freq());
        } catch (IOException e) {
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.