google-local-results-ai-parser 0.1.6 → 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: b1d9420283a21ee83c026e452292a42ded13528261d395e8cadc4d8aa2cc1e6f
4
- data.tar.gz: b1a7ed2399121ab91dfb219af73b245ebc0a0a0ca6e6e3b75de27541c4224572
3
+ metadata.gz: 290163a767ae91b4c7b8d45087ad40e1e72dc36581b1565a7360fb059674ba11
4
+ data.tar.gz: af915102b08661235115e5c08287ec424690f9a245454130ca64e4ecd489407c
5
5
  SHA512:
6
- metadata.gz: 1b7dbed7555e7a80c9191b404766a2b5ed758b49a0cb3f867eab3f608b611155c3f6203c483428e2d616adf76b634446393d248fe2b78970ae1d3196751f9f55
7
- data.tar.gz: 9f5528a15881f0798de4d62084ec263debed89d6a42b8b95481e371daba9fc82171af5c2c4bfa15aa0abacaec953d25b1db1251e4bcc2386df6992f5da1a3309
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
@@ -441,7 +453,7 @@ module GoogleLocalResultsAiParser
441
453
  # On-site services, Online appointments
442
454
  # Fixes `On-site services`, `Online appointments`
443
455
  def service_options_as_description_or_type_confusion(results, label_order, duplicates)
444
- known_errors = ["On-site services", "On-site services not available", "Online appointments", "Online appointments not available"]
456
+ known_errors = ["On-site services", "On-site services not available", "Onsite services", "Onsite services not available", "Online appointments", "Online appointments not available"]
445
457
  caught_results_indices = results.map.with_index {|result, index| index if known_errors.include?(result[:input])}.compact
446
458
  return results, label_order, duplicates if caught_results_indices == []
447
459
 
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.6
4
+ version: 0.1.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Emirhan Akdeniz