public void SaveDictionary(IWordsDictionary dict) { var dic = db.Languages.FirstOrDefault(x => x.Language == dict.Language); if (dic == null) { db.Languages.Add(new LanguageString() { Language = dict.Language }); foreach (var w in dict.Words) { db.Words.Add((Word)w); } } else { foreach (var w in dict.Words) { var word = db.Words.FirstOrDefault(x => x.Text == w.Text); if (word == null) { db.Words.Add((Word)w); } else { word.Picture = w.Picture; } } } db.SaveChanges(); }
public AnalysisResultsForm(IWordsDictionary wordsDictionary) { this.wordsDictionary = wordsDictionary; InitializeComponent(); FoundWordsListBox.SelectedValueChanged += FoundWordsListBox_SelectedValueChanged; }
private void AddNewDictionary() { NewDictionaryName = CultureInfo.CurrentCulture.TextInfo.ToTitleCase(NewDictionaryName.ToLower()); IWordsDictionary dict = _dao.CreateNewDictionary(); dict.Language = NewDictionaryName; dict.Words = new List <IWord>(); _dictionaries.Add(dict); SelectedDictionary = dict; SelectedWord = null; }
public SentenceRepair(IWordsDictionary dictionary, string lightMask, string mask, string replaceMask) { if (string.IsNullOrEmpty(mask)) { throw new ArgumentException("Value cannot be null or empty.", nameof(mask)); } this.mask = mask; this.replaceMask = replaceMask ?? throw new ArgumentNullException(nameof(replaceMask)); this.dictionary = dictionary ?? throw new ArgumentNullException(nameof(dictionary)); this.lightMask = lightMask; }
public void SaveDictionary(IWordsDictionary dict) { var dic = _dicts.FirstOrDefault(x => x.Language == dict.Language); if (dic == null) { _dicts.Add(dict); } else { dic = dict; } }
public SentenceRepairHandler(ILexiconConfiguration path, IWordsDictionary dictionary) { if (path == null) { throw new ArgumentNullException(nameof(path)); } cleanup = new EmojyCleanup(); cleanup.NormalizeText = false; resourcesPath = Path.Combine(path.LexiconPath, "Repair"); this.dictionary = dictionary ?? throw new ArgumentNullException(nameof(dictionary)); Load(); }
private void DoFilter(IWordsDictionary dict, string filter) { if (dict == null) { return; } if (dict.Words == null) { return; } var view = CollectionViewSource.GetDefaultView(dict.Words); if (filter.Length > 0) { view.Filter = (w) => ((IWord)w).Text.Contains(filter, StringComparison.OrdinalIgnoreCase); } else { view.Filter = null; } }
public WordsBuilder(IWordsDictionary dictionary) { this.Dictionary = dictionary; }
public DefaultDocumentProcessor(IWordProcessor wordProcessor, IWordsDictionary wordsDictionary, Func<IWordLexer> lexerFactory) { this.wordProcessor = wordProcessor; this.wordsDictionary = wordsDictionary; this.lexerFactory = lexerFactory; }
public RawWordExtractor(IWordsDictionary dictionary, IMemoryCache cache) { Dictionary = dictionary ?? throw new ArgumentNullException(nameof(dictionary)); this.cache = cache ?? throw new ArgumentNullException(nameof(cache)); service = new PluralizationServiceInstance(); }
public AddDiacriticsesProcess(IDocument document, IWordsDictionary wordsDictionary, Func<IWordLexer> lexerFactory) { this.document = document; this.wordsDictionary = wordsDictionary; this.lexerFactory = lexerFactory; }