Skip to content

Commit

Permalink
Change mergedtextcorpus parameter
Browse files Browse the repository at this point in the history
  • Loading branch information
Enkidu93 committed Nov 15, 2024
1 parent 14697e4 commit 2058d4d
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 12 deletions.
12 changes: 2 additions & 10 deletions src/SIL.Machine/Corpora/CorporaExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -544,20 +544,12 @@ public static ITextCorpus ChooseRandom(
int seed
)
{
return new MergedTextCorpus(
new NParallelTextCorpus(corpora) { AllRows = allRows.ToArray() },
MergeRule.Random,
seed
);
return new MergedTextCorpus(corpora, allRows.ToArray(), MergeRule.Random, seed);
}

public static ITextCorpus ChooseFirst(this IEnumerable<ITextCorpus> corpora, IEnumerable<bool> allRows)
{
return new MergedTextCorpus(
new NParallelTextCorpus(corpora) { AllRows = allRows.ToArray() },
MergeRule.First,
0
);
return new MergedTextCorpus(corpora, allRows.ToArray(), MergeRule.First, 0);
}

#endregion
Expand Down
9 changes: 7 additions & 2 deletions src/SIL.Machine/Corpora/MergedTextCorpus.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,14 @@ public class MergedTextCorpus : TextCorpusBase

private readonly Random _random;

public MergedTextCorpus(NParallelTextCorpus nParallelTextCorpus, MergeRule mergeRule, int seed)
public MergedTextCorpus(
IEnumerable<ITextCorpus> corpora,
IEnumerable<bool> allRows,
MergeRule mergeRule,
int seed
)
{
_corpus = nParallelTextCorpus;
_corpus = new NParallelTextCorpus(corpora) { AllRows = allRows.ToList() };
_mergeRule = mergeRule;
_random = new Random(seed);
}
Expand Down

0 comments on commit 2058d4d

Please sign in to comment.