code: def augment_arabic_padt(sents, ratio=0.05):
      """
      Basic Arabic tokenizer gets the trailing punctuation wrong if there is a blank space.
  
      Reason seems to be that there are almost no examples of "text ." in the dataset.
      This function augments the Arabic-PADT dataset with a few such examples.
      TODO: it may very well be that a lot of tokeners have this problem.
  
      Also, there are a few examples in UD2.7 which are apparently
      headlines where there is a ' . ' in the middle of the text.
      According to an Arabic speaking labmate, the sentences are
      headlines which could be reasonably split into two items.  Having
      them as one item is quite confusing and possibly incorrect, but
      such is life.
      """
      new_sents = []
      for sentence in sents:
          if len(sentence) < 4:
              raise ValueError("Read a surprisingly short sentence")
          text_line = None
          if sentence[0].startswith("# newdoc") and sentence[
              3
          ].startswith("# text"):
              text_line = 3
          elif sentence[0].startswith("# newpar") and sentence[
              2
          ].startswith("# text"):
              text_line = 2
          elif sentence[0].startswith("# sent_id") and sentence[
              1
          ].startswith("# text"):
              text_line = 1
          else:
              raise ValueError(
                  "Could not find text line in %s"
                  % sentence[0].split()[-1]
              )
  
          # for some reason performance starts dropping quickly at higher numbers
          if random.random() > ratio:
              continue
  
          if (
              sentence[text_line][-1] in (".", "؟", "?", "!")
              and sentence[text_line][-2]
              not in (".", "؟", "?", "!", " ")
              and has_space_after_no(sentence[-2].split()[-1])
              and len(sentence[-1].split()[1]) == 1
          ):
              new_sent = list(sentence)
              new_sent[text_line] = (
                  new_sent[text_line][:-1]
                  + " "
                  + new_sent[text_line][-1]
              )
              pieces = sentence[-2].split("\t")
              pieces[-1] = remove_space_after_no(pieces[-1])
              new_sent[-2] = "\t".join(pieces)
              assert new_sent != sentence
              new_sents.append(new_sent)
      return sents + new_sents
  
imports: import argparse
  import glob
  import os
  import random
  import re
  import tempfile
  from collections import Counter
  from stanza.models.common.constant import treebank_to_short_name
  import stanza.utils.datasets.common
  from stanza.utils.datasets.common import read_sentences_from_conllu, write_sentences_to_conllu, INT_RE, MWT_RE, MWT_OR_COPY_RE
  import stanza.utils.datasets.tokenization.convert_ml_cochin
  import stanza.utils.datasets.tokenization.convert_my_alt
  import stanza.utils.datasets.tokenization.convert_vi_vlsp
  import stanza.utils.datasets.tokenization.convert_th_best
  import stanza.utils.datasets.tokenization.convert_th_lst20
  import stanza.utils.datasets.tokenization.convert_th_orchid
label_desc: Use image node_id 7 for calling a global function with example usage: augment_arabic_padt(sents, ratio) and returns: unknown