-
-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
#370 - control pretranslating existing text #371
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed 5 of 5 files at r1, all commit messages.
Reviewable status: all files reviewed, 6 unresolved discussions (waiting on @johnml1135)
src/Serval.Translation/Contracts/PretranslationUSFMTextOrigin.cs
line 3 at r1 (raw file):
namespace Serval.Translation.Contracts; public enum PretranslationUSFMTextOrigin
For acronyms that are longer than 2 characters, you should only capitalize the first letter.
src/Serval.Translation/Controllers/TranslationEnginesController.cs
line 660 at r1 (raw file):
[NotNull] string corpusId, [NotNull] string textId, [FromBody] PretranslationUSFMTextOrigin? textOrigin,
It is unexpected and often considered incorrect to pass a body when using the GET method. This can be specified using a query string, i.e. [FromQuery]
. Since it will be part of the URL, the field name needs to be kebab case. You can easily specify the field name in the attribute, i.e. [FromQuery(Name = "text-origin")]
.
src/Serval.Translation/Controllers/TranslationEnginesController.cs
line 676 at r1 (raw file):
corpusId, textId, textOrigin ??= PretranslationUSFMTextOrigin.PreferExisting,
You only need the normal null-coalescing operator (??
).
src/Serval.Translation/Controllers/TranslationEnginesController.cs
line 774 at r1 (raw file):
/// </summary> /// <remarks> /// Specify the corpora and textIds to train on. If no train_on field is provided, all corpora will be used.
train_on
should be trainOn
. We should also put it in quotes so that it is obvious that we are referring to a property.
src/Serval.Translation/Services/PretranslationService.cs
line 37 at r1 (raw file):
string corpusId, string textId, PretranslationUSFMTextOrigin textOrigin = PretranslationUSFMTextOrigin.PreferExisting,
This doesn't need to have a default value, especially since there isn't one specified in the interface.
src/Serval.Translation/Services/PretranslationService.cs
line 129 at r1 (raw file):
sourceSettings, usfm, [], // don't pass the pretranslations, we only want the existing text.
When we pass a literal value, I usually explicitly specify the parameter name, since it isn't obvious from the variable name.
Previously, ddaspit (Damien Daspit) wrote…
done |
Previously, ddaspit (Damien Daspit) wrote…
Done. |
Previously, ddaspit (Damien Daspit) wrote…
Done. |
Previously, ddaspit (Damien Daspit) wrote…
Done. |
Previously, ddaspit (Damien Daspit) wrote…
Done. |
Previously, ddaspit (Damien Daspit) wrote…
Done. |
Write more tests, and update machine version. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed 6 of 6 files at r2, all commit messages.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @johnml1135)
tests/Serval.Translation.Tests/Services/PretranslationServiceTests.cs
line 15 at r2 (raw file):
"corpus1", "MAT", textOrigin: Contracts.PretranslationUsfmTextOrigin.PreferPretranslated
If you add global using Serval.Translation.Contracts;
to "Usings.cs", then you can get rid of the namespace.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewable status: 5 of 7 files reviewed, 1 unresolved discussion (waiting on @ddaspit)
tests/Serval.Translation.Tests/Services/PretranslationServiceTests.cs
line 15 at r2 (raw file):
Previously, ddaspit (Damien Daspit) wrote…
If you add
global using Serval.Translation.Contracts;
to "Usings.cs", then you can get rid of the namespace.
Done.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed 2 of 2 files at r3, all commit messages.
Reviewable status: complete! all files reviewed, all discussions resolved (waiting on @johnml1135)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewable status: complete! all files reviewed, all discussions resolved (waiting on @johnml1135)
src/Serval.Translation/Services/PretranslationService.cs
line 126 at r3 (raw file):
); case PretranslationUsfmTextOrigin.OnlyExisting: return UpdateUsfm(
In this case, we are just returning the USFM with all text stripped out. Is that correct?
Update from reviewer comments Update test coverage, update to most recent Machine version. Update documentation.
6203ad3
to
e4d83d0
Compare
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #371 +/- ##
==========================================
+ Coverage 70.70% 70.81% +0.11%
==========================================
Files 151 151
Lines 7114 7172 +58
Branches 1118 1121 +3
==========================================
+ Hits 5030 5079 +49
- Misses 1633 1638 +5
- Partials 451 455 +4 ☔ View full report in Codecov by Sentry. |
Previously, ddaspit (Damien Daspit) wrote…
Yes. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed 1 of 6 files at r2, 6 of 6 files at r4, all commit messages.
Reviewable status: complete! all files reviewed, all discussions resolved (waiting on @johnml1135)
I didn't need to add another parameter for pretranslating stuff that is not being trained on. It seemed obvious (to me) that if a person is actively choosing not to train a specific verse, and asks for it pretranslated, we should just do what they want (credit to Damien for the idea).
This change is