def get_vocab_id(self, key: Text, default: Optional[int] = None) -> int:
    """Gets the vocab id of `key`."""
    if key in self._special_codepoints:
      return self._special_codepoints[key]
    try:
      return ord(key)
    except TypeError:
      raise ValueError(f"invalid vocab key: '{key}'")
Gets the vocab id of `key`.
language/canine/tydiqa/char_splitter.py