fuzzy_match 1.3.1 → 1.3.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/Gemfile +12 -2
- data/History.txt +13 -0
- data/README.markdown +10 -6
- data/benchmark/before-with-free.txt +21 -21
- data/benchmark/before.txt +21 -21
- data/benchmark/memory.rb +6 -6
- data/examples/bts_aircraft/{blockings.csv → groupings.csv} +0 -0
- data/examples/bts_aircraft/test_bts_aircraft.rb +6 -6
- data/fuzzy_match.gemspec +1 -10
- data/lib/fuzzy_match.rb +41 -33
- data/lib/fuzzy_match/result.rb +1 -1
- data/lib/fuzzy_match/rule.rb +14 -0
- data/lib/fuzzy_match/rule/grouping.rb +32 -0
- data/lib/fuzzy_match/rule/identity.rb +19 -0
- data/lib/fuzzy_match/rule/normalizer.rb +20 -0
- data/lib/fuzzy_match/rule/stop_word.rb +11 -0
- data/lib/fuzzy_match/version.rb +1 -1
- data/test/helper.rb +3 -1
- data/test/test_fuzzy_match.rb +188 -124
- data/test/test_fuzzy_match_convoluted.rb.disabled +12 -12
- data/test/{test_blocking.rb → test_grouping.rb} +6 -6
- data/test/test_identity.rb +8 -8
- data/test/test_normalizer.rb +2 -2
- data/test/test_wrapper.rb +1 -1
- metadata +15 -101
- data/lib/fuzzy_match/blocking.rb +0 -36
- data/lib/fuzzy_match/identity.rb +0 -23
- data/lib/fuzzy_match/normalizer.rb +0 -28
- data/lib/fuzzy_match/stop_word.rb +0 -19
@@ -1,19 +0,0 @@
|
|
1
|
-
class FuzzyMatch
|
2
|
-
# A stop word is ignored
|
3
|
-
class StopWord
|
4
|
-
attr_reader :regexp
|
5
|
-
|
6
|
-
def initialize(regexp_or_str)
|
7
|
-
@regexp = regexp_or_str.to_regexp
|
8
|
-
end
|
9
|
-
|
10
|
-
# Destructively remove stop words from the string
|
11
|
-
def apply!(str)
|
12
|
-
str.gsub! regexp, ''
|
13
|
-
end
|
14
|
-
|
15
|
-
def inspect
|
16
|
-
"#<FuzzyMatch::StopWord regexp=#{regexp.inspect}>"
|
17
|
-
end
|
18
|
-
end
|
19
|
-
end
|