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

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: f879eea0293f78de7556e0b7b2c899d7c1460ab75955b3e014c9ec8341c183bd
4
- data.tar.gz: 5e4b4ba286d337ac577fa2750344d910ec297b981c0b57c53b25cf94be6fb10f
3
+ metadata.gz: a0046662dab725d061630a6391db2450e0306e0bccdf44a8a28681014dd0739b
4
+ data.tar.gz: 24b20b65d3eeef9f4d40fd227306a48428312e7e4af8fc9e366cab584e828bc9
5
5
  SHA512:
6
- metadata.gz: 3e6b363af552c4bf34da4ac387830720c98bfbc5c1a2331c2fe1fed8c373d3d0f66bb1bd303b8565d2fcaadeeabfca6969fb4f5a13f25c9efc24f2d44923a288
7
- data.tar.gz: 801b68771772460632e704cca817d01a2662b8958415510cce48c57af2b37592493e9826d226b4f5bfd67ef5cb432ba8e7fa9b7bac63b84914791ef4a216f1c9
6
+ metadata.gz: 2ad1fc7d80ddc04a8a46337ba3ca681a2cf4630b743807b78774be7f0d83266018fd1cd283123cc3ef52e5b7fb92722db0881f6fbf89fe1ee060964d3b74a827
7
+ data.tar.gz: cba8c079367c3a5d52c1b27c26ca524774ef04aa5643a08876b26b5cd05d01b8e4fede63a32b4ededc26e317235335827d1421a68f6a57dece45d4d8bc0a859c
@@ -441,13 +441,13 @@ module GoogleLocalResultsAiParser
441
441
  # On-site services, Online appointments
442
442
  # Fixes `On-site services`, `Online appointments`
443
443
  def service_options_as_description_or_type_confusion(results, label_order, duplicates)
444
- known_errors = ["On-site services", "On-site services not available", "Online appointments", "Online appointments not available"]
444
+ known_errors = ["On-site services", "On-site services not available", "Onsite services", "Onsite services not available", "Online appointments", "Online appointments not available"]
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
- not_service_option_duplicate = duplicates.find.with_index do |duplicate, duplicate_index|
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
- not_service_option_duplicate.each do |duplicate_index|
472
- duplicate_arr = duplicates.find{|duplicate| duplicate.include?(2)}
473
- last_item = duplicate_arr[-1]
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
- if (duplicate_arr = duplicates[duplicates.index(not_service_option_duplicate)]) && duplicate_arr.size == 1
478
- duplicates.delete(duplicate_arr)
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
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.1.5
4
+ version: 0.1.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Emirhan Akdeniz