Skip to main content

Method to get a words probability with fixes from How to Compute the Probability of a Word.

Project description

probability-of-a-word

Code to compute a word's probability using the fixes from "How to Compute the Probability of a Word"

Installation

You can install WordsProbability directly from PyPI:

pip install wordsprobability

Or from source:

git clone git@github.com:tpimentelms/probability-of-a-word.git
cd probability-of-a-word
pip install -e .

Dependencies

WordsProbability has the following requirements:

Usage

Basic Usage

Install this repository. Then run:

$ wordsprobability --model pythia-70m --input examples/abstract.txt --output temp.tsv

The output will be a tsv file with a word per row with its respective computed surprisal and surprisal_fixed values. Currently, supported models are: pythia-70m, pythia-160m, pythia-410m, pythia-14b, pythia-28b, pythia-69b, pythia-120b, gpt-small, gpt-medium, gpt-large, gpt-xl.

Extra Information

Citation

If this code or the paper were usefull to you, consider citing it:

@article{pimentel-etal-2024-howto,
    title = "How to Compute the Probability of a Word",
    author = "Pimentel, Tiago and
    Meister, Clara",
    year = "2024",
    eprint = {2406.14561},
    archivePrefix = {arXiv},
    primaryClass = {cs.CL},
    url = {https://arxiv.org/abs/2406.14561},
    journal = "arXiv preprint arXiv:2406.14561",
}

Contact

To ask questions or report problems, please open an issue.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

wordsprobability-0.11.tar.gz (3.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

wordsprobability-0.11-py3-none-any.whl (4.1 kB view details)

Uploaded Python 3

File details

Details for the file wordsprobability-0.11.tar.gz.

File metadata

  • Download URL: wordsprobability-0.11.tar.gz
  • Upload date:
  • Size: 3.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.10.14

File hashes

Hashes for wordsprobability-0.11.tar.gz
Algorithm Hash digest
SHA256 03b4b32ce1659299b875e824e1adb5491729d18ae172f2a00c12bf9ccbaab050
MD5 0beb8186eaff9fe83af6eb32c0021acd
BLAKE2b-256 00bd78ee5212f1bcbe8661d7caf5343e39d2f72b7fe17cff3858375b9c81f632

See more details on using hashes here.

File details

Details for the file wordsprobability-0.11-py3-none-any.whl.

File metadata

File hashes

Hashes for wordsprobability-0.11-py3-none-any.whl
Algorithm Hash digest
SHA256 7cec33543819c9b7b825f059db8819934004357b24112468c14bddf7f5366b13
MD5 1ff2a0e5d519bea42f529ab1ec1e8b37
BLAKE2b-256 dd2aea326411faaf97be19e86ac9449d3bd29fb0e77e07e7692b0070c3a02ffa

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page