Skip to content

zimuse/solutions_emotion

main
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 

Emotion recognition (prediction) solutions

SID:10135033

You need to have python3 installed.

To run first solution

python3 xproject.py

To run second solution

pip install openai
python3 bot.py

-First Solution- #Emotion recognition using trigger words
Stores trigger words in angTriggerWords.txt joyTriggerWords.txt preTriggerWords.txt
and equivalent emotions are predefined in the emotions.txt file.
If files do not exist on the path where the script is located, it will create them
and populate with predefined trigger words, same goes for emotions
results file stores just 2 numbers, first one is correct guesses, next one is
total guesses. Files are read that way that words are split into according arrays.
Then then after user passes input to the program, the for loop starts and using
method called "any()" it first checks if the trigger word for angry is present in the sentence,
then for joy and for pressured. If none are found the program will prompt the user if the algorithm should be improved
if yes, there will be a choice to populate 1 out of 3 files with a trigger word, if no the program stopps and 1 is added to the total guess count.
If the guess was correct (user said yes), +1 is added to the correct guesses integer and saved to the file.
Main knowledge that was used is developed from the Computer Science course in Coventry University
Also referred to documentation located in https://docs.python.org/3/library/functions.html

-Second solution- Referred to
https://platform.openai.com/docs/api-reference/introduction
The second option was created with Python and makes two API calls to the OpenAI API after every user input.
The first API call made following the user's input includes an emotion prediction function.
This call generates a JSON output that is then cleaned up, and the response is saved as a string that is conditionally produced based on the emotional state.
The programme indicates that the user's emotion has changed if its emotional state changes; else, it does not output the emotion change component.
The model can anticipate emotions with the aid of the API, but since it does not generate sentient, it is still able to predict emotions and give a satisfactory result.
Also conversational module (other API call) gets context and last emotion of the previous message. That enhances user experience and disguises this bot to appear as a "human"

About

Emotional recognition solutions

Resources

Stars

Watchers

Forks

Releases

No releases published

Languages