class_docstr: A mapping from symbols to consecutive integers
code: def encode_line(
      self,
      line,
      line_tokenizer=tokenize_line,
      add_if_not_exist=True,
      consumer=None,
      append_eos=True,
      reverse_order=False,
  ) -> torch.IntTensor:
      words = line_tokenizer(line)
      if reverse_order:
          words = list(reversed(words))
      nwords = len(words)
      ids = torch.IntTensor(nwords + 1 if append_eos else nwords)
  
      for i, word in enumerate(words):
          if add_if_not_exist:
              idx = self.add_symbol(word)
          else:
              idx = self.index(word)
          if consumer is not None:
              consumer(word, idx)
          ids[i] = idx
      if append_eos:
          ids[nwords] = self.eos_index
      return ids
  
imports: import os
  from collections import Counter
  from multiprocessing import Pool
  import torch
  from fairseq import utils
  from fairseq.data import data_utils
  from fairseq.file_chunker_utils import Chunker, find_offsets
  from fairseq.file_io import PathManager
  from fairseq.tokenizer import tokenize_line
label_desc: Use image node_id 25 for calling the Dictionary obj's underlying member method code with example usage: obj.encode_line(line, line_tokenizer, add_if_not_exist, consumer, append_eos, reverse_order) and returns: ids