rouge-rust 0.1.2__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- rouge_rust-0.1.2/.github/workflows/release.yml +166 -0
- rouge_rust-0.1.2/.gitignore +72 -0
- rouge_rust-0.1.2/Cargo.lock +231 -0
- rouge_rust-0.1.2/Cargo.toml +23 -0
- rouge_rust-0.1.2/LICENSE +21 -0
- rouge_rust-0.1.2/PKG-INFO +140 -0
- rouge_rust-0.1.2/README.md +112 -0
- rouge_rust-0.1.2/pyproject.toml +39 -0
- rouge_rust-0.1.2/src/lib.rs +233 -0
- rouge_rust-0.1.2/src/scorer.rs +704 -0
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
name: CI and Release
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches:
|
|
6
|
+
- main
|
|
7
|
+
- develop
|
|
8
|
+
tags:
|
|
9
|
+
- "v*"
|
|
10
|
+
pull_request:
|
|
11
|
+
branches:
|
|
12
|
+
- main
|
|
13
|
+
- develop
|
|
14
|
+
workflow_dispatch:
|
|
15
|
+
|
|
16
|
+
permissions:
|
|
17
|
+
contents: read
|
|
18
|
+
|
|
19
|
+
jobs:
|
|
20
|
+
build:
|
|
21
|
+
name: Build ${{ matrix.name }}
|
|
22
|
+
runs-on: ${{ matrix.runner }}
|
|
23
|
+
strategy:
|
|
24
|
+
fail-fast: false
|
|
25
|
+
matrix:
|
|
26
|
+
include:
|
|
27
|
+
- name: linux-x86_64
|
|
28
|
+
runner: ubuntu-latest
|
|
29
|
+
target: x86_64
|
|
30
|
+
manylinux: auto
|
|
31
|
+
args: --release --out dist --find-interpreter --zig
|
|
32
|
+
test: true
|
|
33
|
+
- name: linux-aarch64
|
|
34
|
+
runner: ubuntu-latest
|
|
35
|
+
target: aarch64
|
|
36
|
+
manylinux: auto
|
|
37
|
+
args: --release --out dist --find-interpreter --zig
|
|
38
|
+
test: false
|
|
39
|
+
- name: windows-x64
|
|
40
|
+
runner: windows-latest
|
|
41
|
+
target: x64
|
|
42
|
+
args: --release --out dist --find-interpreter
|
|
43
|
+
test: true
|
|
44
|
+
- name: macos-x86_64
|
|
45
|
+
runner: macos-15-intel
|
|
46
|
+
target: x86_64
|
|
47
|
+
args: --release --out dist --find-interpreter
|
|
48
|
+
test: true
|
|
49
|
+
- name: macos-aarch64
|
|
50
|
+
runner: macos-14
|
|
51
|
+
target: aarch64
|
|
52
|
+
args: --release --out dist --find-interpreter
|
|
53
|
+
test: true
|
|
54
|
+
|
|
55
|
+
steps:
|
|
56
|
+
- uses: actions/checkout@v4
|
|
57
|
+
|
|
58
|
+
- uses: actions/setup-python@v5
|
|
59
|
+
with:
|
|
60
|
+
python-version: "3.11"
|
|
61
|
+
|
|
62
|
+
- name: Build wheels
|
|
63
|
+
if: ${{ matrix.manylinux }}
|
|
64
|
+
uses: PyO3/maturin-action@v1
|
|
65
|
+
with:
|
|
66
|
+
target: ${{ matrix.target }}
|
|
67
|
+
manylinux: ${{ matrix.manylinux }}
|
|
68
|
+
args: ${{ matrix.args }}
|
|
69
|
+
|
|
70
|
+
- name: Build wheels
|
|
71
|
+
if: ${{ !matrix.manylinux }}
|
|
72
|
+
uses: PyO3/maturin-action@v1
|
|
73
|
+
with:
|
|
74
|
+
target: ${{ matrix.target }}
|
|
75
|
+
args: ${{ matrix.args }}
|
|
76
|
+
|
|
77
|
+
- name: Upload wheels
|
|
78
|
+
uses: actions/upload-artifact@v4
|
|
79
|
+
with:
|
|
80
|
+
name: wheels-${{ matrix.name }}
|
|
81
|
+
path: dist
|
|
82
|
+
|
|
83
|
+
- name: Install wheel and run tests
|
|
84
|
+
if: ${{ matrix.test }}
|
|
85
|
+
shell: bash
|
|
86
|
+
run: |
|
|
87
|
+
python -m pip install --upgrade pip
|
|
88
|
+
python -m pip install rouge-rust --find-links dist --force-reinstall
|
|
89
|
+
if [ -d tests ]; then
|
|
90
|
+
python -m pip install pytest rouge-score
|
|
91
|
+
pytest -q
|
|
92
|
+
else
|
|
93
|
+
echo "No tests directory on this branch; skipping pytest."
|
|
94
|
+
fi
|
|
95
|
+
|
|
96
|
+
sdist:
|
|
97
|
+
name: Build sdist
|
|
98
|
+
runs-on: ubuntu-latest
|
|
99
|
+
steps:
|
|
100
|
+
- uses: actions/checkout@v4
|
|
101
|
+
|
|
102
|
+
- name: Build sdist
|
|
103
|
+
uses: PyO3/maturin-action@v1
|
|
104
|
+
with:
|
|
105
|
+
command: sdist
|
|
106
|
+
args: --out dist
|
|
107
|
+
|
|
108
|
+
- name: Upload sdist
|
|
109
|
+
uses: actions/upload-artifact@v4
|
|
110
|
+
with:
|
|
111
|
+
name: sdist
|
|
112
|
+
path: dist
|
|
113
|
+
|
|
114
|
+
publish:
|
|
115
|
+
name: Publish to PyPI
|
|
116
|
+
if: ${{ startsWith(github.ref, 'refs/tags/v') }}
|
|
117
|
+
needs:
|
|
118
|
+
- build
|
|
119
|
+
- sdist
|
|
120
|
+
runs-on: ubuntu-latest
|
|
121
|
+
environment:
|
|
122
|
+
name: pypi
|
|
123
|
+
url: https://pypi.org/p/rouge-rust
|
|
124
|
+
permissions:
|
|
125
|
+
id-token: write
|
|
126
|
+
steps:
|
|
127
|
+
- uses: actions/download-artifact@v4
|
|
128
|
+
with:
|
|
129
|
+
path: dist-artifacts
|
|
130
|
+
|
|
131
|
+
- name: Flatten artifacts
|
|
132
|
+
shell: bash
|
|
133
|
+
run: |
|
|
134
|
+
mkdir -p dist
|
|
135
|
+
find dist-artifacts -type f \( -name '*.whl' -o -name '*.tar.gz' \) -exec cp {} dist/ \;
|
|
136
|
+
|
|
137
|
+
- name: Publish package distributions to PyPI
|
|
138
|
+
uses: pypa/gh-action-pypi-publish@release/v1
|
|
139
|
+
with:
|
|
140
|
+
packages-dir: dist
|
|
141
|
+
|
|
142
|
+
github-release:
|
|
143
|
+
name: Create GitHub release
|
|
144
|
+
if: ${{ startsWith(github.ref, 'refs/tags/v') }}
|
|
145
|
+
needs:
|
|
146
|
+
- build
|
|
147
|
+
- sdist
|
|
148
|
+
runs-on: ubuntu-latest
|
|
149
|
+
permissions:
|
|
150
|
+
contents: write
|
|
151
|
+
steps:
|
|
152
|
+
- uses: actions/download-artifact@v4
|
|
153
|
+
with:
|
|
154
|
+
path: dist-artifacts
|
|
155
|
+
|
|
156
|
+
- name: Flatten artifacts
|
|
157
|
+
shell: bash
|
|
158
|
+
run: |
|
|
159
|
+
mkdir -p dist
|
|
160
|
+
find dist-artifacts -type f \( -name '*.whl' -o -name '*.tar.gz' \) -exec cp {} dist/ \;
|
|
161
|
+
|
|
162
|
+
- name: Create GitHub release
|
|
163
|
+
uses: softprops/action-gh-release@v2
|
|
164
|
+
with:
|
|
165
|
+
files: dist/*
|
|
166
|
+
generate_release_notes: true
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
/target
|
|
2
|
+
|
|
3
|
+
# Byte-compiled / optimized / DLL files
|
|
4
|
+
__pycache__/
|
|
5
|
+
.pytest_cache/
|
|
6
|
+
*.py[cod]
|
|
7
|
+
|
|
8
|
+
# C extensions
|
|
9
|
+
*.so
|
|
10
|
+
|
|
11
|
+
# Distribution / packaging
|
|
12
|
+
.Python
|
|
13
|
+
.venv/
|
|
14
|
+
env/
|
|
15
|
+
bin/
|
|
16
|
+
build/
|
|
17
|
+
develop-eggs/
|
|
18
|
+
dist/
|
|
19
|
+
eggs/
|
|
20
|
+
lib/
|
|
21
|
+
lib64/
|
|
22
|
+
parts/
|
|
23
|
+
sdist/
|
|
24
|
+
var/
|
|
25
|
+
include/
|
|
26
|
+
man/
|
|
27
|
+
venv/
|
|
28
|
+
*.egg-info/
|
|
29
|
+
.installed.cfg
|
|
30
|
+
*.egg
|
|
31
|
+
|
|
32
|
+
# Installer logs
|
|
33
|
+
pip-log.txt
|
|
34
|
+
pip-delete-this-directory.txt
|
|
35
|
+
pip-selfcheck.json
|
|
36
|
+
|
|
37
|
+
# Unit test / coverage reports
|
|
38
|
+
htmlcov/
|
|
39
|
+
.tox/
|
|
40
|
+
.coverage
|
|
41
|
+
.cache
|
|
42
|
+
nosetests.xml
|
|
43
|
+
coverage.xml
|
|
44
|
+
|
|
45
|
+
# Translations
|
|
46
|
+
*.mo
|
|
47
|
+
|
|
48
|
+
# Mr Developer
|
|
49
|
+
.mr.developer.cfg
|
|
50
|
+
.project
|
|
51
|
+
.pydevproject
|
|
52
|
+
|
|
53
|
+
# Rope
|
|
54
|
+
.ropeproject
|
|
55
|
+
|
|
56
|
+
# Django stuff:
|
|
57
|
+
*.log
|
|
58
|
+
*.pot
|
|
59
|
+
|
|
60
|
+
.DS_Store
|
|
61
|
+
|
|
62
|
+
# Sphinx documentation
|
|
63
|
+
docs/_build/
|
|
64
|
+
|
|
65
|
+
# PyCharm
|
|
66
|
+
.idea/
|
|
67
|
+
|
|
68
|
+
# VSCode
|
|
69
|
+
.vscode/
|
|
70
|
+
|
|
71
|
+
# Pyenv
|
|
72
|
+
.python-version
|
|
@@ -0,0 +1,231 @@
|
|
|
1
|
+
# This file is automatically @generated by Cargo.
|
|
2
|
+
# It is not intended for manual editing.
|
|
3
|
+
version = 4
|
|
4
|
+
|
|
5
|
+
[[package]]
|
|
6
|
+
name = "autocfg"
|
|
7
|
+
version = "1.5.0"
|
|
8
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
9
|
+
checksum = "c08606f8c3cbf4ce6ec8e28fb0014a2c086708fe954eaa885384a6165172e7e8"
|
|
10
|
+
|
|
11
|
+
[[package]]
|
|
12
|
+
name = "crossbeam-deque"
|
|
13
|
+
version = "0.8.6"
|
|
14
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
15
|
+
checksum = "9dd111b7b7f7d55b72c0a6ae361660ee5853c9af73f70c3c2ef6858b950e2e51"
|
|
16
|
+
dependencies = [
|
|
17
|
+
"crossbeam-epoch",
|
|
18
|
+
"crossbeam-utils",
|
|
19
|
+
]
|
|
20
|
+
|
|
21
|
+
[[package]]
|
|
22
|
+
name = "crossbeam-epoch"
|
|
23
|
+
version = "0.9.18"
|
|
24
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
25
|
+
checksum = "5b82ac4a3c2ca9c3460964f020e1402edd5753411d7737aa39c3714ad1b5420e"
|
|
26
|
+
dependencies = [
|
|
27
|
+
"crossbeam-utils",
|
|
28
|
+
]
|
|
29
|
+
|
|
30
|
+
[[package]]
|
|
31
|
+
name = "crossbeam-utils"
|
|
32
|
+
version = "0.8.21"
|
|
33
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
34
|
+
checksum = "d0a5c400df2834b80a4c3327b3aad3a4c4cd4de0629063962b03235697506a28"
|
|
35
|
+
|
|
36
|
+
[[package]]
|
|
37
|
+
name = "either"
|
|
38
|
+
version = "1.15.0"
|
|
39
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
40
|
+
checksum = "48c757948c5ede0e46177b7add2e67155f70e33c07fea8284df6576da70b3719"
|
|
41
|
+
|
|
42
|
+
[[package]]
|
|
43
|
+
name = "fast_rouge"
|
|
44
|
+
version = "0.1.2"
|
|
45
|
+
dependencies = [
|
|
46
|
+
"pyo3",
|
|
47
|
+
"rayon",
|
|
48
|
+
"rustc-hash",
|
|
49
|
+
]
|
|
50
|
+
|
|
51
|
+
[[package]]
|
|
52
|
+
name = "heck"
|
|
53
|
+
version = "0.5.0"
|
|
54
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
55
|
+
checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea"
|
|
56
|
+
|
|
57
|
+
[[package]]
|
|
58
|
+
name = "indoc"
|
|
59
|
+
version = "2.0.7"
|
|
60
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
61
|
+
checksum = "79cf5c93f93228cf8efb3ba362535fb11199ac548a09ce117c9b1adc3030d706"
|
|
62
|
+
dependencies = [
|
|
63
|
+
"rustversion",
|
|
64
|
+
]
|
|
65
|
+
|
|
66
|
+
[[package]]
|
|
67
|
+
name = "libc"
|
|
68
|
+
version = "0.2.183"
|
|
69
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
70
|
+
checksum = "b5b646652bf6661599e1da8901b3b9522896f01e736bad5f723fe7a3a27f899d"
|
|
71
|
+
|
|
72
|
+
[[package]]
|
|
73
|
+
name = "memoffset"
|
|
74
|
+
version = "0.9.1"
|
|
75
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
76
|
+
checksum = "488016bfae457b036d996092f6cb448677611ce4449e970ceaf42695203f218a"
|
|
77
|
+
dependencies = [
|
|
78
|
+
"autocfg",
|
|
79
|
+
]
|
|
80
|
+
|
|
81
|
+
[[package]]
|
|
82
|
+
name = "once_cell"
|
|
83
|
+
version = "1.21.4"
|
|
84
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
85
|
+
checksum = "9f7c3e4beb33f85d45ae3e3a1792185706c8e16d043238c593331cc7cd313b50"
|
|
86
|
+
|
|
87
|
+
[[package]]
|
|
88
|
+
name = "portable-atomic"
|
|
89
|
+
version = "1.13.1"
|
|
90
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
91
|
+
checksum = "c33a9471896f1c69cecef8d20cbe2f7accd12527ce60845ff44c153bb2a21b49"
|
|
92
|
+
|
|
93
|
+
[[package]]
|
|
94
|
+
name = "proc-macro2"
|
|
95
|
+
version = "1.0.106"
|
|
96
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
97
|
+
checksum = "8fd00f0bb2e90d81d1044c2b32617f68fcb9fa3bb7640c23e9c748e53fb30934"
|
|
98
|
+
dependencies = [
|
|
99
|
+
"unicode-ident",
|
|
100
|
+
]
|
|
101
|
+
|
|
102
|
+
[[package]]
|
|
103
|
+
name = "pyo3"
|
|
104
|
+
version = "0.27.2"
|
|
105
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
106
|
+
checksum = "ab53c047fcd1a1d2a8820fe84f05d6be69e9526be40cb03b73f86b6b03e6d87d"
|
|
107
|
+
dependencies = [
|
|
108
|
+
"indoc",
|
|
109
|
+
"libc",
|
|
110
|
+
"memoffset",
|
|
111
|
+
"once_cell",
|
|
112
|
+
"portable-atomic",
|
|
113
|
+
"pyo3-build-config",
|
|
114
|
+
"pyo3-ffi",
|
|
115
|
+
"pyo3-macros",
|
|
116
|
+
"unindent",
|
|
117
|
+
]
|
|
118
|
+
|
|
119
|
+
[[package]]
|
|
120
|
+
name = "pyo3-build-config"
|
|
121
|
+
version = "0.27.2"
|
|
122
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
123
|
+
checksum = "b455933107de8642b4487ed26d912c2d899dec6114884214a0b3bb3be9261ea6"
|
|
124
|
+
dependencies = [
|
|
125
|
+
"target-lexicon",
|
|
126
|
+
]
|
|
127
|
+
|
|
128
|
+
[[package]]
|
|
129
|
+
name = "pyo3-ffi"
|
|
130
|
+
version = "0.27.2"
|
|
131
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
132
|
+
checksum = "1c85c9cbfaddf651b1221594209aed57e9e5cff63c4d11d1feead529b872a089"
|
|
133
|
+
dependencies = [
|
|
134
|
+
"libc",
|
|
135
|
+
"pyo3-build-config",
|
|
136
|
+
]
|
|
137
|
+
|
|
138
|
+
[[package]]
|
|
139
|
+
name = "pyo3-macros"
|
|
140
|
+
version = "0.27.2"
|
|
141
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
142
|
+
checksum = "0a5b10c9bf9888125d917fb4d2ca2d25c8df94c7ab5a52e13313a07e050a3b02"
|
|
143
|
+
dependencies = [
|
|
144
|
+
"proc-macro2",
|
|
145
|
+
"pyo3-macros-backend",
|
|
146
|
+
"quote",
|
|
147
|
+
"syn",
|
|
148
|
+
]
|
|
149
|
+
|
|
150
|
+
[[package]]
|
|
151
|
+
name = "pyo3-macros-backend"
|
|
152
|
+
version = "0.27.2"
|
|
153
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
154
|
+
checksum = "03b51720d314836e53327f5871d4c0cfb4fb37cc2c4a11cc71907a86342c40f9"
|
|
155
|
+
dependencies = [
|
|
156
|
+
"heck",
|
|
157
|
+
"proc-macro2",
|
|
158
|
+
"pyo3-build-config",
|
|
159
|
+
"quote",
|
|
160
|
+
"syn",
|
|
161
|
+
]
|
|
162
|
+
|
|
163
|
+
[[package]]
|
|
164
|
+
name = "quote"
|
|
165
|
+
version = "1.0.45"
|
|
166
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
167
|
+
checksum = "41f2619966050689382d2b44f664f4bc593e129785a36d6ee376ddf37259b924"
|
|
168
|
+
dependencies = [
|
|
169
|
+
"proc-macro2",
|
|
170
|
+
]
|
|
171
|
+
|
|
172
|
+
[[package]]
|
|
173
|
+
name = "rayon"
|
|
174
|
+
version = "1.11.0"
|
|
175
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
176
|
+
checksum = "368f01d005bf8fd9b1206fb6fa653e6c4a81ceb1466406b81792d87c5677a58f"
|
|
177
|
+
dependencies = [
|
|
178
|
+
"either",
|
|
179
|
+
"rayon-core",
|
|
180
|
+
]
|
|
181
|
+
|
|
182
|
+
[[package]]
|
|
183
|
+
name = "rayon-core"
|
|
184
|
+
version = "1.13.0"
|
|
185
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
186
|
+
checksum = "22e18b0f0062d30d4230b2e85ff77fdfe4326feb054b9783a3460d8435c8ab91"
|
|
187
|
+
dependencies = [
|
|
188
|
+
"crossbeam-deque",
|
|
189
|
+
"crossbeam-utils",
|
|
190
|
+
]
|
|
191
|
+
|
|
192
|
+
[[package]]
|
|
193
|
+
name = "rustc-hash"
|
|
194
|
+
version = "2.1.1"
|
|
195
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
196
|
+
checksum = "357703d41365b4b27c590e3ed91eabb1b663f07c4c084095e60cbed4362dff0d"
|
|
197
|
+
|
|
198
|
+
[[package]]
|
|
199
|
+
name = "rustversion"
|
|
200
|
+
version = "1.0.22"
|
|
201
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
202
|
+
checksum = "b39cdef0fa800fc44525c84ccb54a029961a8215f9619753635a9c0d2538d46d"
|
|
203
|
+
|
|
204
|
+
[[package]]
|
|
205
|
+
name = "syn"
|
|
206
|
+
version = "2.0.117"
|
|
207
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
208
|
+
checksum = "e665b8803e7b1d2a727f4023456bbbbe74da67099c585258af0ad9c5013b9b99"
|
|
209
|
+
dependencies = [
|
|
210
|
+
"proc-macro2",
|
|
211
|
+
"quote",
|
|
212
|
+
"unicode-ident",
|
|
213
|
+
]
|
|
214
|
+
|
|
215
|
+
[[package]]
|
|
216
|
+
name = "target-lexicon"
|
|
217
|
+
version = "0.13.5"
|
|
218
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
219
|
+
checksum = "adb6935a6f5c20170eeceb1a3835a49e12e19d792f6dd344ccc76a985ca5a6ca"
|
|
220
|
+
|
|
221
|
+
[[package]]
|
|
222
|
+
name = "unicode-ident"
|
|
223
|
+
version = "1.0.24"
|
|
224
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
225
|
+
checksum = "e6e4313cd5fcd3dad5cafa179702e2b244f760991f45397d14d4ebf38247da75"
|
|
226
|
+
|
|
227
|
+
[[package]]
|
|
228
|
+
name = "unindent"
|
|
229
|
+
version = "0.2.4"
|
|
230
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
231
|
+
checksum = "7264e107f553ccae879d21fbea1d6724ac785e8c3bfc762137959b5802826ef3"
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
[package]
|
|
2
|
+
name = "fast_rouge"
|
|
3
|
+
version = "0.1.2"
|
|
4
|
+
edition = "2024"
|
|
5
|
+
description = "High-performance Rust-backed ROUGE scoring for Python"
|
|
6
|
+
readme = "README.md"
|
|
7
|
+
license = "MIT"
|
|
8
|
+
homepage = "https://github.com/kyle-mirich/rouge-rust"
|
|
9
|
+
repository = "https://github.com/kyle-mirich/rouge-rust"
|
|
10
|
+
|
|
11
|
+
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
|
12
|
+
[lib]
|
|
13
|
+
name = "fast_rouge"
|
|
14
|
+
crate-type = ["cdylib"]
|
|
15
|
+
|
|
16
|
+
[dependencies]
|
|
17
|
+
pyo3 = "0.27.0"
|
|
18
|
+
rayon = "1.11.0"
|
|
19
|
+
rustc-hash = "2.1.1"
|
|
20
|
+
|
|
21
|
+
[profile.release]
|
|
22
|
+
codegen-units = 1
|
|
23
|
+
lto = "thin"
|
rouge_rust-0.1.2/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Kyle Mirich
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: rouge-rust
|
|
3
|
+
Version: 0.1.2
|
|
4
|
+
Classifier: Development Status :: 3 - Alpha
|
|
5
|
+
Classifier: Intended Audience :: Developers
|
|
6
|
+
Classifier: Intended Audience :: Science/Research
|
|
7
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
8
|
+
Classifier: Programming Language :: Python :: 3
|
|
9
|
+
Classifier: Programming Language :: Python :: 3 :: Only
|
|
10
|
+
Classifier: Programming Language :: Rust
|
|
11
|
+
Classifier: Programming Language :: Python :: Implementation :: CPython
|
|
12
|
+
Classifier: Programming Language :: Python :: Implementation :: PyPy
|
|
13
|
+
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
|
|
14
|
+
Requires-Dist: pytest>=8 ; extra == 'dev'
|
|
15
|
+
Requires-Dist: rouge-score>=0.1.2 ; extra == 'dev'
|
|
16
|
+
Requires-Dist: twine>=6 ; extra == 'dev'
|
|
17
|
+
Provides-Extra: dev
|
|
18
|
+
License-File: LICENSE
|
|
19
|
+
Summary: High-performance Rust-backed ROUGE scoring for Python
|
|
20
|
+
Keywords: nlp,rouge,evaluation,rust,pyo3
|
|
21
|
+
Home-Page: https://github.com/kyle-mirich/rouge-rust
|
|
22
|
+
Requires-Python: >=3.8
|
|
23
|
+
Description-Content-Type: text/markdown; charset=UTF-8; variant=GFM
|
|
24
|
+
Project-URL: Homepage, https://github.com/kyle-mirich/rouge-rust
|
|
25
|
+
Project-URL: Issues, https://github.com/kyle-mirich/rouge-rust/issues
|
|
26
|
+
Project-URL: Repository, https://github.com/kyle-mirich/rouge-rust
|
|
27
|
+
|
|
28
|
+
# rouge-rust
|
|
29
|
+
|
|
30
|
+
`rouge-rust` is a Rust-powered replacement for Google's `rouge-score` Python package.
|
|
31
|
+
It provides matching ROUGE-1, ROUGE-2, and ROUGE-L metrics through a PyO3 extension module,
|
|
32
|
+
with fast batch APIs for large-scale evaluation workloads.
|
|
33
|
+
|
|
34
|
+
## Features
|
|
35
|
+
|
|
36
|
+
- ROUGE-1, ROUGE-2, and ROUGE-L scoring
|
|
37
|
+
- `score()` for drop-in per-pair scoring
|
|
38
|
+
- `score_batch()` for list-of-dicts batch scoring
|
|
39
|
+
- `score_batch_flat()` for high-throughput struct-of-arrays batch scoring
|
|
40
|
+
- Rust core optimized for large datasets
|
|
41
|
+
|
|
42
|
+
## Installation
|
|
43
|
+
|
|
44
|
+
```bash
|
|
45
|
+
pip install rouge-rust
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
## Usage
|
|
49
|
+
|
|
50
|
+
```python
|
|
51
|
+
import fast_rouge
|
|
52
|
+
|
|
53
|
+
single = fast_rouge.score("the cat sat", "the cat sat")
|
|
54
|
+
print(single["rouge1"].fmeasure)
|
|
55
|
+
|
|
56
|
+
batch = fast_rouge.score_batch(
|
|
57
|
+
["the cat sat", "hello world"],
|
|
58
|
+
["the dog sat", "hello there"],
|
|
59
|
+
)
|
|
60
|
+
print(batch[0]["rougeL"].precision)
|
|
61
|
+
|
|
62
|
+
flat = fast_rouge.score_batch_flat(
|
|
63
|
+
["the cat sat", "hello world"],
|
|
64
|
+
["the dog sat", "hello there"],
|
|
65
|
+
)
|
|
66
|
+
print(flat.rouge1_fmeasure[0])
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
## Development
|
|
70
|
+
|
|
71
|
+
Build the extension into the active virtual environment:
|
|
72
|
+
|
|
73
|
+
```bash
|
|
74
|
+
source "$HOME/.cargo/env"
|
|
75
|
+
.venv/bin/maturin develop --release
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
Run tests:
|
|
79
|
+
|
|
80
|
+
```bash
|
|
81
|
+
source "$HOME/.cargo/env"
|
|
82
|
+
cargo test
|
|
83
|
+
.venv/bin/pytest -q
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
Run the benchmark:
|
|
87
|
+
|
|
88
|
+
```bash
|
|
89
|
+
PAIR_COUNT=100000 REPEATS=3 .venv/bin/python benchmark.py
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
## Contributing
|
|
93
|
+
|
|
94
|
+
See [CONTRIBUTING.md](CONTRIBUTING.md).
|
|
95
|
+
|
|
96
|
+
## License
|
|
97
|
+
|
|
98
|
+
This project is released under the MIT License. See [LICENSE](LICENSE).
|
|
99
|
+
|
|
100
|
+
## Release
|
|
101
|
+
|
|
102
|
+
Build a source distribution and wheel:
|
|
103
|
+
|
|
104
|
+
```bash
|
|
105
|
+
source "$HOME/.cargo/env"
|
|
106
|
+
.venv/bin/maturin build --release --sdist -o dist
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
Validate the distributions:
|
|
110
|
+
|
|
111
|
+
```bash
|
|
112
|
+
.venv/bin/python -m twine check dist/*
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
Upload to PyPI:
|
|
116
|
+
|
|
117
|
+
```bash
|
|
118
|
+
source "$HOME/.cargo/env"
|
|
119
|
+
.venv/bin/maturin upload dist/*
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
## GitHub Actions release flow
|
|
123
|
+
|
|
124
|
+
This repo includes a GitHub Actions pipeline in `.github/workflows/release.yml`.
|
|
125
|
+
|
|
126
|
+
- pushes and pull requests to `main` and `develop` build and test wheels
|
|
127
|
+
- tags matching `v*` build release artifacts
|
|
128
|
+
- tag builds publish to PyPI and create a GitHub Release
|
|
129
|
+
|
|
130
|
+
### One-time PyPI setup
|
|
131
|
+
|
|
132
|
+
Configure PyPI trusted publishing for:
|
|
133
|
+
|
|
134
|
+
- owner: `kyle-mirich`
|
|
135
|
+
- repository: `rouge-rust`
|
|
136
|
+
- workflow: `release.yml`
|
|
137
|
+
- environment: `pypi`
|
|
138
|
+
|
|
139
|
+
After that, creating and pushing a tag such as `v0.1.0` will trigger publishing.
|
|
140
|
+
|