(self, word)
return self._word_to_id[word]
Returns the id (integer) of a word (string). Returns [UNK] id if word is OOV.
Returns the id (integer) of a word (string). Returns [UNK] id if word is OOV.
Returns the id ( integer ) of a word ( string ) . Returns [ UNK ] id if word is OOV .
def word2id(self, word):
    """Returns the id (integer) of a word (string). Returns [UNK] id if word is OOV."""
    if word not in self._word_to_id:
      return self._word_to_id[UNKNOWN_TOKEN]
    return self._word_to_id[word]
def word2id ( self , word ) : if word not in self . _word_to_id : return self . _word_to_id [ UNKNOWN_TOKEN ] return self . _word_to_id [ word ]