public static void ProcessDirectory(string targetDirectory, string outputFile)
        {
            Dictionary <string, List <int> > resultDictionary = new Dictionary <string, List <int> >();

            string[] fileEntries = Directory.GetFiles(targetDirectory);

            Dictionary <string, List <int> > removableStuff = new Dictionary <string, List <int> >();

            removableStuff.Add("posts", new List <int> {
                0, 1, 4, 5, 6, 7, 9
            });
            removableStuff.Add("canopy", new List <int> {
                0, 1, 3, 4, 7, 8, 9, 10
            });

            for (int i = 0; i < fileEntries.Length; i++)
            {
                var bookIteam = new BookInformation(i, fileEntries[i]);

                FileProcessing.ProcessFile(resultDictionary, bookIteam);
                if (i == fileEntries.Length - 1)
                {
                    //var res = WordsBreaking.ProcessFile(fileName, result);
                    BooleanSeach.SeachQuery(resultDictionary);
                    WriteToFile(resultDictionary, outputFile);

                    //BooleanSeach.OrQuery(removableStuff, "posts", "canopy");
                }
            }
        }
Exemple #2
0
        public static Dictionary <string, List <int> > ProcessFile(Dictionary <string, List <int> > resultDictionary,
                                                                   BookInformation bookInfo)
        {
            string allText = File.ReadAllText(bookInfo.bookPath);

            //TakeDate(allText, ref resultDictionary, bookInfo.bookID);

            //TakeEmails(allText, ref resultDictionary, bookInfo.bookID);

            //TakeBeForms(allText, ref resultDictionary, bookInfo.bookID);

            //TakeQuotes(allText, ref resultDictionary, bookInfo.bookID);

            // parse for punctuation
            string punctuation = " “'/,.?!;:\"\r\n";

            //string punctuation = @" ,.?!;:\r\n\d";
            string[] FirstFileWords = allText.Split(punctuation.ToCharArray());

            MakeDictionary(FirstFileWords, ref resultDictionary, bookInfo.bookID);

            return(resultDictionary);
        }