/// <summary> /// Add a MoInflClass to the collection. /// </summary> /// <param name="ic">The MoInflClass to add.</param> public IMoInflClass Add(IMoInflClass ic) { Debug.Assert(ic != null); IMoInflClass icAdd = (IMoInflClass)ValidateObject(ic); List.Add(icAdd); return(icAdd); }
/// <summary> /// are there any sub items for this item? /// </summary> /// <returns></returns> public override bool GetHaveSubItems() { m_ic = (IMoInflClass)CmObject.CreateFromDBObject(m_cache, m_hvo); if (m_ic == null) { return(false); } return(m_ic.SubclassesOC.Count > 0); }
private static void WriteInflectionClassXmlAttribute(XmlWriter writer, IMoInflClass inflClass, string sInflClass) { if (inflClass != null) { writer.WriteAttributeString(sInflClass, inflClass.Hvo.ToString(CultureInfo.InvariantCulture)); writer.WriteAttributeString(sInflClass + "Abbr", inflClass.Hvo > 0 ? inflClass.Abbreviation.BestAnalysisAlternative.Text : ""); } else { writer.WriteAttributeString(sInflClass, "0"); } }
private static void WriteStemMsaXmlElement(XmlWriter writer, IMoStemMsa stemMsa, IEnumerable <ILexEntryRef> variantEntryRefs) { writer.WriteStartElement("stemMsa"); WritePosXmlAttribute(writer, stemMsa.PartOfSpeechRA, "cat"); IMoInflClass inflClass = stemMsa.InflectionClassRA; if (inflClass == null) { // use default inflection class of the POS or // the first ancestor POS that has a non-zero default inflection class int inflClassHvo = 0; IPartOfSpeech pos = stemMsa.PartOfSpeechRA; while (pos != null && inflClassHvo == 0) { if (pos.DefaultInflectionClassRA != null) { inflClassHvo = pos.DefaultInflectionClassRA.Hvo; } else { int clsid = stemMsa.Services.GetInstance <ICmObjectRepository>().GetObject(pos.Owner.Hvo).ClassID; pos = clsid == PartOfSpeechTags.kClassId ? stemMsa.Services.GetInstance <IPartOfSpeechRepository>().GetObject(pos.Owner.Hvo) : null; } } if (inflClassHvo != 0) { inflClass = stemMsa.Services.GetInstance <IMoInflClassRepository>().GetObject(inflClassHvo); } } WriteInflectionClassXmlAttribute(writer, inflClass, "inflClass"); WriteRequiresInflectionXmlAttribute(writer, stemMsa.PartOfSpeechRA); WriteFeatureStructureNodes(writer, stemMsa.MsFeaturesOA, stemMsa.Hvo); WriteProductivityRestrictionNodes(writer, stemMsa.ProdRestrictRC, "productivityRestriction"); WriteFromPosNodes(writer, stemMsa.FromPartsOfSpeechRC, "fromPartsOfSpeech"); foreach (ILexEntryRef entryRef in variantEntryRefs) { foreach (ILexEntryType lexEntryType in entryRef.VariantEntryTypesRS) { var inflEntryType = lexEntryType as ILexEntryInflType; if (inflEntryType != null) { WriteFeatureStructureNodes(writer, inflEntryType.InflFeatsOA, stemMsa.Hvo); } } } writer.WriteEndElement(); //stemMsa }
protected void CreateStemMsaXmlElement(XmlDocument doc, XmlNode morphNode, IMoStemMsa stemMsa) { XmlNode stemMsaNode = CreateXmlElement(doc, "stemMsa", morphNode); CreatePOSXmlAttribute(doc, stemMsaNode, stemMsa.PartOfSpeechRA, "cat"); IMoInflClass inflClass = stemMsa.InflectionClassRA; if (inflClass == null) { // use default inflection class of the POS or // the first ancestor POS that has a non-zero default inflection class int inflClassHvo = 0; IPartOfSpeech pos = stemMsa.PartOfSpeechRA; while (pos != null && inflClassHvo == 0) { if (pos.DefaultInflectionClassRA != null) { inflClassHvo = pos.DefaultInflectionClassRA.Hvo; } else { int clsid = m_cache.ServiceLocator.GetInstance <ICmObjectRepository>().GetObject(pos.Owner.Hvo).ClassID; if (clsid == PartOfSpeechTags.kClassId) { pos = m_cache.ServiceLocator.GetInstance <IPartOfSpeechRepository>().GetObject(pos.Owner.Hvo); } else { pos = null; } } } if (inflClassHvo != 0) { inflClass = m_cache.ServiceLocator.GetInstance <IMoInflClassRepository>().GetObject(inflClassHvo); } } CreateInflectionClassXmlAttribute(doc, stemMsaNode, inflClass, "inflClass"); CreateRequiresInflectionXmlAttribute(doc, stemMsa.PartOfSpeechRA, stemMsaNode); CreateFeatureStructureNodes(doc, stemMsaNode, stemMsa.MsFeaturesOA, stemMsa.Hvo); CreateProductivityRestrictionNodes(doc, stemMsaNode, stemMsa.ProdRestrictRC, "productivityRestriction"); CreateFromPOSNodes(doc, stemMsaNode, stemMsa.FromPartsOfSpeechRC, "fromPartsOfSpeech"); }
/// <summary> /// Constructor. /// </summary> /// <param name="cache">FDO Cache object.</param> /// <param name="inflClass">The inflection class.</param> /// <param name="displayNameProperty">property name to display</param> public MoInflClassLabel(FdoCache cache, IMoInflClass inflClass, string displayNameProperty) : base(cache, inflClass, displayNameProperty) { }
private static XElement ExportInflectionClass(IMoInflClass inflectionClass, Icu.UNormalizationMode mode) { return new XElement("MoInflClass", new XAttribute("Id", inflectionClass.Hvo), ExportBestAnalysis(inflectionClass.Name, "Name", mode), ExportBestAnalysis(inflectionClass.Abbreviation, "Abbreviation", mode), ExportBestAnalysis(inflectionClass.Description, "Description", mode), new XElement("Subclasses", from inflClass in inflectionClass.SubclassesOC select ExportInflectionClass(inflClass, mode))); }
private static void WriteInflectionClassXmlAttribute(XmlWriter writer, IMoInflClass inflClass, string sInflClass) { if (inflClass != null) { writer.WriteAttributeString(sInflClass, inflClass.Hvo.ToString(CultureInfo.InvariantCulture)); writer.WriteAttributeString(sInflClass + "Abbr", inflClass.Hvo > 0 ? inflClass.Abbreviation.BestAnalysisAlternative.Text : ""); } else writer.WriteAttributeString(sInflClass, "0"); }
/// <summary> /// are there any sub items for this item? /// </summary> /// <returns></returns> public override bool GetHaveSubItems() { m_ic = (IMoInflClass)CmObject.CreateFromDBObject(m_cache, m_hvo); if (m_ic == null) return false; return m_ic.SubclassesOC.Count > 0; }
private void AddInflectiononSubclass(IMoInflClass parent, string name) { var inflClass = Cache.ServiceLocator.GetInstance<IMoInflClassFactory>().Create(); parent.SubclassesOC.Add(inflClass); inflClass.Name.SetAnalysisDefaultWritingSystem(name); inflClass.Abbreviation.SetAnalysisDefaultWritingSystem(name); }
protected void CreateInflectionClassXmlAttribute(XmlDocument doc, XmlNode msaNode, IMoInflClass inflClass, string sInflClass) { if (inflClass != null) { CreateXmlAttribute(doc, sInflClass, inflClass.Hvo.ToString(), msaNode); string sInflClassAbbr; if (inflClass.Hvo > 0) sInflClassAbbr = inflClass.Abbreviation.BestAnalysisAlternative.Text; else sInflClassAbbr = ""; CreateXmlAttribute(doc, sInflClass + "Abbr", sInflClassAbbr, msaNode); } else CreateXmlAttribute(doc, sInflClass, "0", msaNode); }
/// <summary> /// Add a MoInflClass to the collection. /// </summary> /// <param name="ic">The MoInflClass to add.</param> public IMoInflClass Add(IMoInflClass ic) { Debug.Assert(ic != null); IMoInflClass icAdd = (IMoInflClass)ValidateObject(ic); List.Add(icAdd); return icAdd; }
/// <summary> /// Constructor. /// </summary> /// <param name="cache">FDO Cache object.</param> /// <param name="inflClass">The inflection class.</param> /// <param name="displayNameProperty">property name to display</param> /// <param name="displayWs">writing system to display</param> public MoInflClassLabel(LcmCache cache, IMoInflClass inflClass, string displayNameProperty, string displayWs) : base(cache, inflClass, displayNameProperty, displayWs) { }
protected void CreateInflectionClassXmlAttribute(XmlDocument doc, XmlNode msaNode, IMoInflClass inflClass, string sInflClass) { if (inflClass != null) { CreateXmlAttribute(doc, sInflClass, inflClass.Hvo.ToString(), msaNode); string sInflClassAbbr; if (inflClass.Hvo > 0) { sInflClassAbbr = inflClass.Abbreviation.BestAnalysisAlternative.Text; } else { sInflClassAbbr = ""; } CreateXmlAttribute(doc, sInflClass + "Abbr", sInflClassAbbr, msaNode); } else { CreateXmlAttribute(doc, sInflClass, "0", msaNode); } }
/// <summary> /// Constructor. /// </summary> /// <param name="cache">FDO Cache object.</param> /// <param name="inflClass">The inflection class.</param> /// <param name="displayNameProperty">property name to display</param> public MoInflClassLabel(FdoCache cache, IMoInflClass inflClass, string displayNameProperty) : base(cache, inflClass, displayNameProperty) { }