Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
2
2021-060
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
2021-060
2021-060
Commits
2171709d
Commit
2171709d
authored
Sep 21, 2021
by
Dhananjaya Jayashanka
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update textAnalyze.py file
parent
60e7e948
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
6 deletions
+9
-6
Emotion/textAnalyze.py
Emotion/textAnalyze.py
+9
-6
No files found.
Emotion/textAnalyze.py
View file @
2171709d
import
string
from
collections
import
Counter
def
textAnalyze
(
speech
):
text
=
speech
...
...
@@ -36,13 +37,15 @@ def textAnalyze(speech):
final_words
.
append
(
word
)
emotion_list
=
[]
with
open
(
'Emotion/emotions.txt'
,
'r'
)
as
file
:
for
line
in
file
:
clear_line
=
line
.
replace
(
"
\n
"
,
''
)
.
replace
(
","
,
''
)
.
replace
(
"'"
,
''
)
.
strip
()
word
,
emotion
=
clear_line
.
split
(
':'
)
if
word
in
final_words
:
emotion_list
.
append
(
emotion
)
for
i
in
final_words
:
with
open
(
'Emotion/emotions.txt'
,
'r'
)
as
file
:
for
line
in
file
:
clear_line
=
line
.
replace
(
"
\n
"
,
''
)
.
replace
(
","
,
''
)
.
replace
(
"'"
,
''
)
.
strip
()
word
,
emotion
=
clear_line
.
split
(
':'
)
if
i
in
word
:
final_emotions
=
emotion
.
replace
(
""
,
''
)
.
strip
()
emotion_list
.
append
(
final_emotions
)
print
(
emotion_list
)
w
=
Counter
(
emotion_list
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment