code: def to_one_hot(txt, vocab=vocab_hash):
      vocab_size = len(vocab.keys())
      one_hot_vec = np.zeros(
          (vocab_size + 1, len(txt)), dtype=np.float32
      )
      # run through txt and "switch on" relevant positions in one-hot vector
      for idx, char in enumerate(txt):
          if char in vocab_hash:
              vocab_idx = vocab_hash[char]
              one_hot_vec[vocab_idx, idx] = 1
          # raised if character is out of vocabulary
          else:
              pass
      return one_hot_vec
  
file_path: nlp-architect/nlp_architect/utils/generic.py
imports: from __future__ import absolute_import, division, print_function, unicode_literals
  import re
  import numpy
label_desc: Use image node_id 7 for calling a global function with example usage: to_one_hot(txt, vocab) and returns: one_hot_vec