Skip to main content
Archived

This project has been archived by its maintainers, and is no longer receiving any updates.

Surprisal

An implementation of surprisal in Python.

Installation

pip install surprisal

Usage

from pysurprisal import Surprisal

text = "..."

# calculate surprisal for each word in the text
data = Surprisal(text)
surprisals = data.calculate_surprisals()

# get the top 10 most surprising words
top_k = data.get_top_k(10)

# print dictionary of all surprisals
# key = word, value = surprisal
print(surprisals.surprisals)

Contributors

  • capjamesg

License

This project is licensed under an MIT license.

Metadata

Release files for pysurprisal 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pysurprisal 0.1.0
File Size Uploaded
pysurprisal-0.1.0.tar.gz 3.6 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for pysurprisal 0.1.0
File Interpreter ABI Platform
pysurprisal-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 7.3 kB

Release files / pysurprisal-0.1.0.tar.gz

Download URL pysurprisal-0.1.0.tar.gz
Size 3.6 kB
Tags Source
SHA-256 checksum
How to use checksums
11b83f0aab855cf2fd676a2283107f6016a1507bea952a52adc389c42597c425
BLAKE2b-256 checksum
How to use checksums
44afc78c9a4378efb442c1261fef6c981de15de1199de64b0a0cce7af3fb1673
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.9.12

Release files / pysurprisal-0.1.0-py3-none-any.whl

Download URL pysurprisal-0.1.0-py3-none-any.whl
Size 3.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
7d5b719cd2a225d573dbc903e3052b383c6634b47f6395bffdb90c387b486833
BLAKE2b-256 checksum
How to use checksums
90e9ee5a84d21486ff2345cf9edf7481fb7710b19c71dc66f1089ec71df63bfc
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.9.12

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page