I did a few searches and I could not find any open source lame filter for rails. Is there anything similar? I am trying to limit lame user-created content, in particular, all caps, improper capitalization, excessive exclamation points, and excessive bold or italics.
Here's a ruby Bayesian classifier that can be taught to block certain types of content. This will require some creativity to apply directly to your problem.
This is a commercial service, but SocialMod is worth mentioning.
, . - .
before_validation :filter_lameness def filter_lameness # reduce exclamation marks content.gsub!(/![!1]+/, "!") # Proper capitalization. content.gsub!(/(\.\s*[a-z])/, $1.upcase) # capital starts sentence content.gsub!(/([A-Z]{5,})/, $1.capitalize) # lowercases all but first letter in a string of capitals. Minimum length 5. # etc... return true # needed in case the last gsub matches nothing, otherwise validation returns nil and will fail end
demerit , .
Source: https://habr.com/ru/post/1720714/More articles:wcf Removing wsdl from WCF Service with Flattened WSDL - wsdlIs there any use for porting the Haskell Edison and Core APIs to F #? - immutabilityInterruption Using TSQLQuery & params - sqlForce a registered user to log in without invalidating his session - c #Can aspect-oriented programming be a positive addition to the C # language? - c #How can I break the python search: make.up.a.dot.separated.name.and.use.it.until.destroyed = 777 - pythonWhat are the functional differences between AspectJ and PostSharp? - javaMySQL: LEFT JOIN .. select everything from table 1, even if it is not in table 2? - sqlWriting a compiler in your native language - compiler-constructionShould I allow 2 char password? - securityAll Articles