| Access | Constructor and Description |
|---|---|
| public | |
| public |
| Modifier and Type | Method and Description |
|---|---|
| public final double | Returns: 1.0 - the cosine similarity in the range [0, 1]The first string to compare. s1, final String The second string to compare. s2)Implements info. Return 1.0 - similarity. |
| private static double | |
| private static double | |
| public final double | Returns: The cosine similarity in the range [0, 1]The first string to compare. s1, final String The second string to compare. s2)Implements info. Compute the cosine similarity between strings. |
| public final double |
| Cosine | back to summary |
|---|---|
| public Cosine(final int k) Implements Cosine Similarity between strings. The strings are first transformed in vectors of occurrences of k-shingles (sequences of k characters). In this n-dimensional space, the similarity between the two strings is the cosine of their respective vectors. | |
| Cosine | back to summary |
|---|---|
| public Cosine() Implements Cosine Similarity between strings. The strings are first transformed in vectors of occurrences of k-shingles (sequences of k characters). In this n-dimensional space, the similarity between the two strings is the cosine of their respective vectors. Default k is 3. | |
| distance | back to summary |
|---|---|
| public final double distance(final String s1, final String s2) Implements info. Return 1.0 - similarity.
| |
| dotProduct | back to summary |
|---|---|
| private static double dotProduct(final Map<String, Integer> profile1, final Map<String, Integer> profile2) | |
| norm | back to summary |
|---|---|
| private static double norm(final Map<String, Integer> profile) Compute the norm L2 : sqrt(Sum_i( v_i²)).
| |
| similarity | back to summary |
|---|---|
| public final double similarity(final String s1, final String s2) Implements info. Compute the cosine similarity between strings.
| |
| similarity | back to summary |
|---|---|
| public final double similarity(final Map<String, Integer> profile1, final Map<String, Integer> profile2) Compute similarity between precomputed profiles. | |