Skip to content

Commit

Permalink
Fix build error
Browse files Browse the repository at this point in the history
  • Loading branch information
Enkidu93 committed Oct 16, 2024
1 parent 4485822 commit 42c6778
Show file tree
Hide file tree
Showing 7 changed files with 14 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ await engineService.TrainSegmentPairAsync(
public override async Task<Empty> 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(
Expand Down Expand Up @@ -269,17 +269,17 @@ 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(),
TargetCorpora = source.TargetCorpora.Select(Map).ToList()
};
}

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,
Expand All @@ -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,
Expand All @@ -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
};
}
Expand Down
1 change: 0 additions & 1 deletion src/Machine/src/Serval.Machine.Shared/Usings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,6 @@ public override object ActivateJob(Type jobType)
Substitute.For<ILogger<NmtPreprocessBuildJob>>(),
_env.BuildJobService,
_env.SharedFileService,
Substitute.For<ICorpusService>(),
new LanguageTagService()
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -781,11 +781,10 @@ public PreprocessBuildJob GetBuildJob(TranslationEngineType engineType)
Substitute.For<ILogger<NmtPreprocessBuildJob>>(),
BuildJobService,
SharedFileService,
CorpusService,
new LanguageTagService()
)
{
Seed = 1234
CorpusService = CorpusService
};
}
case TranslationEngineType.SmtTransfer:
Expand All @@ -797,12 +796,11 @@ public PreprocessBuildJob GetBuildJob(TranslationEngineType engineType)
Substitute.For<ILogger<PreprocessBuildJob>>(),
BuildJobService,
SharedFileService,
CorpusService,
LockFactory,
TrainSegmentPairs
)
{
Seed = 1234
CorpusService = CorpusService
};
}
default:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -687,7 +687,6 @@ public override object ActivateJob(Type jobType)
Substitute.For<ILogger<PreprocessBuildJob>>(),
_env.BuildJobService,
_env.SharedFileService,
Substitute.For<ICorpusService>(),
_env._lockFactory,
_env.TrainSegmentPairs
)
Expand Down
2 changes: 2 additions & 0 deletions src/Machine/test/Serval.Machine.Shared.Tests/Usings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;

0 comments on commit 42c6778

Please sign in to comment.