class_docstr: Version of fairseq.data.LanguagePairDataset which represents source
  and target sentences as sequences of words, each represented as a
  sequence of characters (with numberized indices for both words and
  characters).
  Right-padded only.
code: def collater(self, samples):
      if len(samples) == 0:
          return {}
      source_data = self.collate_source(samples)
      target_toks, prev_output_tokens, ntokens = None, None, None
      prev_tgt_char_inds, tgt_char_inds, tgt_word_lengths = (
          None,
          None,
          None,
      )
      prev_tgt_word_lengths = None
      if self.tgt:
          (
              target_toks,
              prev_output_tokens,
              ntokens,
          ) = self.collate_targets(samples)
          tgt_char_data = self.collate_tgt_chars(samples)
          prev_tgt_char_inds = tgt_char_data["prev_tgt_char_inds"]
          tgt_char_inds = tgt_char_data["tgt_char_inds"]
          tgt_word_lengths = tgt_char_data["tgt_word_lengths"]
          prev_tgt_word_lengths = tgt_char_data["prev_tgt_word_lengths"]
      return {
          "id": source_data["id"],
          "ntokens": ntokens,
          "net_input": {
              "src_tokens": source_data["src_tokens"],
              "src_lengths": source_data["src_lengths"],
              "char_inds": source_data["char_inds"],
              "word_lengths": source_data["word_lengths"],
              "prev_output_tokens": prev_output_tokens,
              "prev_output_chars": prev_tgt_char_inds,
              "prev_output_word_lengths": prev_tgt_word_lengths,
          },
          "target": target_toks,
          "target_char_inds": tgt_char_inds,
          "tgt_word_lengths": tgt_word_lengths,
          "weights": source_data["weights"],
      }
  
imports: from typing import Any, Dict
  import numpy
  import torch
  from fairseq import data, tokenizer
  from fvcore.common.file_io import PathManager
  from pytorch_translate import vocab_constants
  from pytorch_translate.data.dictionary import TAGS
label_desc: Use image node_id 4 for calling the LanguagePairCharDataset obj's underlying member method code with example usage: obj.collater(samples) and returns: dict, dict