コード例 #1
0
        List <string> getTokenizedKeywords(string text)
        {
            string[]      tokenizedString = Tokenizer.tokenizeString(text);
            List <string> words           = StopwordExtractor.work(tokenizedString);

            return(words);
        }
コード例 #2
0
        /// <summary>
        /// This methods performs the main function of ranking the documents
        /// It collects the query and uses it get the rank value of each document
        /// </summary>
        /// <param name="query"></param>
        public void Rank(string query)
        {
            string[]      tokenizedQuery = Tokenizer.tokenizeString(query);
            List <string> QW             = StopwordExtractor.work(tokenizedQuery);

            List <Doocument> documentList = Storage.getStorageDetails().getDocumentList();

            for (int i = 0; i < documentList.Count; i++)
            {
                int    id = documentList[i].getID();
                double a  = totalFrequency(QW, id);
                double b  = magnitudeRoot(QW, id);
                if (b != 0)
                {
                    documentList[i].setRankValue(a / b);
                }
                else
                {
                    documentList[i].setRankValue(0);
                }
            }
        }