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

Use chapter-filtering for terms #545

Merged
merged 14 commits into from
Nov 27, 2024
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@
await env.RunBuildJobAsync(corpus1, useKeyTerms: true);

(int src1Count, int src2Count, int trgCount, int termCount) = await env.GetTrainCountAsync();
Assert.Multiple(() =>

Check failure on line 119 in src/Machine/test/Serval.Machine.Shared.Tests/Services/PreprocessBuildJobTests.cs

View workflow job for this annotation

GitHub Actions / NUnit Tests

Serval.Machine.Shared.Services.PreprocessBuildJobTests ► RunAsync_EnableKeyTerms

Failed test found in: src/Machine/test/Serval.Machine.Shared.Tests/TestResults/test-results.trx Error: Expected: 5726 But was: 0
Raw output
  Expected: 5726
  But was:  0

   at Serval.Machine.Shared.Services.PreprocessBuildJobTests.RunAsync_EnableKeyTerms() in /home/runner/work/serval/serval/src/Machine/test/Serval.Machine.Shared.Tests/Services/PreprocessBuildJobTests.cs:line 119
   at NUnit.Framework.Internal.TaskAwaitAdapter.GenericAdapter`1.BlockUntilCompleted()
   at NUnit.Framework.Internal.MessagePumpStrategy.NoMessagePumpStrategy.WaitForCompletion(AwaitAdapter awaiter)
   at NUnit.Framework.Internal.AsyncToSyncAdapter.Await(Func`1 invoke)
   at NUnit.Framework.Internal.Commands.TestMethodCommand.RunTestMethod(TestExecutionContext context)
   at NUnit.Framework.Internal.Commands.TestMethodCommand.Execute(TestExecutionContext context)
   at NUnit.Framework.Internal.Execution.SimpleWorkItem.<>c__DisplayClass4_0.<PerformWork>b__0()
   at NUnit.Framework.Internal.ContextUtils.<>c__DisplayClass1_0`1.<DoIsolated>b__0(Object _)

1)    at Serval.Machine.Shared.Services.PreprocessBuildJobTests.<>c__DisplayClass7_0.<RunAsync_EnableKeyTerms>b__0() in /home/runner/work/serval/serval/src/Machine/test/Serval.Machine.Shared.Tests/Services/PreprocessBuildJobTests.cs:line 124
   at NUnit.Framework.Assert.Multiple(TestDelegate testDelegate)
   at Serval.Machine.Shared.Services.PreprocessBuildJobTests.RunAsync_EnableKeyTerms() in /home/runner/work/serval/serval/src/Machine/test/Serval.Machine.Shared.Tests/Services/PreprocessBuildJobTests.cs:line 119

{
Assert.That(src1Count, Is.EqualTo(0));
Assert.That(src2Count, Is.EqualTo(0));
Expand Down Expand Up @@ -238,7 +238,7 @@
using TestEnvironment env = new();
ParallelCorpus corpus1 = TestEnvironment.TextFileCorpus(sourceLanguage: "xxx", targetLanguage: "zzz");

Assert.ThrowsAsync<InvalidOperationException>(async () =>

Check failure on line 241 in src/Machine/test/Serval.Machine.Shared.Tests/Services/PreprocessBuildJobTests.cs

View workflow job for this annotation

GitHub Actions / NUnit Tests

Serval.Machine.Shared.Services.PreprocessBuildJobTests ► RunAsync_UnknownLanguageTagsNoData

Failed test found in: src/Machine/test/Serval.Machine.Shared.Tests/TestResults/test-results.trx Error: Expected: <System.InvalidOperationException> But was: <System.ArgumentException: There must be at least one corpora. (Parameter 'corpora') at SIL.Machine.Corpora.NParallelTextCorpus..ctor(IEnumerable`1 corpora, IComparer`1 rowRefComparer) at SIL.Machine.Corpora.MergedTextCorpus..ctor(IEnumerable`1 corpora, MergeRule mergeRule, Nullable`1 seed) at SIL.Machine.Corpora.CorporaExtensions.ChooseRandom(IEnumerable`1 corpora, Nullable`1 seed) at SIL.ServiceToolkit.Services.ParallelCorpusPreprocessingService.Preprocess(IReadOnlyList`1 corpora, Action`1 train, Action`2 pretranslate, Boolean useKeyTerms) in /home/runner/work/serval/serval/src/ServiceToolkit/src/SIL.ServiceToolkit/Services/ParallelCorpusPreprocessingService.cs:line 93 at Serval.Machine.Shared.Services.PreprocessBuildJob.WriteDataFilesAsync(String buildId, IReadOnlyList`1 corpora, String buildOptions, CancellationToken cancellationToken) in /home/runner/work/serval/serval/src/Machine/src/Serval.Machine.Shared/Services/PreprocessBuildJob.cs:line 110 at Serval.Machine.Shared.Services.PreprocessBuildJob.WriteDataFilesAsync(String buildId, IReadOnlyList`1 corpora, String buildOptions, CancellationToken cancellationToken) in /home/runner/work/serval/serval/src/Machine/src/Serval.Machine.Shared/Services/PreprocessBuildJob.cs:line 143 at Serval.Machine.Shared.Services.PreprocessBuildJob.WriteDataFilesAsync(String buildId, IReadOnlyList`1 corpora, String buildOptions, CancellationToken cancellationToken) in /home/runner/work/serval/serval/src/Machine/src/Serval.Machine.Shared/Services/PreprocessBuildJob.cs:line 143 at Serval.Machine.Shared.Services.PreprocessBuildJob.WriteDataFilesAsync(String buildId, IReadOnlyList`1 corpora, String buildOptions, CancellationToken cancellationToken) in /home/runner/work/serval/serval/src/Machine/src/Serval.Machine.Shared/Services/PreprocessBuildJob.cs:line 143 at Serval.Machine.Shared.Services.PreprocessBuildJob.WriteDataFilesAsync(String buildId, IReadOnlyList`1 corpora, String buildOptions, CancellationToken cancellationToken) in /home/runner/work/serval/serval/src/Machine/src/Serval.Machine.Shared/Services/PreprocessBuildJob.cs:line 143 at Serval.Machine.Shared.Services.PreprocessBuildJob.DoWorkAsync(String engineId, String buildId, IReadOnlyList`1 data, String buildOptions, CancellationToken cancellationToken) in /home/runner/work/serval/serval/src/Machine/src/Serval.Machine.Shared/Services/PreprocessBuildJob.cs:line 44 at Serval.Machine.Shared.Services.HangfireBuildJob`1.RunAsync(String engineId, String buildId, T data, String buildOptions, CancellationToken cancellationToken) in /home/runner/work/serval/serval/src/Machine/src/Serval.Machine.Shared/Services/HangfireBuildJob.cs:line 54 at Serval.Machine.Shared.Services.HangfireBuildJob`1.RunAsync(String engineId, String buildId, T data, String buildOptions, CancellationToken cancellationToken) in /home/runner/work/serval/serval/src/Machine/src/Serval.Machine.Shared/Services/HangfireBuildJob.cs:line 118 at Serval.Machine.Shared.Services.HangfireBuildJob`1.RunAsync(String engineId, String buildId, T data, String buildOptions, CancellationToken cancellationToken) in /home/runner/work/serval/serval/src/Machine/src/Serval.Machine.Shared/Services/HangfireBuildJob.cs:line 123 at Serval.Machine.Shared.Services.PreprocessBuildJobTests.<>c__DisplayClass13_0.<<RunAsync_UnknownLanguageTagsNoData>b__0>d.MoveNext() in /home/runner/work/serval/serval/src/Machine/test/Serval.Machine.Shared.Tests/Services/PreprocessBuildJobTests.cs:line 243 --- End of stack trace from previous location --- at NUnit.Framework.Internal.TaskAwaitAdapter.GenericAdapter`1.BlockUntilCompleted() at NUnit.Framework.Internal.MessagePumpStrategy.NoMessagePumpStrategy.WaitForCompletion(AwaitAdapter awaiter) at NUnit.Framework.Internal.AsyncToSyncAdapter.Await(Func`1 invoke) at NUnit.Framework.Assert.ThrowsAsync(IResolveConstraint expression, AsyncTestDelegate code, String message, Object[] args)>
Raw output
  Expected: <System.InvalidOperationException>
  But was:  <System.ArgumentException: There must be at least one corpora. (Parameter 'corpora')
   at SIL.Machine.Corpora.NParallelTextCorpus..ctor(IEnumerable`1 corpora, IComparer`1 rowRefComparer)
   at SIL.Machine.Corpora.MergedTextCorpus..ctor(IEnumerable`1 corpora, MergeRule mergeRule, Nullable`1 seed)
   at SIL.Machine.Corpora.CorporaExtensions.ChooseRandom(IEnumerable`1 corpora, Nullable`1 seed)
   at SIL.ServiceToolkit.Services.ParallelCorpusPreprocessingService.Preprocess(IReadOnlyList`1 corpora, Action`1 train, Action`2 pretranslate, Boolean useKeyTerms) in /home/runner/work/serval/serval/src/ServiceToolkit/src/SIL.ServiceToolkit/Services/ParallelCorpusPreprocessingService.cs:line 93
   at Serval.Machine.Shared.Services.PreprocessBuildJob.WriteDataFilesAsync(String buildId, IReadOnlyList`1 corpora, String buildOptions, CancellationToken cancellationToken) in /home/runner/work/serval/serval/src/Machine/src/Serval.Machine.Shared/Services/PreprocessBuildJob.cs:line 110
   at Serval.Machine.Shared.Services.PreprocessBuildJob.WriteDataFilesAsync(String buildId, IReadOnlyList`1 corpora, String buildOptions, CancellationToken cancellationToken) in /home/runner/work/serval/serval/src/Machine/src/Serval.Machine.Shared/Services/PreprocessBuildJob.cs:line 143
   at Serval.Machine.Shared.Services.PreprocessBuildJob.WriteDataFilesAsync(String buildId, IReadOnlyList`1 corpora, String buildOptions, CancellationToken cancellationToken) in /home/runner/work/serval/serval/src/Machine/src/Serval.Machine.Shared/Services/PreprocessBuildJob.cs:line 143
   at Serval.Machine.Shared.Services.PreprocessBuildJob.WriteDataFilesAsync(String buildId, IReadOnlyList`1 corpora, String buildOptions, CancellationToken cancellationToken) in /home/runner/work/serval/serval/src/Machine/src/Serval.Machine.Shared/Services/PreprocessBuildJob.cs:line 143
   at Serval.Machine.Shared.Services.PreprocessBuildJob.WriteDataFilesAsync(String buildId, IReadOnlyList`1 corpora, String buildOptions, CancellationToken cancellationToken) in /home/runner/work/serval/serval/src/Machine/src/Serval.Machine.Shared/Services/PreprocessBuildJob.cs:line 143
   at Serval.Machine.Shared.Services.PreprocessBuildJob.DoWorkAsync(String engineId, String buildId, IReadOnlyList`1 data, String buildOptions, CancellationToken cancellationToken) in /home/runner/work/serval/serval/src/Machine/src/Serval.Machine.Shared/Services/PreprocessBuildJob.cs:line 44
   at Serval.Machine.Shared.Services.HangfireBuildJob`1.RunAsync(String engineId, String buildId, T data, String buildOptions, CancellationToken cancellationToken) in /home/runner/work/serval/serval/src/Machine/src/Serval.Machine.Shared/Services/HangfireBuildJob.cs:line 54
   at Serval.Machine.Shared.Services.HangfireBuildJob`1.RunAsync(String engineId, String buildId, T data, String buildOptions, CancellationToken cancellationToken) in /home/runner/work/serval/serval/src/Machine/src/Serval.Machine.Shared/Services/HangfireBuildJob.cs:line 118
   at Serval.Machine.Shared.Services.HangfireBuildJob`1.RunAsync(String engineId, String buildId, T data, String buildOptions, CancellationToken cancellationToken) in /home/runner/work/serval/serval/src/Machine/src/Serval.Machine.Shared/Services/HangfireBuildJob.cs:line 123
   at Serval.Machine.Shared.Services.PreprocessBuildJobTests.<>c__DisplayClass13_0.<<RunAsync_UnknownLanguageTagsNoData>b__0>d.MoveNext() in /home/runner/work/serval/serval/src/Machine/test/Serval.Machine.Shared.Tests/Services/PreprocessBuildJobTests.cs:line 243
--- End of stack trace from previous location ---
   at NUnit.Framework.Internal.TaskAwaitAdapter.GenericAdapter`1.BlockUntilCompleted()
   at NUnit.Framework.Internal.MessagePumpStrategy.NoMessagePumpStrategy.WaitForCompletion(AwaitAdapter awaiter)
   at NUnit.Framework.Internal.AsyncToSyncAdapter.Await(Func`1 invoke)
   at NUnit.Framework.Assert.ThrowsAsync(IResolveConstraint expression, AsyncTestDelegate code, String message, Object[] args)>

   at Serval.Machine.Shared.Services.PreprocessBuildJobTests.RunAsync_UnknownLanguageTagsNoData() in /home/runner/work/serval/serval/src/Machine/test/Serval.Machine.Shared.Tests/Services/PreprocessBuildJobTests.cs:line 241

1)    at Serval.Machine.Shared.Services.PreprocessBuildJobTests.RunAsync_UnknownLanguageTagsNoData() in /home/runner/work/serval/serval/src/Machine/test/Serval.Machine.Shared.Tests/Services/PreprocessBuildJobTests.cs:line 241

{
await env.RunBuildJobAsync(corpus1, engineId: "engine2");
});
Expand Down Expand Up @@ -308,7 +308,7 @@
new DummyCorpus(new List<string>() { "LEV", "MRK", "MAT" }, new List<string>() { "MAT" })
}
);
Assert.DoesNotThrowAsync(async () =>

Check failure on line 311 in src/Machine/test/Serval.Machine.Shared.Tests/Services/PreprocessBuildJobTests.cs

View workflow job for this annotation

GitHub Actions / NUnit Tests

Serval.Machine.Shared.Services.PreprocessBuildJobTests ► RunAsync_OnlyParseSelectedBooks_NoBadBooks

Failed test found in: src/Machine/test/Serval.Machine.Shared.Tests/TestResults/test-results.trx Error: Expected: No Exception to be thrown But was: <System.ArgumentException: There must be at least one corpora. (Parameter 'corpora') at SIL.Machine.Corpora.NParallelTextCorpus..ctor(IEnumerable`1 corpora, IComparer`1 rowRefComparer) at SIL.Machine.Corpora.MergedTextCorpus..ctor(IEnumerable`1 corpora, MergeRule mergeRule, Nullable`1 seed) at SIL.Machine.Corpora.CorporaExtensions.ChooseRandom(IEnumerable`1 corpora, Nullable`1 seed) at SIL.ServiceToolkit.Services.ParallelCorpusPreprocessingService.Preprocess(IReadOnlyList`1 corpora, Action`1 train, Action`2 pretranslate, Boolean useKeyTerms) in /home/runner/work/serval/serval/src/ServiceToolkit/src/SIL.ServiceToolkit/Services/ParallelCorpusPreprocessingService.cs:line 93 at Serval.Machine.Shared.Services.PreprocessBuildJob.WriteDataFilesAsync(String buildId, IReadOnlyList`1 corpora, String buildOptions, CancellationToken cancellationToken) in /home/runner/work/serval/serval/src/Machine/src/Serval.Machine.Shared/Services/PreprocessBuildJob.cs:line 110 at Serval.Machine.Shared.Services.PreprocessBuildJob.WriteDataFilesAsync(String buildId, IReadOnlyList`1 corpora, String buildOptions, CancellationToken cancellationToken) in /home/runner/work/serval/serval/src/Machine/src/Serval.Machine.Shared/Services/PreprocessBuildJob.cs:line 143 at Serval.Machine.Shared.Services.PreprocessBuildJob.WriteDataFilesAsync(String buildId, IReadOnlyList`1 corpora, String buildOptions, CancellationToken cancellationToken) in /home/runner/work/serval/serval/src/Machine/src/Serval.Machine.Shared/Services/PreprocessBuildJob.cs:line 143 at Serval.Machine.Shared.Services.PreprocessBuildJob.WriteDataFilesAsync(String buildId, IReadOnlyList`1 corpora, String buildOptions, CancellationToken cancellationToken) in /home/runner/work/serval/serval/src/Machine/src/Serval.Machine.Shared/Services/PreprocessBuildJob.cs:line 143 at Serval.Machine.Shared.Services.PreprocessBuildJob.WriteDataFilesAsync(String buildId, IReadOnlyList`1 corpora, String buildOptions, CancellationToken cancellationToken) in /home/runner/work/serval/serval/src/Machine/src/Serval.Machine.Shared/Services/PreprocessBuildJob.cs:line 143 at Serval.Machine.Shared.Services.PreprocessBuildJob.DoWorkAsync(String engineId, String buildId, IReadOnlyList`1 data, String buildOptions, CancellationToken cancellationToken) in /home/runner/work/serval/serval/src/Machine/src/Serval.Machine.Shared/Services/PreprocessBuildJob.cs:line 44 at Serval.Machine.Shared.Services.HangfireBuildJob`1.RunAsync(String engineId, String buildId, T data, String buildOptions, CancellationToken cancellationToken) in /home/runner/work/serval/serval/src/Machine/src/Serval.Machine.Shared/Services/HangfireBuildJob.cs:line 54 at Serval.Machine.Shared.Services.HangfireBuildJob`1.RunAsync(String engineId, String buildId, T data, String buildOptions, CancellationToken cancellationToken) in /home/runner/work/serval/serval/src/Machine/src/Serval.Machine.Shared/Services/HangfireBuildJob.cs:line 118 at Serval.Machine.Shared.Services.HangfireBuildJob`1.RunAsync(String engineId, String buildId, T data, String buildOptions, CancellationToken cancellationToken) in /home/runner/work/serval/serval/src/Machine/src/Serval.Machine.Shared/Services/HangfireBuildJob.cs:line 123 at Serval.Machine.Shared.Services.PreprocessBuildJobTests.<>c__DisplayClass16_0.<<RunAsync_OnlyParseSelectedBooks_NoBadBooks>b__0>d.MoveNext() in /home/runner/work/serval/serval/src/Machine/test/Serval.Machine.Shared.Tests/Services/PreprocessBuildJobTests.cs:line 313 --- End of stack trace from previous location --- at NUnit.Framework.Internal.TaskAwaitAdapter.GenericAdapter`1.BlockUntilCompleted() at NUnit.Framework.Internal.MessagePumpStrategy.NoMessagePumpStrategy.WaitForCompletion(AwaitAdapter awaiter) at NUnit.Framework.Internal.AsyncToSyncAdapter.Await(Func`1 invoke) at NUnit.Framework.Internal.ExceptionHelper.RecordException(Delegate parameterlessDelegate, String parameterName)>
Raw output
  Expected: No Exception to be thrown
  But was:  <System.ArgumentException: There must be at least one corpora. (Parameter 'corpora')
   at SIL.Machine.Corpora.NParallelTextCorpus..ctor(IEnumerable`1 corpora, IComparer`1 rowRefComparer)
   at SIL.Machine.Corpora.MergedTextCorpus..ctor(IEnumerable`1 corpora, MergeRule mergeRule, Nullable`1 seed)
   at SIL.Machine.Corpora.CorporaExtensions.ChooseRandom(IEnumerable`1 corpora, Nullable`1 seed)
   at SIL.ServiceToolkit.Services.ParallelCorpusPreprocessingService.Preprocess(IReadOnlyList`1 corpora, Action`1 train, Action`2 pretranslate, Boolean useKeyTerms) in /home/runner/work/serval/serval/src/ServiceToolkit/src/SIL.ServiceToolkit/Services/ParallelCorpusPreprocessingService.cs:line 93
   at Serval.Machine.Shared.Services.PreprocessBuildJob.WriteDataFilesAsync(String buildId, IReadOnlyList`1 corpora, String buildOptions, CancellationToken cancellationToken) in /home/runner/work/serval/serval/src/Machine/src/Serval.Machine.Shared/Services/PreprocessBuildJob.cs:line 110
   at Serval.Machine.Shared.Services.PreprocessBuildJob.WriteDataFilesAsync(String buildId, IReadOnlyList`1 corpora, String buildOptions, CancellationToken cancellationToken) in /home/runner/work/serval/serval/src/Machine/src/Serval.Machine.Shared/Services/PreprocessBuildJob.cs:line 143
   at Serval.Machine.Shared.Services.PreprocessBuildJob.WriteDataFilesAsync(String buildId, IReadOnlyList`1 corpora, String buildOptions, CancellationToken cancellationToken) in /home/runner/work/serval/serval/src/Machine/src/Serval.Machine.Shared/Services/PreprocessBuildJob.cs:line 143
   at Serval.Machine.Shared.Services.PreprocessBuildJob.WriteDataFilesAsync(String buildId, IReadOnlyList`1 corpora, String buildOptions, CancellationToken cancellationToken) in /home/runner/work/serval/serval/src/Machine/src/Serval.Machine.Shared/Services/PreprocessBuildJob.cs:line 143
   at Serval.Machine.Shared.Services.PreprocessBuildJob.WriteDataFilesAsync(String buildId, IReadOnlyList`1 corpora, String buildOptions, CancellationToken cancellationToken) in /home/runner/work/serval/serval/src/Machine/src/Serval.Machine.Shared/Services/PreprocessBuildJob.cs:line 143
   at Serval.Machine.Shared.Services.PreprocessBuildJob.DoWorkAsync(String engineId, String buildId, IReadOnlyList`1 data, String buildOptions, CancellationToken cancellationToken) in /home/runner/work/serval/serval/src/Machine/src/Serval.Machine.Shared/Services/PreprocessBuildJob.cs:line 44
   at Serval.Machine.Shared.Services.HangfireBuildJob`1.RunAsync(String engineId, String buildId, T data, String buildOptions, CancellationToken cancellationToken) in /home/runner/work/serval/serval/src/Machine/src/Serval.Machine.Shared/Services/HangfireBuildJob.cs:line 54
   at Serval.Machine.Shared.Services.HangfireBuildJob`1.RunAsync(String engineId, String buildId, T data, String buildOptions, CancellationToken cancellationToken) in /home/runner/work/serval/serval/src/Machine/src/Serval.Machine.Shared/Services/HangfireBuildJob.cs:line 118
   at Serval.Machine.Shared.Services.HangfireBuildJob`1.RunAsync(String engineId, String buildId, T data, String buildOptions, CancellationToken cancellationToken) in /home/runner/work/serval/serval/src/Machine/src/Serval.Machine.Shared/Services/HangfireBuildJob.cs:line 123
   at Serval.Machine.Shared.Services.PreprocessBuildJobTests.<>c__DisplayClass16_0.<<RunAsync_OnlyParseSelectedBooks_NoBadBooks>b__0>d.MoveNext() in /home/runner/work/serval/serval/src/Machine/test/Serval.Machine.Shared.Tests/Services/PreprocessBuildJobTests.cs:line 313
--- End of stack trace from previous location ---
   at NUnit.Framework.Internal.TaskAwaitAdapter.GenericAdapter`1.BlockUntilCompleted()
   at NUnit.Framework.Internal.MessagePumpStrategy.NoMessagePumpStrategy.WaitForCompletion(AwaitAdapter awaiter)
   at NUnit.Framework.Internal.AsyncToSyncAdapter.Await(Func`1 invoke)
   at NUnit.Framework.Internal.ExceptionHelper.RecordException(Delegate parameterlessDelegate, String parameterName)>

   at Serval.Machine.Shared.Services.PreprocessBuildJobTests.RunAsync_OnlyParseSelectedBooks_NoBadBooks() in /home/runner/work/serval/serval/src/Machine/test/Serval.Machine.Shared.Tests/Services/PreprocessBuildJobTests.cs:line 311

1)    at Serval.Machine.Shared.Services.PreprocessBuildJobTests.RunAsync_OnlyParseSelectedBooks_NoBadBooks() in /home/runner/work/serval/serval/src/Machine/test/Serval.Machine.Shared.Tests/Services/PreprocessBuildJobTests.cs:line 311

{
await env.RunBuildJobAsync(corpus);
});
Expand Down Expand Up @@ -359,7 +359,7 @@
}

[Test]
public async Task ParallelCorpusLogic()
public async Task ParallelCorpusAsync()
{
using TestEnvironment env = new();
var corpora = new List<ParallelCorpus>()
Expand Down Expand Up @@ -508,6 +508,246 @@
});
}

[Test]
public async Task ParallelCorpusAsync_UseKeyTerms()
{
using TestEnvironment env = new();
var corpora = new List<ParallelCorpus>()
{
new ParallelCorpus()
{
Id = "1",
SourceCorpora = new List<MonolingualCorpus>()
{
new()
{
Id = "_1",
Language = "en",
Files = new List<CorpusFile> { env.ParatextFile("pt-source1") },
TrainOnChapters = new()
{
{
"MAT",
new() { 1 }
},
{
"LEV",
new() { }
}
},
PretranslateChapters = new()
{
{
"1CH",
new() { }
}
}
},
new()
{
Id = "_1",
Language = "en",
Files = new List<CorpusFile> { env.ParatextFile("pt-source2") },
TrainOnChapters = new()
{
{
"MAT",
new() { 1 }
},
{
"MRK",
new() { }
}
},
PretranslateChapters = new() { }
},
},
TargetCorpora = new List<MonolingualCorpus>()
{
new()
{
Id = "_1",
Language = "en",
Files = new List<CorpusFile> { env.ParatextFile("pt-target1") },
TrainOnChapters = new()
{
{
"MAT",
new() { 1 }
},
{
"MRK",
new() { }
}
}
},
new()
{
Id = "_2",
Language = "en",
Files = new List<CorpusFile> { env.ParatextFile("pt-target2") },
TrainOnChapters = new()
{
{
"MAT",
new() { 1 }
},
{
"MRK",
new() { }
},
{
"LEV",
new() { }
}
}
}
}
}
};
await env.RunBuildJobAsync(corpora, useKeyTerms: true);
string source = await env.GetSourceExtractAsync();
string target = await env.GetTargetExtractAsync();
Assert.Multiple(() =>
{
StringAssert.StartsWith(
@"Source one, chapter fourteen, verse fifty-five. Segment b.
Source one, chapter fourteen, verse fifty-six.
Source two, chapter one, verse one.
Source two, chapter one, verse two.
Source two, chapter one, verse three.
Source one, chapter one, verse four.
Source two, chapter one, verse five. Source two, chapter one, verse six.
Source one, chapter one, verse seven, eight, and nine. Source one, chapter one, verse ten.
Source two, chapter one, verse one.
",
source
);
StringAssert.StartsWith(
@"Target two, chapter fourteen, verse fifty-five.
Target two, chapter fourteen, verse fifty-six.
Target one, chapter one, verse one.
Target one, chapter one, verse two.
Target one, chapter one, verse three.

Target one, chapter one, verse five and six.
Target one, chapter one, verse seven and eight. Target one, chapter one, verse nine and ten.

",
target
);
StringAssert.Contains("Abraham", source);
StringAssert.Contains("Abraham", target);
StringAssert.DoesNotContain("Zedekiah", source);
StringAssert.DoesNotContain("Zedekiah", target);
});
JsonArray? pretranslations = await env.GetPretranslationsAsync();
Assert.That(pretranslations, Is.Not.Null);
Assert.That(pretranslations!.Count, Is.EqualTo(7), pretranslations.ToJsonString());
Assert.That(
pretranslations[2]!["translation"]!.ToString(),
Is.EqualTo("Source one, chapter twelve, verse one.")
);
}

[Test]
public async Task ParallelCorpusAsync_UseKeyTerms_TextIds()
{
using TestEnvironment env = new();
var corpora = new List<ParallelCorpus>()
{
new ParallelCorpus()
{
Id = "1",
SourceCorpora = new List<MonolingualCorpus>()
{
new()
{
Id = "_1",
Language = "en",
Files = new List<CorpusFile> { env.ParatextFile("pt-source1") },
TrainOnTextIds = ["MAT", "LEV"],
PretranslateTextIds = ["1CH"]
},
new()
{
Id = "_1",
Language = "en",
Files = new List<CorpusFile> { env.ParatextFile("pt-source2") },
TrainOnTextIds = ["MAT", "MRK"],
PretranslateTextIds = []
},
},
TargetCorpora = new List<MonolingualCorpus>()
{
new()
{
Id = "_1",
Language = "en",
Files = new List<CorpusFile> { env.ParatextFile("pt-target1") },
TrainOnTextIds = ["MAT", "MRK"]
},
new()
{
Id = "_2",
Language = "en",
Files = new List<CorpusFile> { env.ParatextFile("pt-target2") },
TrainOnTextIds = ["MAT", "MRK", "LEV"]
}
}
}
};
await env.RunBuildJobAsync(corpora, useKeyTerms: true);
string source = await env.GetSourceExtractAsync();
string target = await env.GetTargetExtractAsync();
Assert.Multiple(() =>
{
StringAssert.StartsWith(
@"Source one, chapter fourteen, verse fifty-five. Segment b.
Source one, chapter fourteen, verse fifty-six.
Source two, chapter one, verse one.
Source two, chapter one, verse two.
Source two, chapter one, verse three.
Source one, chapter one, verse four.
Source two, chapter one, verse five. Source two, chapter one, verse six.
Source one, chapter one, verse seven, eight, and nine. Source one, chapter one, verse ten.
Source one, chapter two, verse one.
Source one, chapter two, verse two.

Source two, chapter one, verse one.
",
source
);
StringAssert.StartsWith(
@"Target two, chapter fourteen, verse fifty-five.
Target two, chapter fourteen, verse fifty-six.
Target one, chapter one, verse one.
Target one, chapter one, verse two.
Target one, chapter one, verse three.

Target one, chapter one, verse five and six.
Target one, chapter one, verse seven and eight. Target one, chapter one, verse nine and ten.
Target one, chapter two, verse one.

Target one, chapter two, verse three.

",
target
);
StringAssert.Contains("Abraham", source);
StringAssert.Contains("Abraham", target);
StringAssert.DoesNotContain("Zedekiah", source);
StringAssert.DoesNotContain("Zedekiah", target);
});
JsonArray? pretranslations = await env.GetPretranslationsAsync();
Assert.That(pretranslations, Is.Not.Null);
Assert.That(pretranslations!.Count, Is.EqualTo(7), pretranslations.ToJsonString());
Assert.That(
pretranslations[2]!["translation"]!.ToString(),
Is.EqualTo("Source one, chapter twelve, verse one.")
);
}

private class TestEnvironment : DisposableBase
{
private static readonly string TestDataPath = Path.Combine(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,11 @@
<Notes />
<Denials />
</TermRendering>
<TermRendering Id="צִדְקִיָּהוּ-2" Guess="false">
<Renderings>Zedekiah</Renderings>
<Glossary />
<Changes />
<Notes />
<Denials />
</TermRendering>
</TermRenderingsList>
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,11 @@
<Notes />
<Denials />
</TermRendering>
<TermRendering Id="צִדְקִיָּהוּ-2" Guess="false">
<Renderings>Zedekiah</Renderings>
<Glossary />
<Changes />
<Notes />
<Denials />
</TermRendering>
</TermRenderingsList>
Original file line number Diff line number Diff line change
Expand Up @@ -36,14 +36,16 @@ public IEnumerable<ITextCorpus> CreateTextCorpora(IReadOnlyList<CorpusFile> file
return corpora;
}

public IEnumerable<ITextCorpus> CreateTermCorpora(IReadOnlyList<CorpusFile> files)
public IEnumerable<ITextCorpus> CreateTermCorpora(
IReadOnlyList<(CorpusFile File, Dictionary<string, HashSet<int>> Chapters)> corpora
)
{
foreach (CorpusFile file in files)
foreach ((CorpusFile file, Dictionary<string, HashSet<int>> chapters) in corpora)
{
switch (file.Format)
{
case FileFormat.Paratext:
yield return new ParatextBackupTermsCorpus(file.Location, ["PN"]);
yield return new ParatextBackupTermsCorpus(file.Location, ["PN"], chapters: chapters);
break;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,7 @@
public interface ICorpusService
{
IEnumerable<ITextCorpus> CreateTextCorpora(IReadOnlyList<CorpusFile> files);
IEnumerable<ITextCorpus> CreateTermCorpora(IReadOnlyList<CorpusFile> files);
IEnumerable<ITextCorpus> CreateTermCorpora(
IReadOnlyList<(CorpusFile File, Dictionary<string, HashSet<int>> Chapters)> corpora
);
}
Original file line number Diff line number Diff line change
Expand Up @@ -82,15 +82,17 @@

if (useKeyTerms)
{
ITextCorpus? sourceTermCorpus = _corpusService
.CreateTermCorpora(corpus.SourceCorpora.SelectMany(sc => sc.Files).ToList())
.FirstOrDefault();
ITextCorpus? targetTermCorpus = _corpusService
.CreateTermCorpora(corpus.TargetCorpora.SelectMany(tc => tc.Files).ToList())
.FirstOrDefault();
if (sourceTermCorpus is not null && targetTermCorpus is not null)
ITextCorpus[]? sourceTermCorpora = _corpusService
.CreateTermCorpora(corpus.SourceCorpora.SelectMany(GetChaptersPerFile).ToArray())
.ToArray();
ITextCorpus[]? targetTermCorpora = _corpusService
.CreateTermCorpora(corpus.TargetCorpora.SelectMany(GetChaptersPerFile).ToArray())
.ToArray();
if (sourceTermCorpora is not null && targetTermCorpora is not null)
{
IParallelTextCorpus parallelKeyTermsCorpus = sourceTermCorpus.AlignRows(targetTermCorpus);
IParallelTextCorpus parallelKeyTermsCorpus = sourceTermCorpora

Check failure on line 93 in src/ServiceToolkit/src/SIL.ServiceToolkit/Services/ParallelCorpusPreprocessingService.cs

View workflow job for this annotation

GitHub Actions / NUnit Tests

Serval.Machine.Shared.Services.PreprocessBuildJobTests ► RunAsync_FilterOutEverything

Failed test found in: src/Machine/test/Serval.Machine.Shared.Tests/TestResults/test-results.trx Error: System.ArgumentException : There must be at least one corpora. (Parameter 'corpora')
Raw output
System.ArgumentException : There must be at least one corpora. (Parameter 'corpora')
   at SIL.Machine.Corpora.NParallelTextCorpus..ctor(IEnumerable`1 corpora, IComparer`1 rowRefComparer)
   at SIL.Machine.Corpora.MergedTextCorpus..ctor(IEnumerable`1 corpora, MergeRule mergeRule, Nullable`1 seed)
   at SIL.Machine.Corpora.CorporaExtensions.ChooseRandom(IEnumerable`1 corpora, Nullable`1 seed)
   at SIL.ServiceToolkit.Services.ParallelCorpusPreprocessingService.Preprocess(IReadOnlyList`1 corpora, Action`1 train, Action`2 pretranslate, Boolean useKeyTerms) in /home/runner/work/serval/serval/src/ServiceToolkit/src/SIL.ServiceToolkit/Services/ParallelCorpusPreprocessingService.cs:line 93
   at Serval.Machine.Shared.Services.PreprocessBuildJob.WriteDataFilesAsync(String buildId, IReadOnlyList`1 corpora, String buildOptions, CancellationToken cancellationToken) in /home/runner/work/serval/serval/src/Machine/src/Serval.Machine.Shared/Services/PreprocessBuildJob.cs:line 110
   at Serval.Machine.Shared.Services.PreprocessBuildJob.WriteDataFilesAsync(String buildId, IReadOnlyList`1 corpora, String buildOptions, CancellationToken cancellationToken) in /home/runner/work/serval/serval/src/Machine/src/Serval.Machine.Shared/Services/PreprocessBuildJob.cs:line 143
   at Serval.Machine.Shared.Services.PreprocessBuildJob.WriteDataFilesAsync(String buildId, IReadOnlyList`1 corpora, String buildOptions, CancellationToken cancellationToken) in /home/runner/work/serval/serval/src/Machine/src/Serval.Machine.Shared/Services/PreprocessBuildJob.cs:line 143
   at Serval.Machine.Shared.Services.PreprocessBuildJob.WriteDataFilesAsync(String buildId, IReadOnlyList`1 corpora, String buildOptions, CancellationToken cancellationToken) in /home/runner/work/serval/serval/src/Machine/src/Serval.Machine.Shared/Services/PreprocessBuildJob.cs:line 143
   at Serval.Machine.Shared.Services.PreprocessBuildJob.WriteDataFilesAsync(String buildId, IReadOnlyList`1 corpora, String buildOptions, CancellationToken cancellationToken) in /home/runner/work/serval/serval/src/Machine/src/Serval.Machine.Shared/Services/PreprocessBuildJob.cs:line 143
   at Serval.Machine.Shared.Services.PreprocessBuildJob.DoWorkAsync(String engineId, String buildId, IReadOnlyList`1 data, String buildOptions, CancellationToken cancellationToken) in /home/runner/work/serval/serval/src/Machine/src/Serval.Machine.Shared/Services/PreprocessBuildJob.cs:line 44
   at Serval.Machine.Shared.Services.HangfireBuildJob`1.RunAsync(String engineId, String buildId, T data, String buildOptions, CancellationToken cancellationToken) in /home/runner/work/serval/serval/src/Machine/src/Serval.Machine.Shared/Services/HangfireBuildJob.cs:line 54
   at Serval.Machine.Shared.Services.HangfireBuildJob`1.RunAsync(String engineId, String buildId, T data, String buildOptions, CancellationToken cancellationToken) in /home/runner/work/serval/serval/src/Machine/src/Serval.Machine.Shared/Services/HangfireBuildJob.cs:line 118
   at Serval.Machine.Shared.Services.HangfireBuildJob`1.RunAsync(String engineId, String buildId, T data, String buildOptions, CancellationToken cancellationToken) in /home/runner/work/serval/serval/src/Machine/src/Serval.Machine.Shared/Services/HangfireBuildJob.cs:line 123
   at Serval.Machine.Shared.Services.PreprocessBuildJobTests.RunAsync_FilterOutEverything() in /home/runner/work/serval/serval/src/Machine/test/Serval.Machine.Shared.Tests/Services/PreprocessBuildJobTests.cs:line 12
   at NUnit.Framework.Internal.TaskAwaitAdapter.GenericAdapter`1.BlockUntilCompleted()
   at NUnit.Framework.Internal.MessagePumpStrategy.NoMessagePumpStrategy.WaitForCompletion(AwaitAdapter awaiter)
   at NUnit.Framework.Internal.AsyncToSyncAdapter.Await(Func`1 invoke)
   at NUnit.Framework.Internal.Commands.TestMethodCommand.RunTestMethod(TestExecutionContext context)
   at NUnit.Framework.Internal.Commands.TestMethodCommand.Execute(TestExecutionContext context)
   at NUnit.Framework.Internal.Execution.SimpleWorkItem.<>c__DisplayClass4_0.<PerformWork>b__0()
   at NUnit.Framework.Internal.ContextUtils.<>c__DisplayClass1_0`1.<DoIsolated>b__0(Object _)
   at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
--- End of stack trace from previous location ---
   at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
   at NUnit.Framework.Internal.ContextUtils.DoIsolated(ContextCallback callback, Object state)
   at NUnit.Framework.Internal.ContextUtils.DoIsolated[T](Func`1 func)
   at NUnit.Framework.Internal.Execution.SimpleWorkItem.PerformWork()

Check failure on line 93 in src/ServiceToolkit/src/SIL.ServiceToolkit/Services/ParallelCorpusPreprocessingService.cs

View workflow job for this annotation

GitHub Actions / NUnit Tests

Serval.Machine.Shared.Services.PreprocessBuildJobTests ► RunAsync_MixedSource_Text

Failed test found in: src/Machine/test/Serval.Machine.Shared.Tests/TestResults/test-results.trx Error: System.ArgumentException : There must be at least one corpora. (Parameter 'corpora')
Raw output
System.ArgumentException : There must be at least one corpora. (Parameter 'corpora')
   at SIL.Machine.Corpora.NParallelTextCorpus..ctor(IEnumerable`1 corpora, IComparer`1 rowRefComparer)
   at SIL.Machine.Corpora.MergedTextCorpus..ctor(IEnumerable`1 corpora, MergeRule mergeRule, Nullable`1 seed)
   at SIL.Machine.Corpora.CorporaExtensions.ChooseRandom(IEnumerable`1 corpora, Nullable`1 seed)
   at SIL.ServiceToolkit.Services.ParallelCorpusPreprocessingService.Preprocess(IReadOnlyList`1 corpora, Action`1 train, Action`2 pretranslate, Boolean useKeyTerms) in /home/runner/work/serval/serval/src/ServiceToolkit/src/SIL.ServiceToolkit/Services/ParallelCorpusPreprocessingService.cs:line 93
   at Serval.Machine.Shared.Services.PreprocessBuildJob.WriteDataFilesAsync(String buildId, IReadOnlyList`1 corpora, String buildOptions, CancellationToken cancellationToken) in /home/runner/work/serval/serval/src/Machine/src/Serval.Machine.Shared/Services/PreprocessBuildJob.cs:line 110
   at Serval.Machine.Shared.Services.PreprocessBuildJob.WriteDataFilesAsync(String buildId, IReadOnlyList`1 corpora, String buildOptions, CancellationToken cancellationToken) in /home/runner/work/serval/serval/src/Machine/src/Serval.Machine.Shared/Services/PreprocessBuildJob.cs:line 143
   at Serval.Machine.Shared.Services.PreprocessBuildJob.WriteDataFilesAsync(String buildId, IReadOnlyList`1 corpora, String buildOptions, CancellationToken cancellationToken) in /home/runner/work/serval/serval/src/Machine/src/Serval.Machine.Shared/Services/PreprocessBuildJob.cs:line 143
   at Serval.Machine.Shared.Services.PreprocessBuildJob.WriteDataFilesAsync(String buildId, IReadOnlyList`1 corpora, String buildOptions, CancellationToken cancellationToken) in /home/runner/work/serval/serval/src/Machine/src/Serval.Machine.Shared/Services/PreprocessBuildJob.cs:line 143
   at Serval.Machine.Shared.Services.PreprocessBuildJob.WriteDataFilesAsync(String buildId, IReadOnlyList`1 corpora, String buildOptions, CancellationToken cancellationToken) in /home/runner/work/serval/serval/src/Machine/src/Serval.Machine.Shared/Services/PreprocessBuildJob.cs:line 143
   at Serval.Machine.Shared.Services.PreprocessBuildJob.DoWorkAsync(String engineId, String buildId, IReadOnlyList`1 data, String buildOptions, CancellationToken cancellationToken) in /home/runner/work/serval/serval/src/Machine/src/Serval.Machine.Shared/Services/PreprocessBuildJob.cs:line 44
   at Serval.Machine.Shared.Services.HangfireBuildJob`1.RunAsync(String engineId, String buildId, T data, String buildOptions, CancellationToken cancellationToken) in /home/runner/work/serval/serval/src/Machine/src/Serval.Machine.Shared/Services/HangfireBuildJob.cs:line 54
   at Serval.Machine.Shared.Services.HangfireBuildJob`1.RunAsync(String engineId, String buildId, T data, String buildOptions, CancellationToken cancellationToken) in /home/runner/work/serval/serval/src/Machine/src/Serval.Machine.Shared/Services/HangfireBuildJob.cs:line 118
   at Serval.Machine.Shared.Services.HangfireBuildJob`1.RunAsync(String engineId, String buildId, T data, String buildOptions, CancellationToken cancellationToken) in /home/runner/work/serval/serval/src/Machine/src/Serval.Machine.Shared/Services/HangfireBuildJob.cs:line 123
   at Serval.Machine.Shared.Services.PreprocessBuildJobTests.RunAsync_MixedSource_Text() in /home/runner/work/serval/serval/src/Machine/test/Serval.Machine.Shared.Tests/Services/PreprocessBuildJobTests.cs:line 222
   at NUnit.Framework.Internal.TaskAwaitAdapter.GenericAdapter`1.BlockUntilCompleted()
   at NUnit.Framework.Internal.MessagePumpStrategy.NoMessagePumpStrategy.WaitForCompletion(AwaitAdapter awaiter)
   at NUnit.Framework.Internal.AsyncToSyncAdapter.Await(Func`1 invoke)
   at NUnit.Framework.Internal.Commands.TestMethodCommand.RunTestMethod(TestExecutionContext context)
   at NUnit.Framework.Internal.Commands.TestMethodCommand.Execute(TestExecutionContext context)
   at NUnit.Framework.Internal.Execution.SimpleWorkItem.<>c__DisplayClass4_0.<PerformWork>b__0()
   at NUnit.Framework.Internal.ContextUtils.<>c__DisplayClass1_0`1.<DoIsolated>b__0(Object _)
   at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
--- End of stack trace from previous location ---
   at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
   at NUnit.Framework.Internal.ContextUtils.DoIsolated(ContextCallback callback, Object state)
   at NUnit.Framework.Internal.ContextUtils.DoIsolated[T](Func`1 func)
   at NUnit.Framework.Internal.Execution.SimpleWorkItem.PerformWork()

Check failure on line 93 in src/ServiceToolkit/src/SIL.ServiceToolkit/Services/ParallelCorpusPreprocessingService.cs

View workflow job for this annotation

GitHub Actions / NUnit Tests

Serval.Machine.Shared.Services.PreprocessBuildJobTests ► RunAsync_PretranslateAll

Failed test found in: src/Machine/test/Serval.Machine.Shared.Tests/TestResults/test-results.trx Error: System.ArgumentException : There must be at least one corpora. (Parameter 'corpora')
Raw output
System.ArgumentException : There must be at least one corpora. (Parameter 'corpora')
   at SIL.Machine.Corpora.NParallelTextCorpus..ctor(IEnumerable`1 corpora, IComparer`1 rowRefComparer)
   at SIL.Machine.Corpora.MergedTextCorpus..ctor(IEnumerable`1 corpora, MergeRule mergeRule, Nullable`1 seed)
   at SIL.Machine.Corpora.CorporaExtensions.ChooseRandom(IEnumerable`1 corpora, Nullable`1 seed)
   at SIL.ServiceToolkit.Services.ParallelCorpusPreprocessingService.Preprocess(IReadOnlyList`1 corpora, Action`1 train, Action`2 pretranslate, Boolean useKeyTerms) in /home/runner/work/serval/serval/src/ServiceToolkit/src/SIL.ServiceToolkit/Services/ParallelCorpusPreprocessingService.cs:line 93
   at Serval.Machine.Shared.Services.PreprocessBuildJob.WriteDataFilesAsync(String buildId, IReadOnlyList`1 corpora, String buildOptions, CancellationToken cancellationToken) in /home/runner/work/serval/serval/src/Machine/src/Serval.Machine.Shared/Services/PreprocessBuildJob.cs:line 110
   at Serval.Machine.Shared.Services.PreprocessBuildJob.WriteDataFilesAsync(String buildId, IReadOnlyList`1 corpora, String buildOptions, CancellationToken cancellationToken) in /home/runner/work/serval/serval/src/Machine/src/Serval.Machine.Shared/Services/PreprocessBuildJob.cs:line 143
   at Serval.Machine.Shared.Services.PreprocessBuildJob.WriteDataFilesAsync(String buildId, IReadOnlyList`1 corpora, String buildOptions, CancellationToken cancellationToken) in /home/runner/work/serval/serval/src/Machine/src/Serval.Machine.Shared/Services/PreprocessBuildJob.cs:line 143
   at Serval.Machine.Shared.Services.PreprocessBuildJob.WriteDataFilesAsync(String buildId, IReadOnlyList`1 corpora, String buildOptions, CancellationToken cancellationToken) in /home/runner/work/serval/serval/src/Machine/src/Serval.Machine.Shared/Services/PreprocessBuildJob.cs:line 143
   at Serval.Machine.Shared.Services.PreprocessBuildJob.WriteDataFilesAsync(String buildId, IReadOnlyList`1 corpora, String buildOptions, CancellationToken cancellationToken) in /home/runner/work/serval/serval/src/Machine/src/Serval.Machine.Shared/Services/PreprocessBuildJob.cs:line 143
   at Serval.Machine.Shared.Services.PreprocessBuildJob.DoWorkAsync(String engineId, String buildId, IReadOnlyList`1 data, String buildOptions, CancellationToken cancellationToken) in /home/runner/work/serval/serval/src/Machine/src/Serval.Machine.Shared/Services/PreprocessBuildJob.cs:line 44
   at Serval.Machine.Shared.Services.HangfireBuildJob`1.RunAsync(String engineId, String buildId, T data, String buildOptions, CancellationToken cancellationToken) in /home/runner/work/serval/serval/src/Machine/src/Serval.Machine.Shared/Services/HangfireBuildJob.cs:line 54
   at Serval.Machine.Shared.Services.HangfireBuildJob`1.RunAsync(String engineId, String buildId, T data, String buildOptions, CancellationToken cancellationToken) in /home/runner/work/serval/serval/src/Machine/src/Serval.Machine.Shared/Services/HangfireBuildJob.cs:line 118
   at Serval.Machine.Shared.Services.HangfireBuildJob`1.RunAsync(String engineId, String buildId, T data, String buildOptions, CancellationToken cancellationToken) in /home/runner/work/serval/serval/src/Machine/src/Serval.Machine.Shared/Services/HangfireBuildJob.cs:line 123
   at Serval.Machine.Shared.Services.PreprocessBuildJobTests.RunAsync_PretranslateAll() in /home/runner/work/serval/serval/src/Machine/test/Serval.Machine.Shared.Tests/Services/PreprocessBuildJobTests.cs:line 77
   at NUnit.Framework.Internal.TaskAwaitAdapter.GenericAdapter`1.BlockUntilCompleted()
   at NUnit.Framework.Internal.MessagePumpStrategy.NoMessagePumpStrategy.WaitForCompletion(AwaitAdapter awaiter)
   at NUnit.Framework.Internal.AsyncToSyncAdapter.Await(Func`1 invoke)
   at NUnit.Framework.Internal.Commands.TestMethodCommand.RunTestMethod(TestExecutionContext context)
   at NUnit.Framework.Internal.Commands.TestMethodCommand.Execute(TestExecutionContext context)
   at NUnit.Framework.Internal.Execution.SimpleWorkItem.<>c__DisplayClass4_0.<PerformWork>b__0()
   at NUnit.Framework.Internal.ContextUtils.<>c__DisplayClass1_0`1.<DoIsolated>b__0(Object _)
   at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
--- End of stack trace from previous location ---
   at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
   at NUnit.Framework.Internal.ContextUtils.DoIsolated(ContextCallback callback, Object state)
   at NUnit.Framework.Internal.ContextUtils.DoIsolated[T](Func`1 func)
   at NUnit.Framework.Internal.Execution.SimpleWorkItem.PerformWork()

Check failure on line 93 in src/ServiceToolkit/src/SIL.ServiceToolkit/Services/ParallelCorpusPreprocessingService.cs

View workflow job for this annotation

GitHub Actions / NUnit Tests

Serval.Machine.Shared.Services.PreprocessBuildJobTests ► RunAsync_PretranslateTextIds

Failed test found in: src/Machine/test/Serval.Machine.Shared.Tests/TestResults/test-results.trx Error: System.ArgumentException : There must be at least one corpora. (Parameter 'corpora')
Raw output
System.ArgumentException : There must be at least one corpora. (Parameter 'corpora')
   at SIL.Machine.Corpora.NParallelTextCorpus..ctor(IEnumerable`1 corpora, IComparer`1 rowRefComparer)
   at SIL.Machine.Corpora.MergedTextCorpus..ctor(IEnumerable`1 corpora, MergeRule mergeRule, Nullable`1 seed)
   at SIL.Machine.Corpora.CorporaExtensions.ChooseRandom(IEnumerable`1 corpora, Nullable`1 seed)
   at SIL.ServiceToolkit.Services.ParallelCorpusPreprocessingService.Preprocess(IReadOnlyList`1 corpora, Action`1 train, Action`2 pretranslate, Boolean useKeyTerms) in /home/runner/work/serval/serval/src/ServiceToolkit/src/SIL.ServiceToolkit/Services/ParallelCorpusPreprocessingService.cs:line 93
   at Serval.Machine.Shared.Services.PreprocessBuildJob.WriteDataFilesAsync(String buildId, IReadOnlyList`1 corpora, String buildOptions, CancellationToken cancellationToken) in /home/runner/work/serval/serval/src/Machine/src/Serval.Machine.Shared/Services/PreprocessBuildJob.cs:line 110
   at Serval.Machine.Shared.Services.PreprocessBuildJob.WriteDataFilesAsync(String buildId, IReadOnlyList`1 corpora, String buildOptions, CancellationToken cancellationToken) in /home/runner/work/serval/serval/src/Machine/src/Serval.Machine.Shared/Services/PreprocessBuildJob.cs:line 143
   at Serval.Machine.Shared.Services.PreprocessBuildJob.WriteDataFilesAsync(String buildId, IReadOnlyList`1 corpora, String buildOptions, CancellationToken cancellationToken) in /home/runner/work/serval/serval/src/Machine/src/Serval.Machine.Shared/Services/PreprocessBuildJob.cs:line 143
   at Serval.Machine.Shared.Services.PreprocessBuildJob.WriteDataFilesAsync(String buildId, IReadOnlyList`1 corpora, String buildOptions, CancellationToken cancellationToken) in /home/runner/work/serval/serval/src/Machine/src/Serval.Machine.Shared/Services/PreprocessBuildJob.cs:line 143
   at Serval.Machine.Shared.Services.PreprocessBuildJob.WriteDataFilesAsync(String buildId, IReadOnlyList`1 corpora, String buildOptions, CancellationToken cancellationToken) in /home/runner/work/serval/serval/src/Machine/src/Serval.Machine.Shared/Services/PreprocessBuildJob.cs:line 143
   at Serval.Machine.Shared.Services.PreprocessBuildJob.DoWorkAsync(String engineId, String buildId, IReadOnlyList`1 data, String buildOptions, CancellationToken cancellationToken) in /home/runner/work/serval/serval/src/Machine/src/Serval.Machine.Shared/Services/PreprocessBuildJob.cs:line 44
   at Serval.Machine.Shared.Services.HangfireBuildJob`1.RunAsync(String engineId, String buildId, T data, String buildOptions, CancellationToken cancellationToken) in /home/runner/work/serval/serval/src/Machine/src/Serval.Machine.Shared/Services/HangfireBuildJob.cs:line 54
   at Serval.Machine.Shared.Services.HangfireBuildJob`1.RunAsync(String engineId, String buildId, T data, String buildOptions, CancellationToken cancellationToken) in /home/runner/work/serval/serval/src/Machine/src/Serval.Machine.Shared/Services/HangfireBuildJob.cs:line 118
   at Serval.Machine.Shared.Services.HangfireBuildJob`1.RunAsync(String engineId, String buildId, T data, String buildOptions, CancellationToken cancellationToken) in /home/runner/work/serval/serval/src/Machine/src/Serval.Machine.Shared/Services/HangfireBuildJob.cs:line 123
   at Serval.Machine.Shared.Services.PreprocessBuildJobTests.RunAsync_PretranslateTextIds() in /home/runner/work/serval/serval/src/Machine/test/Serval.Machine.Shared.Tests/Services/PreprocessBuildJobTests.cs:line 88
   at NUnit.Framework.Internal.TaskAwaitAdapter.GenericAdapter`1.BlockUntilCompleted()
   at NUnit.Framework.Internal.MessagePumpStrategy.NoMessagePumpStrategy.WaitForCompletion(AwaitAdapter awaiter)
   at NUnit.Framework.Internal.AsyncToSyncAdapter.Await(Func`1 invoke)
   at NUnit.Framework.Internal.Commands.TestMethodCommand.RunTestMethod(TestExecutionContext context)
   at NUnit.Framework.Internal.Commands.TestMethodCommand.Execute(TestExecutionContext context)
   at NUnit.Framework.Internal.Execution.SimpleWorkItem.<>c__DisplayClass4_0.<PerformWork>b__0()
   at NUnit.Framework.Internal.ContextUtils.<>c__DisplayClass1_0`1.<DoIsolated>b__0(Object _)
   at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
--- End of stack trace from previous location ---
   at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
   at NUnit.Framework.Internal.ContextUtils.DoIsolated(ContextCallback callback, Object state)
   at NUnit.Framework.Internal.ContextUtils.DoIsolated[T](Func`1 func)
   at NUnit.Framework.Internal.Execution.SimpleWorkItem.PerformWork()

Check failure on line 93 in src/ServiceToolkit/src/SIL.ServiceToolkit/Services/ParallelCorpusPreprocessingService.cs

View workflow job for this annotation

GitHub Actions / NUnit Tests

Serval.Machine.Shared.Services.PreprocessBuildJobTests ► RunAsync_PretranslateTextIdsOverlapWithTrainOnTextIds

Failed test found in: src/Machine/test/Serval.Machine.Shared.Tests/TestResults/test-results.trx Error: System.ArgumentException : There must be at least one corpora. (Parameter 'corpora')
Raw output
System.ArgumentException : There must be at least one corpora. (Parameter 'corpora')
   at SIL.Machine.Corpora.NParallelTextCorpus..ctor(IEnumerable`1 corpora, IComparer`1 rowRefComparer)
   at SIL.Machine.Corpora.MergedTextCorpus..ctor(IEnumerable`1 corpora, MergeRule mergeRule, Nullable`1 seed)
   at SIL.Machine.Corpora.CorporaExtensions.ChooseRandom(IEnumerable`1 corpora, Nullable`1 seed)
   at SIL.ServiceToolkit.Services.ParallelCorpusPreprocessingService.Preprocess(IReadOnlyList`1 corpora, Action`1 train, Action`2 pretranslate, Boolean useKeyTerms) in /home/runner/work/serval/serval/src/ServiceToolkit/src/SIL.ServiceToolkit/Services/ParallelCorpusPreprocessingService.cs:line 93
   at Serval.Machine.Shared.Services.PreprocessBuildJob.WriteDataFilesAsync(String buildId, IReadOnlyList`1 corpora, String buildOptions, CancellationToken cancellationToken) in /home/runner/work/serval/serval/src/Machine/src/Serval.Machine.Shared/Services/PreprocessBuildJob.cs:line 110
   at Serval.Machine.Shared.Services.PreprocessBuildJob.WriteDataFilesAsync(String buildId, IReadOnlyList`1 corpora, String buildOptions, CancellationToken cancellationToken) in /home/runner/work/serval/serval/src/Machine/src/Serval.Machine.Shared/Services/PreprocessBuildJob.cs:line 143
   at Serval.Machine.Shared.Services.PreprocessBuildJob.WriteDataFilesAsync(String buildId, IReadOnlyList`1 corpora, String buildOptions, CancellationToken cancellationToken) in /home/runner/work/serval/serval/src/Machine/src/Serval.Machine.Shared/Services/PreprocessBuildJob.cs:line 143
   at Serval.Machine.Shared.Services.PreprocessBuildJob.WriteDataFilesAsync(String buildId, IReadOnlyList`1 corpora, String buildOptions, CancellationToken cancellationToken) in /home/runner/work/serval/serval/src/Machine/src/Serval.Machine.Shared/Services/PreprocessBuildJob.cs:line 143
   at Serval.Machine.Shared.Services.PreprocessBuildJob.WriteDataFilesAsync(String buildId, IReadOnlyList`1 corpora, String buildOptions, CancellationToken cancellationToken) in /home/runner/work/serval/serval/src/Machine/src/Serval.Machine.Shared/Services/PreprocessBuildJob.cs:line 143
   at Serval.Machine.Shared.Services.PreprocessBuildJob.DoWorkAsync(String engineId, String buildId, IReadOnlyList`1 data, String buildOptions, CancellationToken cancellationToken) in /home/runner/work/serval/serval/src/Machine/src/Serval.Machine.Shared/Services/PreprocessBuildJob.cs:line 44
   at Serval.Machine.Shared.Services.HangfireBuildJob`1.RunAsync(String engineId, String buildId, T data, String buildOptions, CancellationToken cancellationToken) in /home/runner/work/serval/serval/src/Machine/src/Serval.Machine.Shared/Services/HangfireBuildJob.cs:line 54
   at Serval.Machine.Shared.Services.HangfireBuildJob`1.RunAsync(String engineId, String buildId, T data, String buildOptions, CancellationToken cancellationToken) in /home/runner/work/serval/serval/src/Machine/src/Serval.Machine.Shared/Services/HangfireBuildJob.cs:line 118
   at Serval.Machine.Shared.Services.HangfireBuildJob`1.RunAsync(String engineId, String buildId, T data, String buildOptions, CancellationToken cancellationToken) in /home/runner/work/serval/serval/src/Machine/src/Serval.Machine.Shared/Services/HangfireBuildJob.cs:line 123
   at Serval.Machine.Shared.Services.PreprocessBuildJobTests.RunAsync_PretranslateTextIdsOverlapWithTrainOnTextIds() in /home/runner/work/serval/serval/src/Machine/test/Serval.Machine.Shared.Tests/Services/PreprocessBuildJobTests.cs:line 102
   at NUnit.Framework.Internal.TaskAwaitAdapter.GenericAdapter`1.BlockUntilCompleted()
   at NUnit.Framework.Internal.MessagePumpStrategy.NoMessagePumpStrategy.WaitForCompletion(AwaitAdapter awaiter)
   at NUnit.Framework.Internal.AsyncToSyncAdapter.Await(Func`1 invoke)
   at NUnit.Framework.Internal.Commands.TestMethodCommand.RunTestMethod(TestExecutionContext context)
   at NUnit.Framework.Internal.Commands.TestMethodCommand.Execute(TestExecutionContext context)
   at NUnit.Framework.Internal.Execution.SimpleWorkItem.<>c__DisplayClass4_0.<PerformWork>b__0()
   at NUnit.Framework.Internal.ContextUtils.<>c__DisplayClass1_0`1.<DoIsolated>b__0(Object _)
   at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
--- End of stack trace from previous location ---
   at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
   at NUnit.Framework.Internal.ContextUtils.DoIsolated(ContextCallback callback, Object state)
   at NUnit.Framework.Internal.ContextUtils.DoIsolated[T](Func`1 func)
   at NUnit.Framework.Internal.Execution.SimpleWorkItem.PerformWork()

Check failure on line 93 in src/ServiceToolkit/src/SIL.ServiceToolkit/Services/ParallelCorpusPreprocessingService.cs

View workflow job for this annotation

GitHub Actions / NUnit Tests

Serval.Machine.Shared.Services.PreprocessBuildJobTests ► RunAsync_TrainAndPretranslateAll

Failed test found in: src/Machine/test/Serval.Machine.Shared.Tests/TestResults/test-results.trx Error: System.ArgumentException : There must be at least one corpora. (Parameter 'corpora')
Raw output
System.ArgumentException : There must be at least one corpora. (Parameter 'corpora')
   at SIL.Machine.Corpora.NParallelTextCorpus..ctor(IEnumerable`1 corpora, IComparer`1 rowRefComparer)
   at SIL.Machine.Corpora.MergedTextCorpus..ctor(IEnumerable`1 corpora, MergeRule mergeRule, Nullable`1 seed)
   at SIL.Machine.Corpora.CorporaExtensions.ChooseRandom(IEnumerable`1 corpora, Nullable`1 seed)
   at SIL.ServiceToolkit.Services.ParallelCorpusPreprocessingService.Preprocess(IReadOnlyList`1 corpora, Action`1 train, Action`2 pretranslate, Boolean useKeyTerms) in /home/runner/work/serval/serval/src/ServiceToolkit/src/SIL.ServiceToolkit/Services/ParallelCorpusPreprocessingService.cs:line 93
   at Serval.Machine.Shared.Services.PreprocessBuildJob.WriteDataFilesAsync(String buildId, IReadOnlyList`1 corpora, String buildOptions, CancellationToken cancellationToken) in /home/runner/work/serval/serval/src/Machine/src/Serval.Machine.Shared/Services/PreprocessBuildJob.cs:line 110
   at Serval.Machine.Shared.Services.PreprocessBuildJob.WriteDataFilesAsync(String buildId, IReadOnlyList`1 corpora, String buildOptions, CancellationToken cancellationToken) in /home/runner/work/serval/serval/src/Machine/src/Serval.Machine.Shared/Services/PreprocessBuildJob.cs:line 143
   at Serval.Machine.Shared.Services.PreprocessBuildJob.WriteDataFilesAsync(String buildId, IReadOnlyList`1 corpora, String buildOptions, CancellationToken cancellationToken) in /home/runner/work/serval/serval/src/Machine/src/Serval.Machine.Shared/Services/PreprocessBuildJob.cs:line 143
   at Serval.Machine.Shared.Services.PreprocessBuildJob.WriteDataFilesAsync(String buildId, IReadOnlyList`1 corpora, String buildOptions, CancellationToken cancellationToken) in /home/runner/work/serval/serval/src/Machine/src/Serval.Machine.Shared/Services/PreprocessBuildJob.cs:line 143
   at Serval.Machine.Shared.Services.PreprocessBuildJob.WriteDataFilesAsync(String buildId, IReadOnlyList`1 corpora, String buildOptions, CancellationToken cancellationToken) in /home/runner/work/serval/serval/src/Machine/src/Serval.Machine.Shared/Services/PreprocessBuildJob.cs:line 143
   at Serval.Machine.Shared.Services.PreprocessBuildJob.DoWorkAsync(String engineId, String buildId, IReadOnlyList`1 data, String buildOptions, CancellationToken cancellationToken) in /home/runner/work/serval/serval/src/Machine/src/Serval.Machine.Shared/Services/PreprocessBuildJob.cs:line 44
   at Serval.Machine.Shared.Services.HangfireBuildJob`1.RunAsync(String engineId, String buildId, T data, String buildOptions, CancellationToken cancellationToken) in /home/runner/work/serval/serval/src/Machine/src/Serval.Machine.Shared/Services/HangfireBuildJob.cs:line 54
   at Serval.Machine.Shared.Services.HangfireBuildJob`1.RunAsync(String engineId, String buildId, T data, String buildOptions, CancellationToken cancellationToken) in /home/runner/work/serval/serval/src/Machine/src/Serval.Machine.Shared/Services/HangfireBuildJob.cs:line 118
   at Serval.Machine.Shared.Services.HangfireBuildJob`1.RunAsync(String engineId, String buildId, T data, String buildOptions, CancellationToken cancellationToken) in /home/runner/work/serval/serval/src/Machine/src/Serval.Machine.Shared/Services/HangfireBuildJob.cs:line 123
   at Serval.Machine.Shared.Services.PreprocessBuildJobTests.RunAsync_TrainAndPretranslateAll() in /home/runner/work/serval/serval/src/Machine/test/Serval.Machine.Shared.Tests/Services/PreprocessBuildJobTests.cs:line 66
   at NUnit.Framework.Internal.TaskAwaitAdapter.GenericAdapter`1.BlockUntilCompleted()
   at NUnit.Framework.Internal.MessagePumpStrategy.NoMessagePumpStrategy.WaitForCompletion(AwaitAdapter awaiter)
   at NUnit.Framework.Internal.AsyncToSyncAdapter.Await(Func`1 invoke)
   at NUnit.Framework.Internal.Commands.TestMethodCommand.RunTestMethod(TestExecutionContext context)
   at NUnit.Framework.Internal.Commands.TestMethodCommand.Execute(TestExecutionContext context)
   at NUnit.Framework.Internal.Execution.SimpleWorkItem.<>c__DisplayClass4_0.<PerformWork>b__0()
   at NUnit.Framework.Internal.ContextUtils.<>c__DisplayClass1_0`1.<DoIsolated>b__0(Object _)
   at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
--- End of stack trace from previous location ---
   at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
   at NUnit.Framework.Internal.ContextUtils.DoIsolated(ContextCallback callback, Object state)
   at NUnit.Framework.Internal.ContextUtils.DoIsolated[T](Func`1 func)
   at NUnit.Framework.Internal.Execution.SimpleWorkItem.PerformWork()

Check failure on line 93 in src/ServiceToolkit/src/SIL.ServiceToolkit/Services/ParallelCorpusPreprocessingService.cs

View workflow job for this annotation

GitHub Actions / NUnit Tests

Serval.Machine.Shared.Services.PreprocessBuildJobTests ► RunAsync_TrainOnAll

Failed test found in: src/Machine/test/Serval.Machine.Shared.Tests/TestResults/test-results.trx Error: System.ArgumentException : There must be at least one corpora. (Parameter 'corpora')
Raw output
System.ArgumentException : There must be at least one corpora. (Parameter 'corpora')
   at SIL.Machine.Corpora.NParallelTextCorpus..ctor(IEnumerable`1 corpora, IComparer`1 rowRefComparer)
   at SIL.Machine.Corpora.MergedTextCorpus..ctor(IEnumerable`1 corpora, MergeRule mergeRule, Nullable`1 seed)
   at SIL.Machine.Corpora.CorporaExtensions.ChooseRandom(IEnumerable`1 corpora, Nullable`1 seed)
   at SIL.ServiceToolkit.Services.ParallelCorpusPreprocessingService.Preprocess(IReadOnlyList`1 corpora, Action`1 train, Action`2 pretranslate, Boolean useKeyTerms) in /home/runner/work/serval/serval/src/ServiceToolkit/src/SIL.ServiceToolkit/Services/ParallelCorpusPreprocessingService.cs:line 93
   at Serval.Machine.Shared.Services.PreprocessBuildJob.WriteDataFilesAsync(String buildId, IReadOnlyList`1 corpora, String buildOptions, CancellationToken cancellationToken) in /home/runner/work/serval/serval/src/Machine/src/Serval.Machine.Shared/Services/PreprocessBuildJob.cs:line 110
   at Serval.Machine.Shared.Services.PreprocessBuildJob.WriteDataFilesAsync(String buildId, IReadOnlyList`1 corpora, String buildOptions, CancellationToken cancellationToken) in /home/runner/work/serval/serval/src/Machine/src/Serval.Machine.Shared/Services/PreprocessBuildJob.cs:line 143
   at Serval.Machine.Shared.Services.PreprocessBuildJob.WriteDataFilesAsync(String buildId, IReadOnlyList`1 corpora, String buildOptions, CancellationToken cancellationToken) in /home/runner/work/serval/serval/src/Machine/src/Serval.Machine.Shared/Services/PreprocessBuildJob.cs:line 143
   at Serval.Machine.Shared.Services.PreprocessBuildJob.WriteDataFilesAsync(String buildId, IReadOnlyList`1 corpora, String buildOptions, CancellationToken cancellationToken) in /home/runner/work/serval/serval/src/Machine/src/Serval.Machine.Shared/Services/PreprocessBuildJob.cs:line 143
   at Serval.Machine.Shared.Services.PreprocessBuildJob.WriteDataFilesAsync(String buildId, IReadOnlyList`1 corpora, String buildOptions, CancellationToken cancellationToken) in /home/runner/work/serval/serval/src/Machine/src/Serval.Machine.Shared/Services/PreprocessBuildJob.cs:line 143
   at Serval.Machine.Shared.Services.PreprocessBuildJob.DoWorkAsync(String engineId, String buildId, IReadOnlyList`1 data, String buildOptions, CancellationToken cancellationToken) in /home/runner/work/serval/serval/src/Machine/src/Serval.Machine.Shared/Services/PreprocessBuildJob.cs:line 44
   at Serval.Machine.Shared.Services.HangfireBuildJob`1.RunAsync(String engineId, String buildId, T data, String buildOptions, CancellationToken cancellationToken) in /home/runner/work/serval/serval/src/Machine/src/Serval.Machine.Shared/Services/HangfireBuildJob.cs:line 54
   at Serval.Machine.Shared.Services.HangfireBuildJob`1.RunAsync(String engineId, String buildId, T data, String buildOptions, CancellationToken cancellationToken) in /home/runner/work/serval/serval/src/Machine/src/Serval.Machine.Shared/Services/HangfireBuildJob.cs:line 118
   at Serval.Machine.Shared.Services.HangfireBuildJob`1.RunAsync(String engineId, String buildId, T data, String buildOptions, CancellationToken cancellationToken) in /home/runner/work/serval/serval/src/Machine/src/Serval.Machine.Shared/Services/HangfireBuildJob.cs:line 123
   at Serval.Machine.Shared.Services.PreprocessBuildJobTests.RunAsync_TrainOnAll() in /home/runner/work/serval/serval/src/Machine/test/Serval.Machine.Shared.Tests/Services/PreprocessBuildJobTests.cs:line 30
   at NUnit.Framework.Internal.TaskAwaitAdapter.GenericAdapter`1.BlockUntilCompleted()
   at NUnit.Framework.Internal.MessagePumpStrategy.NoMessagePumpStrategy.WaitForCompletion(AwaitAdapter awaiter)
   at NUnit.Framework.Internal.AsyncToSyncAdapter.Await(Func`1 invoke)
   at NUnit.Framework.Internal.Commands.TestMethodCommand.RunTestMethod(TestExecutionContext context)
   at NUnit.Framework.Internal.Commands.TestMethodCommand.Execute(TestExecutionContext context)
   at NUnit.Framework.Internal.Execution.SimpleWorkItem.<>c__DisplayClass4_0.<PerformWork>b__0()
   at NUnit.Framework.Internal.ContextUtils.<>c__DisplayClass1_0`1.<DoIsolated>b__0(Object _)
   at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
--- End of stack trace from previous location ---
   at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
   at NUnit.Framework.Internal.ContextUtils.DoIsolated(ContextCallback callback, Object state)
   at NUnit.Framework.Internal.ContextUtils.DoIsolated[T](Func`1 func)
   at NUnit.Framework.Internal.Execution.SimpleWorkItem.PerformWork()

Check failure on line 93 in src/ServiceToolkit/src/SIL.ServiceToolkit/Services/ParallelCorpusPreprocessingService.cs

View workflow job for this annotation

GitHub Actions / NUnit Tests

Serval.Machine.Shared.Services.PreprocessBuildJobTests ► RunAsync_TrainOnTextIds

Failed test found in: src/Machine/test/Serval.Machine.Shared.Tests/TestResults/test-results.trx Error: System.ArgumentException : There must be at least one corpora. (Parameter 'corpora')
Raw output
System.ArgumentException : There must be at least one corpora. (Parameter 'corpora')
   at SIL.Machine.Corpora.NParallelTextCorpus..ctor(IEnumerable`1 corpora, IComparer`1 rowRefComparer)
   at SIL.Machine.Corpora.MergedTextCorpus..ctor(IEnumerable`1 corpora, MergeRule mergeRule, Nullable`1 seed)
   at SIL.Machine.Corpora.CorporaExtensions.ChooseRandom(IEnumerable`1 corpora, Nullable`1 seed)
   at SIL.ServiceToolkit.Services.ParallelCorpusPreprocessingService.Preprocess(IReadOnlyList`1 corpora, Action`1 train, Action`2 pretranslate, Boolean useKeyTerms) in /home/runner/work/serval/serval/src/ServiceToolkit/src/SIL.ServiceToolkit/Services/ParallelCorpusPreprocessingService.cs:line 93
   at Serval.Machine.Shared.Services.PreprocessBuildJob.WriteDataFilesAsync(String buildId, IReadOnlyList`1 corpora, String buildOptions, CancellationToken cancellationToken) in /home/runner/work/serval/serval/src/Machine/src/Serval.Machine.Shared/Services/PreprocessBuildJob.cs:line 110
   at Serval.Machine.Shared.Services.PreprocessBuildJob.WriteDataFilesAsync(String buildId, IReadOnlyList`1 corpora, String buildOptions, CancellationToken cancellationToken) in /home/runner/work/serval/serval/src/Machine/src/Serval.Machine.Shared/Services/PreprocessBuildJob.cs:line 143
   at Serval.Machine.Shared.Services.PreprocessBuildJob.WriteDataFilesAsync(String buildId, IReadOnlyList`1 corpora, String buildOptions, CancellationToken cancellationToken) in /home/runner/work/serval/serval/src/Machine/src/Serval.Machine.Shared/Services/PreprocessBuildJob.cs:line 143
   at Serval.Machine.Shared.Services.PreprocessBuildJob.WriteDataFilesAsync(String buildId, IReadOnlyList`1 corpora, String buildOptions, CancellationToken cancellationToken) in /home/runner/work/serval/serval/src/Machine/src/Serval.Machine.Shared/Services/PreprocessBuildJob.cs:line 143
   at Serval.Machine.Shared.Services.PreprocessBuildJob.WriteDataFilesAsync(String buildId, IReadOnlyList`1 corpora, String buildOptions, CancellationToken cancellationToken) in /home/runner/work/serval/serval/src/Machine/src/Serval.Machine.Shared/Services/PreprocessBuildJob.cs:line 143
   at Serval.Machine.Shared.Services.PreprocessBuildJob.DoWorkAsync(String engineId, String buildId, IReadOnlyList`1 data, String buildOptions, CancellationToken cancellationToken) in /home/runner/work/serval/serval/src/Machine/src/Serval.Machine.Shared/Services/PreprocessBuildJob.cs:line 44
   at Serval.Machine.Shared.Services.HangfireBuildJob`1.RunAsync(String engineId, String buildId, T data, String buildOptions, CancellationToken cancellationToken) in /home/runner/work/serval/serval/src/Machine/src/Serval.Machine.Shared/Services/HangfireBuildJob.cs:line 54
   at Serval.Machine.Shared.Services.HangfireBuildJob`1.RunAsync(String engineId, String buildId, T data, String buildOptions, CancellationToken cancellationToken) in /home/runner/work/serval/serval/src/Machine/src/Serval.Machine.Shared/Services/HangfireBuildJob.cs:line 118
   at Serval.Machine.Shared.Services.HangfireBuildJob`1.RunAsync(String engineId, String buildId, T data, String buildOptions, CancellationToken cancellationToken) in /home/runner/work/serval/serval/src/Machine/src/Serval.Machine.Shared/Services/HangfireBuildJob.cs:line 123
   at Serval.Machine.Shared.Services.PreprocessBuildJobTests.RunAsync_TrainOnTextIds() in /home/runner/work/serval/serval/src/Machine/test/Serval.Machine.Shared.Tests/Services/PreprocessBuildJobTests.cs:line 48
   at NUnit.Framework.Internal.TaskAwaitAdapter.GenericAdapter`1.BlockUntilCompleted()
   at NUnit.Framework.Internal.MessagePumpStrategy.NoMessagePumpStrategy.WaitForCompletion(AwaitAdapter awaiter)
   at NUnit.Framework.Internal.AsyncToSyncAdapter.Await(Func`1 invoke)
   at NUnit.Framework.Internal.Commands.TestMethodCommand.RunTestMethod(TestExecutionContext context)
   at NUnit.Framework.Internal.Commands.TestMethodCommand.Execute(TestExecutionContext context)
   at NUnit.Framework.Internal.Execution.SimpleWorkItem.<>c__DisplayClass4_0.<PerformWork>b__0()
   at NUnit.Framework.Internal.ContextUtils.<>c__DisplayClass1_0`1.<DoIsolated>b__0(Object _)
   at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
--- End of stack trace from previous location ---
   at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
   at NUnit.Framework.Internal.ContextUtils.DoIsolated(ContextCallback callback, Object state)
   at NUnit.Framework.Internal.ContextUtils.DoIsolated[T](Func`1 func)
   at NUnit.Framework.Internal.Execution.SimpleWorkItem.PerformWork()
.ChooseRandom(Seed)
.AlignRows(targetTermCorpora.ChooseFirst());
foreach (ParallelTextRow row in parallelKeyTermsCorpus)
{
train(new Row(row.TextId, row.Refs, row.SourceText, row.TargetText, 1));
Expand All @@ -111,6 +113,19 @@
}
}

private static IEnumerable<(CorpusFile File, Dictionary<string, HashSet<int>> Chapters)> GetChaptersPerFile(
MonolingualCorpus mc
)
{
Dictionary<string, HashSet<int>>? chapters = mc.TrainOnChapters;
if (chapters is null && mc.TrainOnTextIds is not null)
{
chapters = mc.TrainOnTextIds.Select(tid => (tid, new HashSet<int> { })).ToDictionary();
}
chapters ??= [];
return mc.Files.Select(f => (f, chapters));
}

private static ITextCorpus FilterPretranslateCorpora(MonolingualCorpus corpus, ITextCorpus textCorpus)
{
textCorpus = textCorpus.Transform(CleanSegment);
Expand Down
Loading