profanalyzer 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/History.txt +11 -0
- data/Manifest.txt +7 -0
- data/README.txt +97 -0
- data/Rakefile +13 -0
- data/config/list.yml +1586 -0
- data/lib/profanalyzer.rb +212 -0
- data/test/test_profanalyzer.rb +92 -0
- metadata +72 -0
data/History.txt
ADDED
@@ -0,0 +1,11 @@
|
|
1
|
+
=== 0.1.0 / 2009-03-22
|
2
|
+
|
3
|
+
* First release
|
4
|
+
|
5
|
+
* Separates racist, sexual, and otherwise profane terms
|
6
|
+
* Rates each word on a scale from 0-5 of "badness", which is based on
|
7
|
+
my subjective opinion, and the use of the word in non-profane ways
|
8
|
+
(such as "ass" in "assess").
|
9
|
+
|
10
|
+
|
11
|
+
|
data/Manifest.txt
ADDED
data/README.txt
ADDED
@@ -0,0 +1,97 @@
|
|
1
|
+
= profanalyzer
|
2
|
+
|
3
|
+
* FIX (url)
|
4
|
+
|
5
|
+
== DESCRIPTION:
|
6
|
+
|
7
|
+
Profanalyzer has one purpose: analyze a block of text for profanity. It is
|
8
|
+
able to filter profane words as well.
|
9
|
+
|
10
|
+
What sets it slightly apart from other filters is that it classifies each
|
11
|
+
blocked word as "profane", "racist", or "sexual" - although right now, each
|
12
|
+
word is considered "profane". It also rates each word on a scale from 0-5,
|
13
|
+
which is based on my subjective opinion, as well as whether the word is
|
14
|
+
commonly used in non-profane situations, such as "ass" in "assess".
|
15
|
+
|
16
|
+
The Profanalyzer will default to a tolerance of of 2, which will kick back
|
17
|
+
the arguably non-profane words. It will also test against all words,
|
18
|
+
including racist or sexual words.
|
19
|
+
|
20
|
+
Lastly, it allows for custom substitutions! For example, the filter at the
|
21
|
+
website http://www.fark.com/ turns the word "fuck" into "fark", and "shit"
|
22
|
+
into "shiat". You can specify these if you want.
|
23
|
+
|
24
|
+
== FEATURES/PROBLEMS:
|
25
|
+
|
26
|
+
* Tolerance-based filtering
|
27
|
+
* Switch between checking all words, racist terms, sexual words, or some
|
28
|
+
mixture
|
29
|
+
* Custom substitutions
|
30
|
+
* Boolean-based profanity checking (skipping the filtering)
|
31
|
+
|
32
|
+
== SYNOPSIS:
|
33
|
+
|
34
|
+
Out of the box, you can simply use Profanalyzer.filter and
|
35
|
+
Profanalyzer.profane?:
|
36
|
+
|
37
|
+
require 'rubygems'
|
38
|
+
require 'profanalyzer'
|
39
|
+
|
40
|
+
Profanalyzer.profane? "asshole" #==> true
|
41
|
+
Profanalyzer.filter "asshole" #==> "#!$%@&!"
|
42
|
+
|
43
|
+
Then you can change the tolerance:
|
44
|
+
|
45
|
+
Profanalyzer.tolerance = 5
|
46
|
+
Profanalyzer.profane? "hooker" #==> false
|
47
|
+
|
48
|
+
Or do specific checking:
|
49
|
+
|
50
|
+
Profanalyzer.check_all = false # turn off catch-all checking
|
51
|
+
Profanalyzer.check_racist = false # don't check racial slurs
|
52
|
+
Profanalyzer.check_sexual = true # sexual checking on
|
53
|
+
|
54
|
+
Profanalyzer.profane? "mick" #==> false
|
55
|
+
Profanalyzer.profane? "vagina" #==> true
|
56
|
+
|
57
|
+
Lastly, you can add custom substitutions:
|
58
|
+
|
59
|
+
Profanalyzer.substitute("shit","shiat")
|
60
|
+
Profanalyzer.filter "shit" #==> "shiat"
|
61
|
+
|
62
|
+
Profanalyzer.substitute(:fuck => :fark)
|
63
|
+
Profanalyzer.filter("fuck") #==> "fark"
|
64
|
+
|
65
|
+
|
66
|
+
== REQUIREMENTS:
|
67
|
+
|
68
|
+
hoe - a gem for building gems, which I used for profanalyzer.
|
69
|
+
|
70
|
+
== INSTALL:
|
71
|
+
|
72
|
+
sudo gem install profanalyzer
|
73
|
+
|
74
|
+
== LICENSE:
|
75
|
+
|
76
|
+
(The MIT License)
|
77
|
+
|
78
|
+
Copyright (c) 2009 FIX
|
79
|
+
|
80
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
81
|
+
a copy of this software and associated documentation files (the
|
82
|
+
'Software'), to deal in the Software without restriction, including
|
83
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
84
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
85
|
+
permit persons to whom the Software is furnished to do so, subject to
|
86
|
+
the following conditions:
|
87
|
+
|
88
|
+
The above copyright notice and this permission notice shall be
|
89
|
+
included in all copies or substantial portions of the Software.
|
90
|
+
|
91
|
+
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
|
92
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
93
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
94
|
+
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
95
|
+
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
96
|
+
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
97
|
+
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/Rakefile
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
# -*- ruby -*-
|
2
|
+
|
3
|
+
require 'rubygems'
|
4
|
+
require 'hoe'
|
5
|
+
require './lib/profanalyzer.rb'
|
6
|
+
|
7
|
+
Hoe.new('profanalyzer', Profanalyzer::VERSION) do |p|
|
8
|
+
# p.rubyforge_name = 'profanalyzerx' # if different than lowercase project name
|
9
|
+
p.developer('Michael J. Edgar', 'edgar@triqweb.com')
|
10
|
+
p.remote_rdoc_dir = ''
|
11
|
+
end
|
12
|
+
|
13
|
+
# vim: syntax=Ruby
|