Ejemplo n.º 1
0
        protected void AddAffixAllomorphToEntry(List <ICmObject> addList, ILexEntry le, string alloName,
                                                IPhEnvironment env)
        {
            var allomorph = m_affixFact.Create();

            le.AlternateFormsOS.Add(allomorph);
            if (env != null)
            {
                allomorph.PhoneEnvRC.Add(env);
            }
            allomorph.Form.set_String(Cache.DefaultVernWs, alloName);
            addList.Add(allomorph);
        }
Ejemplo n.º 2
0
        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);
        }