{"id":26725541,"url":"https://github.com/sarthakm402/smart_recommender_system","last_synced_at":"2026-05-06T07:33:56.020Z","repository":{"id":283417543,"uuid":"951367961","full_name":"sarthakm402/Smart_Recommender_system","owner":"sarthakm402","description":" Uses sentiment analysis and recommendation algorithms to provide personalized hotel suggestions.","archived":false,"fork":false,"pushed_at":"2025-03-27T12:56:53.000Z","size":9,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-27T13:42:15.585Z","etag":null,"topics":["bert-fine-tuning","flask","python","transformer"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sarthakm402.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2025-03-19T15:10:40.000Z","updated_at":"2025-03-27T12:56:56.000Z","dependencies_parsed_at":"2025-03-21T04:45:59.755Z","dependency_job_id":null,"html_url":"https://github.com/sarthakm402/Smart_Recommender_system","commit_stats":null,"previous_names":["sarthakm402/smart_recommender_system"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sarthakm402%2FSmart_Recommender_system","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sarthakm402%2FSmart_Recommender_system/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sarthakm402%2FSmart_Recommender_system/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sarthakm402%2FSmart_Recommender_system/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sarthakm402","download_url":"https://codeload.github.com/sarthakm402/Smart_Recommender_system/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245924453,"owners_count":20694731,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["bert-fine-tuning","flask","python","transformer"],"created_at":"2025-03-27T21:19:22.047Z","updated_at":"2026-05-06T07:33:50.995Z","avatar_url":"https://github.com/sarthakm402.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Smart Hotel Recommendation System\n\n## Overview\nThis project is a **Smart Hotel Recommendation System** that uses **sentiment analysis** and **recommendation algorithms** to provide personalized hotel suggestions. It utilizes **TripAdvisor hotel reviews** as the dataset and implements both **user-based collaborative filtering** and **content-based filtering** to suggest hotels. The system is built with **Flask** for the backend and integrates a **BERT-based sentiment analysis model** to classify user reviews.\n\n## Dataset\n- **Source**: TripAdvisor Hotel Reviews\n- **Columns**:\n  - `Review` (text of the hotel review) → Processed as `cleaned_review`\n  - `Rating` (user rating from 1-5) → Mapped to `review_score`\n  - `sentiments` (derived from ratings):\n    - 0: Negative (rating ≤ 2)\n    - 1: Neutral (rating = 3)\n    - 2: Positive (rating ≥ 4)\n  - `user_id` (randomly assigned unique users)\n  - `hotel_id` (randomly assigned hotel IDs)\n\n## Justification for Recommendation Approach\n### 1. User-Based Collaborative Filtering (Using User ID)\n- The system tracks **users who liked the same hotels**.\n- If a user has previously liked certain hotels, the system finds **similar users** and recommends hotels they enjoyed.\n- If a user has no history, **default top-rated hotels** are recommended.\n\n### 2. Content-Based Filtering (Using Hotel ID)\n- Uses **TF-IDF (Term Frequency-Inverse Document Frequency)** on reviews to find similarity.\n- When a user searches for a hotel, the system recommends **similar hotels** based on review content.\n\n## API Endpoints\n### 1. Home Page\n`GET /`\n- Loads the **index_recommender.html** template.\n\n### 2. Sentiment Analysis\n`POST /predict_sentiment`\n- **Input:** JSON `{ \"review\": \"Amazing hotel with great service!\" }`\n- **Output:** `{ \"review\": \"Amazing hotel with great service!\", \"sentiment\": \"Positive\" }`\n\n### 3. Top Hotels\n`GET /top_hotels`\n- Returns **top 10 highest-rated hotels**.\n\n### 4. Personalized Hotel Recommendation\n`GET /recommend/\u003cint:user_id\u003e`\n- **Finds hotels liked by similar users**.\n- If a user has **no previous history**, returns top-rated hotels.\n\n### 5. Similar Hotel Recommendation\n`GET /similar_hotels/\u003cint:hotel_id\u003e`\n- Returns hotels **similar to the given hotel** based on **content-based filtering**.\n\n## Model Performance\n- **Sentiment Classification Model**\n  - **Accuracy:** 94%\n  - Model: **Fine-tuned BERT**\n  - Predicts sentiment as **Positive, Neutral, or Negative**\n\n## Notes\n- **Initial Load Time**: Since the system loads a **BERT model** for sentiment analysis, **please wait a few minutes** when starting the application.\n- **Data Processing**: User IDs and hotel IDs are **randomly assigned**, meaning the recommendations will differ upon reloading the dataset.\n\n## Running the Application\n1. Install dependencies:\n   ```bash\n   pip install flask torch transformers pandas numpy scikit-learn\n   ```\n2. Run the Flask app:\n   ```bash\n   python app.py\n   ```\n3. Open your browser and navigate to:\n   ```\n   http://127.0.0.1:5000/\n   ```\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsarthakm402%2Fsmart_recommender_system","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsarthakm402%2Fsmart_recommender_system","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsarthakm402%2Fsmart_recommender_system/lists"}