Conversation
|
Note: a developer should never have to explicitly run |
|
@tanhaow What is the expected output for your test script given the test data? The test script ran, but I'm not sure what I'm supposed to conclude from that. |
laurejt
left a comment
There was a problem hiding this comment.
Overall, this looks pretty good but the code/files need to be reorganized as outlined in my comments below.
There was a problem hiding this comment.
Move the method of interest into the new file metrics.py within the existing translation module. This new file should contain all machine translation metrics we create (similar to what was done for generating translations).
src/muse/metrics/__init__.py
Outdated
There was a problem hiding this comment.
Delete this. It should not be needed. Instead, the metrics submodule should have been added to the top-level __init__.py (i.e., src/muse/__init__.py), but don't do this since this submodule is being removed.
There was a problem hiding this comment.
Update your test script so that it will work with the updated code organization.
test_scripts/test_compute_chrf.py
Outdated
| @@ -0,0 +1,58 @@ | |||
| #!/usr/bin/env python3 | |||
There was a problem hiding this comment.
Why are you including this shebang? Do you running this as an executable?
src/muse/metrics/chrf.py
Outdated
| if not tr_text or not tr_text.strip(): | ||
| raise ValueError("Translation text cannot be empty") | ||
| if not ref_text or not ref_text.strip(): | ||
| raise ValueError("Reference text cannot be empty") |
There was a problem hiding this comment.
Remove these checks, they are unnecessary.
test_scripts/test_compute_chrf.py
Outdated
| import sys | ||
| from pathlib import Path | ||
|
|
||
| from muse.metrics import compute_chrf |
There was a problem hiding this comment.
This line should look something like this:
| from muse.metrics import compute_chrf | |
| from muse.translation.metrics import compute_chrf |
- Move compute_chrf() from src/muse/metrics/chrf.py to src/muse/translation/metrics.py - Remove src/muse/metrics/ submodule entirely - Remove unnecessary empty string validation checks - Update test script import path - Remove shebang from test script Addresses review comments from @laurejt in PR #27 Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
499239e to
d23a35a
Compare
- Move compute_chrf() from src/muse/metrics/chrf.py to src/muse/translation/metrics.py - Remove src/muse/metrics/ submodule entirely
The test script is just there to verify the What's the output you got? |
- Created new src/muse/evaluation module for MT evaluation metrics - Moved compute_chrf() from src/muse/translation/metrics.py to src/muse/evaluation/metrics.py - Updated test script import path - Added evaluation to module exports This separates evaluation concerns from translation generation, allowing for future expansion with other metrics (COMET, BLEU, etc.)
|
Thanks for your review, @laurejt! Changes: Created new |
laurejt
left a comment
There was a problem hiding this comment.
This can be merged, but the following two changes must be made:
- Remove
src/muse/evaluation/__init__.py - Update the pyproject.toml to be as general with dependencies as possible. Only provide versioning requirements when necessary.
pyproject.toml
Outdated
| "evaluate>=0.4.0", | ||
| "datasets>=2.0.0", # required by evaluate | ||
| "sacrebleu>=2.0.0", # required by evaluate for ChrF metric |
There was a problem hiding this comment.
Why is the versioning to the patch level specified? If this is necessary write a comment explaining why.
Associated Issue(s): resolves #14
Changes in this PR
compute_chrf()function insrc/muse/evaluation/metrics.pyto compute ChrF scores for machine translationsevaluationmodule for MT evaluation metricsevaluate,datasets, andsacrebleutopyproject.tomltest_scripts/test_compute_chrf.pyNotes
compute_chrf()function takes two parameters:tr_text(machine translation) andref_text(human reference), and returns a float score in range [0, 100].Reviewer Checklist
test_data_mt_tencent.jsonl) from Google Drive and run test scripttr_text,ref_textinputs;floatoutput)