private static Dictionary <string, List <string> > GetKeyWordsHelper(List <ArticleModel> articles, string category, List <string> stopList) { Dictionary <string, List <string> > allWordsFromTag = new Dictionary <string, List <string> >(); foreach (var articleModel in articles) { string tag = articleModel.Categories[category][0]; if (!allWordsFromTag.ContainsKey(tag)) { allWordsFromTag.Add(tag, new List <string>()); } allWordsFromTag[tag].AddRange(ArticlesHandler.GetWordsFromArticle(articleModel)); } var keys = allWordsFromTag.Keys.ToList(); Dictionary <string, List <string> > stopWords = new Dictionary <string, List <string> >(); foreach (var key in keys) { allWordsFromTag[key] = StemmingService.Call(_articlesHandler.GetStopListedWords(stopList, allWordsFromTag[key])); Dictionary <string, double> wordsFrequency = _articlesHandler.GetTermFrequencies(allWordsFromTag[key]); stopWords[key] = wordsFrequency.Keys.ToList(); } return(stopWords); }
public MessageScanner(IServiceProvider services) { discord = services.GetRequiredService <DiscordSocketClient>(); data = services.GetRequiredService <IDataService>(); stemSrv = services.GetRequiredService <StemmingService>(); sb = new StringBuilder(); trimChars = new char[] { '.', ',', '?', '!', ';', ':', '"', '\'', '(', ')', '[', ']', '{', '}' }; ReloadChannelTypes(); ReloadTriggerLists(); discord.MessageReceived += ProcessMessage; Instance = this; }
public static List <string> GetStemmedAndStoplistedWords(ArticleModel article, List <string> stoplist) { StopListService stopservice = new StopListService(GetWordsFromArticle(article)); return(StemmingService.Call(stopservice.Call(stoplist))); }
public InfoModule(IServiceProvider services) { pluralSrv = services.GetRequiredService <StemmingService>(); }