From eba0fed06704a6a81ee39b232bf7d62068b0aa76 Mon Sep 17 00:00:00 2001 From: rampaa Date: Sat, 28 Dec 2024 21:58:27 +0300 Subject: [PATCH] Minor --- JL.Core.Tests/LookupTests.cs | 2 +- JL.Core/Lookup/LookupResult.cs | 6 +++--- JL.Core/Lookup/LookupUtils.cs | 5 +++-- JL.Core/Mining/MiningUtils.cs | 8 ++++---- 4 files changed, 11 insertions(+), 10 deletions(-) diff --git a/JL.Core.Tests/LookupTests.cs b/JL.Core.Tests/LookupTests.cs index 016d6068..4e1fb19c 100644 --- a/JL.Core.Tests/LookupTests.cs +++ b/JL.Core.Tests/LookupTests.cs @@ -61,7 +61,7 @@ public void LookupText_始まる() deconjugatedMatchedText: "始まる", readings: ["はじまる"], formattedDefinitions: "(v5r, vi) (1) to begin; to start; to commence;(v5r, vi) (2) to happen (again); to begin (anew);(v5r, vi) (3) to date (from); to originate (in)", - edictId: 1307500 + entryId: 1307500 ) ]; diff --git a/JL.Core/Lookup/LookupResult.cs b/JL.Core/Lookup/LookupResult.cs index ac389b9b..0b8b6771 100644 --- a/JL.Core/Lookup/LookupResult.cs +++ b/JL.Core/Lookup/LookupResult.cs @@ -13,7 +13,7 @@ public sealed class LookupResult public List? Frequencies { get; } // JMdict, JMnedict, KANJIDIC2 - internal int EdictId { get; } + internal int EntryId { get; } // Word dictionaries public string DeconjugatedMatchedText { get; } @@ -57,7 +57,7 @@ internal LookupResult( string? deconjugationProcess = null, string? kanjiComposition = null, string? kanjiStats = null, - int edictId = 0, + int entryId = 0, byte strokeCount = 0, byte kanjiGrade = byte.MaxValue, IDictionary>? pitchAccentDict = null @@ -70,7 +70,7 @@ internal LookupResult( PrimarySpelling = primarySpelling; Readings = readings; FormattedDefinitions = formattedDefinitions; - EdictId = edictId; + EntryId = entryId; AlternativeSpellings = alternativeSpellings; DeconjugationProcess = deconjugationProcess; PrimarySpellingOrthographyInfoList = primarySpellingOrthographyInfoList; diff --git a/JL.Core/Lookup/LookupUtils.cs b/JL.Core/Lookup/LookupUtils.cs index 626d38d5..7f3518be 100644 --- a/JL.Core/Lookup/LookupUtils.cs +++ b/JL.Core/Lookup/LookupUtils.cs @@ -427,6 +427,7 @@ private static LookupResult[] SortLookupResults(IEnumerable lookup ? index : int.MaxValue; }) + .ThenBy(static lookupResult => lookupResult.EntryId) .ToArray(); } @@ -963,7 +964,7 @@ private static List BuildJmdictResult( readings: jmdictResult.Readings, matchedText: wordResult.MatchedText, deconjugatedMatchedText: wordResult.DeconjugatedMatchedText, - edictId: jmdictResult.Id, + entryId: jmdictResult.Id, alternativeSpellings: jmdictResult.AlternativeSpellings, deconjugationProcess: LookupResultUtils.DeconjugationProcessesToText(wordResult.Processes?[i]), frequencies: GetWordFrequencies(jmdictResult, wordFreqs, frequencyDicts), @@ -1008,7 +1009,7 @@ private static List BuildJmnedictResult( LookupResult result = new ( - edictId: jmnedictRecord.Id, + entryId: jmnedictRecord.Id, primarySpelling: jmnedictRecord.PrimarySpelling, alternativeSpellings: jmnedictRecord.AlternativeSpellings, readings: jmnedictRecord.Readings, diff --git a/JL.Core/Mining/MiningUtils.cs b/JL.Core/Mining/MiningUtils.cs index 24ab8230..e5b932e4 100644 --- a/JL.Core/Mining/MiningUtils.cs +++ b/JL.Core/Mining/MiningUtils.cs @@ -196,8 +196,8 @@ public static class MiningUtils : null; case JLField.EdictId: - return lookupResult.EdictId > 0 - ? lookupResult.EdictId.ToString(CultureInfo.InvariantCulture) + return lookupResult.EntryId > 0 + ? lookupResult.EntryId.ToString(CultureInfo.InvariantCulture) : null; case JLField.DeconjugationProcess: @@ -481,9 +481,9 @@ private static Dictionary GetMiningParameters(LookupResult look : selectedDefinitions; } - if (lookupResult.EdictId > 0) + if (lookupResult.EntryId > 0) { - miningParams[JLField.EdictId] = lookupResult.EdictId.ToString(CultureInfo.InvariantCulture); + miningParams[JLField.EdictId] = lookupResult.EntryId.ToString(CultureInfo.InvariantCulture); } if (lookupResult.DeconjugationProcess is not null)