Skip to content

Commit

Permalink
Move sort to corpus class
Browse files Browse the repository at this point in the history
  • Loading branch information
Enkidu93 committed Nov 27, 2024
1 parent a41e6e3 commit 96ee214
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 5 deletions.
5 changes: 4 additions & 1 deletion src/SIL.Machine/Corpora/ParatextBackupTermsCorpus.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,10 @@ public ParatextBackupTermsCorpus(
IEnumerable<(string, IReadOnlyList<string>)> glosses = new ZipParatextProjectTermsParser(
archive,
settings
).Parse(termCategories, useTermGlosses, chapters);
)
.Parse(termCategories, useTermGlosses, chapters)
.OrderBy(g => g.TermId);

string textId =
$"{settings.BiblicalTermsListType}:{settings.BiblicalTermsProjectName}:{settings.BiblicalTermsFileName}";

Expand Down
3 changes: 1 addition & 2 deletions src/SIL.Machine/Corpora/ParatextProjectTermsParserBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -168,8 +168,7 @@ protected ParatextProjectTermsParserBase(ParatextProjectSettingsParserBase setti
{
return termsRenderings
.Concat(termsGlosses.Where(kvp => !termsRenderings.ContainsKey(kvp.Key)))
.Select(kvp => (kvp.Key, (IReadOnlyList<string>)kvp.Value.ToList()))
.OrderBy(glosses => glosses.Key);
.Select(kvp => (kvp.Key, (IReadOnlyList<string>)kvp.Value.ToList()));
}
return new List<(string, IReadOnlyList<string>)>();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ public void TestGetKeyTermsFromTermsLocalizations_NoTermRenderings()
);
IEnumerable<(string TermId, IReadOnlyList<string> Glosses)> terms = env.GetGlosses();
Assert.That(terms.Count, Is.EqualTo(5726));
Assert.That(string.Join(" ", terms.First().Glosses), Is.EqualTo("Aaron"));
Assert.That(string.Join(" ", terms.First().Glosses), Is.EqualTo("Abagtha"));
}

[Test]
Expand Down Expand Up @@ -139,7 +139,8 @@ public void TestGetKeyTermsFromTermsLocalizations_TermRenderingsExists_PreferLoc
);
IReadOnlyList<(string TermId, IReadOnlyList<string> Glosses)> terms = env.GetGlosses().ToList();
Assert.That(terms.Count, Is.EqualTo(5726));
Assert.That(string.Join(" ", terms[1].Glosses), Is.EqualTo("Aaron"));
Assert.That(string.Join(" ", terms[1].Glosses), Is.EqualTo("Abagtha"));
Assert.That(string.Join(" ", terms[2].Glosses), Is.EqualTo("Abi"));
}

[Test]
Expand Down

0 comments on commit 96ee214

Please sign in to comment.