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

Update to Machine 3.0.2 #305

Merged
merged 2 commits into from
Feb 7, 2024
Merged
Show file tree
Hide file tree
Changes from all 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
2 changes: 1 addition & 1 deletion src/Serval.Shared/Serval.Shared.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<PackageReference Include="Grpc.Core.Api" Version="2.52.0" />
<PackageReference Include="Grpc.HealthCheck" Version="2.52.0" />
<PackageReference Include="Grpc.Net.ClientFactory" Version="2.52.0" />
<PackageReference Include="SIL.Machine" Version="3.0.1" Condition="!Exists('..\..\..\machine\src\SIL.Machine\SIL.Machine.csproj')" />
<PackageReference Include="SIL.Machine" Version="3.0.2" Condition="!Exists('..\..\..\machine\src\SIL.Machine\SIL.Machine.csproj')" />
</ItemGroup>

<ItemGroup>
Expand Down
27 changes: 18 additions & 9 deletions src/Serval.Translation/Services/EngineService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -200,15 +200,6 @@ Dictionary<string, List<int>> GetChapters(V1.Corpus corpus, string scriptureRang
{
engine.Corpora.Select(c =>
{
if (
c.TargetFiles.Count > 1
|| c.TargetFiles.First().Format != Shared.Contracts.FileFormat.Paratext
)
{
throw new InvalidOperationException(
$"The corpus {c.Id} is not compatible with using a scripture range"
);
}
V1.Corpus corpus = Map(c);
if (pretranslate?.TryGetValue(c.Id, out PretranslateCorpus? pretranslateCorpus) ?? false)
{
Expand All @@ -218,6 +209,15 @@ Dictionary<string, List<int>> GetChapters(V1.Corpus corpus, string scriptureRang
corpus.PretranslateTextIds.Add(pretranslateCorpus.TextIds);
if (pretranslateCorpus.ScriptureRange is not null)
{
if (
c.TargetFiles.Count > 1
|| c.TargetFiles.First().Format != Shared.Contracts.FileFormat.Paratext
)
{
throw new InvalidOperationException(
$"The corpus {c.Id} is not compatible with using a scripture range"
);
}
corpus.PretranslateChapters.Add(
GetChapters(corpus, pretranslateCorpus.ScriptureRange)
.Select(
Expand All @@ -239,6 +239,15 @@ Dictionary<string, List<int>> GetChapters(V1.Corpus corpus, string scriptureRang
corpus.TrainOnTextIds.Add(trainingCorpus.TextIds);
if (trainingCorpus.ScriptureRange is not null)
{
if (
c.TargetFiles.Count > 1
|| c.TargetFiles.First().Format != Shared.Contracts.FileFormat.Paratext
)
{
throw new InvalidOperationException(
$"The corpus {c.Id} is not compatible with using a scripture range"
);
}
corpus.TrainOnChapters.Add(
GetChapters(corpus, trainingCorpus.ScriptureRange)
.Select(
Expand Down
Loading