You need to agree to share your Hugging Face information to access this model

This repository is publicly accessible, but you have to accept the conditions to access its files and content.

Log in or Sign Up to review the conditions and access this model content.

Persian Sentence Completion Classifier

A BERT-based classifier that determines whether a Persian sentence is Complete or Incomplete.
Designed for use in ASR post-processing pipelines (e.g. after speech-to-text).

Usage

from transformers import AutoTokenizer, AutoModelForSequenceClassification
import torch

MODEL_ID = "MohammadJRanjbar/persian-sentence-completion"

tokenizer = AutoTokenizer.from_pretrained(MODEL_ID)
model = AutoModelForSequenceClassification.from_pretrained(MODEL_ID)
model.eval()

label_map = {0: "Incomplete", 1: "Complete"}

def classify_sentences(sentences, batch_size=16):
    results = []
    for i in range(0, len(sentences), batch_size):
        batch = sentences[i:i+batch_size]
        inputs = tokenizer(batch, return_tensors="pt", padding=True,
                           truncation=True, max_length=128)
        with torch.no_grad():
            outputs = model(**inputs)
            preds = torch.argmax(outputs.logits, dim=-1)
            results.extend([label_map[p.item()] for p in preds])
    return results

# Example
texts = ["امروز هوا خیلی عالی", "امروز هوا خیلی عالی است."]
print(classify_sentences(texts))
# → ['Incomplete', 'Complete']

Citation

This model was introduced in the ParsVoice paper (Appendix C) and trained on PersianPunc data. If you use it, please cite both the ParsVoice paper (EMNLP 2026):

@inproceedings{ranjbar-kalahroodi-etal-2026-parsvoice,
    title = "{P}ars{V}oice: A Large-Scale Multi-Speaker {P}ersian Speech Corpus for Text-to-Speech Synthesis",
    author = "Ranjbar Kalahroodi, Mohammad Javad  and
      Faili, Heshaam  and
      Shakery, Azadeh",
    editor = "Lee, Hung-Yi  and
      Dev, Sunipa  and
      Li, Junyi Jessy  and
      Elliott, Desmond",
    booktitle = "Proceedings of the 2026 Conference on Empirical Methods in Natural Language Processing",
    month = oct,
    year = "2026",
    address = "Budapest, Hungary",
    publisher = "Association for Computational Linguistics",
    url = "https://aclanthology.org/2026.emnlp-main.2458/",
    doi = "10.18653/2026.emnlp-main.2458",
    pages = "55804--55819",
    ISBN = "979-8-89176-459-0"
}

and the PersianPunc paper (SilkRoadNLP 2026):

@inproceedings{ranjbar-kalahroodi-etal-2026-persianpunc,
    title = "{P}ersian{P}unc: A Large-Scale Dataset and {BERT}-Based Approach for {P}ersian Punctuation Restoration",
    author = "Ranjbar Kalahroodi, Mohammad Javad  and
      Faili, Heshaam  and
      Shakery, Azadeh",
    editor = "Merchant, Rayyan  and
      Megerdoomian, Karine  and
      Asgari, Ehsaneddin",
    booktitle = "The Proceedings of the First Workshop on {NLP} and {LLM}s for the {I}ranian Language Family",
    month = mar,
    year = "2026",
    address = "Rabat, Morocco",
    publisher = "Association for Computational Linguistics",
    url = "https://aclanthology.org/2026.silkroadnlp-1.11/",
    doi = "10.18653/v1/2026.silkroadnlp-1.11",
    pages = "105--113",
    ISBN = "979-8-89176-371-5"
}
Downloads last month
-
Safetensors
Model size
0.2B params
Tensor type
F32
·
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support

Model tree for MohammadJRanjbar/persian-sentence-completion

Finetuned
(25)
this model

Dataset used to train MohammadJRanjbar/persian-sentence-completion