Word Filter

Post here your questions about SFS2X. Here we discuss all server-side matters. For client API questions see the dedicated forums.

Moderators: Lapo, Bax

User avatar
ekrem5353
Posts: 118
Joined: 10 Dec 2015, 15:50

Word Filter

Postby ekrem5353 » 13 Dec 2019, 08:00

Hi, I am trying to use word filter and I need to add some words as seperate word like when word sik is swear word but isik is not

i tried this (?i:\bword\b)
(?i:bastard)
(?i:nigger)
(?i:nigga)
(?i:\bsik\b) this worked but words that come after that did not work
(?i:\bgöt\b)

How can I do that some of the words should not show up separateley

Thanks
User avatar
Lapo
Site Admin
Posts: 23008
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: Word Filter

Postby Lapo » 13 Dec 2019, 09:39

What do you mean by separately? Can you give me an example?
Lapo
--
gotoAndPlay()
...addicted to flash games
User avatar
ekrem5353
Posts: 118
Joined: 10 Dec 2015, 15:50

Re: Word Filter

Postby ekrem5353 » 13 Dec 2019, 10:50

I mean if a word foo is in the sentence. like I foo you :) this is a bad word we should catch him. When it is I afoo you or I foon you it should pass ; it is not swear.

or just word foo or . at the start of the sentence or end of the
User avatar
ekrem5353
Posts: 118
Joined: 10 Dec 2015, 15:50

Re: Word Filter

Postby ekrem5353 » 13 Dec 2019, 11:29

As I said. there are words in turkish like sik when you write it alone. it is swear word. but some other normal words contain it. like isik. it shows up i*** as if it is swear word. Users can not write properly. I tried this(?i:\bsik\b) it worked but second word did not work (?i:\bam\b) when users tried to write "aman aman kimler gelmiş". it becomes (**an **an kimler gelmis) and couple of users got banned I had to deactivate word filter
User avatar
Lapo
Site Admin
Posts: 23008
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: Word Filter

Postby Lapo » 13 Dec 2019, 15:44

Thanks, it's clear now.
It's a matter of using the correct regular expression to catch a certain group of characters when they are used a single word vs. when they are part of a longer word. Such as in your example or something like "ass" versus "massage".

You can search a bit on Google to find example regex for your use case. Maybe this should help:
https://superuser.com/questions/903168/ ... cific-word

Sounds similar to what you want to do.
Lapo

--

gotoAndPlay()

...addicted to flash games
Tanker_5455
Posts: 4
Joined: 30 Nov 2019, 18:27

Re: Word Filter

Postby Tanker_5455 » 14 Dec 2019, 07:47

Thanks for the resource, I was quite annoyed with that as well. I tried to exclude some swearwords in different languages, but for example, the French insult "con" (a souped up "idiot") is used in many words (inconvénience, contre) and its exclusion messed up both French and English words (beacon, for example).
User avatar
ekrem5353
Posts: 118
Joined: 10 Dec 2015, 15:50

Re: Word Filter

Postby ekrem5353 » 16 Dec 2019, 07:18

ok as a regex it works but only first one works. I added them on wordsFile.txt

(?i:asslicker)
(?i:bastard)
(?i:nigger)
(?i:nigga)
(?:^|\W)am(?:$|\W)
(?:^|\W)aq(?:$|\W)
(?:^|\W)oc(?:$|\W)
(?:^|\W)oç(?:$|\W)

like this when I write ama it passes as it should. but aqa does not pass. How should I add them to wordsFile. I tried before

(?i:asslicker)
(?i:bastard)
(?i:nigger)
(?i:nigga)
(?i:\bam\b)
(?i:\baq\b)

like this same thing heppened first word works but the rest of the words do not work

Maybe I should add them differently

Thanks
User avatar
ekrem5353
Posts: 118
Joined: 10 Dec 2015, 15:50

Re: Word Filter

Postby ekrem5353 » 16 Dec 2019, 07:54

Now I need to correct something. some of the words does not work

(?i:nigga)
(?i:\baq\b)
(?i:\boc\b)
(?i:\boç\b)
(?i:\bam\b)
(?i:\b0c\b)
(?i:\b0ç\b)
(?i:\bo.c\b)

here for example aq, oç, 0ç, ag did not work . but am, o.c worked which one comes first nothing to do with it I guess

it is regex related issue nothing to do with smartfox I think. if anyone had same problem can give suggestion maybe

Thanks
User avatar
ekrem5353
Posts: 118
Joined: 10 Dec 2015, 15:50

Re: Word Filter

Postby ekrem5353 » 16 Dec 2019, 08:15

ok I found the problem its my bad under the list there were words with . (dot) added to the end of the words. I removed them now it seems to work properly.

thanks.

Return to “SFS2X Questions”

Who is online

Users browsing this forum: No registered users and 54 guests