punctuate all

Providerkredor
Categorytoken-classification
Licensemit
Downloads631.4K
Stars0

Overview

Punctuate All is a specialized token-classification model designed to automate punctuation restoration in unstructured text. For developers working with ASR (Automatic Speech Recognition) outputs or raw OCR data, this model serves as a critical post-processing layer to convert continuous text streams into readable, grammatically structured content. It focuses on identifying boundary markers and punctuation tokens without altering the original word sequence, making it an efficient tool for improving downstream NLP pipeline accuracy. Integration is straightforward for those familiar with token-classification tasks, offering a lightweight alternative to larger generative models when the only requirement is structural correction.

Highlights

  • Automates punctuation restoration for ASR and OCR streams
  • Specialized token-classification architecture for high efficiency
  • Preserves original text sequences without generative hallucinations
  • Permissive MIT license for flexible commercial integration

Usage

Install
# Install Hugging Face transformers
pip install transformers torch
SDK Usage
# Load model with transformers
from transformers import AutoModel, AutoTokenizer

model = AutoModel.from_pretrained("kredor/punctuate-all")
tokenizer = AutoTokenizer.from_pretrained("kredor/punctuate-all")

Hugging Face Download

We recommend downloading the model via the Hugging Face CLI or Hub SDK.

Guidance:Before downloading, install huggingface_hub with:

Guidance
pip install -U huggingface_hub

CLI Download

Download the full repository

Download the full repository
huggingface-cli download kredor/punctuate-all

Download a single file to a local folder (e.g. config.json into ./dir)

Download a single file to a local folder (e.g. config.json into ./dir)
huggingface-cli download kredor/punctuate-all config.json --local-dir ./dir

See the official docs for more CLI options

SDK Download

SDK Download
# 模型下载
from huggingface_hub import snapshot_download
model_dir = snapshot_download('kredor/punctuate-all')

Git Download

Make sure git-lfs is installed first

Git Download
git lfs install
git clone https://huggingface.co/kredor/punctuate-all

To skip LFS large-file downloads, use:

Skip LFS
GIT_LFS_SKIP_SMUDGE=1 git clone https://huggingface.co/kredor/punctuate-all

Model files are hosted on the Hugging Face Hub — download directly via HF CLI / SDK / Git, not through this site.

PyTorch / Transformers Usage

Install Transformers

Install Transformers
pip install -U transformers torch

Load the model and run inference

Load the model and run inference
from transformers import AutoModelForCausalLM, AutoTokenizer

model = AutoModelForCausalLM.from_pretrained('kredor/punctuate-all')
tokenizer = AutoTokenizer.from_pretrained('kredor/punctuate-all')

Full Documentation

来源: HuggingFace

---
license: mit
datasets:

  • wmt/europarl

metrics:
  • f1

  • recall

  • precision

---
This is based on Oliver Guhr's work. The difference is that it is a finetuned xlm-roberta-base instead of an xlm-roberta-large and on twelve languages instead of four. The languages are: English, German, French, Spanish, Bulgarian, Italian, Polish, Dutch, Czech, Portugese, Slovak, Slovenian.

----- report -----

precision recall f1-score support

0 0.99 0.99 0.99 73317475
. 0.94 0.95 0.95 4484845
, 0.86 0.86 0.86 6100650
? 0.88 0.85 0.86 136479
- 0.60 0.29 0.39 233630
: 0.71 0.49 0.58 152424

accuracy 0.98 84425503
macro avg 0.83 0.74 0.77 84425503
weighted avg 0.98 0.98 0.98 84425503

----- confusion matrix -----

t/p 0 . , ? - :
0 1.0 0.0 0.0 0.0 0.0 0.0
. 0.0 1.0 0.0 0.0 0.0 0.0
, 0.1 0.0 0.9 0.0 0.0 0.0
? 0.0 0.1 0.0 0.8 0.0 0.0
- 0.1 0.1 0.5 0.0 0.3 0.0
: 0.0 0.3 0.1 0.0 0.0 0.5

Join our Telegram