public bool IsBugFix(Commit commit) { if (!Regex.IsMatch(commit.Message, MessageRegExp, RegexOptions.IgnoreCase)) { return(false); } string messageToLower = commit.Message.ToLower(); if (StopWords.Any(x => messageToLower.IndexOf(x) > 0)) { return(false); } return(true); }
public WordProcessor(string fileContents) { StopWords = Properties.Resources.stopwords .Split('\n', StringSplitOptions.RemoveEmptyEntries) .Select(s => s.Trim().ToLowerInvariant().StemWord()); string contents = new string(fileContents.Where(c => char.IsLetter(c) || char.IsWhiteSpace(c)).ToArray()); ContentList = contents .Split(Delimitters, StringSplitOptions.RemoveEmptyEntries) .Select(s => s.Trim().ToLowerInvariant().StemWord()) .Where(s => !string.IsNullOrEmpty(s) && !StopWords.Any(stopWord => stopWord.Equals(s, StringComparison.OrdinalIgnoreCase))); foreach (string word in ContentList) { if (!WordCount.TryAdd(word, 1)) { WordCount[word]++; continue; } } WordCount = WordCount.OrderByDescending(i => i.Value).ThenBy(i => i.Key).ToDictionary(k => k.Key, v => v.Value); }