Building a Dashboard from Unstructured Sentiment Analysis of Hotel Reviews
Key point
It explained how to build a dashboard for topic-based sentiment analysis of hotel reviews using AI21 Jurassic-1.
Details
This covers a method for collecting reviews from hotel booking platforms like Hotels.com, performing unstructured sentiment analysis and topic extraction in one pass, and displaying the results as a dashboard. Using Jurassic-1 from AI21 Studio, you can convert review text into structured JSON with almost no NLP knowledge.
The core flow is as follows.
- Collect reviews for each hotel page by page using RapidAPI's Hotels.com reviews API. Calling the reviews API requires a RapidAPI key, which is separate from the AI21 Studio key.
- The example uses the Empire Hotel, gathering only the summary of each review from the response and combining about 50 reviews per page into the full set.
- langdetect is used to filter out reviews that aren't in English or are too short, improving input quality.
The model uses a few-shot prompt that was tested and refined in the playground. The examples should cover a variety of items that frequently appear in real reviews, such as location, room, cleanliness, facilities, service, view, and AC, and the article recommends at least 8 examples. Since accuracy matters, temperature=0 is used, and the output is received in a form like {"Location": "Positive"}.
In the aggregation step, the results are parsed using ast.literal_eval and pandas, responses with broken formatting are excluded, and the Positive/Negative counts for the top 7 topics are tallied and visualized. The visualization is built based on a matplotlib horizontal bar chart example, and the dashboard shows at a glance strengths such as location, service, and cleanliness, as well as improvement points such as WiFi, AC, and rooms/facilities.
Finally, performing a simple validation by comparing against Booking.com's category ratings lets you check whether the dashboard results align with actual user evaluations. This results in a practical analysis tool that lets hotel operators quickly identify strengths and weaknesses without having to read through long reviews themselves.
This summary was generated automatically by AI. Check the original for the author's claims and context. Copyright belongs to the original author.
Our guide explains how the AI works. Report summary errors, attribution issues, or removal requests via Contact.