google-local-results-ai-parser 0.1.5 → 0.1.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/google-local-results-ai-parser.rb +9 -8
- 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: b1d9420283a21ee83c026e452292a42ded13528261d395e8cadc4d8aa2cc1e6f
|
4
|
+
data.tar.gz: b1a7ed2399121ab91dfb219af73b245ebc0a0a0ca6e6e3b75de27541c4224572
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1b7dbed7555e7a80c9191b404766a2b5ed758b49a0cb3f867eab3f608b611155c3f6203c483428e2d616adf76b634446393d248fe2b78970ae1d3196751f9f55
|
7
|
+
data.tar.gz: 9f5528a15881f0798de4d62084ec263debed89d6a42b8b95481e371daba9fc82171af5c2c4bfa15aa0abacaec953d25b1db1251e4bcc2386df6992f5da1a3309
|
@@ -445,9 +445,9 @@ module GoogleLocalResultsAiParser
|
|
445
445
|
caught_results_indices = results.map.with_index {|result, index| index if known_errors.include?(result[:input])}.compact
|
446
446
|
return results, label_order, duplicates if caught_results_indices == []
|
447
447
|
|
448
|
-
|
448
|
+
not_service_option_duplicates = duplicates.select.with_index do |duplicate, duplicate_index|
|
449
449
|
caught_results_indices.each do |caught_index|
|
450
|
-
if results[caught_index][:result][0][0]["label"] != "service_options"
|
450
|
+
if duplicate.include?(caught_index) && results[caught_index][:result][0][0]["label"] != "service_options"
|
451
451
|
duplicate_index
|
452
452
|
end
|
453
453
|
end
|
@@ -468,14 +468,15 @@ module GoogleLocalResultsAiParser
|
|
468
468
|
caught_results_indices.each {|caught_index| label_order[caught_index] = "service_options"}
|
469
469
|
|
470
470
|
# Rearranging duplicates
|
471
|
-
|
472
|
-
|
473
|
-
|
474
|
-
duplicates[duplicates.index(duplicate_arr)].delete(last_item)
|
471
|
+
not_service_option_duplicates.each do |not_service_option_duplicate|
|
472
|
+
last_item = duplicates[duplicates.index(not_service_option_duplicate)][-1]
|
473
|
+
duplicates[duplicates.index(not_service_option_duplicate)].delete(last_item)
|
475
474
|
end
|
476
475
|
|
477
|
-
|
478
|
-
duplicates.
|
476
|
+
not_service_option_duplicates.each do |not_service_option_duplicate|
|
477
|
+
if (duplicate_arr = duplicates[duplicates.index(not_service_option_duplicate)]) && duplicate_arr.size == 1
|
478
|
+
duplicates.delete(duplicate_arr)
|
479
|
+
end
|
479
480
|
end
|
480
481
|
|
481
482
|
return results, label_order, duplicates
|