Skip to content

Commit

Permalink
Spread out steps for easier debugging
Browse files Browse the repository at this point in the history
  • Loading branch information
Enkidu93 committed Oct 17, 2024
1 parent d3300c7 commit 6ceee18
Showing 1 changed file with 18 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -302,6 +302,24 @@ IReadOnlyList<ITextCorpus> trgCorpora

private static IEnumerable<Row> AlignPretranslateCorpus(ITextCorpus[] srcCorpora, ITextCorpus[] trgCorpora)
{
if (srcCorpora.All(sc => sc.IsScripture()))
{
var alignedCorpora = srcCorpora.SelectMany(sc => trgCorpora.Select(tc => AlignScripture(sc, tc)));
var zippedCorpora = alignedCorpora.ZipMany(rows => rows.ToArray());
var filteredZippedCorpora = zippedCorpora.Where(rows =>
rows.All(r => r is null || r.TargetSegment.Length == 0)
);
var rows = filteredZippedCorpora.Select(row =>
row.Where(r => r is not null && r.SourceSegment.Length > 0).FirstOrDefault()
);
foreach (Row? r in rows)
{
if (r is not null)
yield return r;
}
yield break;
}

int rowCount = 0;
StringBuilder srcSegBuffer = new();
StringBuilder trgSegBuffer = new();
Expand Down

0 comments on commit 6ceee18

Please sign in to comment.