code: def parse_vocab(path, vocab_size):
      with open(path, "r") as f:
          word_counts = Counter()
          blob = []
          for ii, sentence in enumerate(f):
              sentence = (
                  sentence.lower().replace(".", "").replace(",", "")
              )
              sentence = sentence.replace("\xe2\x80\x99s", "")
              tokens = sentence.split()
              blob += tokens
              if ii % 100000 == 0:
                  word_counts += Counter(blob)
                  blob = []
          word_counts += Counter(blob)  # get any leftover fraction
          vocab = [
              w[0] for w in word_counts.most_common(vocab_size - 2)
          ]
          vocab = ["<eos>", "<unk>"] + vocab  # used for LUT size
      return vocab
  
file_path: neon/examples/nmt/data.py
imports: import os
  import numpy
  from collections import Counter
  import h5py
  import tarfile
  import gzip
  from neon.data.datasets import Dataset
  from neon.util.argparser import NeonArgparser
label_desc: Use image node_id 2 for calling a global function with example usage: parse_vocab(path, vocab_size) and returns: vocab