Matheel 0.2.2__tar.gz → 0.3.0__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.
- {matheel-0.2.2 → matheel-0.3.0}/PKG-INFO +23 -16
- {matheel-0.2.2 → matheel-0.3.0}/README.md +15 -15
- {matheel-0.2.2 → matheel-0.3.0}/matheel/chunking.py +2 -15
- {matheel-0.2.2 → matheel-0.3.0}/matheel/cli.py +120 -2
- matheel-0.3.0/matheel/code_metrics.py +1400 -0
- {matheel-0.2.2 → matheel-0.3.0}/matheel/comparison_suite.py +32 -22
- {matheel-0.2.2 → matheel-0.3.0}/matheel/feature_weights.py +3 -28
- matheel-0.3.0/matheel/preprocessing.py +198 -0
- {matheel-0.2.2 → matheel-0.3.0}/matheel/similarity.py +217 -35
- {matheel-0.2.2 → matheel-0.3.0}/matheel.egg-info/PKG-INFO +23 -16
- {matheel-0.2.2 → matheel-0.3.0}/matheel.egg-info/requires.txt +7 -0
- {matheel-0.2.2 → matheel-0.3.0}/pyproject.toml +10 -2
- {matheel-0.2.2 → matheel-0.3.0}/tests/test_chunking.py +8 -15
- {matheel-0.2.2 → matheel-0.3.0}/tests/test_cli.py +57 -0
- matheel-0.3.0/tests/test_code_metrics.py +256 -0
- {matheel-0.2.2 → matheel-0.3.0}/tests/test_comparison_suite.py +22 -7
- {matheel-0.2.2 → matheel-0.3.0}/tests/test_feature_weights.py +1 -1
- matheel-0.3.0/tests/test_preprocessing.py +67 -0
- {matheel-0.2.2 → matheel-0.3.0}/tests/test_real_models.py +4 -7
- {matheel-0.2.2 → matheel-0.3.0}/tests/test_similarity.py +36 -82
- matheel-0.2.2/matheel/code_metrics.py +0 -417
- matheel-0.2.2/matheel/preprocessing.py +0 -88
- matheel-0.2.2/tests/test_code_metrics.py +0 -57
- matheel-0.2.2/tests/test_preprocessing.py +0 -21
- {matheel-0.2.2 → matheel-0.3.0}/LICENSE +0 -0
- {matheel-0.2.2 → matheel-0.3.0}/matheel/__init__.py +0 -0
- {matheel-0.2.2 → matheel-0.3.0}/matheel/model_routing.py +0 -0
- {matheel-0.2.2 → matheel-0.3.0}/matheel/vectors.py +0 -0
- {matheel-0.2.2 → matheel-0.3.0}/matheel.egg-info/SOURCES.txt +0 -0
- {matheel-0.2.2 → matheel-0.3.0}/matheel.egg-info/dependency_links.txt +0 -0
- {matheel-0.2.2 → matheel-0.3.0}/matheel.egg-info/entry_points.txt +0 -0
- {matheel-0.2.2 → matheel-0.3.0}/matheel.egg-info/top_level.txt +0 -0
- {matheel-0.2.2 → matheel-0.3.0}/setup.cfg +0 -0
- {matheel-0.2.2 → matheel-0.3.0}/tests/test_model_routing.py +0 -0
- {matheel-0.2.2 → matheel-0.3.0}/tests/test_vectors.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: matheel
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.3.0
|
|
4
4
|
Summary: Matheel: A CLI and Python package for source-code similarity detection.
|
|
5
5
|
Author: Fahad Ebrahim
|
|
6
6
|
License-Expression: CC-BY-NC-4.0
|
|
@@ -13,6 +13,9 @@ Requires-Dist: click<9,>=8
|
|
|
13
13
|
Requires-Dist: pandas<3.1,>=2.2
|
|
14
14
|
Requires-Dist: numpy<3,>=2
|
|
15
15
|
Requires-Dist: rapidfuzz<4,>=3
|
|
16
|
+
Requires-Dist: networkx<4,>=3
|
|
17
|
+
Requires-Dist: tree-sitter-language-pack<0.8,>=0.7
|
|
18
|
+
Requires-Dist: func-timeout<5,>=4
|
|
16
19
|
Requires-Dist: sentence-transformers<5.2,>=5.1
|
|
17
20
|
Requires-Dist: sentencepiece<0.3,>=0.2
|
|
18
21
|
Provides-Extra: chunking
|
|
@@ -20,6 +23,8 @@ Requires-Dist: chonkie<1.6,>=1.5; extra == "chunking"
|
|
|
20
23
|
Provides-Extra: chunking-code
|
|
21
24
|
Requires-Dist: chonkie[code]<1.6,>=1.5; extra == "chunking-code"
|
|
22
25
|
Provides-Extra: metrics
|
|
26
|
+
Requires-Dist: apted<2,>=1.0; extra == "metrics"
|
|
27
|
+
Requires-Dist: bert-score<0.4,>=0.3; extra == "metrics"
|
|
23
28
|
Provides-Extra: model2vec
|
|
24
29
|
Requires-Dist: model2vec<0.8,>=0.7; extra == "model2vec"
|
|
25
30
|
Provides-Extra: pylate
|
|
@@ -29,6 +34,8 @@ Requires-Dist: gradio<6,>=5; extra == "gradio"
|
|
|
29
34
|
Requires-Dist: gradio-huggingfacehub-search==0.0.8; extra == "gradio"
|
|
30
35
|
Provides-Extra: all
|
|
31
36
|
Requires-Dist: chonkie[code]<1.6,>=1.5; extra == "all"
|
|
37
|
+
Requires-Dist: apted<2,>=1.0; extra == "all"
|
|
38
|
+
Requires-Dist: bert-score<0.4,>=0.3; extra == "all"
|
|
32
39
|
Requires-Dist: model2vec<0.8,>=0.7; extra == "all"
|
|
33
40
|
Requires-Dist: pylate<1.5,>=1.4; extra == "all"
|
|
34
41
|
Requires-Dist: gradio<6,>=5; extra == "all"
|
|
@@ -58,6 +65,7 @@ Optional extras:
|
|
|
58
65
|
```bash
|
|
59
66
|
pip install "matheel[chunking]"
|
|
60
67
|
pip install "matheel[chunking_code]"
|
|
68
|
+
pip install "matheel[metrics]"
|
|
61
69
|
pip install "matheel[model2vec]"
|
|
62
70
|
pip install "matheel[pylate]"
|
|
63
71
|
pip install "matheel[gradio]"
|
|
@@ -65,23 +73,17 @@ pip install "matheel[all]"
|
|
|
65
73
|
pip install "matheel[dev]"
|
|
66
74
|
```
|
|
67
75
|
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
```bash
|
|
71
|
-
pip install -c constraints/py312.txt .
|
|
72
|
-
```
|
|
73
|
-
|
|
74
|
-
`matheel[all]` installs the currently supported optional backends in one command: Chonkie code chunking, model2vec, PyLate, and the Gradio app dependencies.
|
|
76
|
+
`matheel[all]` installs the currently supported optional backends in one command: Chonkie code chunking, metrics runtime dependencies (RUBY graph/tree, TSED, CodeBERTScore), model2vec, PyLate, and the Gradio app dependencies.
|
|
75
77
|
|
|
76
78
|
## Quick Start
|
|
77
79
|
|
|
78
|
-
The repo includes a small Java archive at `sample_pairs.zip` for
|
|
80
|
+
The repo includes a small Java archive at `sample_pairs.zip` for quick validation.
|
|
79
81
|
|
|
80
82
|
CLI:
|
|
81
83
|
|
|
82
84
|
```bash
|
|
83
85
|
matheel compare sample_pairs.zip \
|
|
84
|
-
--model
|
|
86
|
+
--model huggingface/CodeBERTa-small-v1 \
|
|
85
87
|
--feature-weight semantic=0.7 \
|
|
86
88
|
--feature-weight levenshtein=0.3 \
|
|
87
89
|
--threshold 0.2 \
|
|
@@ -95,7 +97,7 @@ from matheel.similarity import get_sim_list
|
|
|
95
97
|
|
|
96
98
|
results = get_sim_list(
|
|
97
99
|
"sample_pairs.zip",
|
|
98
|
-
model_name="
|
|
100
|
+
model_name="huggingface/CodeBERTa-small-v1",
|
|
99
101
|
threshold=0.2,
|
|
100
102
|
number_results=10,
|
|
101
103
|
feature_weights={
|
|
@@ -129,11 +131,16 @@ Code metrics:
|
|
|
129
131
|
- `codebleu_syntax`
|
|
130
132
|
- `codebleu_dataflow`
|
|
131
133
|
- `crystalbleu`
|
|
134
|
+
- `ruby`
|
|
135
|
+
- `tsed`
|
|
136
|
+
- `codebertscore`
|
|
137
|
+
|
|
138
|
+
`ruby` now uses a full staged implementation (`graph -> tree -> string`), with optional runtime dependencies enabled via `matheel[metrics]`.
|
|
132
139
|
|
|
133
140
|
Chunking methods:
|
|
134
141
|
|
|
135
142
|
- `none`
|
|
136
|
-
- Chonkie-backed when installed: `code`, `
|
|
143
|
+
- Chonkie-backed when installed: `code`, `chonkie_token`, `chonkie_sentence`, `chonkie_recursive`, `chonkie_fast`
|
|
137
144
|
|
|
138
145
|
Vector backends:
|
|
139
146
|
|
|
@@ -175,7 +182,7 @@ Compare a directory or ZIP archive:
|
|
|
175
182
|
|
|
176
183
|
```bash
|
|
177
184
|
matheel compare codes/ \
|
|
178
|
-
--model
|
|
185
|
+
--model huggingface/CodeBERTa-small-v1 \
|
|
179
186
|
--vector-backend auto \
|
|
180
187
|
--max-token-length 256 \
|
|
181
188
|
--feature-weight semantic=0.6 \
|
|
@@ -212,7 +219,7 @@ from matheel.similarity import calculate_similarity
|
|
|
212
219
|
score = calculate_similarity(
|
|
213
220
|
"def add(a, b):\n return a + b\n",
|
|
214
221
|
"def add(x, y):\n return x + y\n",
|
|
215
|
-
model_name="
|
|
222
|
+
model_name="huggingface/CodeBERTa-small-v1",
|
|
216
223
|
vector_backend="auto",
|
|
217
224
|
max_token_length=256,
|
|
218
225
|
similarity_function="dot",
|
|
@@ -233,7 +240,7 @@ from matheel.similarity import get_sim_list
|
|
|
233
240
|
|
|
234
241
|
results = get_sim_list(
|
|
235
242
|
"sample_codes",
|
|
236
|
-
model_name="
|
|
243
|
+
model_name="huggingface/CodeBERTa-small-v1",
|
|
237
244
|
threshold=0.4,
|
|
238
245
|
number_results=50,
|
|
239
246
|
vector_backend="auto",
|
|
@@ -276,7 +283,7 @@ The `docs/` folder is already structured well for a later GitHub Pages setup if
|
|
|
276
283
|
|
|
277
284
|
## Examples
|
|
278
285
|
|
|
279
|
-
- Quick archive
|
|
286
|
+
- Quick archive check: [examples/sample_pairs_demo.py](examples/sample_pairs_demo.py)
|
|
280
287
|
- Preprocessing: [examples/preprocessing_demo.py](examples/preprocessing_demo.py)
|
|
281
288
|
- Chunking: [examples/chunking_demo.py](examples/chunking_demo.py)
|
|
282
289
|
- Vector backends: [examples/vectors_demo.py](examples/vectors_demo.py)
|
|
@@ -17,6 +17,7 @@ Optional extras:
|
|
|
17
17
|
```bash
|
|
18
18
|
pip install "matheel[chunking]"
|
|
19
19
|
pip install "matheel[chunking_code]"
|
|
20
|
+
pip install "matheel[metrics]"
|
|
20
21
|
pip install "matheel[model2vec]"
|
|
21
22
|
pip install "matheel[pylate]"
|
|
22
23
|
pip install "matheel[gradio]"
|
|
@@ -24,23 +25,17 @@ pip install "matheel[all]"
|
|
|
24
25
|
pip install "matheel[dev]"
|
|
25
26
|
```
|
|
26
27
|
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
```bash
|
|
30
|
-
pip install -c constraints/py312.txt .
|
|
31
|
-
```
|
|
32
|
-
|
|
33
|
-
`matheel[all]` installs the currently supported optional backends in one command: Chonkie code chunking, model2vec, PyLate, and the Gradio app dependencies.
|
|
28
|
+
`matheel[all]` installs the currently supported optional backends in one command: Chonkie code chunking, metrics runtime dependencies (RUBY graph/tree, TSED, CodeBERTScore), model2vec, PyLate, and the Gradio app dependencies.
|
|
34
29
|
|
|
35
30
|
## Quick Start
|
|
36
31
|
|
|
37
|
-
The repo includes a small Java archive at `sample_pairs.zip` for
|
|
32
|
+
The repo includes a small Java archive at `sample_pairs.zip` for quick validation.
|
|
38
33
|
|
|
39
34
|
CLI:
|
|
40
35
|
|
|
41
36
|
```bash
|
|
42
37
|
matheel compare sample_pairs.zip \
|
|
43
|
-
--model
|
|
38
|
+
--model huggingface/CodeBERTa-small-v1 \
|
|
44
39
|
--feature-weight semantic=0.7 \
|
|
45
40
|
--feature-weight levenshtein=0.3 \
|
|
46
41
|
--threshold 0.2 \
|
|
@@ -54,7 +49,7 @@ from matheel.similarity import get_sim_list
|
|
|
54
49
|
|
|
55
50
|
results = get_sim_list(
|
|
56
51
|
"sample_pairs.zip",
|
|
57
|
-
model_name="
|
|
52
|
+
model_name="huggingface/CodeBERTa-small-v1",
|
|
58
53
|
threshold=0.2,
|
|
59
54
|
number_results=10,
|
|
60
55
|
feature_weights={
|
|
@@ -88,11 +83,16 @@ Code metrics:
|
|
|
88
83
|
- `codebleu_syntax`
|
|
89
84
|
- `codebleu_dataflow`
|
|
90
85
|
- `crystalbleu`
|
|
86
|
+
- `ruby`
|
|
87
|
+
- `tsed`
|
|
88
|
+
- `codebertscore`
|
|
89
|
+
|
|
90
|
+
`ruby` now uses a full staged implementation (`graph -> tree -> string`), with optional runtime dependencies enabled via `matheel[metrics]`.
|
|
91
91
|
|
|
92
92
|
Chunking methods:
|
|
93
93
|
|
|
94
94
|
- `none`
|
|
95
|
-
- Chonkie-backed when installed: `code`, `
|
|
95
|
+
- Chonkie-backed when installed: `code`, `chonkie_token`, `chonkie_sentence`, `chonkie_recursive`, `chonkie_fast`
|
|
96
96
|
|
|
97
97
|
Vector backends:
|
|
98
98
|
|
|
@@ -134,7 +134,7 @@ Compare a directory or ZIP archive:
|
|
|
134
134
|
|
|
135
135
|
```bash
|
|
136
136
|
matheel compare codes/ \
|
|
137
|
-
--model
|
|
137
|
+
--model huggingface/CodeBERTa-small-v1 \
|
|
138
138
|
--vector-backend auto \
|
|
139
139
|
--max-token-length 256 \
|
|
140
140
|
--feature-weight semantic=0.6 \
|
|
@@ -171,7 +171,7 @@ from matheel.similarity import calculate_similarity
|
|
|
171
171
|
score = calculate_similarity(
|
|
172
172
|
"def add(a, b):\n return a + b\n",
|
|
173
173
|
"def add(x, y):\n return x + y\n",
|
|
174
|
-
model_name="
|
|
174
|
+
model_name="huggingface/CodeBERTa-small-v1",
|
|
175
175
|
vector_backend="auto",
|
|
176
176
|
max_token_length=256,
|
|
177
177
|
similarity_function="dot",
|
|
@@ -192,7 +192,7 @@ from matheel.similarity import get_sim_list
|
|
|
192
192
|
|
|
193
193
|
results = get_sim_list(
|
|
194
194
|
"sample_codes",
|
|
195
|
-
model_name="
|
|
195
|
+
model_name="huggingface/CodeBERTa-small-v1",
|
|
196
196
|
threshold=0.4,
|
|
197
197
|
number_results=50,
|
|
198
198
|
vector_backend="auto",
|
|
@@ -235,7 +235,7 @@ The `docs/` folder is already structured well for a later GitHub Pages setup if
|
|
|
235
235
|
|
|
236
236
|
## Examples
|
|
237
237
|
|
|
238
|
-
- Quick archive
|
|
238
|
+
- Quick archive check: [examples/sample_pairs_demo.py](examples/sample_pairs_demo.py)
|
|
239
239
|
- Preprocessing: [examples/preprocessing_demo.py](examples/preprocessing_demo.py)
|
|
240
240
|
- Chunking: [examples/chunking_demo.py](examples/chunking_demo.py)
|
|
241
241
|
- Vector backends: [examples/vectors_demo.py](examples/vectors_demo.py)
|
|
@@ -2,11 +2,8 @@ import inspect
|
|
|
2
2
|
|
|
3
3
|
|
|
4
4
|
_BASE_METHODS = ("none",)
|
|
5
|
-
_LEGACY_METHODS = ("lines", "tokens", "characters")
|
|
6
5
|
_CHONKIE_METHODS = (
|
|
7
6
|
"code",
|
|
8
|
-
"codechunker",
|
|
9
|
-
"chonkie_code",
|
|
10
7
|
"chonkie_token",
|
|
11
8
|
"chonkie_sentence",
|
|
12
9
|
"chonkie_recursive",
|
|
@@ -14,8 +11,6 @@ _CHONKIE_METHODS = (
|
|
|
14
11
|
)
|
|
15
12
|
_CHONKIE_CLASS_NAMES = {
|
|
16
13
|
"code": "CodeChunker",
|
|
17
|
-
"codechunker": "CodeChunker",
|
|
18
|
-
"chonkie_code": "CodeChunker",
|
|
19
14
|
"chonkie_token": "TokenChunker",
|
|
20
15
|
"chonkie_sentence": "SentenceChunker",
|
|
21
16
|
"chonkie_recursive": "RecursiveChunker",
|
|
@@ -23,8 +18,6 @@ _CHONKIE_CLASS_NAMES = {
|
|
|
23
18
|
}
|
|
24
19
|
_CHONKIE_PARAMETER_NAMES = {
|
|
25
20
|
"code": ("chunk_size", "language", "include_nodes", "tokenizer"),
|
|
26
|
-
"codechunker": ("chunk_size", "language", "include_nodes", "tokenizer"),
|
|
27
|
-
"chonkie_code": ("chunk_size", "language", "include_nodes", "tokenizer"),
|
|
28
21
|
"chonkie_token": ("chunk_size", "chunk_overlap", "tokenizer"),
|
|
29
22
|
"chonkie_sentence": (
|
|
30
23
|
"chunk_size",
|
|
@@ -47,7 +40,7 @@ def available_chunking_methods():
|
|
|
47
40
|
|
|
48
41
|
def chunker_parameter_names(method):
|
|
49
42
|
selected_method = (method or "").strip().lower()
|
|
50
|
-
if selected_method
|
|
43
|
+
if selected_method == "none":
|
|
51
44
|
return ()
|
|
52
45
|
return _CHONKIE_PARAMETER_NAMES.get(selected_method, ())
|
|
53
46
|
|
|
@@ -275,14 +268,8 @@ def chunk_text(
|
|
|
275
268
|
):
|
|
276
269
|
selected_method = (method or "none").strip().lower()
|
|
277
270
|
|
|
278
|
-
if selected_method
|
|
271
|
+
if selected_method == "none":
|
|
279
272
|
chunks = [text or ""]
|
|
280
|
-
elif selected_method == "lines":
|
|
281
|
-
chunks = chunk_by_lines(text, chunk_size=chunk_size, chunk_overlap=chunk_overlap)
|
|
282
|
-
elif selected_method == "tokens":
|
|
283
|
-
chunks = chunk_by_tokens(text, chunk_size=chunk_size, chunk_overlap=chunk_overlap)
|
|
284
|
-
elif selected_method == "characters":
|
|
285
|
-
chunks = chunk_by_characters(text, chunk_size=chunk_size, chunk_overlap=chunk_overlap)
|
|
286
273
|
elif selected_method in _CHONKIE_METHODS:
|
|
287
274
|
return _chunk_with_chonkie(
|
|
288
275
|
text,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import click
|
|
2
2
|
from .comparison_suite import load_run_configs, run_comparison_suite
|
|
3
3
|
from .code_metrics import available_code_metrics
|
|
4
|
-
from .similarity import available_runtime_devices, get_sim_list
|
|
4
|
+
from .similarity import DEFAULT_MODEL_NAME, available_runtime_devices, get_sim_list
|
|
5
5
|
from .chunking import available_chunk_aggregations, available_chunking_methods
|
|
6
6
|
from .model_routing import available_vector_backends
|
|
7
7
|
from .preprocessing import available_preprocess_modes
|
|
@@ -24,7 +24,7 @@ def main():
|
|
|
24
24
|
multiple=True,
|
|
25
25
|
help='Normalized feature weights as name=value. Example: --feature-weight semantic=0.5 --feature-weight code_metric=0.5',
|
|
26
26
|
)
|
|
27
|
-
@click.option('--model', default=
|
|
27
|
+
@click.option('--model', default=DEFAULT_MODEL_NAME, show_default=True, help='Embedding model name.')
|
|
28
28
|
@click.option(
|
|
29
29
|
'--preprocess-mode',
|
|
30
30
|
type=click.Choice(available_preprocess_modes()),
|
|
@@ -68,6 +68,68 @@ def main():
|
|
|
68
68
|
@click.option('--codebleu-component-weights', default='0.25,0.25,0.25,0.25', show_default=True, help='Comma-separated weights for ngram, weighted_ngram, syntax, dataflow.')
|
|
69
69
|
@click.option('--crystalbleu-max-order', default=4, show_default=True, help='Maximum n-gram order for CrystalBLEU.')
|
|
70
70
|
@click.option('--crystalbleu-trivial-ngram-count', default=50, show_default=True, help='How many frequent n-grams to ignore in CrystalBLEU.')
|
|
71
|
+
@click.option('--ruby-max-order', default=4, show_default=True, help='Maximum n-gram order for RUBY.')
|
|
72
|
+
@click.option('--ruby-epsilon', default=1e-12, show_default=True, help='Small epsilon used by RUBY F1 smoothing.')
|
|
73
|
+
@click.option(
|
|
74
|
+
'--ruby-mode',
|
|
75
|
+
type=click.Choice(("auto", "graph", "tree", "string", "ngram")),
|
|
76
|
+
default='auto',
|
|
77
|
+
show_default=True,
|
|
78
|
+
help='RUBY strategy selection.',
|
|
79
|
+
)
|
|
80
|
+
@click.option(
|
|
81
|
+
'--ruby-tokenizer',
|
|
82
|
+
type=click.Choice(("tranx", "regex")),
|
|
83
|
+
default='tranx',
|
|
84
|
+
show_default=True,
|
|
85
|
+
help='Tokenizer used by RUBY string mode.',
|
|
86
|
+
)
|
|
87
|
+
@click.option(
|
|
88
|
+
'--ruby-denominator',
|
|
89
|
+
type=click.Choice(("max", "mean")),
|
|
90
|
+
default='max',
|
|
91
|
+
show_default=True,
|
|
92
|
+
help='Length normalization denominator used by RUBY string mode.',
|
|
93
|
+
)
|
|
94
|
+
@click.option('--ruby-graph-timeout-seconds', default=1.0, show_default=True, help='Per-step timeout (seconds) for RUBY graph edit search.')
|
|
95
|
+
@click.option('--ruby-graph-use-edge-cost/--no-ruby-graph-use-edge-cost', default=True, show_default=True, help='Whether RUBY graph mode includes edge insertion/deletion cost.')
|
|
96
|
+
@click.option('--ruby-graph-include-leaf-edges/--no-ruby-graph-include-leaf-edges', default=True, show_default=True, help='Whether RUBY graph mode adds sequential leaf edges.')
|
|
97
|
+
@click.option('--ruby-tree-max-nodes', default=180, show_default=True, help='Maximum parsed tree nodes for RUBY tree/graph modes.')
|
|
98
|
+
@click.option('--ruby-tree-max-depth', default=10, show_default=True, help='Maximum parsed tree depth for RUBY tree/graph modes.')
|
|
99
|
+
@click.option('--ruby-tree-max-children', default=8, show_default=True, help='Maximum parsed children per node for RUBY tree/graph modes.')
|
|
100
|
+
@click.option('--tsed-delete-cost', default=1.0, show_default=True, help='Delete edit cost for TSED.')
|
|
101
|
+
@click.option('--tsed-insert-cost', default=1.0, show_default=True, help='Insert edit cost for TSED.')
|
|
102
|
+
@click.option('--tsed-rename-cost', default=1.0, show_default=True, help='Rename edit cost for TSED.')
|
|
103
|
+
@click.option('--tsed-max-nodes', default=180, show_default=True, help='Maximum AST nodes sampled per file for TSED.')
|
|
104
|
+
@click.option('--tsed-max-depth', default=10, show_default=True, help='Maximum AST depth for TSED.')
|
|
105
|
+
@click.option('--tsed-max-children', default=8, show_default=True, help='Maximum AST children sampled per node for TSED.')
|
|
106
|
+
@click.option('--codebertscore-model', default='microsoft/codebert-base', show_default=True, help='Model name used for CodeBERTScore.')
|
|
107
|
+
@click.option('--codebertscore-num-layers', default=0, show_default=True, help='Hidden layer count for CodeBERTScore. 0 uses model defaults.')
|
|
108
|
+
@click.option('--codebertscore-batch-size', default=16, show_default=True, help='Batch size for CodeBERTScore.')
|
|
109
|
+
@click.option('--codebertscore-max-length', default=0, show_default=True, help='Max tokenizer length for CodeBERTScore. 0 uses model limits.')
|
|
110
|
+
@click.option(
|
|
111
|
+
'--codebertscore-device',
|
|
112
|
+
type=click.Choice(("auto",) + available_runtime_devices()),
|
|
113
|
+
default='auto',
|
|
114
|
+
show_default=True,
|
|
115
|
+
help='Runtime device for CodeBERTScore.',
|
|
116
|
+
)
|
|
117
|
+
@click.option('--codebertscore-lang', default='', show_default=True, help='Optional language code passed to CodeBERTScore.')
|
|
118
|
+
@click.option('--codebertscore-idf/--no-codebertscore-idf', default=False, show_default=True, help='Enable IDF weighting for CodeBERTScore.')
|
|
119
|
+
@click.option(
|
|
120
|
+
'--codebertscore-rescale-with-baseline/--no-codebertscore-rescale-with-baseline',
|
|
121
|
+
default=False,
|
|
122
|
+
show_default=True,
|
|
123
|
+
help='Enable baseline rescaling for CodeBERTScore.',
|
|
124
|
+
)
|
|
125
|
+
@click.option(
|
|
126
|
+
'--codebertscore-use-fast-tokenizer/--no-codebertscore-use-fast-tokenizer',
|
|
127
|
+
default=False,
|
|
128
|
+
show_default=True,
|
|
129
|
+
help='Use fast tokenizer for CodeBERTScore.',
|
|
130
|
+
)
|
|
131
|
+
@click.option('--codebertscore-nthreads', default=4, show_default=True, help='Thread count for CodeBERTScore.')
|
|
132
|
+
@click.option('--codebertscore-verbose/--no-codebertscore-verbose', default=False, show_default=True, help='Verbose CodeBERTScore output.')
|
|
71
133
|
@click.option('--levenshtein-weights', default='1,1,1', show_default=True, help='Comma-separated insert,delete,substitute costs for Levenshtein.')
|
|
72
134
|
@click.option('--jaro-winkler-prefix-weight', default=0.1, show_default=True, help='Prefix bonus weight for Jaro-Winkler (0.0 to 0.25).')
|
|
73
135
|
@click.option(
|
|
@@ -120,6 +182,34 @@ def compare(
|
|
|
120
182
|
codebleu_component_weights,
|
|
121
183
|
crystalbleu_max_order,
|
|
122
184
|
crystalbleu_trivial_ngram_count,
|
|
185
|
+
ruby_max_order,
|
|
186
|
+
ruby_epsilon,
|
|
187
|
+
ruby_mode,
|
|
188
|
+
ruby_tokenizer,
|
|
189
|
+
ruby_denominator,
|
|
190
|
+
ruby_graph_timeout_seconds,
|
|
191
|
+
ruby_graph_use_edge_cost,
|
|
192
|
+
ruby_graph_include_leaf_edges,
|
|
193
|
+
ruby_tree_max_nodes,
|
|
194
|
+
ruby_tree_max_depth,
|
|
195
|
+
ruby_tree_max_children,
|
|
196
|
+
tsed_delete_cost,
|
|
197
|
+
tsed_insert_cost,
|
|
198
|
+
tsed_rename_cost,
|
|
199
|
+
tsed_max_nodes,
|
|
200
|
+
tsed_max_depth,
|
|
201
|
+
tsed_max_children,
|
|
202
|
+
codebertscore_model,
|
|
203
|
+
codebertscore_num_layers,
|
|
204
|
+
codebertscore_batch_size,
|
|
205
|
+
codebertscore_max_length,
|
|
206
|
+
codebertscore_device,
|
|
207
|
+
codebertscore_lang,
|
|
208
|
+
codebertscore_idf,
|
|
209
|
+
codebertscore_rescale_with_baseline,
|
|
210
|
+
codebertscore_use_fast_tokenizer,
|
|
211
|
+
codebertscore_nthreads,
|
|
212
|
+
codebertscore_verbose,
|
|
123
213
|
levenshtein_weights,
|
|
124
214
|
jaro_winkler_prefix_weight,
|
|
125
215
|
vector_backend,
|
|
@@ -152,6 +242,34 @@ def compare(
|
|
|
152
242
|
codebleu_component_weights=codebleu_component_weights,
|
|
153
243
|
crystalbleu_max_order=crystalbleu_max_order,
|
|
154
244
|
crystalbleu_trivial_ngram_count=crystalbleu_trivial_ngram_count,
|
|
245
|
+
ruby_max_order=ruby_max_order,
|
|
246
|
+
ruby_epsilon=ruby_epsilon,
|
|
247
|
+
ruby_mode=ruby_mode,
|
|
248
|
+
ruby_tokenizer=ruby_tokenizer,
|
|
249
|
+
ruby_denominator=ruby_denominator,
|
|
250
|
+
ruby_graph_timeout_seconds=ruby_graph_timeout_seconds,
|
|
251
|
+
ruby_graph_use_edge_cost=ruby_graph_use_edge_cost,
|
|
252
|
+
ruby_graph_include_leaf_edges=ruby_graph_include_leaf_edges,
|
|
253
|
+
ruby_tree_max_nodes=ruby_tree_max_nodes,
|
|
254
|
+
ruby_tree_max_depth=ruby_tree_max_depth,
|
|
255
|
+
ruby_tree_max_children=ruby_tree_max_children,
|
|
256
|
+
tsed_delete_cost=tsed_delete_cost,
|
|
257
|
+
tsed_insert_cost=tsed_insert_cost,
|
|
258
|
+
tsed_rename_cost=tsed_rename_cost,
|
|
259
|
+
tsed_max_nodes=tsed_max_nodes,
|
|
260
|
+
tsed_max_depth=tsed_max_depth,
|
|
261
|
+
tsed_max_children=tsed_max_children,
|
|
262
|
+
codebertscore_model=codebertscore_model,
|
|
263
|
+
codebertscore_num_layers=(None if int(codebertscore_num_layers or 0) <= 0 else int(codebertscore_num_layers)),
|
|
264
|
+
codebertscore_batch_size=codebertscore_batch_size,
|
|
265
|
+
codebertscore_max_length=codebertscore_max_length,
|
|
266
|
+
codebertscore_device=codebertscore_device,
|
|
267
|
+
codebertscore_lang=(str(codebertscore_lang).strip() or None),
|
|
268
|
+
codebertscore_idf=codebertscore_idf,
|
|
269
|
+
codebertscore_rescale_with_baseline=codebertscore_rescale_with_baseline,
|
|
270
|
+
codebertscore_use_fast_tokenizer=codebertscore_use_fast_tokenizer,
|
|
271
|
+
codebertscore_nthreads=codebertscore_nthreads,
|
|
272
|
+
codebertscore_verbose=codebertscore_verbose,
|
|
155
273
|
levenshtein_weights=levenshtein_weights,
|
|
156
274
|
jaro_winkler_prefix_weight=jaro_winkler_prefix_weight,
|
|
157
275
|
vector_backend=vector_backend,
|