How to use from the
Use from the
Scikit-learn library
from huggingface_hub import hf_hub_download
import joblib
model = joblib.load(
	hf_hub_download("Legenddefsx/charling", "sklearn_model.joblib")
)
# only load pickle files from sources you trust
# read more about it here https://skops.readthedocs.io/en/stable/persistence.html

๐Ÿง  CharLing - Turkish/English Language Detection Model

Model Description

CharLing is a lightweight and fast language detection model trained on 882,555 parallel Turkish-English sentence pairs. It uses character frequency analysis with n-grams (2-4) combined with a Logistic Regression classifier, achieving 99.61% accuracy on the test set. The model is designed to quickly distinguish between Turkish and English text with minimal computational resources, making it ideal for preprocessing pipelines, multilingual applications, and edge devices.

๐ŸŽฏ Quick Start

import pickle

# Download and load the model
with open('charling.pkl', 'rb') as f:
    model_data = pickle.load(f)

vectorizer = model_data['vectorizer']
classifier = model_data['classifier']

def detect_language(text):
    vector = vectorizer.transform([text])
    prediction = classifier.predict(vector)[0]
    return "๐Ÿ‡น๐Ÿ‡ท Turkish" if prediction == 0 else "๐Ÿ‡ฌ๐Ÿ‡ง English"

# Test it
print(detect_language("Bugรผn hava รงok gรผzel."))  # ๐Ÿ‡น๐Ÿ‡ท Turkish
print(detect_language("The weather is nice today."))  # ๐Ÿ‡ฌ๐Ÿ‡ง English
Downloads last month
-
Inference Providers NEW
This model isn't deployed by any Inference Provider. ๐Ÿ™‹ Ask for provider support