def insert(self, symbol):
    """Try to insert a symbol into the table.

    No action will be taken after the table has been frozen.

    Args:
      symbol: a string

    Raises:
      IndexError: When exceeding a fixed vocabulary size.
      ValueError: When inserting an illegally named entity.
    """
    if symbol not in self._id_dict and not self._frozen:
      if self._vocab_size and self._next_id >= self._vocab_size:
        raise IndexError(
            'Cannot exceed fixed vocabluary size of %d' % self._vocab_size)
      self._id_dict[symbol] = self._next_id
      self._symbol_list.append(symbol)
      self._next_id += 1
    if symbol not in self._id_dict and self._frozen and self._unk is None:
      raise ValueError('Trying to insert an illegal entity name %s' % symbol)
Try to insert a symbol into the table.

    No action will be taken after the table has been frozen.

    Args:
      symbol: a string

    Raises:
      IndexError: When exceeding a fixed vocabulary size.
      ValueError: When inserting an illegally named entity.
    
language/nql/nql/symbol.py