You are on page 1of 6

A Human Intention Detector – An application of

Sentiment Analysis
Megha Dutta1, Shayan Mondal2,
Sanjay Chakraborty3, Arpan Chakraborty4
1
Institute of Engineering & Management, Kolkata
2
Institute of Engineering & Management, Kolkata
3
Techno India College of Technology, Salt Lake, Kolkata
4
Institute of Engineering Management, Kolkata
{meghadutta201@gmail.com, shayanmondal237@gmail.com, schakraborty770@gmail.com,
arpan.chakraborty0007@gmail.com}
Abstract:
In recent past, our society has witnessed different types of criminal and unpleasant
activities with the common people and in most of the cases women are being victimized. The
women are getting harassed or threatened in different places. So there should be some means by
which we can provide security or safety to women. Being responsible citizens of India, we feel
there is an urgent need to take major steps to protect the ladies as well as the moral values of our
society. These types of incidents motivated us to develop a real time safety device for human
beings, spatially for women. It has been observed in study that when a person is under
threatening his/her body temperature changes. Taking this into account and with the help of
sentiment analysis we have developed a simple safety device which can be integrated with smart
phones. Our device predicts the intention of a person by analysing the speech and checks the
body temperature of the victim and combines these two facts together to detect the severity level
of threatening. In this paper we are going to describe our proposed approach to detect the threats.
We shall also provide the experimental result analysis and accuracy.

Keywords: Sentimental Analysis, Temperature, Mood Detection, Speech Recognition, Intention,


Human Safety, Affinn List.
Introduction:
Technological advancement has bring us to the world where everything seems to be
possible. The ultimate use of any resource is for the development and wellbeing of the society.
Therefore, the main objective of our project is to develop a system which can be used for various
safety purposes in all fields of security. It is very obvious that the intention of a person becomes
clear by the words he/she uses while speaking. With the help of an afinn list we can make almost
accurate classification of positive and negative words. The positive words signifies good attitude
while the negative words suggest that the speaker has a bad intention. This is the first alarming
point. Negative intentions are a sign of possible future crimes. But again this alone is not enough
to assure that the situation is alarming. Here comes the second aspect of this project. It is
scientifically measures. Combining both these factors, our project can sense the possibilities of
crime in a situation. Initially the thought was women safety against such heinous crimes
occurring in the society but later we realized that it could be helpful for others as well.
Background Study:
Body temperature is a complex clinical variable. This is among the few factors which can
be measured accurately and quantitatively analysed. The normal body temperature is defined as
37°C [4]. However the temperature of a body keeps changing throughout the day in response to
various factors like individual's metabolism rate, room temperature, place etc. It even varies for
different part of the body. There are five major clinical practices to measure the body
temperature.
 Rectal
 Oral
 Axillary
 Forehead
 Ear
Most convenient practice is measuring the oral site. While the standard one is rectal
temperature. Sentimental analysis refers to the identification [1], extraction and study of
affective states. It is also referred as opinion mining. It has proved to be very useful in
commercial field, especially to study customer surveys and feedbacks. Sentimental analysis has
three major approaches:
 Knowledge-based methods
 Statistical methods
 Hybrid methods
In knowledge based methods, texts are classified into obvious affect words and assign them
a probable affinity to particular emotions. This list is referred to as afinn list. Statistical methods
take the help of machine learning while hybrid methods are a combination of both. The most
basic task of opinion analysis is to determine the polarity of a text message. It can be either of
positive, negative and neutral.
It is observed that the attitude or emotional response of the speaker can be evaluated or
senses by quantifying the overall affinity of his message with respect to any given topic.
THE ORITICAL CONCEPTS:

AFINN [2] is a list of English words rated for valence with an integer between minus five
(negative) and plus five (positive). The words have been manually labelled by Finn Årup
Nielsen in 2009-2011.
 Very Negative (rating -5 or -4)
 Negative (rating -3, -2, or -1)
 Positive (rating 1, 2, or 3)
 Very Positive (rating 4 or 5)
Google has a great Speech Recognition API. This API converts spoken text (microphone)
into written text (Python strings), briefly Speech to Text. Speech can be entered in a microphone
and Google API will translate this into written text. The API has excellent results for English
language. The audio is recorded using the speech recognition module, the module will include
on top of the program. Secondly the record speech is sent to the Google speech recognition API
which will then return the output.
r.recognize_google (audio) returns a string.

PROPOSED WORK:
The project aims at creating an application for human safety purpose. The proposed idea
is to study the intention of a person based on different factors like speech and body temperature.
It is a common observation that the body temperature of human being varies according to his
mood. When a person is threatened, his body temperature lies within a certain range, while when
he is happy, his temperature lies in a different range. This key factor has been taken into
consideration in generating a result (positive or negative) and combined with the sentimental
analysis of the speech of the third person who is trying to threaten him/her.
The proposed work can be divided into two modules –
1. Temperature Module:
It is assumed that the data input for temperature has already been recorded through
some hardware components. It is observed that if a person is threatened, there can be two cases,
either the person becomes 'angry' or he becomes 'frightened'. Presently the experiment has been
conducted only with the first case and the data range for the mood 'angry' has been recorded.
2. Speech Module:
Speech is taken as input with the help of a microphone. The Google Speech
Recognition API has noise cancellation to some extent. This clear voice is recorded in an audio
file while it's in turn converted to text with the help of Google Speech to Text conversion API.
The text file is processed with the help of various Python libraries [1]. The stop words are
removed and keywords are extracted. These keywords are run against the afinn list to find the
respective scores thus giving the sentiment of the input speech.
The result from both these modules are combined and if body temperature lies within the given
range and the sentiment is negative, then some threat is suspected and emergency contact shall
be informed with the help of phone’s GPS.
Algorithm:
Input
temp : Body temperature of the victim
speech : Speech of the object
Output
a) Sentimental analysis of the speech after converting it to text
b) Mood corresponding to a given body temperature
c) Final results after combining sentimental analysis and mood to detect
seriousness of a situation
Pseudo code:
1. P : total no of moods ; counter : 0
2. Repeat steps 3 through 9 until counter <=P
3. N : total no of input temperature for each mood
4. timestamp <--- 0
5. loop : Repeat steps 4 and 5 until timestamp <= N for a particular mood
6. Record temp
7. timestamp <--- timestamp + 1
8. end loop
9. Compute the average of all the recorded temperature and store in finalTemp[]
10. Record speech
Speech to text conversion using suitable APIs and well known fact that our nervous
system reacts to different situations in different ways. Body temperature plays an important role
in human body's response to various conditions. It varies according to place, climate, health,
mood etc. The variation of body temperature with mood is the key to sense threat. If a person is
in threat, her body temperature will vary from what it usu
11. Removal of stop words and punctuations and generating clean text
12. Categorizing clean text and keywords as positive, negative and neutral
13. Storing the result in the form of an array text Analysis[] which will have to columns one for
keyword and the other for assigned values( 0--> neutral, 1--> positive, -1 --> negative)
15. Combining finalTemp[] and textAnalysis[] array and applying machine learning to generate
the desired result
16. If Fmood == threat and Fanalysis ==negative then
“Inform emergency contact anf trigger an alarm”
17. else
“No threat detected”
18. End
Block Diagram of the Proposed Idea:

Experimental Observation:
The dataset was created by taking feedback from various audiences using Google docs
form. All possible threat messages collected from the survey was tested against the proposed
program and the output was as follows:
Fig. 1. No. of dataset vs Accuracy in %

It is observed that as the number of sample dataset is increased and as new words are added to
the Afinn List, the accuracy % is increasing.
For example, as shown, if we input the speech as “I will kill you”, we get an overall score of -3
which indicates negative sentiment. This result is combined with temperature dataset [3] as
given below:
MOOD BODY TEMPERATURE
o
RANGE (in C)

Happy 28-31.5

Sad 29-32

Angry 30-35

Table 1. Variation of body temperature with mood

CONCLUSION AND FUTURE SCOPE:


From the results of this project, it is clear that it is possible to predict the criminal intent of
a person or the possibility of a person being under threat using existing technologies. And these
can contribute tremendously towards security purposes and will help to reduce crimes. However,
this is just the beginning. We can improve the output of such a system to a huge extent. Scope of
such project is very extensible in future. Few improvements are stated below:
1) We worked with a limited data set. Collecting more number of data samples and adding more
words to the afinn list will increase the accuracy effectively.

2) Adding a few more factors will improve the system performance to great extent. Some
of the factors can be:

 o Heartbeat sensing
 o Humidity sensing
o Automatic camera activation to take the video/image of the predicted culprit.
4) A GPS locator can be put to work to let the contacts of the predicted victim know her
location and a danger alarm.
5) This whole idea can be converted to an android safety app and contribute to a better
and safe society.

REFERENCES:
1. CNN. Cable News Network, No Date. Web. 19 Feb. 2017. Available:
https://edition.cnn.com/2014/02/04/tech/innovation/this-new-tech-can-detect-your-
mood/index.html
2. Technology Review. 26 Oct. 2010. Web. 15 Jan. 2016. Available:
https://www.technologyreview.com/s/421316/sensor-detects-emotions-through-the-skin/
3. https://www.sciencedirect.com/topics/earth-and-planetary-sciences/body-temperature
4. https://www.ukessays.com/essays/physiology/literature-review-body-temperature-
3097.php

You might also like