diff options
author | Rocky Madden <git@rockymadden.com> | 2013-03-15 23:50:53 -0600 |
---|---|---|
committer | Rocky Madden <git@rockymadden.com> | 2013-03-15 23:50:53 -0600 |
commit | d5f8c6f968c7ad4c086a6ddef526b383648fcffd (patch) | |
tree | cfeadea826410e3aeaab5117c80b9ec0b19c6719 /core/source | |
parent | bf647570705de2023784641251bf80b9c8a23113 (diff) | |
download | stringmetric-d5f8c6f968c7ad4c086a6ddef526b383648fcffd.tar.gz stringmetric-d5f8c6f968c7ad4c086a6ddef526b383648fcffd.tar.bz2 stringmetric-d5f8c6f968c7ad4c086a6ddef526b383648fcffd.zip |
Code formatting tweaks.
Diffstat (limited to 'core/source')
21 files changed, 21 insertions, 63 deletions
diff --git a/core/source/core/scala/com/rockymadden/stringmetric/phonetic/MetaphoneAlgorithm.scala b/core/source/core/scala/com/rockymadden/stringmetric/phonetic/MetaphoneAlgorithm.scala index c0b8be2..f061748 100755 --- a/core/source/core/scala/com/rockymadden/stringmetric/phonetic/MetaphoneAlgorithm.scala +++ b/core/source/core/scala/com/rockymadden/stringmetric/phonetic/MetaphoneAlgorithm.scala @@ -5,9 +5,7 @@ import com.rockymadden.stringmetric.phonetic.Alphabet.{ Alpha, LowercaseVowel } import scala.annotation.{ switch, tailrec } /** An implementation of the Metaphone algorithm. */ -class MetaphoneAlgorithm extends StringAlgorithm[String] { - this: StringFilter => - +class MetaphoneAlgorithm extends StringAlgorithm[String] { this: StringFilter => final override def compute(charArray: Array[Char]): Option[Array[Char]] = { val fca = filter(charArray) diff --git a/core/source/core/scala/com/rockymadden/stringmetric/phonetic/MetaphoneMetric.scala b/core/source/core/scala/com/rockymadden/stringmetric/phonetic/MetaphoneMetric.scala index 85f48d7..df6e7cd 100755 --- a/core/source/core/scala/com/rockymadden/stringmetric/phonetic/MetaphoneMetric.scala +++ b/core/source/core/scala/com/rockymadden/stringmetric/phonetic/MetaphoneMetric.scala @@ -4,9 +4,7 @@ import com.rockymadden.stringmetric.{ StringFilter, StringMetric } import com.rockymadden.stringmetric.phonetic.Alphabet.Alpha /** A implementation of the Metaphone metric. */ -class MetaphoneMetric extends StringMetric[Boolean] { - this: StringFilter => - +class MetaphoneMetric extends StringMetric[Boolean] { this: StringFilter => final override def compare(charArray1: Array[Char], charArray2: Array[Char]): Option[Boolean] = { val fca1 = filter(charArray1) lazy val fca2 = filter(charArray2) diff --git a/core/source/core/scala/com/rockymadden/stringmetric/phonetic/NysiisAlgorithm.scala b/core/source/core/scala/com/rockymadden/stringmetric/phonetic/NysiisAlgorithm.scala index 633dd23..ce9f508 100755 --- a/core/source/core/scala/com/rockymadden/stringmetric/phonetic/NysiisAlgorithm.scala +++ b/core/source/core/scala/com/rockymadden/stringmetric/phonetic/NysiisAlgorithm.scala @@ -5,9 +5,7 @@ import com.rockymadden.stringmetric.phonetic.Alphabet.{ Alpha, LowercaseVowel } import scala.annotation.{ switch, tailrec } /** An implementation of the NYSIIS algorithm. */ -class NysiisAlgorithm extends StringAlgorithm[String] { - this: StringFilter => - +class NysiisAlgorithm extends StringAlgorithm[String] { this: StringFilter => final override def compute(charArray: Array[Char]): Option[Array[Char]] = { val fca = filter(charArray) diff --git a/core/source/core/scala/com/rockymadden/stringmetric/phonetic/NysiisMetric.scala b/core/source/core/scala/com/rockymadden/stringmetric/phonetic/NysiisMetric.scala index 7483abd..61ab218 100755 --- a/core/source/core/scala/com/rockymadden/stringmetric/phonetic/NysiisMetric.scala +++ b/core/source/core/scala/com/rockymadden/stringmetric/phonetic/NysiisMetric.scala @@ -4,9 +4,7 @@ import com.rockymadden.stringmetric.{ StringFilter, StringMetric } import com.rockymadden.stringmetric.phonetic.Alphabet.Alpha /** An implementation of the NYSIIS metric. */ -class NysiisMetric extends StringMetric[Boolean] { - this: StringFilter => - +class NysiisMetric extends StringMetric[Boolean] { this: StringFilter => final override def compare(charArray1: Array[Char], charArray2: Array[Char]): Option[Boolean] = { val unequal = (c1: Char, c2: Char) => { val lc1 = c1.toLower diff --git a/core/source/core/scala/com/rockymadden/stringmetric/phonetic/RefinedNysiisAlgorithm.scala b/core/source/core/scala/com/rockymadden/stringmetric/phonetic/RefinedNysiisAlgorithm.scala index a490b53..14ed94b 100755 --- a/core/source/core/scala/com/rockymadden/stringmetric/phonetic/RefinedNysiisAlgorithm.scala +++ b/core/source/core/scala/com/rockymadden/stringmetric/phonetic/RefinedNysiisAlgorithm.scala @@ -5,9 +5,7 @@ import com.rockymadden.stringmetric.phonetic.Alphabet.{ Alpha, LowercaseVowel } import scala.annotation.{ switch, tailrec } /** An implementation of the refined NYSIIS algorithm. */ -class RefinedNysiisAlgorithm extends StringAlgorithm[String] { - this: StringFilter => - +class RefinedNysiisAlgorithm extends StringAlgorithm[String] { this: StringFilter => final override def compute(charArray: Array[Char]): Option[Array[Char]] = { val fca = filter(charArray) diff --git a/core/source/core/scala/com/rockymadden/stringmetric/phonetic/RefinedNysiisMetric.scala b/core/source/core/scala/com/rockymadden/stringmetric/phonetic/RefinedNysiisMetric.scala index f25a0a3..46ffb03 100755 --- a/core/source/core/scala/com/rockymadden/stringmetric/phonetic/RefinedNysiisMetric.scala +++ b/core/source/core/scala/com/rockymadden/stringmetric/phonetic/RefinedNysiisMetric.scala @@ -4,9 +4,7 @@ import com.rockymadden.stringmetric.{ StringFilter, StringMetric } import com.rockymadden.stringmetric.phonetic.Alphabet.Alpha /** An implementation of the refined NYSIIS metric. */ -class RefinedNysiisMetric extends StringMetric[Boolean] { - this: StringFilter => - +class RefinedNysiisMetric extends StringMetric[Boolean] { this: StringFilter => final override def compare(charArray1: Array[Char], charArray2: Array[Char]): Option[Boolean] = { val unequal = (c1: Char, c2: Char) => { val lc1 = c1.toLower diff --git a/core/source/core/scala/com/rockymadden/stringmetric/phonetic/RefinedSoundexAlgorithm.scala b/core/source/core/scala/com/rockymadden/stringmetric/phonetic/RefinedSoundexAlgorithm.scala index d45431c..4f73aff 100755 --- a/core/source/core/scala/com/rockymadden/stringmetric/phonetic/RefinedSoundexAlgorithm.scala +++ b/core/source/core/scala/com/rockymadden/stringmetric/phonetic/RefinedSoundexAlgorithm.scala @@ -5,9 +5,7 @@ import com.rockymadden.stringmetric.phonetic.Alphabet.Alpha import scala.annotation.{ switch, tailrec } /** An implementation of the refined Soundex algorithm. */ -class RefinedSoundexAlgorithm extends StringAlgorithm[String] { - this: StringFilter => - +class RefinedSoundexAlgorithm extends StringAlgorithm[String] { this: StringFilter => final override def compute(charArray: Array[Char]): Option[Array[Char]] = { val fca = filter(charArray) diff --git a/core/source/core/scala/com/rockymadden/stringmetric/phonetic/RefinedSoundexMetric.scala b/core/source/core/scala/com/rockymadden/stringmetric/phonetic/RefinedSoundexMetric.scala index c55dc5b..3d0616a 100755 --- a/core/source/core/scala/com/rockymadden/stringmetric/phonetic/RefinedSoundexMetric.scala +++ b/core/source/core/scala/com/rockymadden/stringmetric/phonetic/RefinedSoundexMetric.scala @@ -4,9 +4,7 @@ import com.rockymadden.stringmetric.{ StringFilter, StringMetric } import com.rockymadden.stringmetric.phonetic.Alphabet.Alpha /** An implementation of the refined Soundex metric. */ -class RefinedSoundexMetric extends StringMetric[Boolean] { - this: StringFilter => - +class RefinedSoundexMetric extends StringMetric[Boolean] { this: StringFilter => final override def compare(charArray1: Array[Char], charArray2: Array[Char]): Option[Boolean] = { val fca1 = filter(charArray1) lazy val fca2 = filter(charArray2) diff --git a/core/source/core/scala/com/rockymadden/stringmetric/phonetic/SoundexAlgorithm.scala b/core/source/core/scala/com/rockymadden/stringmetric/phonetic/SoundexAlgorithm.scala index aef70c6..e5bb579 100755 --- a/core/source/core/scala/com/rockymadden/stringmetric/phonetic/SoundexAlgorithm.scala +++ b/core/source/core/scala/com/rockymadden/stringmetric/phonetic/SoundexAlgorithm.scala @@ -5,9 +5,7 @@ import com.rockymadden.stringmetric.phonetic.Alphabet.Alpha import scala.annotation.{ switch, tailrec } /** An implementation of the Soundex algorithm. */ -class SoundexAlgorithm extends StringAlgorithm[String] { - this: StringFilter => - +class SoundexAlgorithm extends StringAlgorithm[String] { this: StringFilter => final override def compute(charArray: Array[Char]): Option[Array[Char]] = { val fca = filter(charArray) diff --git a/core/source/core/scala/com/rockymadden/stringmetric/phonetic/SoundexMetric.scala b/core/source/core/scala/com/rockymadden/stringmetric/phonetic/SoundexMetric.scala index 6c760d7..6b83863 100755 --- a/core/source/core/scala/com/rockymadden/stringmetric/phonetic/SoundexMetric.scala +++ b/core/source/core/scala/com/rockymadden/stringmetric/phonetic/SoundexMetric.scala @@ -4,9 +4,7 @@ import com.rockymadden.stringmetric.{ StringFilter, StringMetric } import com.rockymadden.stringmetric.phonetic.Alphabet.Alpha /** An implementation of the Soundex metric. */ -class SoundexMetric extends StringMetric[Boolean] { - this: StringFilter => - +class SoundexMetric extends StringMetric[Boolean] { this: StringFilter => final override def compare(charArray1: Array[Char], charArray2: Array[Char]): Option[Boolean] = { val fca1 = filter(charArray1) lazy val fca2 = filter(charArray2) diff --git a/core/source/core/scala/com/rockymadden/stringmetric/similarity/DiceSorensenMetric.scala b/core/source/core/scala/com/rockymadden/stringmetric/similarity/DiceSorensenMetric.scala index 9846aa5..f091161 100755 --- a/core/source/core/scala/com/rockymadden/stringmetric/similarity/DiceSorensenMetric.scala +++ b/core/source/core/scala/com/rockymadden/stringmetric/similarity/DiceSorensenMetric.scala @@ -6,9 +6,7 @@ import com.rockymadden.stringmetric.{ ConfigurableStringMetric, MatchTuple, Stri * An implementation of the Dice/Sorensen metric. This implementation differs in that n-gram size is required. * Traditionally, the algorithm uses bigrams. */ -class DiceSorensenMetric extends ConfigurableStringMetric[Double, Int] { - this: StringFilter => - +class DiceSorensenMetric extends ConfigurableStringMetric[Double, Int] { this: StringFilter => final override def compare(charArray1: Array[Char], charArray2: Array[Char])(implicit n: Int): Option[Double] = { if (n <= 0) throw new IllegalArgumentException("Expected valid n.") diff --git a/core/source/core/scala/com/rockymadden/stringmetric/similarity/HammingMetric.scala b/core/source/core/scala/com/rockymadden/stringmetric/similarity/HammingMetric.scala index 038905d..ece7458 100755 --- a/core/source/core/scala/com/rockymadden/stringmetric/similarity/HammingMetric.scala +++ b/core/source/core/scala/com/rockymadden/stringmetric/similarity/HammingMetric.scala @@ -3,9 +3,7 @@ package com.rockymadden.stringmetric.similarity import com.rockymadden.stringmetric.{ CompareTuple, StringFilter, StringMetric } /** An implementation of the Hamming metric. */ -class HammingMetric extends StringMetric[Int] { - this: StringFilter => - +class HammingMetric extends StringMetric[Int] { this: StringFilter => final override def compare(charArray1: Array[Char], charArray2: Array[Char]): Option[Int] = { val fca1 = filter(charArray1) lazy val fca2 = filter(charArray2) diff --git a/core/source/core/scala/com/rockymadden/stringmetric/similarity/JaccardMetric.scala b/core/source/core/scala/com/rockymadden/stringmetric/similarity/JaccardMetric.scala index 178aecb..91be375 100755 --- a/core/source/core/scala/com/rockymadden/stringmetric/similarity/JaccardMetric.scala +++ b/core/source/core/scala/com/rockymadden/stringmetric/similarity/JaccardMetric.scala @@ -3,9 +3,7 @@ package com.rockymadden.stringmetric.similarity import com.rockymadden.stringmetric.{ ConfigurableStringMetric, MatchTuple, StringFilter } /* An implementation of the Jaccard metric. */ -class JaccardMetric extends ConfigurableStringMetric[Double, Int] { - this: StringFilter => - +class JaccardMetric extends ConfigurableStringMetric[Double, Int] { this: StringFilter => final override def compare(charArray1: Array[Char], charArray2: Array[Char])(implicit n: Int): Option[Double] = { if (n <= 0) throw new IllegalArgumentException("Expected valid n.") diff --git a/core/source/core/scala/com/rockymadden/stringmetric/similarity/JaroMetric.scala b/core/source/core/scala/com/rockymadden/stringmetric/similarity/JaroMetric.scala index f985256..9449f3c 100755 --- a/core/source/core/scala/com/rockymadden/stringmetric/similarity/JaroMetric.scala +++ b/core/source/core/scala/com/rockymadden/stringmetric/similarity/JaroMetric.scala @@ -7,9 +7,7 @@ import scala.collection.mutable.{ ArrayBuffer, HashSet } * An implementation of the Jaro metric. One differing detail in this implementation is that if a character is matched * in string2, it cannot be matched upon again. This results in a more penalized distance in these scenarios. */ -class JaroMetric extends StringMetric[Double] { - this: StringFilter => - +class JaroMetric extends StringMetric[Double] { this: StringFilter => final override def compare(charArray1: Array[Char], charArray2: Array[Char]): Option[Double] = { val fca1 = filter(charArray1) lazy val fca2 = filter(charArray2) diff --git a/core/source/core/scala/com/rockymadden/stringmetric/similarity/JaroWinklerMetric.scala b/core/source/core/scala/com/rockymadden/stringmetric/similarity/JaroWinklerMetric.scala index a6fbd78..f4a7852 100755 --- a/core/source/core/scala/com/rockymadden/stringmetric/similarity/JaroWinklerMetric.scala +++ b/core/source/core/scala/com/rockymadden/stringmetric/similarity/JaroWinklerMetric.scala @@ -7,9 +7,7 @@ import com.rockymadden.stringmetric.{ StringFilter, StringMetric } * matched in string2, it cannot be matched upon again. This results in a more penalized distance in these scenarios * (e.g. comparing henka and henkan distance is 0.9666 versus the typical 0.9722). */ -class JaroWinklerMetric extends StringMetric[Double] { - this: StringFilter => - +class JaroWinklerMetric extends StringMetric[Double] { this: StringFilter => final override def compare(charArray1: Array[Char], charArray2: Array[Char]): Option[Double] = { val fca1 = filter(charArray1) val fca2 = filter(charArray2) diff --git a/core/source/core/scala/com/rockymadden/stringmetric/similarity/LevenshteinMetric.scala b/core/source/core/scala/com/rockymadden/stringmetric/similarity/LevenshteinMetric.scala index 287d4e8..163dd44 100755 --- a/core/source/core/scala/com/rockymadden/stringmetric/similarity/LevenshteinMetric.scala +++ b/core/source/core/scala/com/rockymadden/stringmetric/similarity/LevenshteinMetric.scala @@ -3,9 +3,7 @@ package com.rockymadden.stringmetric.similarity import com.rockymadden.stringmetric.{ CompareTuple, StringFilter, StringMetric } /** An implementation of the Levenshtein metric. */ -class LevenshteinMetric extends StringMetric[Int] { - this: StringFilter => - +class LevenshteinMetric extends StringMetric[Int] { this: StringFilter => final override def compare(charArray1: Array[Char], charArray2: Array[Char]): Option[Int] = { val fca1 = filter(charArray1) lazy val fca2 = filter(charArray2) diff --git a/core/source/core/scala/com/rockymadden/stringmetric/similarity/NGramAlgorithm.scala b/core/source/core/scala/com/rockymadden/stringmetric/similarity/NGramAlgorithm.scala index e9b78ce..cc67e04 100755 --- a/core/source/core/scala/com/rockymadden/stringmetric/similarity/NGramAlgorithm.scala +++ b/core/source/core/scala/com/rockymadden/stringmetric/similarity/NGramAlgorithm.scala @@ -4,9 +4,7 @@ import com.rockymadden.stringmetric.{ ConfigurableStringAlgorithm, StringFilter import scala.annotation.tailrec /** An implementation of the N-Gram algorithm. */ -class NGramAlgorithm extends ConfigurableStringAlgorithm[Array[String], Int] { - this: StringFilter => - +class NGramAlgorithm extends ConfigurableStringAlgorithm[Array[String], Int] { this: StringFilter => final override def compute(charArray: Array[Char])(implicit n: Int): Option[Array[Array[Char]]] = { if (n <= 0) throw new IllegalArgumentException("Expected valid n.") diff --git a/core/source/core/scala/com/rockymadden/stringmetric/similarity/NGramMetric.scala b/core/source/core/scala/com/rockymadden/stringmetric/similarity/NGramMetric.scala index c4db257..935e576 100755 --- a/core/source/core/scala/com/rockymadden/stringmetric/similarity/NGramMetric.scala +++ b/core/source/core/scala/com/rockymadden/stringmetric/similarity/NGramMetric.scala @@ -4,9 +4,7 @@ import com.rockymadden.stringmetric.{ ConfigurableStringMetric, MatchTuple, Stri import scala.math /** An implementation of the N-Gram metric. */ -class NGramMetric extends ConfigurableStringMetric[Double, Int] { - this: StringFilter => - +class NGramMetric extends ConfigurableStringMetric[Double, Int] { this: StringFilter => final override def compare(charArray1: Array[Char], charArray2: Array[Char])(implicit n: Int): Option[Double] = { if (n <= 0) throw new IllegalArgumentException("Expected valid n.") diff --git a/core/source/core/scala/com/rockymadden/stringmetric/similarity/OverlapMetric.scala b/core/source/core/scala/com/rockymadden/stringmetric/similarity/OverlapMetric.scala index 3bf85ca..574e131 100755 --- a/core/source/core/scala/com/rockymadden/stringmetric/similarity/OverlapMetric.scala +++ b/core/source/core/scala/com/rockymadden/stringmetric/similarity/OverlapMetric.scala @@ -4,9 +4,7 @@ import com.rockymadden.stringmetric.{ ConfigurableStringMetric, MatchTuple, Stri import scala.math /* An implementation of the overlap metric. */ -class OverlapMetric extends ConfigurableStringMetric[Double, Int] { - this: StringFilter => - +class OverlapMetric extends ConfigurableStringMetric[Double, Int] { this: StringFilter => final override def compare(charArray1: Array[Char], charArray2: Array[Char])(implicit n: Int): Option[Double] = { if (n <= 0) throw new IllegalArgumentException("Expected valid n.") diff --git a/core/source/core/scala/com/rockymadden/stringmetric/similarity/RatcliffObershelpMetric.scala b/core/source/core/scala/com/rockymadden/stringmetric/similarity/RatcliffObershelpMetric.scala index 3a969d7..d53b8c3 100755 --- a/core/source/core/scala/com/rockymadden/stringmetric/similarity/RatcliffObershelpMetric.scala +++ b/core/source/core/scala/com/rockymadden/stringmetric/similarity/RatcliffObershelpMetric.scala @@ -3,9 +3,7 @@ package com.rockymadden.stringmetric.similarity import com.rockymadden.stringmetric.{ CompareTuple, StringFilter, StringMetric } /** An implementation of the Ratcliff/Obershelp metric. */ -class RatcliffObershelpMetric extends StringMetric[Double] { - this: StringFilter => - +class RatcliffObershelpMetric extends StringMetric[Double] { this: StringFilter => final override def compare(charArray1: Array[Char], charArray2: Array[Char]): Option[Double] = { val fca1 = filter(charArray1) lazy val fca2 = filter(charArray2) diff --git a/core/source/core/scala/com/rockymadden/stringmetric/similarity/WeightedLevenshteinMetric.scala b/core/source/core/scala/com/rockymadden/stringmetric/similarity/WeightedLevenshteinMetric.scala index 07c0d25..8ab3f3a 100755 --- a/core/source/core/scala/com/rockymadden/stringmetric/similarity/WeightedLevenshteinMetric.scala +++ b/core/source/core/scala/com/rockymadden/stringmetric/similarity/WeightedLevenshteinMetric.scala @@ -5,9 +5,7 @@ import scala.math.BigDecimal /** An implementation of a weighted Levenshtein metric. */ class WeightedLevenshteinMetric - extends ConfigurableStringMetric[Double, (BigDecimal, BigDecimal, BigDecimal)] { - - this: StringFilter => + extends ConfigurableStringMetric[Double, (BigDecimal, BigDecimal, BigDecimal)] { this: StringFilter => /** Options order is delete, insert, then substitute weight. */ final override def compare(charArray1: Array[Char], charArray2: Array[Char]) |