code: def preprocess_bilingual_corpora(
      args: argparse.Namespace,
      source_dict: Dictionary,
      char_source_dict: Optional[Dictionary],
      target_dict: Dictionary,
      char_target_dict: Optional[Dictionary],
  ):
      """
      Preprocess source and target parallel datasets
      Prerequisite: Vocabs are already built (see build_vocabs)
      """
      embed_bytes = getattr(args, "embed_bytes", False)
      if args.train_source_text_file:
          args.train_source_binary_path = binarize_text_file(
              text_file=args.train_source_text_file,
              dictionary=source_dict,
              output_path=args.train_source_binary_path,
              append_eos=args.append_eos_to_source,
              reverse_order=args.reverse_source,
              embed_bytes=embed_bytes,
              char_dictionary=char_source_dict,
          )
      if args.eval_source_text_file:
          args.eval_source_binary_path = binarize_text_file(
              text_file=args.eval_source_text_file,
              dictionary=source_dict,
              output_path=args.eval_source_binary_path,
              append_eos=args.append_eos_to_source,
              reverse_order=args.reverse_source,
              embed_bytes=embed_bytes,
              char_dictionary=char_source_dict,
          )
  
      # For target sentences, we always append EOS tokens, and never reverse
      # their order.
      if args.train_target_text_file:
          args.train_target_binary_path = binarize_text_file(
              text_file=args.train_target_text_file,
              dictionary=target_dict,
              output_path=args.train_target_binary_path,
              # We always append EOS to the target sentence since we still want
              # the model to output an indication the sentence has finished, even
              # if we don't append the EOS symbol to the source sentence
              # (to prevent the model from misaligning UNKs or other words
              # to the frequently occurring EOS).
              append_eos=True,
              # We don't reverse the order of the target sentence, since
              # even if the source sentence is fed to the model backwards,
              # we still want the model to start outputting from the first word.
              reverse_order=False,
              embed_bytes=embed_bytes,
              char_dictionary=char_target_dict,
          )
      if args.eval_target_text_file:
          args.eval_target_binary_path = binarize_text_file(
              text_file=args.eval_target_text_file,
              dictionary=target_dict,
              output_path=args.eval_target_binary_path,
              append_eos=True,
              reverse_order=False,
              embed_bytes=embed_bytes,
              char_dictionary=char_target_dict,
          )
  
imports: import argparse
  import os
  import tempfile
  from typing import Dict, List, Optional
  from pytorch_translate import constants, multilingual_utils, options, utils
  from pytorch_translate.data import char_data, data
  from pytorch_translate.data.dictionary import Dictionary
label_desc: Use image node_id 8 for calling a global function with example usage: preprocess_bilingual_corpora(args, source_dict, char_source_dict, target_dict, char_target_dict) without return types