Final Report
Final Report
I confirm that I understand my coursework needs to be submitted online via Google Classroom under the
relevant module page before the deadline in order for my assignment to be accepted and marked. I am
fully aware that late submissions will be treated as non-submission and a mark of zero will be awarded.
Acknowledgement
I would like to take this occasion to express my gratitude to Mr. Subash Basnet and Mr.
Bibek Khanal, our esteemed Project Supervisors, for their unwavering support and advice
throughout our final year project. Their continuous supervision and monitoring have been
really beneficial in completing this project.
I would also like to express my gratitude to our university and college for allowing us to
learn and work on a self-project. I am grateful to my helping teachers, faculty members,
and the entire Islington community for allowing us to grow with knowledge and wisdom.
Abstract
The following report is a compilation of final year project work that tracks the project's
overall progress. The introduction, background information, development progress
documents, project outcome, and future possible engagement are all included in this
report. The research culminates in a fully functional mobile application that performs
sentiment analysis on YouTube comments, tweets, and custom texts. Spam and sarcasm
detection are also included for a more reliable analysis. Being a social media assisting
platform, there is also a feature for connecting job seekers with providers. This project
employs a Multinomial Naive Bayes Probabilistic Classifier. Flutter and Flask are utilized
to create a user-friendly application. The project's backend API is hosted on the Heroku
platform.
5.4.2 Here’s how I will be further engaged on this project in future: ................. 115
ii. Using Flask over fully featured framework like Django ................................... 134
iii. Multinomial Naive Bayes algorithm over available package like TextBlob .. 134
Appendix 3: Software Requirement Specification ................................................. 135
Chapter 1: Introduction
This application is built for folks who need social media in their professional lives in some
way. Users can perform sentiment analysis on chosen YouTube video comments and
tweets using the developed platform. This platform allows social media-related job
recruiters and job seekers to connect with one another.
1
PRASHANT GHIMIRE
CS6PO5NI FINAL YEAR PROJECT
The comments, feedback and public opinion on social medias can be really
applicable for various purposes to companies, content creators and for similar
professions. User’s opinion data is available on the internet but there is lack of optimal
utilization of it. The prime difficulties I found in the social media engaged professionals
are:
i. The feedbacks of any range of customers can be truly important to sharpen the
qualities to a company, content creators and similar professionals but the lack of
proper tools, the power of feedbacks cannot be optimally utilized (John Hattie,
2007).
ii. The Online Labour Index (OLI) provides data related to gig economy (freelancers).
In 2017, the index reported that skills from diverse ranges were growing from all
around the world where USA was ahead for writing/translation and India was
ahead for software development and technology. Even with the availability of
multiple job searching platforms, the freelancers engaged in social media works
were found to have difficulties in connecting with their specific type of jobs (Rajat
Kathuria, 2017).
2
PRASHANT GHIMIRE
CS6PO5NI FINAL YEAR PROJECT
Contemplating the potential use cases of strong human presence in social medias and
my genuine interest in this, I was self-motivated to build my final year project and future
career in this sector. Sentimento is a portable platform or mobile application for
professionals who are engaged in any form of social media work. It is built primarily for
social media influencers and digital content creators who has presence in the social
media in a professional life. The professionals engaged in digital marketing/advertising,
mass psychology, political campaigns and similar field professionals can be benefited
from my built platform.
3
PRASHANT GHIMIRE
CS6PO5NI FINAL YEAR PROJECT
Sentimento, the platform I have developed is a tool for professionals who are
engaged in multiple forms of social media works like content creators, freelancers,
marketing personals, etc. The solutions that I have come up with to the previously stated
challenges are as follows:
i. To keep track of audience feedbacks, content providers can't look through every
single comment on their YouTube videos. This takes a long time and is frequently
unfeasible. The Sentimento platform may be used to scan comments in bulk and
content creators can be provided with a summary feedback report.
ii. Not every company or workforce affords expensive cost of data science team, the
platform can be utilized by marketing and advertisement agencies to find what
people are saying to particular things. At this stage of prototype level, YouTube
comments and Twitter tweets are available as means of data.
iii. Freelancers related to social media work can be connected with relevant work
vacancies in the platform. I considered this feature to include to solve the second
problem I mentioned in previous heading.
iv. Political Campaigns or similar events has their own objectives. To monitor what
people are saying about the particular event can be monitored from the platform
using tweets sentiment analysis to specific hashtag/topic.
4
PRASHANT GHIMIRE
CS6PO5NI FINAL YEAR PROJECT
The activities of my involvement or the objectives to fulfil the aim of the project are as
follows:
iii. To learn about backend and REST API development using Python’s Flask.
iv. To research and self-study about how can I implement the sentiment analysis part
in my project.
vi. To implement user interfaces and front-end development works on Flutter that I
learned from my internship period.
vii. To carry out database related works in real project that we have been learning from
first year of the college.
5
PRASHANT GHIMIRE
CS6PO5NI FINAL YEAR PROJECT
1.6.1 Background
1.6.2 Development
This section of the report documents the technical work performed during the
development of this project, including system design, database and system architecture,
frontend and backend development, software development methodology. This section of
the report also includes a survey done at various stages of project development, as well
as diagrammatic representations of various components of the solution. The codes for
various sections of the development, such as the algorithmic component, the
backend/frontend side, and the cloud hosting work, are also attached here with sufficient
elaboration.
6
PRASHANT GHIMIRE
CS6PO5NI FINAL YEAR PROJECT
This section of the project documentation offers a summary of the testing procedures for
the created system's various functionalities. The testing methods or plans for completing
system and unit testing are first thoroughly outlined. Under system testing, each of the
developed system's essential features is tested. Under unit testing, the smaller logical
functions or the interface with which the user interacts are also tested. The testing
procedure includes tabular data and screenshots of the interface depending on the
expected and actual/output results.
Following the testing, there is a critical analysis portion in which the overall testing,
whether the development went as intended, and other components of the development
work are critically examined, as well as personal experience.
1.6.4 Conclusion
The report's final but crucial section offers information on the project's legal, social, and
ethical difficulties. This section also includes the project's various use cases/benefits as
well as its limitations. This section of the documentation work also discusses additional
work that can be done to improve the project, how further studies in this topic can be done
in further studies of my academic and career pathway.
7
PRASHANT GHIMIRE
CS6PO5NI FINAL YEAR PROJECT
Chapter 2: Background
Sentimento, a social media assisting platform, can be used by various social media
related professionals. Primarily, we can categorize the end users based in following tree
structure:
8
PRASHANT GHIMIRE
CS6PO5NI FINAL YEAR PROJECT
The platform is designed and developed to fit all the previously mentioned potential
users. It clarifies that this project is not made for any particular client. The platform is
developed keeping in mind to fulfil the professional needs of potential users. The user
interface and database architecture are structured for all the general users of the platform.
9
PRASHANT GHIMIRE
CS6PO5NI FINAL YEAR PROJECT
The project was finished with the help of a variety of tools and technologies that were
already available in the community. The total solution is broken into numerous sections
in this part, and each module is well explained.
10
PRASHANT GHIMIRE
CS6PO5NI FINAL YEAR PROJECT
The above diagram depicts a graphical summary of the sentiment analysis workflow. The
flow of the process is depicted in the diagram above, from the beginning phase of
gathering data to the processing phases and finally to the finalization of sentiment scores.
11
PRASHANT GHIMIRE
CS6PO5NI FINAL YEAR PROJECT
Lexicon-based Approach
In this approach, a collection or dictionary of positive and negative labelled words are
required. For calculating the overall sentiment/polarity of the data, a function to sum the
average polarity of words is defined. The final average polarity is determined as the
overall sentiment (positive or negative) score for a sentence or a piece of testing data
(Mulvenna, 2015).
12
PRASHANT GHIMIRE
CS6PO5NI FINAL YEAR PROJECT
In supervised learning, there are multiple classification techniques like Decision Tree
Classifier, Linear Classifier, Rule Based Approach, Probabilistic Classifier. Each of these
classification approaches have their own certain variations and multiple algorithms.
Decision Tree Classifier can be used for both classification and regression problems. It is
a tree-structured classifier where there are decision node and leaf node. Decision nodes
are used to perform decision, have multiple branches whereas leaf nodes are output of
those decisions (Lior Rokach, 2015).
13
PRASHANT GHIMIRE
CS6PO5NI FINAL YEAR PROJECT
Let’s assume ‘c’ as shopping and ‘x’ as raining. The posterior probability denotes
the conditional probability of shopping when its already raining. P (x | c) denotes
probability of occurrence of rain while shopping. P (c) denotes probability of raining.
When there is occurrence of discrete features (e.g., word counts for text classification),
the multinomial naive bayes classifier is suitable option. It requires integer feature counts
and based on frequency of the features and its label or classification. It can be used in
multinomially distributed data (Scikit-learn, 2021).
14
PRASHANT GHIMIRE
CS6PO5NI FINAL YEAR PROJECT
Flask, a micro web framework has been utilized for the API development of the
sentimento project.
Reasons to use Flask over other backend tools for this project:
i. Flask is lightweight, only useful modules to our system can be imported, less space
consuming comparing to Django or other full-featured framework.
ii. Previous experience of working with Flask framework.
iii. Only API development is necessary with no need of user-interacting web pages.
So, there is no need to use web page templates. In such case, Flask is one of the
best tools.
Flutter, cross platform framework is used for the user interface development work
for the project.
15
PRASHANT GHIMIRE
CS6PO5NI FINAL YEAR PROJECT
Similar types of projects are sought from the project's research stage to
requirement analysis and development, and inspiration is collected to produce a better
solution for Sentimento's project.
It is an iOS application for tweets analysis based on hashtag. User has to choose
a topic to which analysis is performed. The tweets analysed and percentage distribution
of positivity/negativity found is shown in this platform (C9 Apps Desenvolvimento de
Software Ltda ME, 2017).
Figure 8 Sentiment analysis outcome between Taylor Swift and Jake Paul
16
PRASHANT GHIMIRE
CS6PO5NI FINAL YEAR PROJECT
It is an android application for tweets analysis. Users can choose the topic and
number of total tweets they want to analyse. The type of visualization output can also be
chosen whether they want to view in graph or pie-chart. There is option to choose
between polarity visualization and emotion. There is also feature to show recent searches
by a user. Maximum 100 recent tweets would be analysed and tweets would be 7 days
old. The application works with Naive Bayes Classifier and generates the sentiment in
positive and negative polarity (Jay Khatri, 2020).
Platform: Android
17
PRASHANT GHIMIRE
CS6PO5NI FINAL YEAR PROJECT
LinkedIn is considered as similar projects to mine because there will be social media
related job networking feature in my ‘Sentimento’ platform.
18
PRASHANT GHIMIRE
CS6PO5NI FINAL YEAR PROJECT
According to the information supplied in the Google Play application description, the
second project uses the Naive Bayes Classifier. Multinomial Naive Bayes is used in my
research to classify data as sarcastic or not. The frequency of an event occurring is
represented by Multinomial Nave Bayes. Because the goal is to increase the accuracy of
the analysis, improvements to the algorithm may be made in future sprints. However, the
Naive Bayes algorithm is set to be used in the classification section.
Personal view on how the developed solution is better than similar projects
Sentimento platform isn't just for analysing tweets. YouTube comments and custom
sentence/paragraphs are also supported. The sentiment report saving function allows
users to access reports in the future and compare sentiment discrepancies between past
and present sentiment changes on the same topic.
19
PRASHANT GHIMIRE
CS6PO5NI FINAL YEAR PROJECT
Chapter 3: Development
Software Development can be carried out following several methodologies based on each
project’s requirement and conditions. Waterfall, Agile, Rapid Application Development are
popular methodologies. These methodologies have smaller branches with certain
differences.
20
PRASHANT GHIMIRE
CS6PO5NI FINAL YEAR PROJECT
Waterfall
It is a linear and traditional approach of software development. Each phase of process is
carried out in sequential order. Next task is not executed without finishing the previous
one (Young, 2013).
Spiral Model
This model is appropriate for unique projects where there is high risk of project failure.
21
PRASHANT GHIMIRE
CS6PO5NI FINAL YEAR PROJECT
Unified Process
It is an interactive approach of development for larger projects with bureaucratic
development teams. The principles of this methodology stand between waterfall and agile
principles.
Agile
Agile principles are very adaptive towards change in requirements and plans. The minimal
cost and quality software are the key principles of agile methodology. It is similar to unified
process but iterations are much short period of time in agile.
The Scrum framework of agile methodology will be utilized for this project because
it is appropriate for this project type. Agile characteristics such as flexible work divisions
for individuals, working software over exhaustive documentation, and adapting to
changes are all part of the Scrum methodology. Each sprint of the scrum is dedicated to
completing specific tasks.
The Scrum methodology is about carrying out the project based on multiple sprints. In
each sprint, we carry out certain feature. Each sprint can be of one to two week long. The
tasks to be done, the tasks to be reviewed are maintained in scrum. There is no hard rule
for task assignment. Instead, the tasks can be chosen by each individual and primary
focus is for completion of tasks in a sprint. Products are built within certain time frame
and improves on each iteration from the previous one.
Three points to consider on sprint planning are as follows (Star Agile, 2020):
i. This is an individual project; all the tasks are self-done. Roles are not specified in
scrum but main focus is on task completion. This provides flexibility to carry out
multiple tasks in self-easiness.
iii. Technical challenges in my project are higher than documentation and scrum itself
is effective to develop product more than artifacts focus.
Product Owner, Scrum Master (Project Manager), Development Team are three roles in
Scrum project (Glamazdina, 2021). As this is an individual final year project, all the three
roles are allocated to myself as a sole performer of the project.
24
PRASHANT GHIMIRE
CS6PO5NI FINAL YEAR PROJECT
The functional and non-functional requirements, as well as product features, are recorded
at this phase for later implementation. The task description provided by the client is broken
down into smaller technical components to complete. The product owner or client party
meets with the scrum master to discuss the product's development. This engagement can
happen at any time during the development process.
The set of product backlog items are selected for the next sprint in this phase. Usually, a
sprint last about two weeks, the short duration sprints provide the opportunity to accept
client’s further feedback. This provides enough time to adapt new changes if required.
There is an additional benefit of extra time for bug addressing and debugging. After
breaking down the problem domains of the sprint into smaller tasks, scrum team is also
responsible for prioritizing the works (Star Agile, 2020).
25
PRASHANT GHIMIRE
CS6PO5NI FINAL YEAR PROJECT
Following the planning and appropriate coordination, this is the actual working stage on
the product. A task progress board is kept up to date. Task cards are divided into four
categories: tasks to accomplish, current tasks, tasks to review, and completed tasks.
Internal meeting of the developer team exists for less than 15minutes to synchronize the
tasks for next 24hours. The work inspection and work forecast of team members are
carried out for fine tuning of the product.
This phase is about viewing the tasks done in this sprint. The quality of the sprint or
deployment is evaluated and judged if any necessary changes are essential to make. The
product owner describes what product backlog items have been ‘done’ and what not. The
entire team collaborates on what to do next (Khristich, 2020).
26
PRASHANT GHIMIRE
CS6PO5NI FINAL YEAR PROJECT
v. Sprint retrospective
It is a final meeting and last phase of the scrum development process. It is attended by
product owner/client, scrum master and development team. This is time boxed for forty-
five minutes a week (Khristich, 2020).
Questions each team member answers in sprint retrospective are as follows (Linders,
2013):
i. What worked well in previous sprint.
ii. What did not work well, difficulties faced, requirements that were not fulfilled.
iii. What should be done differently, changes a team member want to make in working
process if any.
27
PRASHANT GHIMIRE
CS6PO5NI FINAL YEAR PROJECT
To obtain better and reliable data, the surveys were taken only from people who
regularly uses social media (Instagram, Snapchat, LinkedIn) in their professional life.
28
PRASHANT GHIMIRE
CS6PO5NI FINAL YEAR PROJECT
i. The survey shows nearly half of the social media users are aware about how
companies can use our social media activity data.
ii. Forty two percent approximate users not knowing about their user activity indicates
companies do not take sufficient steps to highlight how do they use their
information for multiple purposes.
iii. Sixteen percent of approximate users getting to know about how social media
companies use our data indicates movies and web series are helping to make
people understand about critical information.
29
PRASHANT GHIMIRE
CS6PO5NI FINAL YEAR PROJECT
Question 2: Do you think any valuable information can be extracted using user's
comment, tweets, and posts?
i. The answers from volunteers shows majority of the social media users who are
aware about their online data are also precisely confident on what data can be
useful for third factor use cases.
30
PRASHANT GHIMIRE
CS6PO5NI FINAL YEAR PROJECT
i. Almost half of the volunteers chooses to rarely comment on YouTube videos. This
indicates that there is high probability for most of the comments found on YouTube
are spam, unwanted promotions or sometimes scam initiations.
ii. The answers suggest to make a user’s opinion filtration system from bulk of spam
comments. This will help to perform sentiment analysis on reliable data excluding
senseless spam comments.
31
PRASHANT GHIMIRE
CS6PO5NI FINAL YEAR PROJECT
Question 4: Do you often tweet about ongoing internet topics, events or news?
i. The survey answer tells people are getting less interested to tweet about any
particular topics than in past. Before few years, the tweeting culture was booming
significantly.
ii. People’s awareness on data privacy has made people more conscious on where
to express themselves.
iii. Twenty six percent approximate users ready to tweet on critical social, global
issues indicates people are ready to unite and raise voice on any important issues.
32
PRASHANT GHIMIRE
CS6PO5NI FINAL YEAR PROJECT
Question 5: If there was a tool that will give you summary report of public sentiment on
any internet topics, will you use such tool?
i. Majority of the survey volunteers are interested in using tools that saves time to
understand mass sentiment on particular topic.
ii. One slice of a pizza or ten percent people are more interested to go through each
of the comments/tweets by themselves.
33
PRASHANT GHIMIRE
CS6PO5NI FINAL YEAR PROJECT
Question 6: Do you think, a separate platform to connect just social media related job
recruiter and job seeker is a better idea?
ii. The user’s interest rate makes job seeker and provider connecting feature to add
to the platform requirements.
34
PRASHANT GHIMIRE
CS6PO5NI FINAL YEAR PROJECT
Question 1: Which social media platforms do you want to use for obtaining mass
sentiment/opinion?
i. Majority of the answers from post-survey showed their interest to use both
YouTube and Twitter platform for sentiment analysis.
ii. Both platforms are now considered to integrate on Sentimento’s system after
requirement analysis.
35
PRASHANT GHIMIRE
CS6PO5NI FINAL YEAR PROJECT
Question 2: Do you want to use your own third-party access tokens or will it be easier for
you to not care about it?
Figure 20 Chart showing user's interest to use their own third-party credentials
i. The survey shows the platform will be used by both technical and non-technical
users.
ii. There is strong need to implement a system where user can either use their own
third-party access tokens or can be dependent with platform itself to serve both
type of users.
36
PRASHANT GHIMIRE
CS6PO5NI FINAL YEAR PROJECT
i. Survey report shows all post survey volunteers want to be logged in to the platform
unless they want to logout by themselves.
ii. All the potential users find logging in every time quite tedious. So, considering this,
bearer token mechanism will be used with no date expiry to keep user logged in.
37
PRASHANT GHIMIRE
CS6PO5NI FINAL YEAR PROJECT
Question 4: Choose one or many sentiment categories you want in the platform
i. Out of total nineteen responses, all the five sentiment categories are strongly
chosen.
ii. All the five sentiment labels will be considered for development work.
38
PRASHANT GHIMIRE
CS6PO5NI FINAL YEAR PROJECT
Question 5: Do you want to see what analysis you did the last time?
i. Nearly eighty percent of survey volunteers want to view their past sentiment
reports.
ii. Twenty one percent of people not agreeing to record their past reports is also a
considerable number of users. Considering this, instead of storing all the past
reports, the platform will have feature where users can save the sentiment report
if they want to.
39
PRASHANT GHIMIRE
CS6PO5NI FINAL YEAR PROJECT
Question 6: Do you think users should be limited on how many job vacancies they can
post at a time?
i. Eighty four percent of people are conscious about chances of false vacancies post
if users can post any number of vacancies.
ii. Near to 16 percent of people desires to post any number of vacancies they want.
Considering both type of users, a threshold limit of five posts can be made at a
time. Any previous post can be deleted to other new posts. This feature satisfies
both kind of user preferences.
40
PRASHANT GHIMIRE
CS6PO5NI FINAL YEAR PROJECT
After doing research about social media platforms, analysing what can be done for
the project with supervisors and evaluating the conducted survey results, following
requirement analysis has been done:
Functional requirements:
i. Primary Features
FR. 2 User can login to system with their credentials used on registration
System Requirement
SR. 3 User can provide their correct login credentials
SR. 4 Backend responds with login fail in case of invalid information or
else user will be forwarded to dashboard
FR. 3 User can perform sentiment analysis on YouTube comments and tweets
System Requirement
SR. 5 User can provide YouTube video URL or topic of tweet to perform
sentiment analysis
SR. 6 Backend responds with sentiment report if valid input is given by
user.
41
PRASHANT GHIMIRE
CS6PO5NI FINAL YEAR PROJECT
FR. 4 User can view open job vacancies and skill offering from other users of
platform
System Requirement
SR. 7 User can choose either job vacancies or freelancing services to
view
SR. 8 Backend responds with currently available vacancies posted by
other users of platform
FR. 5 User can post social media related job vacancies and their skill offering in the
platform
System Requirement
SR. 9 User can provide information about their vacancy or freelancing
skill.
SR. 10 Backend stores the data in the database that is accessible by
other users later
FR. 7 User can save and view their past sentiment analysis reports
System Requirement
SR. 13 User can have the option to save sentiment report for further
uses.
SR. 14 Backend stores the report in the database.
42
PRASHANT GHIMIRE
CS6PO5NI FINAL YEAR PROJECT
ii. Authentication
Bearer authentication tokens will be used by the system to authenticate user’s request to
backend.
Non-functional requirements:
ii. Scalability: The backend of the project is to be hosted in cloud for larger scale
accessibility of the project.
iii. Security: For user’s security reasons, the platform should not store third party
access tokens. Considering it, the tokens will be locally saved in user’s device.
43
PRASHANT GHIMIRE
CS6PO5NI FINAL YEAR PROJECT
44
PRASHANT GHIMIRE
CS6PO5NI FINAL YEAR PROJECT
45
PRASHANT GHIMIRE
CS6PO5NI FINAL YEAR PROJECT
46
PRASHANT GHIMIRE
CS6PO5NI FINAL YEAR PROJECT
47
PRASHANT GHIMIRE
CS6PO5NI FINAL YEAR PROJECT
48
PRASHANT GHIMIRE
CS6PO5NI FINAL YEAR PROJECT
49
PRASHANT GHIMIRE
CS6PO5NI FINAL YEAR PROJECT
50
PRASHANT GHIMIRE
CS6PO5NI FINAL YEAR PROJECT
51
PRASHANT GHIMIRE
CS6PO5NI FINAL YEAR PROJECT
52
PRASHANT GHIMIRE
CS6PO5NI FINAL YEAR PROJECT
53
PRASHANT GHIMIRE
CS6PO5NI FINAL YEAR PROJECT
54
PRASHANT GHIMIRE
CS6PO5NI FINAL YEAR PROJECT
55
PRASHANT GHIMIRE
CS6PO5NI FINAL YEAR PROJECT
56
PRASHANT GHIMIRE
CS6PO5NI FINAL YEAR PROJECT
57
PRASHANT GHIMIRE
CS6PO5NI FINAL YEAR PROJECT
Highlights of sprint 1
i. The initial user interface or tiny application using NLTK library is developed for
demo showcase showing small glance of how the system will look like.
58
PRASHANT GHIMIRE
CS6PO5NI FINAL YEAR PROJECT
ii. Faced memory allocation error while count vectorization of sentences and
decided to remove ‘not’ as stop words from sentences to fix issue but this
created another big issue of change of meaning of a sentence.
59
PRASHANT GHIMIRE
CS6PO5NI FINAL YEAR PROJECT
Highlights of sprint 2:
60
PRASHANT GHIMIRE
CS6PO5NI FINAL YEAR PROJECT
ii. Multinomial Naive Bayes module for both debug and production level
In the above code, ‘fit_transform’ method is used for training data whereas
‘transform’ method is used for testing data. This is done for removing exclusion biasness
from the system towards particular features. Exclusion biasness occurs if features of
training data are not evaluated just because it does not exist in testing data. ‘fit_transform’
is used for training data to learn mean and variance of the features from training data.
The mean and variance of the testing data needs to be new for our model so we use
‘transform’ for it (Khanna, 2020).
61
PRASHANT GHIMIRE
CS6PO5NI FINAL YEAR PROJECT
The scikit-learn library has been used for the Multinomial Naïve Bayes calculated.
The detailed theory is explained in the previous solution section of the report. There are
two functions which does the same work but one is for debug level which uses textual
training data for each run while the production ready function uses already existing trained
model.
In the production level, using the textual data for training data too can cost higher memory
usage. And it is not efficient to do for production. To shorten the runtime duration, once
calculated object of the run time of CountVectorizer class is dumped in external file. The
once calculated object of Multinomial class is also dumped in another external file. Saving
a machine learning model is also known as serialization (GeeksforGeeks, 2021).
62
PRASHANT GHIMIRE
CS6PO5NI FINAL YEAR PROJECT
This class is used to make objects of result of sentiment analysis by the backend
developed with flask and returns JSON response using the object created from this class.
63
PRASHANT GHIMIRE
CS6PO5NI FINAL YEAR PROJECT
For extracting both the third party’s data, their official API guidelines or documentation is
studied to make these two functions.
64
PRASHANT GHIMIRE
CS6PO5NI FINAL YEAR PROJECT
65
PRASHANT GHIMIRE
CS6PO5NI FINAL YEAR PROJECT
66
PRASHANT GHIMIRE
CS6PO5NI FINAL YEAR PROJECT
67
PRASHANT GHIMIRE
CS6PO5NI FINAL YEAR PROJECT
68
PRASHANT GHIMIRE
CS6PO5NI FINAL YEAR PROJECT
iii. Sign in, Signup user interfaces for front end application
Figure 52 Git commit showing front end user authentication pages task done
69
PRASHANT GHIMIRE
CS6PO5NI FINAL YEAR PROJECT
Highlights of sprint 5:
BLOC state management is utilized and all the essential remaining front-end tasks like
profile viewing, vacancy posting, managing coupons are completed during this long sprint.
State Management:
Business Logic Component (BLOC) is used for state management of the built Flutter
application. Building production level or qualitative applications, managing current state
becomes critical. State management helps many developers to collaborate and work in a
single code base seamlessly following pattern (Bloc Library, 2021).
For this application, multiple blocs are created for several use cases like authentication,
sentiment analysis, viewing vacancies. Wherever there is presence of multiple state like
data loading and loaded state, Bloc has been consumed in the application.
70
PRASHANT GHIMIRE
CS6PO5NI FINAL YEAR PROJECT
71
PRASHANT GHIMIRE
CS6PO5NI FINAL YEAR PROJECT
Highlights of sprint 6:
Normally while following Scrum in corporate or office environment, one sprint lasts
around one to four weeks. For this sprint (six) of the project, this sprint lasted quite longer
than a month as there were no past experiences of publishing a fully featured application
to Google Play Store. The policy issues and formalities to publish this application took
longer time making this sprint longer than usual Scrum’s sprint.
72
PRASHANT GHIMIRE
CS6PO5NI FINAL YEAR PROJECT
73
PRASHANT GHIMIRE
CS6PO5NI FINAL YEAR PROJECT
During the multiple sprints of development of this project ‘Sentimento’, the features
built or integrated in the platform are tested properly with brief documentation of the
individual test. The testing plans are listed below as following:
For the unit testing of this project, the individual interface components or functionalities of
the built Flutter application is to be tested with precision. Apart from the application where
user interacts, the built Flask API end points is also to be tested. The discrete end point
APIs for sentiment analysis, vacancy without user authorization token and all built
fragmentary backend logical parts are tested using Postman. Also, the access
authentication for third parties is also tested in unit testing of this project.
74
PRASHANT GHIMIRE
CS6PO5NI FINAL YEAR PROJECT
The unit testing plan for this project are listed in the table below as follows:
Test Id Objective
1 To check if user can register with already used credentials.
2 To check if user can login without being registered.
3 To check if user can be registered with valid credentials.
4 To check if user can login with valid credentials.
5 To check if user can login with invalid password.
6 To check if user can view their profile.
7 To verify user cannot access sentiment analysis feature without providing
tokens or coupons.
8 To test if user can access sentiment analysis feature after providing tokens
or coupons.
9 To test user can perform polarity check on manual sentences.
10 To test user cannot perform sentiment analysis with invalid coupon or token.
11 To test user can view their saved sentiment reports.
12 To verify user will be shown error message if no any sentiment reports are
saved.
13 To test if dashboard is responsive to screen size on multiple devices.
14 To show user can post a vacancy in the platform.
15 To show user cannot post more than five vacancies.
16 To show user redirects to phone call when presses contact button.
17 To verify user can delete their previously posted vacancy.
18 To test user can logout from the platform.
19 To show error message will be displayed if user tries to access saved reports
without internet connection.
20 To show user’s name and email in the interface when user is navigated from
login screen to dashboard.
Table 5 Unit testing for Flutter application
75
PRASHANT GHIMIRE
CS6PO5NI FINAL YEAR PROJECT
Test Id Objective
1 To read a user's profile without supplying a bearer token.
2 To show open vacancies can be viewed without user authentication.
3 To show user cannot delete another user’s vacancy post.
4 To show user cannot perform analysis on more than 2000 comments.
Table 6 Unit testing for Flask API
76
PRASHANT GHIMIRE
CS6PO5NI FINAL YEAR PROJECT
System testing is about validating that all the integrated systems are merged to make a
sole application perform its functionalities. Integration testing justifies the unity of team
work of the built platform. Those features included in the software requirement
specification document are tested in the system testing of this report.
The system testing plan for this project are listed in table below:
Test Id Objective
1 To validate backend server is live and responsive in cloud.
2 To show backend is properly integrated with frontend.
3 To show user can perform sentiment analysis on tweets.
4 To show user can save sentiment report.
Table 7 System testing for built platform
77
PRASHANT GHIMIRE
CS6PO5NI FINAL YEAR PROJECT
81
PRASHANT GHIMIRE
CS6PO5NI FINAL YEAR PROJECT
Action Valid email address and invalid password was provided to login.
Expected Result User will be shown error message.
Actual Result After clicking login button, loading interface was shown and toast
message about incorrect password was shown.
Conclusion User cannot log in to the platform with incorrect password which
makes this test successful.
Table 12 Unit test 5
84
PRASHANT GHIMIRE
CS6PO5NI FINAL YEAR PROJECT
UT7: To verify user cannot access sentiment analysis feature without providing tokens
or coupons.
UT8: To show user can access sentiment analysis feature after providing tokens or
coupons.
87
PRASHANT GHIMIRE
CS6PO5NI FINAL YEAR PROJECT
88
PRASHANT GHIMIRE
CS6PO5NI FINAL YEAR PROJECT
UT10: To show user cannot perform sentiment analysis with invalid coupon.
89
PRASHANT GHIMIRE
CS6PO5NI FINAL YEAR PROJECT
UT11: To verify that user can view their saved sentiment reports.
Action ‘My Reports’ button was clicked then ‘Show Details’ was clicked.
Expected Result All the saved sentiment reports were expected to appear.
Actual Result All the saved reports were shown in order.
Conclusion User can view their saved reports stating this test is successful.
Table 18 Unit test 11
UT12: To verify user will be shown error message if no any sentiment reports are saved.
91
PRASHANT GHIMIRE
CS6PO5NI FINAL YEAR PROJECT
93
PRASHANT GHIMIRE
CS6PO5NI FINAL YEAR PROJECT
Action All the fields were filled and ‘Post vacancy’ button was clicked.
Expected Result A toast message would be shown.
Actual Result A toast message stating vacancy posted on the platform was shown.
Conclusion The vacancy was added which states test is successful.
Table 20 Unit test 14
Action A new vacancy is tried to add from the user account which already
has five active posts.
Expected Result A toast message would be shown.
Actual Result A toast message stating vacancy posted on the platform was shown.
Conclusion The vacancy was added which states test is successful.
Table 21 Unit test 15
Figure 76 User having five open vacancies trying to add another new vacancy
95
PRASHANT GHIMIRE
CS6PO5NI FINAL YEAR PROJECT
UT16: To show user navigates to phone call when presses contact button.
96
PRASHANT GHIMIRE
CS6PO5NI FINAL YEAR PROJECT
Action ‘Delete Post’ button was pressed from detailed view of a freelancer.
Expected Result User will be taken to dashboard after deleting with a toast message.
Actual Result Dashboard was opened with a message stating post deleted.
Conclusion The feature worked as expected which states test is successful.
Table 23 Unit test 17
97
PRASHANT GHIMIRE
CS6PO5NI FINAL YEAR PROJECT
98
PRASHANT GHIMIRE
CS6PO5NI FINAL YEAR PROJECT
UT19: To verify that error message will be displayed if user tries to access saved reports
without internet connection.
Action Both the Wi-Fi and cellular data was turned off and ‘My Reports’ was
clicked.
Expected Result A toast message would be shown.
Actual Result A toast message about no internet was shown.
Conclusion The feature worked as expected which states test is successful.
Table 25 Unit test 19
99
PRASHANT GHIMIRE
CS6PO5NI FINAL YEAR PROJECT
UT20: To show user’s name and email in the interface when user is navigated from login
screen to dashboard.
100
PRASHANT GHIMIRE
CS6PO5NI FINAL YEAR PROJECT
Action HTTP GET request was done on profile viewing backend URL
Expected Result An error message would be provided.
Actual Result Error message about missing authorization header was shown.
Conclusion The test is successful.
Table 27 Unit test 21
101
PRASHANT GHIMIRE
CS6PO5NI FINAL YEAR PROJECT
103
PRASHANT GHIMIRE
CS6PO5NI FINAL YEAR PROJECT
UT24: To show user cannot perform analysis on more than 2000 comments.
Action Video id, API key and 5000 number of comments were given as input
for post request.
Expected Result Sentiment analysis would be prevented and error message would
be provided in response.
Actual Result Message guiding how many comments can be taken was shown in
API response.
Conclusion The backend is throttled from bulk comments analysis stating the
test successful.
Table 30 Unit test 24
104
PRASHANT GHIMIRE
CS6PO5NI FINAL YEAR PROJECT
Action Curl command was applied to domain of the hosted API from
command prompt.
Expected Result The built API documentation would be shown.
Actual Result JSON format information was shown.
Conclusion The Flask built backend API hosted on Heroku transferred data as
response which states server is live and test is successful.
Table 31 System test 1
105
PRASHANT GHIMIRE
CS6PO5NI FINAL YEAR PROJECT
107
PRASHANT GHIMIRE
CS6PO5NI FINAL YEAR PROJECT
Action Android Emulator was selected from VS Code and ‘flutter run’
command was executed from the terminal.
Expected Result The application was expected to be opened in Android emulator.
Actual Result Application was opened after 8.2 second of compilation without any
errors.
Conclusion This test is successful as application opened as expected.
Table 35 System test 5
109
PRASHANT GHIMIRE
CS6PO5NI FINAL YEAR PROJECT
The above documented unit and system testing demonstrates that all the
requirements are considered and implemented in this platform. By following the SCRUM
principle while carrying out the project, the development was completed within allocated
timeframe and enough time was available for additional improvements.
One of the testings failed for this project. The error was faced in frontend part of the
project. User’s name and email was not shown in the top of profile on first login. This error
existed as there was no state management applied for this part. Apart from this, all the
testings were successful. To summarize the carried-out test, following points are written
as follows:
ii. Frontend, backend was fully integrated and worked all together.
iii. All the validation, data throttling and logical parts of the interface worked as
expected.
iv. The state management worked smooth and loading screens were shown in every
buffering stage for better user experience.
110
PRASHANT GHIMIRE
CS6PO5NI FINAL YEAR PROJECT
Chapter 5: Conclusion
Here’s how the platform is built to prevent any professional issues from happening:
i. Users are trusting with their personal information while using this app,
understanding this, passwords are hashed before storing in database. The email that user
provides while registering in the platform is not visible to third person/parties.
ii. The third party’s (YouTube and Twitter) API key user has to enter to perform
sentiment analysis are user’s sensitive information. Keeping this in mind, those API keys
are not stored in system’s database. Instead, the keys are encrypted and locally saved in
the user’s device.
iii. To prevent bad actors from posting spam vacancies, the system throttles users to
post only five open vacancies at a time.
iv. There might be any incorrect information while posting vacancy by user. In such
case user wants to remove such misinformation. Considering this, there is a feature to
delete previous posts.
111
PRASHANT GHIMIRE
CS6PO5NI FINAL YEAR PROJECT
5.2 Advantages
For the artificial intelligence or machine trained model to better communicate with
humans, there is need for machines to understand the human sentiments. Thus, the
application of sentiment analysis is not only limited to human uses but also to artificial
intelligence. The tasks where humans are better than machines at this stage can be
replaced by machines themselves with the better sentiment consumption by machines.
There are endless areas where sentiment analysis can be performed as it carries huge
potential use cases. And it is one of the emerging, innovative and applicable area for the
present and future human society (Somers, 2019).
112
PRASHANT GHIMIRE
CS6PO5NI FINAL YEAR PROJECT
i. Users can view/add posts about freelancing service and job vacancies related to
social media field.
ii. Data analysts can quickly perform sentiment analysis and extract summary from
the platform for their any sorts of use case.
iii. Marketing professionals can observe current public sentiment about any public
figures and compare among them which can be useful for decision taking about
collaborating with best influencers.
iv. Social media influencers can observe audience’s feedbacks on their content and
publish further content accordingly.
v. Public sentiment regarding any topic can also be useful for news media
professionals. Also, other users can also benefit from this feature.
113
PRASHANT GHIMIRE
CS6PO5NI FINAL YEAR PROJECT
5.3 Limitations
Challenges that can arise while performing sentiment analysis are listed below:
(Mohammad, 2016)
i. Irony and Sarcasm: People uses sarcasm and ironic sentences to express the
meaning. In such cases, the real point they want to make can be one thing but the straight
sentence can mean something different. Even human can find it difficult to understand
sometimes which makes more difficult for trained models to predict the actual meaning.
ii. Context and Polarity: As trained model works within the provided boundaries, it’s
hard to understand the actual sentiment according to the context. Example: the opinion
can be regarding something but the context can be different. Here the calculated
sentiment polarity does to belong to real context resulting less trustworthy analysis.
iii. Stop words: The stop words are better to remove for reducing the numerical
vectorized array of data. This can save memory and better performance but removal of
stop words can alter the meaning of a sentence. Example: In the sentence ‘I do not like
you’. When ‘not’ stop word is removed while pre-processing, the meaning changes. So,
it is challenging to deal with stop words.
114
PRASHANT GHIMIRE
CS6PO5NI FINAL YEAR PROJECT
Using Flutter to build the frontend part of this project and my past internship on this
framework improved my Flutter knowledge and hands-on experience. This provided me
the confidence and certain level of quality to engage in mobile application to smoothly
transit from academic to professional life.
Being a data enthusiast from early days of entering technology field, there is
always a keen interest of pursuing Data Science for my post graduate studies. This is an
undergraduate academic work but I will be engaged in this same field even after the
completion of this undergraduate project.
The further aim of mine is to improve space and time complexity of the sentiment analysis
part of this project. The accuracy of the analysis at this level is also not well reliable.
Further research and theoretical findings from multiple scholars will be absorbed to
improvise the quality of this work. And there is a significant possibility to purse this same
topic for my post-graduate thesis work.
115
PRASHANT GHIMIRE
CS6PO5NI FINAL YEAR PROJECT
Chapter 6: References
Excluding theoretical research for carrying out this project, there is also use of
diverse contents that assisted in executing development work of the project. Attachment
of all the references that were accessed during or before the development of this project
are as follows:
i. LinkedIn learning course for building Flask API by Bruce Van Horn
116
PRASHANT GHIMIRE
CS6PO5NI FINAL YEAR PROJECT
ii. Flask official documentation: While performing CRUD operations and making
models for database, Flask’s official documentation was surfed for class, methods using
guide.
iii. Flutter package manager: It is an official package manager where developers can
contribute their work and enormous cross-platform application components are available
here.
117
PRASHANT GHIMIRE
CS6PO5NI FINAL YEAR PROJECT
iv. Stack overflow community: When there was run-time error building frontend or
backend, stack overflow was surfed to view how developers faced and solved similar
issues in the past. With such reference, the debugging and solving run-time errors were
smooth.
v. Scikit-learn: For the sentiment analysis (Multinomial Naive Bayes algorithm) part
of the project, scikit-learn, a machine learning library has been used.
118
PRASHANT GHIMIRE
CS6PO5NI FINAL YEAR PROJECT
Chapter 7: Bibliography
Aqeel, A., 2020. BLoC (Local & Global) State Management with Flutter. [Online]
Available at: https://devmuaz.medium.com/bloc-local-global-state-management-with-
flutter-e8e443b135f8
[Accessed 23 March 2022].
Binita Verma, R. S. T., 2018. Sentiment Analysis Using Lexicon and Machine Learning-
Based Approaches: A Survey. Bhopal, Maulana Azad National Intitute of Technology.
Bloc Library, 2021. Why Bloc?. [Online]
Available at: https://bloclibrary.dev/#/whybloc
[Accessed 2 April 2022].
C9 Apps Desenvolvimento de Software Ltda ME, 2017. TSentiment. s.l.:C9 Apps
Desenvolvimento de Software Ltda ME.
Doshi, S., 2021. Why I Prefer Flutter Over React Native for App Development. Web Dev
Zone, 23 August, pp. 2-4.
GeeksforGeeks, 2021. Saving a machine learning Model. [Online]
Available at: https://www.geeksforgeeks.org/saving-a-machine-learning-model/
[Accessed 10 January 2022].
GeeksforGeeks, 2021. Software Engineering | Quality Characteristics of a good SRS.
[Online]
Available at: https://www.geeksforgeeks.org/software-engineering-quality-
characteristics-of-a-good-srs/
[Accessed 9 December 2021].
Glamazdina, Y., 2021. A Guide to the Agile Software Development Life Cycle (SDLC).
[Online]
Available at: https://brocoders.com/blog/agile-software-development-life-cycle/
[Accessed 26 March 2022].
Hamilton, T., 2022. Integration Testing: What is, Types, Top Down & Bottom Up
Example. [Online]
Available at: https://www.guru99.com/integration-testing.html
[Accessed 28 March 2022].
119
PRASHANT GHIMIRE
CS6PO5NI FINAL YEAR PROJECT
Jay Khatri, I. K., 2020. Sentiment Analysis - Know The Opinion. s.l.:Jay Khatri.
Jha, V., 2017. Naive Bayes - machine learning algorithm for classification problems.
[Online]
Available at: https://www.techleer.com/articles/200-naive-bayes-machine-learning-
algorithm-for-classification-problems/
[Accessed 07 December 2021].
John Hattie, H. T., 2007. The Power of Feedback, Auckland: University of Auckland.
Khanna, C., 2020. What and why behind fit_transform() and transform() in scikit-learn!.
[Online]
Available at: https://towardsdatascience.com/what-and-why-behind-fit-transform-vs-
transform-in-scikit-learn-78f915cf96fe
Khorikov, V., 2020. Unit Testing: Principles, Practices and Patterns. 1st ed. Shelter
Island: Manning Publications.
Khristich, S., 2020. The Scrum Cycle in Agile Software Development. [Online]
Available at: https://tateeda.com/blog/the-scrum-cycle-in-agile-software-development
[Accessed 17 Febraury 2022].
Linders, B., 2013. Which Questions do you Ask in Retrospectives?. [Online]
Available at: https://www.benlinders.com/2013/which-questions-do-you-ask-in-
retrospectives/
[Accessed 28 March 2022].
LinkedIn, 2021. About LinkedIn. [Online]
Available at: https://about.linkedin.com/
[Accessed 8 December 2021].
Lior Rokach, O. M., 2015. Decision Trees, Tel Aviv: Oded Maimon Department of
Industrial Engineering.
Liu, J., 2016. Data Visualization on Sentiment Analysis. Chicago: Jiaqi Liu.
Ludvig Persson, J. L., 2018. Sarcasm Detection with TensorFlow, Stockholm: School of
Electrical Engineering and Computer Science.
Mohammad, S. M., 2016. Challenges in Sentiment Analysis, Ottawa: National Research
Council Canada.
120
PRASHANT GHIMIRE
CS6PO5NI FINAL YEAR PROJECT
Mulvenna, J. A., 2015. Improved lexicon-based sentiment analysis for social media
analytics, Belfast: Queen's University Belfast - Research Portal.
Perisic, M., 2014. The Good, The Bad and The Ugly of Agile Software Development.
[Online]
Available at: https://www.linkedin.com/pulse/20141106203747-11592828-the-good-the-
bad-and-the-ugly-of-agile-software-development/
[Accessed 1 April 2022].
Prokopisko, A., 2019. Software development life cycle. [Online]
Available at: https://medium.com/@artjoms/software-development-life-cycle-sdlc-
6155dbfe3cbc
[Accessed 04 April 2022].
Rajat Kathuria, M. K. G. V. K. B. S. K., 2017. Future of Work in a Digital Era: The
Potential and Challenges for Online Freelancing and Microwork in India, New Delhi:
INDIAN COUNCIL FOR RESEARCH ON INTERNATIONAL ECONOMIC RELATIONS.
Saifee Vohra, J. T., 2013. Applications and Challenges for Sentiment Analysis : A
Survey. International Journal of Engineering Research & Technology (IJERT), 2(2), pp.
3-5.
Samadhan Engineering, 2021. Services: Artificial Intelligence Applications. [Online]
Available at: https://www.thesamadhan.com/services/artificial-intelligence-applications
[Accessed 13 December 2021].
Scikit-learn, 2021. User Guide: Naive Bayes. [Online]
Available at: https://scikit-learn.org/stable/modules/naive_bayes.html#multinomial-naive-
bayes
[Accessed 14 Decembwr 2021].
scrum.org, 2020. What is Scrum?. [Online]
Available at: https://www.scrum.org/resources/what-is-scrum
[Accessed 21 November 2021].
Shimon Ullman, T. P., 2014. Unsupervised learning, Massachusetts: Massachusetts
Institute of Technology.
Somers, M., 2019. Emotion AI, explained. Massachusetts: MIT Management Sloan
School.
121
PRASHANT GHIMIRE
CS6PO5NI FINAL YEAR PROJECT
Sommerville, I., 2011. Software Requirement Documents. In: M. H. Marcia Horton, ed.
SOFTWARE ENGINEERING. Hagerstown: Pearson, pp. 91-98.
Stanford Edu, 2009. Properties of Naive Bayes. [Online]
Available at: https://nlp.stanford.edu/IR-book/html/htmledition/properties-of-naive-bayes-
1.html
[Accessed 18 December 2021].
Star Agile, 2020. Overview of Scrum Phases. [Online]
Available at: https://staragile.com/blog/scrum-phases
[Accessed 6 April 2022].
Walaa Medhat, A. H. H. K., 2014. Sentiment Analysis Algorithms and applications. Ain
Shams Engineering Journal, V(8), pp. 1093-1113.
Young, D. C., 2013. Software Development Methodologies. Huntsville: Alabama
Supercomputer Center.
122
PRASHANT GHIMIRE
CS6PO5NI FINAL YEAR PROJECT
Chapter 8: Appendix
i. Gantt chart
123
PRASHANT GHIMIRE
CS6PO5NI FINAL YEAR PROJECT
124
PRASHANT GHIMIRE
CS6PO5NI FINAL YEAR PROJECT
125
PRASHANT GHIMIRE
CS6PO5NI FINAL YEAR PROJECT
126
PRASHANT GHIMIRE
CS6PO5NI FINAL YEAR PROJECT
v. Product Backlog
127
PRASHANT GHIMIRE
CS6PO5NI FINAL YEAR PROJECT
128
PRASHANT GHIMIRE
CS6PO5NI FINAL YEAR PROJECT
129
PRASHANT GHIMIRE
CS6PO5NI FINAL YEAR PROJECT
130
PRASHANT GHIMIRE
CS6PO5NI FINAL YEAR PROJECT
131
PRASHANT GHIMIRE
CS6PO5NI FINAL YEAR PROJECT
132
PRASHANT GHIMIRE
CS6PO5NI FINAL YEAR PROJECT
133
PRASHANT GHIMIRE
CS6PO5NI FINAL YEAR PROJECT
Business Logic Component (BLOC) is recommended by Google itself for any state
management related tasks in Flutter application. There is a need to use state
management for quality applications where managing state becomes significant action.
There is a need of tracking the current state of the application to navigate through multiple
user interfaces and passing data using their models. Multiple developers can work in the
same project as workloads are divided into multiple modules. The interface design codes
and logical codes are separately written in BLOC pattern (Bloc Library, 2021).
For this project, we need backend to develop only API excluding any views like
web pages. If Django or other fully fetched framework was used, it would only cause extra
space which is not a good practise. And Django provides most of the work done by itself
with its REST framework. Using such pre-built method, there would be less learning
opportunities. Instead, I found it better to write own functions while using Flask as it is a
microframework and there is a need to import other modules as per need.
iii. Multinomial Naive Bayes algorithm over available package like TextBlob
Packages like TextBlob, Vader has the functionality to calculate polarity by itself.
There would be no learning opportunities on supervised machine learning if the project
was fully depended on such libraries. So, the plan was made to break down analysis into
spam, sarcasm labels. Labelled data models were used from Kaggle (data model source)
and using Multinomial Naïve Bayes of Ski-kit learn, the labels of testing datasets were
performed. This provided me the learning opportunity and certain level of experience on
supervised learning.
134
PRASHANT GHIMIRE
CS6PO5NI FINAL YEAR PROJECT
Project: Sentimento
“Social media assisting platform with sentiment analysis”
Introduction
The qualities of a clear and in-depth SRS document are as follows (GeeksforGeeks,
2021):
i. The requirements stated by client or feedbacks from surveys are clearly addressed
in the document.
135
PRASHANT GHIMIRE
CS6PO5NI FINAL YEAR PROJECT
ii. All the must have functional and non-functional requirements are properly
attached.
iii. Preciseness over ambiguousness is another essential quality for a good SRS
document.
iv. It is better for a SRS document to be easily modifiable as requirements of a project
in SCRUM of Agile are prone to have changes or improvements in the further
iterations of the project.
v. The SRS document is also made for client or non-technical viewers. It is a good
practise to make this document easily understandable with use of simpler
language and terms.
136
PRASHANT GHIMIRE
CS6PO5NI FINAL YEAR PROJECT
Purpose
The core purpose of this mobile application is to provide a user-friendly platform where
non-technical and technical (with understanding of Data Analytics) users can perform
sentiment analysis within same interface.
This document is primarily intended for the development team of the Sentimento
project. Developers from algorithm team, backend and frontend including other team
members engaged in technical and non-technical areas are the key readers/viewers of
this document. The client of the project or potential users can also read this document to
verify their demands are included in the document.
Viewing all the features to include in the platform, developers can identify and plan
their moves accordingly. The vocal hearing from the client is not consistent and official
but this document with client’s approval provides clear vision on what to do and how to
implement those essential features in the platform. This document can also be a proof of
record of tasks to carry out for both the parties (client and development team).
137
PRASHANT GHIMIRE
CS6PO5NI FINAL YEAR PROJECT
Contents
User’s need:
From the feedbacks of pre-survey, a mobile application with easy-to-use interfaces
is to be developed where they can just provide video URL or topic of tweet. And just with
this little information, users should be able to do their sentiment analysis task. The
demand of a social media related job vacancies posting/viewing feature is also
considered to include in the system.
The development work of this project is first divided into four sections and carried
out sequentially. The four sections are as follows:
Two functions are to be made to extract comments of a chosen video of YouTube and
tweets using each of the respective third-party documentation. After that, a function to
clean the data is made and using Multinomial Naive Bayes functionality of scikit-learn and
training data models, sentiment analysis module is developed.
Flask framework will be used to make the application programming interface (API) of the
system. The CRUD operations and sentiment analysis module will be integrated with this
part of the development and it interacts with the frontend part of the system to complete
the overall usefulness of the system.
138
PRASHANT GHIMIRE
CS6PO5NI FINAL YEAR PROJECT
Heroku, a cloud hosting service is to be used to host the Python backend. The free
account with zero payment to make service will be utilized to make the platform’s API live.
The mobile application is estimated to publish on Google Play Store if the developed
application at the end fulfils all the policy requirements of publishing application on Play
Store.
139
PRASHANT GHIMIRE
CS6PO5NI FINAL YEAR PROJECT
Requirements
Functional requirements:
i. Primary Features
FR. 2 User can login to system with their credentials used on registration
System Requirement
SR. 3 User can provide their correct login credentials
SR. 4 Backend responds with login fail in case of invalid information or
else user will be forwarded to dashboard
FR. 3 User can perform sentiment analysis on YouTube comments and tweets
System Requirement
SR. 5 User can provide YouTube video URL or topic of tweet to perform
sentiment analysis
SR. 6 Backend responds with sentiment report if valid input is given by
user.
140
PRASHANT GHIMIRE
CS6PO5NI FINAL YEAR PROJECT
FR. 4 User can view open job vacancies and skill offering from other users of
platform
System Requirement
SR. 7 User can choose either job vacancies or freelancing services to
view
SR. 8 Backend responds with currently available vacancies posted by
other users of platform
FR. 5 User can post social media related job vacancies and their skill offering in the
platform
System Requirement
SR. 9 User can provide information about their vacancy or freelancing
skill.
SR. 10 Backend stores the data in the database that is accessible by
other users later
FR. 7 User can save and view their past sentiment analysis reports
System Requirement
SR. 13 User can have the option to save sentiment report for further
uses.
SR. 14 Backend stores the report in the database.
141
PRASHANT GHIMIRE
CS6PO5NI FINAL YEAR PROJECT
ii. Authentication
Bearer authentication tokens will be used by the system to authenticate user’s request to
backend.
Non-functional requirements:
ii. Scalability: The backend of the project is to be hosted in cloud for larger scale
accessibility of the project.
iii. Security: For user’s security reasons, the platform should not store third party
access tokens. Considering it, the tokens will be locally saved in user’s device.
142
PRASHANT GHIMIRE
CS6PO5NI FINAL YEAR PROJECT
Approval
The platform is designed and developed to fit all the potential users like data
analyst, marketing and news media professionals and social media related job
seeker/provider. It clarifies that this project is not made for any particular client. The
platform is developed keeping in mind to fulfil the professional needs of potential users.
The user interface and database architecture are structured for all the general users of
the platform.
This project is designed to suit the interest of multiple or large-scale users, there is no
any particular client of this project to approve this software requirement specification.
Instead, our supervisors of the project have approved the proposed system to carry out
the development works of this project.
143
PRASHANT GHIMIRE
CS6PO5NI FINAL YEAR PROJECT
144
PRASHANT GHIMIRE
CS6PO5NI FINAL YEAR PROJECT
145
PRASHANT GHIMIRE
CS6PO5NI FINAL YEAR PROJECT
146
PRASHANT GHIMIRE
CS6PO5NI FINAL YEAR PROJECT
147
PRASHANT GHIMIRE
CS6PO5NI FINAL YEAR PROJECT
(15th Increment)
Week20: Published Flutter application to Google Play Store.
(14th Increment)
Week19: Database migrated from SQLite to PostgreSQL, Deployed API on Heroku, made
live and stable
(13th Increment)
Week18: Vacancy viewing/adding/deleting UI feature and their bloc, fixes widget pixel
oversizing issue in smaller width devices
(12th Increment)
Week17: YouTube, Twitter, manual sentiment analysis UI, report saving feature and their
bloc
(11th Increment)
Week16: Profile, Home Page Menus, Keys Manage and their bloc
(10th Increment)
Week15: Login/Signup Screens with auth BLOC and API request handler for auth task
(9th Increment)
Week14: Implemented sentiment report and vacancy (saving/viewing) backend API part
148
PRASHANT GHIMIRE
CS6PO5NI FINAL YEAR PROJECT
(8th Increment)
Week13: User Login, JWT authentication to allow only authenticated users to perform
sentiment analysis, YouTube/Twitter sentiment algorithm linked
(7th Increment)
Week12: Flask backend setup and done up to user registration
(6th Increment)
Week11: Data integration part code using YouTube, Twitter API documentation
(5th Increment)
Week10: Implemented pickle (serializing trained ML model) concept in my system that
increases calculation speed
(4th Increment)
Week9: Made a working sentiment analysis model that works by providing both training,
testing data
(3rd Increment)
Week8: Worked on data pre-processing like tokenizing, stemming, stop words part
(2nd Increment)
Week7: Started to write code for development work after initial level research and learning
NLTK, TextBlob
(1st Increment)
Week6: Initial UI prototype is made ready to implement it properly later after completion
of backend work
i. Backend
def create_app(test_config=None):
app = Flask(__name__, instance_relative_config=True)
if test_config is None:
app.config.from_mapping(
SECRET_KEY=os.environ.get("SECRET_KEY"),
SQLALCHEMY_DATABASE_URI=os.environ.get("DATABASE_URI"),
SQLALCHEMY_TRACK_MODIFICATIONS=False,
JWT_SECRET_KEY=os.environ.get('JWT_SECRET_KEY')
)
else:
app.config.from_mapping(test_config)
app.register_blueprint(register_blueprint)
app.register_blueprint(login_blueprint)
app.register_blueprint(report_blueprint)
app.register_blueprint(profile_blueprint)
app.register_blueprint(vacancy_blueprint)
app.register_blueprint(youtube_blueprint)
app.register_blueprint(twitter_blueprint)
app.register_blueprint(manual_blueprint)
def index():
return {
"Registration": "/register/ [POST]",
"Login": "/login/ [POST]",
"User profile": "/profile/ [GET]",
"YouTube comments analysis": "/red/ [POST]",
"Tweets analysis": "/blue/ [POST]",
"User reports": "/report/ [GET/POST]",
"Vacancy": "/vacancy/ [GET/POST/DELETE] &
/vacancy/all?filter=freelancer or vacancy [GET]",
"Sentence/Paragraph polarity": "/manual/ [POST]"
}
db.app = app
db.init_app(app)
JWTManager(app)
# with app.app_context():
# db.create_all()
return app
The above code file is the backend logic that listens the requests received from API
db = SQLAlchemy()
class User(db.Model):
id = db.Column(db.Integer, primary_key=True)
name = db.Column(db.String(55), nullable=False)
email = db.Column(db.String(80), unique=True, nullable=False)
password = db.Column(db.Text(), nullable=False)
purpose = db.Column(db.String(30), nullable=False)
analysis_count = db.Column(db.Integer, default=0)
vacancy_count = db.Column(db.Integer, default=0)
reports = db.relationship('Report', backref="user")
vacancies = db.relationship('Vacancy', backref="user")
class Report(db.Model):
id = db.Column(db.Integer, primary_key=True)
user_id = db.Column(db.Integer, db.ForeignKey('user.id'))
analysis_datetime = db.Column(db.DateTime, default=datetime.now())
platform = db.Column(db.String(20), nullable=False)
data = db.Column(db.String(200), nullable=False)
data_count = db.Column(db.Integer, nullable=False)
spam_count = db.Column(db.Integer, nullable=False)
sarcasm_count = db.Column(db.Integer, nullable=False)
positive_count = db.Column(db.Integer, nullable=False)
negative_count = db.Column(db.Integer, nullable=False)
neutral_count = db.Column(db.Integer, nullable=False)
overall_polarity = db.Column(db.String(6), nullable=False)
class Vacancy(db.Model):
id = db.Column(db.Integer, primary_key=True)
user_id = db.Column(db.Integer, db.ForeignKey('user.id'))
title = db.Column(db.String(50), nullable=False)
contact_email = db.Column(db.String(80), nullable=False)
contact_number = db.Column(db.String(20), nullable=False)
description = db.Column(db.String(600), nullable=False)
work_hr = db.Column(db.Integer, nullable=False)
wage_hr = db.Column(db.Text, nullable=False)
is_negotiable = db.Column(db.Boolean, default=True, nullable=False)
is_vacancy = db.Column(db.Boolean, default=True, nullable=False)
The above code file contains all the three models of the system
152
PRASHANT GHIMIRE
CS6PO5NI FINAL YEAR PROJECT
@profile_blueprint.route('/profile/', methods=['GET'])
@jwt_required()
def profile():
try:
user_email = get_jwt_identity()
current_user = User.query.filter_by(email=user_email).first()
return {
"success": "true",
"name": current_user.name,
"email": current_user.email,
"purpose": current_user.purpose,
"analysis_count": str(current_user.analysis_count),
"vacancy_count": str(current_user.vacancy_count)}
except:
return success_false()
The above code file handles the user’s profile viewing request
@register_blueprint.route('/register/', methods=['POST'])
def register():
request_data = request.get_json()
try:
name = request_data['name']
email = request_data['email']
153
PRASHANT GHIMIRE
CS6PO5NI FINAL YEAR PROJECT
password = request_data['password']
purpose = request_data['purpose']
access_token = create_access_token(
identity=email, expires_delta=False)
except:
return success_false()
@youtube_blueprint.route('/red/', methods=['POST'])
@jwt_required()
def youtube_sentiment():
request_data = request.get_json()
try:
user_email = get_jwt_identity()
current_user = User.query.filter_by(email=user_email).first()
video_id = request_data['video_id']
api_key = request_data['api_key']
approx_comments = 0 # declaring outside so that it can be used at this
space
try:
approx_comments = int(request_data['approx_comments'])
except:
return {"success": "false", "msg": "Approx comments should be
numeric"}
155
PRASHANT GHIMIRE
CS6PO5NI FINAL YEAR PROJECT
current_user.analysis_count += 1
db.session.commit()
# after adding the user's analysis count, need to return sentiment result
to user
return {
"success": "true",
"msg": "Analysed given data succesfully",
"title": youtube_data[2],
"thumbnail": youtube_data[1],
"total_data": sentiment.data_count(),
"spam_count": sentiment.layer_count()[0],
"sarcasm_count": sentiment.layer_count()[1],
"positive_count": sentiment.overall_polarity()["positive_count"],
"negative_count": sentiment.overall_polarity()["negative_count"],
"neutral_count": sentiment.overall_polarity()["neutral_count"],
"overall_polarity":
round((sentiment.overall_polarity()["overall_polarity"]), 3)
}
except:
return {"success": "false", "msg": "Invalid API request"}
The above code file handles user’s YouTube comment sentiment analysis request
156
PRASHANT GHIMIRE
CS6PO5NI FINAL YEAR PROJECT
ii. Frontend
import 'package:flutter/material.dart';
import 'package:flutter_neumorphic/flutter_neumorphic.dart';
import 'package:flutter_secure_storage/flutter_secure_storage.dart';
import 'package:sentimento/screens/analysis_screen/comments_screen.dart';
import 'package:sentimento/screens/analysis_screen/manual_analysis.dart';
import 'package:sentimento/screens/analysis_screen/tweets_screen.dart';
import 'package:sentimento/screens/authscreen_controller.dart';
import 'package:sentimento/screens/getstarted_screen/getstarted_screen.dart';
import 'package:sentimento/screens/home_screen/home_screen.dart';
import 'package:sentimento/screens/login_screen/login_screen.dart';
import 'package:sentimento/screens/mynetwork_screen/post_service.dart';
import 'package:sentimento/screens/mynetwork_screen/post_vacancy.dart';
import 'package:sentimento/screens/mynetwork_screen/user_posts.dart';
import 'package:sentimento/screens/mynetwork_screen/view_freelancers.dart';
import 'package:sentimento/screens/mynetwork_screen/view_vacancies.dart';
import 'package:sentimento/screens/profile_screen/profile_screen.dart';
import 'package:sentimento/screens/register_screen/register_screen.dart';
import 'package:sentimento/screens/reports_screen/reports_screen.dart';
import 'package:sentimento/utilities/routes.dart';
FlutterSecureStorage? secureStorage;
void main() {
//making single instance so that it can be used again by other methods from
multiple pages
secureStorage = const FlutterSecureStorage();
runApp(MaterialApp(
debugShowCheckedModeBanner: false,
theme: ThemeData(primarySwatch: Colors.teal, brightness: Brightness.light),
home: const AuthScreenController(),
routes: {
AppRoutes.getstartedscreen: (context) => const GetStartedScreen(),
AppRoutes.loginscreen: (context) => const LoginScreen(),
AppRoutes.registerscreen: (context) => const RegisterScreen(),
AppRoutes.homescreen: (context) => const HomeScreen(),
AppRoutes.profilescreen: (context) => const ProfileScreen(),
AppRoutes.commentsAnalysis: (context) => const CommentsScreen(),
AppRoutes.tweetsAnalysis: (context) => const TweetsScreen(),
AppRoutes.manualAnalysis: (context) => const ManualAnalysis(),
AppRoutes.reports: (context) => const ReportsScreen(),
157
PRASHANT GHIMIRE
CS6PO5NI FINAL YEAR PROJECT
158
PRASHANT GHIMIRE
CS6PO5NI FINAL YEAR PROJECT
import 'dart:convert';
import 'package:http/http.dart' as http;
import 'package:sentimento/utilities/securestorage.dart';
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:sentimento/bloc/auth_bloc/auth_bloc.dart';
import 'package:sentimento/screens/getstarted_screen/getstarted_screen.dart';
import 'package:sentimento/screens/home_screen/home_screen.dart';
import 'package:sentimento/widgets/minor_ui_parts.dart';
160
PRASHANT GHIMIRE
CS6PO5NI FINAL YEAR PROJECT
@override
Widget build(BuildContext context) {
return BlocProvider(
create: (context) => AuthBloc(LoadingState())..add(SessionCheckerEvent()),
child: BlocBuilder<AuthBloc, AuthState>(
builder: (context, state) {
if (state is LoggedInState) {
return const HomeScreen();
} else if (state is MessageState) {
manualToastMsg(state.message);
} else if (state is LoggedOutState) {
return const GetStartedScreen();
}
return showLoading(context);
},
),
);
}
}
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:sentimento/bloc/auth_bloc/auth_bloc.dart';
import 'package:sentimento/screens/getstarted_screen/getstarted_screen.dart';
import 'package:sentimento/screens/home_screen/home_screen.dart';
import 'package:sentimento/widgets/minor_ui_parts.dart';
@override
Widget build(BuildContext context) {
return BlocProvider(
create: (context) => AuthBloc(LoadingState())..add(SessionCheckerEvent()),
child: BlocBuilder<AuthBloc, AuthState>(
builder: (context, state) {
if (state is LoggedInState) {
return const HomeScreen();
161
PRASHANT GHIMIRE
CS6PO5NI FINAL YEAR PROJECT
class TextFieldValidator {
static emailValidator(email) {
bool emailValid = RegExp(
r"^[a-zA-Z0-9.a-zA-Z0-9.!#$%&'*+-/=?^_`{|}~]+@[a-zA-Z0-9]+\.[a-zA-
Z]+")
.hasMatch(email);
if (emailValid) {
return null;
} else {
return "Enter valid email address";
}
}
static passwordValidator(password) {
if (password!.isEmpty || password.length < 6) {
return "Password length must be atleast 6";
}
return null;
}
static nameValidator(name) {
if (name!.isEmpty) {
return "Name cannot be empty";
}
if (name.length < 5) {
return "Name should be more than 5chars";
}
if (name.length > 55) {
return "Name should be less than 55chars";
162
PRASHANT GHIMIRE
CS6PO5NI FINAL YEAR PROJECT
}
}
static keyValidator(key) {
if (key!.isEmpty) {
return "Key/coupan cannot be empty";
}
if (key.length < 5) {
return "Key/coupan should be more than 5chars";
}
if (key.length > 250) {
return "Key/coupan should be less than 250chars";
}
}
static numOfDataValidator(dataCount) {
try {
int approx = int.parse(dataCount);
if ((approx < 20) || (approx > 1000)) {
return "Range of 20 to 1000 is only allowed for now.";
163
PRASHANT GHIMIRE
CS6PO5NI FINAL YEAR PROJECT
}
} catch (e) {
return "Enter numeric values only";
}
}
static roleValidator(role) {
if ((role.length < 3) || (role.length > 50)) {
return "Length of role should be between 3 to 50";
}
}
static phoneNumberValidator(number) {
if ((number.length < 5) || (number.length > 20)) {
return "Length of phone number should be between 5 to 20";
}
}
static descriptionValidator(desc) {
if (desc.length < 15) {
return "Description should be atleast 15chars in length";
}
}
static workHrValidator(hr) {
try {
int hrs = int.parse(hr);
if ((hrs < 1) || (hrs > 8)) {
return "Working hour should be in range of 1 to 8";
}
} catch (e) {
return "Enter numeric values only";
}
}
static wageValidator(wage) {
if ((wage.length < 2) || (wage.length > 15)) {
return "Invalid wage/hour format";
}
}
}
164
PRASHANT GHIMIRE
CS6PO5NI FINAL YEAR PROJECT
import 'dart:convert';
import 'api_universal.dart';
165
PRASHANT GHIMIRE
CS6PO5NI FINAL YEAR PROJECT
import 'dart:convert';
import 'package:sentimento/models/post_model.dart';
import 'package:sentimento/widgets/minor_ui_parts.dart';
import 'api_universal.dart';
return response;
}
var deleteResponse =
blocResponder(await getDELETEResponse("$deletePostEndPoint$postId"));
manualToastMsg(deleteResponse["msg"]);
return deleteResponse;
}
import 'dart:async';
import 'package:bloc/bloc.dart';
import 'package:equatable/equatable.dart';
import 'package:sentimento/api/auth_requests.dart';
import 'package:sentimento/utilities/securestorage.dart';
part 'auth_event.dart';
part 'auth_state.dart';
FutureOr<void> _initialEvent(
InitialEvent initialEvent, Emitter<AuthState> emit) {
emit.call(LoggedOutState());
}
FutureOr<void> _sessionChecker(
SessionCheckerEvent sessionClickedEvent, Emitter<AuthState> emit) async {
emit.call(LoadingState());
//checks if bearer token is saved or not
bool userLoggedIn = await isLoggedIn();
if (userLoggedIn) {
emit.call(LoggedInState());
} else if (!userLoggedIn) {
emit.call(LoggedOutState());
}
}
FutureOr<void> _loginClick(
LoginClickedEvent loginClickedEvent, Emitter<AuthState> emit) async {
167
PRASHANT GHIMIRE
CS6PO5NI FINAL YEAR PROJECT
emit.call(LoadingState());
try {
var loginResponse = await requestLogin(
loginClickedEvent.email, loginClickedEvent.password);
authValidatior(loginResponse, emit);
} catch (e) {
emit.call(MessageState(message: "No internet or try again"));
}
}
168
PRASHANT GHIMIRE
CS6PO5NI FINAL YEAR PROJECT
class AppRoutes {
static String getstartedscreen = "/getstarted";
static String loginscreen = "/login";
static String registerscreen = "/register";
static String splashscreen = "/splash";
static String homescreen = "/home";
static String profilescreen = "/profile";
static String commentsAnalysis = "/comments";
static String tweetsAnalysis = "/tweets";
static String manualAnalysis = "/manual";
static String analysisResult = "/result";
static String reports = "/reports";
static String postVacancy = "/post/vacancy";
static String postSkill = "/post/skill";
static String viewVacancy = "/view/vacancies";
static String viewFreelancer = "/view/freelancers";
static String myPosts = "/myposts";
}
169
PRASHANT GHIMIRE