public void VectorCount() { ILexEntryFactory factory = Cache.ServiceLocator.GetInstance <ILexEntryFactory>(); factory.Create(); ILexEntry entry = factory.Create(); Assert.AreEqual(0, entry.AlternateFormsOS.Count); entry.Delete(); Assert.IsTrue(0 < Cache.LanguageProject.LexDbOA.Entries.Count()); }
protected ILexEntry AddLexeme(List <ICmObject> addList, string lexForm, IMoMorphType morphTypePoss, string gloss, IPartOfSpeech categoryPoss) { var msa = new SandboxGenericMSA { MainPOS = categoryPoss }; var comp = new LexEntryComponents { MorphType = morphTypePoss, MSA = msa }; comp.GlossAlternatives.Add(m_tssFact.MakeString(gloss, Cache.DefaultAnalWs)); comp.LexemeFormAlternatives.Add(m_tssFact.MakeString(lexForm, Cache.DefaultVernWs)); var entry = m_entryFact.Create(comp); addList.Add(entry); return(entry); }
private ILexEntry MakeEntryWithForm(string form) { var entry = m_entryFactory.Create(); entry.LexemeFormOA = Cache.ServiceLocator.GetInstance <IMoStemAllomorphFactory>().Create(); entry.LexemeFormOA.Form.VernacularDefaultWritingSystem = TsStringUtils.MakeString( form, Cache.DefaultVernWs); return(entry); }
private ILexEntry CreateSimpleEntry(string form, string gloss) { var lexAlt = TsStringUtils.MakeString(form, m_wsVern); var glossAlt = TsStringUtils.MakeString(gloss, m_wsAnalysis); var msa = new SandboxGenericMSA { MainPOS = m_noun, MsaType = MsaType.kStem }; var leComp = new LexEntryComponents { MSA = msa, MorphType = m_stem }; leComp.GlossAlternatives.Add(glossAlt); leComp.LexemeFormAlternatives.Add(lexAlt); var entry = m_leFact.Create(leComp); return(entry); }
private ILexEntry MakeEntry() { var entry = m_entryFactory.Create(); return(entry); }
public void TwoAnalyses() { IWfiWordform catsTest = CheckAnalysisSize("catsTEST", 0, true); ILexDb ldb = Cache.LanguageProject.LexDbOA; ParseResult result = null; UndoableUnitOfWorkHelper.Do("Undo stuff", "Redo stuff", m_actionHandler, () => { // Noun ILexEntry catN = m_entryFactory.Create(); IMoStemAllomorph catNForm = m_stemAlloFactory.Create(); catN.AlternateFormsOS.Add(catNForm); catNForm.Form.VernacularDefaultWritingSystem = Cache.TsStrFactory.MakeString("catNTEST", m_vernacularWS.Handle); IMoStemMsa catNMsa = m_stemMsaFactory.Create(); catN.MorphoSyntaxAnalysesOC.Add(catNMsa); ILexEntry sPl = m_entryFactory.Create(); IMoAffixAllomorph sPlForm = m_afxAlloFactory.Create(); sPl.AlternateFormsOS.Add(sPlForm); sPlForm.Form.VernacularDefaultWritingSystem = Cache.TsStrFactory.MakeString("sPLTEST", m_vernacularWS.Handle); IMoInflAffMsa sPlMsa = m_inflAffMsaFactory.Create(); sPl.MorphoSyntaxAnalysesOC.Add(sPlMsa); // Verb ILexEntry catV = m_entryFactory.Create(); IMoStemAllomorph catVForm = m_stemAlloFactory.Create(); catV.AlternateFormsOS.Add(catVForm); catVForm.Form.VernacularDefaultWritingSystem = Cache.TsStrFactory.MakeString("catVTEST", m_vernacularWS.Handle); IMoStemMsa catVMsa = m_stemMsaFactory.Create(); catV.MorphoSyntaxAnalysesOC.Add(catVMsa); ILexEntry sAgr = m_entryFactory.Create(); IMoAffixAllomorph sAgrForm = m_afxAlloFactory.Create(); sAgr.AlternateFormsOS.Add(sAgrForm); sAgrForm.Form.VernacularDefaultWritingSystem = Cache.TsStrFactory.MakeString("sAGRTEST", m_vernacularWS.Handle); IMoInflAffMsa sAgrMsa = m_inflAffMsaFactory.Create(); sAgr.MorphoSyntaxAnalysesOC.Add(sAgrMsa); result = new ParseResult(new[] { new ParseAnalysis(new[] { new ParseMorph(catNForm, catNMsa), new ParseMorph(sPlForm, sPlMsa) }), new ParseAnalysis(new[] { new ParseMorph(catVForm, catVMsa), new ParseMorph(sAgrForm, sAgrMsa) }) }); }); m_filer.ProcessParse(catsTest, ParserPriority.Low, result); ExecuteIdleQueue(); CheckAnalysisSize("catsTEST", 2, false); }
public void TwoAnalyses() { var catsTEST = CheckAnalysisSize("catsTEST", 0, true); var ldb = Cache.LanguageProject.LexDbOA; string xmlFragment = null; UndoableUnitOfWorkHelper.Do("Undo stuff", "Redo stuff", m_actionHandler, () => { // Noun var catN = m_entryFactory.Create(); var catNForm = m_stemAlloFactory.Create(); catN.AlternateFormsOS.Add(catNForm); catNForm.Form.VernacularDefaultWritingSystem = Cache.TsStrFactory.MakeString("catNTEST", m_vernacularWS.Handle); var catNMSA = m_stemMsaFactory.Create(); catN.MorphoSyntaxAnalysesOC.Add(catNMSA); var sPL = m_entryFactory.Create(); var sPLForm = m_afxAlloFactory.Create(); sPL.AlternateFormsOS.Add(sPLForm); sPLForm.Form.VernacularDefaultWritingSystem = Cache.TsStrFactory.MakeString("sPLTEST", m_vernacularWS.Handle); var sPLMSA = m_inflAffMsaFactory.Create(); sPL.MorphoSyntaxAnalysesOC.Add(sPLMSA); // Verb var catV = m_entryFactory.Create(); var catVForm = m_stemAlloFactory.Create(); catV.AlternateFormsOS.Add(catVForm); catVForm.Form.VernacularDefaultWritingSystem = Cache.TsStrFactory.MakeString("catVTEST", m_vernacularWS.Handle); var catVMSA = m_stemMsaFactory.Create(); catV.MorphoSyntaxAnalysesOC.Add(catVMSA); var sAGR = m_entryFactory.Create(); var sAGRForm = m_afxAlloFactory.Create(); sAGR.AlternateFormsOS.Add(sAGRForm); sAGRForm.Form.VernacularDefaultWritingSystem = Cache.TsStrFactory.MakeString("sAGRTEST", m_vernacularWS.Handle); var sAGRMSA = m_inflAffMsaFactory.Create(); sAGR.MorphoSyntaxAnalysesOC.Add(sAGRMSA); xmlFragment = "<Wordform DbRef='" + catsTEST.Hvo + "' Form='catsTEST'>" + Environment.NewLine + "<WfiAnalysis>" + Environment.NewLine + "<Morphs>" + Environment.NewLine + "<Morph>" + Environment.NewLine + "<MoForm DbRef='" + catNForm.Hvo + "' Label='catNTEST'/>" + Environment.NewLine + "<MSI DbRef='" + catNMSA.Hvo + "'/>" + Environment.NewLine + "</Morph>" + Environment.NewLine + "<Morph>" + Environment.NewLine + "<MoForm DbRef='" + sPLForm.Hvo + "' Label='sPLTEST'/>" + Environment.NewLine + "<MSI DbRef='" + sPLMSA.Hvo + "'/>" + Environment.NewLine + "</Morph>" + Environment.NewLine + "</Morphs>" + Environment.NewLine + "</WfiAnalysis>" + Environment.NewLine + "<WfiAnalysis>" + Environment.NewLine + "<Morphs>" + Environment.NewLine + "<Morph>" + Environment.NewLine + "<MoForm DbRef='" + catVForm.Hvo + "' Label='catVTEST'/>" + Environment.NewLine + "<MSI DbRef='" + catVMSA.Hvo + "'/>" + Environment.NewLine + "</Morph>" + Environment.NewLine + "<Morph>" + Environment.NewLine + "<MoForm DbRef='" + sAGRForm.Hvo + "' Label='sAGRTEST'/>" + Environment.NewLine + "<MSI DbRef='" + sAGRMSA.Hvo + "'/>" + Environment.NewLine + "</Morph>" + Environment.NewLine + "</Morphs>" + Environment.NewLine + "</WfiAnalysis>" + Environment.NewLine + "</Wordform>" + Environment.NewLine; }); m_filer.ProcessParse(ParserPriority.Low, xmlFragment, 0); ExecuteIdleQueue(); CheckAnalysisSize("catsTEST", 2, false); }