Untitled

 avatar
unknown
plain_text
3 years ago
846 B
7
Indexable
 static void writeFile(string fileName)
        {
            const int MAX_FILE_LINES = 50000;
            string[] AllLines = new string[MAX_FILE_LINES];

            AVLTree<string> tree = new AVLTree<string>();

            AllLines = File.ReadAllLines(fileName);

            foreach(string line in AllLines)
            {
                string[] words = line.Split(' ', ',', '.', '?', ';', ':', '!');
                foreach (string word in words)
                    if (word != "")
                        //  Console.WriteLine(word.ToLower());
                        tree.InsertItem(word.ToLower());
            }
            StreamWriter sw = new StreamWriter(fileName);
            sw.WriteLine("Number of words {0}", tree.Count());
          // sw.WriteLine("Number of times each word appears {0}",  );
        }
Editor is loading...