diff options
author | Rocky Madden <git@rockymadden.com> | 2013-01-31 20:26:47 -0700 |
---|---|---|
committer | Rocky Madden <git@rockymadden.com> | 2013-01-31 20:26:47 -0700 |
commit | 5e6ea313f56a26190831127018336c54e6500443 (patch) | |
tree | 5014aaf7e35d7783450f601b92102eab33cbc1f2 | |
parent | 4595a17f47521dd40ce0f791f1692216c729ae10 (diff) | |
download | stringmetric-5e6ea313f56a26190831127018336c54e6500443.tar.gz stringmetric-5e6ea313f56a26190831127018336c54e6500443.tar.bz2 stringmetric-5e6ea313f56a26190831127018336c54e6500443.zip |
Added syntactic sugar and updated scaladoc.
19 files changed, 46 insertions, 53 deletions
diff --git a/core/source/core/scala/com/rockymadden/stringmetric/Algorithm.scala b/core/source/core/scala/com/rockymadden/stringmetric/Algorithm.scala index 21524cc..bc26fd1 100755 --- a/core/source/core/scala/com/rockymadden/stringmetric/Algorithm.scala +++ b/core/source/core/scala/com/rockymadden/stringmetric/Algorithm.scala @@ -1,6 +1,6 @@ package com.rockymadden.stringmetric -/** Marks those which leverage traits of a standalone algorithm. */ +/** Trait for all algorithms. */ trait Algorithm[T] { type ComputeReturn <: AnyRef -}
\ No newline at end of file +} diff --git a/core/source/core/scala/com/rockymadden/stringmetric/Filter.scala b/core/source/core/scala/com/rockymadden/stringmetric/Filter.scala index 8316d76..e623db1 100755 --- a/core/source/core/scala/com/rockymadden/stringmetric/Filter.scala +++ b/core/source/core/scala/com/rockymadden/stringmetric/Filter.scala @@ -1,6 +1,6 @@ package com.rockymadden.stringmetric -/** Marks those which leverage traits of a filter. */ +/** Trait for all filters. */ trait Filter[T] { def filter(t: T): T -}
\ No newline at end of file +} diff --git a/core/source/core/scala/com/rockymadden/stringmetric/FilterableAlgorithm.scala b/core/source/core/scala/com/rockymadden/stringmetric/FilterableAlgorithm.scala index d1265bc..d862090 100755 --- a/core/source/core/scala/com/rockymadden/stringmetric/FilterableAlgorithm.scala +++ b/core/source/core/scala/com/rockymadden/stringmetric/FilterableAlgorithm.scala @@ -1,6 +1,6 @@ package com.rockymadden.stringmetric -/** Marks those which leverage traits of a filterable [[com.rockymadden.stringmetric.Algorithm]]. */ +/** Trait for all filterable [[com.rockymadden.stringmetric.Algorithm]]. */ trait FilterableAlgorithm[T, F <: Filter[T]] extends Algorithm[T] { def compute(t: T)(implicit f: F): Option[ComputeReturn] -}
\ No newline at end of file +} diff --git a/core/source/core/scala/com/rockymadden/stringmetric/FilterableConfigurableAlgorithm.scala b/core/source/core/scala/com/rockymadden/stringmetric/FilterableConfigurableAlgorithm.scala index f8ed18e..cdd0814 100755 --- a/core/source/core/scala/com/rockymadden/stringmetric/FilterableConfigurableAlgorithm.scala +++ b/core/source/core/scala/com/rockymadden/stringmetric/FilterableConfigurableAlgorithm.scala @@ -1,6 +1,6 @@ package com.rockymadden.stringmetric -/** Marks those which leverage traits of a filterable and configurable [[com.rockymadden.stringmetric.Algorithm]]. */ +/** Trait for all filterable and configurable [[com.rockymadden.stringmetric.Algorithm]]. */ trait FilterableConfigurableAlgorithm[T, O, F <: Filter[T]] extends Algorithm[T] { def compute(t: T)(o: O)(implicit f: F): Option[ComputeReturn] -}
\ No newline at end of file +} diff --git a/core/source/core/scala/com/rockymadden/stringmetric/FilterableConfigurableMetric.scala b/core/source/core/scala/com/rockymadden/stringmetric/FilterableConfigurableMetric.scala index f49c705..914ac46 100755 --- a/core/source/core/scala/com/rockymadden/stringmetric/FilterableConfigurableMetric.scala +++ b/core/source/core/scala/com/rockymadden/stringmetric/FilterableConfigurableMetric.scala @@ -1,6 +1,6 @@ package com.rockymadden.stringmetric -/** Marks those which leverage traits of a filterable and configurable [[com.rockymadden.stringmetric.Metric]]. */ +/** Trait for all filterable and configurable [[com.rockymadden.stringmetric.Metric]]. */ trait FilterableConfigurableMetric[T, O, F <: Filter[T]] extends Metric[T] { def compare(t1: T, t2: T)(o: O)(implicit f: F): Option[CompareReturn] -}
\ No newline at end of file +} diff --git a/core/source/core/scala/com/rockymadden/stringmetric/FilterableConfigurableStringAlgorithm.scala b/core/source/core/scala/com/rockymadden/stringmetric/FilterableConfigurableStringAlgorithm.scala index 091e904..70d109a 100755 --- a/core/source/core/scala/com/rockymadden/stringmetric/FilterableConfigurableStringAlgorithm.scala +++ b/core/source/core/scala/com/rockymadden/stringmetric/FilterableConfigurableStringAlgorithm.scala @@ -1,8 +1,6 @@ package com.rockymadden.stringmetric -/** - * Marks those which leverage traits of a string based [[com.rockymadden.stringmetric.FilterableConfigurableAlgorithm]]. - */ +/** Trait for all string based [[com.rockymadden.stringmetric.FilterableConfigurableAlgorithm]]. */ trait FilterableConfigurableStringAlgorithm[O] extends FilterableConfigurableAlgorithm[String, O, StringFilter] with StringAlgorithm { diff --git a/core/source/core/scala/com/rockymadden/stringmetric/FilterableConfigurableStringMetric.scala b/core/source/core/scala/com/rockymadden/stringmetric/FilterableConfigurableStringMetric.scala index fb92bdb..3aaea58 100755 --- a/core/source/core/scala/com/rockymadden/stringmetric/FilterableConfigurableStringMetric.scala +++ b/core/source/core/scala/com/rockymadden/stringmetric/FilterableConfigurableStringMetric.scala @@ -1,10 +1,9 @@ package com.rockymadden.stringmetric -/** - * Marks those which leverage traits of a string based [[com.rockymadden.stringmetric.FilterableConfigurableMetric]]. - */ +/** Trait for all string based [[com.rockymadden.stringmetric.FilterableConfigurableMetric]]. */ trait FilterableConfigurableStringMetric[O] extends FilterableConfigurableMetric[String, O, StringFilter] with StringMetric { - def compare(charArray1: Array[Char], charArray2: Array[Char])(o: O)(implicit stringFilter: StringFilter): Option[CompareReturn] + def compare(charArray1: Array[Char], charArray2: Array[Char])(o: O) + (implicit stringFilter: StringFilter): Option[CompareReturn] } diff --git a/core/source/core/scala/com/rockymadden/stringmetric/FilterableMetric.scala b/core/source/core/scala/com/rockymadden/stringmetric/FilterableMetric.scala index b59bffe..2e43859 100755 --- a/core/source/core/scala/com/rockymadden/stringmetric/FilterableMetric.scala +++ b/core/source/core/scala/com/rockymadden/stringmetric/FilterableMetric.scala @@ -1,6 +1,6 @@ package com.rockymadden.stringmetric -/** Marks those which leverage traits of a filterable [[com.rockymadden.stringmetric.Metric]]. */ +/** Trait for all filterable [[com.rockymadden.stringmetric.Metric]]. */ trait FilterableMetric[T, F <: Filter[T]] extends Metric[T] { def compare(t1: T, t2: T)(implicit f: F): Option[CompareReturn] -}
\ No newline at end of file +} diff --git a/core/source/core/scala/com/rockymadden/stringmetric/FilterableStringAlgorithm.scala b/core/source/core/scala/com/rockymadden/stringmetric/FilterableStringAlgorithm.scala index 3888d24..f6aef84 100755 --- a/core/source/core/scala/com/rockymadden/stringmetric/FilterableStringAlgorithm.scala +++ b/core/source/core/scala/com/rockymadden/stringmetric/FilterableStringAlgorithm.scala @@ -1,6 +1,6 @@ package com.rockymadden.stringmetric -/** Marks those which leverage traits of a string based [[com.rockymadden.stringmetric.FilterableAlgorithm]]. */ +/** Trait for all string based [[com.rockymadden.stringmetric.FilterableAlgorithm]]. */ trait FilterableStringAlgorithm extends FilterableAlgorithm[String, StringFilter] with StringAlgorithm { def compute(charArray: Array[Char])(implicit stringFilter: StringFilter): Option[Array[_]] -}
\ No newline at end of file +} diff --git a/core/source/core/scala/com/rockymadden/stringmetric/FilterableStringMetric.scala b/core/source/core/scala/com/rockymadden/stringmetric/FilterableStringMetric.scala index b00d954..5c5fd07 100755 --- a/core/source/core/scala/com/rockymadden/stringmetric/FilterableStringMetric.scala +++ b/core/source/core/scala/com/rockymadden/stringmetric/FilterableStringMetric.scala @@ -1,7 +1,7 @@ package com.rockymadden.stringmetric -/** Marks those which leverage traits of a string based [[com.rockymadden.stringmetric.FilterableMetric]]. */ +/** Trait for all string based [[com.rockymadden.stringmetric.FilterableMetric]]. */ trait FilterableStringMetric extends FilterableMetric[String, StringFilter] with StringMetric { def compare(charArray1: Array[Char], charArray2: Array[Char]) (implicit stringFilter: StringFilter): Option[CompareReturn] -}
\ No newline at end of file +} diff --git a/core/source/core/scala/com/rockymadden/stringmetric/Metric.scala b/core/source/core/scala/com/rockymadden/stringmetric/Metric.scala index 2595499..8ea8116 100755 --- a/core/source/core/scala/com/rockymadden/stringmetric/Metric.scala +++ b/core/source/core/scala/com/rockymadden/stringmetric/Metric.scala @@ -1,6 +1,6 @@ package com.rockymadden.stringmetric -/** Marks those which leverage traits of a metric. */ +/** Trait for all metrics. */ trait Metric[T] { type CompareReturn <: AnyVal -}
\ No newline at end of file +} diff --git a/core/source/core/scala/com/rockymadden/stringmetric/StringAlgorithm.scala b/core/source/core/scala/com/rockymadden/stringmetric/StringAlgorithm.scala index 4b38831..12ac074 100755 --- a/core/source/core/scala/com/rockymadden/stringmetric/StringAlgorithm.scala +++ b/core/source/core/scala/com/rockymadden/stringmetric/StringAlgorithm.scala @@ -3,12 +3,10 @@ package com.rockymadden.stringmetric import com.rockymadden.stringmetric.phonetic.{ MetaphoneAlgorithm, NysiisAlgorithm, RefinedSoundexAlgorithm, SoundexAlgorithm } import com.rockymadden.stringmetric.similarity.NGramAlgorithm -/** Marks those which leverage traits of a string based [[com.rockymadden.stringmetric.Algorithm]]. */ -trait StringAlgorithm extends Algorithm[String] { +/** Trait for all string based [[com.rockymadden.stringmetric.Algorithm]]. */ +trait StringAlgorithm extends Algorithm[String] -} - -/** Convenience object for those extending [[com.rockymadden.stringmetric.StringAlgorithm]]. */ +/** Standalone convenience object for all extending [[com.rockymadden.stringmetric.StringAlgorithm]]. */ object StringAlgorithm { def computeWithMetaphone(charArray: Array[Char]) (implicit stringFilter: StringFilter): Option[Array[Char]] = @@ -69,4 +67,4 @@ object StringAlgorithm { def refinedSoundex: RefinedSoundexAlgorithm.type = RefinedSoundexAlgorithm def soundex: SoundexAlgorithm.type = SoundexAlgorithm -}
\ No newline at end of file +} diff --git a/core/source/core/scala/com/rockymadden/stringmetric/StringFilter.scala b/core/source/core/scala/com/rockymadden/stringmetric/StringFilter.scala index b00e665..f6081a5 100755 --- a/core/source/core/scala/com/rockymadden/stringmetric/StringFilter.scala +++ b/core/source/core/scala/com/rockymadden/stringmetric/StringFilter.scala @@ -2,12 +2,12 @@ package com.rockymadden.stringmetric import com.rockymadden.stringmetric.filter._ -/** Marks those which leverage traits of a string based [[com.rockymadden.stringmetric.Filter]]. */ +/** Trait for all string based [[com.rockymadden.stringmetric.Filter]]. */ trait StringFilter extends Filter[String] { def filter(charArray: Array[Char]): Array[Char] } -/** Convenience object for those extending [[com.rockymadden.stringmetric.StringFilter]]. */ +/** Standalone convenience object for all extending [[com.rockymadden.stringmetric.StringFilter]]. */ object StringFilter { implicit val stringFilter = delegate @@ -36,4 +36,4 @@ object StringFilter { def asciiSymbolOnly = new StringFilterDelegate with AsciiSymbolOnlyStringFilter def delegate = new StringFilterDelegate -}
\ No newline at end of file +} diff --git a/core/source/core/scala/com/rockymadden/stringmetric/StringMetric.scala b/core/source/core/scala/com/rockymadden/stringmetric/StringMetric.scala index bbe68d1..babcd46 100755 --- a/core/source/core/scala/com/rockymadden/stringmetric/StringMetric.scala +++ b/core/source/core/scala/com/rockymadden/stringmetric/StringMetric.scala @@ -3,12 +3,10 @@ package com.rockymadden.stringmetric import com.rockymadden.stringmetric.phonetic.{ MetaphoneMetric, NysiisMetric, RefinedSoundexMetric, SoundexMetric } import com.rockymadden.stringmetric.similarity._ -/** Marks those which leverage traits of a string based [[com.rockymadden.stringmetric.Metric]]. */ -trait StringMetric extends Metric[String] { +/** Trait for all string based [[com.rockymadden.stringmetric.Metric]]. */ +trait StringMetric extends Metric[String] -} - -/** Convenience object for those extending [[com.rockymadden.stringmetric.StringMetric]]. */ +/** Stabdalone convenience object for all extending [[com.rockymadden.stringmetric.StringMetric]]. */ object StringMetric { def compareWithDiceSorensen(charArray1: Array[Char], charArray2: Array[Char])(n: Int) (implicit stringFilter: StringFilter): Option[DiceSorensenMetric.CompareReturn] = @@ -143,4 +141,4 @@ object StringMetric { def soundex: SoundexMetric.type = SoundexMetric def weightedLevenshtein: WeightedLevenshteinMetric.type = WeightedLevenshteinMetric -}
\ No newline at end of file +} diff --git a/core/source/core/scala/com/rockymadden/stringmetric/filter/package.scala b/core/source/core/scala/com/rockymadden/stringmetric/filter/package.scala index e74b7e5..ca003eb 100755 --- a/core/source/core/scala/com/rockymadden/stringmetric/filter/package.scala +++ b/core/source/core/scala/com/rockymadden/stringmetric/filter/package.scala @@ -1,6 +1,6 @@ package com.rockymadden.stringmetric -/** Provides core filter functionality. */ +/** Provides filter functionality. */ package object filter { -}
\ No newline at end of file +} diff --git a/core/source/core/scala/com/rockymadden/stringmetric/package.scala b/core/source/core/scala/com/rockymadden/stringmetric/package.scala index 916f5bb..01c1eb1 100755 --- a/core/source/core/scala/com/rockymadden/stringmetric/package.scala +++ b/core/source/core/scala/com/rockymadden/stringmetric/package.scala @@ -1,8 +1,8 @@ package com.rockymadden -/** Provides core string metric functionality. */ +/** Provides traits and standalone convenience objects. */ package object stringmetric { - type CompareTuple[T] = Tuple2[Array[T], Array[T]] + type CompareTuple[T] = (Array[T], Array[T]) - type MatchTuple[T] = Tuple2[Array[T], Array[T]] -}
\ No newline at end of file + type MatchTuple[T] = (Array[T], Array[T]) +} diff --git a/core/source/core/scala/com/rockymadden/stringmetric/phonetic/package.scala b/core/source/core/scala/com/rockymadden/stringmetric/phonetic/package.scala index 4739cd8..1a538a6 100755 --- a/core/source/core/scala/com/rockymadden/stringmetric/phonetic/package.scala +++ b/core/source/core/scala/com/rockymadden/stringmetric/phonetic/package.scala @@ -1,6 +1,6 @@ package com.rockymadden.stringmetric -/** Provides core phonetic string metric functionality. */ +/** Provides phonetic algorithm and metric functionality. */ package object phonetic { -}
\ No newline at end of file +} 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 aeb82b9..b833330 100755 --- a/core/source/core/scala/com/rockymadden/stringmetric/similarity/WeightedLevenshteinMetric.scala +++ b/core/source/core/scala/com/rockymadden/stringmetric/similarity/WeightedLevenshteinMetric.scala @@ -5,10 +5,10 @@ import scala.math.BigDecimal /** An implementation of a weighted Levenshtein [[com.rockymadden.stringmetric.StringMetric]]. */ object WeightedLevenshteinMetric - extends StringMetric with FilterableConfigurableStringMetric[Tuple3[BigDecimal, BigDecimal, BigDecimal]] { + extends StringMetric with FilterableConfigurableStringMetric[(BigDecimal, BigDecimal, BigDecimal)] { type CompareReturn = Double - type Options = Tuple3[BigDecimal, BigDecimal, BigDecimal] + type Options = (BigDecimal, BigDecimal, BigDecimal) /** Options order is delete, insert, then substitute weight. */ override def compare(charArray1: Array[Char], charArray2: Array[Char])(options: Options) @@ -53,4 +53,4 @@ object WeightedLevenshteinMetric m(ct._1.length)(ct._2.length) } -}
\ No newline at end of file +} diff --git a/core/source/core/scala/com/rockymadden/stringmetric/similarity/package.scala b/core/source/core/scala/com/rockymadden/stringmetric/similarity/package.scala index e15b732..49a73da 100755 --- a/core/source/core/scala/com/rockymadden/stringmetric/similarity/package.scala +++ b/core/source/core/scala/com/rockymadden/stringmetric/similarity/package.scala @@ -1,6 +1,6 @@ package com.rockymadden.stringmetric -/** Provides core similarity string metric functionality. */ +/** Provides similarity algorithm and metric functionality. */ package object similarity { -}
\ No newline at end of file +} |