Sentiment in Arabic hotel reviews
PySpark, AraBERT, Hugging Face Transformers
A PySpark pipeline in three layers, bronze, silver and gold, over 105,698 Arabic hotel reviews, and an AraBERT model fine-tuned on what came out of it. Spark runs the model too, as batch inference.
While cleaning the data I found that about 40% of the reviews, 42,102 of them, opened with a title Booking.com writes from the guest’s own score, the Arabic for “Exceptional” or “Disappointing”. A model could pass by reading the first word. I removed those titles before training, so these scores are not comparable with published ones that keep them. They are the ones I can defend.
On 10,217 reviews it had never seen, the fine-tuned model is right 91.85% of the time, against 85.76% for a TF-IDF and logistic-regression baseline. That is 43% fewer errors, and the gain is largest on short reviews, where there is least to read.
It is not finished. Dialect negation still catches it out: “المكيف خربان”, the AC is broken, reads as negative, but “المكيف ما يبرد”, the AC doesn’t cool, comes back positive. The README lists that with the other limits.
Short up to 10 words
Medium 11 to 40
Long over 40
| Model | Validation | Test |
|---|---|---|
| TF-IDF and logistic regression | 85.15% | 85.76% |
| AraBERT v02, fine-tuned | 91.91% | 91.85% |
Figure 2 as a table
| Review length | Baseline | AraBERT |
|---|---|---|
| Short, up to 10 words | 81.7% | 89.8% |
| Medium, 11 to 40 | 86.6% | 92.2% |
| Long, over 40 | 91.0% | 94.7% |