private Lambda parseLambda(String expr) { if ("DF".equals(expr)) { return new LambdaDF(); } else if ("TTF".equals(expr)) { return new LambdaTTF(); } else { throw new RuntimeException("Invalid lambda: " + expr); } }
/** ll/ttf/h3 with parameterized normalization */ public void testParameters() throws Exception { Similarity sim = getSimilarity("text_params"); assertEquals(IBSimilarity.class, sim.getClass()); IBSimilarity ib = (IBSimilarity) sim; assertEquals(DistributionLL.class, ib.getDistribution().getClass()); assertEquals(LambdaTTF.class, ib.getLambda().getClass()); assertEquals(NormalizationH3.class, ib.getNormalization().getClass()); NormalizationH3 norm = (NormalizationH3) ib.getNormalization(); assertEquals(900f, norm.getMu(), 0.01f); }