Packages

object StringDistance

Main class to organize functionality of different string distance algorithms

import com.github.vickumar1981.stringdistance.StringDistance._
import com.github.vickumar1981.stringdistance.impl.{ConstantGap, LinearGap}

// Scores between strings
val cosSimilarity: Double = Cosine.score("hello", "chello")
val damerau: Double = Damerau.score("martha", "marhta")
val diceCoefficient: Double = DiceCoefficient.score("martha", "marhta")
val hamming: Double = Hamming.score("martha", "marhta")
val jaccard: Double = Jaccard.score("karolin", "kathrin", 1)
val jaro: Double = Jaro.score("martha", "marhta")
val jaroWinkler: Double = JaroWinkler.score("martha", "marhta", 0.1)
val levenshtein: Double = Levenshtein.score("martha", "marhta")
val needlemanWunsch: Double = NeedlemanWunsch.score("martha", "marhta", ConstantGap())
val ngramSimilarity: Double = NGram.score("karolin", "kathrin", 1)
val bigramSimilarity: Double = NGram.score("karolin", "kathrin", 2)
val overlap: Double = Overlap.score("karolin", "kathrin", 1)
val smithWaterman: Double = SmithWaterman.score("martha", "marhta", (LinearGap(gapValue = -1), Integer.MAX_VALUE))
val smithWatermanGotoh: Double = SmithWatermanGotoh.score("martha", "marhta", ConstantGap())
val tversky: Double = Tversky.score("karolin", "kathrin", 0.5)

// Distances between strings
val damerauDist: Int = Damerau.distance("martha", "marhta")
val hammingDist: Int = Hamming.distance("martha", "marhta")
val levenshteinDist: Int = Levenshtein.distance("martha", "marhta")
val longestCommonSubSeq: Int = LongestCommonSeq.distance("martha", "marhta")
val ngramDist: Int = NGram.distance("karolin", "kathrin", 1)
val bigramDist: Int = NGram.distance("karolin", "kathrin", 2)

// return a List[String] of ngram tokens
val tokens = NGram.tokens("martha", 2) // List("ma", "ar", "rt", "th", "ha")
Linear Supertypes
AnyRef, Any
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. StringDistance
  2. AnyRef
  3. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. Protected

Value Members

  1. final def !=(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  2. final def ##(): Int
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  4. final def asInstanceOf[T0]: T0
    Definition Classes
    Any
  5. def clone(): AnyRef
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.CloneNotSupportedException]) @native()
  6. final def eq(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  7. def equals(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef → Any
  8. def finalize(): Unit
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.Throwable])
  9. final def getClass(): Class[_ <: AnyRef]
    Definition Classes
    AnyRef → Any
    Annotations
    @native()
  10. def hashCode(): Int
    Definition Classes
    AnyRef → Any
    Annotations
    @native()
  11. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  12. final def ne(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  13. final def notify(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  14. final def notifyAll(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  15. final def synchronized[T0](arg0: => T0): T0
    Definition Classes
    AnyRef
  16. def toString(): String
    Definition Classes
    AnyRef → Any
  17. final def wait(): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])
  18. final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])
  19. final def wait(arg0: Long): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException]) @native()
  20. object Cosine extends StringMetric[CosineAlgorithm]
  21. object Damerau extends StringMetric[DamerauLevenshteinAlgorithm]
  22. object DiceCoefficient extends StringMetric[DiceCoefficientAlgorithm]
  23. object Hamming extends StringMetric[HammingAlgorithm]
  24. object Jaccard extends WeightedStringMetric[JaccardAlgorithm, Int]
  25. object Jaro extends StringMetric[JaroAlgorithm]
  26. object JaroWinkler extends WeightedStringMetric[JaroWinklerAlgorithm, Double]
  27. object Levenshtein extends StringMetric[LevenshteinAlgorithm]
  28. object LongestCommonSeq extends StringMetric[LongestCommonSeqAlorithm]
  29. object NGram extends WeightedStringMetric[NGramAlgorithm, Int] with NGramTokenizer
  30. object NeedlemanWunsch extends WeightedStringMetric[NeedlemanWunschAlgorithm, ConstantGap]
  31. object Overlap extends WeightedStringMetric[OverlapAlgorithm, Int]
  32. object SmithWaterman extends WeightedStringMetric[SmithWatermanAlgorithm, (Gap, Int)]
  33. object SmithWatermanGotoh extends WeightedStringMetric[SmithWatermanGotohAlgorithm, ConstantGap]
  34. object Tversky extends WeightedStringMetric[TverskyAlgorithm, Double]

Inherited from AnyRef

Inherited from Any

Ungrouped