Skip to content

About

Python wrapper and web UI for IBM Watson NLP emotion detection (anger, disgust, fear, joy, sadness).

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

 
 

Latest commit

 

History

7 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

EmotionDetector

Python wrapper and web UI for IBM Watson NLP emotion detection (anger, disgust, fear, joy, sadness).

Features

  • emotion_detector(text) sends text to the Watson NLP emotion endpoint and returns scores for anger, disgust, fear, joy and sadness.
  • Adds a dominant_emotion field with the highest-scoring emotion.
  • Returns None for every emotion (and for dominant_emotion) if the request or parsing fails.
  • Single-page UI (templates/index.html) with a text box and a "Run Sentiment Analysis" button that shows the result below the form.

Project layout

final_project/emotion_detection.py   Watson NLP client function
templates/index.html                  Single-page UI (Bootstrap 4)
static/mywebscript.js                 Sends the text to the backend and renders the response

Run it

Requirements: Python 3 and the requests package. The detector calls a hosted IBM Watson endpoint, so network access is required.

pip install requests
python -c "from final_project.emotion_detection import emotion_detector; print(emotion_detector('I am so happy today'))"

The UI is plain HTML and JavaScript. Its script calls emotionDetector?textToAnalyze=<text>, but this repository does not include the server route that serves that endpoint, so the page cannot return results from this repo alone. Open templates/index.html only after adding a backend that provides that route.

License

Apache License 2.0. See LICENSE.

About

Python wrapper and web UI for IBM Watson NLP emotion detection (anger, disgust, fear, joy, sadness).

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages