google-local-results-ai-parser 0.2.5 → 0.2.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 +5 -5
- 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: 6935f20f427cc87b991af4c49d4db7d52004303837e075f20c73e933c5f77d90
|
4
|
+
data.tar.gz: 5be934605c20bcfea761f148ae3574315f56d3d2e9ea19307f891e8bc0ab7938
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d34c7e63db0ed905053b98c68888f2830fdbdc1e2d2117d7353df8df2a704b66beb72dd8940f44224ceaebf6d643d8df1dce67c56a5864ed56f99d2ba6c13f78
|
7
|
+
data.tar.gz: 10453d1c6f06571a0d81f3c6b8bbd96659764c230d44cec898b8f8832f317d22bfa661b04c0cf4cc091f16033f68f44beb56a20505419738e1653d9d57d59a90
|
@@ -483,18 +483,17 @@ module GoogleLocalResultsAiParser
|
|
483
483
|
"Online estimates not available",
|
484
484
|
"Takeaway"
|
485
485
|
]
|
486
|
-
caught_results_indices = results.map.with_index {|result, index| index if known_errors.include?(result[:input])}.compact
|
486
|
+
caught_results_indices = results.map.with_index {|result, index| index if known_errors.include?(result[:input]) && result[:result][0][0]["label"] != "service options"}.compact
|
487
487
|
|
488
488
|
not_service_option_duplicates = []
|
489
489
|
caught_results_indices.each do |caught_index|
|
490
490
|
duplicates.each.with_index do |duplicate, duplicate_index|
|
491
|
-
if duplicate.include?(caught_index)
|
491
|
+
if duplicate.include?(caught_index)
|
492
492
|
not_service_option_duplicates << duplicate_index
|
493
493
|
end
|
494
494
|
end
|
495
495
|
end
|
496
496
|
|
497
|
-
return results, label_order, duplicates if not_service_option_duplicates == []
|
498
497
|
# Zero out the `type` or `description`, and put it to last position
|
499
498
|
caught_results_indices.each do |caught_index|
|
500
499
|
service_options_hash = results[caught_index][:result][0].find {|hash| hash["label"] == "service options" }
|
@@ -505,10 +504,11 @@ module GoogleLocalResultsAiParser
|
|
505
504
|
old_result_hash["score"] = 0.0
|
506
505
|
results[caught_index][:result][0] << old_result_hash
|
507
506
|
end
|
508
|
-
|
507
|
+
|
509
508
|
# Rearranging `label_order`
|
510
|
-
caught_results_indices.each {|caught_index| label_order[caught_index] = "
|
509
|
+
caught_results_indices.each {|caught_index| label_order[caught_index] = "service options"}
|
511
510
|
|
511
|
+
return results, label_order, duplicates if not_service_option_duplicates == []
|
512
512
|
# Rearranging duplicates
|
513
513
|
not_service_option_duplicates.each do |not_service_option_duplicate|
|
514
514
|
last_item = duplicates[not_service_option_duplicate][-1]
|