simstring_pure 1.1.1 → 1.1.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +5 -5
  2. data/lib/simstring_pure.rb +9 -11
  3. metadata +3 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 9733d2ee56f3c95d1fc3a483c5fc0791a40f221f
4
- data.tar.gz: 53e69ca93dae86a227954107a3baca9eddcd0f65
2
+ SHA256:
3
+ metadata.gz: 2d00d36acf8dd657c51fb32206ea5fade63107b8dd7ef6f45bcdab3eccbea0fd
4
+ data.tar.gz: 2e886005eea40d08f4de401bf68ff588b5b572aff79252f4df8139e68d949f19
5
5
  SHA512:
6
- metadata.gz: 6f90d0c66fc502d749c67e5f12a7241599dd5646337cf664097237762db5773a19540375a200bb110b13ad2977beb486b88171bda3eef7577a77e28f6fd4be14
7
- data.tar.gz: 50490e3405a21a81d12a17c82f639ae1152939035f7e6acd60083e72aef9f42cc7769d600525de5373656e90758a0a0a54dce0b9adbac116694f1086e572d332
6
+ metadata.gz: 031a8ba57c72e58c4a7c3857cb5becb3bf397b5649966cd5bbe82f7bb6dc793a4ef0021823f89e311c44255f51a0a298557bd596ffa0c9f6a84539ab82d64bea
7
+ data.tar.gz: 92a447d97c318e659dca1dc63cb63e42346471dd1234fe02eabd03cf4a8bc0ab3b67c9e9c2f931b6a65cbfc49d6c883019175f74a260865d26b4b7c2900b52f9
@@ -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 @feature_to_string_map
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
- @feature_to_string_map[feature] ||= Set.new
203
- @feature_to_string_map[feature] << string
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 lookup_strings_by_feature_set_size(size)
218
- @feature_set_size_to_string_map[size] || Set.new
219
- end
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.lookup_strings_by_feature_set_size(y_size) & db.lookup_strings_by_feature(feature)
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.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: 2016-03-17 00:00:00.000000000 Z
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.5.1
42
+ rubygems_version: 2.7.6
43
43
  signing_key:
44
44
  specification_version: 4
45
45
  summary: SimString approximate string matching library.