Urgent.News

What's breaking now, across thousands of outlets.

Tech

Pull Agoda hotel reviews with scores and sub-scores into a spreadsheet, in Python

If you manage a hotel, run a reputation-management tool or analyse a city's hotel market, Agoda is one of the review sources you can't skip in Asia. A single hotel page there mixes two review pools: reviews from Agoda's own guests and reviews from Booking.com guests that Agoda republishes. Each pool has its own score, its own review count and its own six sub-scores (cleanliness, facilities,…

To analyze Agoda hotel reviews with scores and sub-scores, you can use Python to pull the data into a CSV file. Begin by installing the necessary library, apify-client, using pip. Then, create an instance of the ApifyClient using your API key. Next, make a call to the Agoda reviews scraper actor, providing a list of hotels, the maximum number of reviews per hotel, and a date filter for new reviews.

Once the reviews are retrieved, iterate through the results and extract the relevant information for each review. Create a CSV file named reviews.csv and define the header fields, such as hotel_name, source, rating, title, text, negatives, traveller_type, reviewer_country, review_date, and owner_response. Write the header to the CSV file and then add each review as a row in the CSV.

Next, organize the data by hotel and traveler type, counting the number of ratings for each hotel and listing the positive and negative feedback for each review. Print the hotel name, Agoda score, Booking.com score, cleanliness sub-score, and value for money sub-score. Finally, sort the ratings for each hotel by traveler type and print the results.

Written by urgent.news from Dev.to's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.

Read the original at dev.to →

More in Tech

Tokenization: BPE from Scratch, Vocab Size, and What Tokenizers Hide

Tokenization: BPE from Scratch, Vocab Size, and What Tokenizers Hide Before a language model reads a single word, a tokenizer has already decided how that word gets cut up.

  • Tokenization breaks text into smaller units called tokens.
  • BPE merges frequent character pairs into new tokens until reaching a predetermined vocabulary size.
  • BPE is used in language models like GPT-2 and Llama 3 to efficiently represent text as tokens.

More from Monday 9 November →