LTScore
LanguageTool wrapper for multilingual grammaticality assessment. For Welsh, it uses CySgor, which is based on the Cysill grammar checker, but works with the same principles as LTScore.
Utility
In low resource languages settings, LTScore can be used as a tool to evaluate the grammaticality of generated text, such as machine translation outputs or conversational AIs. From this, it can be used to filter through training corpora (like sorting legit content from cheap autotranslated websites in fineweb), and improve training data quality, or to evaluate the outputs of a model during training or inference when other methods are not available or satisfactory.
Languages supported
LTScore supports the following languages:
- ar: Arabic
- ast: Asturian
- be: Belarusian
- br: Breton
- ca: Catalan
- crh: Crimean Tatar
- cy: Welsh
- da: Danish
- de: German
- el: Greek
- en: English
- eo: Esperanto
- es: Spanish
- fa: Persian
- fr: French
- ga: Irish
- gl: Galician
- it: Italian
- ja: Japanese
- km: Khmer
- nl: Dutch
- pl: Polish
- pt: Portuguese
- ro: Romanian
- ru: Russian
- sk: Slovak
- sl: Slovenian
- sv: Swedish
- ta: Tamil
- tl: Tagalog
- uk: Ukrainian
- zh: Chinese
Installation
pip install ltscore
Run the Docker image locally
You can download the LanguageTool image from Docker Hub, then using the port 8010 as indicated below.
docker pull erikvl87/languagetool
docker run --rm -p 8010:8010 erikvl87/languagetool
For more details about the Docker container's configuration, see this link.
LTScore as a CLI
There are two ways to use the CLI, either by entering a text file's path, or directly a text. The CLI returns a string of numbers representing the grammaticality score of the text.
# With a text as a positional character
ltscore -l br "Kalz dud a zo amañ!"
# With a -p or --path flag
ltscore -l br -p ./src/ltscore/assets/text-sample-br.txt
or alternatively with the pipe operator:
cat src/ltscore/assets/text-sample-br.txt | ltscore -l br
JSON file processing
LTScore can also process some files for short analysis.
Adding LTScore to an existing file
Given a file data.ndjson with the following content:
{"source": "'Mañ an dud o tont.", "target": "Les gens arrivent.", "prediction": "Les gens vient."}
{"source": "Un devezh dilabour eo Lun Fask.", "target": "Le lundi de Pâques est un jour férié.", "prediction": "Le lundi de Pâques ai un jours fériée."}
running ltscore -t prediction -l fr -p data.ndjson and will get the file updated in the following way:
{"source":"'Mañ an dud o tont.","target":"Les gens arrivent.","prediction":"Les gens vient.","ltscore":33.333333333333336,"mistakes_categories":["CAT_GRAMMAIRE"]}
{"source":"Un devezh dilabour eo Lun Fask.","target":"Le lundi de Pâques est un jour férié.","prediction":"Le lundi de Pâques ai un jours fériée.","ltscore":25.0,"mistakes_categories":["CAT_HOMONYMES_PARONYMES","AGREEMENT"]}
Generating a report
Adding the -r or --report flag will generate a markdown report with a KDE plot of the LTScore distribution, descriptive statistics, and an analysis of sentences based on the mistake categories. The report will be saved in the same directory as the input file with the name ltscore_report.md.
To use it on the file available in src/tests/fixtures/text-sample-br.ndjson, which analyzes a breton texts, you would run:
# Make sure you have pandoc installed in your system to generate the report in PDF format!
ltscore -rt prediction -l br -p tests/fixtures/openai-whisper-large-v3--cv-25.0-2026-03-09-br.jsonl
You would then get a report in the same directory as the input file with the ending ltscore_report.md containing a KDE plot of the LTScore distribution, descriptive statistics, and an analysis of sentences based on the mistake categories.
LTScore as a library
One can also use this package as a python library:
from ltscore import get_score, get_mistakes
# get the scores
df["scores"] = df.apply(lambda row: get_score(row["text"], language=row["language"]), axis=1)
# returns a list of mistakes for each text
df["mistakes"] = df.apply(lambda row: get_mistakes(row["text"], language=row["language"]), axis=1)
Metadata
Release files for ltscore 1.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| ltscore-1.2.0.tar.gz | 11.3 kB | With provenance | Details for ltscore-1.2.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| ltscore-1.2.0-py3-none-any.whl | Python 3 | none | any | Details for ltscore-1.2.0-py3-none-any.whl |
Total release size: 20.1 kB
Release files / ltscore-1.2.0.tar.gz
| Download URL | ltscore-1.2.0.tar.gz |
|---|---|
| Size | 11.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
b3501eecc3dfe4ce8cee603e4f0dac152db763524da9c8f5a611777dbde502c6
|
|
BLAKE2b-256 checksum How to use checksums |
e654d2edd8a1c06c9be2604903579c1882919f3cad2ed9e01f7f372b3e9499aa
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jun 19, 2026.
Transparency logRelease files / ltscore-1.2.0-py3-none-any.whl
| Download URL | ltscore-1.2.0-py3-none-any.whl |
|---|---|
| Size | 8.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
57dd5ba3576fd3276f70b9a7b0859d9c08c395f7d10d01538578dd65c6f6646f
|
|
BLAKE2b-256 checksum How to use checksums |
ddcb2d35794bfc7988fbc05948cbfaeda3874deddd924fe508fcb79f8225a33f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jun 19, 2026.
Transparency logSecurity for ltscore 1.2.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.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for ltscore-1.2.0.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jun 19, 2026.
Transparency logA 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.