CoolFace
Modelpublic

uygarkurt/bert-restore-punctuation-turkish

sourceHugging Facemitupdated 3y agoView on Hugging Face
6likes492downloads
Model Card

Transformer Based Punctuation Restoration Models for Turkish

<div float="center"> <a href="https://github.com/uygarkurt/Turkish-Punctuation-Restoration"> <img alt="open-source-image" src="https://img.shields.io/badge/GitHub-repository-green?logo=GitHub"> </a> </div> <div align="center"> <p>Liked our work? give us a ⭐ on GitHub!</p> </div>

You can find the BERT model used in the paper Transformer Based Punctuation Restoration for Turkish. Aim of this work is correctly place pre-decided punctuation marks in a given text. We present three pre-trained transformer models to predict period(.), comma(,) and question(?) marks for the Turkish language.

Usage <a class="anchor" id="usage"></a>

Inference <a class="anchor" id="inference"></a>

Recommended usage is via HuggingFace. You can run an inference using the pre-trained BERT model with the following code:

from transformers import pipeline

pipe = pipeline(task="token-classification", model="uygarkurt/bert-restore-punctuation-turkish")

sample_text = "Türkiye toprakları üzerindeki ilk yerleşmeler Yontma Taş Devri'nde başlar Doğu Trakya'da Traklar olmak üzere Hititler Frigler Lidyalılar ve Dor istilası sonucu Yunanistan'dan kaçan Akalar tarafından kurulan İyon medeniyeti gibi çeşitli eski Anadolu medeniyetlerinin ardından Makedonya kralı Büyük İskender'in egemenliğiyle ve fetihleriyle birlikte Helenistik Dönem başladı"

out = pipe(sample_text)

To use a different pre-trained model you can just replace the model argument with one of the other available models we provided.

Data <a class="anchor" id="data"></a>

Dataset is provided in data/ directory as train, validation and test splits.

Dataset can be summarized as below:

SplitTotalPeriod (.)Comma (,)Question (?)
Train1471806124817981949816
Validation18032615306119801199
Test18248715524122421255

Available Models <a class="anchor" id="models"></a>

We experimented with BERT, ELECTRA and ConvBERT. Pre-trained models can be accessed via Huggingface.

BERT: https://huggingface.co/uygarkurt/bert-restore-punctuation-turkish \ ELECTRA: https://huggingface.co/uygarkurt/electra-restore-punctuation-turkish \ ConvBERT: https://huggingface.co/uygarkurt/convbert-restore-punctuation-turkish

Results <a class="results" id="results"></a>

Precision and Recall and F1 scores for each model and punctuation mark are summarized below.

ModelPERIODCOMMAQUESTIONOVERALL
Score TypePRF1PRF1PRF1PRF1
BERT0.9726020.9475040.9599520.5761450.7000100.6320660.9276420.9113420.9194200.8255060.8529520.837146
ELECTRA0.9726020.9486890.9604970.5768000.7102080.6365900.9203250.9210740.9206990.8232420.8599900.839262
ConvBERT0.9727310.9467910.9595850.5769640.7081240.6358510.9227640.9138490.9182850.8241530.8562540.837907

Citation <a class="anchor" id="citation"></a>

@INPROCEEDINGS{10286690,
    author={Kurt, Uygar and Çayır, Aykut},
    booktitle={2023 8th International Conference on Computer Science and Engineering (UBMK)}, 
    title={Transformer Based Punctuation Restoration for Turkish}, 
    year={2023},
    volume={},
    number={},
    pages={169-174},
    doi={10.1109/UBMK59864.2023.10286690}
}