protected void CreateMsaXmlElement(XmlNode node, XmlDocument doc, XmlNode morphNode, string sHvo) { XmlNode attr; // morphname contains the hvo of the msa attr = node.SelectSingleNode(sHvo); if (attr != null) { ICmObject obj = CmObject.CreateFromDBObject(m_cache, Convert.ToInt32(attr.Value)); switch (obj.GetType().Name) { default: throw new ApplicationException(String.Format("Invalid MSA type: {0}.", obj.GetType().Name)); case "MoStemMsa": IMoStemMsa stemMsa = obj as IMoStemMsa; CreateStemMsaXmlElement(doc, morphNode, stemMsa); break; case "MoInflAffMsa": IMoInflAffMsa inflMsa = obj as IMoInflAffMsa; CreateInflectionClasses(doc, morphNode); CreateInflMsaXmlElement(doc, morphNode, inflMsa); break; case "MoDerivAffMsa": IMoDerivAffMsa derivMsa = obj as IMoDerivAffMsa; CreateDerivMsaXmlElement(doc, morphNode, derivMsa); break; case "MoUnclassifiedAffixMsa": IMoUnclassifiedAffixMsa unclassMsa = obj as IMoUnclassifiedAffixMsa; CreateUnclassifedMsaXmlElement(doc, morphNode, unclassMsa); break; } } }
private static void WriteUnclassifedMsaXmlElement(XmlWriter writer, IMoUnclassifiedAffixMsa unclassMsa) { writer.WriteStartElement("unclassMsa"); WritePosXmlAttribute(writer, unclassMsa.PartOfSpeechRA, "fromCat"); writer.WriteEndElement(); //unclassMsa }
private static void WriteUnclassifedMsaXmlElement(XmlWriter writer, IMoUnclassifiedAffixMsa unclassMsa) { writer.WriteStartElement("unclassMsa"); WritePosXmlAttribute(writer, unclassMsa.PartOfSpeechRA, "fromCat"); writer.WriteEndElement(); //unclassMsa }
private void WriteMoUnclassifiedAffixMsa(TextWriter w, IMoUnclassifiedAffixMsa msa) { m_flidUnclAffixIsEmpty = m_cache.MetaDataCacheAccessor.GetFieldId("MoUnclassifiedAffixMsa", "IsEmpty", false); if (m_cache.DomainDataByFlid.get_BooleanProp(msa.Hvo, m_flidUnclAffixIsEmpty)) return; 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=\"affix\"/>"); WriteLiftResidue(w, msa); w.WriteLine("</grammatical-info>"); }
protected void CreateUnclassifedMsaXmlElement(XmlDocument doc, XmlNode morphNode, IMoUnclassifiedAffixMsa unclassMsa) { XmlNode unclassMsaNode = CreateXmlElement(doc, "unclassMsa", morphNode); CreatePOSXmlAttribute(doc, unclassMsaNode, unclassMsa.PartOfSpeechRA, "fromCat"); }
/// <summary> /// Constructor. /// </summary> private DummyGenericMSA(IMoUnclassifiedAffixMsa uncMsa) { m_type = MsaType.kUnclassified; m_mainPOS = uncMsa.PartOfSpeechRAHvo; }
protected void CreateUnclassifedMsaXmlElement(XmlDocument doc, XmlNode morphNode, IMoUnclassifiedAffixMsa unclassMsa) { XmlNode unclassMsaNode = CreateXmlElement(doc, "unclassMsa", morphNode); CreatePOSXmlAttribute(doc, unclassMsaNode, unclassMsa.PartOfSpeechRA, "fromCat"); }
protected void CreateMsaXmlElement(XmlNode node, XmlDocument doc, XmlNode morphNode, string sHvo) { XmlNode attr; // morphname contains the hvo of the msa attr = node.SelectSingleNode(sHvo); if (attr != null) { string sObjHvo = attr.Value; // Irregulary inflected forms can have a combination MSA hvo: the LexEntry hvo, a period, and an index to the LexEntryRef var indexOfPeriod = ParseFiler.IndexOfPeriodInMsaHvo(ref sObjHvo); ICmObject obj = m_cache.ServiceLocator.GetInstance <ICmObjectRepository>().GetObject(Convert.ToInt32(sObjHvo)); switch (obj.GetType().Name) { default: throw new ApplicationException(String.Format("Invalid MSA type: {0}.", obj.GetType().Name)); case "MoStemMsa": IMoStemMsa stemMsa = obj as IMoStemMsa; CreateStemMsaXmlElement(doc, morphNode, stemMsa); break; case "MoInflAffMsa": IMoInflAffMsa inflMsa = obj as IMoInflAffMsa; CreateInflectionClasses(doc, morphNode); CreateInflMsaXmlElement(doc, morphNode, inflMsa); break; case "MoDerivAffMsa": IMoDerivAffMsa derivMsa = obj as IMoDerivAffMsa; CreateDerivMsaXmlElement(doc, morphNode, derivMsa); break; case "MoUnclassifiedAffixMsa": IMoUnclassifiedAffixMsa unclassMsa = obj as IMoUnclassifiedAffixMsa; CreateUnclassifedMsaXmlElement(doc, morphNode, unclassMsa); break; case "LexEntry": // is an irregularly inflected form // get the MoStemMsa of its variant var entry = obj as ILexEntry; if (entry.EntryRefsOS.Count > 0) { var index = ParseFiler.IndexOfLexEntryRef(attr.Value, indexOfPeriod); var lexEntryRef = entry.EntryRefsOS[index]; var sense = FDO.DomainServices.MorphServices.GetMainOrFirstSenseOfVariant(lexEntryRef); stemMsa = sense.MorphoSyntaxAnalysisRA as IMoStemMsa; CreateStemMsaXmlElement(doc, morphNode, stemMsa); } break; case "LexEntryInflType": // This is one of the null allomorphs we create when building the // input for the parser in order to still get the Word Grammar to have something in any // required slots in affix templates. CreateInflMsaForLexEntryInflType(doc, morphNode, obj as ILexEntryInflType); break; } } }