def one_hot_numpy_array(self, entity_name,
                          type_name):
    """A one-hot 1-by-N matrix encoding this entity.

    Args:
      entity_name: a string naming an entity.
      type_name: the string type name of the named entity

    Returns:
      A numpy array with shape (1,n) where n is the number of columns.

    Raises:
      EntityNameError: if entity_name does not map to a legal id.
    """
    index = self.get_id(entity_name, type_name)
    if index is None:
      raise EntityNameError(
          entity_name=entity_name,
          type_name=type_name,
          message='Cannot make a one-hot vector')
    result = self.zeros_numpy_array(type_name, True)
    result[0, index] = 1.0
    return result
A one-hot 1-by-N matrix encoding this entity.

    Args:
      entity_name: a string naming an entity.
      type_name: the string type name of the named entity

    Returns:
      A numpy array with shape (1,n) where n is the number of columns.

    Raises:
      EntityNameError: if entity_name does not map to a legal id.
    
language/nql/nql/__init__.py