Skip to main content

textmetrics

Automatic text metrics---BLEU, ROUGE, and METEOR, plus extras like vocab and ngrams.

Usage

# Compares each candidate (c) separately against all references (r).
python -m textmetrics.main c1.txt c2.txt --references r1.txt r2.txt r3.txt

Installation

Requires:

  • Perl (for BLEU)
  • Java 1.8 (for METEOR)
  • Python 3.6+
pip install textmetrics

Features

  • BLEU
  • ROUGE
  • METEOR

Notes

BLEU and METEOR use the refernce implementations (in Perl and Java, respectively). We originally used the reference Perl implementation for ROUGE as well, but it ran so slowly that we opted for a Python reimplementation instead. (ROUGE's original Perl implementation is also more difficult to setup, even with wrapper libraries.)

Worklist

  • pypi

  • API support

  • ROUGE crashes things if it decides there aren't sentences (e.g., run with README.md as input and reference)

  • Add back in orig ROUGE for completeness (place behind switch)

  • ngrams has divide by zero error. With two simple files (two lines each, same first line, differing second line) running with 2.txt --references 1.txt 1.txt triggered this divide by zero

  • Demo for better README

  • Tests

  • Early check in each module for whether program runnable + nice error message (e.g., no java or bad version, no perl or bad version, etc.)

Note to self: I followed this guide for packaging to pypi, and future uploads will probably look like:

# (1) ensure tests pass

# (2) bump version in setup.py

# (3) commit + push to github

# (4) generate distribution
python setup.py sdist bdist_wheel

# (5) Upload
twine upload dist/*

Metadata

Release files for textmetrics 0.0.2

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

Source distribution (sdist)

Source distribution for textmetrics 0.0.2
File Size Uploaded Provenance Actions
textmetrics-0.0.2.tar.gz 9.1 kB Without provenance Details for textmetrics-0.0.2.tar.gz

Built distribution (wheel)

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

Total release size: 21.8 kB

Release files / textmetrics-0.0.2.tar.gz

Download URL textmetrics-0.0.2.tar.gz
Size 9.1 kB
Tags Source
SHA-256 checksum
How to use checksums
f54fcccf3eb569c199969af5e006aaa2f8207ef08182f62acd954e068af92420
BLAKE2b-256 checksum
How to use checksums
86047e68be0a76283471cf71a7ebb76a34ecbbcb7a729aab3a773540732b4e4e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.11.0 pkginfo/1.4.2 requests/2.19.1 setuptools/40.0.0 requests-toolbelt/0.8.0 tqdm/4.24.0 CPython/3.6.5

Release files / textmetrics-0.0.2-py3-none-any.whl

Download URL textmetrics-0.0.2-py3-none-any.whl
Size 12.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
168ba006c86e92e172672ed85fc08564a50f2f619fd01e47d2b0b720ba7a7bf6
BLAKE2b-256 checksum
How to use checksums
4c64759abdb8a35bd8fd1314cb234b29841c42077ac37d1048a7639745d69a15
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.11.0 pkginfo/1.4.2 requests/2.19.1 setuptools/40.0.0 requests-toolbelt/0.8.0 tqdm/4.24.0 CPython/3.6.5

Security for textmetrics 0.0.2

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.0.2 This release

2 release files No provenance

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