code: def encode(self, word, include_oov=True):
      if include_oov:
          if self._word2idx.get(word, None) is None:
              raise ValueError(
                  "Unknown word: %s. Vocabulary should include oovs here."
                  % word
              )
          return self._word2idx[word]
      else:
          word = "<unk>" if word not in self._word2idx else word
          return self._word2idx[word]
  
imports: import logging
  import json
  import numpy
  from collections import OrderedDict
  from .None import ontology
label_desc: Use image node_id 9 for calling the Vocab obj's underlying member method code with example usage: obj.encode(word, include_oov) and returns: self, self