Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
2
2023-362
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
2023-362
2023-362
Commits
bc1061b7
Commit
bc1061b7
authored
Oct 30, 2023
by
Thathsarani R.P.H.S.R
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Modified utils.py
parent
cca659cd
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
30 additions
and
0 deletions
+30
-0
IT20201364/utils.py
IT20201364/utils.py
+30
-0
No files found.
IT20201364/utils.py
0 → 100644
View file @
bc1061b7
import
datetime
def
wake_up
(
text
,
name
):
if
text
is
not
None
:
return
True
if
name
in
text
.
lower
()
else
False
return
False
def
action_time
():
return
datetime
.
datetime
.
now
()
.
time
()
.
strftime
(
'
%
H:
%
M'
)
def
calculate_stress_level
(
sentiment_analysis
):
# Determine stress level based on detected emotions
if
any
(
emotion
in
sentiment_analysis
for
emotion
in
[
"Angry"
,
"Fear"
,
"Sad"
,
"Disgust"
]):
return
"High Stress"
elif
any
(
emotion
in
sentiment_analysis
for
emotion
in
[
"Happy"
,
"Disgust"
]):
return
"Low Stress"
else
:
return
"Low Stress"
def
calculate_emotion_percentages
(
sentiment_analysis
):
total_emotions
=
len
(
sentiment_analysis
)
emotion_count
=
{}
for
emotion
in
sentiment_analysis
:
emotion_count
[
emotion
]
=
emotion_count
.
get
(
emotion
,
0
)
+
1
emotion_percentages
=
{}
for
emotion
,
count
in
emotion_count
.
items
():
percentage
=
(
count
/
total_emotions
)
*
100
emotion_percentages
[
emotion
]
=
round
(
percentage
,
2
)
return
emotion_percentages
\ No newline at end of file
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