public void CreateAnagrams(InputField input_field) { string letters = input_field.text; LetterPool pool = new LetterPool(); Word word = pool.GetLetters(letters.ToLower()); FileManager file_manager = new FileManager(); DateTime start = DateTime.Now; print(start); //Old.TrigramSet ts = Old.FileManager.CreateGraphemeSetFromFile<Old.TrigramSet, Old.Trigram>(load_path.value, Encoding.UTF8); GraphemeRuleSet rules = file_manager.CreateGraphemeSetFromFile(load_path.value, Encoding.UTF8); TimeSpan end = DateTime.Now - start; print(end.TotalSeconds); start = DateTime.Now; print(start); //foreach (Old.VariableLetterGroup s in new Old.VariableLetterGroup(letters).SortedAndAnalyzedUniquePermutations(ts)) // Old.FileManager.CreateOrUpdateFileWithOneLine(s, save_path.value, Encoding.UTF8); //foreach (Word permutation in word.SortedAndAnalyzedUniquePermutations(rules)) // file_manager.CreateOrUpdateFileWithOneLine(permutation, save_path.value, Encoding.UTF8); file_manager.CreateOrOverwriteFile(word.SortedAndAnalyzedUniquePermutations(rules), save_path.value, Encoding.UTF8); end = DateTime.Now - start; print(end.TotalSeconds); }
public GraphemeRuleSet CreateGraphemeSetFromFile(string path, Encoding encoding) { var rules = new GraphemeRuleSet(); LetterPool pool = new LetterPool(); using (StreamReader file = new StreamReader(path, encoding)) { string line = file.ReadLine(); while (line != null) { Word rule = pool.GetLetters(line.ToLower()); rules.AddRule(rule); line = file.ReadLine(); } } return(rules); }