public static void ExploreMode(string startTimestamp) { Console.WriteLine("Loading ressources..."); Core.Lexicotron lexicotron = new Core.Lexicotron(); //var spin = new ConsoleSpinner(); var loading = loadRessources(lexicotron); //while (!loading.IsCompleted) //{ // spin.Turn(); //} Console.WriteLine("Ressources loaded !"); var directory = Helpers.GetExecutingDirectoryPath(); Console.WriteLine($"Executing folder is {directory}"); Console.WriteLine("Processing..."); List <ArticleGroup> articlegroups = lexicotron.ProcessAllDirectory(directory + @"\Input\");// //TODO : make it async with progression bar Console.WriteLine("Write to excel file..."); foreach (ArticleGroup articlegroup in articlegroups) { FileWriter.PrintArticlesToExcel(articlegroup, lexicotron.LexicalFieldsList, startTimestamp);; } }
private static async Task loadRessources(Core.Lexicotron lexicotron) { var loadLexicon = loadLexiconAsync(); var loadLexicalField = loadLexicalFieldAsync(); //TODO: Add hyperonymie ressources var allTasks = new List <Task> { loadLexicon, loadLexicalField }; while (allTasks.Any()) { Task finished = await Task.WhenAny(allTasks); if (finished == loadLexicon) { lexicotron.Lexicon = loadLexicon.Result; Console.WriteLine($"{lexicotron.Lexicon.Count} words from Lexic loaded !"); } else if (finished == loadLexicalField) { var result = loadLexicalField.Result; lexicotron.LexicalFields = result.Item1; lexicotron.LexicalFieldsList = result.Item2; lexicotron.LexicalFieldsToWords = result.Item3; Console.WriteLine($"{lexicotron.LexicalFieldsList.Length} lexicals fields loaded !"); } allTasks.Remove(finished); } }
private static void LexicalFieldFrequencyMode(string startTimestamp) { Console.WriteLine("Loading ressources..."); Core.Lexicotron lexicotron = new Core.Lexicotron(); var loading = loadRessources(lexicotron); Console.WriteLine("Ressources loaded !"); var directory = Helpers.GetExecutingDirectoryPath(); Console.WriteLine($"Executing folder is {directory}"); Console.WriteLine("Processing..."); Dictionary <string, double> lexicalFieldFrequency = lexicotron.ProcessLexicalField();// //TODO : make it async with progression bar Console.WriteLine("Write frequency to excel file..."); FileWriter.PrintLexicalFieldsToExcel(lexicalFieldFrequency, startTimestamp);; }