Skip to content
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

Key terms support #229

Merged
merged 12 commits into from
Dec 6, 2023
6 changes: 4 additions & 2 deletions src/Serval.Client/Client.g.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1017,7 +1017,8 @@ public partial interface ITranslationEnginesClient
/// <br/>
/// <br/>The `"options"` parameter of the build config provides the ability to pass build configuration parameters as a JSON object.
/// <br/>A typical use case would be to set `"options"` to `{"max_steps":10}` in order to configure the maximum
/// <br/>number of training iterations in order to reduce turnaround time for testing purposes.
/// <br/>number of training iterations in order to reduce turnaround time for testing purposes. See [this](https://github.com/sillsdev/serval/wiki/Paratext-Key-Terms-Parsing)
/// <br/>for using `"options"` to include Paratext key terms data in training.
/// </remarks>
/// <param name="id">The translation engine id</param>
/// <param name="buildConfig">The build config (see remarks)</param>
Expand Down Expand Up @@ -2920,7 +2921,8 @@ public string BaseUrl
/// <br/>
/// <br/>The `"options"` parameter of the build config provides the ability to pass build configuration parameters as a JSON object.
/// <br/>A typical use case would be to set `"options"` to `{"max_steps":10}` in order to configure the maximum
/// <br/>number of training iterations in order to reduce turnaround time for testing purposes.
/// <br/>number of training iterations in order to reduce turnaround time for testing purposes. See [this](https://github.com/sillsdev/serval/wiki/Paratext-Key-Terms-Parsing)
/// <br/>for using `"options"` to include Paratext key terms data in training.
/// </remarks>
/// <param name="id">The translation engine id</param>
/// <param name="buildConfig">The build config (see remarks)</param>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -776,7 +776,8 @@ CancellationToken cancellationToken
///
/// The `"options"` parameter of the build config provides the ability to pass build configuration parameters as a JSON object.
/// A typical use case would be to set `"options"` to `{"max_steps":10}` in order to configure the maximum
/// number of training iterations in order to reduce turnaround time for testing purposes.
/// number of training iterations in order to reduce turnaround time for testing purposes. See [this](https://github.com/sillsdev/serval/wiki/Paratext-Key-Terms-Parsing)
/// for using `"options"` to include Paratext key terms data in training.
/// </remarks>
/// <param name="id">The translation engine id</param>
/// <param name="buildConfig">The build config (see remarks)</param>
Expand Down
25 changes: 14 additions & 11 deletions tests/Serval.E2ETests/ServalApiTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -356,34 +356,37 @@ async Task StartAndCancelTwice(string engineId)
public async Task ParatextProjectNmtJobAsync()
{
await _helperClient!.ClearEngines();
DataFile file = await _helperClient.dataFilesClient.CreateAsync(
DataFile file1 = await _helperClient.dataFilesClient.CreateAsync(
new FileParameter(data: File.OpenRead("../../../data/TestProject.zip")),
FileFormat.Paratext
);
string engineId = await _helperClient.CreateNewEngine("Nmt", "en", "es", "NMT4");
await _helperClient.AddTextCorpusToEngine(
engineId,
new string[] { "1JN.txt", "2JN.txt", "3JN.txt" },
"en",
"es",
false
DataFile file2 = await _helperClient.dataFilesClient.CreateAsync(
new FileParameter(data: File.OpenRead("../../../data/TestProjectTarget.zip")),
FileFormat.Paratext
);
string engineId = await _helperClient.CreateNewEngine("Nmt", "en", "sbp", "NMT4");

TranslationCorpus corpus = await _helperClient.translationEnginesClient.AddCorpusAsync(
engineId,
new TranslationCorpusConfig
{
SourceLanguage = "en",
TargetLanguage = "es",
TargetLanguage = "sbp",
SourceFiles = new TranslationCorpusFileConfig[]
{
new TranslationCorpusFileConfig { FileId = file.Id }
new TranslationCorpusFileConfig { FileId = file1.Id }
},
TargetFiles = new TranslationCorpusFileConfig[] { }
TargetFiles = new TranslationCorpusFileConfig[]
{
new TranslationCorpusFileConfig { FileId = file2.Id }
}
}
);
_helperClient.TranslationBuildConfig.Pretranslate!.Add(
new PretranslateCorpusConfig { CorpusId = corpus.Id, TextIds = new string[] { "JHN", "REV" } }
);
_helperClient.TranslationBuildConfig.Options = "{\"max_steps\":10, \"use_key_terms\":true}";

await _helperClient.BuildEngine(engineId);
Assert.That(
(await _helperClient.translationEnginesClient.GetAllBuildsAsync(engineId)).First().State
Expand Down
Binary file modified tests/Serval.E2ETests/data/TestProject.zip
Binary file not shown.
Binary file added tests/Serval.E2ETests/data/TestProjectTarget.zip
Binary file not shown.
Loading