|
Groovy Documentation | |||||||
FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object grails.util.CosineSimilarity
class CosineSimilarity extends java.lang.Object
Uses cosine similarity to find matches from a candidate set for a specified input. Based on code from http://www.nearinfinity.com/blogs/seth_schroeder/groovy_cosine_similarity_in_grails.html
Method Summary | |
---|---|
static java.util.List
|
mostSimilar(java.lang.String pattern, java.lang.Object candidates, double threshold = 0)
Sort the candidates by their similarity to the specified input. |
Methods inherited from class java.lang.Object | |
---|---|
java.lang.Object#wait(), java.lang.Object#wait(long), java.lang.Object#wait(long, int), java.lang.Object#equals(java.lang.Object), java.lang.Object#toString(), java.lang.Object#hashCode(), java.lang.Object#getClass(), java.lang.Object#notify(), java.lang.Object#notifyAll() |
Method Detail |
---|
static java.util.List mostSimilar(java.lang.String pattern, java.lang.Object candidates, double threshold = 0)
pattern
- the input stringcandidates
- the possible matches
Groovy Documentation