private void BindList() { logger.Debug("Begin Load Know Words"); var knowns = dbOperator.FindAll <UserVocabulary>(v => v.KnownStatus == KnownStatus.Known).Select(v => v.Word).OrderBy(v => v).ToList(); cbxKnownList.ClearSelected(); cbxKnownList.DataSource = knowns; logger.Debug("Finish Load Know Words"); logger.Debug("Begin Load Unknown Words"); var notknown = dbOperator.FindAll <UserVocabulary>(v => v.KnownStatus == KnownStatus.Unknown).Select(v => v.Word).OrderBy(v => v).ToList(); cbxUnknownList.ClearSelected(); cbxUnknownList.DataSource = notknown; logger.Debug("Finish Load Unknown Words"); }
/// <summary> /// 找到字幕中的生词,先进行分词,然后取每个单词的原型,然后看每个单词是否认识,认识则跳过,不认识则注释。 /// </summary> /// <param name="subtitles"></param> /// <returns></returns> private IDictionary <string, SubtitleWord> PickNewWords(IList <SubtitleLine> subtitles) { Dictionary <string, SubtitleWord> result = new Dictionary <string, SubtitleWord>(); var knownVocabulary = dbOperator.FindAll <UserVocabulary>(v => v.KnownStatus == KnownStatus.Known).Select(v => v.Word).ToList(); var texts = subtitles.Select(s => s.EnglishText).ToList(); foreach (var line in texts) { var array = line.Split(new char[] { ' ', ',', '.', '?', ':', '!' }, StringSplitOptions.RemoveEmptyEntries); foreach (string word in array) { if (IsEnglishName(word)) { //英文名,忽略 continue; } var original = englishWordService.GetOriginalWord(word); if (knownVocabulary.Contains(word) || knownVocabulary.Contains(original)) { //认识的单词,忽略 continue; } if (result.ContainsKey(original)) { //重复的单词 continue; } var mean = RemarkWord(original); if (mean != null) { result.Add(original, new SubtitleWord() { Word = original, WordInSubitle = word, Means = mean.Means, SubtitleSentence = line }); } } } return(result); }