Search in sources :

Example 1 with NESim

use of edu.illinois.cs.cogcomp.sim.NESim in project cogcomp-nlp by CogComp.

the class EntityComparisonTest method testEntityComparison.

@Test
public void testEntityComparison() {
    Metric ec = new NESim();
    String hitchA = "Bill C. Hitchcock";
    String hitchB = "William Hitchcock";
    String hitchC = "Mrs. Hitchcock";
    String hitchD = "Arthur Hitchcock";
    String hitchE = "Bill F. Hitchcock";
    MetricResponse result = ec.compare(hitchA, hitchB);
    assertEquals(result.score, 1.0, 0.01);
    /**
     * this test FAILS: no gender test
     */
    result = ec.compare(hitchB, hitchC);
    // assertTrue(Double.parseDouble(result.get(EntityComparison.SCORE)) <
    // 0.5);
    result = ec.compare(hitchB, hitchD);
    assertTrue(result.score < 0.6);
    result = ec.compare(hitchA, hitchE);
// Another test that fails. Critical local difference.
// assertTrue( Double.parseDouble( result.get( EntityComparison.SCORE )
// ) < 0.6 );
}
Also used : MetricResponse(edu.illinois.cs.cogcomp.sim.MetricResponse) Metric(edu.illinois.cs.cogcomp.sim.Metric) NESim(edu.illinois.cs.cogcomp.sim.NESim) Test(org.junit.Test)

Example 2 with NESim

use of edu.illinois.cs.cogcomp.sim.NESim in project cogcomp-nlp by CogComp.

the class WordComparator method SetAs_NEComparator.

/**
 * only used to initialize the NE comparator
 *
 * @throws IllegalArgumentException
 * @throws IOException
 */
public void SetAs_NEComparator() throws IllegalArgumentException, IOException {
    System.out.println("set Name entity comparator");
    this.wordSim = new NESim();
}
Also used : NESim(edu.illinois.cs.cogcomp.sim.NESim)

Aggregations

NESim (edu.illinois.cs.cogcomp.sim.NESim)2 Metric (edu.illinois.cs.cogcomp.sim.Metric)1 MetricResponse (edu.illinois.cs.cogcomp.sim.MetricResponse)1 Test (org.junit.Test)1