Downloads · 30 days
0
dinisds/stylometric-ai-detector
stylometric-ai-detector is a text classification model from dinisds. Use it when you need a label for a piece of text. It is set up for scikit-learn. The card lists the license as mit.
AI vs Human text detection using stylometric features and a Random Forest classifier.
Downloads · 30 days
0
Access
Public
Updated Jul 5, 2026
Repo size
419 MB
Likes
0
Public
Click a slice to open those files.
.joblib838 MB · 100%
From the Hugging Face model README
AI vs Human text detection using stylometric features and a Random Forest classifier.
This model classifies text as AI-generated or human-written based on 8 stylometric features:
| Feature | Description |
|---|---|
char_count | Total number of characters |
word_count | Total number of words |
avg_word_len | Average word length |
punct_count | Number of punctuation characters |
sentence_count | Number of sentences |
avg_sentence_len | Average sentence length (in words) |
upper_case_count | Number of fully uppercase alphabetic words |
title_case_count | Number of title-case words |
| Class | Precision | Recall | F1-score | Support |
|---|---|---|---|---|
| Human (0) | 0.96 | 0.98 | 0.97 | 61,112 |
| AI (1) | 0.97 | 0.92 | 0.95 | 36,335 |
| Weighted avg | 0.96 | 0.96 | 0.96 | 97,447 |
Install the Python package:
pip install stylometric-ai-detector
from stylometric_ai_detector import extract_stylometric_features, predict
# Extract features
features = extract_stylometric_features("Your text here...")
# Predict AI vs Human
result = predict(text="Your text here...")
# {"label": "AI", "probability": 0.87}
Or load the model directly:
import joblib
from huggingface_hub import hf_hub_download
path = hf_hub_download(
repo_id="dinisds/stylometric-ai-detector",
filename="random_forest_stylometric_model.joblib",
)
model = joblib.load(path)
FEATURES = [
"char_count", "word_count", "avg_word_len", "punct_count",
"sentence_count", "avg_sentence_len", "upper_case_count", "title_case_count",
]
# model.predict([[char_count, word_count, avg_word_len, punct_count,
# sentence_count, avg_sentence_len, upper_case_count, title_case_count]])
# 0 = Human, 1 = AI
This model is used by the stylometric-ai-detector Python package:
pip install stylometric-ai-detector
from stylometric_ai_detector import predict
result = predict(text="Your text here...")
Dataset: Shanegerami's AI vs Human Text on Kaggle.
MIT