Skip to content

Commit 8370cb1

Browse files
committed
Fix a minor error in reviews as price after fix
- Fix a minor error in reviews as price after fix - Bump up the version to push the recent gem
1 parent 89aee0a commit 8370cb1

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

google-local-results-ai-parser.gemspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Gem::Specification.new do |spec|
22
spec.name = "google-local-results-ai-parser"
3-
spec.version = "0.1.3"
3+
spec.version = "0.1.4"
44
spec.summary = "A gem to be used with serpapi/bert-base-local-results model to predict different parts of Google Local Listings."
55
spec.description = "A gem to be used with serpapi/bert-base-local-results model to predict different parts of Google Local Listings. This gem uses BERT model at https://huggingface.co/serpapi/bert-base-local-results in the background. For serving private servers, head to https://github.com/serpapi/google-local-results-ai-server to get more information."
66
spec.homepage = "https://github.com/serpapi/google-local-results-ai-parser"

lib/google-local-results-ai-parser.rb

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -355,16 +355,16 @@ def reviews_as_price_confusion(results, label_order, duplicates)
355355
# Zero out the `price`, and put it to last position
356356
reviews_hash = results[price_duplicate[-1]][:result][0].find {|hash| hash["label"] == "reviews" }
357357
reviews_index = results[price_duplicate[-1]][:result][0].index(reviews_hash)
358-
results[price_duplicate[-1]][:result][0][0] = {"label" => "reviews", "score" => 1.0}
359-
results[price_duplicate[-1]][:result][0].delete_at(reviews_index)
360-
results[price_duplicate[-1]][:result][0] << {"label" => "price", "score" => 0.0}
358+
results[price_duplicate[0]][:result][0][0] = {"label" => "reviews", "score" => 1.0}
359+
results[price_duplicate[0]][:result][0].delete_at(reviews_index)
360+
results[price_duplicate[0]][:result][0] << {"label" => "price", "score" => 0.0}
361361

362362
# Rearranging `label_order`
363-
label_order[price_duplicate[-1]] = "reviews"
363+
label_order[price_duplicate[0]] = "reviews"
364364

365365
# Rearranging duplicates
366-
last_item = duplicates[duplicates.index(price_duplicate)][-1]
367-
duplicates[duplicates.index(price_duplicate)].delete(last_item)
366+
first_item = duplicates[duplicates.index(price_duplicate)][0]
367+
duplicates[duplicates.index(price_duplicate)].delete(first_item)
368368

369369
if (duplicate_arr = duplicates[duplicates.index(price_duplicate)]) && duplicate_arr.size == 1
370370
duplicates.delete(duplicate_arr)

0 commit comments

Comments
 (0)