private void WriteMoDerivStepMsa(TextWriter w, IMoDerivStepMsa msa) { if (String.IsNullOrEmpty(msa.PosFieldName)) w.WriteLine("<grammatical-info value=\"\">"); else w.WriteLine("<grammatical-info value=\"{0}\">", MakeSafeAndNormalizedAttribute(msa.PosFieldName)); w.WriteLine("<trait name=\"type\" value=\"derivStepAffix\"/>"); WriteLiftResidue(w, msa); w.WriteLine("</grammatical-info>"); }
private bool CheckForAffixDataLoss(IMoAffixForm affix, List <IMoMorphSynAnalysis> rgmsaAffix) { bool fLoseInflCls = affix.InflectionClassesRC.Count > 0; bool fLoseInfixLoc = false; bool fLoseGramInfo = false; bool fLoseRule = false; switch (affix.ClassID) { case MoAffixProcess.kclsidMoAffixProcess: fLoseRule = true; break; case MoAffixAllomorph.kclsidMoAffixAllomorph: IMoAffixAllomorph allo = affix as IMoAffixAllomorph; fLoseInfixLoc = allo.PositionRS.Count > 0; fLoseGramInfo = allo.MsEnvPartOfSpeechRAHvo != 0 || allo.MsEnvFeaturesOAHvo != 0; break; } for (int i = 0; !fLoseGramInfo && i < rgmsaAffix.Count; ++i) { IMoInflAffMsa msaInfl = rgmsaAffix[i] as IMoInflAffMsa; if (msaInfl != null) { if (msaInfl.AffixCategoryRAHvo != 0 || msaInfl.FromProdRestrictRC.Count > 0 || msaInfl.SlotsRC.Count > 0 || msaInfl.InflFeatsOAHvo != 0) { fLoseGramInfo = true; } continue; } IMoDerivAffMsa msaDeriv = rgmsaAffix[i] as IMoDerivAffMsa; if (msaDeriv != null) { if (msaDeriv.AffixCategoryRAHvo != 0 || msaDeriv.FromInflectionClassRAHvo != 0 || msaDeriv.FromPartOfSpeechRAHvo != 0 || msaDeriv.FromProdRestrictRC.Count > 0 || msaDeriv.FromStemNameRAHvo != 0 || msaDeriv.StratumRAHvo != 0 || msaDeriv.ToInflectionClassRAHvo != 0 || msaDeriv.ToProdRestrictRC.Count > 0 || msaDeriv.FromMsFeaturesOAHvo != 0 || msaDeriv.ToMsFeaturesOAHvo != 0) { fLoseGramInfo = true; } continue; } IMoDerivStepMsa msaStep = rgmsaAffix[i] as IMoDerivStepMsa; if (msaStep != null) { if (msaStep.InflectionClassRAHvo != 0 || msaStep.ProdRestrictRC.Count > 0 || msaStep.InflFeatsOAHvo != 0 || msaStep.MsFeaturesOAHvo != 0) { fLoseGramInfo = true; } continue; } } if (fLoseInflCls || fLoseInfixLoc || fLoseGramInfo || fLoseRule) { string sMsg; if (fLoseInflCls && fLoseInfixLoc && fLoseGramInfo) { sMsg = m_mediator.StringTbl.GetStringWithXPath("ChangeMorphTypeLoseInflClsInfixLocGramInfo", m_ksPath); } else if (fLoseRule && fLoseInflCls && fLoseGramInfo) { sMsg = m_mediator.StringTbl.GetStringWithXPath("ChangeMorphTypeLoseRuleInflClsGramInfo", m_ksPath); } else if (fLoseInflCls && fLoseInfixLoc) { sMsg = m_mediator.StringTbl.GetStringWithXPath("ChangeMorphTypeLoseInflClsInfixLoc", m_ksPath); } else if (fLoseInflCls && fLoseGramInfo) { sMsg = m_mediator.StringTbl.GetStringWithXPath("ChangeMorphTypeLoseInflClsGramInfo", m_ksPath); } else if (fLoseInfixLoc && fLoseGramInfo) { sMsg = m_mediator.StringTbl.GetStringWithXPath("ChangeMorphTypeLoseInfixLocGramInfo", m_ksPath); } else if (fLoseRule && fLoseInflCls) { sMsg = m_mediator.StringTbl.GetStringWithXPath("ChangeMorphTypeLoseRuleInflCls", m_ksPath); } else if (fLoseRule) { sMsg = m_mediator.StringTbl.GetStringWithXPath("ChangeMorphTypeLoseRule", m_ksPath); } else if (fLoseInflCls) { sMsg = m_mediator.StringTbl.GetStringWithXPath("ChangeMorphTypeLoseInflCls", m_ksPath); } else if (fLoseInfixLoc) { sMsg = m_mediator.StringTbl.GetStringWithXPath("ChangeMorphTypeLoseInfixLoc", m_ksPath); } else { sMsg = m_mediator.StringTbl.GetStringWithXPath("ChangeMorphTypeLoseGramInfo", m_ksPath); } string sCaption = m_mediator.StringTbl.GetStringWithXPath("ChangeLexemeMorphTypeCaption", m_ksPath); DialogResult result = MessageBox.Show(sMsg, sCaption, MessageBoxButtons.YesNo, MessageBoxIcon.Warning); if (result == DialogResult.No) { return(true); } } return(false); }
/// <summary> /// Constructor. /// </summary> private DummyGenericMSA(IMoDerivStepMsa stepMsa) { Debug.Assert(false, "Step MSAs are not supported yet."); /* m_type; m_mainPOS; m_secondaryPOS; m_slot; */ }