Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/redtius/talkpole

🤖🔍 An AI Model that determines sentence sentiment polarity.
https://github.com/redtius/talkpole

cnn-model convolutional-neural-networks deep-learning deep-neural-networks flask keras long-short-term-memory-models nlp python sentiment-analysis sentiment-classification sentiment-polarity tensorflow

Last synced: 7 days ago
JSON representation

🤖🔍 An AI Model that determines sentence sentiment polarity.

Awesome Lists containing this project

README

        

# TalkPole


Project Logo


TalkPole Logo

## Overview

TalkPole is an innovative sentiment analysis model designed to accurately predict the sentiment of French sentences. Leveraging a range of neural network architectures, TalkPole excels in discerning both positive and negative sentiments with high precision. Trained on a comprehensive French dataset, TalkPole is finely tuned to understand and interpret the nuances of the French language.

As a forward-thinking solution, TalkPole seamlessly integrates into microservices architectures and offers flexible deployment through REST APIs, making it a versatile choice for modern applications.


Project Showcase


TalkPole UI Version

## Features

**Multiple Models**
* CNN
* LSTM
* CNN-BiLSTM
* DistilBERT (still under development)

Here is a comparative analysis of the models tested for classifying text as positive or negative. The CNN model demonstrated the best performance in accurately labeling the sentiment.


Models Comparison 1


Accuracy/Precision/Recall Comparison

However, when it comes to precision in determining the sentiment polarity, the CNN model fell short. In contrast, the CNN-BiLSTM model excelled in this aspect. The improved precision of the CNN-BiLSTM model is largely due to the context-sensitive capabilities of the BiLSTM layer, which enhances its ability to capture and interpret subtle nuances in sentiment more effectively.


Models Comparison 2


Performance on 100 Sentences

Here's when to use each model:

*CNN*
* Perfomance Requirements
* Precision in Positivity or Negativity
* No need to determine Neutrality
* No context awareness needed
* Large Amount of Data

*CNN-BiLSTM & LSTM*
* Context awareness needed
* Need to determine Neutrality
* Polarity Precision
* Small Amount of Data

**REST API Version**

Exposes a REST API for interaction with the sentiment analysis service.

**Kafka Version**

Integrates with Kafka to process and analyze data in real-time.

This version could be used in Microservices architecture.

**UI Version**

In Case, You wanted to experiment with different models and check documetations, you can use the UI Version

## Tools

This project wouldn't be possible without these tools:







Tools Used

## Installation

### Prerequisites

* Python 3.x
* Tensorflow 2.17.0
* Keras 3.x
* Flask 3.x
* Kafka
* Docker

### Steps

**For Kafka Versions**

1. Clone Repository or use docker image in dockerhub

```bash
git clone https://github.com/Redtius/TalkPole.git -b Kafka-CNN-BiLSTM
```
OR
```bash
docker pull redtius/talkpole:kafka-cnn-bilstm
```

2. Set Up Kafka for the container
make sure you setup these **Required** Environment variables:

* `KAFKA_PORT` : set it to the port of the kafka server.
* `KAFKA_HOST` : set it to the host of the kafka server.

3. Run the Application

you can use docker compose to run the application

```bash
docker-compose up -d
```

OR

run the container depending on your own use

```bash
docker run -e KAFKA_PORT=9092 -e KAFKA_HOST=localhost -p 5000:5000 talkpole
```

### Usage

Request Body:
```json
{
#"ref":"reference-id",
"content":"c'est le meilleur produit"
}
```
Response Body:
```json
{
#"ref":"reference-id",
#"content":"c'est le meilleur produit",
"result":"0.97864554"
}
```

#### Kafka Integration

* **Producer**: Sends Messages to `talkpole_out` topic.
* **Consumer**: Listens to `talkpole_in` topic.

## Testing

To run Unit Tests for the project

```bash
pytest
```

## Troubleshooting

* **Common Issues**
* Kafka connection problems: Ensure Kafka is running and accessible.
* Model loading issues: Verify model files are present and correctly referenced.
* Versions incompatibility: Make sure all dependencies have the right versions and python is 3.12+.

## License

This Project is under the Apache 2.0 License.