コード例 #1
0
ファイル: ArticlesController.cs プロジェクト: workcard/CafeT
        public Dictionary <string, int[]> GetArticlesWords(Guid articleId)
        {
            ArticleModel  _article = _articleManager.GetByIdAsync(articleId).Result;
            VnTextCrawler _crawler = new VnTextCrawler();

            _crawler.Run(_article.Content.HtmlToText());

            Dictionary <string, int[]> dictionary = new Dictionary <string, int[]>();

            foreach (var item in _crawler.Processor.CleanWordObjects)
            {
                dictionary.Add(item.Value, item.Indexs);
            }
            return(dictionary);
        }
コード例 #2
0
ファイル: ArticlesController.cs プロジェクト: workcard/CafeT
        public async Task <ActionResult> GetEnglishWords(Guid articleId)
        {
            ArticleModel  _article = _articleManager.GetByIdAsync(articleId).Result;
            VnTextCrawler _crawler = new VnTextCrawler();

            _crawler.Run(_article.Content.HtmlToText());

            var _words = _crawler.Processor
                         .CleanWordObjects
                         .Where(t => t.Lang == WordLang.English)
                         .Select(t => t.Value)
                         .Distinct();

            var _allWords = GetMemoryWords().Select(t => t.Model.Value).Distinct();
            var _selected = _words.Where(t => !_allWords.Contains(t));

            if (Request.IsAjaxRequest())
            {
                return(PartialView("Words/_NewWords", _selected));
            }
            return(View("Words/_NewWords", _selected));
        }