aalok-sathe/surprisal

A unified interface for computing surprisal (log probabilities) from language models! Supports neural, symbolic, and black-box API models.

52
/ 100
Established

This tool helps researchers in linguistics, psychology, and cognitive science measure how surprising a word is within a sentence using various language models. You input sentences or text, and it outputs numerical 'surprisal' scores for each word or a chosen segment, indicating how unexpected that word was in its context. It's designed for anyone analyzing human language processing, text comprehension, or language model behavior.

No commits in the last 6 months. Available on PyPI.

Use this if you need to quantify the predictability or unexpectedness of words in text, for example, to understand reading difficulty or assess a language model's fluency.

Not ideal if you need to generate text, translate languages, or perform general text classification, as this tool focuses specifically on surprisal calculation.

psycholinguistics cognitive-science natural-language-processing text-analysis computational-linguistics
Stale 6m
Maintenance 2 / 25
Adoption 8 / 25
Maturity 25 / 25
Community 17 / 25

How are scores calculated?

Stars

51

Forks

11

Language

Python

License

MIT

Last pushed

Aug 06, 2025

Commits (30d)

0

Dependencies

3

Get this data via API

curl "https://pt-edge.onrender.com/api/v1/quality/llm-tools/aalok-sathe/surprisal"

Open to everyone — 100 requests/day, no key needed. Get a free key for 1,000/day.