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

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: cca82d65c271c431ecff087ba09a5c85180097441df64b99b55fd017c03314ef
4
+ data.tar.gz: c746ea73236cd49e6a983b03e8719a1eeb075607a8d4d08c2c6b1c3b99a0eb0d
5
5
  SHA512:
6
- metadata.gz: 2ad1fc7d80ddc04a8a46337ba3ca681a2cf4630b743807b78774be7f0d83266018fd1cd283123cc3ef52e5b7fb92722db0881f6fbf89fe1ee060964d3b74a827
7
- data.tar.gz: cba8c079367c3a5d52c1b27c26ca524774ef04aa5643a08876b26b5cd05d01b8e4fede63a32b4ededc26e317235335827d1421a68f6a57dece45d4d8bc0a859c
6
+ metadata.gz: 56cd8f0b6f19673a0fa87ed7007fe844d80b906ce2500ec5207872dfc5d5fecd4a8e27c3e504e46f7bab8d2f3bf369e3ae409e8df2a0bcf3aae9764df4a1611f
7
+ data.tar.gz: '06988a8a22f7ea42dd840d117a9798fd4c808cc0b7327acb08772417db94c122b759196a126264cad9484bbfc53efab77635ded7ce1bb1c36908531a2c72cfe6'
@@ -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", "Onsite services", "Onsite 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", "Takeaway"]
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,14 +1,14 @@
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.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Emirhan Akdeniz
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-06-20 00:00:00.000000000 Z
11
+ date: 2023-06-21 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: A gem to be used with serpapi/bert-base-local-results model to predict
14
14
  different parts of Google Local Listings. This gem uses BERT model at https://huggingface.co/serpapi/bert-base-local-results