Пример #1
0
        private async void button4_Click(object sender, EventArgs e)
        {
            var articleWordOccurenceData = await MongoDBHandler.GetArticleWordOccurenceData();

            var words = await MongoDBHandler.GetWordCollection();

            // exclude numbers 0-9 and article banner placeholder and some other irrelevant characters

            var toExclude = new[]
            {
                "0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "\n[ArticleBannerPlaceholder]\n", "10", "20", "\t", "\n—", "„"
            };

            words = words.Where(a => !toExclude.Contains(a.WordName)).ToList();

            // get first 100 words by occurence (DESC) and extract articleWordOccurence data according to it

            var wordsArray = words.OrderByDescending(a => a.Occurence).Take(100).Select(a => a.WordName).ToList();

            var aWODExtracted = articleWordOccurenceData.Where(a => wordsArray.Contains(a.Word)).ToList();

            await MongoDBHandler.InsertArticleWordOccurences100Words(aWODExtracted);
        }