コード例 #1
0
  // Test for this class
  public static void main(String[] args) throws IOException {

    CosineDocumentSimilarity cosineDocumentSimilarity = new CosineDocumentSimilarity();
    System.out.println(
        cosineDocumentSimilarity.getCosineSimilarity(
            "Hello doggy", "great labradr whatever doggy doggy hello"));
  }
コード例 #2
0
  public static double getCosineSimValue(String s1, String s2) throws IOException {

    CosineDocumentSimilarity cosineDocumentSimilarity = new CosineDocumentSimilarity();
    // return (cosineDocumentSimilarity.getCosineSimilarity("Hello rodgers tell remote what",
    //		"great labradr homecoming lazy gear remote" ));
    // \

    return cosineDocumentSimilarity.getCosineSimilarity(s1, s2);
  }