1

I'm working on an iOS app that involves user input, and I'd like to keep it kid-friendly. One of the main features of the app is that user inputted titles and phrases can be shown to everyone who uses the app.

When a user creates a new title I want to verify that it is safe-for-work. My initial thought was just to have a list of all profane words and verify that none of them exist in the title:

for bad_word in list_of_bad_words:
    if bad_word in user_inputted_title:
         // Complain to user!
// Title is okay.

I imagine that there must be libraries or best practices for doing this. People could easily substitute numbers for letters, and I'm sure there are sequences of SFW words that create inappropriate phrases.

Can anyone suggest a better way of doing this? Specifically, if there are any Swift tools that would be awesome!

Alex
  • 676
  • 9
  • 20

1 Answers1

0

There are some cocoapods for this:

I haven't used either of these personally, but I hope these can be a good starting point. The first one replaces any profanity with asterisks, and the second can give you the range of the profanity so you can replace it with your own filler. Good luck.

SilentLupin
  • 658
  • 10
  • 16
  • Thanks for these! I looked at them but they do seem to do the basic test that I first thought of. I was hoping for some more complex algorithms, but I guess that's all there is... – Alex Aug 06 '15 at 17:41