I'm not sure if there are any off-the-shelf solutions for it, but if I were
implementing something like it, it would probably make more sense to first
store the filter words into a hashtable, then tokenize the input string
into words using strtok() or the like, and do a word by word comparison
with the hashtable, replacing each word in the input string as needed --
that way, you should be able to do it in time proportional only to the
length of your input string, not the size of the filter word list.
-- Mark
At 03:17 PM 2/4/2003 -0600, you wrote:
>Hi,
>I am working on a simple chat filter for our network game.
>Are there any drop-in chat filters available?
>How does everyone else deal with chat filtering?
>
>I had thought of having a list of words and then strstr() for each one in
>my message I want filtered,
>That would be kinda slow though if the filter list was big.
>
>I had also thought of a dictionary tree to store the filter words and then
>send the message i want filtered through the dictionary, starting with
>each successive character in the msg.
>
>Am I missing something or does anyone have any better ideas?
>
>
>- Ray
--
Mark Wang
mailto:mw...@cs...
http://www.markwang.com/
AIM:markwang99
|