code: def build_indexes(args):
      tag_to_idx = {}
      char_to_idx = {}
      train_files = [
          f"{args.data_dir}/{x}"
          for x in os.listdir(args.data_dir)
          if "train" in x
      ]
      for train_file in train_files:
          with open(train_file) as curr_file:
              lines = curr_file.read().strip().split("\n")
          examples = [
              json.loads(line) for line in lines if line.strip()
          ]
          for example in examples:
              label = example["label"]
              if label not in tag_to_idx:
                  tag_to_idx[label] = len(tag_to_idx)
              sequence = example["text"]
              for char in list(sequence):
                  if char not in char_to_idx:
                      char_to_idx[char] = len(char_to_idx)
      char_to_idx["UNK"] = len(char_to_idx)
      char_to_idx["<PAD>"] = len(char_to_idx)
  
      return tag_to_idx, char_to_idx
  
file_path: stanza/stanza/models/lang_identifier.py
imports: import argparse
  import json
  import logging
  import os
  import random
  import torch
  from datetime import datetime
  from stanza.models.common import utils
  from stanza.models.langid.data import DataLoader
  from stanza.models.langid.trainer import Trainer
  from stanza.utils.get_tqdm import get_tqdm
label_desc: Use image node_id 4 for calling a global function with example usage: build_indexes(args) and returns: tag_to_idx,  char_to_idx