Downloads · 30 days
6
13% of all-time downloads
akaruineko/bad-good-classifier-ru_en
bad-good-classifier-ru_en is a text classification model from akaruineko. Use it when you need a label for a piece of text. The card lists the license as mit.
[!WARNING] Legacy model FTAN 1.0 (bad-good-classifier-ruen) 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 perform…
Downloads · 30 days
6
13% of all-time downloads
All-time downloads
45
Public
Parameters
11.8M
141 MB on disk
Likes
0
Public
Click a slice to open those files.
.pt94.3 MB · 66%
From the Hugging Face model README
[!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.5instead.FTAN 1.0 is primarily intended for:
- experimenting with word-level classification
- research
- exploring the early development of the FTAN model family
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.
Make sure you have Python 3.7+ and the Hugging Face transformers package installed:
pip install transformers torch
Example of classifying a single text:
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}")
LABEL_0 = bad, LABEL_1 = good
The model is trained on two datasets labeled "good" and "bad". The data is manually prepared and includes texts in Russian and English.
MIT License.
Thanks for using this classifier! Feel free to share feedback and improvement ideas.