google-local-results-ai-parser 0.1.7 → 0.1.8

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a0046662dab725d061630a6391db2450e0306e0bccdf44a8a28681014dd0739b
4
- data.tar.gz: 24b20b65d3eeef9f4d40fd227306a48428312e7e4af8fc9e366cab584e828bc9
3
+ metadata.gz: 290163a767ae91b4c7b8d45087ad40e1e72dc36581b1565a7360fb059674ba11
4
+ data.tar.gz: af915102b08661235115e5c08287ec424690f9a245454130ca64e4ecd489407c
5
5
  SHA512:
6
- metadata.gz: 2ad1fc7d80ddc04a8a46337ba3ca681a2cf4630b743807b78774be7f0d83266018fd1cd283123cc3ef52e5b7fb92722db0881f6fbf89fe1ee060964d3b74a827
7
- data.tar.gz: cba8c079367c3a5d52c1b27c26ca524774ef04aa5643a08876b26b5cd05d01b8e4fede63a32b4ededc26e317235335827d1421a68f6a57dece45d4d8bc0a859c
6
+ metadata.gz: 9089889919afccd9d07bf823be8343d01dcff7ec6e04d86b7ccfebae28c47348eaed1a00304a9df58bb7b85ca8e2e1dd3d750cf020d2a18a6a892872b720069e
7
+ data.tar.gz: c105bfd73e7491ab02f1fe343ba1d54307f035455b4e28a46156505a9e578b1c26b53af31e4e465b8ec2624e08d758647726289e4a8fe4cfd8e653c34cebaa0b
@@ -90,14 +90,14 @@ module GoogleLocalResultsAiParser
90
90
  duplicates = find_duplicates(label_order)
91
91
 
92
92
  # Known clashes
93
+ results, label_order, duplicates = button_text_as_hours_confusion(results, label_order, duplicates)
94
+ results, label_order, duplicates = button_text_as_address_confusion(results, label_order, duplicates)
95
+ results, label_order, duplicates = button_text_as_service_options_confusion(results, label_order, duplicates)
93
96
  results, label_order, duplicates = service_options_as_type_confusion(results, label_order, duplicates)
94
97
  results, label_order, duplicates = description_as_hours_confusion(results, label_order, duplicates)
95
98
  results, label_order, duplicates = description_as_type_confusion(results, label_order, duplicates)
96
99
  results, label_order, duplicates = reviews_as_rating_confusion(results, label_order, duplicates)
97
100
  results, label_order, duplicates = reviews_as_price_confusion(results, label_order, duplicates)
98
- results, label_order, duplicates = button_text_as_hours_confusion(results, label_order, duplicates)
99
- results, label_order, duplicates = button_text_as_address_confusion(results, label_order, duplicates)
100
- results, label_order, duplicates = button_text_as_service_options_confusion(results, label_order, duplicates)
101
101
  results, label_order, duplicates = service_options_as_description_or_type_confusion(results, label_order, duplicates)
102
102
 
103
103
  # General clashes
@@ -227,18 +227,30 @@ module GoogleLocalResultsAiParser
227
227
  end
228
228
  end
229
229
 
230
- # Delete the known button text directly
231
- results.delete_at(hours_duplicate[-1])
232
-
233
- # Rearranging `label_order`
234
- label_order.delete_at(hours_duplicate[-1])
235
-
236
- # Rearranging duplicates
237
- last_item = duplicates[duplicates.index(hours_duplicate)][-1]
238
- duplicates[duplicates.index(hours_duplicate)].delete(last_item)
230
+ if hours_duplicate
231
+ # Delete the known button text directly
232
+ results.delete_at(hours_duplicate[-1])
233
+
234
+ # Rearranging `label_order`
235
+ label_order.delete_at(hours_duplicate[-1])
236
+
237
+ # Rearranging duplicates
238
+ last_item = duplicates[duplicates.index(hours_duplicate)][-1]
239
+ duplicates[duplicates.index(hours_duplicate)].delete(last_item)
239
240
 
240
- if (duplicate_arr = duplicates[duplicates.index(hours_duplicate)]) && duplicate_arr.size == 1
241
- duplicates.delete(duplicate_arr)
241
+ if (duplicate_arr = duplicates[duplicates.index(hours_duplicate)]) && duplicate_arr.size == 1
242
+ duplicates.delete(duplicate_arr)
243
+ end
244
+ else
245
+ known_error_indices = results.map.with_index {|result, result_index| result_index if known_errors.include?(result[:input])}.compact
246
+
247
+ known_error_indices.each do |index|
248
+ # Delete the known button text directly
249
+ results.delete_at(index)
250
+
251
+ # Rearranging `label_order`
252
+ label_order.delete_at(index)
253
+ end
242
254
  end
243
255
 
244
256
  return results, label_order, duplicates
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: google-local-results-ai-parser
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.7
4
+ version: 0.1.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Emirhan Akdeniz