Skip to main content

lmproof - Language Model Proof Reader

Library to do proof-reading corrections for Grammatical Errors, spelling errors, confused word errors and other errors using pre-trained Language Models.

Usage

Install spacy model by python -m spacy download en. Then try out this snippet.

import lmproof
proof_reader = lmproof.load("en")
source = "The foxes living on the Shire is brown.'"
corrected = proof_reader.proofread(source) # "The foxes living in the Shire are brown."

How it works?

We use the language model based scoring approach mentioned in Christopher Bryant and Ted Briscoe. 2018 with few changes.

Unlike many approaches to GEC, this approach does NOT require annotated training data and mainly depends on a monolingual language model. The program works by iteratively comparing certain words in a text against alternative candidates and applying a correction if one of these candidates is more probable than the original word. These correction candidates are variously generated by a word inflection library or are otherwise defined manually. Currently, this system only corrects:

Non-words (e.g. freind and informations)
Morphology (e.g. eat, ate, eaten, eating, etc.)
Common Determiners and Prepositions (e.g. the, a, in, at, to, etc.)
Commonly Confused Words (e.g. bear/bare, lose/loose, etc.)

This work builds upon https://github.com/chrisjbryant/lmgec-lite/

Components

Language Models

Inflection generators

  • LemmInflect is used to lemmatize and generate inflections for candidate proposals to the language model.

Spell Checker

  • symspellpy is used for obtaining spell check candidates.

The components are highly modularised to facilitate experimentation with newer scorers and support more languages. Pre-trained language models for other languages, inflectors, common error patterns can be easily added to support more languages.

TODOs

  • Use edits in existing GEC corpus to generate candidates.
  • Tests
  • Publish benchmarks of the model.
  • Think of simple ways to generate insertion candidates.
  • Add more languages.

Metadata

Release files for lmproof 0.3.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 lmproof 0.3.0
File Size Uploaded Provenance Actions
lmproof-0.3.0.tar.gz 640.5 kB Without provenance Details for lmproof-0.3.0.tar.gz

Built distribution (wheel)

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

Total release size: 1.3 MB

Release files / lmproof-0.3.0.tar.gz

Download URL lmproof-0.3.0.tar.gz
Size 640.5 kB
Tags Source
SHA-256 checksum
How to use checksums
eb52c8e6a319ee91d9b8192ced3b0f9b3f70272f739ee1f6cb2dad7bd0210b5e
BLAKE2b-256 checksum
How to use checksums
e699b17a800fc017cf9af09cd3face05d2d7357dd6000824484b88f0f6e7daa6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.0.0 CPython/3.7.7 Linux/5.3.0-46-generic

Release files / lmproof-0.3.0-py3-none-any.whl

Download URL lmproof-0.3.0-py3-none-any.whl
Size 639.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
5e4ad6108f7b9af04e0e59e05ee3e6f70f370bb8e15d3f55c6365768d080b94b
BLAKE2b-256 checksum
How to use checksums
15db627c4ad1b1b0631d22290a09bb108a26ef08369337c3be31ba61fd436d8d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.0.0 CPython/3.7.7 Linux/5.3.0-46-generic

Security for lmproof 0.3.0

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.

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