Skip to content

Commit

Permalink
Be able to retrieve pretranslations from parallel corpora - update fi…
Browse files Browse the repository at this point in the history
…lter. Add E2E test. (#528)
  • Loading branch information
johnml1135 authored Oct 30, 2024
1 parent aa10f6f commit b64902b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -738,7 +738,7 @@ CancellationToken cancellationToken
{
Engine engine = await _engineService.GetAsync(id, cancellationToken);
await AuthorizeAsync(engine);
if (!engine.Corpora.Any(c => c.Id == corpusId))
if (!engine.Corpora.Any(c => c.Id == corpusId) && !engine.ParallelCorpora.Any(c => c.Id == corpusId))
return NotFound();
if (engine.ModelRevision == 0)
return Conflict();
Expand Down Expand Up @@ -800,7 +800,7 @@ CancellationToken cancellationToken
{
Engine engine = await _engineService.GetAsync(id, cancellationToken);
await AuthorizeAsync(engine);
if (!engine.Corpora.Any(c => c.Id == corpusId))
if (!engine.Corpora.Any(c => c.Id == corpusId) && !engine.ParallelCorpora.Any(c => c.Id == corpusId))
return NotFound();
if (engine.ModelRevision == 0)
return Conflict();
Expand Down Expand Up @@ -875,7 +875,7 @@ CancellationToken cancellationToken
{
Engine engine = await _engineService.GetAsync(id, cancellationToken);
await AuthorizeAsync(engine);
if (!engine.Corpora.Any(c => c.Id == corpusId))
if (!engine.Corpora.Any(c => c.Id == corpusId) && !engine.ParallelCorpora.Any(c => c.Id == corpusId))
return NotFound();
if (engine.ModelRevision == 0)
return Conflict();
Expand Down
4 changes: 2 additions & 2 deletions src/Serval/test/Serval.E2ETests/ServalApiTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -213,8 +213,8 @@ public async Task NmtLargeBatchAndDownload()
TranslationEngine engine = await _helperClient.TranslationEnginesClient.GetAsync(engineId);
Assert.That(engine.IsModelPersisted, Is.True);
string[] books = ["bible_LARGEFILE.txt"];
await _helperClient.AddTextCorpusToEngineAsync(engineId, books, "es", "en", false);
string cId = await _helperClient.AddTextCorpusToEngineAsync(engineId, ["3JN.txt"], "es", "en", true);
await _helperClient.AddParallelTextCorpusToEngineAsync(engineId, books, "es", "en", false);
string cId = await _helperClient.AddParallelTextCorpusToEngineAsync(engineId, ["3JN.txt"], "es", "en", true);
await _helperClient.BuildEngineAsync(engineId);
await Task.Delay(1000);
IList<Pretranslation> lTrans = await _helperClient.TranslationEnginesClient.GetAllPretranslationsAsync(
Expand Down

0 comments on commit b64902b

Please sign in to comment.