Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Bad Word Filter PRO - Solution against profanity and obscenity

Discussion in 'Assets and Asset Store' started by Stefan-Laubenberger, Jan 9, 2015.

  1. alk_arman

    alk_arman

    Joined:
    Jun 12, 2017
    Posts:
    2
    Hi,

    This plugin adding CT_BWF symbol on project setting per version 2.9.6 - 17 Nov 2017 as per documentation.
    This symbol also not referenced anywhere else in the code.
    May the team clarify what this symbol is needed for? Is it safe to omit this symbol?

    Thanks
     
  2. Stefan-Laubenberger

    Stefan-Laubenberger

    Joined:
    May 25, 2014
    Posts:
    1,976
    Hi

    The compile define CT_BWF is only needed to know if BWF is actually installed (e.g. for other assets etc.).
    If you don't want it, just delete "CompileDefines.cs" and remove the entry.


    Cheers
    Stefan
     
  3. alk_arman

    alk_arman

    Joined:
    Jun 12, 2017
    Posts:
    2
    Alright, thank you, it is crystal clear now
     
    Stefan-Laubenberger likes this.
  4. PandaArcade

    PandaArcade

    Joined:
    Jan 2, 2017
    Posts:
    128
    Hi @Stefan-Laubenberger :)

    I grabbed BWF filter yesterday and have implemented it in our project but I can't find a setting that makes it as strict as I need it to be.

    For example, A player can use nicknames like DonkeyDick and BabySex and BadWordManager.Contains() returns false. Short of adding regex for every word I don't want to be used like this is there any way to make BWF more strict?
     
  5. Stefan-Laubenberger

    Stefan-Laubenberger

    Joined:
    May 25, 2014
    Posts:
    1,976
    Hi PandaArcade

    Thank you for investing into BWF!

    As you can imagine, every user of BWF has other rules, what they want to get filtered.

    The basic idea of BWF back in 2014 was to provide the code to filter words; the languages where added as a "bonus". They were made to fit for most people out-of-the-box.

    Because filtering is a thin red line: one wrong filter, and you filter too much. The classic example is "Scunthorpe".
    There is also a wide spectrum of opinions to the question: what is a bad word? Some people are more and easier offended by words than others, so what to pick and whatnot?

    Therefore, we decided to be not to restrictive and let the user change and add the regexes for every language.
    I'm fully aware that it is some work, but I'm afraid this is inevitable.

    However, you are right, the filter for the two examples you provided are not strict enough and will be updated in the next version.
    Just find the regex in "en.txt" (line 63) and "global.txt" (line 44) and add \w* in front of the word to catch all variants of your examples.

    I hope you understand our point of view.


    Cheers
    Stefan


    To all customers
    We're happy to add new words and changed filters to the asset, so if you like to see the integrated, just send us the updated files. We have a "Credits"-section with wonderful people who helped improving BWF, so if you want to be part of that list, go ahead ;)
     
  6. PandaArcade

    PandaArcade

    Joined:
    Jan 2, 2017
    Posts:
    128
    @Stefan-Laubenberger Thanks for the explanation

    Is this expected behavior? - When I call BadWordManager.ReplaceAll("1234 dick") it returns irea ****

    It has successfully replaced dick with **** but strangely changed the number at the beginning to letters.
     
    Last edited: Aug 31, 2019
  7. Stefan-Laubenberger

    Stefan-Laubenberger

    Joined:
    May 25, 2014
    Posts:
    1,976
    Hi

    This happens if "Replace Leet Speak" is enabled; please disable it:
    upload_2019-8-31_12-4-24.png


    Cheers
    Stefan
     
  8. PandaArcade

    PandaArcade

    Joined:
    Jan 2, 2017
    Posts:
    128
    Thanks @Stefan-Laubenberger. This is weird behavior.

    Another problem we're having is that BWM is renaming anything you select to BWF even if it didn't have anything to do with BWM. We did find the Ensure Name settings which when disabled does stop this from happening. The Ensure Name setting isn't saved in the project so we had to make sure everyone working on the project had this setting disabled on their computer. Why even have the Ensure Name setting?
     
  9. Stefan-Laubenberger

    Stefan-Laubenberger

    Joined:
    May 25, 2014
    Posts:
    1,976
    BWF is a singleton and we wanted to make sure that only one instance is in the scene. Furthermore, it helps us to detect if BWF is in the scene.

    Anyway, I apologize for the hassle it caused for your team, but you can simply change the value of the variable "DEFAULT_ENSURE_NAME" (line 70) in "Constants.cs" to false. That will solve it for all users.


    Cheers
    Stefan
     
    PandaArcade likes this.
  10. PandaArcade

    PandaArcade

    Joined:
    Jan 2, 2017
    Posts:
    128
    Hi Stefan,

    I've updated to the latest version of BWF and it doesn't compile. I get this error...

    Assets\Plugins\crosstales\BadWordFilter\Editor\Util\GAApi.cs(17,30): error CS0117: 'EditorConfig' does not contain a definition for 'TRACER'

    Btw BWF doesn't allow the word after o_O

    Thanks,

    Paul J.
     
  11. Stefan-Laubenberger

    Stefan-Laubenberger

    Joined:
    May 25, 2014
    Posts:
    1,976
    Hi Paul

    Please follow chapter 10 of the documentation:
    https://www.crosstales.com/media/data/assets/badwordfilter/BadWordFilter-doc.pdf

    About the detection: "after" is a bad word in German. Anyway, you can prevent this by calling the methods (e.g. "Contains") with the sources you need (or delete the word).
    To identify which regex triggered a detection, you could enable "Debug BadWords" in the configuration.

    I hope this helps you further.


    Cheers
    Stefan
     
  12. Info-Gamer

    Info-Gamer

    Joined:
    Aug 28, 2015
    Posts:
    3
    This bad word filter looks like it works really well! Great job! I created my own bad word filter which is not as in-depth as yours but it works quick and simply. If you'd like to check it out you can find it here.
     
  13. Stefan-Laubenberger

    Stefan-Laubenberger

    Joined:
    May 25, 2014
    Posts:
    1,976
    Hi

    Thank you for sharing your solution!

    It's a good starting point to get the basics about "bad word"-filtering. Everyone will start with something similar and then realize, that it's really, really hard to do good and accurate filtering.
    Some pitfalls:
    1. Comparing strings: you will end up with countless variations of words; e.g. the word "butt" in your demo video: what about "buttface", "butthair" etc.? Users are pretty creative :)
    2. Complexity: the next step after string compare is something like to use "string.Contains", which will also detect wrong words like "Scunthorpe"
    3. Some users use leet-speak or similar to write bad words, like "p0rn"; more variations!
    4. Unicode: you can do some nasty stuff with it; there are some unpleasing symbols available.
    Then add multiple languages to it and you have a full time job ;)

    Seriously, there is a reason we created this asset. If you honor your time and also put a price tag to it, let's say $10 per hour, there is no way you can accomplish this task in 4 hours.
    Therefore, by buying a battle-tested and supported solution, you will end up seeing much better results than any "quick and dirty" solution.
    Why re-invent the wheel, except for educational purposes? One thing less to care about, yolo!


    Cheers
    Stefan



    P.S:
    Your post seems to be an ad to your service. It would be nice if you would show your users how it's really done by linking to our asset in the store. :cool:
     
  14. busalaev

    busalaev

    Joined:
    May 1, 2019
    Posts:
    3
    upload_2020-2-13_16-56-11.png
    I`m sorry for my "english". :) I just almost bought a plugin, and an online test showed a terrible result.:)
     
  15. Stefan-Laubenberger

    Stefan-Laubenberger

    Joined:
    May 25, 2014
    Posts:
    1,976
    Unfortunately, we can't speak Russian very well, but instead of insulting our product, you're welcome to help us improve the filter :)

    The online demo version of our tool is very old and we should update it asap; the actual version has a lot of new features and detection rules since the version you tested.


    Edit
    As you can see, the new version works:
    upload_2020-2-14_11-7-42.png
     
    Last edited: Feb 14, 2020
  16. busalaev

    busalaev

    Joined:
    May 1, 2019
    Posts:
    3
    not really) the word "охуел" - is very bad.
     
  17. Stefan-Laubenberger

    Stefan-Laubenberger

    Joined:
    May 25, 2014
    Posts:
    1,976
    Good to know, it's added to the filter :)

    Bad Word Filter does not claim to filter all bad words in any language. Every customer has another level of what's a bad word, so they can add new words and customize the existing ones in the filter.
    It's also easy to add new filters for new languages etc.; that's the power of BWF.

    Our "Russian"-filter has over 250 regex words which detects hundreds of variations; but we know, Russian has a lot of swear words, so it maybe has to be extended for a specific usage.

    As I said, we're always appreciate feedback and new words from users since we can't speak 25 languages ;)
     
  18. busalaev

    busalaev

    Joined:
    May 1, 2019
    Posts:
    3
    Any Russian "hunky" can make a large database of bad words just for a couple of liters of beer.))
     
  19. Ghetaldus

    Ghetaldus

    Joined:
    Jul 15, 2017
    Posts:
    46
    What is purpose of "Simple Check" setting?
    Filter seems to catch chinese bad words with both disabled or enabled Simple Check.
     
  20. Stefan-Laubenberger

    Stefan-Laubenberger

    Joined:
    May 25, 2014
    Posts:
    1,976
    Hi

    "Simple Check" is mainly much faster than the normal check since it doesn't use regular expressions for the matching.
    We recommend using this setting for Chinese, Korean, Japanese and Thai.

    I hope this helps you further.

    Stay safe!


    Cheers
    Stefan
     
    Ghetaldus likes this.
  21. Stefan-Laubenberger

    Stefan-Laubenberger

    Joined:
    May 25, 2014
    Posts:
    1,976
    twobob likes this.
  22. reggie_sgs

    reggie_sgs

    Joined:
    Jun 29, 2014
    Posts:
    276
    I wanted to request that you remove this from the product as I don't want to have this modifying my defines every time I install or update it. I was actually coming here just to look into this as well so it's nice to see it was already answered. I think most people know how to do this if required so forcing it on everyone is not ideal.

    Thanks,
    Reggie
     
  23. Stefan-Laubenberger

    Stefan-Laubenberger

    Joined:
    May 25, 2014
    Posts:
    1,976
    Hi Reggie

    The compile define is quite relevant for integrations with other assets.
    However, the next release of BWF will have the option to disable adding compile defines:
    upload_2020-5-5_22-27-17.png

    I hope this fulfills your request.

    Cheers
    Stefan
     
  24. reggie_sgs

    reggie_sgs

    Joined:
    Jun 29, 2014
    Posts:
    276
    Thanks, that would be nice. It was quite frustrating to delete and then find it re-appeared again. I had to track down and delete the offending script to finally stop it.
     
  25. gecko

    gecko

    Joined:
    Aug 10, 2006
    Posts:
    2,240
    Hi, we've been using BWF for awhile, really love it. But we'd like to move the badword lists to our web server, so we can easily edit them without doing a new build of the game. Is there a way to do that -- have the game pull the data from a file on our server (and use the in-build data only as a fallback)?

    thanks
    Dave
     
  26. Stefan-Laubenberger

    Stefan-Laubenberger

    Joined:
    May 25, 2014
    Posts:
    1,976
    Hi Dave

    This is quite easy: just edit or copy the existing sources and enter the URL to your bad words:
    upload_2020-5-13_0-23-58.png

    I hope this helps you further.


    Cheers
    Stefan
     
    twobob and gecko like this.
  27. tonzusj

    tonzusj

    Joined:
    May 18, 2020
    Posts:
    1
    Hello-
    Does this asset require internet connection in order to do the name check?
     
  28. Stefan-Laubenberger

    Stefan-Laubenberger

    Joined:
    May 25, 2014
    Posts:
    1,976
    Hi

    No, BWF works offline.
    I hope this answers your question.

    Stay safe!


    Cheers
    Stefan
     
  29. gecko

    gecko

    Joined:
    Aug 10, 2006
    Posts:
    2,240
    Apologies if this is addressed in the docs, but I couldn't find it: In in-game text chat, if a player types a badword in a sentence, then that sentence is displayed with the replacement characters for the badword. But if they type just a badword, then nothing appears at all after they submit it. Which is confusing to that player. Are there other options for that--either show the replacement characters, or some feedback?

    thx!
    Dave
     
  30. Stefan-Laubenberger

    Stefan-Laubenberger

    Joined:
    May 25, 2014
    Posts:
    1,976
    Hi Dave

    I may not fully understand the problem.
    At which point do you check for bad words? Imho, it should be at the moment, the user hits "Enter" or the "Submit" button; BWF should be called and test the text and eventually correct it (e.g. with "ReplaceAll").

    You could also constantly test (e.g. in an interval of 100ms) with "Contains" and disable the "Submit"-action until there are no longer any bad words.
    The other option is the same as above but with "GetAll" - you could use the result with the "Mark"-method to display the found words in the input field or use a separate UI section to display all current bad words.

    Does that help you further?


    So long,
    Stefan
     
  31. gecko

    gecko

    Joined:
    Aug 10, 2006
    Posts:
    2,240
    Thanks for the reply. I think we're using the default functions, but my question is: Why is the badword replaced with the replacement characters when part of a longer phrase, but if the user submits only a badword alone, nothing is displayed? The latter is confusing. Would be better if the badword was always replaced with the replacement characters, no matter if there are other words with it or not.
     
  32. Stefan-Laubenberger

    Stefan-Laubenberger

    Joined:
    May 25, 2014
    Posts:
    1,976
    Our demo works with only one bad word, so I don't know why it doesn't work on your side.
    Can you please provide me more details, like a code snippet?
     
  33. twobob

    twobob

    Joined:
    Jun 28, 2014
    Posts:
    2,058
    Best app ever. Get it
     
    Stefan-Laubenberger likes this.
  34. InglewoodTechnology

    InglewoodTechnology

    Joined:
    Mar 7, 2016
    Posts:
    40
    Unity 2019.4.8f1, downloaded latest BWF and dragged BWF prefab into my main scene BUT the prefab cant find the BWFManager script. How to proceed?
     
  35. Stefan-Laubenberger

    Stefan-Laubenberger

    Joined:
    May 25, 2014
    Posts:
    1,976
    Hi

    Did you add the prefab via the configuration window?
    upload_2020-11-23_19-31-5.png

    So long,
    Stefan
     
  36. InglewoodTechnology

    InglewoodTechnology

    Joined:
    Mar 7, 2016
    Posts:
    40
    Stefan, thanks for the quick reply. My entire BWF install looks bad now. I tried to update my install and took these steps from the docs:

    1. Update "Bad Word Filter PRO" to the latest version from the "Unity AssetStore"
    2. Inside the project in Unity, go to menu "File" => "New Scene"
    3. Delete the "Assets/Plugins/crosstales/BadWordFilter" folder from the Project-view
    4. Import the latest version downloaded from the "Unity AssetStore

    But I don't have any way to access the config window; no menu options related to BWF.
     
  37. Stefan-Laubenberger

    Stefan-Laubenberger

    Joined:
    May 25, 2014
    Posts:
    1,976
    That's really strange :-(
    Can you please delete "Assets/Plugins/crosstales" and re-import it again?
    Do you see any errors in the console?
     
  38. InglewoodTechnology

    InglewoodTechnology

    Joined:
    Mar 7, 2016
    Posts:
    40
    Ah. Hm. I was getting errors generated from MY scripts, as they were referencing BWF ("using Crosstales.BWF.Manager")

    I comment out those lines in my scripts, no more errors, and now the BWF installation looks great (using tools/Bad Word Filter PRO I can add prefab, &c.)

    EXCEPT THAT

    My scripts now fail on "using Crosstales.BWF.Manager"; did the namespace change in latest version or...?
     
  39. Stefan-Laubenberger

    Stefan-Laubenberger

    Joined:
    May 25, 2014
    Posts:
    1,976
    Can you please show me the error?
     
  40. InglewoodTechnology

    InglewoodTechnology

    Joined:
    Mar 7, 2016
    Posts:
    40
    The type or namespace name 'Crosstales' could not be found (are you missing a using directive or an assembly reference?)
     
  41. Stefan-Laubenberger

    Stefan-Laubenberger

    Joined:
    May 25, 2014
    Posts:
    1,976
    Hmm, but test-drive and our demo scenes are working?
     
  42. InglewoodTechnology

    InglewoodTechnology

    Joined:
    Mar 7, 2016
    Posts:
    40
    To be clear; if my scripts don't reference Crosstales namespace, everything works.

    Prior to recent upgrade this was not an issue; everything worked. Since upgrade (steps as per doc instructions), my scripts can not now ref Crosstales namespace (errors as above and BWF not appearing in tools menu).
     
  43. Stefan-Laubenberger

    Stefan-Laubenberger

    Joined:
    May 25, 2014
    Posts:
    1,976
    is there an asmdef-file under "Plugins" or inside "crosstales"?
     
  44. InglewoodTechnology

    InglewoodTechnology

    Joined:
    Mar 7, 2016
    Posts:
    40
    No, no asmdef BUT I do see "crosstales" folders under both "Plugins" folder AND under "Editor Default Resources" folder; is this correct?
     
  45. Stefan-Laubenberger

    Stefan-Laubenberger

    Joined:
    May 25, 2014
    Posts:
    1,976
    That's correct that way.
    Can you please just create a new, empty project and import BWF there?
    Unfortunately, I currently have no other idea what could be wrong :(
     
  46. InglewoodTechnology

    InglewoodTechnology

    Joined:
    Mar 7, 2016
    Posts:
    40
    This is a very good tech support idea, I appreciate your help.

    Brand new project in a brand new folder, imported BWF, added prefab using config window. no complaints.

    HOWEVER, in Visual Studio Code I am seeing the attached errors:
     

    Attached Files:

  47. Stefan-Laubenberger

    Stefan-Laubenberger

    Joined:
    May 25, 2014
    Posts:
    1,976
    But you have no errors in Unity?
     
  48. InglewoodTechnology

    InglewoodTechnology

    Joined:
    Mar 7, 2016
    Posts:
    40
    No errors in Unity, runs fine; I guess that's that? There is something specific to my original project that is the problem, not the config of BWF?
     
  49. Stefan-Laubenberger

    Stefan-Laubenberger

    Joined:
    May 25, 2014
    Posts:
    1,976
    I really don't know why you are seeing those errors in VS :confused:
    Maybe the installation ("Unity tools for VS") is broken?
    Is it possible to re-install it?
     
  50. Ghetaldus

    Ghetaldus

    Joined:
    Jul 15, 2017
    Posts:
    46
    Just updated today from older version to latest and I see that ReplaceAll seem to not work without having to specify for which sources. It was handy to just do like so and have it use all sources.
    upload_2020-12-23_14-18-55.png

    This is the error:
    upload_2020-12-23_14-19-38.png

    PS.
    I see that latest docs say that it should work, so not sure if it is a bug then.