Skip to content

Commit

Permalink
Update to Machine 3.0.2 (#305)
Browse files Browse the repository at this point in the history
* Update to Machine 3.0.2
  • Loading branch information
Enkidu93 authored Feb 7, 2024
1 parent 8e4a86b commit bb5b1be
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 10 deletions.
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

0 comments on commit bb5b1be

Please sign in to comment.