# Employing a Multilingual Transformer Model for Segmenting Unpunctuated Arabic Text
## 3 PDTS: Punctuation Detector for Text Segmentation
For reproducibility purposes, we make the code and files of our experiments publicly available under. ### Experiment Setup

#### 4.1.1 Experiment Protocol and Metrics

In the context of this paper, a proper protocol to experiment is to generate a representative test set from any available well-written corpus (i.e., contains grammatically correct punctuations). The thought is to treat the original texts, typically written by expert writers, as gold-standard references, while removing all punctuation from them to form tests' inputs (i.e., mimic the transcribed audio-to-text documents). Then, comparing the tests' outputs \begin{table}
\begin{tabular}{l l} \hline \hline
**Rule** & **Description** \\ \hline
**Rule1: if \(|s|\ \geq\ 2\) then**\(true:\)**false** otherwise. & It asserts that segment \(s\) consists of at least two-word tokens. \\ \hline
**Rule2 : if nltk (NLTK: Natural Language Toolkit— - -www.nltk.org/, accessed on 14 October 2022). pos\_tag(s).numOf(\(NOUN\)) \(\geq\) 2 then**\(true:\)**false** otherwise. & It asserts that segment \(s\) consists of at least two part-of-speech nouns. \\ \hline
**Rule3 : if nltk.pos tag(s).numOf(\(NOUN\)) \(\geq\) 1 and**nltk.pos\_tag(s).numOf(\(VERB\)) \(\geq\) 1 then**\(true:\)_false_ otherwise. & It asserts that segment \(s\) consists of at least one part-of-speech noun as well as one verb. \\ \hline
**Rule4 : if \(t_{i}^{m}==\)nltk.pos(\(Full\_Stop\)) and \(s\in\emptyset\) then**\(true:\)_false_ otherwise. & It asserts that segment \(s\) represents the end of a sentence/text. \\ \hline \hline \end{tabular}
\end{table} 
Table 2: Our generic linguistic rules (represented as _IF-Then_ block), used in PDTS to validate the detected punctuations. (i.e., produced by PDTS) with the original gold references to estimate the generalization error. We have implemented this protocol (illustrated in Figure 2) and used four standard evaluation metrics (_accuracy, precision, recall_, and _f-measure_) to measure the performance quality of PDTS, expressed as follows:

\[accuracy =\frac{(TP+TN)}{(TP+FP+FN+TN)},\] \[precision =\frac{TP}{(TP+FP)^{\prime}},\] \[recall =\frac{TP}{(TP+FN)}.\] \[f\text{-}measure =2\cdot\frac{precision\cdot recall}{precision+recall}\]

where _TP_ (true-positive) represents correct predicted cases of punctuations; _FP_ (false-positive) represents wrong predicted cases due to a mismatch of predicted punctuations with the already existing ones in the gold-standard references; _TN_ (true-negative) represents wrong predicted punctuations due to their absence in the gold-standard references; and _FN_ (false-negative) represents missed cases to predict the existing punctuations in the gold-standard reference. #### 4.1.2 Arabic Corpora

We choose to experiment on a combination of two public Arabic corpora. They provide a variety of short-to-long texts written in different styles and formats (i.e., in terms of the presence of diacritics and punctuation). The first corpus is ABMC ([[https://metatext.io/datasets/arabic-in-business-and-management-corpora-abmc](https://metatext.io/datasets/arabic-in-business-and-management-corpora-abmc)]([https://metatext.io/datasets/arabic-in-business-and-management-corpora-abmc](https://metatext.io/datasets/arabic-in-business-and-management-corpora-abmc)), accessed on 14 October 2022) (Arabic in Business and Management Corpora), comprising 1200 documents (400 statements written by chairpersons and chief executive managers, besides another 800 news articles on the economic and stock market). The second corpus ([[https://github.com/AliOsm/arabic-text-diacritization](https://github.com/AliOsm/arabic-text-diacritization)]([https://github.com/AliOsm/arabic-text-diacritization](https://github.com/AliOsm/arabic-text-diacritization)), accessed on 14 October 2022) comprises 55,000 formal and diacritized statements. Overall, we test our PDTS on 16,281 text examples (out of 56,200) after excluding documents that contain less than 50 words.