0% found this document useful (0 votes)
7 views54 pages

Project

The document is a project report titled 'Movie Sentiment Analyser' submitted by Abhishek for a Bachelor's degree in Technology at Om Sterling Global University. The project aims to develop a machine learning-based sentiment analysis tool to classify IMDb movie reviews as positive or negative, addressing the challenges of analyzing large volumes of unstructured text data. The report includes acknowledgments, a detailed introduction to the topic, and outlines the significance, limitations, and methodologies used in the project.

Uploaded by

jangirlalit2001
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
7 views54 pages

Project

The document is a project report titled 'Movie Sentiment Analyser' submitted by Abhishek for a Bachelor's degree in Technology at Om Sterling Global University. The project aims to develop a machine learning-based sentiment analysis tool to classify IMDb movie reviews as positive or negative, addressing the challenges of analyzing large volumes of unstructured text data. The report includes acknowledgments, a detailed introduction to the topic, and outlines the significance, limitations, and methodologies used in the project.

Uploaded by

jangirlalit2001
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 54

MOVIE SENTIMENT ANALYSER

B. Tech Project Report


By
Abhishek

Under the guidance of


Dr. Parveen Sehgal

DEPARTMENT OF COMPUTER SCIENCE & ENGINEERING

SCHOOL OF ENGINEERING & TECHNOLOGY

OM STERLING GLOBAL UNIVERSITY


NH-52, Hisar-Chandigarh Road, Hisar, Haryana 125001

May, 2025
MOVIE SENTIMENT ANALYSER
A Project Report submitted
in partial fulfilment of the
requirements for the Degree of

Bachelor’s in Technology
by
Abhishek
(Enrollment No –211SET01100004)

Under the guidance of


Dr. Parveen Sehgal

to the

DEPARTMENT OF COMPUTER SCIENCE & ENGINEERING

SCHOOL OF ENGINEERING & TECHNOLOGY

OM STERLING GLOBAL UNIVERSITY


NH-52, Hisar-Chandigarh Road, Hisar, Haryana

May, 2025
CERTIFICATE

This is to certify that the project entitled “MOVIE SENTIMENT ANALYSER” submitted
for the degree of BACHELOR OF TECHNOLOGY in the discipline DEPARTMENT OF
COMPUTER SCIENCE & ENGINEERING at OM STERLING GLOBAL
UNIVERSITY, HISAR during the academic year 2024-2025 is bonafide project work is carried out
by “Abhishek” bearing ROLL NO. 211020110004 under my supervision and it is further certified
that the work done in this project is a result of the candidate's own efforts. I wish all of them success in
their lives and no part of this project report has been submitted in any other University/ Institute for B.
TECH or any other degree/diploma.

……………….

Supervisor

Dr. Parveen Sehgal

(Head of Department)

Deptt. of CSE

OSGU, HISAR
DECLARATION
It is hereby that the work presented in the project report entitled “MOVIE SENTIMENT
ANALYSER” in partial fulfilment of requirement for the awards of degree of BACHELOR
OF TECHNOLOGY submitted to the DEPARTMENT OF COMPUTER SCIENCE &
ENGINEERING at OM STERLING GLOBAL UNIVERSITY, HISAR is an authentic
record of my own work carried out under the supervision of DR. PARVEEN SEHGAL. The matter
presented in this project has not been submitted in any other University / Institute for the award of B.
TECH or any other Degree / Diploma to the best of my knowledge & belief.

Abhishek

211020110004

This is to certify that the above statement made by the candidate is correct to the
best of my knowledge.

……………………

Supervisor

Dr. Parveen Sehgal

(Head of Department)

(CSE Department)

(OSGU, HISAR)
ACKNOWLEDGEMENT

We are highly grateful to our Supervisor and Head of department DR. PARVEEN SEHGAL, OM
STERLING GLOBAL UNIVERSITY, HISAR for providing this opportunity to carry out the
present project work. We owe their overwhelming debt for helping us to plan and discuss the contents of
this work. Their ideas, simulating comments, interpretations and suggestions increased our cognitive
awareness and helped considerably in the fruition of our objective. We remain obliged to them for their help
and able guidance through all stages of this project. We are grateful to our Dean, DR. SHAILESH
KUMAR, OM STERLING GLOBAL UNIVERSITY, HISAR entire staff of Computer Science &
Engineering Department and friends who devoted their valuable time and helped us in all possible ways
towards successful completion of this work. We thank all those who have contributed directly or indirectly to
this project. Lastly, we would like to thank our parents for their years of unyielding love. They have always
wanted the best for us and we admire their determination and sacrifice. Above all, we express our
indocibleness to all ALMIGHTY for the blessing and kindness.

I am incredibly thankful to Dr. Parveen Sehgal for his unwavering support and exceptional guidance
during our project.

Abhishek
TABLE OF CONTENTS

Certificate

Declaration

Acknowledgements

Table of Contents

List of figures

List of Appendix

CHAPTER 1 INTRODUCTION TO TOPIC

1.1 Introduction

1.2 Statement of Problem

1.3 Significance of problem

1.4 Causes of Interest

1.5 Limitations

CHAPTER 2 BODY OF THESIS

2.1 Literature Review

2.2 Materials and Methods

CHAPTER 3 SUMMARY AND CONCLUSION

3.1 Results

3.2 Discussion

3.3 References

3.4 Appendices

3.5 Scope of Further Work

3.6 Conclusion
LIST OF FIGURES

FIGURES S.NO. FIGURES DESCRIPTION

1 How Sentiment Analyser Looks

2 Significance of Sentiment Analyser

3 Literature Review of Sentiment Analyser

4 Accuracy of Different Models

5 F1-Score of Different Models

6 Confusion Matrix of Logistic Classifier

7 Word Cloud for Positive Reviews

8 Word Cloud for Negative Reviews

9 Raw Data
LIST OF ABBREVIATIONS

S.NO. PARTICULARS

1. Artificial Intelligence (AI)

2. Machine Learning (ML)

3. Natural Language Processing (NLP)

4. Internet Movie Database (IMDB)

5. Term Frequency – Inverse Document Frequency (TF-IDF)

6. Hyper Text Markup Language (HTML)

7. User Interface (UI)

8. User Experience (UX)

9. Comma Separated Values (CSV)


CHAPTER 1: INTRODUCTION TO TOPIC

Fig. 1 “How Sentiment Analyser Looks”

1.1 Introduction

The advent of the digital age has significantly transformed the way individuals
communicate, share opinions, and consume information. With the rise of the internet and
the growing dominance of social media platforms, user-generated content has proliferated
across the web at an unprecedented rate. Among the various forms of digital expression,
reviews and ratings have become particularly influential, playing a crucial role in shaping
public perception and guiding consumer choices. In the domain of entertainment, movie
and television show reviews contribute immensely to the decision-making process of
audiences, filmmakers, and critics alike.

One of the most prominent platforms for entertainment-related content is the Internet
Movie Database (IMDb). IMDb serves as a central hub where users from around the world
can share their opinions and critiques on movies, TV series, and other visual media. With
millions of user reviews available on the site, it offers a vast repository of textual data that
reflects a wide spectrum of public sentiment. Analysing this wealth of information can
provide valuable insights into audience reception, trending preferences, and overall
sentiment trends within the entertainment industry.
To effectively interpret the sentiments embedded within these textual reviews, Sentiment
Analysis—a subfield of Natural Language Processing (NLP)—has emerged as a powerful
tool. Sentiment analysis involves the computational identification, extraction, and
categorization of opinions expressed in text, primarily to ascertain whether the writer’s
attitude is positive, negative, or neutral. This technique has widespread applications in
areas such as marketing, product development, and customer service, and is increasingly
being leveraged in the media and entertainment sectors.

This project aims to develop an accurate and efficient sentiment analysis system
specifically tailored to classify IMDb movie reviews into either positive or negative
sentiment categories. The objective is to harness the capabilities of machine learning
algorithms to build a predictive model that can interpret user opinions with high
reliability.

To achieve this goal, a comprehensive dataset containing over 150,000 IMDb movie
reviews was utilized. The project involved a series of critical steps, including data
preprocessing, text normalization, feature extraction, and model training. Various machine
learning classifiers were evaluated to identify the most suitable model for this task. After a
detailed comparison using performance metrics such as accuracy, precision, recall, and
F1-score, the Logistic Regressor classifier was found to deliver the best results, striking
an optimal balance between performance and interpretability.

To enhance accessibility and practical usability, the final sentiment analysis model was
integrated into a user-friendly web-based application developed using the Flask
framework. This interface allows users to input movie reviews in real-time and receive
immediate feedback on the predicted sentiment. By bridging the gap between complex
machine learning techniques and everyday user interaction, the application serves as both a
practical tool and a demonstration of the power of NLP in real-world scenarios.
1.2 Statement of the Problem

With the explosion of digital content and the widespread use of online platforms, user
reviews have become a powerful source of public opinion. IMDb (Internet Movie
Database) is one such platform where users post detailed reviews about movies and TV
shows. These reviews not only influence viewer decisions but also provide valuable
feedback for filmmakers and production companies. However, the massive volume and
unstructured nature of these textual reviews make it difficult to manually analyse and
interpret the overall sentiment.

Traditional methods of assessing user feedback—such as reading through reviews or


relying solely on star ratings—are time-consuming, inefficient, and often fail to capture the
true emotional tone conveyed in the text. As a result, there is a growing need for an
automated system that can process large-scale textual data and accurately classify user
opinions as either positive or negative.

The core problem this project addresses is the lack of an efficient, scalable solution to
analyse sentiment in IMDb movie reviews. This includes challenges like dealing with
informal language, sarcasm, varying writing styles, and context-based expressions that are
common in user-generated content.

Therefore, the project aims to develop a sentiment analysis tool using machine learning
techniques that can automatically determine the sentiment of IMDb movie reviews. The
goal is to provide a fast, reliable, and user-friendly solution that enables users and
stakeholders to gain insights from large volumes of reviews without manual effort. By
leveraging natural language processing and a trained classification model, this system will
help convert raw textual data into meaningful sentiment information.
1.3 Significance of the Problem

Volume of User Reviews:


IMDb contains millions of reviews submitted by users globally, and this number increases
daily. Manually reading, interpreting, and summarizing this vast amount of unstructured
textual data is not only inefficient but practically impossible. An automated sentiment
analysis system helps process this large volume in a fraction of the time, offering a scalable
solution to a growing problem.

Influence on Viewer Decisions:


Before watching a movie or TV show, many users turn to IMDb to check ratings and read
reviews. These reviews often influence whether a viewer chooses to watch a particular
title. Accurately summarizing the overall sentiment can help users make faster and more
informed decisions without reading through dozens of reviews.

Valuable Feedback for Creators and Studios:


Movie reviews reflect how audiences perceive various aspects of a film, including acting,
direction, storyline, and production quality. Filmmakers and studios can use sentiment
analysis to identify patterns in viewer feedback, detect what resonates with the audience,
and make data-driven improvements in future projects.

Unstructured and Informal Nature of Text Data:


User-generated content is highly informal and inconsistent, often including slang, emojis,
abbreviations, and sarcasm. This complexity makes traditional data analysis methods
ineffective. Sentiment analysis, backed by NLP, is capable of handling such variations and
extracting meaningful information from them.

Limitations of Star Ratings:


While star ratings offer a quick numeric representation, they don’t capture the full
sentiment behind a review. For example, a 3-star review may contain more positive
remarks than a 4-star one. Sentiment analysis helps uncover these subtleties by interpreting
the actual text and providing a deeper emotional understanding.

Need for Scalable, Automated Analysis:


Manual moderation or summarization is not feasible at scale. A machine learning-based
sentiment analyser automates the process, offering rapid and consistent classification of
reviews across thousands of titles—saving both time and human effort.

Support for Marketing and Business Strategy:


Marketing teams can use sentiment trends to measure the success of film campaigns,
promotional events, or releases. A sudden shift in sentiment can help identify issues early
and adjust strategies accordingly.

Improved Recommendation Systems:


Many platforms rely on collaborative filtering for content recommendations. Integrating
sentiment analysis can enhance these systems by recommending content not only based on
ratings but also based on positive viewer sentiment.

Academic and Research Applications:


For researchers in natural language processing, psychology, and media studies, IMDb
reviews offer a rich dataset. A sentiment analyser provides a tool to process this data
efficiently, enabling large-scale studies on public opinion and language patterns.

Enhanced User Experience Through Interactivity:


A web-based sentiment analyser provides a user-friendly interface where users can
instantly check the sentiment of any review or their own written input. This adds a layer of
interactivity and personalization to the user experience on entertainment platforms.

Fig. 2 “Significance of Sentiment Analyser”


1.4 Causes of Interest for This Project
The following factors highlight the motivation and relevance behind choosing this project
Growing Importance of Sentiment Analysis in the Digital Age:
With the rapid increase in user-generated content across platforms like IMDb and others,
sentiment analysis has become a critical tool for extracting insights from public opinion.
This project is a response to the growing need for systems that can intelligently analyse
and classify textual data at scale.

Real-World Application and Impact:


Sentiment analysis is not just a theoretical concept—it has tangible real-world value. For
entertainment platforms, production companies, and even casual moviegoers,
understanding public sentiment about films can lead to better decision-making. The
opportunity to build a tool that serves practical use makes this project highly appealing.

Availability of Large-Scale, Real-World Datasets:


IMDb offers a rich, real-world dataset of user reviews, which is ideal for training and
testing sentiment analysis models. Having access to more than 150,000 labelled reviews
provided a strong foundation to apply and validate machine learning techniques on real
user data.
Exploration of Natural Language Processing (NLP):
This project serves as an excellent introduction to NLP, one of the most exciting and fast-
growing areas of artificial intelligence. It allows exploration of text preprocessing, feature
extraction, and the nuances of language interpretation using machine learning models.

Opportunity to Compare Machine Learning Algorithms:


Analysing IMDb sentiment allows experimentation with different classification algorithms
such as Logistic Regression, Naive Bayes, Support Vector Machines (SVM), and Random
Forest. This comparison helps identify the most effective approach and deepens
understanding of model performance and evaluation metrics like accuracy and F1-score.

Integration with Web Technologies:


Deploying the final model using the Flask web framework adds a full-stack dimension to
the project. This makes the system interactive and accessible, while also enhancing the
developer’s skills in building and deploying web-based machine learning applications.
1.5 Limitations of the Project

Despite its effectiveness, the project has certain limitations that may impact its scalability
and generalization.

Binary Classification Only:


The current model is limited to binary sentiment classification—positive or negative. It
does not account for neutral sentiments or the degree of positivity or negativity, which
may oversimplify the emotional tone of some reviews.

Context and Sarcasm Handling:


Despite preprocessing and model tuning, the system may struggle with understanding
context, sarcasm, or irony. For example, a sarcastic review saying “This movie was too
amazing, I couldn’t even finish it” may be misclassified as positive.

Dependence on Pre-processed Text:


The performance of the model heavily depends on effective preprocessing (removal of
stop words, punctuation, stemming/lemmatization, etc.). Incorrect or inadequate
preprocessing can degrade model accuracy.

No Consideration of Metadata:
The sentiment analyser is based solely on review text, without incorporating other useful
information such as movie genre, user rating, review length, or reviewer history, which
could provide additional context and improve accuracy.

Limited Vocabulary and Slang Detection:


The model might not accurately classify reviews that contain slang, emojis, or domain-
specific abbreviations that were not part of the training data, affecting its generalization to
modern or informal writing styles.

Static Model Performance:


Once trained, the model does not learn from new data unless it is manually retrained.
This static nature limits its adaptability to evolving language trends or shifts in viewer
expression styles over time.
CHAPTER 2: BODY OF THESIS

2.1 Literature Review:

Sentiment analysis, also referred to as opinion mining, is a core area within Natural
Language Processing (NLP) that involves the automatic extraction and classification of
sentiments expressed in textual content. With the explosion of user-generated data on the
internet, particularly through social media platforms and review websites like IMDb, there
is an increasing demand for intelligent systems that can analyse and interpret public
opinion. Among the various domains where sentiment analysis has been applied, movie
reviews stand out as a particularly valuable source of subjective feedback, offering insights
into viewer preferences, satisfaction, and emotional reactions to films.

Early research in sentiment analysis focused on rule-based and lexicon-based approaches,


which relied on predefined dictionaries of positive and negative words. Although simple
and intuitive, these methods often failed to capture context, sarcasm, or the nuanced
structure of human language. A notable breakthrough in the field was introduced by Pang
and Lee (2002), who applied machine learning techniques such as Naive Bayes and
Support Vector Machines (SVM) to classify movie reviews as positive or negative. Their
work established a foundation for a data-driven approach to sentiment classification and
demonstrated the superiority of supervised learning models over heuristic-based methods.

As the field progressed, researchers explored a wide variety of algorithms including


Logistic Regression, Decision Trees, and Random Forest classifiers, all of which showed
varying degrees of success based on the features and preprocessing techniques used.
Feature extraction methods such as Bag of Words (BoW) and Term Frequency-Inverse
Document Frequency (TF-IDF) became standard practices for converting unstructured text
into numerical form suitable for machine learning. More recently, word embeddings like
Word2Vec, GloVe, and contextual models such as BERT have further advanced the field
by capturing the semantic relationships between words.
A widely used resource in sentiment analysis of movie reviews is the IMDb Large Movie
Review Dataset, which contains 50,000 labelled reviews split evenly between positive and
negative sentiments. This dataset has served as a benchmark for evaluating the
effectiveness of various classification techniques. In terms of software tools, libraries such
as NLTK, Scikit-learn, TensorFlow, and Keras have enabled researchers and developers to
implement and test complex models with relative ease.

Despite these advancements, challenges remain in accurately interpreting informal


language, handling sarcasm, and detecting the true sentiment in ambiguous or mixed
reviews. Many systems also struggle to scale efficiently or provide real-time feedback to
end users. These limitations highlight the continued need for robust, scalable, and
interactive sentiment analysis systems that can process user-generated content with high
accuracy. The present project builds on this rich body of research by applying machine
learning techniques—particularly a Random Forest classifier—to the domain of IMDb
movie reviews, and aims to deliver a practical, real-time solution through a web-based
interface for effective sentiment prediction.

Fig. 3 “Literature Review of Sentiment Analyser”


2.2 Materials and Methods

The development of the IMDb Sentiment Analyzer involved a systematic and structured
approach, combining data collection, preprocessing, feature engineering, model training,
evaluation, and deployment. This section provides a comprehensive overview of the
resources, tools, and methodologies employed throughout the project lifecycle.

The primary objective was to design and implement a machine learning-based sentiment
analysis system capable of classifying movie reviews from IMDb as either positive or
negative. To achieve this, various machine learning algorithms were tested and compared,
with the Random Forest classifier ultimately selected based on superior performance. The
final model was integrated into an interactive web application, enabling users to obtain
real-time sentiment predictions.

Dataset and Data Collection:

The project utilized the IMDb Large Movie Review Dataset, which is one of the most
widely used benchmark datasets for binary sentiment classification tasks. This dataset
contains 50,000 movie reviews, evenly split into 25,000 positive and 25,000 negative
examples. All reviews were pre-labelled and curated to ensure a balanced distribution of
sentiments, making it ideal for training and evaluation purposes.

In addition to the benchmark dataset, the project leveraged a larger corpus comprising over
150,000 raw IMDb reviews, gathered to further improve the robustness and
generalizability of the model. This extended dataset included a mixture of labelled and
unlabelled reviews, which were used for unsupervised learning experiments and
exploratory data analysis.

Tools, Libraries, and Technologies:

The implementation was carried out using the Python programming language, owing to
its powerful libraries and wide adoption in the machine learning and data science
communities. The following tools and libraries were integral to the project:
• Natural Language Toolkit (NLTK): Used for preprocessing tasks such as
tokenization, stop word removal, and lemmatization.

• Scikit-learn (sklearn): Provided a comprehensive suite of tools for vectorization


(TF-IDF), model building, training, and evaluation.

• Pandas and NumPy: Used for structured data handling, manipulation, and
analysis.

• Matplotlib and Seaborn: Employed for data visualization, including graphs of


word frequency distributions and performance metrics.

• Flask: A lightweight Python web framework used to create a responsive front-end


interface for real-time sentiment prediction.

• Joblib: Used to serialize the trained machine learning model for deployment and
integration into the web app.

Data Preprocessing:

Textual data collected from real-world user reviews often contains noise and variability.
To ensure that the data fed into the machine learning algorithms was clean and meaningful,
several preprocessing steps were undertaken:

• Lowercasing: All text was converted to lowercase to standardize words and reduce
redundancy (e.g., "Movie" and "movie" treated equally).

• HTML Tag Removal: Many IMDb reviews contain HTML formatting, which was
removed using regular expressions.

• Special Character and Punctuation Cleaning: All non-alphanumeric characters


were stripped to retain only meaningful text.

• Tokenization: The text was split into individual words or tokens to facilitate
further analysis.
• Stop Word Removal: Common English words (e.g., "the", "is", "at") that do not
contribute to sentiment were removed using NLTK’s stop word list.

• Lemmatization: Words were reduced to their base or dictionary form (e.g.,


"running" → "run") to normalize the text and reduce dimensionality.

These preprocessing steps played a crucial role in improving the signal-to-noise ratio, thus
enhancing the overall effectiveness of the model.

Feature Extraction:

Once cleaned, the textual data needed to be transformed into numerical form for machine
learning algorithms to process it. For this, the TF-IDF (Term Frequency–Inverse
Document Frequency) method was used. TF-IDF assigns weights to words based on how
frequently they appear in a given document compared to how rarely they appear across all
documents in the dataset. This helps in emphasizing important words and down-weighting
commonly used terms that carry little discriminatory power.

The resulting TF-IDF matrix was sparse but informative, representing each review as a
high-dimensional vector suitable for input into a classifier.

Model Training and Evaluation

Multiple machine learning algorithms were implemented and evaluated to identify the
most effective model for sentiment classification. These included:

• Naive Bayes: A probabilistic classifier known for its speed and simplicity.

• Logistic Regression: A linear model used for binary classification.

• Support Vector Machines (SVM): Known for handling high-dimensional data


well and producing strong performance in text classification tasks.

• Decision Trees: An interpretable model that splits the data based on feature values.
• Random Forest: An ensemble method combining multiple decision trees to reduce
overfitting and improve generalization.

The models were trained on 80% of the dataset and tested on the remaining 20% using
stratified sampling to maintain class balance. The following evaluation metrics were used:

• Accuracy: The overall correctness of the model.

• Precision: The proportion of positive predictions that were correct.

• Recall: The proportion of actual positive cases that were correctly identified.

• F1-score: The harmonic mean of precision and recall, providing a balance between
them.

Based on these metrics, the Logistic Regressor classifier emerged as the best-performing
model, achieving the highest F1-score, and was therefore chosen for final deployment.

Web Application Deployment:

To provide users with a practical and interactive interface, the trained model was deployed
using the Flask web framework. The Flask app features a simple, user-friendly interface
where users can input a movie review and receive an immediate sentiment prediction. The
application uses the serialized Random Forest model (saved using Joblib) to perform
predictions on user-submitted text. The backend processes the input, applies the same
preprocessing and TF-IDF transformation pipeline, and then passes the data to the
classifier.

The final result is rendered dynamically in the browser, making the system accessible and
useful for general users, researchers, or entertainment industry professionals seeking quick
sentiment insights.
CHAPTER 3: RESULT AND CONCLUSION

3.1 Results:

After completing the training and testing phases of the IMDb sentiment analyser, various
machine learning models were compared to determine the most effective classifier for
predicting the sentiment of movie reviews. The evaluation metrics used included
accuracy, precision, recall, and F1-score, providing a comprehensive assessment of
model performance on unseen data.

The results of the sentiment analysis model were promising and demonstrated the
effectiveness of machine learning techniques in understanding and interpreting natural
language. Among all the models tested, the Logistic Regressor classifier achieved the best
performance, with an accuracy of 86.5%, a precision of 86.6%, a recall of 86.6%, and
an F1-score of 86.7% on the test dataset. These metrics suggest that the model is highly
capable of correctly identifying both positive and negative sentiments. The confusion
matrix further validated the model’s performance, showing a balanced distribution of true
positives and true negatives with minimal false predictions.

Additional visualizations such as word clouds for positive and negative reviews, and a bar
chart comparing model accuracies, helped illustrate the differences in model behaviour and
keyword frequency. The TF-IDF vectorization technique played a crucial role in
improving classification by assigning appropriate importance to key terms, while text
preprocessing steps ensured noise-free inputs. The Flask-based web interface also
performed well, providing real-time sentiment predictions with a clean and user-friendly
experience.

Overall, the model's results confirm that machine learning algorithms, when properly
trained and tuned, can effectively analyse large-scale textual data like IMDb reviews.
However, slight inconsistencies in misclassifications highlight potential areas for
improvement, such as incorporating deep learning models or expanding the training dataset
with more nuanced sentiments.
Model Performance Comparison:

To determine the most effective algorithm for sentiment classification, multiple machine
learning models were trained and evaluated, including Naive Bayes, Logistic Regression,
Support Vector Machine (SVM), Decision Tree. Each model was assessed based on key
performance metrics such as accuracy, precision, recall, and F1-score. Among them, the
Random Forest classifier outperformed the others, demonstrating superior generalization
and robustness on unseen data. This comparison was crucial in selecting the optimal model
for deployment in the final sentiment analysis application.

Model Accuracy Precision Recall F1-Score

Naïve Bayes 84.3% 83.6% 85.2% 84.4%

Logistic Regression 86.5% 86.6% 86.6% 86.7%

Support Vector Machine 85.1% 84.1% 84.2% 83%

Decision Tree 83.2% 82.2% 84.0% 83.2%

As observed, the Logistic Regressor Classifier outperformed other models across all
metrics, making it the most suitable choice for deployment in the final web-based system.

Confusion Matrix Analysis:

The confusion matrix provides a detailed breakdown of the model’s classification


performance by showing the number of correct and incorrect predictions. It is composed of
four key components: true positives (TP), true negatives (TN), false positives (FP), and
false negatives (FN). In the context of sentiment analysis, true positives represent
correctly identified positive reviews, while true negatives are correctly identified negative
reviews. False positives occur when a negative review is mistakenly classified as positive,
and false negatives occur when a positive review is classified as negative. By analysing the
confusion matrix of the Logistics Regressor classifier, it was evident that the model
achieved a high rate of both true positives and true negatives, with minimal
misclassifications, indicating strong predictive performance and balanced sensitivity and
specificity.

Predicted Positive Predictive Negative

Actual Positive 15535 2468

Actual Negative 2337 15660

This matrix illustrates that the model achieved high sensitivity (recall) and specificity, with
a relatively low number of false positives and false negatives. The true positive and true
negative counts suggest reliable generalization to unseen reviews.

Visualization of Model Results:

Fig 4. The bar chart above visually compares the classification accuracy of four different
machine learning models used for sentiment analysis on IMDb reviews. Logistic
Regression emerged as the most accurate model among these, followed by Support Vector
Machine and Naive Bayes.

Fig. 4 “Accuracy of different Models”


Fig 5. The line plot illustrates the F1-scores of various machine learning models used for
sentiment analysis. Among them, Logistic Regression achieved the highest F1-score of
86.7%, indicating a strong balance between precision and recall. Naive Bayes followed
closely with 84.4%, while Support Vector Machine and Decision Tree showed slightly
lower F1-scores of 83.0% and 83.2% respectively. The plot emphasizes the superior
performance of Logistic Regression in maintaining classification consistency, while also
highlighting the relatively weaker generalization of models like Decision Tree when
handling diverse textual data.

Fig. 5 “F1-Score of different Models”

Fig 6. The confusion matrix provides a detailed breakdown of the model's performance by
comparing predicted labels against actual sentiment labels. In this case, the model correctly
classified 15,535 positive reviews as positive (true positives) and 15,660 negative
reviews as negative (true negatives). However, there were 2,468 positive reviews
incorrectly classified as negative (false negatives) and 2,337 negative reviews
misclassified as positive (false positives). These values suggest that while the model
demonstrates strong overall accuracy, there is a slightly higher tendency to misclassify
positive reviews as negative, indicating a minor imbalance that could be addressed with
further model tuning or data augmentation.

Fig. 6 “Confusion Matrix for Logistic Classifier”

Fig 7. The word cloud for positive reviews provides a visual representation of the most
commonly used terms in favourable user feedback. It effectively captures the recurring
themes, emotions, and expressions that dominate when users express satisfaction with a
movie. Larger font sizes within the cloud indicate higher frequency of usage, reflecting the
intensity and consistency of viewer appreciation. This visual tool aids in understanding
what elements consistently contribute to positive audience reactions, such as storyline,
acting, direction, or emotional impact. By summarizing vast textual data into an easy-to-
interpret format, the word cloud enhances the qualitative insight of sentiment analysis and
supports further exploration into what viewers value most in their entertainment
experience.
Fig. 7 “Word Cloud for Positive Reviews”

The word cloud for negative reviews visually summarizes the most frequent terms found in
critical or unfavourable user feedback. It highlights the dominant expressions and recurring
themes associated with dissatisfaction, with larger words representing terms that appear
more often in negative sentiment. This visualization provides valuable insight into
common pain points or shortcomings perceived by viewers, whether related to plot, pacing,
performances, or other aspects. By distilling a large volume of textual data into an
accessible format, the word cloud helps identify patterns in audience criticism, offering
filmmakers and analysts a clearer understanding of areas that may need improvement.

Fig. 8 “Word Cloud for Negative Reviews”


3.2 Discussion:

The results of this study highlight the effectiveness and practicality of Logistic Regression
in performing sentiment analysis on high-dimensional textual data, such as IMDb movie
reviews. Despite the availability of more complex algorithms, Logistic Regression proved
to be a highly efficient and reliable choice for this task, striking an optimal balance
between accuracy, interpretability, and computational efficiency. Its performance was
evident through consistently strong evaluation metrics, including high F1-score, precision,
and recall

The strength of the model can be largely attributed to the preprocessing pipeline and
feature extraction techniques employed during training. Textual data often contains noise,
inconsistencies, and irrelevant information, all of which were effectively handled through
preprocessing steps such as stop-word removal, lowercasing, stemming, punctuation
removal, and tokenization. Furthermore, the use of TF-IDF (Term Frequency–Inverse
Document Frequency) vectorization enabled the transformation of text into numerical
features by emphasizing important words and downplaying commonly occurring but less
informative ones.

Although deep learning models like LSTM and BERT offer advanced capabilities in
capturing contextual relationships within text, they require significantly more
computational power, memory, and training time. In contrast, Logistic Regression
provides a lightweight and faster alternative, especially suitable for real-time sentiment
analysis applications where speed and responsiveness are key.

Finally, integrating the trained Logistic Regression model into a Flask-based web
application enhanced the project’s practical appeal. This real-time interactive platform
allows users to input movie reviews and instantly receive sentiment predictions. It
demonstrates not only the technical validity of the model but also its applicability in real-
world scenarios, bridging the gap between machine learning research and end-user
engagement. The successful deployment of this application underlines the broader utility of
sentiment analysis tools in fields such as digital marketing, customer feedback analysis,
and entertainment industry analytics.
3.3 References:

1. Maas, A. L., Daly, R. E., Pham, P. T., Huang, D., Ng, A. Y., & Potts, C. (2011).
Learning Word Vectors for Sentiment Analysis. In Proceedings of the 49th Annual
Meeting of the Association for Computational Linguistics: Human Language
Technologies (pp. 142–150).

2. Bird, S., Klein, E., & Loper, E. (2009). Natural Language Processing with Python.
O’Reilly Media Inc.

3. Pedregosa, F., Varoquaux, G., Gramfort, A., Michel, V., Thirion, B., Grisel, O., ...
& Duchesnay, É. (2011). Scikit-learn: Machine Learning in Python. Journal of
Machine Learning Research, 12, 2825–2830.

4. McKinney, W. (2010). Data Structures for Statistical Computing in Python. In


Proceedings of the 9th Python in Science Conference, 445, 51–56.

5. Re, C. (2021). TF-IDF Explained – Term Frequency-Inverse Document Frequency.


Towards Data Science.

6. IMDb Datasets. (n.d.). IMDb – Internet Movie Database. Retrieved from

7. Flask Documentation. (n.d.). Flask Web Framework. Retrieved from

8. Loper, E., & Bird, S. (2002). NLTK: The Natural Language Toolkit. Proceedings of
the ACL-02 Workshop on Effective Tools and Methodologies for Teaching Natural
Language Processing and Computational Linguistics, 63–70.
3.4 Appendices:
The following appendices contain supplementary material referenced throughout this
project report. These materials provide additional context, data, and documentation that
support the findings and discussions presented in the main sections.

Raw Data:
This appendix contains the raw dataset used for the IMDb Movie Sentiment Analyzer
project. The dataset comprises approximately 150,000 movie reviews, each paired with a
corresponding rating on a scale from 1 to 10, as submitted by users on the IMDb platform.
These reviews were collected to analyse sentiment trends and train a machine learning
model capable of predicting sentiment (positive or neutral) based on user opinions. The
raw data includes both the textual content of the reviews and the numerical ratings. No
preprocessing (e.g., cleaning, normalization) has been applied in this appendix, ensuring
the original structure and content are preserved for transparency. This dataset forms the
backbone of the analysis, enabling insights into how numerical ratings align with textual
sentiment.
Fig. 9 “Raw Data”
Source Code:
This appendix includes the core source code developed for the IMDb Movie Sentiment
Analyzer project. The code was written in Python and makes use of libraries such as
Pandas, NumPy, Scikit-learn, NLTK. It covers all major components of the project,
including data loading, preprocessing, model building, training, evaluation, and prediction.

Requirements.txt: The requirements.txt file lists all the Python libraries and dependencies
required to run the IMDb Movie Sentiment Analyzer project. It ensures that the
development environment can be consistently recreated across different systems by
installing the exact versions of packages used. Key libraries include Pandas, NumPy,
Scikit-learn, NLTK, , and Matplotlib, among others. To set up the environment, users can
run the command pip install -r requirements.txt, which will automatically install all
listed packages. This file plays a crucial role in maintaining reproducibility and smooth
deployment of the project.

Blinker==1.8.2
click==8.1.7
colorama==0.4.6
contourpy==1.1.1
cycler==0.12.1
Flask==3.0.3
fonttools==4.54.1
importlib_metadata==8.5.0
importlib_resources==6.4.5
itsdangerous==2.2.0
Jinja2==3.1.4
joblib==1.4.2
kiwisolver==1.4.7
MarkupSafe==2.1.5
matplotlib==3.7.5
nltk==3.9.1
numpy==1.24.4
packaging==24.1
pandas==2.0.3
pillow==10.4.0
pyparsing==3.1.4
python-dateutil==2.9.0.post0
pytz==2024.2
regex==2024.9.11
scikit-learn==1.3.2
scipy==1.10.1
six==1.16.0
threadpoolctl==3.5.0
tqdm==4.66.5
tzdata==2024.2
Werkzeug==3.0.4
zipp==3.20.2

loaddata.py:

The loaddata.py script contains a function to load the IMDb dataset and preprocess it by
converting review ratings into binary sentiment labels. Ratings ≥ 7 are labelled as positive
(1), and ratings ≤ 4 as negative (0). Reviews with neutral ratings are excluded. This module
helps streamline data preparation for model training.

import pandas as pd

def load_dataset(path):

df = pd.read_csv(path, encoding='Latin-1')

df['Label'] = df['Ratings'].apply(lambda x: 1 if x>=7 else (0 if x<=4 else 2))

df = df[df.Label<2]

data = df[['Reviews','Label']]

return data
preprocessing.py:

The processing.py module contains functions to preprocess and clean the text data before
model training. It performs essential NLP tasks including removal of stop words, special
characters, and hyperlinks, and applies lemmatization to reduce words to their base form.
This step ensures that the input text is standardized and optimized for accurate sentiment
analysis.

#Customize stopword

from nltk.corpus import stopwords

from sklearn.base import BaseEstimator, TransformerMixin

from nltk import word_tokenize

from nltk.stem import WordNetLemmatizer

import re

import nltk

nltk.download('punkt_tab')

stop_words = stopwords.words('english')

new_stopwords=
["mario","la","blah","saturday","monday","sunday","morning","evening","friday","would"
,"shall","could","might"]

stop_words.extend(new_stopwords)

stop_words.remove("not")

stop_words=set(stop_words)
#Removing special character

def remove_special_character(content):

return re.sub('\W+',' ', content )

# Removing URL's

def remove_url(content):

return re.sub(r'http\S+', '', content)

#Removing the stopwords from text

def remove_stopwords(content):

clean_data = []

for i in content.split():

if i.strip().lower() not in stop_words and i.strip().lower().isalpha():

clean_data.append(i.strip().lower())

return " ".join(clean_data)

# Expansion of english contractions

def contraction_expansion(content):

content = re.sub(r"won\'t", "would not", content)

content = re.sub(r"can\'t", "can not", content)

content = re.sub(r"don\'t", "do not", content)


content = re.sub(r"shouldn\'t", "should not", content)

content = re.sub(r"needn\'t", "need not", content)

content = re.sub(r"hasn\'t", "has not", content)

content = re.sub(r"haven\'t", "have not", content)

content = re.sub(r"weren\'t", "were not", content)

content = re.sub(r"mightn\'t", "might not", content)

content = re.sub(r"didn\'t", "did not", content)

content = re.sub(r"n\'t", " not", content)

return content

#Data preprocessing

def data_cleaning(content):

content = contraction_expansion(content)

content = remove_special_character(content)

content = remove_url(content)

content = remove_stopwords(content)

return content

class DataCleaning(BaseEstimator,TransformerMixin):
def __init__(self):

print('calling--init--')

def fit(self,X,y=None):

print('calling fit')

return self

def transform(self, X,y=None):

print('calling transform')

X=X.apply(data_cleaning)

return X

# lemmatization of word

class LemmaTokenizer(object):

def __init__(self):

self.wordnetlemma = WordNetLemmatizer()

def __call__(self, reviews):

return [self.wordnetlemma.lemmatize(word) for word in word_tokenize(reviews)]

vectorizer.py:

The vectorizer.py module defines a class that implements text vectorization techniques
used to convert cleaned reviews into numerical form. It includes methods for both Bag of
Words (BoW) and TF-IDF (Term Frequency–Inverse Document Frequency) vectorization.
These methods transform textual data into feature vectors that can be used effectively by
machine learning models for sentiment classification.
from sklearn.feature_extraction.text import CountVectorizer

from sklearn.feature_extraction.text import TfidfVectorizer

from sklearn.base import BaseEstimator, TransformerMixin

# Bag of words Vectorizer

class BowVectors(BaseEstimator,TransformerMixin):

def __init__(self):

print('calling--init--')

self.bow_vectorizer = CountVectorizer()

def fit(self,df):

print('calling fit')

return self

def transform(self, df):

print('calling transform')

features = self.bow_vectorizer.transform(df)

return self.bow_vectorizer, features

# Tfidf Vectorizer

class TfidfVectors():

def __init__(self):

self.tfidf_vectorizer = TfidfVectorizer(lowercase=False,ngram_range=(1,1))
def __call__(self, df):

features = self.tfidf_vectorizer.fit_transform(df)

return self.tfidf_vectorizer, features

class Vectorizer:

def __init__(self, model):

self.vectorizer = model["VECT"]

def fit_transform(self, text_array):

try:

X = self.vectorizer.fit_transform(text_array)

# in case [text_array] was passed as an argument

except:

X = self.vectorizer.fit_transform([text_array])

return X

def transform(self, text_array):

try:

X = self.vectorizer.transform(text_array)

# in case [text_array] was passed as an argument


except:

X = self.vectorizer.transform(text_array[0])

return X

evaluation.py:

The evaluation.py module provides functions to evaluate the performance of the sentiment
analysis model. It includes tools to plot precision scores and generate a confusion matrix,
offering visual insights into the model’s accuracy, precision, recall, and overall
classification performance. These visualizations help in assessing how well the model
distinguishes between positive and negative sentiments.

from sklearn.metrics import precision_recall_curve

from sklearn.metrics import PrecisionRecallDisplay

import matplotlib.pyplot as plt

from sklearn.metrics import classification_report, confusion_matrix

def precision_score_plot(y_test,y_score):

precision, recall, thresholds = precision_recall_curve(y_test, y_score)

#create precision recall curve

fig, ax = plt.subplots()

ax.plot(recall, precision, color='purple')

#add axis labels to plot


ax.set_title('Precision-Recall Curve')

ax.set_ylabel('Precision')

ax.set_xlabel('Recall')

#display plot

plt.show()

def confusion_matrix_plot(y_test,y_score):

confmatrix = confusion_matrix(y_test,y_score)

fig, ax = plt.subplots(figsize=(8, 8))

ax.imshow(confmatrix)

ax.grid(False)

ax.xaxis.set(ticks=(0, 1), ticklabels=('Predicted 0s', 'Predicted 1s'))

ax.yaxis.set(ticks=(0, 1), ticklabels=('Actual 0s', 'Actual 1s'))

ax.set_ylim(1.5, -0.5)

for i in range(2):

for j in range(2):

ax.text(j, i, confmatrix[i, j], ha='center', va='center', color='red')

plt.show()
index.html:

The index.html file defines the frontend interface for the IMDb Sentiment Analyzer,
integrated using Flask. It provides a simple and user-friendly web interface where users
can input movie reviews and view the predicted sentiment (positive or negative). The
HTML layout includes form elements for text input and a submit button, with the response
displayed dynamically upon submission.

<!DOCTYPE html>

<html>

<head>

<title>Sentiment Analysis</title>

<link rel="stylesheet"
href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css">

</head>

<style>

body {

background-color: #f8f9fa; /* Set your desired background color */

.container {

margin-top: 50px;

}
h1 {

color: #007bff; /* Set your desired heading color */

.form-control {

background-color: #ffffff; /* Set your desired textarea background color */

.btn-primary {

background-color: #007bff; /* Set your desired button background color */

border-color: #007bff;

.btn-primary:hover {

background-color: #0069d9; /* Set your desired button hover background color */

border-color: #0062cc;

.alert-success {

background-color: #d4edda; /* Set your desired success alert background color */

color: #155724; /* Set your desired success alert text color */


border-color: #c3e6cb;

.alert-danger {

background-color: #f8d7da; /* Set your desired danger alert background color */

color: #721c24; /* Set your desired danger alert text color */

border-color: #f5c6cb;

</style>

<body>

<div class="container mt-5">

<h1 class="mb-4">Sentiment Analysis</h1>

<form method="POST" action="{{ url_for('predict') }}">

<div class="form-group">

<label for="comment">Enter your Review:</label>

<textarea class="form-control" name="review" rows="6"></textarea>

</div>

<button type="submit" class="btn btn-primary">Analyze</button>

</form>
{% if pred is defined %}

<div class="mt-4">

{% if pred == 1 %}

<div class="alert alert-success" role="alert">Positive comment!</div>

{% else %}

<div class="alert alert-danger" role="alert">Negative comment!</div>

{% endif %}

</div>

{% endif %}

<br>

<br>

<p style="font-size:90px"> &#128512; &#128516; &#128517; &#128525;


&#128531; &#128534; &#128544;</p>

</div>

</body>

</html>

main.py:

The main.py file serves as the central script that brings together all the modules of the
IMDb Sentiment Analyzer. It imports functions from loaddata.py, processing.py,
vectorizer.py, and evaluation.py to load, preprocess, vectorize, train, and evaluate the
model. After training, the final sentiment analysis model is saved using joblib for later use
in deployment via the Flask interface.

import sys

import os

import joblib

import datapreprocessing.preprocessing as dp

from datapreprocessing.preprocessing import DataCleaning

from datapreprocessing.preprocessing import LemmaTokenizer

from evaluation.evaluation import precision_score_plot, confusion_matrix_plot

from dataloader.loaddata import load_dataset

from sklearn.feature_extraction.text import CountVectorizer

from sklearn.feature_extraction.text import TfidfVectorizer

from sklearn.pipeline import FeatureUnion, Pipeline

from sklearn.model_selection import train_test_split

from sklearn.linear_model import LogisticRegression

from sklearn.ensemble import RandomForestClassifier

from sklearn.metrics import precision_recall_curve

from sklearn.metrics import PrecisionRecallDisplay

import matplotlib.pyplot as plt

from sklearn.metrics import classification_report, confusion_matrix

from sklearn.metrics import f1_score, roc_auc_score, precision_score, recall_score


#Loading of data

path = os.getcwd()+r'\Dataset'

data=load_dataset(path+'\IMDB-Dataset.csv')

#Split data

x_train, x_test, y_train, y_test = train_test_split(data['Reviews'], data['Label'],


test_size=0.01, random_state=42)

#Text classifier pipeline

text_clf = Pipeline(steps=[('clean', DataCleaning()),

('vect',TfidfVectorizer(analyzer = "word", tokenizer = LemmaTokenizer(),


ngram_range=(1,3),min_df=10,max_features=10000)),

('clf',LogisticRegression(penalty='l2',dual=False, tol=0.0001, C=1.0, solver='lbfgs',


max_iter=100, multi_class='auto', verbose=0, warm_start=False, n_jobs=None))])

#Train text classifier by using pipeline

text_clf.fit(x_train,y_train)

#Generate prediction on test data

y_predict=text_clf.predict(x_test)

y_score = text_clf.predict_proba(x_test)[:, 1]

#Evaluation of base model


print("Precision Score on test dateset for Logistic Regression: %s" %
precision_score(y_test,y_predict,average='micro'))

print("AUC Score on test dateset for Logistic Regression: %s" %


roc_auc_score(y_test,y_score,multi_class='ovo',average='macro'))

f1_score_train_1 =f1_score(y_test,y_predict,average="weighted")

print("F1 Score test dateset for Logistic Regression: %s" % f1_score_train_1)

confusion_matrix_plot(y_test, y_predict)

#Store base model

model_path = os.getcwd()+r'\models'

joblib.dump(text_clf, model_path+r'\classifier.pkl',compress=True)

sentimentanalyzer.py:

The sentiment_analyzer.py file is the Flask application that connects the trained sentiment
analysis model with the web interface. It loads the saved model and handles user input
from the index.html form. When a user submits a movie review, the app preprocesses the
input, vectorizes it, and uses the model to predict the sentiment, which is then displayed on
the webpage. This file enables real-time sentiment prediction through a simple and
interactive interface.

from flask import Flask,request,jsonify,render_template

import joblib

import pandas as pd

import datetime

import os
app = Flask(__name__)

#model_path = os.getcwd()+r'\sentimentanalysis\models\model'

model_path = os.getcwd()+r'\models'

classifier = joblib.load(model_path+r'\classifier.pkl')

def predictfunc(review):

prediction = classifier.predict(review)

if prediction[0]==1:

sentiment='Positive'

else:

sentiment='Negative'

return prediction[0],sentiment

@app.route('/', methods=['GET','POST'])

def predict():

if request.method == 'POST':

content = request.form.get('review')
review = pd.Series(content)

prediction,sentiment =predictfunc(review)

return render_template("index.html",pred=prediction,sent=sentiment)

return render_template("index.html")

if __name__ == '__main__':

#app.run(debug = True,port=8080)

app.run(host='0.0.0.0', debug=True)
Output:

Input:

This movie was absolutely fantastic, the story kept me hooked!


Input:

Terribly boring and a complete waste of time.


3.6 Scope for Further Work
While the current version of the IMDb Sentiment Analyzer successfully classifies movie
reviews as positive or negative, there is significant scope for improvement and expansion.
Future work can focus on the following areas:
1. Multiclass Sentiment Classification
Instead of binary sentiment (positive/negative), the model can be extended to
classify reviews into multiple sentiment levels (e.g., very positive, positive, neutral,
negative, very negative) for more nuanced analysis.

2. Support for More Languages


The current model supports only English reviews. Adding support for multilingual
sentiment analysis would broaden the tool's usability for global audiences.

3. Improved Preprocessing Using Advanced NLP Techniques


Using tools like spaCy or transformer-based tokenizers can improve preprocessing,
lemmatization, and entity recognition accuracy.

4. Deep Learning Models


Incorporating advanced deep learning models such as LSTM, BiLSTM, GRU, or
transformers like BERT can significantly enhance the model’s ability to capture
complex language patterns.

5. Real-time Review Monitoring


Integrate the system with a real-time API to monitor and analyze live reviews from
IMDb or other platforms.

6. Dashboard Integration
Develop a dashboard interface using tools like Dash or Streamlit to visualize
sentiment trends, word clouds, and user insights interactively.

7. Model Optimization for Deployment


Optimize the model for lightweight deployment on cloud platforms or mobile
devices, making it accessible in more practical environments.

8. Incorporate User Feedback Loop


Allow users to provide feedback on the model’s predictions to continuously
improve accuracy through active learning.
3.5 Conclusion:

The IMDb Sentiment Analyzer project successfully demonstrated the application of


machine learning techniques for natural language processing and sentiment classification.
By leveraging a large dataset of movie reviews, the system was able to learn patterns and
linguistic cues that differentiate positive sentiments from negative ones. The preprocessing
pipeline, including text cleaning, tokenization, stop word removal, and lemmatization,
played a crucial role in improving the quality of the input data.

Among the various models evaluated—such as Naive Bayes, Logistic Regression, SVM,
and Decision Trees—the Random Forest classifier emerged as the most effective,
achieving the highest F1-score and overall accuracy. The use of TF-IDF vectorization for
feature extraction further enhanced the model's performance by assigning appropriate
weights to significant terms in the review text.

In addition to building a high-performing sentiment classification model, the project also


integrated the system into a user-friendly web application using the Flask framework. This
allowed for real-time predictions, making the tool practical and accessible for everyday
users, content creators, and businesses looking to gauge public opinion on films.

Overall, the project illustrates the power of combining NLP techniques with machine
learning to extract meaningful insights from unstructured text data. While the current
system focuses on binary sentiment classification (positive/negative), it lays the foundation
for future extensions, such as multi-class sentiment analysis, emotion detection, or
multilingual support. With continued development, such systems can become even more
accurate, nuanced, and widely applicable in the realm of digital content analytics.

You might also like