Пример #1
0
 public Word(string content, Sentence parent)
 {
     this._parent = parent;
     this.Content = content;
     this._weight = 0;
     //this.normWords = new cWords();
     //this.noneNormWords = new cWords();
 }
Пример #2
0
 // основной конструктор который точно используется :)
 public Word(string content, string lexem, Sentence parent)
 {
     this._content = content;
     this._weight = 0;
     _parent = parent;
     int n = this.Parent.Parent.normalWords.findByContent(lexem);
     if (n > -1) // если нормализованное слово уже было ранее обнаружено
     {
         this.normWord = this.Parent.Parent.normalWords[n]; // то оставляем ссылку на него
     }
     else
     {
         this.normWord = new Word(lexem);                    // иначе создаем новое
         this.Parent.Parent.normalWords.Add(normWord);  // и добавляем в общую коллекцию норм. слов
     }
     this.normWord.Weight++;            
 }
Пример #3
0
        public readonly string textEncode; // кодировка скорее всего не нужно

        public Referator(string xml)
        {
            Sentences = new cSentences(this);


            XmlDocument xDoc = new XmlDocument();
            xDoc.LoadXml(xml);
            XmlNode xSentences = xDoc.SelectSingleNode("sentences");
            XmlNodeList xSe = xSentences.SelectNodes("se");
            foreach (XmlNode se in xSe)
            {
                int seIndex = int.Parse(se.Attributes["index"].Value);
                string s = se.Attributes["weight"].Value;
                s = s.Replace('.', ',');
                float seWeight = float.Parse(s);
                Sentence sentence = new Sentence(se.InnerText,this,seIndex,1);
                sentence.Weight = seWeight;
                Sentences.Add(sentence);
            }                        
        }