VinMir's picture
Added model files for emotion
003c9f5
|
raw
history blame
2.64 kB

GordonAI

GordonAI is an AI package designed for sentiment analysis, emotion detection, and fact-checking classification. The models are pre-trained on three languages: Italian, English, and Spanish.

Features

  • Sentiment Analysis: Classifies text into three categories: positive, negative, and neutral.
  • Emotion Detection: Identifies the six basic emotions defined by Paul Ekman (1992): joy, sadness, fear, anger, surprise, disgust (plus neutral).
  • Fact-Checking Classification: Classifies text into disinformation, hoax, fake news, or true news.

Installation

You can install the package using pip. Simply run the following command:

pip install GordonAI

Usage

Sentiment Analysis

You can use the SentimentAnalyzer to predict the sentiment of a text. The analyzer classifies texts as positive, negative, or neutral.

from GordonAI.models import SentimentAnalyzer
# Initialize the sentiment analyzer
analyzer = SentimentAnalyzer()
# Predict sentiment of a list of texts
result = analyzer.predict(["This is a great product!", "This is a terrible mistake."])
# Output the predictions
print(result)

Emotion Detection

You can use the EmotionAnalyzer to predict the emotion of a text. The analyzer classifies texts as joy, sadness, fear, anger, surprise, disgust or neutral.

from GordonAI.models import EmotionAnalyzer
# Initialize the emotion analyzer
emotion_analyzer = EmotionAnalyzer()
# Predict emotions of a list of texts
result = emotion_analyzer.predict(["I'm so happy today!", "I'm feeling really sad."])
# Output the predictions
print(result)

Fact-Checking Classification

You can use the FactAnalyzer to predict whether a texts or a claim falls into categories like disinformation, fake news, hoax, or true news.

from GordonAI.models import FactAnalyzer
# Initialize the emotion analyzer
fact_analyzer  = FactAnalyzer()
# Predict emotions of a list of texts
result = fact_analyzer.predict(["This news story is about a real event.", "This news article is based on fake information."])
# Output the predictions
print(result)

Requirements

Python >= 3.9 transformers torch

You can install the dependencies using:

pip install transformers torch

Acknowledgments

This package is part of the work for my doctoral thesis. I would like to thank NeoData and Università di Catania for their valuable contributions to the development of this project.