Work at SourceForge, help us to make it a better place! We have an immediate need for a Support Technician in our San Francisco or Denver office.

Close

Problem in using Simmetric: Cosine Similarity

Help
2008-06-06
2013-04-25
  • Tabbasum Naz
    Tabbasum Naz
    2008-06-06

    Hello,

    Its the first time, I am using simmetric. I want to use cosine similarity metric.
    I tried it with Levenshtein its working fine but when i am trying to use cosine similarity, following error occurs.
    Can anybody help me in resolving this error?
    Thanks in advance!
    Tabbasum

    Exception in thread "main" java.lang.Error: Unresolved compilation problems:
        The type TokeniserWhitespace must implement the inherited abstract method InterfaceTokeniser.tokenizeToArrayList(String)
        The type ArrayList is not generic; it cannot be parameterized with arguments <String>
        Syntax error, parameterized types are only available if source level is 5.0
        The type ArrayList is not generic; it cannot be parameterized with arguments <String>
        Syntax error, parameterized types are only available if source level is 5.0
        The type ArrayList is not generic; it cannot be parameterized with arguments <String>
        Syntax error, parameterized types are only available if source level is 5.0
        The type Set is not generic; it cannot be parameterized with arguments <String>
        Syntax error, parameterized types are only available if source level is 5.0
        The type Set is not generic; it cannot be parameterized with arguments <String>
        Syntax error, parameterized types are only available if source level is 5.0
        The type HashSet is not generic; it cannot be parameterized with arguments <String>
        Syntax error, parameterized types are only available if source level is 5.0

        at uk.ac.shef.wit.simmetrics.tokenisers.TokeniserWhitespace.<init>(TokeniserWhitespace.java:59)
        at uk.ac.shef.wit.simmetrics.similaritymetrics.CosineSimilarity.<init>(CosineSimilarity.java:75)
        at uk.ac.shef.wit.simmetrics.SimpleExample.main(SimpleExample.java:84)

     
    • ReverendSam
      ReverendSam
      2008-06-06

      It the version of java used is not uptodate maybe you have Java 5 (or beyond) installed, the JVM running may be different.

      Try typing this in the console window: java -version.
      It will give you the Version of the Runtime Environment.

      Or, if you are using an IDE, then you need to enable Java 5 support.
      In Eclipse, You can add Java 5 in Window > Preferences > Java > Installed JRE’s.
      and/or, Set the compiler compliance level to 5.0 (Window > Preferences > Java > Compiler)

      In Netbeans, you can use (Tools -> Java Platform Manager) to check your default platform.

      Hope this helps,

      Sam

       
    • Tabbasum Naz
      Tabbasum Naz
      2008-06-07

      Thanks!
      It worked.

      Tabbasum

       
  • shatlav
    shatlav
    2013-02-12

    Hi,

    I'm trying to simmetrics to compare 27000 strings in an array to each other. The problem is that the program runs untill 1878th  line, but it considered to go through all 27000 lines. Can you suggest something?
    This is the part of calculating the similarities:

    AbstractStringMetric metric = new CosineSimilarity();
    for(int i = 0; i < all.length; i++){
    for(int j = 0; j < i; j++){
    sim = metric.getSimilarity(all, all_);
    if(sim >= 0.5){
    System.out.println(i+": "+j + ": "+sim);
    }
    }
    }_