bleuscore
bleuscore
is a fast BLEU score calculator written in rust. You can check try the web demo here for a quick experience.
Installation
The python package has been published to pypi, so we can install it directly:
uv:uv add bleuscorepip:pip install bleuscore
Quick Start
The usage is exactly same with huggingface evaluate:
- import evaluate
+ import bleuscore
predictions = ["hello there general kenobi", "foo bar foobar"]
references = [
["hello there general kenobi", "hello there !"],
["foo bar foobar"]
]
- bleu = evaluate.load("bleu")
- results = bleu.compute(predictions=predictions, references=references)
+ results = bleuscore.compute(predictions=predictions, references=references)
print(results)
# {'bleu': 1.0, 'precisions': [1.0, 1.0, 1.0, 1.0], 'brevity_penalty': 1.0,
# 'length_ratio': 1.1666666666666667, 'translation_length': 7, 'reference_length': 6}
Benchmark
TLDR: We got more than 10x speedup when the corpus size beyond 100K
We use the demo data shown in quick start to do this simple benchmark. You can check the benchmark/simple for the benchmark source code. Detailed per-PR results are tracked automatically via the Benchmark workflow.
Release files for bleuscore 0.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 | |
|---|---|---|---|
| bleuscore-0.2.0.tar.gz | 29.8 kB | Details |
Built distributions (wheels)
| File | Reset | |||
|---|---|---|---|---|
| bleuscore-0.2.0-cp38-abi3-win_amd64.whl | CPython 3.8 | abi3 | Windows x86-64 | Details |
| bleuscore-0.2.0-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl | CPython 3.8 | abi3 | Linux glibc 2.17+ x86-64 | Details |
| bleuscore-0.2.0-cp38-abi3-manylinux_2_12_i686.manylinux2010_i686.whl | CPython 3.8 | abi3 | Linux glibc 2.12+ x86-32 | Details |
| bleuscore-0.2.0-cp38-abi3-macosx_11_0_arm64.whl | CPython 3.8 | abi3 | macOS 11.0+ ARM64 | Details |
Total release size: 3.1 MB
Release files / bleuscore-0.2.0.tar.gz
| Download URL | bleuscore-0.2.0.tar.gz |
|---|---|
| Size | 29.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
228ba2e64127f22cdcd9709884c03c1107e6b0e5b03fc076b03799d37ec254e1
|
|
BLAKE2b-256 checksum How to use checksums |
bb76033e45cc12f474eafd1b3d73402730c7e464df7c4f84453c21a5622b4db3
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
maturin/1.13.1
|
Release files / bleuscore-0.2.0-cp38-abi3-win_amd64.whl
| Download URL | bleuscore-0.2.0-cp38-abi3-win_amd64.whl |
|---|---|
| Size | 725.6 kB |
| Tags | CPython 3.8 Windows x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
dff11497d4326e13d80a16e96903b5b20b4eef23da7b3197b0fc46720b7b9077
|
|
BLAKE2b-256 checksum How to use checksums |
1a99433077ec2f7e1733fa8d17e0e7eef9ea9af994800fae29be01b858c4f9ba
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
maturin/1.13.1
|
Release files / bleuscore-0.2.0-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
| Download URL | bleuscore-0.2.0-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl |
|---|---|
| Size | 808.4 kB |
| Tags | CPython 3.8 Linux glibc 2.17+ x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
5e9a2e31a222b4a5b1a3ded612721cf0bb3a10c00518f70a40d463dbd194fe21
|
|
BLAKE2b-256 checksum How to use checksums |
2448887beb2eb118d88b754cda5285d3f3ba2d581f6b1148b99c360b30996b7e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
maturin/1.13.1
|
Release files / bleuscore-0.2.0-cp38-abi3-manylinux_2_12_i686.manylinux2010_i686.whl
| Download URL | bleuscore-0.2.0-cp38-abi3-manylinux_2_12_i686.manylinux2010_i686.whl |
|---|---|
| Size | 802.0 kB |
| Tags | CPython 3.8 Linux glibc 2.12+ x86-32 abi3 |
|
SHA-256 checksum How to use checksums |
b009b8a0be93cfcc7cfab53d59216e903e3b4549185788225e9c5ebddf25d957
|
|
BLAKE2b-256 checksum How to use checksums |
7043d09799214b6e1dcf2747b551533444ae2314508a4a419405c64f80e595d4
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
maturin/1.13.1
|
Release files / bleuscore-0.2.0-cp38-abi3-macosx_11_0_arm64.whl
| Download URL | bleuscore-0.2.0-cp38-abi3-macosx_11_0_arm64.whl |
|---|---|
| Size | 705.8 kB |
| Tags | CPython 3.8 abi3 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
eb735c52c0d413ed42b9b51c892335c3a3a2ec164f389c4498f5af90b3f3dd1c
|
|
BLAKE2b-256 checksum How to use checksums |
11e9458acb0d4574110febc38ec2cfa75d7bcfca3c37af16e3071700b8dc7644
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
maturin/1.13.1
|