Example #1
0
        static void Main(string[] args)
        {
            var src = @"F:\ToSummarize.txt";

            string str = System.IO.File.ReadAllText(src);

            string[] Lines = str.Split(new string[] { "\r\n", "\n", "." }, StringSplitOptions.RemoveEmptyEntries);

            WordHandle stopword = new WordHandle();

            TFIDF tf = new TFIDF(Lines);

            using (System.IO.StreamWriter file = new System.IO.StreamWriter(@"F:\Summary.txt"))
            {
                foreach (var item in tf.DocResult)
                {
                    file.WriteLine(Lines[item]);
                }
            }
        }
Example #2
0
        public string[] Partition(string input)
        {
            Regex r = new Regex("([ \\t{}():;. \n])");

            input = input.ToLower();

            String[] tokens = r.Split(input);

            ArrayList fltr = new ArrayList();

            for (int i = 0; i < tokens.Length; i++)
            {
                MatchCollection mc = r.Matches(tokens[i]);
                if (mc.Count <= 0 && tokens[i].Trim().Length > 0 &&
                    !WordHandle.IsStopword(tokens[i]))
                {
                    fltr.Add(tokens[i]);
                }
            }
            return(ArrLstToArr(fltr));
        }