diff --git a/Src/LexText/Interlinear/ITextDllTests/InterlinearExporterTests.cs b/Src/LexText/Interlinear/ITextDllTests/InterlinearExporterTests.cs index 0ca1284a67..d3fb24c376 100644 --- a/Src/LexText/Interlinear/ITextDllTests/InterlinearExporterTests.cs +++ b/Src/LexText/Interlinear/ITextDllTests/InterlinearExporterTests.cs @@ -237,6 +237,7 @@ public void ExportBasicInformation_FormSansMorph() 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($@"//morphemes[@analysisStatus='guess']", 1); 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); } @@ -450,6 +451,7 @@ public void ExportVariantTypeInformation_LT9374() AssertThatXmlIn.Dom(exportedDoc).HasSpecifiedNumberOfMatchesForXpath(@"//word[item[@type='txt']='went']", 1); AssertThatXmlIn.Dom(exportedDoc).HasSpecifiedNumberOfMatchesForXpath(@"//morph[item[@type='txt']='went']", 1); // The guesser adds an analysis for "go". + AssertThatXmlIn.Dom(exportedDoc).HasSpecifiedNumberOfMatchesForXpath($@"//morphemes[@analysisStatus='guess']", 1); 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); @@ -600,6 +602,7 @@ public void ExportIrrInflVariantTypeInformation_LT7581_glsAppend() AssertThatXmlIn.Dom(exportedDoc).HasSpecifiedNumberOfMatchesForXpath(@"//morph[item[@type='txt']='went']", 1); // The guesser adds an analysis for "go". + AssertThatXmlIn.Dom(exportedDoc).HasSpecifiedNumberOfMatchesForXpath($@"//morphemes[@analysisStatus='guess']", 1); 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); diff --git a/Src/LexText/Interlinear/InterlinVc.cs b/Src/LexText/Interlinear/InterlinVc.cs index 16ebcc3e8f..1fcddda4d9 100644 --- a/Src/LexText/Interlinear/InterlinVc.cs +++ b/Src/LexText/Interlinear/InterlinVc.cs @@ -101,6 +101,7 @@ public class InterlinVc : FwBaseVc, IDisposable internal const int ktagSegmentFree = -61; internal const int ktagSegmentLit = -62; internal const int ktagSegmentNote = -63; + internal const int ktagGuessedAnalysis = -64; // flids for paragraph annotation sequences. internal int ktagSegmentForms; @@ -1821,6 +1822,8 @@ private void DisplayMorphemes() bool isHumanGuess = m_this.Decorator.get_IntProp(m_hvoDefault, InterlinViewDataCache.OpinionAgentFlid) != (int) AnalysisGuessServices.OpinionAgent.Parser; m_this.SetGuessing(m_vwenv, isHumanGuess ? ApprovedGuessColor : MachineGuessColor); + // Let the exporter know that this is a guessed analysis. + m_vwenv.AddProp(ktagGuessedAnalysis, m_this, 0); } m_vwenv.AddObj(m_hvoDefault, m_this, kfragAnalysisMorphs); } @@ -1835,6 +1838,8 @@ private void DisplayMorphemes() { // Real analysis is just word, one we're displaying is a default m_this.SetGuessing(m_vwenv); + // Let the exporter know that this is a guessed analysis. + m_vwenv.AddProp(ktagGuessedAnalysis, m_this, 0); } m_vwenv.AddObj(m_hvoWfiAnalysis, m_this, kfragAnalysisMorphs); } diff --git a/Src/LexText/Interlinear/InterlinearExporter.cs b/Src/LexText/Interlinear/InterlinearExporter.cs index d64e453696..9d7c4b8e6b 100644 --- a/Src/LexText/Interlinear/InterlinearExporter.cs +++ b/Src/LexText/Interlinear/InterlinearExporter.cs @@ -33,6 +33,7 @@ public class InterlinearExporter : CollectorEnv bool m_fDoingInterlinName = false; // true during MSA bool m_fDoingGlossPrepend = false; // true after special AddProp bool m_fDoingGlossAppend = false; // true after special AddProp + bool m_fDoingGuessedAnalysis = false; // true after special AddProp string m_sPendingPrefix; // got a prefix, need the ws from the form itself before we write it. string m_sFreeAnnotationType; ITsString m_tssPendingHomographNumber; @@ -388,6 +389,11 @@ public override void AddObj(int hvoItem, IVwViewConstructor vc, int frag) public override void AddProp(int tag, IVwViewConstructor vc, int frag) { + if (tag == InterlinVc.ktagGuessedAnalysis) + { + m_fDoingGuessedAnalysis = true; + return; + } if (tag == InterlinVc.ktagGlossPrepend) { m_fDoingGlossPrepend = true; @@ -602,10 +608,16 @@ public override void AddObjVecItems(int tag, IVwViewConstructor vc, int frag) break; case InterlinVc.kfragMorphBundle: m_writer.WriteStartElement("morphemes"); + if (m_fDoingGuessedAnalysis) + { + m_writer.WriteAttributeString("analysisStatus", "guess"); + } break; default: break; } + // Clear here instead of above just to make sure it gets cleared. + m_fDoingGuessedAnalysis = false; base.AddObjVecItems (tag, vc, frag); switch(frag) {