public void AddWordTest() { using (Hunspell hunspell = new Hunspell("en_us.aff", "en_us.dic")) { Assert.IsFalse(hunspell.Spell("phantasievord")); Assert.IsTrue(hunspell.Add("phantasievord")); Assert.IsTrue(hunspell.Spell("phantasievord")); Assert.IsTrue(hunspell.Remove("phantasievord")); Assert.IsFalse(hunspell.Spell("phantasievord")); Assert.IsFalse(hunspell.Spell("phantasos")); Assert.IsFalse(hunspell.Spell("phantasoses")); Assert.IsTrue(hunspell.AddWithAffix("phantasos", "fish")); Assert.IsTrue(hunspell.Spell("phantasos")); Assert.IsTrue(hunspell.Spell("phantasoses")); Assert.IsTrue(hunspell.Remove("phantasos")); Assert.IsFalse(hunspell.Spell("phantasos")); Assert.IsFalse(hunspell.Spell("phantasoses")); } }
protected override void SetStatusInternal(string word, bool isCorrect) { if (isCorrect) { if (IsVernacular) { // Custom vernacular-only dictionary. // want it 'affixed' like the prototype, which has been marked to suppress other-case matches _hunspellHandle.AddWithAffix(MarshallAsUtf8Bytes(word), MarshallAsUtf8Bytes(SpellingHelper.PrototypeWord)); } else { // not our custom dictionary, some majority language, we can't (and probably don't want) // to be restrictive about case. _hunspellHandle.Add(MarshallAsUtf8Bytes(word)); } } else { _hunspellHandle.Remove(MarshallAsUtf8Bytes(word)); } }