🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
DemoInstallSign in
Socket

empathy-machines

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

empathy-machines

An off-the-rack NLP sentiment classifier- upload your own corpus or use the pre-installed ones

0.5.1
PyPI
Maintainers
1

empathyMachines

A standalone NLP sentiment classifier you can import as a module

Purposes

  • Offer a batteries-included NLP classifier you can use either on it's own, or to make sentiment predictions as part of a broder NLP project (for example, when classifying customer messages, whether the customer is angry or not might help you determine if this is a compensation request, or a request to adjust their address.)
  • Have the entire sentiment prediction process scaffolded so you can feed in your own training corpus, and easily train an NLP sentiment classifier.

How to use

  • Download the repo from GitHub (pip install coming later)
  • cd into repo, and pip install -r requirements.txt
  • In your Python code, from EmpathyMachines import EmpathyMachines
  • nlp_classifier = EmpathyMachines()
  • nlp_classifier.train(corpus='Twitter')
  • nlp_classifier.predict(text_string)

Corpora included

Include your own corpus (UNDER CONSTRUCTION)

Feel free to train a classifier on your own corpus!

Two ways to do this:

  • Read in a .csv file with header row containing "sentiment", "text", and optionally, "confidence"

  • Pass in an array of Python dictionaries, with attributes for "sentiment", "text", and optionally, "confidence"

  • Create a .csv file with the following fields

  • nlp_classifier.train(corpus='custom', corpus_path='path/to/custom/corpus.csv', analytics_output=False)

Keywords

machine learning

FAQs

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts