code: def make_array(tokens, vocab, add_eos=True):
      unk_id = vocab["<unk>"]
      eos_id = vocab["<eos>"]
      ids = [vocab.get(token, unk_id) for token in tokens]
      if add_eos:
          ids.append(eos_id)
      return numpy.array(ids, numpy.int32)
  
file_path: chainer/examples/text_classification/nlp_utils.py
imports: import collections
  import io
  import numpy
  import chainer
label_desc: Use image node_id 5 for calling a global function with example usage: make_array(tokens, vocab, add_eos) and returns: numpy