code: def get_glove_w2v(source_dir="./data/news20/", dim=100):
      """
      Parse or download the pre-trained glove word2vec if source_dir is empty.
  
      :param source_dir: The directory storing the pre-trained word2vec
      :param dim: The dimension of a vector
      :return: A dict mapping from word to vector
      """
      w2v_dir = download_glove_w2v(source_dir)
      w2v_path = os.path.join(w2v_dir, "glove.6B.%sd.txt" % dim)
      kargs = {}
      if not (sys.version_info < (3,)):
          kargs["encoding"] = "latin-1"
      with open(w2v_path, **kargs) as w2v_f:
          pre_w2v = {}
          for line in w2v_f.readlines():
              items = line.split(" ")
              pre_w2v[items[0]] = [float(i) for i in items[1:]]
          return pre_w2v
  
imports: import tarfile
  from bigdl.dllib.feature.dataset import base
  import os
  import sys
label_desc: Use image node_id 4 for calling a global function with example usage: get_glove_w2v(source_dir, dim) and returns: pre_w2v