I am creating an application that allows a user to post messages to a board. I want to be able to filter profanity. For instance if someone types an inappropriate word of 5 characters I want it to read "#?@#@" or whatever. Ideally, I would be able to install a rails plugin or ruby gem and then simply write Code : - fold - unfold --> message_text.hide_profanity! <-- and that would automatically hide all words deemed inappropriate by the filter. I would also be OK with it being part of the validation, i.e. --> validates_no_profanity :message <-- which would raise errors should there be any profanity in the value. Is there any easy rails plugin or ruby gem that does this. This seems like such a common need for an application that reinventing the wheel seems foolish. Thanks, -Nathan -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Can''t you use the original text and the message_text.hide_profanity! text and combine them together? -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
I haven''t seen any but it wouldn''t be that hard to RYO with word lists. Also, you can check out www.webpurify.com which is a service with a REST API (free for non-commercial use). If you were to RYO, you may want to think about the following: - converting L337-speak to letters prior to filtering (e.g. @ -> a, | \| -> n) - using wordlists for multiple languages --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Nathan Esquenazi wrote:> I am creating an application that allows a user to post messages to a > board. I want to be able to filter profanity. For instance if someone > types an inappropriate word of 5 characters I want it to read "#?@#@" or > whatever. Ideally, I would be able to install a rails plugin or ruby gem > and then simply write > > > Code : - fold - unfold > > --> message_text.hide_profanity! <-- > > and that would automatically hide all words deemed inappropriate by the > filter. > > I would also be OK with it being part of the validation, i.e. > > --> validates_no_profanity :message <-- > > which would raise errors should there be any profanity in the value. > > Is there any easy rails plugin or ruby gem that does this. This seems > like such a common need for an application that reinventing the wheel > seems foolish. > > Thanks, > > -NathanI just created a Profanity Filter plugin for Rails during the Community Code Drive at RailsConf 08. It''s just a one-liner in your model. You can find it here: http://github.com/adambair/profanity-filter/tree/master If you encounter any issues, just log your concern at: http://adambair.lighthouseapp.com/projects/12000-profanity-filter/tickets Hopefully someone will find this useful! -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Adam Bair wrote:> I just created a Profanity Filter plugin for Rails during the Community > Code Drive at RailsConf 08. It''s just a one-liner in your model. You > can find it here: > > http://github.com/adambair/profanity-filter/tree/master > > If you encounter any issues, just log your concern at: > > http://adambair.lighthouseapp.com/projects/12000-profanity-filter/tickets > > Hopefully someone will find this useful!Actually, I just renamed this to Fu-fu: The Profanity Filter for Rails. http://github.com/adambair/fu-fu/tree/master http://adambair.lighthouseapp.com/projects/12000-fu-fu/overview -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Adam Bair wrote:> Adam Bair wrote: > >> I just created a Profanity Filter plugin for Rails during the Community >> Code Drive at RailsConf 08. It''s just a one-liner in your model. You >> can find it here:Cool... I wrote my own solution to this a while ago. Not as elegant, perhaps. http://pastie.caboo.se/206695 -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Matthew Rudy Jacobs wrote:> > Cool... > I wrote my own solution to this a while ago. > Not as elegant, perhaps. > > http://pastie.caboo.se/206695also, my solution is just a view helper... hence we don''t destroy our user''s data. it may be the case that you want to censor something in one context (a front page "random comment" perhaps?) but keep the original content in its true form on the proper page. -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Matthew Rudy Jacobs wrote:> Matthew Rudy Jacobs wrote: > >> >> Cool... >> I wrote my own solution to this a while ago. >> Not as elegant, perhaps. >> >> http://pastie.caboo.se/206695 > > also, > my solution is just a view helper... > hence we don''t destroy our user''s data. > > it may be the case that you want to censor something in one context > (a front page "random comment" perhaps?) > but keep the original content in its true form on the proper page.and here''s my test http://pastie.caboo.se/206697 -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Matthew Rudy Jacobs wrote:> Matthew Rudy Jacobs wrote: > >> >> Cool... >> I wrote my own solution to this a while ago. >> Not as elegant, perhaps. >> >> http://pastie.caboo.se/206695 > > also, > my solution is just a view helper... > hence we don''t destroy our user''s data. > > it may be the case that you want to censor something in one context > (a front page "random comment" perhaps?) > but keep the original content in its true form on the proper page.Yeah, the data modification could be an issue for some folks and will be changing shortly. I''ll be updating the plugin over the next day or so the original text will be left in the database: http://adambair.lighthouseapp.com/projects/12000/tickets/4-provide-an-option-to-make-the-filter-non-destructive I''ll also be working on a new (better) regex for curse detection: http://adambair.lighthouseapp.com/projects/12000/tickets/6-update-filter-to-use-a-more-appropriate-regex Thanks for the suggestions! Please feel free to create new tickets. :) -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Matthew Rudy Jacobs wrote:> Matthew Rudy Jacobs wrote: > >> >> Cool... >> I wrote my own solution to this a while ago. >> Not as elegant, perhaps. >> >> http://pastie.caboo.se/206695 > > also, > my solution is just a view helper... > hence we don''t destroy our user''s data. > > it may be the case that you want to censor something in one context > (a front page "random comment" perhaps?) > but keep the original content in its true form on the proper page.Fu-fu now has two modes: destructive (profanity_filter!) and non-destructive (profanity_filter). The non-destructive version will leave the original text in the database and only filter when called. The safe method will not modify stored data. -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---