예제 #1
0
        public void AddToSummary(SentenceScore sentence)
        {
            if (_Summary.Any(sent => sent.Sentence.Equals(sentence.Sentence)) ||
                sentence.Sentence.Split(' ').Length < MinSentenceLength ||
                sentence.Sentence.Split(' ').Length > MaxSentenceLength ||
                sentence.Sentence.EndsWith("?"))
            {
                return;
            }

            if (_Summary.Count < 3 || sentence.Score > MinScore())
            {
                Insert(sentence);
            }
        }
예제 #2
0
        private void Insert(SentenceScore sentence)
        {
            if (_Summary.Count == 0)
            {
                _Summary.Add(sentence);
                return;
            }

            for (int i = 0; i < _Summary.Count; i++)
            {
                if (sentence.Score > _Summary[i].Score)
                {
                    _Summary.Insert(i, sentence);
                    break;
                }
                else if (i == _Summary.Count - 1)
                {
                    _Summary.Insert(i + 1, sentence);
                    break;
                }
            }
            RemoveLowestScoringSentence();
        }