/// <summary>
        /// Создание подтекста из xml-элемента
        /// </summary>
        /// <param name="subSentence">родительское подпредложение</param>
        /// <param name="subSentenceXML">xml-элемент подтекста</param>
        /// <param name="language">язык предложения</param>
        private static void SubTextFromXElement(SubSentence subSentence, XElement subSentenceXML, string language)
        {
            int position = _positionInSentence;
            var entities = _sentenceEntities;

            SubTextInfo subText = new SubTextInfo(
                GetSymbolFromXElement(subSentenceXML.Elements().First()),
                GetSymbolFromXElement(subSentenceXML.Elements().Last()));

            subText.Sentences       = TextFromXElement(subSentenceXML).Sentences;
            subSentence.SubTextInfo = subText;

            _sentenceEntities   = entities;
            _positionInSentence = position + GetFullValue(subSentenceXML).Length;
        }
Ejemplo n.º 2
0
        public XElement ToXElement()
        {
            var result = new XElement(UnitTextType.SUB_SENT.ToString());

            result.SetAttributeValue(RDF.Attribute.Type, Type);
            result.SetAttributeValue(RDF.Attribute.ID, IdGenerator.GetID(this));
            if (SubTextInfo != null)
            {
                var subText = SubTextInfo.ToXElement();
                foreach (var element in subText.Elements())
                {
                    if (element.IsContainAttribute(RDF.Attribute.StartPosition))
                    {
                        SubTextInfo.UpdateStartPosition(element, StartPosition);
                    }
                }
                result.Add(subText.Elements());
                return(result);
            }

            SetSubjectAttribute(result);
            SetPassiveSubjectAttribute(result);
            #region [.Тональность.]
            if (Tonality.SNT != TonalityType.__UNDEFINE__)
            {
                result.SetAttributeValue(RDF.Attribute.SNT, Tonality.SNT);
                result.SetAttributeValue(RDF.Attribute.FRT, Tonality.FRT);
            }
            if (Tonality.SNTFINAL != TonalityType.__UNDEFINE__)
            {
                result.SetAttributeValue(RDF.Attribute.SNTFINAL, Tonality.SNTFINAL);
                result.SetAttributeValue(RDF.Attribute.FRTFINAL, Tonality.FRTFINAL);
            }
            #endregion
            AddChildElements(result);

            return(result);
        }