Skip to content

Commit

Permalink
Fix merge errors
Browse files Browse the repository at this point in the history
  • Loading branch information
johnml1135 committed Oct 14, 2024
1 parent 2c8d598 commit a574439
Show file tree
Hide file tree
Showing 30 changed files with 595 additions and 613 deletions.
15 changes: 9 additions & 6 deletions src/Echo/src/EchoEngine/WordAlignmentEngineServiceV1.cs
Original file line number Diff line number Diff line change
Expand Up @@ -76,9 +76,6 @@ await client.BuildStartedAsync(
{
foreach (ParallelCorpus corpus in request.Corpora)
{
if (!corpus.WordAlignOnAll && corpus.WordAlignOnTextIds.Count == 0)
continue;

var sourceFiles = corpus
.SourceCorpora.SelectMany(sc =>
sc.Files.Where(f =>
Expand All @@ -92,9 +89,15 @@ await client.BuildStartedAsync(
)
.ToDictionary(f => f.TextId, f => f.Location);
var targetFiles = corpus
.TargetFiles.Where(f =>
(corpus.WordAlignOnAll || corpus.WordAlignOnTextIds.Contains(f.TextId))
&& f.Format == FileFormat.Text
.TargetCorpora.SelectMany(tc =>
tc.Files.Where(f =>
(
tc.WordAlignOnAll
|| tc.WordAlignOnTextIds is null
|| tc.WordAlignOnTextIds.Contains(f.TextId)
)
&& f.Format == FileFormat.Text
)
)
.ToDictionary(f => f.TextId, f => f.Location);

Expand Down
289 changes: 120 additions & 169 deletions src/Serval/src/Serval.Client/Client.g.cs

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/Serval/src/Serval.Shared/Controllers/Endpoints.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ public static class Endpoints
public const string GetAssessmentReferenceCorpus = "GetAssessmentReferenceCorpus";
public const string GetAssessmentJob = "GetAssessmentJob";
public const string GetWordAlignmentEngine = "GetWordAlignmentEngine";
public const string GetWordAlignmentCorpus = "GetWordAlignmentCorpus";
public const string GetParallelWordAlignmentCorpus = "GetParallelWordAlignmentCorpus";
public const string GetWordAlignmentBuild = "GetWordAlignmentBuild";

public const string GetWebhook = "GetWebhook";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace Serval.Translation.Models;
namespace Serval.Shared.Models;

public record MonolingualCorpus
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace Serval.Shared.Models;
namespace Serval.Translation.Models;

public record TrainingCorpus
{
Expand Down
6 changes: 3 additions & 3 deletions src/Serval/src/Serval.Translation/Services/EngineService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -432,8 +432,8 @@ public Task AddParallelCorpusAsync(
public async Task<Models.ParallelCorpus> UpdateParallelCorpusAsync(
string engineId,
string parallelCorpusId,
IReadOnlyList<Models.MonolingualCorpus>? sourceCorpora,
IReadOnlyList<Models.MonolingualCorpus>? targetCorpora,
IReadOnlyList<Shared.Models.MonolingualCorpus>? sourceCorpora,
IReadOnlyList<Shared.Models.MonolingualCorpus>? targetCorpora,
CancellationToken cancellationToken = default
)
{
Expand Down Expand Up @@ -716,7 +716,7 @@ private V1.ParallelCorpus Map(
}

private V1.MonolingualCorpus Map(
Models.MonolingualCorpus source,
Shared.Models.MonolingualCorpus source,
ParallelCorpusFilter? trainingFilter,
ParallelCorpusFilter? pretranslateFilter,
string? referenceFileLocation
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
namespace Serval.WordAlignment.Contracts;

public record ParallelCorpusFilterConfigDto
{
public required string CorpusId { get; init; }
public IReadOnlyList<string>? TextIds { get; init; }
public string? ScriptureRange { get; init; }
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
namespace Serval.WordAlignment.Contracts;

public record ParallelCorpusFilterDto
{
public required ResourceLinkDto Corpus { get; init; }
public IReadOnlyList<string>? TextIds { get; init; }
public string? ScriptureRange { get; init; }
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ namespace Serval.WordAlignment.Contracts;

public record TrainingCorpusConfigDto
{
public required string CorpusId { get; init; }
public IReadOnlyList<string>? TextIds { get; init; }
public string? ScriptureRange { get; init; }
public string? ParallelCorpusId { get; init; }
public IReadOnlyList<ParallelCorpusFilterConfigDto>? SourceFilters { get; init; }
public IReadOnlyList<ParallelCorpusFilterConfigDto>? TargetFilters { get; init; }
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@ namespace Serval.WordAlignment.Contracts;

public record TrainingCorpusDto
{
public required ResourceLinkDto Corpus { get; init; }

public IReadOnlyList<string>? TextIds { get; init; }

public string? ScriptureRange { get; init; }
public ResourceLinkDto? ParallelCorpus { get; init; }
public IReadOnlyList<ParallelCorpusFilterDto>? SourceFilters { get; init; }
public IReadOnlyList<ParallelCorpusFilterDto>? TargetFilters { get; init; }
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ namespace Serval.WordAlignment.Contracts;

public record WordAlignOnCorpusConfigDto
{
public required string CorpusId { get; init; }
public IReadOnlyList<string>? TextIds { get; init; }
public string? ScriptureRange { get; init; }
public string? ParallelCorpusId { get; init; }
public IReadOnlyList<ParallelCorpusFilterConfigDto>? SourceFilters { get; init; }
public IReadOnlyList<ParallelCorpusFilterConfigDto>? TargetFilters { get; init; }
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@ namespace Serval.WordAlignment.Contracts;

public record WordAlignOnCorpusDto
{
public required ResourceLinkDto Corpus { get; init; }

public IReadOnlyList<string>? TextIds { get; init; }

public string? ScriptureRange { get; init; }
public ResourceLinkDto? ParallelCorpus { get; init; }
public IReadOnlyList<ParallelCorpusFilterDto>? SourceFilters { get; init; }
public IReadOnlyList<ParallelCorpusFilterDto>? TargetFilters { get; init; }
}

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
namespace Serval.WordAlignment.Contracts;

public record WordAlignmentParallelCorpusConfigDto
{
/// <summary>
/// The corpus name.
/// </summary>
public string? Name { get; init; }

public required IReadOnlyList<string> SourceCorpusIds { get; init; } = new List<string>();
public required IReadOnlyList<string> TargetCorpusIds { get; init; } = new List<string>();
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
namespace Serval.WordAlignment.Contracts;

public record WordAlignmentParallelCorpusDto
{
public required string Id { get; init; }
public required string Url { get; init; }
public required ResourceLinkDto Engine { get; init; }
public required IReadOnlyList<ResourceLinkDto> SourceCorpora { get; init; }
public required IReadOnlyList<ResourceLinkDto> TargetCorpora { get; init; }
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
using System.ComponentModel.DataAnnotations;

namespace Serval.WordAlignment.Contracts;

public record WordAlignmentParallelCorpusUpdateConfigDto : IValidatableObject
{
public IReadOnlyList<string>? SourceCorpusIds { get; init; }

public IReadOnlyList<string>? TargetCorpusIds { get; init; }

public IEnumerable<System.ComponentModel.DataAnnotations.ValidationResult> Validate(
ValidationContext validationContext
)
{
if (SourceCorpusIds is null && TargetCorpusIds is null)
{
yield return new System.ComponentModel.DataAnnotations.ValidationResult(
"At least one field must be specified.",
[nameof(SourceCorpusIds), nameof(TargetCorpusIds)]
);
}
}
}
Loading

0 comments on commit a574439

Please sign in to comment.