Professional Documents
Culture Documents
CHAPTER 3
SYSTEM ANALYSIS
3. SYSTEM STUDY
3.1 FEASIBILITY STUDY
The existing application using traditional algorithms such as Random
Forest or SVM.These detect sentiments from user messages. But those
algorithms accuracy is not better and they are not maintaining user
personal information such as their personal profile to send motivational
messages in ontologies.
SVM is used for classification with several feature selection techniques in
the depression detection context.
The SMO algorithm(Sequential Minimal Optimization is used for
solving quadratic programming problem) is used to train SVM(Support
Vector Machine); SMO was the most accurate for predicting depression
among senior citizens.
Random Forest and Naive Bayes algorithms are also used for
sentiment analysis, fordetecting psychological disturbances on OSN; the
results present an accuracy of about 0.8.
Random Forest:In sentiment analysis, the goal is to figure out the
sentiment (positive, negative, or neutral) of a piece of text from a social
media post. Each decision tree in the Random Forest looks at different
aspects of the text and makes its own prediction. Then, the Random Forest
combines all these predictions to make the final result.
DISADVANTAGES:
The system doesn’t have access to a wide range of accurate and up to date
information so it may not be able to provide desired accuracy.
Low efficiency and accuracy
PROPOSED SYSTEM:
The main goal of this work is to introduce an RS that uses an
approach named Knowledge-Based Recommendation System (KBRS),
which aggregates an ontology collection for health scenarios, named
Nuadu, which is not addressed in other RSs designed to improve
emotional health. The proposed KBRS also includes the sentiment
analysis approach and an emotional health monitoring system.
The monitoring system filters sentences from an OSN that allows
to identify potential users with depression or stress conditions. To
accomplish this task, an objective method based on an BLSTM-RNN is
used to detect potential psychological disorders, along an CNN.
Later, a KBRS is activated to send happy, calm, relaxing, or
motivational messages to these users. These messages have different
intensity levels depending on the sentiment intensity of the sentences
posted on an OSN, which is determined by anenhanced sentiment
analysis metric, eSM2.
eSM2: It is like a helpful judge of opinion in text. It gives you a clear idea of
whether something is positive, negative, or neutral.
Sentiment analysis metrics typically assess the performance of sentiment
analysis models by comparing their predictions to ground truth labels (actual
ADVANTAGES:
An innovative solution given by the proposed system classifies the
sentences with depressive or stressed content.
The presence of certain words in the sentences can be monitored and
analyzed to identify users at a high risk of attempting suicide and an
appropriate intervention can take place.
The results from KBRS using BLSTM-RNN and ontology reached 94%
of satisfied users and improves emotional health.
High accuracy and efficiency.
SOFTWARE REQUIREMENT:
Operating system : Windows 11
Coding Language : PYTHON 3.7
Database : MYSQL
Editor : Jupyter notebook
HARDWARE REQUIREMENT:
Storage : 512 SSD
RAM : 8 Gb
Processor : Intel Core i5/10 Gen
Usecase Diagram:
Sequence Diagram:
The application starts running when it is executed for the first time. The server
has to be started and then the internet explorer in used as the browser. The
project will run on the local area network so the server machine will serve as
the administrator while the other connected systems can act as the clients. The
developed system is highly user friendly and can be easily understood by
anyone using it even for the first time.
What is Python
Below are some facts about Python.
Python is currently the most widely used multi-purpose, high-level
programming language.
Python allows programming in Object-Oriented and Procedural
paradigms. Python programs generally are smaller than other
programming languages like Java.
Programmers have to type relatively less and indentation requirement of
the language, makes them readable all the time.
Python language is being used by almost all tech-giant companies like –
Google, Amazon, Facebook, Instagram, Dropbox, Uber… etc.
The biggest strength of Python is huge collection of standard library
which can be used for the following –
Machine Learning
GUI Applications (like Kivy, Tkinter, PyQt etc. )
Web frameworks like Django (used by YouTube, Instagram,
Dropbox)
Image processing (like Opencv, Pillow)
Web scraping (like Scrapy, BeautifulSoup, Selenium)
Test frameworks
Multimedia
Advantages of Python :-
Let’s see how Python dominates over other languages.
A Knowledge-Based Recommendation System Includes Sentiment
Analysis 19
1. Extensive Libraries
Python downloads with an extensive library and it contain code for
various purposes like regular expressions, documentation-generation, unit-
testing, web browsers, threading, databases, CGI, email, image
manipulation, and more. So, we don’t have to write the complete code for
that manually.
2. Extensible
As we have seen earlier, Python can be extended to other languages.
You can write some of your code in languages like C++ or C. This comes
in handy, especially in projects.
3. Embeddable
Complimentary to extensibility, Python is embeddable as well. You can
put your Python code in your source code of a different language, like C+
+. This lets us add scripting capabilitiesto our code in the other language.
4. Improved Productivity
The language’s simplicity and extensive libraries render programmers
more productive than languages like Java and C++ do. Also, the fact that
you need to write less and get more things done.
5. IOT Opportunities
Since Python forms the basis of new platforms like Raspberry Pi, it finds
the future bright for the Internet Of Things. This is a way to connect the
language with the real world.
6. Simple and Easy
When working with Java, you may have to create a class to print ‘Hello
World’. But in Python, just a print statement will do. It is also quite easy
to learn, understand, andcode. This is why when people pick up Python,
they have a hard time adjusting to other more verbose languages like Java.
7. Readable
Because it is not such a verbose language, reading Python is much like
reading English. This is the reason why it is so easy to learn, understand,
Disadvantages of Python
So far, we’ve seen why Python is a great choice for your project. But if
you choose it, you should be aware of its consequences as well. Let’s now
see the downsides of choosing Python over another language.
1. Speed Limitations
We have seen that Python code is executed line by line. But since Python
is interpreted, it often results in slow execution. This, however, isn’t a
problem unless speed is a focal point for the project. In other words,
unless high speed is a requirement, the benefits offered by Python are
enough to distract us from its speed limitations.
2. Weak in Mobile Computing and Browsers
While it serves as an excellent server-side language, Python is much
rarely seen on the client-side. Besides that, it is rarely ever used to
implement smartphone-based applications. One such application is called
Carbonnelle.
CODING:
from tkinter import messagebox
from tkinter import *
stop_words = set(stopwords.words('english'))
os.environ["PYTHONIOENCODING"] = "utf-8"
main = tkinter.Tk()
main.title("Knowledge-Based Recommendation System") #designing
main screen
main.geometry("1300x1200")
def generateModel():
global X
global Y
global XX
global tokenizer
global X_train, X_test, Y_train, Y_test
X = []
Y = []
text.delete('1.0', END)
train = pd.read_csv(filename,encoding='utf8')
count = 0
for i in range(len(train)):
sentiment = train._get_value(i,0,takeable = True)
tweet = train._get_value(i,1,takeable = True)
tweet = tweet.lower()
icon = train._get_value(i,2,takeable = True)
max_fatures = 2000
tokenizer = Tokenizer(num_words=max_fatures, split=' ')
tokenizer.fit_on_texts(X)
XX = tokenizer.texts_to_sequences(X)
XX = pad_sequences(XX)
X_train, X_test, Y_train, Y_test = train_test_split(XX,Y, test_size =
0.13, random_state = 42)
def blstm():
global blstm_acc
global model
text.delete('1.0', END)
embed_dim = 128
lstm_out = 196
max_fatures = 2000
model = Sequential()
model.add(Embedding(max_fatures, embed_dim,input_length =
XX.shape[1]))
model.add(SpatialDropout1D(0.4))
model.add(LSTM(lstm_out, dropout=0.2, recurrent_dropout=0.2))
model.add(Dense(3,activation='softmax'))
def sendEmail(tomail,emaildata):
#text.delete('1.0', END)
msg = EmailMessage()
msg.set_content(emaildata)
msg['Subject'] = 'Message From Knowledge based STRESS
Application'
msg['From'] = "tejaswiniillindra@gmail.com"
msg['To'] = tomail
s = smtplib.SMTP('smtp.gmail.com', 587)
s.starttls()
s.login("tejaswiniillindra@gmail.com", "tejasowmya02")
s.send_message(msg)
s.quit()
#text.insert(END,"Email Message Sent To Authorities")
for i in range(len(test)):
email = test._get_value(i,0,takeable = True)
tweet = test._get_value(i,1,takeable = True)
arr = tweet.split(" ")
icon = ''
msg = ''
for j in range(len(arr)):
for emoji in UNICODE_EMOJI:
if emoji == arr[j]:
icon = UNICODE_EMOJI[arr[j]]
icon = ''.join(re.sub('[^A-Za-z\s]+', '', icon))
if len(icon) > 0:
for k in range(len(arr)-1):
word = arr[k].strip()
if len(word) > 2 and word not in stop_words:
msg+=arr[k]+" "
msg+=icon
else:
for k in range(len(arr)):
word = arr[k].strip()
if len(word) > 2 and word not in stop_words:
msg+=arr[k]+" "
textdata = msg.strip()
mytext = [textdata]
twts = tokenizer.texts_to_sequences(mytext)
twts = pad_sequences(twts, maxlen=19, dtype='int32', value=0)
def randomForest():
global random_acc
text.delete('1.0', END)
cls =
RandomForestClassifier(n_estimators=10,max_depth=1,random_state=4)
cls.fit(X_train, Y_train)
text.insert(END,"Prediction Results\n")
prediction_data = prediction(X_test, cls)
random_acc = cal_accuracy(Y_test, prediction_data)
main.config(bg='LightSalmon3')
main.mainloop()
CHAPTER 6
TESTING
6.1SYSTEM TEST
The purpose of testing i6s to discove.r 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
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.
Functional test
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.
Unit Testing
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.
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.
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.
CHAPTER 7
RESULTS
To run this project first double click on ‘download_nltk.bat’ file to
download natural language processing API. This API helps in removing
stop words or special symbols from messages.
After clicking the run, you will get the below screen.
In above screen we can see BLSTM model generated and its prediction
accuracy is 100% and now we can see black console below to see BLSTM
In above screen we can see beside each message application detected and
mark with stress or non-stress status. If user detected under stress, then
application recommend for motivational message. In above screen I can’t
9.REFERENCES
1. I.-R. Glavan, A. Mirica, and B. Firtescu, “The use of social media for
communication.” Official Statistics at European Level. Romanian
Statistical Review, vol. 4, pp. 37–48, Dec. 2016.
2. M. Al-Qurishi, M. S. Hossain, M. Alrubaian, S. M. M. Rahman, and A.
Alamri, “Leveraging analysis of user behavior to identify malicious
activities in large-scale social networks,” IEEE Transactions on Industrial
Informatics, vol. 14, no. 2, pp. 799–813, Feb 2018.
3. R. L. Rosa, D. Z. Rodr´ıguez, and G. Bressan, “Music recommendation
system based on user’s sentiments extracted from social networks,” IEEE
Transactions on Consumer Electronics, vol. 61, no. 3, pp. 359–367, Oct
2015.
4. R. Rosa, D. Rodr, G. Schwartz, I. de Campos Ribeiro, G. Bressan et al.,
“Monitoring system for potential users with depression using sentiment
analysis,” in 2016 IEEE International Conference on Consumer
Electronics (ICCE). Sao Paulo, Brazil: IEEE, Jan 2016, pp. 381–382.
5. I. B. Weiner and R. L. Greene, “Handbook of personality assessment,” in
John Wiley and Sons, N.J, EUA, 2008.
6. H. Lin, J. Jia, J. Qiu, Y. Zhang, G. Shen, L. Xie, J. Tang, L. Feng, and T.
S. Chua, “Detecting stress based on social interactions in social
networks,” IEEE Transactions on Knowledge and Data Engineering, vol.
29, no. 9, pp. 1820–1833, Sept 2017.
7. J. T. Hancock, K. Gee, K. Ciaccio, and J. M.-H. Lin, “I’m sad you’re sad:
Emotional contagion in cmc,” in Proceedings of the 2008 ACM