class_docstr: Class for generating a dictionary of all words in the PTB corpus
class_docstr_tok: ["Class","for","generating","a","dictionary","of","all","words","in","the","PTB","corpus"]
docstr: Initialize class
  Args:
      data_dir: str, location of data
      dataset: str, name of data corpus
docstr_tok: ["Initialize","class","Args",":","data_dir",":","str",",","location","of","data","dataset",":","str",",","name","of","data","corpus"]
code: def __init__(
      self,
      data_dir=os.path.expanduser("~/data"),
      dataset="WikiText-103",
  ):
      """
      Initialize class
      Args:
          data_dir: str, location of data
          dataset: str, name of data corpus
      """
      self.data_dir = data_dir
      self.dataset = dataset
      self.filepath = os.path.join(data_dir, FILENAME[self.dataset])
      self._maybe_download(data_dir)
  
      self.word2idx = {}
      self.idx2word = []
  
      self.load_dictionary()
      print(
          "Loaded dictionary of words of size {}".format(
              len(self.idx2word)
          )
      )
      self.sos_symbol = self.word2idx["<sos>"]
      self.eos_symbol = self.word2idx["<eos>"]
      self.save_dictionary()
  
file_path: nlp-architect/nlp_architect/data/ptb.py
imports: import os
  import sys
  import numpy
  import urllib.request
label_desc: Use image node_id 1 to create a new PTBDictionary object  with example: obj = PTBDictionary(data_dir, dataset)