code: def build_vocab(
      corpus_path_l: List, eos_token: Optional[str] = "<eos>"
  ) -> Vocab:
      """Build the default vocabulary used in datasets like
  
          - wikitext2
          - wikitext103
          - text8
          - enwiki8
  
      The strategy is to split with white-space and store all appeared tokens.
      Also, the tokens will be sorted with a descending order of their frequency.
  
      Parameters
      ----------
      corpus_path_l
          The corpus path
      eos_token
          If it is not None, the eos_token will be added to the vocabulary.
  
      Returns
      -------
      vocab
          The vocabulary
      """
      counter = Counter()
      ntokens = 0
      print("Build the default vocabulary used in benchmarks:")
      for corpus_path in corpus_path_l:
          with open(corpus_path, "r", encoding="utf-8") as f:
              for idx, line in enumerate(f):
                  if idx > 0 and idx % 500000 == 0:
                      print("    line {}".format(idx))
                  line = line.strip()
                  tokens = line.split()
                  counter.update(tokens)
                  ntokens += len(tokens)
      if eos_token is not None and eos_token in counter:
          raise ValueError(
              'eos_token is set to be "{}", which appears in the text. '
              "Is it intended? You may choose another token as the eos_token.".format(
                  eos_token
              )
          )
      vocab = Vocab(counter, unk_token=None, eos_token=eos_token)
      print("Processed {} tokens, vocab={}".format(ntokens, vocab))
      return vocab
  
file_path: gluon-nlp/src/gluonnlp/cli/data/language_modeling/prepare_lm.py
imports: import argparse
  import os
  import zipfile
  import tarfile
  import shutil
  from typing import List, Optional
  from collections import Counter
  from gluonnlp.base import get_data_home_dir
  from gluonnlp.utils.misc import download, load_checksum_stats
  from gluonnlp.data.vocab import Vocab
label_desc: Use image node_id 3 for calling a global function with example usage: build_vocab(corpus_path_l, eos_token) and returns: vocab