diff --git a/Build/mkall.targets b/Build/mkall.targets index 5d9d4a5aa8..298ba3c581 100644 --- a/Build/mkall.targets +++ b/Build/mkall.targets @@ -285,7 +285,7 @@ 5.2.0-beta0003 13.0.0-beta0076 9.4.0.1-beta - 11.0.0-beta0087 + 11.0.0-beta0089 70.1.123 2.5.13 diff --git a/Build/nuget-common/packages.config b/Build/nuget-common/packages.config index e2d0b27894..e0e5d9a534 100644 --- a/Build/nuget-common/packages.config +++ b/Build/nuget-common/packages.config @@ -52,15 +52,15 @@ - - - - - - - - - + + + + + + + + + diff --git a/Src/LexText/Interlinear/ChooseAnalysisHander.cs b/Src/LexText/Interlinear/ChooseAnalysisHander.cs index 7a5803b28d..bdb5f82c6f 100644 --- a/Src/LexText/Interlinear/ChooseAnalysisHander.cs +++ b/Src/LexText/Interlinear/ChooseAnalysisHander.cs @@ -25,6 +25,7 @@ internal class ChooseAnalysisHandler : IComboHandler, IDisposable { int m_hvoAnalysis; // The current 'analysis', may be wordform, analysis, gloss. int m_hvoSrc; // the object (CmAnnotation? or SbWordform) we're analyzing. + AnalysisOccurrence m_occurrence; bool m_fInitializing = false; // true to suppress AnalysisChosen while setting up combo. LcmCache m_cache; IComboList m_combo; @@ -110,12 +111,13 @@ internal IVwStylesheet StyleSheet /// /// /// - public ChooseAnalysisHandler(LcmCache cache, int hvoSrc, int hvoAnalysis, IComboList comboList) + public ChooseAnalysisHandler(LcmCache cache, int hvoSrc, int hvoAnalysis, AnalysisOccurrence occurrence, IComboList comboList) { m_combo = comboList; m_cache = cache; m_hvoSrc = hvoSrc; m_hvoAnalysis = hvoAnalysis; + m_occurrence = occurrence; m_combo.SelectedIndexChanged += new EventHandler(m_combo_SelectedIndexChanged); m_combo.WritingSystemFactory = cache.LanguageWritingSystemFactoryAccessor; } @@ -280,7 +282,9 @@ public void SetupCombo() var wordform = m_owner.GetWordformOfAnalysis(); // Add the analyses, and recursively the other items. - foreach (var wa in wordform.AnalysesOC) + var guess_services = new AnalysisGuessServices(m_cache); + var sorted_analyses = guess_services.GetSortedAnalysisGuesses(wordform, m_occurrence, false); + foreach (var wa in sorted_analyses) { Opinions o = wa.GetAgentOpinion( m_cache.LangProject.DefaultUserAgent); @@ -307,7 +311,9 @@ void AddAnalysisItems(IWfiAnalysis wa) { AddItem(wa, MakeAnalysisStringRep(wa, m_cache, StyleSheet != null, (m_owner as SandboxBase).RawWordformWs), true); - foreach (var gloss in wa.MeaningsOC) + var guess_services = new AnalysisGuessServices(m_cache); + var sorted_glosses = guess_services.GetSortedGlossGuesses(wa, m_occurrence); + foreach (var gloss in sorted_glosses) { AddItem(gloss, MakeGlossStringRep(gloss, m_cache, StyleSheet != null), true); } diff --git a/Src/LexText/Interlinear/ITextDllTests/InterlinearExporterTests.cs b/Src/LexText/Interlinear/ITextDllTests/InterlinearExporterTests.cs index bbc1103610..0ca1284a67 100644 --- a/Src/LexText/Interlinear/ITextDllTests/InterlinearExporterTests.cs +++ b/Src/LexText/Interlinear/ITextDllTests/InterlinearExporterTests.cs @@ -234,10 +234,11 @@ public void ExportBasicInformation_FormSansMorph() //validate export xml against schema ValidateInterlinearXml(exportedDoc); - AssertThatXmlIn.Dom(exportedDoc).HasSpecifiedNumberOfMatchesForXpath($@"//word[item[@type='txt' and @lang='{QaaXKal}']='gone']", 1); - AssertThatXmlIn.Dom(exportedDoc).HasSpecifiedNumberOfMatchesForXpath($@"//morph[item[@type='txt' and @lang='{QaaXKal}']]", 2); - AssertThatXmlIn.Dom(exportedDoc).HasSpecifiedNumberOfMatchesForXpath($@"//morph[item[@type='txt' and @lang='{QaaXKal}']='go']", 1); AssertThatXmlIn.Dom(exportedDoc).HasSpecifiedNumberOfMatchesForXpath($@"//morph[item[@type='txt' and @lang='{QaaXKal}']='en']", 1); + AssertThatXmlIn.Dom(exportedDoc).HasSpecifiedNumberOfMatchesForXpath($@"//word[item[@type='txt' and @lang='{QaaXKal}']='gone']", 1); + // The guesser adds an analysis for "go". + AssertThatXmlIn.Dom(exportedDoc).HasSpecifiedNumberOfMatchesForXpath($@"//morph[item[@type='txt' and @lang='{QaaXKal}']='go']", 2); + AssertThatXmlIn.Dom(exportedDoc).HasSpecifiedNumberOfMatchesForXpath($@"//morph[item[@type='txt' and @lang='{QaaXKal}']]", 3); } /// @@ -448,7 +449,8 @@ public void ExportVariantTypeInformation_LT9374() ValidateInterlinearXml(exportedDoc); AssertThatXmlIn.Dom(exportedDoc).HasSpecifiedNumberOfMatchesForXpath(@"//word[item[@type='txt']='went']", 1); AssertThatXmlIn.Dom(exportedDoc).HasSpecifiedNumberOfMatchesForXpath(@"//morph[item[@type='txt']='went']", 1); - AssertThatXmlIn.Dom(exportedDoc).HasSpecifiedNumberOfMatchesForXpath(@"//morph[item[@type='cf']='go']", 1); + // The guesser adds an analysis for "go". + AssertThatXmlIn.Dom(exportedDoc).HasSpecifiedNumberOfMatchesForXpath(@"//morph[item[@type='cf']='go']", 2); AssertThatXmlIn.Dom(exportedDoc).HasSpecifiedNumberOfMatchesForXpath(@"//morph/item[@type='variantTypes']", 1); AssertThatXmlIn.Dom(exportedDoc).HasSpecifiedNumberOfMatchesForXpath(@"//morph[item[@type='variantTypes']='+fr. var.']", 1); AssertThatXmlIn.Dom(exportedDoc).HasSpecifiedNumberOfMatchesForXpath(@"//morph[item[@type='gls']='go.PST']", 1); @@ -597,7 +599,8 @@ public void ExportIrrInflVariantTypeInformation_LT7581_glsAppend() ValidateInterlinearXml(exportedDoc); AssertThatXmlIn.Dom(exportedDoc).HasSpecifiedNumberOfMatchesForXpath(@"//morph[item[@type='txt']='went']", 1); - AssertThatXmlIn.Dom(exportedDoc).HasSpecifiedNumberOfMatchesForXpath(@"//morph[item[@type='cf']='go']", 1); + // The guesser adds an analysis for "go". + AssertThatXmlIn.Dom(exportedDoc).HasSpecifiedNumberOfMatchesForXpath(@"//morph[item[@type='cf']='go']", 2); AssertThatXmlIn.Dom(exportedDoc).HasSpecifiedNumberOfMatchesForXpath(@"//morph[item[@type='gls']='glossgo']", 1); AssertThatXmlIn.Dom(exportedDoc).HasSpecifiedNumberOfMatchesForXpath(@"//morph/item[@type='glsAppend']", 1); AssertThatXmlIn.Dom(exportedDoc).HasSpecifiedNumberOfMatchesForXpath(@"//morph[item[@type='glsAppend']='.pst']", 1); diff --git a/Src/LexText/Interlinear/SandboxBase.ComboHandlers.cs b/Src/LexText/Interlinear/SandboxBase.ComboHandlers.cs index 2e67245d57..1e2767dbcd 100644 --- a/Src/LexText/Interlinear/SandboxBase.ComboHandlers.cs +++ b/Src/LexText/Interlinear/SandboxBase.ComboHandlers.cs @@ -346,7 +346,7 @@ private static IComboHandler MakeCombo(IHelpTopicProvider helpTopicProvider, ComboListBox clb2 = new ComboListBox(); clb2.StyleSheet = sandbox.StyleSheet; ChooseAnalysisHandler caHandler = new ChooseAnalysisHandler( - caches.MainCache, hvoSbWord, sandbox.Analysis, clb2); + caches.MainCache, hvoSbWord, sandbox.Analysis, sandbox.m_occurrenceSelected, clb2); caHandler.Owner = sandbox; caHandler.AnalysisChosen += new EventHandler( sandbox.Handle_AnalysisChosen); @@ -1125,7 +1125,9 @@ private void AddAnalysesOf(IWfiWordform wordform, bool fBaseWordIsPhrase) return; // no real wordform, can't have analyses. ITsStrBldr builder = TsStringUtils.MakeStrBldr(); ITsString space = TsStringUtils.MakeString(fBaseWordIsPhrase ? " " : " ", m_wsVern); - foreach (IWfiAnalysis wa in wordform.AnalysesOC) + var guess_services = new AnalysisGuessServices(m_caches.MainCache); + var sorted_analyses = guess_services.GetSortedAnalysisGuesses(wordform, m_wsVern); + foreach (IWfiAnalysis wa in sorted_analyses) { Opinions o = wa.GetAgentOpinion( m_caches.MainCache.LangProject.DefaultUserAgent); @@ -3195,7 +3197,10 @@ public override void SetupCombo() private void AddComboItems(ref int hvoEmptyGloss, ITsStrBldr tsb, IWfiAnalysis wa) { IList wsids = m_sandbox.m_choices.EnabledWritingSystemsForFlid(InterlinLineChoices.kflidWordGloss); - foreach (IWfiGloss gloss in wa.MeaningsOC) + + var guess_services = new AnalysisGuessServices(m_caches.MainCache); + var sorted_glosses = guess_services.GetSortedGlossGuesses(wa); + foreach (IWfiGloss gloss in sorted_glosses) { int glossCount = 0;