Package dkpro.similarity.algorithms.lsr

Examples of dkpro.similarity.algorithms.lsr.LexSemResourceComparator


  @Test
  public void testGlossOverlapWikipedia()
    throws Exception
  {
        LexSemResourceComparator comparator = new GlossOverlapComparator(wikiResource, false);

        Set<Entity> entitiesAuto  = wikiResource.getEntity("Automobile");
        Set<Entity> entitiesTruck = wikiResource.getEntity("Truck");

        assertTrue("Auto",  entitiesAuto.size() > 0);
        assertTrue("Truck", entitiesTruck.size() > 0);

        // same page
        assertEquals(1.0, comparator.getSimilarity(entitiesAuto, entitiesAuto), epsilon);

        // different pages
        assertEquals(0.2931, comparator.getSimilarity(entitiesAuto, entitiesTruck), epsilon);
    }
View Full Code Here


    @Ignore("Currently deactivated as Wiktionary resource data is not for API version is not available.")
  @Test
  public void testGlossOverlapWiktionary()
    throws LexicalSemanticResourceException, SimilarityException
  {
    LexSemResourceComparator comparator = new GlossOverlapComparator(wktResource, false);

        Set<Entity> entities1  = wktResource.getEntity("Bayern");
        Set<Entity> entities2 = wktResource.getEntity("Deutschland");

        assertTrue("Bayern",  entities1.size() > 0);
        assertTrue("Deutschland", entities2.size() > 0);

        // same page
        assertEquals(1.0, comparator.getSimilarity(entities1, entities1), epsilon);

        // different pages
        assertEquals(0.22222, comparator.getSimilarity(entities1, entities2), epsilon);
    }
View Full Code Here

  @Ignore("TODO for some reason the leskComparator gloss is from the disambiguation page - need to discover why")
  public void comparisonWithJwplImplementationTest()
    throws LexicalSemanticResourceException, WikiException, SimilarityException
  {
    wikiResource.setIsCaseSensitive(true);
    LexSemResourceComparator glossOverlapComparator = new GlossOverlapComparator(wikiResource, false);

        String term1 = "Automobile";
        String term2 = "Truck";

        Set<Entity> entitiesAuto  = wikiResource.getEntity(term1);
        Set<Entity> entitiesTruck = wikiResource.getEntity(term2);

        LeskComparator leskComparator = new LeskFirstComparator(wiki);
        leskComparator.setUseCache(false);

        assertEquals(glossOverlapComparator.getSimilarity(entitiesAuto, entitiesTruck), leskComparator.getSimilarity(term1, term2), epsilon);

        wikiResource.setIsCaseSensitive(false);
    }
View Full Code Here

TOP

Related Classes of dkpro.similarity.algorithms.lsr.LexSemResourceComparator

Copyright © 2018 www.massapicom. 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.