Skip to content

Commit

Permalink
Review changes
Browse files Browse the repository at this point in the history
  • Loading branch information
Enkidu93 committed Feb 8, 2024
1 parent 436a67d commit 32a8471
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/SIL.Machine/Corpora/CorporaExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,7 @@ public static ITextCorpus Flatten(this IEnumerable<ITextCorpus> corpora)
return new FlattenTextCorpus(corpusArray);
}

public static IEnumerable<(string Text, VerseRef RefCorpusVerseRef, VerseRef? CorpusVerseRef)> ExtractScripture(
public static IEnumerable<(string Text, VerseRef RefCorpusVerseRef, VerseRef CorpusVerseRef)> ExtractScripture(
this ITextCorpus corpus,
ITextCorpus refCorpus = null
)
Expand All @@ -290,7 +290,7 @@ public static ITextCorpus Flatten(this IEnumerable<ITextCorpus> corpora)
&& vref.CompareTo(curRef.Value, null, compareAllVerses: true, compareSegments: false) != 0
)
{
yield return (curTrgLineRange ? "<range>" : curTrgLine.ToString(), curRef.Value, curTrgRef);
yield return (curTrgLineRange ? "<range>" : curTrgLine.ToString(), curRef.Value, curTrgRef.Value);
curTrgLineRange = curTrgLineRange || curTrgLine.Length > 0;
curTrgLine = new StringBuilder();
curTrgRef = null;
Expand Down Expand Up @@ -348,7 +348,7 @@ public static ITextCorpus Flatten(this IEnumerable<ITextCorpus> corpora)
}

if (curRef.HasValue)
yield return (curTrgLineRange ? "<range>" : curTrgLine.ToString(), curRef.Value, curTrgRef);
yield return (curTrgLineRange ? "<range>" : curTrgLine.ToString(), curRef.Value, curTrgRef.Value);
}

private class TransformTextCorpus : TextCorpusBase
Expand Down
2 changes: 2 additions & 0 deletions tests/SIL.Machine.Tests/Corpora/CorporaExtensionsTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ public void ExtractScripture()

Assert.That(text, Is.EqualTo(""));
Assert.That(origRef, Is.EqualTo(new VerseRef("GEN 1:1", ScrVers.Original)));
Assert.That(corpusRef, Is.EqualTo(new VerseRef("GEN 1:1", corpus.Versification)));

(text, origRef, corpusRef) = lines[3167];
Assert.That(text, Is.EqualTo("Chapter fourteen, verse fifty-five. Segment b."));
Expand All @@ -32,6 +33,7 @@ public void ExtractScripture()
(text, origRef, corpusRef) = lines[10727];
Assert.That(text, Is.EqualTo("<range>"));
Assert.That(origRef, Is.EqualTo(new VerseRef("1CH 12:4", ScrVers.Original)));
Assert.That(corpusRef, Is.EqualTo(new VerseRef("1CH 12:4", corpus.Versification)));

(text, origRef, corpusRef) = lines[10731];
Assert.That(text, Is.EqualTo("<range>"));
Expand Down

0 comments on commit 32a8471

Please sign in to comment.