public void AddDocumentIndex(DocumentIndex index, int weight )
        {
            if ( !HasDocument(index.DocumentName) )
                DocumentNodeList.Add(index.DocumentName, 0);

            DocumentNodeList[index.DocumentName]+=weight;
            TotalTermFrequency+=weight;        //used to calculate TFIDF in a quick manner
        }
Пример #2
0
        //adds a word with document specific information
        public void Add(String word, DocumentIndex? index, int weight )
        {
            if (word.Length == 0)
            {
                if (LeafNode == null)
                    LeafNode = new SuffixLeafNode();

                if (index != null)
                    LeafNode.AddDocumentIndex(index.Value,weight);
                return;
            }

            char c = Char.ToLower(word[0]);

            SuffixNode node = Neighbours[SuffixNode.MapToIndex(c)];

            if (node == null)
            {
                Neighbours[SuffixNode.MapToIndex(c)] = new SuffixNode(c);
                node = Neighbours[SuffixNode.MapToIndex(c)];
            }

            node.Add(word.Substring(1),index,weight);
        }