C1 Community
ComponentOne Community is a free source for developers and help authors to collaborate and communicate.

C1SpellChecker and rude words

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

Not Ranked
Posts 2
exceed Posted: Mon, Apr 6 2009 10:18 AM

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

Top 10 Contributor
Posts 2,707

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) | RSS
Contact ComponentOne: 1.800.858.2739 ©1987-2010 ComponentOne LLC All Rights Reserved.