Exemplo n.º 1
0
        private WfiAnalysis Make2BundleAnalysis(string form1, string form2, string gloss1, string gloss2)
        {
            WfiAnalysis result;
            ILexEntry   entry1 = MakeEntry(form1, gloss1);
            ILexEntry   entry2 = MakeEntry(form2, gloss2);

            result = new WfiAnalysis();
            m_wfAxx.AnalysesOC.Add(result);
            IWfiMorphBundle bundle = result.MorphBundlesOS.Append(new WfiMorphBundle());

            bundle.MorphRA = entry1.LexemeFormOA;
            bundle.SenseRA = entry1.SensesOS[0];
            bundle         = result.MorphBundlesOS.Append(new WfiMorphBundle());
            bundle.MorphRA = entry2.LexemeFormOA;
            bundle.SenseRA = entry2.SensesOS[0];

            WfiGloss gloss = new WfiGloss();

            result.MeaningsOC.Add(gloss);
            gloss.Form.AnalysisDefaultWritingSystem = gloss1 + "." + gloss2;
            result.SetAgentOpinion(m_fdoCache.LangProject.DefaultUserAgent, Opinions.approves);

            m_cAnalyses++;

            return(result);
        }
Exemplo n.º 2
0
        public void SetAgentOpinion()
        {
            ICmAgent     agent = m_fdoCache.LangProject.DefaultComputerAgent;
            IWfiWordform wf    = new WfiWordform(m_fdoCache, WfiWordform.FindOrCreateWordform(m_fdoCache, "xxxyyyzzz12234", m_fdoCache.DefaultVernWs, true));
            IWfiAnalysis wa    = new WfiAnalysis();

            wf.AnalysesOC.Add(wa);
            ICmObject target = wa;             // can pick anything as target for evaluation!

            m_fdoCache.BeginUndoTask("doit", "undoit");
            wa.SetAgentOpinion(agent, Opinions.approves);
            m_fdoCache.EndUndoTask();
            Assert.AreEqual(Opinions.approves, wa.GetAgentOpinion(agent));
            m_fdoCache.Undo();
            Assert.AreEqual(Opinions.noopinion, wa.GetAgentOpinion(agent));
            m_fdoCache.Redo();
            Assert.AreEqual(Opinions.approves, wa.GetAgentOpinion(agent));

            m_fdoCache.BeginUndoTask("changeit", "unchangeit");
            wa.SetAgentOpinion(agent, Opinions.disapproves);
            m_fdoCache.EndUndoTask();
            Assert.AreEqual(Opinions.disapproves, wa.GetAgentOpinion(agent));
            m_fdoCache.Undo();
            Assert.AreEqual(Opinions.approves, wa.GetAgentOpinion(agent));
            m_fdoCache.Redo();
            Assert.AreEqual(Opinions.disapproves, wa.GetAgentOpinion(agent));

            m_fdoCache.BeginUndoTask("clearit", "unclearit");
            wa.SetAgentOpinion(agent, Opinions.noopinion);
            m_fdoCache.EndUndoTask();
            Assert.AreEqual(Opinions.noopinion, wa.GetAgentOpinion(agent));
            m_fdoCache.Undo();
            Assert.AreEqual(Opinions.disapproves, wa.GetAgentOpinion(agent));
            m_fdoCache.Redo();
            Assert.AreEqual(Opinions.noopinion, wa.GetAgentOpinion(agent));
        }
Exemplo n.º 3
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;
        }