Package dkpro.similarity.algorithms.api

Examples of dkpro.similarity.algorithms.api.TextSimilarityMeasure


    // These are the two input documents
    String[] tokens1 = "The quick brown fox jumps over the lazy dog".split(" ");    
    String[] tokens2 = "The quick brown dog jumps over the lazy fox".split(" ");
   
    // Compute a trigram relatedness   
    TextSimilarityMeasure measure = new WordNGramContainmentMeasure(3);

    double score = measure.getSimilarity(tokens1, tokens2);

    System.out.println("Trigram similarity: " + score);
   
    // Compute ESA relatedness on Wiktionary    
    /*VectorComparator esa = new VectorComparator(
View Full Code Here


        String text2 = "This is a second different test .";

        List<String> tokens1 = Arrays.asList(text1.split(" "));
        List<String> tokens2 = Arrays.asList(text2.split(" "));
       
        TextSimilarityMeasure measure = new HultigSumoComparator();
        assertEquals(1.0, measure.getSimilarity(tokens1, tokens1), 0.000001);
        assertEquals(0.75729, measure.getSimilarity(tokens1, tokens2), 0.00001);
    }
View Full Code Here

      throws IOException, SimilarityException
  {
    String[] text1 = "This is a test .".split(" ");
    String[] text2 = "This is an example .".split(" ");
 
    TextSimilarityMeasure lsa = new LsaSimilarityMeasure(new File("src/test/resources/model/test.sspace"));
   
    assertEquals(1.0, lsa.getSimilarity(text1, text1), 0.00001);
    assertEquals(0.837171, lsa.getSimilarity(text1, text2), 0.00001);

  }
View Full Code Here

TOP

Related Classes of dkpro.similarity.algorithms.api.TextSimilarityMeasure

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.