public override string PerformPreprocessing(Sentence sentenceForPreprocess)
        {
            var colons = sentenceForPreprocess.ElementList.FindAll(x => x.ElementType.Value == ComprenoSentenceElementType.Punctuator_Colon.Value);
            log.InfoFormat("Found {0} colon(s) in sentence", colons.Count);

            foreach (var colon in colons)
                _processColon(colon, sentenceForPreprocess.ElementList);

            return sentenceForPreprocess.GetSentenceTextFromElements();
        }
        public override string PerformPreprocessing(Sentence sentenceForPreprocess)
        {
            var predicateElements = sentenceForPreprocess.ElementList.FindAll(x => x.SyntacticRole.Value == LWS.Compreno.FormatEntities.SyntacticRole.Predicate.Value);

            if (predicateElements.Count > 0)
                foreach (var predicateElement in predicateElements)
                    _processPredicate(predicateElement, sentenceForPreprocess.ElementList);
            else
                log.WarnFormat("During processing with {0} predicates were not found. Sentence is not changed", Name);
            return sentenceForPreprocess.GetSentenceTextFromElements();
        }
Exemplo n.º 3
0
        public override string PerformPreprocessing(Sentence sentenceForPreprocess)
        {
            var result = sentenceForPreprocess.SentenceText;
            // ищем вставки

            var insertsList = new SentenceInsertBlocks(sentenceForPreprocess);
            log.InfoFormat("Inserts found count is {0}. Data is {1}{2}", insertsList.Enumerations.Count, Environment.NewLine, insertsList.ToString());
            foreach (var insert in insertsList.Enumerations)
            {
                if (insert.Value.IsMainWordPresented)
                {
                    sentenceForPreprocess.ElementList.RemoveAll(x => x.Order == insert.Value.EndElementOrder);
                    sentenceForPreprocess.ElementList.Find(x => x.Order == insert.Value.StartElementOrder).Text = ReplaceStringForOpenBracket;
                }
                else
                    sentenceForPreprocess.ElementList.RemoveAll(x => (x.Order >= insert.Value.StartElementOrder && x.Order <= insert.Value.EndElementOrder));
            }
            result = sentenceForPreprocess.GetSentenceTextFromElements();

            return result;
        }