You are on page 1of 56

A Mini Project Report On

“SENTIMENT CLASSIFICATION USING SENTIMENT


EMBEDDINGS FOR CROSS DOMAINS ”
Submitted in partial fulfillment of the requirement for the award of the degree of

BACHELOR OF TECHNOLOGY
In

COMPUTER SCIENCE AND ENGINEERING

By

GURDEEP KAUR JANDU (15UPIA0524)

PRANAVA CHINDAM (15UP1A0511)

Under the guidance of


Dr. A . GAUTAMI LATHA

DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING

VIGNAN’S INSTITUTE OF MANAGEMENT AND


TECHNOLOGY FOR WOMEN
(Approved by AICTE, New Delhi & Affiliated to JNTU, Hyderabad)

KONDAPUR (V), GHATKESAR (M), RANGAREDDY (DT), TELANGANA, INDIA-


501301

www.vmtw.in

2015-2019
VIGNAN’S INSTITUTE OF MANAGEMENT AND TECHNOLOGY
FOR WOMEN

DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING

DECLARATION

We hereby declare that the project entitled “Sentiment


Classification Using Sentiment Embeddings For Cross Domains” is
bonafide work duly completed by us. It does not contain any part of the
project or thesis submitted by any other candidate to this or any other
institute of the university.

All such materials that have been obtained from other


sources have been duly acknowledged.

GURDEEP KAUR JANDU (15UPIA0524)

PRANAVA CHINDAM (15UP1A0511)


VIGNAN’S INSTITUTE OF MANAGEMENT AND TECHNOLOGY
FOR WOMEN

DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING

CERTIFICATE

This is to certify that the thesis work titled “Sentiment Classification


Using Sentiment Embeddings For Cross Domains” submitted by Gurdeep
Kaur Jandu(15UP1A0524) , Pranava Chindam(15UP1A0511) in partial
fulfillment of the requirements for the award of the degree of Bachelor of
Technology in Computer Science & Engineering to the Vignan's Institute Of
Management And Technology For Women, Ghatkesar is a record of
bonafide work carried out by them under my guidance and supervision.

The results embodied in this project report have not been submitted
in any university for the award of any degree and the results are achieved
successfully.

Mrs. A.GAUTAMI LATHA Mrs. A.GAUTAMI LATHA


Associate Professor Associate Professor
(Head of the Department) (Head of the Department)

(EXTERNAL EXAMINER)
ACKNOWLEDGEMENT

We would like to express our sincere gratitude to Dr. P.Sudhakara Rao,


Principal, Vignan’s Institute of Management and Technology for Women for his
timely suggestions which helped us to complete the project.

We would also like to thank our madam Mrs.Dr.A.Gautami Latha,


Associate Professor and Head of the Department, Computer Science and
Engineering for providing us with constant encouragement and resources which
helped us to complete the project.

We would like to thank our project guide, Mrs.Dr.A.Gautami Latha,


Associate Professor and Head of the Department, Computer Science and
Engineering for her timely cooperation and valuable suggestions throughout the
project.

We would also like to thank all our professors, lecturers, teaching and
non-teaching staff-members, parents and friends for their motivation and
encouragement which helped us complete the project.

With the grace of Almighty, all the efforts put, have yielded fruitful results.
We express our sincere gratitude towards each and everyone who has been supportive
in the successful completion of this project.

GURDEEP KAUR JANDU (15UPIA0524)

PRANAVA CHINDAM (15UP1A0511)


INDEX

ABSTRACT i
LIST OF FIGURES ii
LIST OF TABLES iii
1. INTRODUCTION 1
1.1. Existing System 1
1.2. Proposed System 2
2. LITERATURE SURVEY 3
2.1. Feasibility Analysis 3
2.2.Related Work 4
2.2.1. A neural probabilistic language model 4
2.2.2. Distributed representations of words and phrases 4
2.2.3. Word alignment modeling 5
2.2.4. Learning Sentiment-specific word embedding 5
3. SYSTEM REQUIREMENTS 6
4. SYSTEM ARCHITECTURE 7
5. SYSTEM DESIGN 8
5.1. Use case Diagram 9
5.2. Class Diagram 10
5.3. Sequence Diagram 11
5.4. Flowchart for User 12
5.5. Flowchart for Admin 13
6. IMPLEMENTATION 14
6.1. Modules 14
6.1.1 . Admin & User Entity 14
6.1.2. Word Level Sentiment Classification 14
6.1.3. Sentiment Level Sentiment Classification 14
6.2. Sample code 15
7. SYSYTEM TESTING 23
7.1. Types of tests 23
7.2. Unit Testing 23
7.3. Integration Testing 24
7.4. Acceptance Testing 24
7.5. Testing Methodologies 24
7.6. Other Testing Methodologies 25
7.7. Testing Strategy 27
7.8. Test Cases 27
8. RESULTS 28
9. CONCLUSIONS 44
10. REFERENCES 45
Sentiment Classification Using Sentiment Embeddings

ABSTRACT

Unsupervised Cross-domain Sentiment Classification is the task of adapting a


sentiment classifier trained on a particular domain (source domain), to a different domain
(target domain), without requiring any labeled data for the target domain. By adapting an
existing sentiment classifier to previously unseen target domains, we can avoid the cost
for manual data annotation for the target domain. We model this problem as embedding
learning, and construct three objective functions that capture:

(a) distributional properties of pivots (i.e., common features that appear in both source
and target domains),

(b) label constraints in the source domain documents, and

(c) geometric properties in the unlabeled documents in both source and target domains.

Unlike prior proposals that first learn a lower-dimensional embedding


independent of the source domain sentiment labels, and next a sentiment classifier in this
embedding, our joint optimisation method learns embeddings that are sensitive to
sentiment classification. . Among the individual objective functions, the best performance
is obtained by (c). Moreover, the proposed method reports cross-domain sentiment
classification accuracies that are statistically comparable to the current state-of-the-art
embedding learning methods for cross-domain sentiment classification.

Department of CSE i VMTW


Sentiment Classification Using Sentiment Embeddings

LIST OF FIGURES

NAME PAGE NO.


System Architecture 7
Use case Diagram 9
Class Diagram 10

Sequence Diagram 11
Flowchart for User 12
Flowchart for Admin 13

Home page 28

Admin login page 29

Admin home page 30

Adding new domains and list of added domains 31

Adding new products 32

Viewing all products 33

Search history of users 34

Registration page for users 35

User login page 36

User home page 37

User searching products 38

User reviews about product 39

Express feelings using emojis 40

Product reviews 41

Positive and negative reviews of products 42

Graph analyzation of product 43

Department of CSE ii VMTW


Sentiment Classification Using Sentiment Embeddings

LIST OF TABLES

NAME PAGE NO
Test case for user module 27
Test case for admin module 27

Department of CSE iii VMTW


Sentiment Classification Using Sentiment Embeddings

Department of CSE iv VMTW


Sentiment Classification Using Sentiment Embeddings

1. INTRODUCTION

The ability to correctly identify the sentiment expressed in user-reviews about a


particular product is an important task for several reasons . First, if there is a negative
sentiment associated with a particular feature of a product, the manufacturer can take
immediate actions to address the issue. From the users point-of-view, in online stores
where one cannot physically touch and evaluate a product as in a real-world store, the
user opinions are the only available subjective descriptors of the product . By
automatically classifying the user-reviews , we can assist the potential buyers of a product
to easily understand the overall opinion about that product. Sentiment classification can
be considered as an instance of text classification where a given document must be
classified into a pre-defined set of sentiment classes . We use the term document to refer
various types of user reviews. In binary sentiment classification, a document must be
classified into two classes depending on whether it expresses a positive or a negative
sentiment towards an entity. We are proposing a system which classifies the reviews based
on different domains .

1.1. EXISTING SYSTEM

One popular solution to cross-domain sentiment classification is to first project


the source and the target features into the same lower-dimensional embedding, and
subsequently learn a sentiment classifier on this embedded feature space. This approach
is particularly attractive when there is little overlap between the original source and the
target feature spaces. Similarly distributed words in the source and the target domains get
mapped to closer points in the embedded space, thereby reducing the mismatch of features
in the two domains.

Prior work on cross-domain sentiment classification use unlabeled data from the
source and the target domains to first learn a low-dimensional embedding for the two
domains. Next, labeled reviews in the source domain are projected onto this embedding.
Finally, a binary sentiment classifier is trained using the projected source domain labeled
training instances.

Department of CSE 1 VMTW


Sentiment Classification Using Sentiment Embeddings

A limitation of existing two-step approach that decouples the embedding learning


and sentiment classifier training is that the embeddings learnt in the first step is agnostic
to the sentiment of the documents, which is the ultimate goal in cross-domain sentiment
classification. This method does not consider source domain labeled data during the PLSR
step, which makes the projection agnostic to sentiment classification. Supervised
dimensionality reduction methods are prone to overfitting when the number of labeled
instances are small.

1.2. PROPOSED SYSTEM

The embedding learnt by our method enforces three important requirements. First,
a set of domain independent features (also known as pivots) are selected from the source
and target domains which must be mapped as close as possible in the embedded space.

Second, friend closeness and enemy dispersion of the source domain labeled
documents must be preserved. In other words, positively labeled documents must be
embedded closer to each other and far from the negatively labeled documents. Likewise,
negatively labeled documents must be embedded closer to each other and far from the
positively labeled documents.

Third, within each domain, the local geometry among the documents must be
preserved. For example, unlabeled neighbor documents in the source domain must be
embedded closer to each other in the embedded space whereas, unlabeled neighbor
documents in the target domain must be embedded closer to each other in the embedded
space.

We evaluate the effectiveness of sentiment embeddings empirically by applying


them to two sentiment analysis tasks. Word level sentiment analysis on benchmark
sentiment lexicons can help us see whether sentiment embeddings are useful to discover
similarities between sentiment words. Sentence level sentiment classification on tweets
and reviews help us understand whether sentiment embeddings are helpful in capturing
discriminative features for predict the sentiment of text. The proposed method can be
easily extended to more than two sentiment.

2.LITERATURE SURVEY

Department of CSE 2 VMTW


Sentiment Classification Using Sentiment Embeddings

The purpose of the literature survey is to place the each work in the context of its
contribution to understanding the research problem being studied. It also identifies new
ways to interpret prior research .

2.1. FEASIBLITY ANALYSIS

An important outcome of preliminary investigation is the determination that the


system request is feasible. This is possible only if it is feasible within limited resource
and time. The different feasibilities that have to be analyzed are

 Operational Feasibility
 Economic Feasibility
 Technical Feasibility

2.1.1 OPERATIONAL FEASIBILITY:

Operational Feasibility deals with the study of prospects of the system to be


developed. This system operationally eliminates all the tensions of the Admin and helps
him in effectively tracking the project progress. This kind of automation will surely reduce
the time and energy, which previously consumed in manual work. Based on the study, the
system is proved to be operationally feasible.

2.1.2 ECONOMICAL FEASIBILITY:

Economic Feasibility or Cost-benefit is an assessment of the economic


justification for a computer based project. As hardware was installed from the beginning
& for lots of purposes thus the cost on project of hardware is low. Since the system is a
network based, any number of employees connected to the LAN within that organization
can use this tool from at anytime. The Virtual Private Network is to be developed using
the existing resources of the organization. So the project is economically feasible.

2.1.3. TECHNICAL FEASIBILITY:

Department of CSE 3 VMTW


Sentiment Classification Using Sentiment Embeddings

According to Roger S. Pressman, Technical Feasibility is the assessment of the


technical resources of the organization. The organization needs IBM compatible
machines with a graphical web browser connected to the Internet and Intranet. The
system is developed for platform Independent environment. Java Server Pages,
JavaScript, HTML, SQL server and WebLogic Server are used to develop the system.
The technical feasibility has been carried out. The system is technically feasible for
development and can be developed with the existing facility.

2.2. RELATED WORK

2.2.1. A neural probabilistic language model

Authors: Y. Bengio, R. Ducharme, P. Vincent, and C. Janvin.

A goal of statistical language modeling is to learn the joint probability function of


sequences of words in a language. This is intrinsically difficult because of the curse of
dimensionality: a word sequence on which the model will be tested is likely to be
different from all the word sequences seen during training. Traditional but very successful
approaches based on n-grams obtain generalization by concatenating very short
overlapping sequences seen in the training set. They proposed to fight the curse of
dimensionality by learning a distributed representation for words .

2.2.2. Distributed representations of words and phrases

Authors: T. Mikolov, I. Sutskever, K. Chen, G. Corrado, and J. Dean.


The recently introduced continuous Skip-gram model is an efficient method for
learning high-quality distributed vector representations that capture a large number of
precise syntactic and semantic word relationships. In this they present several extensions
that improve both the quality of the vectors and the training speed. By subsampling of the
frequent words we obtain significant speedup and also learn more regular word
representations. They also describe a simple alternative to the hierarchical softmax called
negative sampling.

Department of CSE 4 VMTW


Sentiment Classification Using Sentiment Embeddings

2.2.3. Word alignment modeling with context dependent

Authors: N. Yang, S. Liu, M. Li, M. Zhou, and N. Yu.

They explored a novel bilingual word alignment approach based on DNN (Deep
Neural Network), which has been proven to be very effective in various machine learning
tasks . We describe in detail how we adapt and extend the CD-DNNHMM method
introduced in speech recognition to the HMM based word alignment model, in which
bilingual word embedding is discriminatively learnt to capture lexical translation
information, and surrounding words are leveraged to model context information in
bilingual sentences.

2.2.4. Learning Sentiment-specific word embedding

Authors: D. Tang, F. Wei, N. Yang, M. Zhou, T. Liu, and B.

They present a method that learns word embedding for Twitter sentiment
classification. Most existing algorithms for learning continuous word representations
typically only model the syntactic context of words but ignore the sentiment of text. This
is problematic for sentiment analysis as they usually map words with similar syntactic
context but opposite sentiment polarity, such as good and bad, to neighboring word
vectors. It address this issue by learning sentiment specific word embedding (SSWE).

3. SYSTEM REQUIREMENTS

Department of CSE 5 VMTW


Sentiment Classification Using Sentiment Embeddings

3.1 SOFTWARE REQUIREMENTS

Operating system : Windows 7

Coding Language : JAVA

Database : MYSQL

Web server : Apache Tomcat

3.2. HARDWARE REQUIREMENTS

Processor : intel core i3

Hard disk : 120 GB

Monitor : 15” LED

RAM : 4 GB

4. SYSTEM ARCHITECTURE

Department of CSE 6 VMTW


Sentiment Classification Using Sentiment Embeddings

Figure(1): System architecture for Sentiment Embeddings for Cross Domains .

5. SYSTEM DESIGN

UML DIAGRAMS

Department of CSE 7 VMTW


Sentiment Classification Using Sentiment Embeddings

UML stands for Unified Modeling Language. UML is a standardized


general-purpose modeling language in the field of object-oriented software
engineering. The standard is managed, and was created by, the Object Management
Group. The goal is for UML to become a common language for creating models
of object oriented computer software.

Use Case Diagram

A use case diagram in the Unified Modeling Language (UML) is a type of


behavioral diagram defined by and created from a Use-case analysis. . The main
purpose of a use case diagram is to show what system functions are performed for
which actor. Roles of the actors in the system can be depicted.

Class Diagram

A class diagram in the Unified Modeling Language (UML) is a type of static


structure diagram that describes the structure of a system by showing the system's
classes, their attributes, operations (or methods), and the relationships among the
classes. It explains which class contains information .

Sequence Diagram

A sequence diagram in Unified Modeling Language (UML) is a kind of


interaction diagram that shows how processes operate with one another and in what
order.

5.1 USECASE DIAGRAM


Sentiment Embedding using Sentiment
Classification for cross domains

Department of CSE 8 VMTW


Sentiment Classification Using Sentiment Embeddings

Registration

Login

Add And View Domains

Add New Products

Search Product

Give Reviews For Product


User
Admin
View Reviews For Products

View User History

View All Products

View Positive and Negative Reviews


For Domains

View Graph Analyzation of


domain Reviews

Logout

This diagram explains about the various actors who interact with the system
and view the products , give reviews and analyze the reviews . Each user has their
specific function represented by oval shaped . It gives the functionality of the
system .

5.2. CLASS DIAGRAM

User Admin
Department of CSE 9 VMTW

Add And View Domain()


Sentiment Classification Using Sentiment Embeddings

username
username
password
password

This diagram gives the details of the attributes and operations that can
be performed by each entity of the system . The system can be accessed only after
successful authentication .

5.3. SEQUENCE DIAGRAM

SERVICE
Department of CSE 10 VMTW
Sentiment Classification Using Sentiment Embeddings

DATABASE

This diagram shows the interaction between the user , admin and database
which are shown in timelines .

5.4. FLOWCHART FOR USER

This flowchart shows the actions performed by the user upon authorized login.

Department of CSE 11 VMTW


Sentiment Classification Using Sentiment Embeddings

USER login

Unauthorized
Check
user

Search Products

Give Reviews

View Reviews

View Search History

View All Products

End process

5.5. FLOWCHART FOR ADMIN

This flowchart shows the actions performed by the admin upon authorized login.

Department of CSE 12 VMTW


Sentiment Classification Using Sentiment Embeddings

ADMIN LOGIN

Yes No
Check Unauthorized

Add And View Domain

Add New Product

View All Products

View Users Search History

View Positive and


Negative Reviews of
Domain

View Graph Analyzation


Of Domain

End process

6 . IMPLEMENTATION

6.1. MODULES:

Department of CSE 13 VMTW


Sentiment Classification Using Sentiment Embeddings

This application that is designed is split into modules where module handles their
respective tasks . The modules are :

1. Admin & user entity

2. Word level sentiment classification

3. Sentence level sentiment classification.

6.1.1 . ADMIN & USER ENTITY

The users view the Uploaded product details and give reviews to that products and
users expose their emotions by the way of emojis. Admin upload the products under
the products domains for the users. Admin can view all uploaded products .Here
admin is view domains the sentiment analysis of the Users reviews and emojis.

6.1.2. WORD LEVEL SENTIMENT CLASSIFICATION

A sentiment embedding should have the ability to map positive words into close
vectors, to map negative words into close vectors, and to separate positive words and
negative words apart. We conduct word level sentiment classification to further
investigate the effectiveness of sentiment embeddings in capturing similarities
between sentiment words.

6.1.3. SENTENCE LEVEL SENTIMENT CLASSIFICATION

This helps us to investigate whether sentiment embedding is capable of capturing


discriminative features for classifying the polarity labels (e.g., emojis) of text.

6.2. SAMPLE CODE

6.2.1. SAMPLE CODE FOR CHECKING POSITIVE REVIEWS

File name : checkingm2.jsp

Department of CSE 14 VMTW


Sentiment Classification Using Sentiment Embeddings

<%@page import="network.DbConnection"%>

<%@page import="java.io.InputStreamReader"%>

<%@page import="java.io.BufferedReader"%>

<%@page import="java.io.InputStream"%>

<%@page import="java.util.regex.Matcher"%>

<%@page import="java.util.regex.Pattern"%>

<%@page import="java.sql.Statement"%>

<%@page import="java.sql.Connection"%>

<%@page import="java.sql.ResultSet"%>

<%@page import="java.util.logging.Level"%>

<%@page import="java.io.FileNotFoundException"%>

<%@page import="java.util.Scanner"%>

<%@page import="java.io.File"%>

<%@page import="java.util.ArrayList"%>

<%@page import="java.util.List"%>

<% Integer count=0;

//creating Arraylist of Strings

List<String> timesArray = new ArrayList<String>();

File file = new File("E:\\poss.txt"); // opens poss.txt file

Scanner scanner = null;

Statement st4=null;

Connection con4=null;

scanner = new Scanner(file);

Department of CSE 15 VMTW


Sentiment Classification Using Sentiment Embeddings

try {

while (scanner.hasNextLine()) {

String[] times = scanner.nextLine().split(","); // creates an array of each string


separated by a comma(,)
for (String time : times) {

timesArray.add(time);//adds strings to timesArray

System.out.println(timesArray);

String text=null;

String productname;

String productid;

String reviews;

String InputStream;

String domains;

String topic;

String ffid;

String filename;

String username;

String domain = request.getParameter("domain");

//returns string value given in domain

session.setAttribute("domain", domain);

//saves an domain in session with unique name "domain"

ResultSet rs3;

Connection con3 = DbConnection .getConnection(); //connection is established

Department of CSE 16 VMTW


Sentiment Classification Using Sentiment Embeddings

Statement st3 = (Statement) con3.createStatement();

rs3 = (ResultSet) st3.executeQuery("SELECT * FROM review where domain = '" +


domain + "' "); //retrieves review from database using SQL query

StringBuffer sb=new StringBuffer(); //creates a empty string buffer of name sb

while(rs3.next())

{ productid = rs3.getString("productid");

productname = rs3.getString("title");

domains = rs3.getString("domain");

reviews = rs3.getString("review");

text = reviews;

String[] regexp = times; //creates the string

for (int i=0;i<=regexp.length-1;i++)

System.out.println(regexp[i]); //prints data present regexp

Pattern pattern = Pattern.compile(regexp[i]); //creates a pattern instance

Matcher matcher = pattern.matcher(text); //creates a matcher instance

for (count = 0; matcher.find(); count++) ;

//matcher.find() - find the match for the text that is passed

String status = "dsfds";

String textt = "fgdfg";

System.out.println("Count: " + count);

System.out.println("&&&&&&&&&&&&&&&"+regexp[i]);

st4=(Statement) con3.createStatement();

Department of CSE 17 VMTW


Sentiment Classification Using Sentiment Embeddings

String sql = "insert into positive(productid,productname ,review, countt,


reputation,domain)values ('" + productid + "','" + productname + "','" + text + "','" +
count + "','" + regexp[i] + "','" + domains + "')"; //query to insert record in positive table

int x=st4.executeUpdate(sql);

if(x!=0){

System.out.println("not inserted");

else{

System.out.println("uninserted");

}}

System.out.println("Count: " +text);}

con3.close();

st3.close();

st4.close(); }}

catch (Exception ex) {

ex.printStackTrace();

response.sendRedirect("checkingn3.jsp");

%>

6.2.2. SAMPLE CODE FOR CHECKING NEGATIVE REVIEWS

File name: checkingn3.jsp

Department of CSE 18 VMTW


Sentiment Classification Using Sentiment Embeddings

<%@page import="network.DbConnection"%>

<%@page import="java.io.InputStreamReader"%>

<%@page import="java.io.BufferedReader"%>

<%@page import="java.io.InputStream"%>

<%@page import="java.util.regex.Matcher"%>

<%@page import="java.util.regex.Pattern"%>

<%@page import="java.sql.Statement"%>

<%@page import="java.sql.Connection"%>

<%@page import="java.sql.ResultSet"%>

<%@page import="java.util.logging.Level"%>

<%@page import="java.io.FileNotFoundException"%>

<%@page import="java.util.Scanner"%>

<%@page import="java.io.File"%>

<%@page import="java.util.ArrayList"%>

<%@page import="java.util.List"%>

<%

Integer count=0;

List<String> timesArray = new ArrayList<String>();

File file = new File("E:\\negative.txt");// opens negative.txt file

Scanner scanner = null;

Statement st4=null;

Connection con4=null;

scanner = new Scanner(file);

Department of CSE 19 VMTW


Sentiment Classification Using Sentiment Embeddings

try {

while (scanner.hasNextLine()) {

String[] times = scanner.nextLine().split(",");


//creates an array of each string separated by a comma(,)
for (String time : times) {

timesArray.add(time);//adds string to timesArray

System.out.println(timesArray);

String text=null;

String productname;

String productid;

String reviews;

String InputStream;

String domains;

String topic;

String ffid;

String filename;

String username;

String domain = request.getParameter("domain");

//returns a string value given in domain

session.setAttribute("domain", domain);

//saves the domain values in session with unique name "domain"

ResultSet rs3;

Connection con3 = DbConnection .getConnection();//connection is established

Department of CSE 20 VMTW


Sentiment Classification Using Sentiment Embeddings

Statement st3 = (Statement) con3.createStatement();

rs3 = (ResultSet) st3.executeQuery("SELECT * FROM review where domain = '" +


domain + "' "); //retrieves review from the database using SQL query

StringBuffer sb=new StringBuffer();//creates an empty string buffer of name sb

while(rs3.next())

{ productid = rs3.getString("productid");

productname = rs3.getString("title");

domains = rs3.getString("domain");

reviews = rs3.getString("review");

text = reviews;

String[] regexp = times; //creates a string

for (int i=0;i<=regexp.length-1;i++)

System.out.println(regexp[i]);

Pattern pattern = Pattern.compile(regexp[i]);//creates a pattern instance

Matcher matcher = pattern.matcher(text);//creates matcher instance

for (count = 0; matcher.find(); count++) ;

//matcher.find() - find the match for the text that is passed

String status = "dsfds";

String textt = "fgdfg";

System.out.println("Count: " + count);

System.out.println("&&&&&&&&&&&&&&&"+regexp[i]);

st4=(Statement) con3.createStatement();

Department of CSE 21 VMTW


Sentiment Classification Using Sentiment Embeddings

String sql = "insert into negative(productid,productname ,review, countt,


reputation,domain)values ('" + productid + "','" + productname + "','" + text + "','" +
count + "','" + regexp[i] + "','" + domains + "')";

//query to insert record into negative table

int x=st4.executeUpdate(sql);

if(x!=0){

System.out.println("not inserted");

else{

System.out.println("uninserted");

}}

System.out.println("Count: " +text);}

con3.close();

st3.close();

st4.close(); }}

catch (Exception ex) {

ex.printStackTrace();

response.sendRedirect("positiverev1.jsp");

%>

7. SYSTEM TESTING

Department of CSE 22 VMTW


Sentiment Classification Using Sentiment Embeddings

System testing is series of different tests whose primary purpose is to fully


exercise the computer based system. Although each test has a different purpose, all the
work should verify that all system element have been properly integrated and perform
allocated functions.

System Implementation is the process of having systems personnel check out and
put newly developed package into use, train users how to interact with it, install the new
application and construct any files of data needed to use the package.

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.

7.1. TYPES OF TESTING

The different types of testing are:

 Unit testing
 Integration testing
 Acceptance testing

7.2. 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

Department of CSE 23 VMTW


Sentiment Classification Using Sentiment Embeddings

of a business process performs accurately to the documented specifications and contains


clearly defined inputs and expected result.

7.3. 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.

7.4. 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.

7.5. TESTING METHODOLOGIES

UNIT TESTING

Unit Testing is defined as a type of software testing where individual units/


components of a software are tested .Unit Testing of software applications is done during
the development (coding) of an application. The objective of Unit Testing is to isolate a
section of code and verify its correctness. In procedural programming, a unit may be an
individual function or procedure. Unit Testing is usually performed by the developer.

INTEGRATION TESTING
Integration Testing is defined as a type of testing where software modules are
integrated logically and tested as a group. A typical software project consists of multiple
software modules, coded by different programmers. Integration Testing focuses on
checking data communication amongst these modules.

Department of CSE 24 VMTW


Sentiment Classification Using Sentiment Embeddings

SYSTEM TESTING
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.

PERFORMANCE TESTING

Performance Testing is defined as a type of software testing to ensure software


applications will perform well under their expected workload. Features and Functionality
supported by a software system is not the only concern. A software application's
performance like its response time, reliability, resource usage and scalability do matter.
The goal of Performance Testing is not to find bugs but to eliminate performance
bottlenecks.

7.6 OTHER TESTING METHODOLOGIES

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.

Department of CSE 25 VMTW


Sentiment Classification Using Sentiment Embeddings

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.

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 least its purpose. It is
purpose. It is used to test areas that cannot be reached from a black box level.

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.

7.7. TESTING STRATEGIES


Field testing will be performed manually and functional tests will be written in
detail.
The different types of testing strategies are :
 Unit testing
 Integration testing
 Validation testing
 System testing

Department of CSE 26 VMTW


Sentiment Classification Using Sentiment Embeddings

7.8. TEST CASES


Test case for user module :

Test Case Input Expected Actual Description


Output Output
Valid login Username, Success Success Test Passed
password ,Control transferred
to menu .
Invalid Username, Failed Failed Test Passed .
login Password Try Again or
register
If the first user

Test case for Admin module :

Test Case Input Expected Actual Description


Output Output
Valid login Username, Success Success Test Passed
password ,Control transferred
to menu .
Invalid Username, Failed Failed Test Passed .
login Password Displays the
message
of Incompleteness
of failure

8. RESULTS

8.1. FORMS AND REPORTS

HOME PAGE :

This is home page of our application which is started using web browser , which
includes menus admin where like HOMEPAGE , USER,ADMIN

Department of CSE 27 VMTW


Sentiment Classification Using Sentiment Embeddings

Fig(ii): Home Page

FORM 1 :

ADMIN LOGIN PAGE

This login page is for admin where admin need to enter correct username and
password to login .

Department of CSE 28 VMTW


Sentiment Classification Using Sentiment Embeddings

Fig(iii) : Admin Login Page

REPORT 1:

ADMIN HOME PAGE :

This page includes all the actions performed by admin such as adding domains ,
products and graph analyzation of reviews .

Department of CSE 29 VMTW


Sentiment Classification Using Sentiment Embeddings

Fig(iv) : Admin Home Page

FORM 2:

ADDING NEW DOMAINS & LIST OF ADDED DOMAIN :

Here admin is adding kitchen appliances as domain and previously added domains
are also listed below i.e., laptops ,Books .

Department of CSE 30 VMTW


Sentiment Classification Using Sentiment Embeddings

Fig(v) : Adding New Domains & List of Added Domain

FORM 3:

ADDING NEW PRODUCTS

After adding domains , admin upload the products with fields such as product
name , price , description and product image .

Department of CSE 31 VMTW


Sentiment Classification Using Sentiment Embeddings

Fig(vi) : Adding New Products

REPORT 2:

VIEWING ALL PRODUCTS

Admin can also view all product list been with fields such as product name , price
, description uploaded with their associated description .

Department of CSE 32 VMTW


Sentiment Classification Using Sentiment Embeddings

Fig(vii) : Viewing All Products

REPORT 3:

SEARCH HISTORY OF USERS

Admin can view the user search history i.e., at what time a user searched for a
product .

Department of CSE 33 VMTW


Sentiment Classification Using Sentiment Embeddings

Fig(viii) : Search History of Users

FORM 4:

REGISTRATION PAGE FOR USERS:


If user want to give reviews ,he need to first register by filling the details such
as name , email , password , gender , dob , phone no. ,location .

Department of CSE 34 VMTW


Sentiment Classification Using Sentiment Embeddings

Fig(ix) : Registration Page for Users.

FORM 5:

USER LOGIN PAGE


This page shows the login page for the users . After registration only a user
can login by entering valid username and password .

Department of CSE 35 VMTW


Sentiment Classification Using Sentiment Embeddings

Fig(x) : User Login Page

REPORT 4:

USERS HOME PAGE :

Once user logins ,user can search for a product and give Reviews for the products
.

Department of CSE 36 VMTW


Sentiment Classification Using Sentiment Embeddings

Fig(xi) : Users home page

FORM 6:

USER SEARCHING PRODUCT :


User can search for product by entering product name and searched results will
be viewed .

Department of CSE 37 VMTW


Sentiment Classification Using Sentiment Embeddings

Fig(xii) : User Searching Product

REPORT 5:

USER REVIEWS ABOUT PRODUCT :


Users give reviews for a particular product either a in form of word or in a
sentence .

Department of CSE 38 VMTW


Sentiment Classification Using Sentiment Embeddings

Fig(xii) : User Reviews about Product

REPORT 6:

EXPRESS FEELINGS USING EMOJIS :


User can not only express his reviews on a particular product in text but
also
using emojis .

Department of CSE 39 VMTW


Sentiment Classification Using Sentiment Embeddings

Fig(xiii) : Express Feelings using emojis

REPORT 7:

PRODUCT REVIEWS :
All the reviews given by a user can be viewed for a particular product in this
page .

Department of CSE 40 VMTW


Sentiment Classification Using Sentiment Embeddings

Fig(xiv) : product reviews

REPORT 8:

POSITIVE AND NEGATIVE REVIEWS PRODUCT :


Once users express their feelings and admin can differentiate positive and
negative reviews for a particular domain .

Department of CSE 41 VMTW


Sentiment Classification Using Sentiment Embeddings

Fig(xv) : Positive and Negative Reviews

REPORT 9:

GRAPH ANALYZATION OF PRODUCT

Admin can easily analyze the reviews in graphical representation where


blue color represents positive reviews , red color represents negative reviews .

Department of CSE 42 VMTW


Sentiment Classification Using Sentiment Embeddings

Fig(xvi) : Graph Analyzation of Product

9. CONCLUSION

As we have considered three constraints i.e.,

a) a set of domain independent features (also known as pivots)

Department of CSE 43 VMTW


Sentiment Classification Using Sentiment Embeddings

b) Label constraints in the source domain documents and

c) Geometric properties of both domains.

that must be satisfied by an embedding that can be used to train a cross domain
sentiment classification method. We evaluated the performance of the individual
constraints as well as their combinations using a benchmark dataset for cross domain
sentiment classification. Our experimental results show that some of the combinations of
the proposed constraints . Unlike previously proposed embedding
learning approaches for cross-domain sentiment classification, our proposed method uses
the label information available for the source domain reviews, thereby learning
embeddings that are sensitive to the final task of application, which is sentiment
classification.

10.REFERENCES

1. D. Tang, F. Wei, N. Yang, M. Zhou, T. Liu, and B. Qin, “Learning


Sentiment-specific word embedding for twitter sentiment classification,” in
Proc. 52th Annu. Meeting Assoc. Comput. Linguistics., 2014, pp. 1555–
1565.

Department of CSE 44 VMTW


Sentiment Classification Using Sentiment Embeddings

2. D. Tang, F. Wei, B. Qin, M. Zhou, and T. Liu, “Building large-scale twitter-


specific sentiment lexicon: A representation learning approach,” in Proc. 25th Int.
Conf. Comput. Linguistics, 2014, pp. 172–182.

3. D. Tang, F. Wei, B. Qin, T. Liu, and M. Zhou, “Coooolll: A deep learning


system for twitter sentiment classification,” in Proc. 8th Int. Workshop
Semantic Eval., 2014, pp. 208–212.

4. C. D. Manning and H. Sch€utze, Foundations of Statistical Natural Language


Processing. Cambridge, MA, USA: MIT Press, 1999.

5. D. Jurafsky and H. James, Speech and Language Processing: An Introduction to


Natural Language Processing, Computational Linguistics, and Speech
Recognition. Englewood Cliffs, NJ, USA: Prentice-Hall, 2000.

6. ] Y. Bengio, R. Ducharme, P. Vincent, and C. Janvin, “A neural probabilistic


language model,” J. Mach. Learning Res., vol. 3, pp. 1137–1155, 2003.

7. T. Mikolov, I. Sutskever, K. Chen, G. Corrado, and J. Dean, “Distributed


representations of words and phrases and their compositionality,” in Proc. Conf.
Neural Inf. Process. Syst., 2013, pp. 3111–3119.

8. J. Pennington, R. Socher, and C. Manning, “Glove: Global vectors for word


representation,” in Proc. Conf. Empirical Methods Natural Lang. Process., 2014,
pp. 1532–1543.

9. Z. S. Harris, “Distributional structure,” Word, vol. 10, pp. 146–162, 1954.

Department of CSE 45 VMTW


Sentiment Classification Using Sentiment Embeddings

10. N. Yang, S. Liu, M. Li, M. Zhou, and N. Yu, “Word alignment modeling with
context dependent deep neural network,” in Proc. 51st Annu. Meeting Assoc.
Comput. Linguistics, 2013, pp. 166–175.

Department of CSE 46 VMTW

You might also like