From 743f4064bab0d2b096c1c16e144782f614cd3de8 Mon Sep 17 00:00:00 2001 From: John Maxwell Date: Wed, 19 Jun 2024 11:20:41 -0700 Subject: [PATCH 1/2] Fix LT-21810 --- Src/LexText/ParserCore/ParserWorker.cs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Src/LexText/ParserCore/ParserWorker.cs b/Src/LexText/ParserCore/ParserWorker.cs index e2eb769b62..c3ffee2e6b 100644 --- a/Src/LexText/ParserCore/ParserWorker.cs +++ b/Src/LexText/ParserCore/ParserWorker.cs @@ -178,8 +178,10 @@ public bool UpdateWordform(IWfiWordform wordform, ParserPriority priority) if (lcResult.Analyses.Count > 0 && lcResult.ErrorMessage == null) { var text = TsStringUtils.MakeString(sLower, form.get_WritingSystem(0)); - var lcWordform = WfiWordformServices.FindOrCreateWordform(m_cache, text); - m_parseFiler.ProcessParse(lcWordform, priority, lcResult); + IWfiWordform lcWordform; + // We cannot use WfiWordformServices.FindOrCreateWordform because of props change (LT-21810). + if (m_cache.ServiceLocator.GetInstance().TryGetObject(text, out lcWordform)) + m_parseFiler.ProcessParse(lcWordform, priority, lcResult); m_parseFiler.ProcessParse(wordform, priority, result); return true; } From ac1e42df38222c27263db1545d65d0c69f749a5e Mon Sep 17 00:00:00 2001 From: John Maxwell Date: Wed, 19 Jun 2024 11:37:30 -0700 Subject: [PATCH 2/2] Suppress parsing of lowercase words that don't exist --- Src/LexText/ParserCore/ParserWorker.cs | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/Src/LexText/ParserCore/ParserWorker.cs b/Src/LexText/ParserCore/ParserWorker.cs index c3ffee2e6b..d75abd6f16 100644 --- a/Src/LexText/ParserCore/ParserWorker.cs +++ b/Src/LexText/ParserCore/ParserWorker.cs @@ -172,18 +172,21 @@ public bool UpdateWordform(IWfiWordform wordform, ParserPriority priority) if (sLower != form.Text) { - var lcResult = m_parser.ParseWord( - CustomIcu.GetIcuNormalizer(FwNormalizationMode.knmNFD) - .Normalize(sLower.Replace(' ', '.'))); - if (lcResult.Analyses.Count > 0 && lcResult.ErrorMessage == null) + var text = TsStringUtils.MakeString(sLower, form.get_WritingSystem(0)); + IWfiWordform lcWordform; + // We cannot use WfiWordformServices.FindOrCreateWordform because of props change (LT-21810). + // Only parse the lowercase version if it exists. + if (m_cache.ServiceLocator.GetInstance().TryGetObject(text, out lcWordform)) { - var text = TsStringUtils.MakeString(sLower, form.get_WritingSystem(0)); - IWfiWordform lcWordform; - // We cannot use WfiWordformServices.FindOrCreateWordform because of props change (LT-21810). - if (m_cache.ServiceLocator.GetInstance().TryGetObject(text, out lcWordform)) + var lcResult = m_parser.ParseWord( + CustomIcu.GetIcuNormalizer(FwNormalizationMode.knmNFD) + .Normalize(sLower.Replace(' ', '.'))); + if (lcResult.Analyses.Count > 0 && lcResult.ErrorMessage == null) + { m_parseFiler.ProcessParse(lcWordform, priority, lcResult); - m_parseFiler.ProcessParse(wordform, priority, result); - return true; + m_parseFiler.ProcessParse(wordform, priority, result); + return true; + } } }