I read documents and break words to get every word in the dictionary, but how can I exclude some words (for example, "/ a / an").
This is my function:
private void Splitter(string[] file) { try { tempDict = file .SelectMany(i => File.ReadAllLines(i) .SelectMany(line => line.Split(new[] { ' ', ',', '.', '?', '!', }, StringSplitOptions.RemoveEmptyEntries)) .AsParallel() .Distinct()) .GroupBy(word => word) .ToDictionary(g => g.Key, g => g.Count()); } catch (Exception ex) { Ex(ex); } }
Also, in this scenario, where do you need to add add .ToLower() to make all the words from the file lowercase? I was thinking of something like this before ( temp = file ..):
file.ToList().ConvertAll(d => d.ToLower());
dictionary c # tolower wpf
Ken'ichi Matsuyama
source share