simstring_pure 1.1.1 → 1.1.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.
- checksums.yaml +5 -5
- data/lib/simstring_pure.rb +9 -11
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 2d00d36acf8dd657c51fb32206ea5fade63107b8dd7ef6f45bcdab3eccbea0fd
|
4
|
+
data.tar.gz: 2e886005eea40d08f4de401bf68ff588b5b572aff79252f4df8139e68d949f19
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 031a8ba57c72e58c4a7c3857cb5becb3bf397b5649966cd5bbe82f7bb6dc793a4ef0021823f89e311c44255f51a0a298557bd596ffa0c9f6a84539ab82d64bea
|
7
|
+
data.tar.gz: 92a447d97c318e659dca1dc63cb63e42346471dd1234fe02eabd03cf4a8bc0ab3b67c9e9c2f931b6a65cbfc49d6c883019175f74a260865d26b4b7c2900b52f9
|
data/lib/simstring_pure.rb
CHANGED
@@ -182,8 +182,8 @@ module SimString
|
|
182
182
|
def initialize(feature_extractor)
|
183
183
|
@strings = Set.new
|
184
184
|
@feature_extractor = feature_extractor
|
185
|
-
@feature_to_string_map = {}
|
186
185
|
@feature_set_size_to_string_map = {}
|
186
|
+
@feature_set_size_and_feature_to_string_map = {}
|
187
187
|
end
|
188
188
|
|
189
189
|
def add(string)
|
@@ -197,10 +197,11 @@ module SimString
|
|
197
197
|
@feature_set_size_to_string_map[feature_set_size] ||= Set.new
|
198
198
|
@feature_set_size_to_string_map[feature_set_size] << string
|
199
199
|
|
200
|
-
# update @
|
200
|
+
# update @feature_set_size_and_feature_to_string_map
|
201
|
+
@feature_set_size_and_feature_to_string_map[feature_set_size] ||= {}
|
201
202
|
features.each do |feature|
|
202
|
-
@
|
203
|
-
@
|
203
|
+
@feature_set_size_and_feature_to_string_map[feature_set_size][feature] ||= Set.new
|
204
|
+
@feature_set_size_and_feature_to_string_map[feature_set_size][feature] << string
|
204
205
|
end
|
205
206
|
end
|
206
207
|
nil
|
@@ -214,12 +215,9 @@ module SimString
|
|
214
215
|
@feature_set_size_to_string_map.keys.max
|
215
216
|
end
|
216
217
|
|
217
|
-
def
|
218
|
-
@
|
219
|
-
|
220
|
-
|
221
|
-
def lookup_strings_by_feature(feature)
|
222
|
-
@feature_to_string_map[feature] || Set.new
|
218
|
+
def lookup_strings_by_feature_set_size_and_feature(size, feature)
|
219
|
+
return Set.new if @feature_set_size_and_feature_to_string_map[size].nil?
|
220
|
+
@feature_set_size_and_feature_to_string_map[size][feature] || Set.new
|
223
221
|
end
|
224
222
|
|
225
223
|
def save(file_path)
|
@@ -310,7 +308,7 @@ module SimString
|
|
310
308
|
# 1. the string has a feature set size equal to <y_size>
|
311
309
|
# 2. the string's feature set contains the feature <feature>
|
312
310
|
def get(db, y_size, feature)
|
313
|
-
db.
|
311
|
+
db.lookup_strings_by_feature_set_size_and_feature(y_size, feature)
|
314
312
|
end
|
315
313
|
end
|
316
314
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: simstring_pure
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- David Ellis
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2018-07-03 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: A Ruby implementation of the SimString approximate string matching algorithm.
|
14
14
|
email: davidkellis@gmail.com
|
@@ -39,7 +39,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
39
39
|
version: '0'
|
40
40
|
requirements: []
|
41
41
|
rubyforge_project:
|
42
|
-
rubygems_version: 2.
|
42
|
+
rubygems_version: 2.7.6
|
43
43
|
signing_key:
|
44
44
|
specification_version: 4
|
45
45
|
summary: SimString approximate string matching library.
|