Skip to content

Commit

Permalink
Change naming to avoid confusion with 'Select'
Browse files Browse the repository at this point in the history
  • Loading branch information
Enkidu93 committed Nov 8, 2024
1 parent bd0ec45 commit 57b759d
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
4 changes: 2 additions & 2 deletions src/SIL.Machine/Corpora/CorporaExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -377,12 +377,12 @@ public static ITextCorpus FilterTexts(this ITextCorpus corpus, IEnumerable<strin
return new FilterTextsTextCorpus(corpus, textIds);
}

public static ITextCorpus SelectRandom(this NParallelTextCorpus corpus, int seed)
public static ITextCorpus ChooseRandom(this NParallelTextCorpus corpus, int seed)
{
return new MergedCorpus(corpus, MergeRule.Random, seed);
}

public static ITextCorpus SelectFirst(this NParallelTextCorpus corpus)
public static ITextCorpus ChooseFirst(this NParallelTextCorpus corpus)
{
return new MergedCorpus(corpus, MergeRule.First, 0);
}
Expand Down
10 changes: 5 additions & 5 deletions tests/SIL.Machine.Tests/Corpora/CorporaExtensionsTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ public void MergedCorpus_SelectFirst()
)
);
var nParallelCorpus = new NParallelTextCorpus([corpus1, corpus2, corpus3]) { AllRowsList = [true, true, true] };
var mergedCorpus = nParallelCorpus.SelectFirst();
var mergedCorpus = nParallelCorpus.ChooseFirst();
var rows = mergedCorpus.ToArray();
Assert.That(rows, Has.Length.EqualTo(3), JsonSerializer.Serialize(rows));
Assert.That(rows[0].Text, Is.EqualTo("source 1 segment 1 ."));
Expand Down Expand Up @@ -140,7 +140,7 @@ public void MergedCorpus_SelectRandom_Seed123456()
)
);
var nParallelCorpus = new NParallelTextCorpus([corpus1, corpus2, corpus3]) { AllRowsList = [true, true, true] };
var mergedCorpus = nParallelCorpus.SelectRandom(123456);
var mergedCorpus = nParallelCorpus.ChooseRandom(123456);
var rows = mergedCorpus.ToArray();
Assert.That(rows, Has.Length.EqualTo(3), JsonSerializer.Serialize(rows));
Assert.Multiple(() =>
Expand Down Expand Up @@ -188,7 +188,7 @@ public void MergedCorpus_SelectRandom_Seed4501()
)
);
var nParallelCorpus = new NParallelTextCorpus([corpus1, corpus2, corpus3]) { AllRowsList = [true, true, true] };
var mergedCorpus = nParallelCorpus.SelectRandom(4501);
var mergedCorpus = nParallelCorpus.ChooseRandom(4501);
var rows = mergedCorpus.ToArray();
Assert.That(rows, Has.Length.EqualTo(3), JsonSerializer.Serialize(rows));
Assert.Multiple(() =>
Expand Down Expand Up @@ -238,7 +238,7 @@ public void AlignMergedCorpora()

ITextCorpus sourceCorpus = (new ITextCorpus[] { sourceCorpus1, sourceCorpus1, sourceCorpus3 })
.AlignMany([true, true, true])
.SelectFirst();
.ChooseFirst();

var targetCorpus1 = new DictionaryTextCorpus(
new MemoryText(
Expand Down Expand Up @@ -276,7 +276,7 @@ public void AlignMergedCorpora()

ITextCorpus targetCorpus = (new ITextCorpus[] { targetCorpus1, targetCorpus2, targetCorpus3 })
.AlignMany([true, true, true])
.SelectFirst();
.ChooseFirst();

IParallelTextCorpus alignedCorpus = sourceCorpus.AlignRows(targetCorpus);
ParallelTextRow[] rows = alignedCorpus.GetRows().ToArray();
Expand Down

0 comments on commit 57b759d

Please sign in to comment.