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 +4 -4
- data/lib/google-local-results-ai-parser.rb +26 -14
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 290163a767ae91b4c7b8d45087ad40e1e72dc36581b1565a7360fb059674ba11
|
4
|
+
data.tar.gz: af915102b08661235115e5c08287ec424690f9a245454130ca64e4ecd489407c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
-
|
231
|
-
|
232
|
-
|
233
|
-
|
234
|
-
|
235
|
-
|
236
|
-
|
237
|
-
|
238
|
-
|
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
|
-
|
241
|
-
|
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
|