diff --git a/src/Machine/src/Serval.Machine.Shared/Services/PreprocessBuildJob.cs b/src/Machine/src/Serval.Machine.Shared/Services/PreprocessBuildJob.cs index 683098a6..0694cbc6 100644 --- a/src/Machine/src/Serval.Machine.Shared/Services/PreprocessBuildJob.cs +++ b/src/Machine/src/Serval.Machine.Shared/Services/PreprocessBuildJob.cs @@ -22,6 +22,8 @@ ISharedFileService sharedFileService private readonly ISharedFileService _sharedFileService = sharedFileService; + public ICorpusService CorpusService { get; set; } = new CorpusService(); + protected override async Task DoWorkAsync( string engineId, string buildId, diff --git a/src/Machine/src/Serval.Machine.Shared/Services/ServalTranslationEngineServiceV1.cs b/src/Machine/src/Serval.Machine.Shared/Services/ServalTranslationEngineServiceV1.cs index bced613b..7d69e874 100644 --- a/src/Machine/src/Serval.Machine.Shared/Services/ServalTranslationEngineServiceV1.cs +++ b/src/Machine/src/Serval.Machine.Shared/Services/ServalTranslationEngineServiceV1.cs @@ -91,7 +91,7 @@ await engineService.TrainSegmentPairAsync( public override async Task StartBuild(StartBuildRequest request, ServerCallContext context) { ITranslationEngineService engineService = GetEngineService(request.EngineType); - Models.ParallelCorpus[] corpora = request.Corpora.Select(Map).ToArray(); + SIL.ServiceToolkit.Models.ParallelCorpus[] corpora = request.Corpora.Select(Map).ToArray(); try { await engineService.StartBuildAsync( @@ -269,9 +269,9 @@ private static Translation.V1.Phrase Map(SIL.Machine.Translation.Phrase source) }; } - private static Models.ParallelCorpus Map(Translation.V1.ParallelCorpus source) + private static SIL.ServiceToolkit.Models.ParallelCorpus Map(Translation.V1.ParallelCorpus source) { - return new Models.ParallelCorpus + return new SIL.ServiceToolkit.Models.ParallelCorpus { Id = source.Id, SourceCorpora = source.SourceCorpora.Select(Map).ToList(), @@ -279,7 +279,7 @@ private static Models.ParallelCorpus Map(Translation.V1.ParallelCorpus source) }; } - private static Models.MonolingualCorpus Map(Translation.V1.MonolingualCorpus source) + private static SIL.ServiceToolkit.Models.MonolingualCorpus Map(Translation.V1.MonolingualCorpus source) { var trainOnChapters = source.TrainOnChapters.ToDictionary( kvp => kvp.Key, @@ -295,7 +295,7 @@ private static Models.MonolingualCorpus Map(Translation.V1.MonolingualCorpus sou var pretranslateTextIds = source.PretranslateTextIds.ToHashSet(); FilterChoice pretranslateFilter = GetFilterChoice(pretranslateChapters, pretranslateTextIds); - return new Models.MonolingualCorpus + return new SIL.ServiceToolkit.Models.MonolingualCorpus { Id = source.Id, Language = source.Language, @@ -307,12 +307,12 @@ private static Models.MonolingualCorpus Map(Translation.V1.MonolingualCorpus sou }; } - private static Models.CorpusFile Map(Translation.V1.CorpusFile source) + private static SIL.ServiceToolkit.Models.CorpusFile Map(Translation.V1.CorpusFile source) { - return new Models.CorpusFile + return new SIL.ServiceToolkit.Models.CorpusFile { Location = source.Location, - Format = (Models.FileFormat)source.Format, + Format = (SIL.ServiceToolkit.Models.FileFormat)source.Format, TextId = source.TextId }; } diff --git a/src/Machine/src/Serval.Machine.Shared/Usings.cs b/src/Machine/src/Serval.Machine.Shared/Usings.cs index 9029e2c8..bb148b80 100644 --- a/src/Machine/src/Serval.Machine.Shared/Usings.cs +++ b/src/Machine/src/Serval.Machine.Shared/Usings.cs @@ -54,7 +54,6 @@ global using SIL.Machine.Translation; global using SIL.Machine.Translation.Thot; global using SIL.Machine.Utils; -global using SIL.Scripture; global using SIL.ServiceToolkit.Models; global using SIL.ServiceToolkit.Services; global using SIL.ServiceToolkit.Utils; diff --git a/src/Machine/test/Serval.Machine.Shared.Tests/Services/NmtEngineServiceTests.cs b/src/Machine/test/Serval.Machine.Shared.Tests/Services/NmtEngineServiceTests.cs index 67145c01..d3300709 100644 --- a/src/Machine/test/Serval.Machine.Shared.Tests/Services/NmtEngineServiceTests.cs +++ b/src/Machine/test/Serval.Machine.Shared.Tests/Services/NmtEngineServiceTests.cs @@ -301,7 +301,6 @@ public override object ActivateJob(Type jobType) Substitute.For>(), _env.BuildJobService, _env.SharedFileService, - Substitute.For(), new LanguageTagService() ); } diff --git a/src/Machine/test/Serval.Machine.Shared.Tests/Services/PreprocessBuildJobTests.cs b/src/Machine/test/Serval.Machine.Shared.Tests/Services/PreprocessBuildJobTests.cs index 539b9c4c..29065719 100644 --- a/src/Machine/test/Serval.Machine.Shared.Tests/Services/PreprocessBuildJobTests.cs +++ b/src/Machine/test/Serval.Machine.Shared.Tests/Services/PreprocessBuildJobTests.cs @@ -781,11 +781,10 @@ public PreprocessBuildJob GetBuildJob(TranslationEngineType engineType) Substitute.For>(), BuildJobService, SharedFileService, - CorpusService, new LanguageTagService() ) { - Seed = 1234 + CorpusService = CorpusService }; } case TranslationEngineType.SmtTransfer: @@ -797,12 +796,11 @@ public PreprocessBuildJob GetBuildJob(TranslationEngineType engineType) Substitute.For>(), BuildJobService, SharedFileService, - CorpusService, LockFactory, TrainSegmentPairs ) { - Seed = 1234 + CorpusService = CorpusService }; } default: diff --git a/src/Machine/test/Serval.Machine.Shared.Tests/Services/SmtTransferEngineServiceTests.cs b/src/Machine/test/Serval.Machine.Shared.Tests/Services/SmtTransferEngineServiceTests.cs index 6b888794..06d0dbde 100644 --- a/src/Machine/test/Serval.Machine.Shared.Tests/Services/SmtTransferEngineServiceTests.cs +++ b/src/Machine/test/Serval.Machine.Shared.Tests/Services/SmtTransferEngineServiceTests.cs @@ -687,7 +687,6 @@ public override object ActivateJob(Type jobType) Substitute.For>(), _env.BuildJobService, _env.SharedFileService, - Substitute.For(), _env._lockFactory, _env.TrainSegmentPairs ) diff --git a/src/Machine/test/Serval.Machine.Shared.Tests/Usings.cs b/src/Machine/test/Serval.Machine.Shared.Tests/Usings.cs index f58cb973..3ccb5537 100644 --- a/src/Machine/test/Serval.Machine.Shared.Tests/Usings.cs +++ b/src/Machine/test/Serval.Machine.Shared.Tests/Usings.cs @@ -28,4 +28,6 @@ global using SIL.Machine.Utils; global using SIL.ObjectModel; global using SIL.Scripture; +global using SIL.ServiceToolkit.Models; +global using SIL.ServiceToolkit.Services; global using SIL.WritingSystems;