google-local-results-ai-parser 0.2.5 → 0.2.6

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: 23d5956da19fd752805805c70fbd41c9b0c4b19a8b080d81a399e9efbced322c
4
- data.tar.gz: 2ae85f484532bf47836efe3b354cb342d2672526adec07d86e8e294a2206f856
3
+ metadata.gz: 6935f20f427cc87b991af4c49d4db7d52004303837e075f20c73e933c5f77d90
4
+ data.tar.gz: 5be934605c20bcfea761f148ae3574315f56d3d2e9ea19307f891e8bc0ab7938
5
5
  SHA512:
6
- metadata.gz: 77d0a15beddddc3e9324cc56c71f16393d1222cc3bab8dcb6df5becf0a0ed3d8a35bb08e4a25da0f463411ee154af1807be279046d551381a595a583f5a661d9
7
- data.tar.gz: c2a9844133da6f5a60cfb2f499e23b265043c41ec9a0d9216cba21ce5f4f5bb1e6766e40e1f1bd6eec41d9143174d47b0e468d1c0d280470c03d2cc7a0bbfb88
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) && results[caught_index][:result][0][0]["label"] != "service_options"
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] = "service_options"}
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]
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.2.5
4
+ version: 0.2.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Emirhan Akdeniz