code: def token2id(docs, vocab, unk_id=None):
      w2id = {w: i for i, w in enumerate(vocab)}
      ids = [
          [w2id[w] if w in w2id else unk_id for w in doc]
          for doc in docs
      ]
      return ids
  
imports: import re
  import json
  import spacy
  import msgpack
  import unicodedata
  import numpy
  import pandas
  import argparse
  import collections
  import multiprocessing
  from concurrent.futures import ProcessPoolExecutor
  import logging
label_desc: Use image node_id 9 for calling a global function with example usage: token2id(docs, vocab, unk_id) and returns: ids