Giter VIP home page Giter VIP logo

hotel_review_classifier's Introduction

Hotel_Review_Classifier

a text classifier that computationally identifies and categorizes opinions (sentiment analysis) expressed in a hotel review. It classifies the review as a positive review or a negative review.

Requirements

  • pandas
pip install pandas
  • nltk
pip install nltk
  • flask
pip install flask
  • pickle
pip install pickle
  • sklearn
pip install sklearn

How it works

The first step is to build a classification model. We need to first prepare the review by eliminating punctuation marks, redundant spaces, etc. Then we have to remove the stopwords (stop words are words which are filtered out before or after processing of natural language data. Some examples of stop words are: "a," "and," "but," "how," "or," and "what.") Once the stopwords are eliminated, we take the root word for each word (for eg. root word of "amazing" is "amaze"). Now our text cleaning process is complete.

The next step is to create a matrix of all words (or the top N words if the number of words is too large). CountVectorizer is used for this purpose. Once we have the matrix all that's left to do is train the classification model.

Now for every review that should be tested, the above cleaning process should be done and converted into a matrix. Then use the classification model to predict the sentiment of the result.

One challenge that you may face is handling contractions and negations like "food was not good" and "food wasn't good". To handle such sentences, a dictionary of contractions is provided in the program which can be used to convert contractions such as "wasn't" to "was not". Now to handle the negation, the first adjective after the negating word "not" can be replaced with its synonym, and the word "not" can be removed. So a review like "food was not good" will become "food was bad". The latter sentence is classified accurately.

hotel_review_classifier's People

Contributors

gauthamn3004 avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.