public void ExportVariantTypeInformation_LT9374() { CheckDisposed(); m_choices.Add(InterlinLineChoices.kflidWord); m_choices.Add(InterlinLineChoices.kflidMorphemes); m_choices.Add(InterlinLineChoices.kflidLexEntries); m_choices.Add(InterlinLineChoices.kflidLexGloss); m_choices.Add(InterlinLineChoices.kflidLexPos); XmlDocument exportedDoc = ExportToXml(); IStTxtPara para1 = m_text1.ContentsOA.ParagraphsOS[1] as IStTxtPara; ValidateExportedParagraph(exportedDoc, m_choices, para1); // Set alternate case endings. ParagraphAnnotator ta = new ParagraphAnnotator(para1); string formLexEntry = "go"; ITsString tssLexEntryForm = StringUtils.MakeTss(formLexEntry, Cache.DefaultVernWs); int clsidForm; ILexEntry leGo = LexEntry.CreateEntry(Cache, MoMorphType.FindMorphType(Cache, new MoMorphTypeCollection(Cache), ref formLexEntry, out clsidForm), tssLexEntryForm, "go.pst", null); ta.SetVariantOf(0, 1, leGo, "fr. var."); exportedDoc = this.ExportToXml(); ValidateExportedParagraph(exportedDoc, m_choices, para1); }
private ILexEntry MakeEntry(string form, string gloss) { ITsString tssLexEntryForm = Cache.MakeVernTss(form); string form1 = form; int clsidForm; return(LexEntry.CreateEntry(Cache, MoMorphType.FindMorphType(Cache, new MoMorphTypeCollection(Cache), ref form1, out clsidForm), tssLexEntryForm, gloss, null)); }
private void SetupLexEntryAndSense(string formLexEntry, string senseGloss, string partOfSpeech, out ILexEntry lexEntry1_Entry, out ILexSense lexEntry1_Sense1) { ITsString tssLexEntryForm = StringUtils.MakeTss(formLexEntry, Cache.DefaultVernWs); int clsidForm; // create a sense with a matching gloss DummyGenericMSA dummyMsa = new DummyGenericMSA(); int hvoSenseMsaPos = m_sandbox.GetComboItemHvo(InterlinLineChoices.kflidWordPos, 0, partOfSpeech); dummyMsa.MainPOS = hvoSenseMsaPos; lexEntry1_Entry = LexEntry.CreateEntry(Cache, MoMorphType.FindMorphType(Cache, new MoMorphTypeCollection(Cache), ref formLexEntry, out clsidForm), tssLexEntryForm, senseGloss, dummyMsa); lexEntry1_Sense1 = lexEntry1_Entry.SensesOS[0]; }
/// <summary> /// Make (two) monomorphemic analyses on our favorite wordform, connected to two entries, one with two glosses. /// </summary> private void MakeMonoAnalyses() { string formLexEntry = "axx"; ITsString tssLexEntryForm = Cache.MakeVernTss(formLexEntry); int clsidForm; ILexEntry entry = LexEntry.CreateEntry(Cache, MoMorphType.FindMorphType(Cache, new MoMorphTypeCollection(Cache), ref formLexEntry, out clsidForm), tssLexEntryForm, "axe", null); ILexSense senseAxe = entry.SensesOS[0]; IMoForm form = entry.LexemeFormOA; m_wfaAxe = new WfiAnalysis(); m_wfAxx.AnalysesOC.Add(m_wfaAxe); IWfiMorphBundle bundle = m_wfaAxe.MorphBundlesOS.Append(new WfiMorphBundle()); bundle.MorphRA = form; bundle.SenseRA = senseAxe; m_wgAxe = new WfiGloss(); m_wfaAxe.MeaningsOC.Add(m_wgAxe); m_wgAxe.Form.AnalysisDefaultWritingSystem = "axe"; m_wgChopper = new WfiGloss(); m_wfaAxe.MeaningsOC.Add(m_wgChopper); m_wgChopper.Form.AnalysisDefaultWritingSystem = "chopper"; m_wfaAxe.SetAgentOpinion(m_fdoCache.LangProject.DefaultUserAgent, Opinions.approves); ILexEntry entryCut = LexEntry.CreateEntry(Cache, MoMorphType.FindMorphType(Cache, new MoMorphTypeCollection(Cache), ref formLexEntry, out clsidForm), tssLexEntryForm, "cut", null); m_wfaCut = new WfiAnalysis(); m_wfAxx.AnalysesOC.Add(m_wfaCut); bundle = m_wfaCut.MorphBundlesOS.Append(new WfiMorphBundle()); bundle.MorphRA = entryCut.LexemeFormOA; bundle.SenseRA = entryCut.SensesOS[0]; m_wgCut = new WfiGloss(); m_wfaCut.MeaningsOC.Add(m_wgCut); m_wgCut.Form.AnalysisDefaultWritingSystem = "cut"; m_wfaCut.SetAgentOpinion(m_fdoCache.LangProject.DefaultUserAgent, Opinions.approves); m_cAnalyses += 2; }
public void NewGlossExistingLexEntryNewLexSense() { int hvoCba0_0 = GetCbaHvo(0, 0, 0); m_sandbox.SwitchWord(hvoCba0_0, false); string formLexEntry = "xxxa"; ITsString tssLexEntryForm = StringUtils.MakeTss(formLexEntry, Cache.DefaultVernWs); int clsidForm; ILexEntry lexEntry1_Entry = LexEntry.CreateEntry(Cache, MoMorphType.FindMorphType(Cache, new MoMorphTypeCollection(Cache), ref formLexEntry, out clsidForm), tssLexEntryForm, "xxxa.existingsense1", null); ILexSense lexEntry1_Sense1 = lexEntry1_Entry.SensesOS[0]; // mark the count of LexEntries int cEntriesOrig = Cache.LangProject.LexDbOA.EntriesOC.Count; // add a new word gloss ITsString tssWordGlossInSandbox = m_sandbox.SetTssInSandbox(InterlinLineChoices.kflidWordGloss, Cache.DefaultAnalWs, "0.0.xxxa"); int hvoWf = WfiWordform.GetWfiWordformFromInstanceOf(Cache, hvoCba0_0); WfiWordform wf = new WfiWordform(Cache, hvoWf); // set word pos, to first possibility (e.g. 'adjunct') int hvoSbWordPos = m_sandbox.SelectIndexInCombo(InterlinLineChoices.kflidWordPos, 0, 0); // confirm the analysis (making a real analysis and a LexSense) int hvoGloss = m_sandbox.ConfirmAnalysis(); WfiGloss wfiGloss = new WfiGloss(Cache, hvoGloss); // make sure we didn't add entries to the Lexicon. int cEntriesAfter = Cache.LangProject.LexDbOA.EntriesOC.Count; Assert.AreEqual(cEntriesOrig, cEntriesAfter); // confirm we have only one analysis and that it is monomorphemic WfiAnalysis wfiAnalysis = wfiGloss.Owner as WfiAnalysis; Assert.AreEqual(wf.Hvo, wfiAnalysis.OwnerHVO, "Expected confirmed analysis to be owned by the original wordform."); Assert.AreEqual(1, wf.AnalysesOC.Count); Assert.AreEqual(1, wfiAnalysis.MorphBundlesOS.Count); Assert.AreEqual(1, wfiAnalysis.MeaningsOC.Count); // make sure the strings of the wfi gloss matches the strings of the lex gloss. ValidateSenseWithAnalysis(m_sandbox.GetLexSenseForWord(), wfiGloss, hvoSbWordPos); }