org.apache.commons.text.similarity

## Class JaccardSimilarity

- java.lang.Object
- - org.apache.commons.text.similarity.JaccardSimilarity

- All Implemented Interfaces:
    SimilarityScore<Double>

      public class JaccardSimilarity
      extends Object
      implements SimilarityScore<Double>

  Measures the Jaccard similarity (aka Jaccard index) of two sets of character sequence. Jaccard similarity is the size of the intersection divided by the size of the union of the two sets.

  For further explanation about Jaccard Similarity, refer https://en.wikipedia.org/wiki/Jaccard_index

  Since:
    1.0

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `JaccardSimilarity()`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `Double` | `apply(CharSequence left, CharSequence right)` Calculates Jaccard Similarity of two set character sequence passed as input.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### JaccardSimilarity

          public JaccardSimilarity()

  - ### Method Detail

    - #### apply

          public Double apply(CharSequence left,
                              CharSequence right)

      Calculates Jaccard Similarity of two set character sequence passed as input.
      Specified by:
        `apply` in interface `SimilarityScore<Double>`
      Parameters:
        `left` - first character sequence
        `right` - second character sequence
      Returns:
        index
      Throws:
        `IllegalArgumentException` - if either String input `null`

Copyright © 2014–2017 The Apache Software Foundation. All rights reserved.