//конструктор public Sentence(string origText, Referator parent, int index) { _originalText = origText; _parent = parent; _index = index; words = new cWords(this); string stemString = Mystem.lematizate(origText); this.parse2WordsFromStr(stemString); }
// constructor public Referator(string inpText, string enc) { /* загружаем словарь стоп слов */ textEncode = enc; string str = ""; string path = Directory.GetCurrentDirectory() + "\\stopWords.txt"; if (File.Exists(path)) { _stopWords = new cStopWords(); _stopWords.Parent = this; using (StreamReader sr = new StreamReader(path)) { while (!sr.EndOfStream) { str = sr.ReadLine(); _stopWords.Add(str); } } } else { throw new Exception("не загружен список стоп слов"); } /* init NormalWords list */ this.normalWords = new cWords(); /* делим текст на предложения */ Regex re = new Regex(@"(?<=(?<!([А-ЯЁA-Z]\.[А-ЯЁA-Z]))[.?!]+)[\s\n\t\r]+(?=[А-ЯЁA-Z\d])"); string[] se = re.Split(inpText); // создание предложений this.Sentences = new cSentences(this); for (int i = 0; i < se.Length; i++) { this.Sentences.Add(se[i], this, i); } // расччет весов предложений foreach (Sentence s in Sentences) { s.calcWeight(); } }