CoolFace
Modelpublic

akaruineko/bad-good-classifier-ru_en

sourceHugging Facemitupdated 1mo agoView on Hugging Face
0likes8downloads
Model Card
[!WARNING] ## Legacy model FTAN 1.0 (`bad-good-classifier-ru_en`) is an old release from the early FTAN series. This version performs word-level classification and is not intended to replace newer FTAN releases. Its performance, label behavior, and capabilities may differ significantly from newer versions of the model. For general-purpose binary offensive-text classification, use `akaruineko/ftan-2.5` instead. FTAN 1.0 is primarily intended for: experimenting with word-level classification research * exploring the early development of the FTAN model family

bad-good-text-classifier-ru-en

Description

This is an effective and simple neural network that can classify words as positive or negative in both Russian and English. It is suitable for filtering chats, comments, reviews and other texts to detect toxicity or negative content. However, the model is not ideal.

Features

  • Bilingual model (Russian(focus is on russian), English).
  • Fast and accurate classification
  • Easy integration into Python projects
  • Trained on a custom dataset with "good" and "bad" labels

Installation

Make sure you have Python 3.7+ and the Hugging Face transformers package installed:

bash
pip install transformers torch

Usage

Example of classifying a single text:

python
from transformers import AutoModelForSequenceClassification, AutoTokenizer
import torch

model_name = "akaruineko/bad-good-classifier-ru_en"

tokenizer = AutoTokenizer.from_pretrained(model_name)
model = AutoModelForSequenceClassification.from_pretrained(model_name)

def classify_word(word):
    inputs = tokenizer(word, return_tensors="pt", truncation=True, padding=True)
    outputs = model(**inputs)
    probs = torch.softmax(outputs.logits, dim=1)
    return {"good": probs[0][1].item(), "bad": probs[0][0].item()}

def classify_text_by_words(text):
    words = text.split()
    results = {}
    for w in words:
        results[w] = classify_word(w)
    return results

if __name__ == "__main__":
    sample_text = "Example text for classification"
    results = classify_text_by_words(sample_text)
    for word, scores in results.items():
        print(f"Word: '{word}' - Good: {scores['good']:.4f}, Bad: {scores['bad']:.4f}")

LABEL0 = bad, LABEL1 = good

Training Data

The model is trained on two datasets labeled "good" and "bad". The data is manually prepared and includes texts in Russian and English.

Training Results

  • Epochs: 12
  • Minimum loss: \~0.03
  • High accuracy on test dataset

License

MIT License.


Thanks for using this classifier! Feel free to share feedback and improvement ideas.