[go: up one dir, main page]

Analysis of Women Safety in Indian Cities Using Machine Learning On Tweets

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 45

Analysis of Women Safety in Indian Cities Using Machine Learning on Tweets

1. INTRODUCTION
Twitter in this modern era has emerged as an ultimate micro-blogging social network
consisting over hundred million users and generate over five hundred million
messages known as ‘Tweets’ every day. Twitter with such a massive audience has
magnetized users to emit their perspective and judgemental about every existing issue
and topic of internet, therefore twitter is an informative source for all the zones like
institutions, companies and organizations.

On the twitter, users will share their opinions and perspective in the tweets section.
This tweet can only contain 140 characters, thus making the users to compact their
messages with the help of abbreviations, slang, shot forms, emoticons, etc. In addition
to this, many people express their opinions by using polysemy and sarcasm also.
Hence twitter language can be termed as the unstructured.

From the tweet, the sentiment behind the message is extracted. This extraction is done
by using the sentimental analysis procedure. Results of the sentimental analysis can
be used in many areas like sentiments regarding a particular brand or release of a
product, analysing public opinions on the government policies, people thoughts on
women, etc.

In order to perform classification of tweets and analyse the outcome, a lot of study has
been done on the data obtained by the twitter. We also review some studies on
machine learning in this paper and research on how to perform sentimental analysis
using that domain on twitter data. The paper scope is restricted to machine learning
algorithm and models.

Staring at women and passing comments can be certain types of violence and
harassments and these practices, which are unacceptable, are usually normal
especially on the part of urban life. Many researches that have been conducted in
India shows that women have reported sexual harassment and other practices as stated
above. Such studies have also shown that in popular metropolitan cities like Delhi,
Pune, Chennai and Mumbai, most women feel they are unsafe when surrounded by
unknown people. On social media, people can freely express what they feel about the
Indian politics, society and many other thoughts. Similarly, women can also share

1 | S t . M a r y ’ s G r o u p o f I n s ti t u ti o n s H y d e r a b a d
Analysis of Women Safety in Indian Cities Using Machine Learning on Tweets

their experiences if they have faced any violence or sexual harassment and this brings
innocent people together in order to stand up against such incidents.

From the analysis of tweets text collection obtained by the twitter, it includes names
of people who has harassed the women and also names of women or innocent people
who have stood against such violent acts or unethical behaviour of men and thus
making them uncomfortable to walk freely in public.

The data set of the tweet will be used to process the machine learning algorithms and
models. This algorithm will perform smoothening the tweet data by eliminating zero
values. Using Laplace and porter’s theory, a method is developed in order to analyse
the tweet data and remove redundant information from the data set. Huge numbers of
people have been attracted to social media platform such as Twitter, Facebook,
Instagram. People express their sentiments about society, politics, women, etc via the
text messages, emoticons and hash-tags through such platforms. There are some
methods of sentiment that can be classified like machine leaning based and lexicon-
based learning.

2 | S t . M a r y ’ s G r o u p o f I n s ti t u ti o n s H y d e r a b a d
Analysis of Women Safety in Indian Cities Using Machine Learning on Tweets

2. LITERATURE SURVEY
Public level information on wrongdoings against ladies accessible to a great extent
through the public wrongdoing Record Bureau shows numerous parts in India
particularly on the metropolitan side, levels of viciousness against ladies are high and
these incorporates assault, seizing, actual torment, attack, sexual dealing and so on,

Via online media sites individuals can unreservedly communicate their perspectives
and ladies can share their encounters in the event that they have confronted any
savagery or inappropriate behavior or their retaliate encounters against badgering that
was forced on them. The tweets about security of ladies and accounts of facing the
badgering further persuades others on a similar web-based media site or application
like Twitter. On the off chance that Other ladies share these messages and tweets
which further spurs numerous men or ladies to stand up and speak loudly against
individuals who have made dangerous spot for the ladies.

In this century huge number of individuals has been pulled in towards web-based
media stages like Facebook, Twitter and Instagram point and the majority of the them
are utilizing it to communicate their feelings and assessments about the general
public. As referenced before there are a few strategies for conclusions that can be
arranged utilizing AI calculation. It is a typical practice to extricate the data from the
information that is accessible on person-to-person communication locales through
systems of information extraction, information examination and information
understanding techniques. The exactness of the Twitter examination and forecast can
be gotten by the utilization of conduct investigation based on interpersonal
organizations.

2.1 Machine learning

Application AI is the cycle of PC calculation and identified with computational


measurements, which centers around making forecasts utilizing PCs. The calculation
dependent on example information, known as "preparing information", to settle on
expectations or choices without being expressly modified to doas such. AI measure as
follow:

3 | S t . M a r y ’ s G r o u p o f I n s ti t u ti o n s H y d e r a b a d
Analysis of Women Safety in Indian Cities Using Machine Learning on Tweets

Fig. 2.1: Machine Learning

2.2 Sentimental Analysis


Estimation examination is the way toward deciding content information and
arranging it into slants positive, negative, or nonpartisan. Utilizing estimation
examination apparatuses to investigate assessments in Twitter information can help
in forming a slant which can additionally be utilized to accomplish supposition
characterization. There are a few techniques for supposition that can be ordered
comprehensively into two different ways – AI based and dictionary learning based.
AI approach incorporates through methods of information extraction, programming
model prepared utilizing separated information. While dictionary learning based
methodology likewise called as unaided methodology and it utilizes the jargon and
scoring strategy to distinguish sentiments. In this paper, we use AI approach where
we work on Extract the tweets information, pre-handling the information, extraction
of highlights, picking base highlights, recognition of assumptions and
characterization of notions utilizing AI draws near. The precision of the examination

4 | S t . M a r y ’ s G r o u p o f I n s ti t u ti o n s H y d e r a b a d
Analysis of Women Safety in Indian Cities Using Machine Learning on Tweets

and forecast can be gotten by the utilization of conduct investigation based on


informal organizations.
Web-based media contains tremendous measure of slant rich information as tweets,
announcements, blog entries and so on Contrasted with general notion investigation,
Twitter estimation examination is minimal troublesome because of the presence of
slang words and incorrect spellings. Python offers succinct and clear code. Complex
calculations and adaptable work processes remain behind AI and AI, Python's
straightforwardness permits designers to compose solid frameworks. Engineers
needs to invest all their energy into tackling a ML issue as opposed to zeroing in on
the specialized subtleties of the language.

5 | S t . M a r y ’ s G r o u p o f I n s ti t u ti o n s H y d e r a b a d
Analysis of Women Safety in Indian Cities Using Machine Learning on Tweets

3. SYSTEM ANALYSIS

3.1 EXISTING SYSTEM

People often express their views freely on social media about what they feel about the
Indian society and the politicians that claim that Indian cities are safe for women. On
social media websites people can freely Express their view point and women can
share their experiences where they have faced abuse harassment or where we would
have fight back against the abuse harassment that was imposed on them. The tweets
about safety of women and stories of standing up against abuse harassment further
motivates other women data on the same social media website or application like
Twitter. Other women share these messages and tweets which further motivates other
5 men or 10 women to stand up and raise a voice against people who have made
Indian cities and unsafe place for the women. In the recent years a large number of
people have been attracted towards social media platforms like Facebook, . It is a
common practice to extract the information from the data that is available on social
networking through procedures of data extraction, data analysis and data
interpretation methods. The accuracy of the Twitter analysis and prediction can be
obtained by the use of behavioral analysis on the basis of social networks.

DISADVANTAGES:

1. Twitter and Instagram point and most of the people are using it to express their
emotions and also their opinions about what they think about the Indian cities
and Indian society.

2. There are several methods of sentiment that can be categorized like machine
learning hybrid and lexicon-based learning.

3. Also, there are another categorization Janta presented with categories of


statistical, knowledge-based and age wise differentiation approaches

6 | S t . M a r y ’ s G r o u p o f I n s ti t u ti o n s H y d e r a b a d
Analysis of Women Safety in Indian Cities Using Machine Learning on Tweets

3.2 PROPOSED SYSTEM

Women have the right to the city which means that they can go freely whenever they
want whether it be too an Educational Institute, or any other place women want to go.
But women feel that they are unsafe in places like malls, shopping malls on their way
to their job location because of the several unknown Eyes body shaming and
harassing these women point Safety or lack of concrete consequences in the life of
women is the main reason of harassment of girls. There are instances when the
harassment of girls was done by their neighbors while they were on the way to school
or there was a lack of safety that created a sense of fear in the minds of small girls
who throughout their lifetime suffer due to that one instance that happened in their
lives where they were forced to do something unacceptable or was abusely harassed
by one of their own neighbor or any other unknown person. Safest cities approach
women safety from a perspective of women rights to the affect the city without fear of
violence or abuse harassment. Rather than imposing restrictions on women that
society usually imposes it is the duty of society to imprecise the need of protection of
women and also recognizes that women and girls also have a right same as men have
to be safe in the City.

ADVANTAGES:

1. Analysis of twitter texts collection also includes the name of people and name
of women who stand up against abuse harassment and unethical behaviour of
men in Indian cities which make them uncomfortable to walk freely.

2. The data set that was obtained through Twitter about the status of women
safety in Indian society

7 | S t . M a r y ’ s G r o u p o f I n s ti t u ti o n s H y d e r a b a d
Analysis of Women Safety in Indian Cities Using Machine Learning on Tweets

4. SYSTEM SPECIFICATIONS

4.1 HARDWARE REQUIREMENTS:

 System : Intel i5 7th gen

 Hard Disk : 1 TB

 Monitor : 15.6’ Colour Monitor

 Mouse : Optical Mouse

 Ram : 2 GB

4.2 SOFTWARE REQUIREMENTS:

 Operating system : Windows 10

 Coding Language : Python

 Front-End : HTML, CSS, JavaScript

 Designing : Html, CSS, JavaScript

 Data Base : MySQL

8 | S t . M a r y ’ s G r o u p o f I n s ti t u ti o n s H y d e r a b a d
Analysis of Women Safety in Indian Cities Using Machine Learning on Tweets

5. SYSTEM ARCHITECTURE

A system architecture is the conceptual model that defines the structure, behavior, and
more views of a system. A system architecture can consist of system components and
the sub-systems developed, that will work together to implement the overall system.

Fig. 5: System Architecture

9 | S t . M a r y ’ s G r o u p o f I n s ti t u ti o n s H y d e r a b a d
Analysis of Women Safety in Indian Cities Using Machine Learning on Tweets

6. SYSTEM DESIGN

UML DIAGRAMS

The Unified Modelling Language allows the software engineer to express an


analysis model using the modelling notation that is governed by a set of syntactic
semantic and pragmatic rules.

A UML system is represented using five different views that describe the
system from distinctly different perspective. Each view is defined by a set of
diagrams, which is as follows.
 User Model View
i. This view represents the system from the user’s perspective.
ii. The analysis representation describes a usage scenario from the end-user’s
perspective.

 Structural Model view


i. In this model the data and functionality are arrived from inside the system.
ii. This model view models the static structures.

 Behavioural Model View


It represents the dynamic of behavioural as parts of the system, depicting the
interactions of collection between various structural elements described in the user
model and structural model view.

 Implementation Model View


In this the structural and behavioural as parts of the system are represented as
they are to be built.

 Environmental Model View


In these the structural and behavioural aspects of the environment in which the
system is to be implemented are represented.

10 | S t . M a r y ’ s G r o u p o f I n s ti t u ti o n s H y d e r a b a d
Analysis of Women Safety in Indian Cities Using Machine Learning on Tweets

6.1 DATA FLOW DIAGRAM


A data flow diagram shows the way information flows through a process or system.
It includes data inputs and outputs, data stores, and the various subprocesses the
data moves through. DFDs are built using standardized symbols and notation to
describe various entities and their relationships.

User

11 | S t . M a r y ’ s G r o u p o f I n s ti t u ti o n s H y d e r a b a d
Analysis of Women Safety in Indian Cities Using Machine Learning on Tweets

Admin

Fig. 6.5: Data Flow Diagram

12 | S t . M a r y ’ s G r o u p o f I n s ti t u ti o n s H y d e r a b a d
Analysis of Women Safety in Indian Cities Using Machine Learning on Tweets

6.2 ER DIAGRAM
ER Diagram stands for Entity Relationship Diagram, also known as ERD is a diagram
that displays the relationship of entity sets stored in a database. In other words, ER
diagrams help to explain the logical structure of databases. ER diagrams are created
based on three basic concepts: entities, attributes and relationships.

User

Admin

Fig. 6.2: ER Diagram

13 | S t . M a r y ’ s G r o u p o f I n s ti t u ti o n s H y d e r a b a d
Analysis of Women Safety in Indian Cities Using Machine Learning on Tweets

6.3 USE CASE DIAGRAM


A use case diagram at its simplest is a representation of a user's interaction with the
system and depicting the specifications of a use case. A use case diagram can portray
the different types of users of a system and the various ways that they interact with
the system. This type of diagram is typically used in conjunction with the textual use
case and will often be accompanied by other types of diagrams as well.
User

Admin

Fig. 6.3: Use Case Diagram

14 | S t . M a r y ’ s G r o u p o f I n s ti t u ti o n s H y d e r a b a d
Analysis of Women Safety in Indian Cities Using Machine Learning on Tweets

6.4 CLASS DIAGRAM

The class diagram is the main building block of object-oriented modelling. It is used
both for general conceptual modelling of the systematic of the application, and for
detailed modelling translating the models into programming code. Class diagrams can
also be used for data modelling. The classes in a class diagram represent both the
main objects, interactions in the application and the classes to be programmed. A
class with three sections.

In the diagram, classes are represented with boxes which contain three parts:

 The upper part holds the name of the class


 The middle part contains the attributes of the class
 The bottom part gives the methods or operations the class can take or
undertake.

Fig. 6.4: Class Diagram

15 | S t . M a r y ’ s G r o u p o f I n s ti t u ti o n s H y d e r a b a d
Analysis of Women Safety in Indian Cities Using Machine Learning on Tweets

6.5 SEQUENCE DIAGRAM

A sequence diagram is a kind of interaction diagram that shows how processes


operate with one another and in what order. It is a construct of a Message Sequence
Chart. A sequence diagram shows object interactions arranged in time sequence.
Sequence diagrams are sometimes called event diagrams, event scenarios, and timing
diagrams.

User

Admin

Fig. 2.1: Sequence Diagram

16 | S t . M a r y ’ s G r o u p o f I n s ti t u ti o n s H y d e r a b a d
Analysis of Women Safety in Indian Cities Using Machine Learning on Tweets

17 | S t . M a r y ’ s G r o u p o f I n s ti t u ti o n s H y d e r a b a d
Analysis of Women Safety in Indian Cities Using Machine Learning on Tweets

6.6 ACTIVITY DIAGRAM

Activity diagram is another important diagram in UML to describe dynamic aspects


of the system. It is basically a flow chart to represent the flow form one activity to
another activity. The activity can be described as an operation of the system.

User

Admin

Fig. 6.6: Activity Diagram

18 | S t . M a r y ’ s G r o u p o f I n s ti t u ti o n s H y d e r a b a d
Analysis of Women Safety in Indian Cities Using Machine Learning on Tweets

6.3 COMPONENT DIAGRAM


In the Unified Modelling Language, a component diagram depicts how components
are wired together to form larger components and or software systems. They are used
to illustrate the structure of arbitrarily complex systems Components are wired
together by using an assembly connector to connect the required interface of one
component with the provided interface of another component. This illustrates the
service consumer - service provider relationship between the two components.
User

Admin

Fig. 6.1: Component Diagram

19 | S t . M a r y ’ s G r o u p o f I n s ti t u ti o n s H y d e r a b a d
Analysis of Women Safety in Indian Cities Using Machine Learning on Tweets

7. MODULES

7.1 Twitter Analysis

People communicate and share their opinion actively on social medias including
Facebook and Twitter, Social network can be considered as a perfect platform to learn
about people’s opinion and sentiments regarding different events. There exists several
opinion-oriented information gathering and analytics systems that aim to extract
people’s opinion regarding different topics.

7.2 Implementation of Sentimental Analysis of Tweets

Report the tweets picked up from Twitter API provided by Twitter itself. Due to the
presence of Twitter API, there are many techniques available for sentimental analysis
of data on social media. In this project a set of available libraries has been used.

7.3 Graph

A Depressed interaction graph G_ is generated via some social graph model,


minimizing the distance between the real and Depressed interaction graphs. An
interaction graph G is extracted from the input (real) social media data. An
interaction graph represents how social network actors interact with each other [25],
[26]. Entities and their interactions in social media are identified, and an interaction
graph is built with a vertex set V, including entities, an edge set E representing
interactions, and an attribute set A, which includes both vertex (entity) attributes and
edge (interaction) attributes

20 | S t . M a r y ’ s G r o u p o f I n s ti t u ti o n s H y d e r a b a d
Analysis of Women Safety in Indian Cities Using Machine Learning on Tweets

7.4 Final Report

If the neutral tweets are significantly high, means that people have a lower
interest in the topic and are not willing to haves a positive/negative side on it. This is
also important to mention that depends on the data of the experiment we may get
different results as people’s opinion may change depending on the circumstances for
example rape news it becomes the most trending news of the year in 2017. For some
queries, the neutral tweets are more than 60% which clearly shows the limitation of
the views. By above analysis that we have done, it can be clearly stated that Chennai
is the safest city whereas Delhi is the unsafe city.

21 | S t . M a r y ’ s G r o u p o f I n s ti t u ti o n s H y d e r a b a d
Analysis of Women Safety in Indian Cities Using Machine Learning on Tweets

8. SAMPLE CODE
Client/sentiment_analysis.py

#Required  Imports

import pandas as pd

from sklearn.svm import SVC as SVR

from sklearn.model_selection import train_test_split as tts

#  from sklearn.metrics  import classification_report as report

from sklearn.feature_extraction.text import TfidfVectorizer as Vectorizer

def sentiment(tweet):

    df = pd.DataFrame([tweet])

    df = clean(df[0])

    df = vector(df)

    return model.predict(df)[0]

def clean(tweets):

    return tweets.apply(lambda x: x.lower().replace('#', ''))

def vector(column):

    column = vectorizer.transform(column)

    column = pd.DataFrame(column.toarray())

    return column

22 | S t . M a r y ’ s G r o u p o f I n s ti t u ti o n s H y d e r a b a d
Analysis of Women Safety in Indian Cities Using Machine Learning on Tweets

#Reading  the dataset

url = "https://docs.google.com/spreadsheets/d/
1kXUP2O4aaPbqUhUdKRaoG5YK9fI01CQR5m9g6Gow7pc/edit#gid=0"

url = url.replace('/edit#gid=', '/export?format=csv&gid=')

df = pd.read_csv(url)

df = df.dropna()

tweets, classes = df[list(df)[0]], df[list(df)[1]]

#data cleaning

tweets = clean(tweets)

#vectorzation

vectorizer = Vectorizer()

vectorizer.fit(tweets)

tweets = vector(tweets)

#splitting the dataset

X_train, X_test, y_train, y_test = tts(

    tweets, classes, test_size=0.2, random_state=42)

#Fitting the dataset into SVR model

svr = SVR()

model = svr.fit(X_train, y_train)

#  result  = model.predict(X_test)

#  print(report(y_test, result))

23 | S t . M a r y ’ s G r o u p o f I n s ti t u ti o n s H y d e r a b a d
Analysis of Women Safety in Indian Cities Using Machine Learning on Tweets

Research/views.py

from django.contrib import messages

from django.shortcuts import render, redirect, get_object_or_404

from Client.forms import Userregister_Form

from Client.models import Userregister_Model, TweetModel, Feedback_Model

from sentimentanalysis import sentiment

def user_login(request):

    if request.method == "POST":

        name = request.POST.get('name')

        password = request.POST.get('password')

        try:

            enter = Userregister_Model.objects.get(name=name, password=password)

            request.session['name']=enter.id

            return redirect('user_mydetails')

        except:

            pass

    return render(request, 'client/user_login.html')

def user_register(request):

    if request.method == "POST":

        forms = Userregister_Form(request.POST)

        if forms.is_valid():

            forms.save()

24 | S t . M a r y ’ s G r o u p o f I n s ti t u ti o n s H y d e r a b a d
Analysis of Women Safety in Indian Cities Using Machine Learning on Tweets

            messages.success(request, 'You have been successfully registered')

            return redirect('user_login')

    else:

        forms = Userregister_Form()

    return render(request, 'client/user_register.html',{'form':forms})

def user_mydetails(request):

    name = request.session['name']

    ted = Userregister_Model.objects.get(id=name)

    return render(request, 'client/user_mydetails.html',{'object':ted})

def user_updatedetails(request):

    name = request.session['name']

    obj = Userregister_Model.objects.get(id=name)

    if request.method == "POST":

        UserName = request.POST.get('name', '')

        Email = request.POST.get('email', '')

        Password = request.POST.get('password', '')

        Phone_Number = request.POST.get('phoneno', '')

        Address = request.POST.get('address', '')

        Dob = request.POST.get('dob', '')

        country = request.POST.get('country', '')

        state = request.POST.get('state', '')

        city = request.POST.get('city', '')

25 | S t . M a r y ’ s G r o u p o f I n s ti t u ti o n s H y d e r a b a d
Analysis of Women Safety in Indian Cities Using Machine Learning on Tweets

        obj = get_object_or_404(Userregister_Model, id=name)

        obj.name = UserName

        obj.email = Email

        obj.password = Password

        obj.phoneno = Phone_Number

        obj.address = Address

        obj.dob = Dob

        obj.country = country

        obj.state = state

        obj.city = city

        obj.save(update_fields=["name", "email", "password", "phoneno", "address","do
b","country","state","city"])

        return redirect('user_mydetails')

    return render(request, 'client/user_updatedetails.html',{'form':obj})

def tweet(request):

    name = request.session['name']

    userObj = Userregister_Model.objects.get(id=name)

    result = ''

    pos = []

    neg = []

    oth = []

    se = 'se'

    if request.method == "POST":

26 | S t . M a r y ’ s G r o u p o f I n s ti t u ti o n s H y d e r a b a d
Analysis of Women Safety in Indian Cities Using Machine Learning on Tweets

        images = request.POST.get('images')

        twt = request.POST.get('tweet')

se = sentiment(twt)

        TweetModel.objects.create(userId=userObj, tweet=twt, topics=result, sentiment=
se,images=images )

    obj = TweetModel.objects.all()

    return render(request,'client/tweet.html',{'list_objects': obj,'result':result,'se':se})

def tweetview(request):

    obj = TweetModel.objects.all()

    return render(request,'client/tweetview.html',{'list_objects':obj})

def feedback(request):

    if request.method == "POST":

        name=request.POST.get('name')

        mobilenumber=request.POST.get('mobilenumber')

        feedback=request.POST.get('feedback')

        Feedback_Model.objects.create(name=name,mobilenumber=mobilenumber,feed
back=feedback,)

        return redirect('feedback')

    return render(request,'client/feedback.html')

Research/views.py

from django.db.models import Count

from django.shortcuts import render, redirect

from Client.models import Userregister_Model, TweetModel, Feedback_Model

27 | S t . M a r y ’ s G r o u p o f I n s ti t u ti o n s H y d e r a b a d
Analysis of Women Safety in Indian Cities Using Machine Learning on Tweets

def admin_login(request):

    if request.method  == "POST":

        admin = request.POST.get('admin')

        password = request.POST.get('password')

        if admin == "admin" and password =="admin":

            return redirect('admin_viewpage')

    return render(request,'research/admin_login.html')

def admin_viewpage(request):

    obj = Userregister_Model.objects.all()

    return render(request,'research/admin_viewpage.html',{'object':obj})

def admin_viewfeedback(request):

    obj=Feedback_Model.objects.all()

    return render(request,'research/admin_viewfeedback.html',{'objects':obj})

def admin_viewtrending(request):

    topic = TweetModel.objects.values('topics').annotate(dcount=Count('topics')).order
_by('-dcount')

    return  render(request,'research/admin_viewtrending.html',{'objects':topic})

def viewtreandingtopics(request,chart_type):

    dd = {}

    pos,neu,neg =0,0,0

28 | S t . M a r y ’ s G r o u p o f I n s ti t u ti o n s H y d e r a b a d
Analysis of Women Safety in Indian Cities Using Machine Learning on Tweets

    poss=None

    topic = TweetModel.objects.values('topics').annotate(dcount=Count('topics')).order
_by('-dcount')

    for t in topic:

        topics=t['topics']

        pos_count=TweetModel.objects.filter(topics=topics).values('sentiment').annotate
(topiccount=Count('topics'))

        poss=pos_count

        for pp in pos_count:

            senti= pp['sentiment']

            if senti == 'positive':

                pos= pp['topiccount']

            elif senti == 'negative':

                neg = pp['topiccount']

            elif senti == 'nutral':

                neu = pp['topiccount']

        dd[topics]=[pos,neg,neu]

    return render(request,'research/viewtreandingtopics.html',
{'object':topic,'dd':dd,'chart_type':chart_type})

def negativefeedbacktivechart(request,chart_type):

    dd = {}

    pos, neu, neg = 0, 0, 0

    poss = None

29 | S t . M a r y ’ s G r o u p o f I n s ti t u ti o n s H y d e r a b a d
Analysis of Women Safety in Indian Cities Using Machine Learning on Tweets

    topic = TweetModel.objects.values('topics').annotate(dcount=Count('topics')).order
_by('-dcount')

    for t in topic:

        topics = t['topics']

        pos_count = TweetModel.objects.filter(topics=topics).values('sentiment').annotat
e(topiccount=Count('topics'))

        poss = pos_count

        for pp in pos_count:

            senti = pp['sentiment']

            if senti == 'positive':

                pos = pp['topiccount']

            elif senti == 'negative':

                neg = pp['topiccount']

            elif senti == 'nutral':

                neu = pp['topiccount']

        dd[topics] = [pos, neg, neu]

    return render(request,'research/negativefeedbacktivechart.html',
{'object':topic,'dd':dd,'chart_type':chart_type})

30 | S t . M a r y ’ s G r o u p o f I n s ti t u ti o n s H y d e r a b a d
Analysis of Women Safety in Indian Cities Using Machine Learning on Tweets

9. SOFTWARE ENVIRONMENT

9.1 PYTHON

Python is a general-purpose interpreted, interactive, object-oriented, and high-level


programming language. An interpreted language, Python has a design philosophy that
emphasizes code readability (notably using whitespace indentation to delimit code
blocks rather than curly brackets or keywords), and a syntax that allows programmers
to express concepts in fewer lines of code than might be used in languages such as C+
+ or Java. It provides constructs that enable clear programming on both small and
large scales. Python interpreters are available for many operating systems. CPython,
the reference implementation of Python, is open-source software and has a
community-based development model, as do nearly all of its variant implementations.
CPython is managed by the non-profit Python Software Foundation. Python features
a dynamic type system and automatic memory management. It supports
multiple programming paradigms, including object-
oriented, imperative, functional and procedural, and has a large and
comprehensive standard library

9.2 DJANGO

Django is a high-level Python Web framework that encourages rapid development


and clean, pragmatic design. Built by experienced developers, it takes care of much of
the hassle of Web development, so you can focus on writing your app without
needing to reinvent the wheel. It’s free and open source.

Django's primary goal is to ease the creation of complex, database-driven websites.


Django emphasizes reusability and "pluggability" of components, rapid development,
and the principle of don't repeat yourself. Python is used throughout, even for settings
files and data models.

31 | S t . M a r y ’ s G r o u p o f I n s ti t u ti o n s H y d e r a b a d
Analysis of Women Safety in Indian Cities Using Machine Learning on Tweets

Fig. 9.1: Django (1)

Django also provides an optional administrative create, read, update and


delete interface that is generated dynamically through introspection and configured
via admin models

Fig. 9.2: Django (2)

32 | S t . M a r y ’ s G r o u p o f I n s ti t u ti o n s H y d e r a b a d
Analysis of Women Safety in Indian Cities Using Machine Learning on Tweets

10. SYSTEM TESTING

The purpose of testing is to discover errors. Testing is the process of trying to


discover every conceivable fault or weakness in a work product. It provides a way to
check the functionality of components, sub-assemblies, assemblies and/or a finished
product It is the process of exercising software with the intent of ensuring that the
Software system meets its requirements and user expectations and does not fail in an
unacceptable manner. There are various types of test. Each test type addresses a
specific testing requirement.

10.1 TYPES OF TESTS

10.1.1 Unit testing

Unit testing involves the design of test cases that validate that the
internal program logic is functioning properly, and that program inputs produce valid
outputs. All decision branches and internal code flow should be validated. It is the
testing of individual software units of the application .it is done after the completion
of an individual unit before integration. This is a structural testing, that relies on
knowledge of its construction and is invasive. Unit tests perform basic tests at
component level and test a specific business process, application, and/or system
configuration. Unit tests ensure that each unique path of a business process performs
accurately to the documented specifications and contains clearly defined inputs and
expected results.

10.1.2 Integration testing

Integration tests are designed to test integrated software


components to determine if they actually run as one program. Testing is event driven
and is more concerned with the basic outcome of screens or fields. Integration tests
demonstrate that although the components were individually satisfaction, as shown by
successfully unit testing, the combination of components is correct and consistent.
Integration testing is specifically aimed at exposing the problems that arise from the
combination of components.

33 | S t . M a r y ’ s G r o u p o f I n s ti t u ti o n s H y d e r a b a d
Analysis of Women Safety in Indian Cities Using Machine Learning on Tweets

10.1.3 Functional Testing

Functional tests provide systematic demonstrations that functions tested are available
as specified by the business and technical requirements, system documentation, and
user manuals.

Functional testing is centered on the following items:

Valid Input : identified classes of valid input must be accepted.

Invalid Input : identified classes of invalid input must be rejected.

Functions : identified functions must be exercised.

Output : identified classes of application outputs must be exercised.

Systems/Procedures : interfacing systems or procedures must be invoked.

Organization and preparation of functional tests is focused on


requirements, key functions, or special test cases. In addition, systematic coverage
pertaining to identify Business process flows; data fields, predefined processes, and
successive processes must be considered for testing. Before functional testing is
complete, additional tests are identified and the effective value of current tests is
determined.

10.1.4 System Test

System testing ensures that the entire integrated software system meets
requirements. It tests a configuration to ensure known and predictable results. An
example of system testing is the configuration oriented system integration test.
System testing is based on process descriptions and flows, emphasizing pre-driven
process links and integration points.

10.1.5 White Box Testing

White Box Testing is a testing in which in which the software tester


has knowledge of the inner workings, structure and language of the software, or at

34 | S t . M a r y ’ s G r o u p o f I n s ti t u ti o n s H y d e r a b a d
Analysis of Women Safety in Indian Cities Using Machine Learning on Tweets

least its purpose. It is purpose. It is used to test areas that cannot be reached from a
black box level.

10.1.6 Black Box Testing

Black Box Testing is testing the software without any knowledge of


the inner workings, structure or language of the module being tested. Black box tests,
as most other kinds of tests, must be written from a definitive source document, such
as specification or requirements document, such as specification or requirements
document. It is a testing in which the software under test is treated, as a black
box .you cannot “see” into it. The test provides inputs and responds to outputs without
considering how the software works.

10.1.7 Unit Testing

Unit testing is usually conducted as part of a combined code and unit


test phase of the software lifecycle, although it is not uncommon for coding and unit
testing to be conducted as two distinct phases.

Test strategy and approach

Field testing will be performed manually and functional tests will be


written in detail.

Test objectives

 All field entries must work properly.

 Pages must be activated from the identified link.

 The entry screen, messages and responses must not be delayed.

Features to be tested

 Verify that the entries are of the correct format

 No duplicate entries should be allowed

 All links should take the user to the correct page.

35 | S t . M a r y ’ s G r o u p o f I n s ti t u ti o n s H y d e r a b a d
Analysis of Women Safety in Indian Cities Using Machine Learning on Tweets

10.1.8 Integration Testing

Software integration testing is the incremental integration testing of two


or more integrated software components on a single platform to produce failures
caused by interface defects.

The task of the integration test is to check that components or software applications,
e.g., components in a software system or – one step up – software applications at the
company level – interact without error.

Test Results: All the test cases mentioned above passed successfully. No defects
encountered.

10.1.9 Acceptance Testing

User Acceptance Testing is a critical phase of any project and requires significant
participation by the end user. It also ensures that the system meets the functional
requirements.

Test Results: All the test cases mentioned above passed successfully. No defects
encountered.

36 | S t . M a r y ’ s G r o u p o f I n s ti t u ti o n s H y d e r a b a d
Analysis of Women Safety in Indian Cities Using Machine Learning on Tweets

11. SYSTEM STUDY

11.1 FEASIBILITY STUDY

The feasibility of the project is analyzed in this phase and business proposal is
put forth with a very general plan for the project and some cost estimates. During
system analysis the feasibility study of the proposed system is to be carried out. This
is to ensure that the proposed system is not a burden to the company. For feasibility
analysis, some understanding of the major requirements for the system is essential.

Three key considerations involved in the feasibility analysis are,

 ECONOMICAL FEASIBILITY

 TECHNICAL FEASIBILITY

 SOCIAL FEASIBILITY

11.1.1 ECONOMICAL FEASIBILITY

This study is carried out to check the economic impact that the system will
have on the organization. The amount of fund that the company can pour into the
research and development of the system is limited. The expenditures must be justified.
Thus the developed system as well within the budget and this was achieved because
most of the technologies used are freely available. Only the customized products had
to be purchased.

11.1.2 TECHNICAL FEASIBILITY

This study is carried out to check the technical feasibility, that is, the technical
requirements of the system. Any system developed must not have a high demand on
the available technical resources. This will lead to high demands on the available
technical resources. This will lead to high demands being placed on the client. The
developed system must have a modest requirement, as only minimal or null changes
are required for implementing this system.

37 | S t . M a r y ’ s G r o u p o f I n s ti t u ti o n s H y d e r a b a d
Analysis of Women Safety in Indian Cities Using Machine Learning on Tweets

11.1.3 SOCIAL FEASIBILITY

The aspect of study is to check the level of acceptance of the system by the
user. This includes the process of training the user to use the system efficiently. The
user must not feel threatened by the system, instead must accept it as a necessity. The
level of acceptance by the users solely depends on the methods that are employed to
educate the user about the system and to make him familiar with it. His level of
confidence must be raised so that he is also able to make some constructive criticism,
which is welcomed, as he is the final user of the system.

38 | S t . M a r y ’ s G r o u p o f I n s ti t u ti o n s H y d e r a b a d
Analysis of Women Safety in Indian Cities Using Machine Learning on Tweets

12. CONCLUSION

Throughout the research paper we have discussed about various machine learning
algorithms that can help us to organize and analyze the huge amount of Twitter data
obtained including millions of tweets and text messages shared every day. These
machine learning algorithms are very effective and useful when it comes to analyzing
of large amount of data including the SPC algorithm and linear algebraic Factor
Model approaches which help to further categorize the data into meaningful groups.
Support vector machines is yet another form of machine learning algorithm that is
very popular in extracting Useful information from the Twitter and get an idea about
the status of women safety in Indian cities.

39 | S t . M a r y ’ s G r o u p o f I n s ti t u ti o n s H y d e r a b a d
Analysis of Women Safety in Indian Cities Using Machine Learning on Tweets

13. REFERENCES
1. Apoorv Agarwal, Fadi Biadsy, and Kathleen R. Mckeown. "Contextual
phrase-level polarity analysis using lexical affect scoring and syntactic n-
grams." Proceedings of the 12th Conference of the European Chapter of the
Association for Computational Linguistics. Association for Computational
Linguistics, 2009.
2. Luciano Barbosa and Junlan Feng. "Robust sentiment detection on twitter
from biased and noisy data." Proceedings of the 23rd international conference
on computational linguistics: posters. Association for Computational
Linguistics, 2010.
3. Adam Bermingham and Alan F. Smeaton. "Classifying sentiment in
microblogs: is brevity an advantage?." Proceedings of the 19th ACM
international conference on Information and knowledge management. ACM,
2010.
4. Michael Gamon. "Sentiment classification on customer feedback data: noisy
data, large feature vectors, and the role of linguistic analysis." Proceedings of
the 20th international conference on Computational Linguistics. Association
for Computational Linguistics, 2004.
5. Soo-Min Kim and Eduard Hovy. "Determining the sentiment of opinions."
Proceedings of the 20th international conference on Computational
Linguistics. Association for Computational Linguistics, 2004.
6. Dan Klein and Christopher D. Manning. "Accurate unlexicalized parsing."
Proceedings of the 41st Annual Meeting on Association for Computational
Linguistics-Volume 1. Association for Computational Linguistics, 2003.
International Research Journal of Engineering and Technology (IRJET) e-
ISSN: 2395-0056 Volume: 07 Issue: 06 | June 2020 www.irjet.net p-ISSN:
2395-0072 © 2020, IRJET | Impact Factor value: 7.529 | ISO 9001:2008
Certified Journal | Page 2279
7. Eugene Charniak and Mark Johnson. "Coarse-to-fine n-best parsing and
MaxEnt discriminative reranking." Proceedings of the 43rd annual meeting on
association for computational linguistics. Association for Computational
Linguistics, 2005.

40 | S t . M a r y ’ s G r o u p o f I n s ti t u ti o n s H y d e r a b a d
Analysis of Women Safety in Indian Cities Using Machine Learning on Tweets

8. Gupta B, Negi M, Vishwakarma K, Rawat G & Badhani P (2017). “Study of


Twitter sentiment analysis using machine learning algorithms on Python.”
International Journal of Computer Applications, 165(9) 0975-8887.
9. Sahayak V, Shete V & Pathan A (2015). “Sentiment analysis on twitter data.”
International Journal of Innovative Research in Advanced Engineering
(IJIRAE), 2(1), 178-183.
10. Mamgain N, Mehta E, Mittal A & Bhatt G (2016, March). “Sentiment analysis
of top colleges in India using Twitter data.” In Computational Techniques, in
Information and Communication Technologies (ICCTICT), 2016 International
Conference on (pp. 525-530). IEEE.

41 | S t . M a r y ’ s G r o u p o f I n s ti t u ti o n s H y d e r a b a d
Analysis of Women Safety in Indian Cities Using Machine Learning on Tweets

14. SCREENSHOTS
1. Today’s Trending

2. Positive Tweets Analysis

42 | S t . M a r y ’ s G r o u p o f I n s ti t u ti o n s H y d e r a b a d
Analysis of Women Safety in Indian Cities Using Machine Learning on Tweets

3. Negative Tweets Analysis

4. Final Report (Bar Chart)

43 | S t . M a r y ’ s G r o u p o f I n s ti t u ti o n s H y d e r a b a d
Analysis of Women Safety in Indian Cities Using Machine Learning on Tweets

5. Final Report (Pie Chart)

6. Final Report (Doughnut Chart)

44 | S t . M a r y ’ s G r o u p o f I n s ti t u ti o n s H y d e r a b a d
Analysis of Women Safety in Indian Cities Using Machine Learning on Tweets

7. Final Report (Funnel Chart)

45 | S t . M a r y ’ s G r o u p o f I n s ti t u ti o n s H y d e r a b a d

You might also like