DEV Community

Cover image for ⚡ I Made a JavaScript Library that Leaves Profanity Speechless! 🤬

⚡ I Made a JavaScript Library that Leaves Profanity Speechless! 🤬

Best Codes on February 08, 2024

How I Built a Profanity Blocking JavaScript Library Introduction As developers, we often come across situations where we need...
Collapse
 
michaeltharrington profile image
Michael Tharrington • Edited

Rock on! Such a cool idea and nice to give folks the option to have this filter.

Also, I appreciate ya labeling that you used AI to assist with the writing... annnnd, particularly cool that it's your own flavor of AI, too!

Good stuff all around, Best Codes. 🙌

Collapse
 
best_codes profile image
Best Codes

Thank you! I'm glad you enjoyed my post.

I believe that I read the guidelines here:
dev.to/devteam/guidelines-for-ai-a...
And they said that I could just put a disclaimer at the end.

I don't like to put it there for some of my posts, because I mostly use AI to rephrase, correct grammar, etc. and not to create content (AI content is quite shallow or uncreative, usually). But, I figure that it's good to be on the safe side and put it there anyway.

Such a cool idea and a good cause.

I originally made this because I made a simple home and weather monitor for myself, which included a home assistant I made called 'Heather'. I could ask it things, and it would search the Internet and use NLP to generate a result. Obviously, I didn't feel like having my AI spout profanity at me, so I created this filter for incoming commands (in case it misheard) and spoken text (in case the result was unsafe).

To others reading this comment, I will warn you that the word list itself is quite strict (it contains about 400 words, if that gives you an idea), so please feel free to customize it for your needs.

Thanks again for the feedback!

Collapse
 
michaeltharrington profile image
Michael Tharrington

That's exactly right! Putting the disclaimer at the end is totally acceptable.

Plus, it really does sound like you are using it lightly and tactfully. Your post sounds very human to me, it's clear that you're putting yourself into it and that's the main thing as far as we're concerned. 🙂

Obviously, I didn't feel like having my AI spout profanity at me

Oh yeah, good call! That would be an odd and unfortunate experience.

Sounds like you've made a cool bot, and I like that ya went with "Heather" when it's primary task was for monitoring the weather. "Heather, how's the weather?" is satisfying. 😀

Thread Thread
 
best_codes profile image
Best Codes • Edited

OK, great! I'm glad I did everything correctly. 🙂

"Heather, how's the weather?" is satisfying. 😀

Actually, one of my friends came up with the name. I told them I was working on a home and weather monitor, and I needed a name for the assistant. They suggested that I combine the H in home with Weather. So, I did. 😀

As you can see, the AI does still need some work, but it described you fairly well, I think:
("Who is Michael Tharrington?")

Image description

Anyway, thanks for chatting, and have a great weekend!

Collapse
 
jameslivesey profile image
James Livesey

Very cool! But is it subject to the Scunthorpe problem?

(Hopefully this comment doesn't trigger the dev.to profanity filters 😅)

Collapse
 
best_codes profile image
Best Codes

I'm glad you brought this up! That's exactly why I included the matchWord parameter in my library. That way, if cat was a bad word, then catastrophe would not trigger it. Plus, many profanity filters (and hopefully mine, here soon) are beginning to use NLP or brain.js filters that analyze sentiment or intent rather than the words themselves (AI, in a sense).
Thanks for the feedback!

Collapse
 
vitustockholm profile image
Vitus

nice one ;))) nice project

Collapse
 
best_codes profile image
Best Codes

Thanks! I'm glad you liked it.

Collapse
 
jim22_s profile image
Info Comment hidden by post author - thread only accessible via permalink
Jim Pincer

Image description

:/

Interesting though

Collapse
 
best_codes profile image
Best Codes

Hi Jim, thanks for the feedback! It looks like you are using GPT Zero to see if my content is AI. While some of it is (as stated at the bottom of the post), certainly less than 60 sentences are!
I would encourage you to read this article about using GPT Zero here:
gptzero.me/news/5-steps-towards-re...
Thanks again for the feedback and happy coding!

Collapse
 
happyhigg123 profile image
Bcfiend(dad

This is so cool
I like the Base64 encoded part

Collapse
 
best_codes profile image
Best Codes

Thanks! I'm glad you enjoyed.

Some comments have been hidden by the post's author - find out more