Beispiel #1
0
        // not sure what GetDocWeightsIds is used for  ? but apparently nothing references it so we might not even need it ???

        // public List<int> GetDocWeightsIds()
        // {
        //     List<int> documents = docWeigthsHashMap.GetKeys().ToList();
        //     List<PostingDocWeight> finalList = new List<PostingDocWeight>();
        //     foreach (int documentID in documents)
        //     {
        //         finalList.Add(GetPostingDocWeight(documentID));
        //     }

        //     return finalList;
        // }

        public PostingDocWeight GetPostingDocWeight(int docID)
        {
            PostingDocWeight result = docWeigthsHashMap.Get(docID);

            if (default(PostingDocWeight) == result)
            {
                return(new PostingDocWeight(0.0, 0, 0, 0.0));
            }
            else
            {
                return(result);
            }
        }
Beispiel #2
0
        ///<sumary>
        /// Writes 8-byte values of document weights to docWeights.bin
        /// </summary>
        /// <param name="index">the index to write</param>
        /// <param name="dirPath">the absolute path to a directory where 'docWeights.bin' be saved</param>
        /// <returns>the list of starting byte positions of each doc weight in docWeights.bin</returns>
        public void WriteDocWeights()
        {
            double tempDocWeight;
            int    tempDocLength;
            double tempAverTermFreq;

            foreach (KeyValuePair <int, int> doc in docByteSize)
            {
                tempDocWeight    = calculatedDocWeights[doc.Key];
                tempDocLength    = tokensPerDocument[doc.Key];
                tempAverTermFreq = averageTermFreqPerDoc[doc.Key];

                PostingDocWeight tempPostDocWeight = new PostingDocWeight(tempDocWeight, tempDocLength, doc.Value, tempAverTermFreq);

                tempDocWeightsHashMap.Add(doc.Key, tempPostDocWeight);
            }
        }