class_docstr: Version of fairseq.data.LanguagePairDataset which represents source
  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 collate_targets(self, samples):
      def merge(move_eos_to_beginning=False):
          return data.data_utils.collate_tokens(
              [s["target"] for s in samples],
              self.pad_idx,
              self.eos_idx,
              left_pad=False,
              move_eos_to_beginning=move_eos_to_beginning,
          )
  
      target = merge(move_eos_to_beginning=False)
      prev_output_tokens = merge(move_eos_to_beginning=True)
  
      ntokens = sum(len(s["target"]) for s in samples)
  
      return target, prev_output_tokens, ntokens
  
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 6 for calling the LanguagePairSourceCharDataset obj's underlying member method code with example usage: obj.collate_targets(samples) and returns: target,  prev_output_tokens,  ntokens, data