public class CosineDistance extends Object implements EditDistance<Double>
It utilizes the CosineSimilarity to compute the distance. Character sequences
are converted into vectors through a simple tokenizer that works with a regular expression
to split words in a sentence.
For further explanation about Cosine Similarity and Cosine Distance, refer to http://en.wikipedia.org/wiki/Cosine_similarity.
CosineSimilarity| Constructor and Description |
|---|
CosineDistance() |
| Modifier and Type | Method and Description |
|---|---|
Double |
apply(CharSequence left,
CharSequence right)
Compares two CharSequences.
|
public Double apply(CharSequence left, CharSequence right)
EditDistanceapply in interface EditDistance<Double>apply in interface SimilarityScore<Double>left - the first CharSequenceright - the second CharSequenceCopyright © 2014–2018 The Apache Software Foundation. All rights reserved.