Exemplo n.º 1
0
        public void AnalyzeText(string text)
        {
            _wordsIdsByText.Clear();

            List <Sentence> sentences = _textAnalyzer.ParseText(text);

            foreach (Sentence sentence in sentences)
            {
                string      sentenceText = (sentence.Text ?? string.Empty).Trim();
                List <Word> words        = sentence.Words.Where(e => !_excludeWordTypes.Contains(e.Type)).ToList();
                if (words.Count < 3)
                {
                    //тип не предложение - пропустить
                    LoggerWrapper.LogTo(LoggerName.Errors).InfoFormat(
                        "TextProcessor.AnalyzeText PartSentence в Sentence не предложение. Предложение \"{0}\" содержит меньше трех слов!",
                        sentenceText);
                    continue;
                }
                if (!SaveSentence(sentenceText, words))
                {
                    LoggerWrapper.LogTo(LoggerName.Errors).InfoFormat(
                        "TextProcessor.AnalyzeText Предложение \"{0}\" не было сохранено!", sentenceText);
                }
            }
        }
Exemplo n.º 2
0
        public void ParseText(string text)
        {
            List <Sentence> sentences = _textAnalyzer.ParseText(text);

            for (int i = 0; i < sentences.Count; i++)
            {
                Console.Write("{0}", i + 1);
                ShowSentence(sentences[i]);
            }
        }