diff options
author | Rocky Madden <git@rockymadden.com> | 2013-12-27 08:09:48 -0700 |
---|---|---|
committer | Rocky Madden <git@rockymadden.com> | 2013-12-27 08:09:48 -0700 |
commit | 001b756ff5fb88e295b0ff4e4ee89bf326a4f83e (patch) | |
tree | e5473fb8248008ca4db6db06fcd0f77297993361 /core/source | |
parent | b5c9e6778960869b34f63089097defcb766d1331 (diff) | |
download | stringmetric-001b756ff5fb88e295b0ff4e4ee89bf326a4f83e.tar.gz stringmetric-001b756ff5fb88e295b0ff4e4ee89bf326a4f83e.tar.bz2 stringmetric-001b756ff5fb88e295b0ff4e4ee89bf326a4f83e.zip |
Removed annotation imports.
Diffstat (limited to 'core/source')
16 files changed, 31 insertions, 47 deletions
diff --git a/core/source/benchmark/scala/com/rockymadden/stringmetric/similarity/DiceSorensenMetricBenchmark.scala b/core/source/benchmark/scala/com/rockymadden/stringmetric/similarity/DiceSorensenMetricBenchmark.scala index 88f5d4c..cfcda28 100755 --- a/core/source/benchmark/scala/com/rockymadden/stringmetric/similarity/DiceSorensenMetricBenchmark.scala +++ b/core/source/benchmark/scala/com/rockymadden/stringmetric/similarity/DiceSorensenMetricBenchmark.scala @@ -2,7 +2,6 @@ package com.rockymadden.stringmetric.similarity import com.google.caliper.Param import com.rockymadden.stringmetric.{CaliperBenchmark, CaliperRunner} -import scala.annotation.tailrec import scala.util.Random final class DiceSorensenMetricBenchmark extends CaliperBenchmark { @@ -17,7 +16,7 @@ final class DiceSorensenMetricBenchmark extends CaliperBenchmark { var charArray2: Array[Char] = _ override protected def setUp() { - @tailrec + @annotation.tailrec def random(l: Int, ps: String = null): String = if (l == 0) "" else { diff --git a/core/source/benchmark/scala/com/rockymadden/stringmetric/similarity/HammingMetricBenchmark.scala b/core/source/benchmark/scala/com/rockymadden/stringmetric/similarity/HammingMetricBenchmark.scala index 60ef7d4..d75b8aa 100755 --- a/core/source/benchmark/scala/com/rockymadden/stringmetric/similarity/HammingMetricBenchmark.scala +++ b/core/source/benchmark/scala/com/rockymadden/stringmetric/similarity/HammingMetricBenchmark.scala @@ -2,7 +2,6 @@ package com.rockymadden.stringmetric.similarity import com.google.caliper.Param import com.rockymadden.stringmetric.{CaliperBenchmark, CaliperRunner} -import scala.annotation.tailrec import scala.util.Random final class HammingMetricBenchmark extends CaliperBenchmark { @@ -17,7 +16,7 @@ final class HammingMetricBenchmark extends CaliperBenchmark { var charArray2: Array[Char] = _ override protected def setUp() { - @tailrec + @annotation.tailrec def random(l: Int, ps: String = null): String = if (l == 0) "" else { diff --git a/core/source/benchmark/scala/com/rockymadden/stringmetric/similarity/JaccardMetricBenchmark.scala b/core/source/benchmark/scala/com/rockymadden/stringmetric/similarity/JaccardMetricBenchmark.scala index 3f6a59f..8ea7066 100755 --- a/core/source/benchmark/scala/com/rockymadden/stringmetric/similarity/JaccardMetricBenchmark.scala +++ b/core/source/benchmark/scala/com/rockymadden/stringmetric/similarity/JaccardMetricBenchmark.scala @@ -2,7 +2,6 @@ package com.rockymadden.stringmetric.similarity import com.google.caliper.Param import com.rockymadden.stringmetric.{CaliperBenchmark, CaliperRunner} -import scala.annotation.tailrec import scala.util.Random final class JaccardMetricBenchmark extends CaliperBenchmark { @@ -17,7 +16,7 @@ final class JaccardMetricBenchmark extends CaliperBenchmark { var charArray2: Array[Char] = _ override protected def setUp() { - @tailrec + @annotation.tailrec def random(l: Int, ps: String = null): String = if (l == 0) "" else { diff --git a/core/source/benchmark/scala/com/rockymadden/stringmetric/similarity/JaroMetricBenchmark.scala b/core/source/benchmark/scala/com/rockymadden/stringmetric/similarity/JaroMetricBenchmark.scala index c9c9b2c..998b7d7 100755 --- a/core/source/benchmark/scala/com/rockymadden/stringmetric/similarity/JaroMetricBenchmark.scala +++ b/core/source/benchmark/scala/com/rockymadden/stringmetric/similarity/JaroMetricBenchmark.scala @@ -2,7 +2,6 @@ package com.rockymadden.stringmetric.similarity import com.google.caliper.Param import com.rockymadden.stringmetric.{CaliperBenchmark, CaliperRunner} -import scala.annotation.tailrec import scala.util.Random final class JaroMetricBenchmark extends CaliperBenchmark { @@ -17,7 +16,7 @@ final class JaroMetricBenchmark extends CaliperBenchmark { var charArray2: Array[Char] = _ override protected def setUp() { - @tailrec + @annotation.tailrec def random(l: Int, ps: String = null): String = if (l == 0) "" else { diff --git a/core/source/benchmark/scala/com/rockymadden/stringmetric/similarity/JaroWinklerMetricBenchmark.scala b/core/source/benchmark/scala/com/rockymadden/stringmetric/similarity/JaroWinklerMetricBenchmark.scala index b3da154..3c1f650 100755 --- a/core/source/benchmark/scala/com/rockymadden/stringmetric/similarity/JaroWinklerMetricBenchmark.scala +++ b/core/source/benchmark/scala/com/rockymadden/stringmetric/similarity/JaroWinklerMetricBenchmark.scala @@ -2,7 +2,6 @@ package com.rockymadden.stringmetric.similarity import com.google.caliper.Param import com.rockymadden.stringmetric.{CaliperBenchmark, CaliperRunner} -import scala.annotation.tailrec import scala.util.Random final class JaroWinklerMetricBenchmark extends CaliperBenchmark { @@ -17,7 +16,7 @@ final class JaroWinklerMetricBenchmark extends CaliperBenchmark { var charArray2: Array[Char] = _ override protected def setUp() { - @tailrec + @annotation.tailrec def random(l: Int, ps: String = null): String = if (l == 0) "" else { diff --git a/core/source/benchmark/scala/com/rockymadden/stringmetric/similarity/LevenshteinMetricBenchmark.scala b/core/source/benchmark/scala/com/rockymadden/stringmetric/similarity/LevenshteinMetricBenchmark.scala index d47e138..31eda09 100755 --- a/core/source/benchmark/scala/com/rockymadden/stringmetric/similarity/LevenshteinMetricBenchmark.scala +++ b/core/source/benchmark/scala/com/rockymadden/stringmetric/similarity/LevenshteinMetricBenchmark.scala @@ -2,7 +2,6 @@ package com.rockymadden.stringmetric.similarity import com.google.caliper.Param import com.rockymadden.stringmetric.{CaliperBenchmark, CaliperRunner} -import scala.annotation.tailrec import scala.util.Random final class LevenshteinMetricBenchmark extends CaliperBenchmark { @@ -17,7 +16,7 @@ final class LevenshteinMetricBenchmark extends CaliperBenchmark { var charArray2: Array[Char] = _ override protected def setUp() { - @tailrec + @annotation.tailrec def random(l: Int, ps: String = null): String = if (l == 0) "" else { diff --git a/core/source/benchmark/scala/com/rockymadden/stringmetric/similarity/NGramMetricBenchmark.scala b/core/source/benchmark/scala/com/rockymadden/stringmetric/similarity/NGramMetricBenchmark.scala index 4250e66..b8cff9c 100755 --- a/core/source/benchmark/scala/com/rockymadden/stringmetric/similarity/NGramMetricBenchmark.scala +++ b/core/source/benchmark/scala/com/rockymadden/stringmetric/similarity/NGramMetricBenchmark.scala @@ -2,7 +2,6 @@ package com.rockymadden.stringmetric.similarity import com.google.caliper.Param import com.rockymadden.stringmetric.{CaliperBenchmark, CaliperRunner} -import scala.annotation.tailrec import scala.util.Random final class NGramMetricBenchmark extends CaliperBenchmark { @@ -20,7 +19,7 @@ final class NGramMetricBenchmark extends CaliperBenchmark { var charArray2: Array[Char] = _ override protected def setUp() { - @tailrec + @annotation.tailrec def random(l: Int, ps: String = null): String = if (l == 0) "" else { diff --git a/core/source/benchmark/scala/com/rockymadden/stringmetric/similarity/OverlapMetricBenchmark.scala b/core/source/benchmark/scala/com/rockymadden/stringmetric/similarity/OverlapMetricBenchmark.scala index 4d7ce0a..e31ea97 100755 --- a/core/source/benchmark/scala/com/rockymadden/stringmetric/similarity/OverlapMetricBenchmark.scala +++ b/core/source/benchmark/scala/com/rockymadden/stringmetric/similarity/OverlapMetricBenchmark.scala @@ -2,7 +2,6 @@ package com.rockymadden.stringmetric.similarity import com.google.caliper.Param import com.rockymadden.stringmetric.{CaliperBenchmark, CaliperRunner} -import scala.annotation.tailrec import scala.util.Random final class OverlapMetricBenchmark extends CaliperBenchmark { @@ -17,7 +16,7 @@ final class OverlapMetricBenchmark extends CaliperBenchmark { var charArray2: Array[Char] = _ override protected def setUp() { - @tailrec + @annotation.tailrec def random(l: Int, ps: String = null): String = if (l == 0) "" else { diff --git a/core/source/benchmark/scala/com/rockymadden/stringmetric/similarity/RatcliffObershelpMetricBenchmark.scala b/core/source/benchmark/scala/com/rockymadden/stringmetric/similarity/RatcliffObershelpMetricBenchmark.scala index edc1527..39d221c 100755 --- a/core/source/benchmark/scala/com/rockymadden/stringmetric/similarity/RatcliffObershelpMetricBenchmark.scala +++ b/core/source/benchmark/scala/com/rockymadden/stringmetric/similarity/RatcliffObershelpMetricBenchmark.scala @@ -2,7 +2,6 @@ package com.rockymadden.stringmetric.similarity import com.google.caliper.Param import com.rockymadden.stringmetric.{CaliperBenchmark, CaliperRunner} -import scala.annotation.tailrec import scala.util.Random final class RatcliffObershelpMetricBenchmark extends CaliperBenchmark { @@ -17,7 +16,7 @@ final class RatcliffObershelpMetricBenchmark extends CaliperBenchmark { var charArray2: Array[Char] = _ override protected def setUp() { - @tailrec + @annotation.tailrec def random(l: Int, ps: String = null): String = if (l == 0) "" else { diff --git a/core/source/benchmark/scala/com/rockymadden/stringmetric/similarity/WeightedLevenshteinMetricBenchmark.scala b/core/source/benchmark/scala/com/rockymadden/stringmetric/similarity/WeightedLevenshteinMetricBenchmark.scala index b511654..bde24a1 100755 --- a/core/source/benchmark/scala/com/rockymadden/stringmetric/similarity/WeightedLevenshteinMetricBenchmark.scala +++ b/core/source/benchmark/scala/com/rockymadden/stringmetric/similarity/WeightedLevenshteinMetricBenchmark.scala @@ -2,7 +2,6 @@ package com.rockymadden.stringmetric.similarity import com.google.caliper.Param import com.rockymadden.stringmetric.{CaliperBenchmark, CaliperRunner} -import scala.annotation.tailrec import scala.util.Random final class WeightedLevenshteinMetricBenchmark extends CaliperBenchmark { @@ -17,7 +16,7 @@ final class WeightedLevenshteinMetricBenchmark extends CaliperBenchmark { var charArray2: Array[Char] = _ override protected def setUp() { - @tailrec + @annotation.tailrec def random(l: Int, ps: String = null): String = if (l == 0) "" else { diff --git a/core/source/main/scala/com/rockymadden/stringmetric/phonetic/MetaphoneAlgorithm.scala b/core/source/main/scala/com/rockymadden/stringmetric/phonetic/MetaphoneAlgorithm.scala index c580fd3..655a3a5 100755 --- a/core/source/main/scala/com/rockymadden/stringmetric/phonetic/MetaphoneAlgorithm.scala +++ b/core/source/main/scala/com/rockymadden/stringmetric/phonetic/MetaphoneAlgorithm.scala @@ -2,7 +2,6 @@ package com.rockymadden.stringmetric.phonetic import com.rockymadden.stringmetric.{StringAlgorithm, StringFilter} import com.rockymadden.stringmetric.Alphabet.{Alpha, LowercaseVowel} -import scala.annotation.{switch, tailrec} /** An implementation of the Metaphone algorithm. */ class MetaphoneAlgorithm extends StringAlgorithm[DummyImplicit, String] { this: StringFilter => @@ -25,7 +24,7 @@ class MetaphoneAlgorithm extends StringAlgorithm[DummyImplicit, String] { this: if (ca.length <= 1) ca else ca.sliding(2).withFilter(a => a(0) == 'c' || a(0) != a(1)).map(a => a(0)).toArray[Char] :+ ca.last - @tailrec + @annotation.tailrec private[this] def transcode(l: Array[Char], c: Char, r: Array[Char], o: Array[Char]): Array[Char] = { if (c == '\0' && r.length == 0) o else { @@ -41,7 +40,7 @@ class MetaphoneAlgorithm extends StringAlgorithm[DummyImplicit, String] { this: } val t = { - (c: @switch) match { + (c: @annotation.switch) match { case 'a' | 'e' | 'i' | 'o' | 'u' => if (l.length == 0) shift(1, o:+ c) else shift(1, o) case 'f' | 'j' | 'l' | 'm' | 'n' | 'r' => shift(1, o :+ c) case 'b' => if (l.length >= 1 && l.last == 'm' && r.length == 0) shift(1, o) else shift(1, o :+ 'b') @@ -95,11 +94,11 @@ class MetaphoneAlgorithm extends StringAlgorithm[DummyImplicit, String] { this: } private[this] def transcodeHead(ca: Array[Char]) = { - (ca.length: @switch) match { + (ca.length: @annotation.switch) match { case 0 => ca case 1 => if (ca.head == 'x') Array('s') else ca case _ => - (ca.head: @switch) match { + (ca.head: @annotation.switch) match { case 'a' if (ca(1) == 'e') => ca.tail case 'g' | 'k' | 'p' if (ca(1) == 'n') => ca.tail case 'w' if (ca(1) == 'r') => ca.tail diff --git a/core/source/main/scala/com/rockymadden/stringmetric/phonetic/NysiisAlgorithm.scala b/core/source/main/scala/com/rockymadden/stringmetric/phonetic/NysiisAlgorithm.scala index ff0b3d6..cf16bbc 100755 --- a/core/source/main/scala/com/rockymadden/stringmetric/phonetic/NysiisAlgorithm.scala +++ b/core/source/main/scala/com/rockymadden/stringmetric/phonetic/NysiisAlgorithm.scala @@ -2,7 +2,6 @@ package com.rockymadden.stringmetric.phonetic import com.rockymadden.stringmetric.{StringAlgorithm, StringFilter} import com.rockymadden.stringmetric.Alphabet.{Alpha, LowercaseVowel} -import scala.annotation.{switch, tailrec} /** An implementation of the NYSIIS algorithm. */ class NysiisAlgorithm extends StringAlgorithm[DummyImplicit, String] { this: StringFilter => @@ -43,7 +42,7 @@ class NysiisAlgorithm extends StringAlgorithm[DummyImplicit, String] { this: Str if (ca.length <= 1) ca else ca.sliding(2).withFilter(a => a(0) != a(1)).map(a => a(0)).toArray[Char] :+ ca.last - @tailrec + @annotation.tailrec private[this] def transcodeCenter(l: Array[Char], c: Char, r: Array[Char], o: Array[Char]): Array[Char] = { if (c == '\0' && r.length == 0) o else { @@ -59,7 +58,7 @@ class NysiisAlgorithm extends StringAlgorithm[DummyImplicit, String] { this: Str } val t = { - (c: @switch) match { + (c: @annotation.switch) match { case 'a' | 'i' | 'o' | 'u' => shift(1, o :+ 'a') case 'b' | 'c' | 'd' | 'f' | 'g' | 'j' | 'l' | 'n' | 'r' | 't' | 'v' | 'x' | 'y' => shift(1, o :+ c) case 'e' => @@ -93,7 +92,7 @@ class NysiisAlgorithm extends StringAlgorithm[DummyImplicit, String] { this: Str lazy val tr2 = ca.takeRight(ca.length - 2) lazy val tr3 = ca.takeRight(ca.length - 3) - (ca.head: @switch) match { + (ca.head: @annotation.switch) match { case 'k' if (ca.length >= 2 && ca(1) == 'n') => (Array('n', 'n'), tr2) case 'k' => (Array('c'), ca.tail) case 'm' if (ca.length >= 3 && (ca(1) == 'a' && ca(2) == 'c')) => (Array('m', 'c'), tr3) @@ -110,7 +109,7 @@ class NysiisAlgorithm extends StringAlgorithm[DummyImplicit, String] { this: Str val lcm1 = ca(ca.length - 2) lazy val t2 = ca.take(ca.length - 2) - (lc: @switch) match { + (lc: @annotation.switch) match { case 'd' if (lcm1 == 'n' || lcm1 == 'r') => (t2, Array('d')) case 'e' if (lcm1 == 'e' || lcm1 == 'i') => (t2, Array('y')) case 't' if (lcm1 == 'd' || lcm1 == 'n' || lcm1 == 'r') => (t2, Array('d')) diff --git a/core/source/main/scala/com/rockymadden/stringmetric/phonetic/RefinedNysiisAlgorithm.scala b/core/source/main/scala/com/rockymadden/stringmetric/phonetic/RefinedNysiisAlgorithm.scala index 334e9e3..196681c 100755 --- a/core/source/main/scala/com/rockymadden/stringmetric/phonetic/RefinedNysiisAlgorithm.scala +++ b/core/source/main/scala/com/rockymadden/stringmetric/phonetic/RefinedNysiisAlgorithm.scala @@ -2,7 +2,6 @@ package com.rockymadden.stringmetric.phonetic import com.rockymadden.stringmetric.{StringAlgorithm, StringFilter} import com.rockymadden.stringmetric.Alphabet.{Alpha, LowercaseVowel} -import scala.annotation.{switch, tailrec} /** An implementation of the refined NYSIIS algorithm. */ class RefinedNysiisAlgorithm extends StringAlgorithm[DummyImplicit, String] { this: StringFilter => @@ -36,7 +35,7 @@ class RefinedNysiisAlgorithm extends StringAlgorithm[DummyImplicit, String] { th if (ca.length <= 1) ca else ca.sliding(2).withFilter(a => a(0) != a(1)).map(a => a(0)).toArray[Char] :+ ca.last - @tailrec + @annotation.tailrec private[this] def transcode(l: Array[Char], c: Char, r: Array[Char], o: Array[Char]): Array[Char] = { if (c == '\0' && r.length == 0) o else { @@ -52,7 +51,7 @@ class RefinedNysiisAlgorithm extends StringAlgorithm[DummyImplicit, String] { th } val t = { - (c: @switch) match { + (c: @annotation.switch) match { case 'a' | 'i' | 'o' | 'u' => if (l.length == 0) shift(1, o :+ c) else shift(1, o :+ 'a') @@ -99,7 +98,7 @@ class RefinedNysiisAlgorithm extends StringAlgorithm[DummyImplicit, String] { th private[this] def transcodeHead(ca: Array[Char]) = { if (ca.length == 0) ca else - (ca.head: @switch) match { + (ca.head: @annotation.switch) match { case 'm' if (ca.length >= 3 && ca(1) == 'a' && ca(2) == 'c') => Array('m', 'c') ++ ca.takeRight(ca.length - 3) case 'p' if (ca.length >= 2 && ca(1) == 'f') => 'f' +: ca.takeRight(ca.length - 2) case _ => ca @@ -112,7 +111,7 @@ class RefinedNysiisAlgorithm extends StringAlgorithm[DummyImplicit, String] { th val lcm1 = ca(ca.length - 2) lazy val t2 = ca.take(ca.length - 2) - (lc: @switch) match { + (lc: @annotation.switch) match { case 'd' if (lcm1 == 'n' || lcm1 == 'r') => t2 :+ 'd' case 'e' if (lcm1 == 'e' || lcm1 == 'i' || lcm1 =='y') => t2 :+ 'y' case 't' if (lcm1 == 'd' || lcm1 == 'n' || lcm1 == 'r') => t2 :+ 'd' diff --git a/core/source/main/scala/com/rockymadden/stringmetric/phonetic/RefinedSoundexAlgorithm.scala b/core/source/main/scala/com/rockymadden/stringmetric/phonetic/RefinedSoundexAlgorithm.scala index f22bde1..c1b0a6e 100755 --- a/core/source/main/scala/com/rockymadden/stringmetric/phonetic/RefinedSoundexAlgorithm.scala +++ b/core/source/main/scala/com/rockymadden/stringmetric/phonetic/RefinedSoundexAlgorithm.scala @@ -2,7 +2,6 @@ package com.rockymadden.stringmetric.phonetic import com.rockymadden.stringmetric.{StringAlgorithm, StringFilter} import com.rockymadden.stringmetric.Alphabet.Alpha -import scala.annotation.{switch, tailrec} /** An implementation of the refined Soundex algorithm. */ class RefinedSoundexAlgorithm extends StringAlgorithm[DummyImplicit, String] { this: StringFilter => @@ -16,12 +15,12 @@ class RefinedSoundexAlgorithm extends StringAlgorithm[DummyImplicit, String] { t final override def compute(string: String)(implicit di: DummyImplicit): Option[String] = compute(string.toCharArray).map(_.mkString) - @tailrec + @annotation.tailrec private[this] def transcode(i: Array[Char], o: Array[Char]): Array[Char] = { if (i.length == 0) o else { val c = i.head.toLower - val m2 = (mc: Char) => (mc: @switch) match { + val m2 = (mc: Char) => (mc: @annotation.switch) match { case 'a' | 'e' | 'h' | 'i' | 'o' | 'u' | 'w' | 'y' => '0' case 'b' | 'p' => '1' case 'f' | 'v' => '2' @@ -34,7 +33,7 @@ class RefinedSoundexAlgorithm extends StringAlgorithm[DummyImplicit, String] { t case 'r' => '9' case _ => '\0' } - val m1 = (mc: Char, pc: Char) => (mc: @switch) match { + val m1 = (mc: Char, pc: Char) => (mc: @annotation.switch) match { case 'a' | 'e' | 'h' | 'i' | 'o' | 'u' | 'w' | 'y' if pc != '0' => '0' case 'b' | 'p' if pc != '1' => '1' case 'f' | 'v' if pc != '2' => '2' @@ -53,7 +52,7 @@ class RefinedSoundexAlgorithm extends StringAlgorithm[DummyImplicit, String] { t // Code once. else m1( c, - (o.last: @switch) match { + (o.last: @annotation.switch) match { case '0' | '1' | '2' | '3' | '4' | '5' | '6' | '7' | '8' | '9' => o.last case _ => m2(o.last) } diff --git a/core/source/main/scala/com/rockymadden/stringmetric/phonetic/SoundexAlgorithm.scala b/core/source/main/scala/com/rockymadden/stringmetric/phonetic/SoundexAlgorithm.scala index 361047d..2f2bf99 100755 --- a/core/source/main/scala/com/rockymadden/stringmetric/phonetic/SoundexAlgorithm.scala +++ b/core/source/main/scala/com/rockymadden/stringmetric/phonetic/SoundexAlgorithm.scala @@ -2,7 +2,6 @@ package com.rockymadden.stringmetric.phonetic import com.rockymadden.stringmetric.{StringAlgorithm, StringFilter} import com.rockymadden.stringmetric.Alphabet.Alpha -import scala.annotation.{switch, tailrec} /** An implementation of the Soundex algorithm. */ class SoundexAlgorithm extends StringAlgorithm[DummyImplicit, String] { this: StringFilter => @@ -20,12 +19,12 @@ class SoundexAlgorithm extends StringAlgorithm[DummyImplicit, String] { this: St final override def compute(string: String)(implicit di: DummyImplicit): Option[String] = compute(string.toCharArray).map(_.mkString) - @tailrec + @annotation.tailrec private[this] def transcode(i: Array[Char], pc: Char, o: Array[Char]): Array[Char] = { if (i.length == 0) o else { val c = i.head.toLower - val m2 = (mc: Char) => (mc: @switch) match { + val m2 = (mc: Char) => (mc: @annotation.switch) match { case 'b' | 'f' | 'p' | 'v' => '1' case 'c' | 'g' | 'j' | 'k' | 'q' | 's' | 'x' | 'z' => '2' case 'd' | 't' => '3' @@ -34,7 +33,7 @@ class SoundexAlgorithm extends StringAlgorithm[DummyImplicit, String] { this: St case 'r' => '6' case _ => '\0' } - val m1 = (mc: Char, pc: Char) => (mc: @switch) match { + val m1 = (mc: Char, pc: Char) => (mc: @annotation.switch) match { case 'b' | 'f' | 'p' | 'v' if pc != '1' => '1' case 'c' | 'g' | 'j' | 'k' | 'q' | 's' | 'x' | 'z' if pc != '2' => '2' case 'd' | 't' if pc != '3' => '3' @@ -49,7 +48,7 @@ class SoundexAlgorithm extends StringAlgorithm[DummyImplicit, String] { this: St // Code once. case _ => m1( c, - (o.last: @switch) match { + (o.last: @annotation.switch) match { case '1' | '2' | '3' | '4' | '5' | '6' => o.last case _ => m2(o.last) } diff --git a/core/source/main/scala/com/rockymadden/stringmetric/tokenization/NGramTokenizer.scala b/core/source/main/scala/com/rockymadden/stringmetric/tokenization/NGramTokenizer.scala index d66fd62..d858a59 100755 --- a/core/source/main/scala/com/rockymadden/stringmetric/tokenization/NGramTokenizer.scala +++ b/core/source/main/scala/com/rockymadden/stringmetric/tokenization/NGramTokenizer.scala @@ -1,7 +1,6 @@ package com.rockymadden.stringmetric.tokenization import com.rockymadden.stringmetric.{StringFilter, StringTokenizer} -import scala.annotation.tailrec /** An implementation of the N-Gram tokenizer. */ class NGramTokenizer extends StringTokenizer[Int, Array[String]] { this: StringFilter => @@ -17,7 +16,7 @@ class NGramTokenizer extends StringTokenizer[Int, Array[String]] { this: StringF final override def tokenize(string: String)(implicit n: Int): Option[Array[String]] = tokenize(string.toCharArray)(n).map(_.map(_.mkString)) - @tailrec + @annotation.tailrec private[this] def sequence(i: Array[Char], o: Array[Array[Char]], n: Int): Array[Array[Char]] = { require(n > 0) |