code: def _align_files(args, src_dict, tgt_dict):
      assert (
          args.trainpref
      ), "--trainpref must be set if --alignfile is specified"
      src_file_name = _train_path(args.source_lang, args.trainpref)
      tgt_file_name = _train_path(args.target_lang, args.trainpref)
      freq_map = {}
      with open(args.alignfile, "r", encoding="utf-8") as align_file:
          with open(src_file_name, "r", encoding="utf-8") as src_file:
              with open(
                  tgt_file_name, "r", encoding="utf-8"
              ) as tgt_file:
                  for a, s, t in zip_longest(
                      align_file, src_file, tgt_file
                  ):
                      si = src_dict.encode_line(
                          s, add_if_not_exist=False
                      )
                      ti = tgt_dict.encode_line(
                          t, add_if_not_exist=False
                      )
                      ai = list(
                          map(lambda x: tuple(x.split("-")), a.split())
                      )
                      for sai, tai in ai:
                          srcidx = si[int(sai)]
                          tgtidx = ti[int(tai)]
                          if (
                              srcidx != src_dict.unk()
                              and tgtidx != tgt_dict.unk()
                          ):
                              assert srcidx != src_dict.pad()
                              assert srcidx != src_dict.eos()
                              assert tgtidx != tgt_dict.pad()
                              assert tgtidx != tgt_dict.eos()
                              if srcidx not in freq_map:
                                  freq_map[srcidx] = {}
                              if tgtidx not in freq_map[srcidx]:
                                  freq_map[srcidx][tgtidx] = 1
                              else:
                                  freq_map[srcidx][tgtidx] += 1
      align_dict = {}
      for srcidx in freq_map.keys():
          align_dict[srcidx] = max(
              freq_map[srcidx], key=freq_map[srcidx].get
          )
      with open(
          os.path.join(
              args.destdir,
              "alignment.{}-{}.txt".format(
                  args.source_lang, args.target_lang
              ),
          ),
          "w",
          encoding="utf-8",
      ) as f:
          for k, v in align_dict.items():
              print("{} {}".format(src_dict[k], tgt_dict[v]), file=f)
  
imports: import logging
  import os
  import shutil
  import sys
  import typing
  from argparse import Namespace
  from itertools import zip_longest
  from fairseq import options, tasks, utils
  from fairseq.binarizer import AlignmentDatasetBinarizer, FileBinarizer, VocabularyDatasetBinarizer
  from fairseq.data import Dictionary
label_desc: Use image node_id 13 for calling a global function with example usage: _align_files(args, src_dict, tgt_dict) without return types