code: def vectorize(docs, w_vocab, c_vocab):
      data = []
      for doc in docs:
          words = np.asarray(
              [
                  w_vocab[w.lower()]
                  if w_vocab[w.lower()] is not None
                  else 1
                  for w in doc
              ]
          ).reshape(1, -1)
          if c_vocab is not None:
              sentence_chars = []
              for w in doc:
                  word_chars = []
                  for c in w:
                      _cid = c_vocab[c]
                      word_chars.append(_cid if _cid is not None else 1)
                  sentence_chars.append(word_chars)
              sentence_chars = np.expand_dims(
                  pad_sentences(sentence_chars, word_length), axis=0
              )
              data.append((words, sentence_chars))
          else:
              data.append(words)
      return data
  
file_path: nlp-architect/examples/chunker/inference.py
imports: from __future__ import absolute_import, division, print_function, unicode_literals
  import argparse
  import pickle
  from os import path
  import numpy
  from nlp_architect.models.chunker import SequenceChunker
  from nlp_architect.utils.generic import pad_sentences
  from nlp_architect.utils.io import check_size, validate_existing_filepath
  from nlp_architect.utils.text import SpacyInstance
label_desc: Use image node_id 1 for calling a global function with example usage: vectorize(docs, w_vocab, c_vocab) and returns: data