Skip to content

Commit

Permalink
Fix tests - update logic
Browse files Browse the repository at this point in the history
  • Loading branch information
johnml1135 committed Oct 11, 2024
1 parent 0fe6b45 commit 6fc1257
Show file tree
Hide file tree
Showing 2 changed files with 130 additions and 44 deletions.
14 changes: 10 additions & 4 deletions src/Serval/src/Serval.Translation/Services/EngineService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -601,7 +601,7 @@ private V1.ParallelCorpus Map(Corpus source, TrainingCorpus? trainingCorpus, Pre
V1.MonolingualCorpus targetCorpus =
new() { Language = source.TargetLanguage, Files = { source.TargetFiles.Select(Map) } };

if (trainingCorpus == null)
if (trainingCorpus == null || (trainingCorpus.TextIds is null && trainingCorpus.ScriptureRange is null))
{
sourceCorpus.TrainOnAll = true;
targetCorpus.TrainOnAll = true;
Expand Down Expand Up @@ -641,7 +641,10 @@ private V1.ParallelCorpus Map(Corpus source, TrainingCorpus? trainingCorpus, Pre
targetCorpus.TrainOnChapters.Add(chapters);
}
}
if (pretranslateCorpus == null)
if (
pretranslateCorpus == null
|| (pretranslateCorpus.TextIds is null && pretranslateCorpus.ScriptureRange is null)
)
{
sourceCorpus.PretranslateAll = true;
targetCorpus.PretranslateAll = true;
Expand Down Expand Up @@ -777,7 +780,7 @@ pretranslateFilter is not null
Files = { source.Files.Select(Map) }
};

if (trainingFilter is null)
if (trainingFilter is null || (trainingFilter.TextIds is null && trainingFilter.ScriptureRange is null))
{
corpus.TrainOnAll = true;
}
Expand All @@ -789,7 +792,10 @@ pretranslateFilter is not null
corpus.TrainOnTextIds.Add(trainingFilter.TextIds);
}

if (pretranslateFilter is null)
if (
pretranslateFilter is null
|| (pretranslateFilter.TextIds is null && pretranslateFilter.ScriptureRange is null)
)
{
corpus.PretranslateAll = true;
}
Expand Down
Loading

0 comments on commit 6fc1257

Please sign in to comment.