Permalink
Browse files

updated readme and Rakefile. Fixed bug in flagged_words.

  • Loading branch information...
1 parent c5eec69 commit 44be36d98f7ddca75d88382d6ccc7f8974540540 Michael Edgar committed Aug 11, 2011
Showing with 3 additions and 128 deletions.
  1. +0 −108 README.markdown
  2. +2 −19 Rakefile
  3. +1 −1 lib/profanalyzer.rb
View
@@ -1,108 +0,0 @@
-# profanalyzer
-
-* http://profanalyzer.rubyforge.org/
-
-## Description
-
-Profanalyzer has one purpose: analyze a block of text for profanity. It is able to filter profane words as well.
-
-What sets it slightly apart from other filters is that it classifies each blocked word as "profane", "racist", or "sexual" - although right now, each word is considered "profane". It also rates each word on a scale from 0-5, which is based on my subjective opinion, as well as whether the word is commonly used in non-profane situations, such as "ass" in "assess".
-
-The Profanalyzer will default to a tolerance of of 4, which will kick back the arguably non-profane words. It will also test against all words, including racist or sexual words.
-
-Lastly, it allows for custom substitutions! For example, the filter at the website http://www.fark.com/ turns the word "fuck" into "fark", and "shit" into "shiat". You can specify these if you want.
-
-## FEATURES/PROBLEMS:
-
-* Tolerance-based filtering
-* Switch between checking all words, racist terms, sexual words, or some
- mixture
-* Custom substitutions
-* Boolean-based profanity checking (skipping the filtering)
-
-## SYNOPSIS:
-
-Out of the box, you can simply use Profanalyzer.filter and
-Profanalyzer.profane?:
-
- require 'rubygems'
- require 'profanalyzer'
-
- Profanalyzer.profane? "asshole" #==> true
- Profanalyzer.filter "asshole" #==> "#!$%@&!"
-
-Then you can change the tolerance:
-
- Profanalyzer.tolerance = 5
- Profanalyzer.profane? "hooker" #==> false
-
-Or do specific checking:
-
- Profanalyzer.check_all = false # turn off catch-all checking
- Profanalyzer.check_racist = false # don't check racial slurs
- Profanalyzer.check_sexual = true # sexual checking on
-
- Profanalyzer.profane? "mick" #==> false
- Profanalyzer.profane? "vagina" #==> true
-
-You can obtain a list of the words which fell afoul of profanity checking:
-
- Profanalyzer.flagged_words("shit damn foo") #==> ["shit", "damn"]
- Profanalyzer.flagged_words("profanalyzer is rad!") #==> []
-
- # With custom settings
- Profanalyzer.check_all = false
- Profanalyzer.check_racist = false
- Profanalyzer.flagged_words("you're a mick") #==> []
-
- # You can pass options to the method itself:
- Profanalyzer.flagged_words("you're a mick", :racist => false) #==> []
-
-Lastly, you can add custom substitutions:
-
- Profanalyzer.substitute("shit","shiat")
- Profanalyzer.filter "shit" #==> "shiat"
-
- Profanalyzer.substitute(:fuck => :fark)
- Profanalyzer.filter("fuck") #==> "fark"
-
-
-## Requirements
-
-hoe - a gem for building gems, which I used for profanalyzer.
-
-## Contributors
-
-* Michael Edgar <adgar@carboni.ca>
-* Thomas Hanley <tjhanley.com@gmail.com>
-* Peter Vandenberk <pvandenberk@mac.com>
-* Christopher M. Hobbs <chris@altbit.org> (nilmethod)
-
-## Installation
-
-sudo gem install profanalyzer
-
-## License
-
-(The MIT License)
-
-Copyright (c) 2009 FIX
-
-Permission is hereby granted, free of charge, to any person obtaining
-a copy of this software and associated documentation files (the
-'Software'), to deal in the Software without restriction, including
-without limitation the rights to use, copy, modify, merge, publish,
-distribute, sublicense, and/or sell copies of the Software, and to
-permit persons to whom the Software is furnished to do so, subject to
-the following conditions:
-
-The above copyright notice and this permission notice shall be
-included in all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
-EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
-IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
-CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
-TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
-SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
View
@@ -4,27 +4,10 @@ require 'rubygems'
require 'hoe'
require './lib/profanalyzer.rb'
-Hoe.new('profanalyzer', Profanalyzer::VERSION) do |p|
- p.rubyforge_name = 'profanalyzer' # if different than lowercase project name
- p.developer('Michael J. Edgar', 'edgar@triqweb.com')
+Hoe.spec('profanalyzer') do |p|
+ p.developer('Michael J. Edgar', 'adgar@carboni.ca')
p.remote_rdoc_dir = ''
p.summary = "Analyzes a block of text for profanity. It is able to filter profane words as well."
- desc 'Post your blog announcement to blogger.'
- task :post_blogger do
- require 'blogger'
- p.with_config do |config, path|
- break unless config['blogs']
- subject, title, body, urls = p.announcement
-
- config['blogs'].each do |site|
- next unless site['url'] =~ /www\.blogger\.com/
- acc = Blogger::Account.new(site['user'],site['password'])
- post = Blogger::Post.new(:title => title, :content => body, :categories => p.blog_categories, :formatter => :rdiscount)
- acc.post(site['blog_id'], post)
-
- end
- end
- end
desc 'Pushes rdocs to carbonica'
task :carbonica => :redocs do
sh "scp -r doc/ adgar@carboni.ca@carboni.ca:/var/www/html/projects/#{p.name}/"
View
@@ -209,10 +209,10 @@ def self.flagged_words(*args)
banned_words = self.forbidden_words_from_settings
banned_words.each do |word|
if str =~ /\b#{word}\b/i
- @@settings = oldsettings if oldsettings
flagged_words << word
end
end
+ @@settings = oldsettings if oldsettings
return flagged_words
end

0 comments on commit 44be36d

Please sign in to comment.