code: def main(
      input_dir,
      tokenizer_dir,
      relabeled_dir="relabeled_tsv",
      split_data=True,
  ):
      random.seed(1006)
  
      input_dir = os.path.join(input_dir, "malayalam", "cochin_ner")
      relabeled_dir = os.path.join(input_dir, relabeled_dir)
      tsv_files = list_relabeled_files(relabeled_dir)
  
      original_text = read_original_text(input_dir)
      print("Original text len: %d" % len(original_text))
      current_index = 0
      sentences = []
      for tsv_file in tsv_files:
          print(tsv_file)
          current_index, new_sentences = scan_file(
              original_text,
              current_index,
              os.path.join(relabeled_dir, tsv_file),
          )
          sentences.extend(new_sentences)
  
      print("Found %d sentences" % len(sentences))
  
      if split_data:
          splits = split_sentences(sentences)
          SHARDS = ("train", "dev", "test")
      else:
          splits = [sentences]
          SHARDS = ["train"]
  
      for split, shard in zip(splits, SHARDS):
          output_filename = os.path.join(
              tokenizer_dir, "ml_cochin.%s.gold.conllu" % shard
          )
          print(
              "Writing %d sentences to %s"
              % (len(split), output_filename)
          )
          with open(output_filename, "w", encoding="utf-8") as fout:
              for sentence in split:
                  word_idx = 1
                  for token in sentence:
                      if isinstance(token, str):
                          fake_dep = (
                              "\t0\troot"
                              if word_idx == 1
                              else "\t1\tdep"
                          )
                          fout.write(
                              "%d\t%s" % (word_idx, token)
                              + "\t_" * 4
                              + fake_dep
                              + "\t_\t_\n"
                          )
                          word_idx += 1
                      else:
                          text = token[0]
                          mwt = token[1]
                          fout.write(
                              "%d-%d\t%s"
                              % (
                                  word_idx,
                                  word_idx + len(mwt) - 1,
                                  text,
                              )
                              + "\t_" * 8
                              + "\n"
                          )
                          for piece in mwt:
                              fake_dep = (
                                  "\t0\troot"
                                  if word_idx == 1
                                  else "\t1\tdep"
                              )
                              fout.write(
                                  "%d\t%s" % (word_idx, piece)
                                  + "\t_" * 4
                                  + fake_dep
                                  + "\t_\t_\n"
                              )
                              word_idx += 1
                  fout.write("\n")
  
file_path: stanza/stanza/utils/datasets/tokenization/convert_ml_cochin.py
imports: from difflib import SequenceMatcher
  import os
  import random
  import sys
  import stanza.utils.default_paths
label_desc: Use image node_id 7 for calling a global function with example usage: main(input_dir, tokenizer_dir, relabeled_dir, split_data) without return types