C1SpellChecker and rude words

WinForms

ComponentOne's WinForms controls

C1SpellChecker and rude words

  • rated by 0 users
  • This post has 1 Reply |
  • 2 Followers
  • chaps,

    I'm trying to add a sort of 'rude word' detection to the tool.

    I've implemented a customparser due to what we are note being a standard text doc. Inside the GetNextWord mehod I verify if the word is infact a rude word, but the problem that I have is if the word in question was added to the main dictionary or a custom dictionary it is not return in the error list. Is there a way that i can force (via the CharRange class maybe?) the word being bad? Or maybe I can inject the words into the main dictionary. What I would like to steer clear from is editing the dictionary files themselves.

     Thanks

     Cedric

  • I see three ways to handle this:

    1) Implement the FilterWord method in your custom parser:

     override string FilterWord(string word)
     {
       if (IsBadWord(word))
         { return "XXXXX"; }
      }

    OR

    2) Create a class that derives from C1SpellChecker and override the CheckWord method:

    override bool CheckWord(string word)
    {
      if (IsBadWord(word))
        { return false; }
      return base.CheckWord(word);
    }

    OR

    3) Edit the main dictionary using the DictionaryEditor utility and remove all offensive words.

    Hope this helps.

     

Page 1 of 1 (2 items)