Example #1
0
        private void countTitleFrequencies(Article article, List <string> searchWords)
        {
            article.TFTitle = new double[article.TF.Length];
            for (int i = 0; i < article.TF.Length; i++)
            {
                article.TFTitle[i] = article.TF[i];
            }
            int count = 1;
            TokenizeStopStem title = new TokenizeStopStem(article.title);

            title.tokenize();
            List <string> t = title.getTokens();

            foreach (var item in t)
            {
                foreach (string s in searchWords)
                {
                    if (item.Equals(s))
                    {
                        count++;
                    }
                }
            }
            for (int i = 0; i < article.TFTitle.Length; i++)
            {
                article.TFTitle[i] *= (1 / (double)count);
            }
        }
Example #2
0
        private static void addTokens(TokenizeStopStem t)
        {
            List <String> tokens = t.getTokens();

            foreach (String token in tokens)
            {
                if (!dictionary.ContainsKey(token))
                {
                    dictionary.Add(token, no++);
                }
            }
        }