Examples of tf()


Examples of org.apache.lucene.search.Similarity.tf()

      assertEquals("tf flat2: i="+i, 2.0f, s.tf(i), 0.0f);
    }
    for (int i = 6; i <=1000; i++) {
      assertTrue("tf: i="+i+" : s="+s.tf(i)+
                 " < d="+d.tf(i),
                 s.tf(i) < d.tf(i));
    }

    // stupidity
    assertEquals("tf zero", 0.0f, s.tf(0), 0.0f);
  }
View Full Code Here

Examples of org.apache.lucene.search.Similarity.tf()

                 " < d="+d.tf(i),
                 s.tf(i) < d.tf(i));
    }

    // stupidity
    assertEquals("tf zero", 0.0f, s.tf(0), 0.0f);
  }

  public void testHyperbolicSweetSpot() {
 
    SweetSpotSimilarity ss = new SweetSpotSimilarity() {
View Full Code Here

Examples of org.apache.lucene.search.Similarity.tf()

    ss.setHyperbolicTfFactors(3.3f, 7.7f, Math.E, 5.0f);
   
    Similarity s = ss;

    for (int i = 1; i <=1000; i++) {
      assertTrue("MIN tf: i="+i+" : s="+s.tf(i),
                 3.3f <= s.tf(i));
      assertTrue("MAX tf: i="+i+" : s="+s.tf(i),
                 s.tf(i) <= 7.7f);
    }
    assertEquals("MID tf", 3.3f+(7.7f - 3.3f)/2.0f, s.tf(5), 0.00001f);
View Full Code Here

Examples of org.apache.lucene.search.Similarity.tf()

   
    Similarity s = ss;

    for (int i = 1; i <=1000; i++) {
      assertTrue("MIN tf: i="+i+" : s="+s.tf(i),
                 3.3f <= s.tf(i));
      assertTrue("MAX tf: i="+i+" : s="+s.tf(i),
                 s.tf(i) <= 7.7f);
    }
    assertEquals("MID tf", 3.3f+(7.7f - 3.3f)/2.0f, s.tf(5), 0.00001f);
   
View Full Code Here

Examples of org.apache.lucene.search.Similarity.tf()

    Similarity s = ss;

    for (int i = 1; i <=1000; i++) {
      assertTrue("MIN tf: i="+i+" : s="+s.tf(i),
                 3.3f <= s.tf(i));
      assertTrue("MAX tf: i="+i+" : s="+s.tf(i),
                 s.tf(i) <= 7.7f);
    }
    assertEquals("MID tf", 3.3f+(7.7f - 3.3f)/2.0f, s.tf(5), 0.00001f);
   
    // stupidity
View Full Code Here

Examples of org.apache.lucene.search.Similarity.tf()

    for (int i = 1; i <=1000; i++) {
      assertTrue("MIN tf: i="+i+" : s="+s.tf(i),
                 3.3f <= s.tf(i));
      assertTrue("MAX tf: i="+i+" : s="+s.tf(i),
                 s.tf(i) <= 7.7f);
    }
    assertEquals("MID tf", 3.3f+(7.7f - 3.3f)/2.0f, s.tf(5), 0.00001f);
   
    // stupidity
    assertEquals("tf zero", 0.0f, s.tf(0), 0.0f);
View Full Code Here

Examples of org.apache.lucene.search.Similarity.tf()

      assertTrue("MIN tf: i="+i+" : s="+s.tf(i),
                 3.3f <= s.tf(i));
      assertTrue("MAX tf: i="+i+" : s="+s.tf(i),
                 s.tf(i) <= 7.7f);
    }
    assertEquals("MID tf", 3.3f+(7.7f - 3.3f)/2.0f, s.tf(5), 0.00001f);
   
    // stupidity
    assertEquals("tf zero", 0.0f, s.tf(0), 0.0f);
   
  }
View Full Code Here

Examples of org.apache.lucene.search.Similarity.tf()

                 s.tf(i) <= 7.7f);
    }
    assertEquals("MID tf", 3.3f+(7.7f - 3.3f)/2.0f, s.tf(5), 0.00001f);
   
    // stupidity
    assertEquals("tf zero", 0.0f, s.tf(0), 0.0f);
   
  }

 
}
View Full Code Here

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

     * Ensures output is either 1 (for all inputs > 0), or 0.
     */
    @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()

     */
    @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
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.