pyeeg.io.load_surprisal_values

pyeeg.io.load_surprisal_values(filepath, eps=1e-12)

Load surprisal values from the given file.

Parameters:
  • filepath (str) – Path to the file containing surprisal values, as extracted with the RNNLM toolkit. If None, returns None.

  • eps (float) – Small value added to the probabilities before taking the negative logarithm, to avoid infinite values (Default: 1e-12).

Returns:

surprisal – Negative log probability of each word, i.e. surprisal values.

Return type:

ndarray