swearjar 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/README.rdoc +20 -0
- data/Rakefile +45 -0
- data/VERSION +1 -0
- data/config/en.yml +488 -0
- data/lib/swearjar/tester.rb +32 -0
- data/lib/swearjar.rb +59 -0
- data/spec/spec.opts +7 -0
- data/spec/spec_helper.rb +1 -0
- data/spec/swearjar_spec.rb +25 -0
- metadata +83 -0
data/README.rdoc
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
= Swearjar
|
2
|
+
|
3
|
+
Simple profanity detection with content analysis.
|
4
|
+
|
5
|
+
== Installation
|
6
|
+
|
7
|
+
gem install swearjar
|
8
|
+
|
9
|
+
== Usage
|
10
|
+
|
11
|
+
require 'swearjar'
|
12
|
+
|
13
|
+
Swearjar.default.profane?('jim henson has a massive hard on he is gonna use to fuck everybody')
|
14
|
+
<< true
|
15
|
+
|
16
|
+
Swearjar.default.scorecard('jim henson has a massive hard on he is gonna use to fuck everybody')
|
17
|
+
<< {:sexual => 2}
|
18
|
+
|
19
|
+
Swearjar.default.censor('jim henson has a massive hard on he is gonna use to fuck everybody')
|
20
|
+
<< 'jim henson has a massive **** ** he is gonna use to **** everybody'
|
data/Rakefile
ADDED
@@ -0,0 +1,45 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
begin
|
4
|
+
require 'jeweler'
|
5
|
+
Jeweler::Tasks.new do |s|
|
6
|
+
s.name = "swearjar"
|
7
|
+
s.description = s.summary = "Put another nickel in the swearjar."
|
8
|
+
s.email = "joshbuddy@gmail.com"
|
9
|
+
s.homepage = "http://github.com/joshbuddy/swearjar"
|
10
|
+
s.authors = "Joshua Hull"
|
11
|
+
s.files = FileList["[A-Z]*", "{lib,spec,config}/**/*"]
|
12
|
+
s.add_dependency 'fuzzyhash', '>=0.0.11'
|
13
|
+
s.add_dependency 'dirge', '>=0.0.3'
|
14
|
+
end
|
15
|
+
Jeweler::GemcutterTasks.new
|
16
|
+
rescue LoadError
|
17
|
+
puts "Jeweler not available. Install it with: sudo gem install technicalpickles-jeweler -s http://gems.github.com"
|
18
|
+
end
|
19
|
+
|
20
|
+
require 'spec'
|
21
|
+
require 'spec/rake/spectask'
|
22
|
+
task :spec => 'spec:all'
|
23
|
+
namespace(:spec) do
|
24
|
+
Spec::Rake::SpecTask.new(:all) do |t|
|
25
|
+
t.spec_opts ||= []
|
26
|
+
t.spec_opts << "-rubygems"
|
27
|
+
t.spec_opts << "--options" << "spec/spec.opts"
|
28
|
+
t.spec_files = FileList['spec/**/*_spec.rb']
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
desc "Run all examples with RCov"
|
33
|
+
Spec::Rake::SpecTask.new('spec_with_rcov') do |t|
|
34
|
+
t.spec_files = FileList['spec/**/*.rb']
|
35
|
+
t.rcov = true
|
36
|
+
t.rcov_opts = ['--exclude', 'spec']
|
37
|
+
end
|
38
|
+
|
39
|
+
require 'rake/rdoctask'
|
40
|
+
desc "Generate documentation"
|
41
|
+
Rake::RDocTask.new do |rd|
|
42
|
+
rd.main = "README.rdoc"
|
43
|
+
rd.rdoc_files.include("README.rdoc", "lib/**/*.rb")
|
44
|
+
rd.rdoc_dir = 'rdoc'
|
45
|
+
end
|
data/VERSION
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
0.0.1
|
data/config/en.yml
ADDED
@@ -0,0 +1,488 @@
|
|
1
|
+
regex:
|
2
|
+
'hard on': [:sexual]
|
3
|
+
"jerk off": [:sexual]
|
4
|
+
"pissed off": [:inappropriate]
|
5
|
+
"sand nigger": [:discriminatory]
|
6
|
+
simple:
|
7
|
+
"anus": [:sexual]
|
8
|
+
"arse": [:insult]
|
9
|
+
"arsehole": [:insult]
|
10
|
+
"ass": [:sexual :insult]
|
11
|
+
"ass-hat": [:insult]
|
12
|
+
"ass-pirate": [:discriminatory]
|
13
|
+
"assbag": [:insult]
|
14
|
+
"assbandit": [:discriminatory]
|
15
|
+
"assbanger": [:discriminatory]
|
16
|
+
"assbite": [:insult]
|
17
|
+
"assclown": [:sexual]
|
18
|
+
"asscock": [:insult]
|
19
|
+
"asscracker": [:sexual]
|
20
|
+
"asses": [:sexual]
|
21
|
+
"assface": [:sexual]
|
22
|
+
"assfuck": [:sexual]
|
23
|
+
"assfucker": [:discriminatory]
|
24
|
+
"assgoblin": [:discriminatory]
|
25
|
+
"asshat": [:sexual]
|
26
|
+
"asshead": [:insult]
|
27
|
+
"asshole": [:insult]
|
28
|
+
"assholes": [:insult]
|
29
|
+
"asshopper": [:discriminatory]
|
30
|
+
"assjacker": [:discriminatory]
|
31
|
+
"asslick": [:insult]
|
32
|
+
"asslicker": [:insult]
|
33
|
+
"assmonkey": [:insult]
|
34
|
+
"assmunch": [:insult]
|
35
|
+
"assmuncher": [:sexual]
|
36
|
+
"assnigger": [:discriminatory]
|
37
|
+
"asspirate": [:discriminatory]
|
38
|
+
"assshit": [:insult]
|
39
|
+
"assshole": [:sexual]
|
40
|
+
"asssucker": [:insult]
|
41
|
+
"asswad": [:sexual]
|
42
|
+
"asswipe": [:sexual]
|
43
|
+
"bampot": [:insult]
|
44
|
+
"bastard": [:insult]
|
45
|
+
"beaner": [:discriminatory]
|
46
|
+
"beastial": [:sexual]
|
47
|
+
"beastiality": [:sexual]
|
48
|
+
"beastility": [:sexual]
|
49
|
+
"bestial": [:sexual]
|
50
|
+
"bestiality": [:sexual]
|
51
|
+
"bitch": [:insult]
|
52
|
+
"bitchass": [:insult]
|
53
|
+
"bitcher": [:insult]
|
54
|
+
"bitchers": [:insult]
|
55
|
+
"bitches": [:insult]
|
56
|
+
"bitchin": [:inappropriate]
|
57
|
+
"bitching": [:inappropriate]
|
58
|
+
"bitchtits": [:discriminatory]
|
59
|
+
"bitchy": [:insult]
|
60
|
+
"blow job": [:sexual]
|
61
|
+
"blowjob": [:sexual]
|
62
|
+
"blowjobs": [:sexual]
|
63
|
+
"bollocks": [:sexual]
|
64
|
+
"bollox": [:sexual]
|
65
|
+
"boner": [:sexual]
|
66
|
+
"brotherfucker": [:discriminatory]
|
67
|
+
"bullshit": [:inappropriate]
|
68
|
+
"bullshit": [:inappropriate]
|
69
|
+
"bumblefuck": [:discriminatory]
|
70
|
+
"butt plug": [:sexual]
|
71
|
+
"butt-pirate": [:discriminatory]
|
72
|
+
"buttfucka": [:discriminatory]
|
73
|
+
"buttfucker": [:discriminatory]
|
74
|
+
"camel toe": [:sexual]
|
75
|
+
"carpetmuncher": [:discriminatory]
|
76
|
+
"chinc": [:discriminatory]
|
77
|
+
"chink": [:discriminatory]
|
78
|
+
"choad": [:sexual]
|
79
|
+
"chode": [:sexual]
|
80
|
+
"clit": [:sexual]
|
81
|
+
"clitface": [:insult]
|
82
|
+
"clitfuck": [:sexual]
|
83
|
+
"clusterfuck": [:inappropriate]
|
84
|
+
"cock": [:sexual]
|
85
|
+
"cockass": "Jerk"
|
86
|
+
"cockbite": [:insult]
|
87
|
+
"cockburger": [:insult]
|
88
|
+
"cockface": [:insult]
|
89
|
+
"cockfucker": [:insult]
|
90
|
+
"cockhead": [:insult]
|
91
|
+
"cockjockey": [:discriminatory]
|
92
|
+
"cockknoker": [:discriminatory]
|
93
|
+
"cockmaster": [:discriminatory]
|
94
|
+
"cockmongler": [:discriminatory]
|
95
|
+
"cockmongruel": [:discriminatory]
|
96
|
+
"cockmonkey": [:insult]
|
97
|
+
"cockmuncher": [:discriminatory]
|
98
|
+
"cocknose": [:insult]
|
99
|
+
"cocknugget": [:insult]
|
100
|
+
"cocks": [:sexual]
|
101
|
+
"cockshit": [:insult]
|
102
|
+
"cocksmith": [:discriminatory]
|
103
|
+
"cocksmoker": [:discriminatory]
|
104
|
+
"cocksuck": [:sexual]
|
105
|
+
"cocksucked": [:sexual]
|
106
|
+
"cocksucker": [:discriminatory :sexual]
|
107
|
+
"cocksucking": [:sexual :discriminatory]
|
108
|
+
"cocksucks": [:sexual :discriminatory]
|
109
|
+
"coochie": [:sexual]
|
110
|
+
"coochy": [:sexual]
|
111
|
+
"coon": [:discriminatory]
|
112
|
+
"cooter": [:sexual]
|
113
|
+
"cracker": [:discriminatory]
|
114
|
+
"cum": [:sexual]
|
115
|
+
"cum": [:sexual]
|
116
|
+
"cumbubble": [:insult]
|
117
|
+
"cumdumpster": [:sexual]
|
118
|
+
"cumguzzler": [:discriminatory]
|
119
|
+
"cumjockey": [:discriminatory]
|
120
|
+
"cummer": [:sexual]
|
121
|
+
"cumming": [:sexual]
|
122
|
+
"cums": [:sexual]
|
123
|
+
"cumshot": [:sexual]
|
124
|
+
"cumslut": [:sexual :insult]
|
125
|
+
"cumtart": [:insult]
|
126
|
+
"cunillingus": [:sexual]
|
127
|
+
"cunnie": [:sexual]
|
128
|
+
"cunnilingus": [:sexual]
|
129
|
+
"cunnilingus": [:sexual]
|
130
|
+
"cunt": [:insult :sexual]
|
131
|
+
"cuntface": [:insult]
|
132
|
+
"cunthole": [:sexual]
|
133
|
+
"cuntlick": [:sexual]
|
134
|
+
"cuntlicker": [:sexual :discriminatory]
|
135
|
+
"cuntlicking": [:sexual]
|
136
|
+
"cuntrag": [:insult]
|
137
|
+
"cunts": [:insult :sexual]
|
138
|
+
"cuntslut": [:insult]
|
139
|
+
"cyberfuc": [:sexual]
|
140
|
+
"cyberfuck": [:sexual]
|
141
|
+
"cyberfucked": [:sexual]
|
142
|
+
"cyberfucker": [:sexual]
|
143
|
+
"cyberfuckers": [:sexual]
|
144
|
+
"cyberfucking": [:sexual]
|
145
|
+
"dago": [:discriminatory]
|
146
|
+
"damn": [:inappropriate]
|
147
|
+
"deggo": [:discriminatory]
|
148
|
+
"dick": [:sexual :insult]
|
149
|
+
"dickbag": [:insult]
|
150
|
+
"dickbeaters": [:sexual]
|
151
|
+
"dickface": [:insult]
|
152
|
+
"dickfuck": [:insult]
|
153
|
+
"dickfucker": [:discriminatory]
|
154
|
+
"dickhead": [:insult]
|
155
|
+
"dickhole": [:sexual]
|
156
|
+
"dickjuice": [:sexual]
|
157
|
+
"dickmilk": [:sexual]
|
158
|
+
"dickmonger": [:discriminatory]
|
159
|
+
"dicks": [:sexual :insult]
|
160
|
+
"dickslap": [:sexual]
|
161
|
+
"dicksucker": [:discriminatory]
|
162
|
+
"dickwad": [:insult]
|
163
|
+
"dickweasel": [:insult]
|
164
|
+
"dickweed": [:insult]
|
165
|
+
"dickwod": [:insult]
|
166
|
+
"dike": [:discriminatory]
|
167
|
+
"dildo": [:sexual]
|
168
|
+
"dildos": [:sexual]
|
169
|
+
"dink": [:insult :sexual]
|
170
|
+
"dinks": [:sexual]
|
171
|
+
"dipshit": [:insult]
|
172
|
+
"doochbag": [:insult]
|
173
|
+
"dookie": [:inappropriate]
|
174
|
+
"douche": [:insult]
|
175
|
+
"douche-fag": [:insult]
|
176
|
+
"douchebag": [:insult]
|
177
|
+
"douchewaffle": [:discriminatory]
|
178
|
+
"dumass": [:insult]
|
179
|
+
"dumb ass": [:insult]
|
180
|
+
"dumbass": [:insult]
|
181
|
+
"dumbfuck": [:insult]
|
182
|
+
"dumbshit": [:insult]
|
183
|
+
"dumshit": [:insult]
|
184
|
+
"dyke": [:discriminatory]
|
185
|
+
"ejaculate": [:sexual]
|
186
|
+
"ejaculated": [:sexual]
|
187
|
+
"ejaculates": [:sexual]
|
188
|
+
"ejaculating": [:sexual]
|
189
|
+
"ejaculatings": [:sexual]
|
190
|
+
"ejaculation": [:sexual]
|
191
|
+
"fag": [:discriminatory]
|
192
|
+
"fagbag": [:discriminatory]
|
193
|
+
"fagfucker": [:discriminatory]
|
194
|
+
"fagging": [:discriminatory]
|
195
|
+
"faggit": [:discriminatory]
|
196
|
+
"faggot": [:discriminatory]
|
197
|
+
"faggot": [:discriminatory]
|
198
|
+
"faggotcock": [:discriminatory]
|
199
|
+
"faggs": [:discriminatory]
|
200
|
+
"fagot": [:discriminatory]
|
201
|
+
"fagots": [:discriminatory]
|
202
|
+
"fags": [:discriminatory]
|
203
|
+
"fagtard": [:discriminatory]
|
204
|
+
"fart": [:inappropriate]
|
205
|
+
"farted": [:inappropriate]
|
206
|
+
"farting": [:inappropriate]
|
207
|
+
"fartings": [:inappropriate]
|
208
|
+
"farts": [:inappropriate]
|
209
|
+
"farty": [:inappropriate]
|
210
|
+
"fatass": [:insult]
|
211
|
+
"felatio": [:sexual]
|
212
|
+
"fellatio": [:sexual]
|
213
|
+
"fellatio": [:sexual]
|
214
|
+
"feltch": [:sexual]
|
215
|
+
"fingerfuck": [:sexual]
|
216
|
+
"fingerfucked": [:sexual]
|
217
|
+
"fingerfucker": [:sexual]
|
218
|
+
"fingerfuckers": [:sexual]
|
219
|
+
"fingerfucking": [:sexual]
|
220
|
+
"fingerfucks": [:sexual]
|
221
|
+
"fistfuck": [:sexual]
|
222
|
+
"fistfucked": [:sexual]
|
223
|
+
"fistfucker": [:sexual]
|
224
|
+
"fistfuckers": [:sexual]
|
225
|
+
"fistfucking": [:sexual]
|
226
|
+
"fistfuckings": [:sexual]
|
227
|
+
"fistfucks": [:sexual]
|
228
|
+
"flamer": [:discriminatory]
|
229
|
+
"fuck": [:sexual]
|
230
|
+
"fuckass": [:insult]
|
231
|
+
"fuckbag": [:insult]
|
232
|
+
"fuckboy": [:insult]
|
233
|
+
"fuckbrain": [:insult]
|
234
|
+
"fuckbutt": [:sexual]
|
235
|
+
"fucked": [:sexual]
|
236
|
+
"fucker": [:sexual :insult]
|
237
|
+
"fuckers": [:sexual :insult]
|
238
|
+
"fuckersucker": [:insult]
|
239
|
+
"fuckface": [:insult]
|
240
|
+
"fuckhead": [:sexual]
|
241
|
+
"fuckhole": [:insult]
|
242
|
+
"fuckin": [:sexual]
|
243
|
+
"fucking": [:sexual]
|
244
|
+
"fuckings": [:sexual]
|
245
|
+
"fuckme": [:sexual]
|
246
|
+
"fucknut": [:insult]
|
247
|
+
"fucknutt": [:insult]
|
248
|
+
"fuckoff": [:insult]
|
249
|
+
"fucks": [:sexual]
|
250
|
+
"fucks": [:sexual]
|
251
|
+
"fuckstick": [:sexual]
|
252
|
+
"fucktard": [:insult]
|
253
|
+
"fuckup": [:insult]
|
254
|
+
"fuckwad": [:insult]
|
255
|
+
"fuckwit": [:insult]
|
256
|
+
"fuckwitt": [:insult]
|
257
|
+
"fudgepacker": [:discriminatory]
|
258
|
+
"fuk": [:sexual]
|
259
|
+
"fuks": [:sexual]
|
260
|
+
"gangbang": [:sexual]
|
261
|
+
"gangbanged": [:sexual]
|
262
|
+
"gangbangs": [:sexual]
|
263
|
+
"gay": [:discriminatory]
|
264
|
+
"gayass": [:sexual]
|
265
|
+
"gaybob": [:discriminatory]
|
266
|
+
"gaydo": [:discriminatory]
|
267
|
+
"gayfuck": [:discriminatory]
|
268
|
+
"gayfuckist": [:discriminatory]
|
269
|
+
"gaylord": [:discriminatory]
|
270
|
+
"gaysex": [:discriminatory]
|
271
|
+
"gaytard": [:discriminatory]
|
272
|
+
"gaywad": [:discriminatory]
|
273
|
+
"goddamn": [:inappropriate :blasphemy]
|
274
|
+
"goddamn": [:inappropriate :blasphemy]
|
275
|
+
"goddamnit": [:inappropriate :blasphemy]
|
276
|
+
"gooch": [:sexual]
|
277
|
+
"gook": [:discriminatory]
|
278
|
+
"gringo": [:discriminatory]
|
279
|
+
"guido": [:discriminatory]
|
280
|
+
"handjob": [:sexual]
|
281
|
+
"hardcoresex": [:sexual]
|
282
|
+
"heeb": [:discriminatory]
|
283
|
+
"hell": [:inappropriate]
|
284
|
+
"hell": [:inappropriate]
|
285
|
+
"ho": [:discriminatory]
|
286
|
+
"hoe": [:discriminatory]
|
287
|
+
"homo": [:discriminatory]
|
288
|
+
"homodumbshit": [:insult]
|
289
|
+
"honkey": [:discriminatory]
|
290
|
+
"horniest": [:sexual]
|
291
|
+
"horny": [:sexual]
|
292
|
+
"hotsex": [:sexual]
|
293
|
+
"humping": [:sexual]
|
294
|
+
"jackass": [:insult]
|
295
|
+
"jap": [:discriminatory]
|
296
|
+
"jigaboo": [:discriminatory]
|
297
|
+
"jism": [:sexual]
|
298
|
+
"jiz": [:sexual]
|
299
|
+
"jizm": [:sexual]
|
300
|
+
"jizz": [:sexual]
|
301
|
+
"jungle bunny": [:discriminatory]
|
302
|
+
"junglebunny": [:discriminatory]
|
303
|
+
"kike": [:discriminatory]
|
304
|
+
"kock": [:sexual]
|
305
|
+
"kondum": [:sexual]
|
306
|
+
"kondums": [:sexual]
|
307
|
+
"kooch": [:sexual]
|
308
|
+
"kootch": [:sexual]
|
309
|
+
"kum": [:sexual]
|
310
|
+
"kumer": [:sexual]
|
311
|
+
"kummer": [:sexual]
|
312
|
+
"kumming": [:sexual]
|
313
|
+
"kums": [:sexual]
|
314
|
+
"kunilingus": [:sexual]
|
315
|
+
"kunt": [:sexual]
|
316
|
+
"kyke": [:discriminatory]
|
317
|
+
"lesbian": [:discriminatory]
|
318
|
+
"lesbo": [:discriminatory]
|
319
|
+
"lezzie": [:discriminatory]
|
320
|
+
"lust": [:sexual]
|
321
|
+
"lusting": [:sexual]
|
322
|
+
"mcfagget": [:discriminatory]
|
323
|
+
"mick": [:discriminatory]
|
324
|
+
"minge": [:sexual]
|
325
|
+
"mothafuck": [:sexual]
|
326
|
+
"mothafucka": [:sexual]
|
327
|
+
"mothafucka": [:insult]
|
328
|
+
"mothafuckas": [:sexual]
|
329
|
+
"mothafuckaz": [:sexual]
|
330
|
+
"mothafucked": [:sexual]
|
331
|
+
"mothafucker": [:sexual :insult]
|
332
|
+
"mothafuckers": [:sexual :insult]
|
333
|
+
"mothafuckin": [:sexual]
|
334
|
+
"mothafucking": [:sexual]
|
335
|
+
"mothafuckings": [:sexual]
|
336
|
+
"mothafucks": [:sexual]
|
337
|
+
"motherfuck": [:sexual]
|
338
|
+
"motherfucked": [:sexual]
|
339
|
+
"motherfucker": [:sexual :insult]
|
340
|
+
"motherfuckers": [:sexual]
|
341
|
+
"motherfuckin": [:sexual]
|
342
|
+
"motherfucking": [:sexual]
|
343
|
+
"motherfuckings": [:sexual]
|
344
|
+
"motherfucks": [:sexual]
|
345
|
+
"muff": [:sexual]
|
346
|
+
"muffdiver": [:discriminatory :sexual]
|
347
|
+
"munging": [:sexual]
|
348
|
+
"negro": [:discriminatory]
|
349
|
+
"nigga": [:discriminatory]
|
350
|
+
"nigger": [:discriminatory]
|
351
|
+
"niggers": [:discriminatory]
|
352
|
+
"niglet": [:discriminatory]
|
353
|
+
"nut sack": [:sexual]
|
354
|
+
"nutsack": [:sexual]
|
355
|
+
"orgasim": [:sexual]
|
356
|
+
"orgasims": [:sexual]
|
357
|
+
"orgasm": [:sexual]
|
358
|
+
"orgasms": [:sexual]
|
359
|
+
"paki": [:discriminatory]
|
360
|
+
"panooch": [:sexual]
|
361
|
+
"pecker": [:sexual]
|
362
|
+
"peckerhead": [:insult]
|
363
|
+
"penis": [:sexual]
|
364
|
+
"penisfucker": [:discriminatory]
|
365
|
+
"penispuffer": [:discriminatory]
|
366
|
+
"phonesex": [:sexual]
|
367
|
+
"phuk": [:sexual]
|
368
|
+
"phuked": [:sexual]
|
369
|
+
"phuking": [:sexual]
|
370
|
+
"phukked": [:sexual]
|
371
|
+
"phukking": [:sexual]
|
372
|
+
"phuks": [:sexual]
|
373
|
+
"phuq": [:sexual]
|
374
|
+
"pis": [:sexual]
|
375
|
+
"pises": [:sexual]
|
376
|
+
"pisin": [:sexual]
|
377
|
+
"pising": [:sexual]
|
378
|
+
"pisof": [:sexual]
|
379
|
+
"piss": [:inappropriate]
|
380
|
+
"pissed": [:inappropriate]
|
381
|
+
"pisser": [:sexual]
|
382
|
+
"pissers": [:sexual]
|
383
|
+
"pisses": [:sexual]
|
384
|
+
"pissflaps": [:sexual]
|
385
|
+
"pissin": [:sexual]
|
386
|
+
"pissing": [:sexual]
|
387
|
+
"pissoff": [:sexual]
|
388
|
+
"polesmoker": [:discriminatory]
|
389
|
+
"pollock": [:discriminatory]
|
390
|
+
"poon": [:sexual]
|
391
|
+
"poonani": [:sexual]
|
392
|
+
"poonany": [:sexual]
|
393
|
+
"poontang": [:sexual]
|
394
|
+
"porch monkey": [:discriminatory]
|
395
|
+
"porchmonkey": [:discriminatory]
|
396
|
+
"porn": [:sexual]
|
397
|
+
"porno": [:sexual]
|
398
|
+
"pornography": [:sexual]
|
399
|
+
"pornos": [:sexual]
|
400
|
+
"prick": [:sexual]
|
401
|
+
"prick": [:sexual]
|
402
|
+
"pricks": [:sexual]
|
403
|
+
"punanny": [:sexual]
|
404
|
+
"punta": [:insult]
|
405
|
+
"pusies": [:sexual :insult]
|
406
|
+
"pussies": [:sexual :insult]
|
407
|
+
"pussy": [:sexual :insult]
|
408
|
+
"pussylicking": [:sexual]
|
409
|
+
"pussys": [:sexual]
|
410
|
+
"pusy": [:sexual]
|
411
|
+
"pusys": [:sexual]
|
412
|
+
"puto": [:insult]
|
413
|
+
"queef": [:sexual]
|
414
|
+
"queer": [:discriminatory]
|
415
|
+
"queerbait": [:discriminatory]
|
416
|
+
"queerhole": [:discriminatory]
|
417
|
+
"renob": [:sexual]
|
418
|
+
"rimjob": [:sexual]
|
419
|
+
"ruski": [:discriminatory]
|
420
|
+
"sandnigger": [:discriminatory]
|
421
|
+
"schlong": [:sexual]
|
422
|
+
"scrote": [:sexual]
|
423
|
+
"shit": [:sexual :inappropriate]
|
424
|
+
"shitass": [:insult]
|
425
|
+
"shitbag": [:insult]
|
426
|
+
"shitbagger": [:insult]
|
427
|
+
"shitbrains": [:insult]
|
428
|
+
"shitbreath": [:insult]
|
429
|
+
"shitcunt": [:insult]
|
430
|
+
"shitdick": [:insult]
|
431
|
+
"shited": [:sexual]
|
432
|
+
"shitface": [:insult]
|
433
|
+
"shitfaced": [:inappropriate :insult]
|
434
|
+
"shitfull": [:sexual]
|
435
|
+
"shithead": [:insult]
|
436
|
+
"shithole": [:insult]
|
437
|
+
"shithouse": [:inappropriate]
|
438
|
+
"shiting": [:sexual]
|
439
|
+
"shitings": [:sexual]
|
440
|
+
"shits": [:sexual]
|
441
|
+
"shitspitter": [:sexual]
|
442
|
+
"shitstain": [:inappropriate :insult]
|
443
|
+
"shitted": [:sexual]
|
444
|
+
"shitter": [:sexual]
|
445
|
+
"shitters": [:sexual]
|
446
|
+
"shittiest": [:inappropriate]
|
447
|
+
"shitting": [:inappropriate]
|
448
|
+
"shittings": [:sexual]
|
449
|
+
"shitty": [:inappropriate]
|
450
|
+
"shity": [:sexual]
|
451
|
+
"shiz": [:inappropriate]
|
452
|
+
"shiznit": [:inappropriate]
|
453
|
+
"skank": [:insult]
|
454
|
+
"skeet": [:sexual]
|
455
|
+
"skullfuck": [:sexual]
|
456
|
+
"slut": [:sexual]
|
457
|
+
"slut": [:discriminatory]
|
458
|
+
"slutbag": [:discriminatory]
|
459
|
+
"sluts": [:sexual]
|
460
|
+
"smeg": [:inappropriate]
|
461
|
+
"smut": [:sexual]
|
462
|
+
"snatch": [:sexual]
|
463
|
+
"spic": [:discriminatory]
|
464
|
+
"spick": [:discriminatory]
|
465
|
+
"splooge": [:sexual]
|
466
|
+
"spunk": [:sexual]
|
467
|
+
"tard": [:discriminatory]
|
468
|
+
"testicle": [:sexual]
|
469
|
+
"thundercunt": [:insult]
|
470
|
+
"tit": [:sexual]
|
471
|
+
"titfuck": [:sexual]
|
472
|
+
"tits": [:sexual]
|
473
|
+
"tittyfuck": [:sexual]
|
474
|
+
"twat": [:sexual]
|
475
|
+
"twatlips": [:insult]
|
476
|
+
"twats": [:sexual]
|
477
|
+
"twatwaffle": [:discriminatory]
|
478
|
+
"unclefucker": [:discriminatory]
|
479
|
+
"va-j-j": [:sexual]
|
480
|
+
"vag": [:sexual]
|
481
|
+
"vagina": [:sexual]
|
482
|
+
"vjayjay": [:sexual]
|
483
|
+
"wank": [:sexual]
|
484
|
+
"wetback": [:discriminatory]
|
485
|
+
"whore": [:insult]
|
486
|
+
"whorebag": [:insult]
|
487
|
+
"whoreface": [:insult]
|
488
|
+
"wop": [:discriminatory]
|
@@ -0,0 +1,32 @@
|
|
1
|
+
require 'yaml'
|
2
|
+
require 'fuzzy_hash'
|
3
|
+
require 'bloomfilter'
|
4
|
+
|
5
|
+
class Swearjar
|
6
|
+
class Tester
|
7
|
+
|
8
|
+
def initialize(config_file)
|
9
|
+
data = YAML.load_file
|
10
|
+
|
11
|
+
@tester = FuzzyHash.new
|
12
|
+
|
13
|
+
data['regex'].each do |pattern, type|
|
14
|
+
@tester[Regexp.new(pattern)] = type
|
15
|
+
end
|
16
|
+
|
17
|
+
data['simple'].each do |test, type|
|
18
|
+
@tester[test] = type
|
19
|
+
end
|
20
|
+
|
21
|
+
end
|
22
|
+
|
23
|
+
def scan(string, &block)
|
24
|
+
string.scan(/\b[\b]+\b/, &block)
|
25
|
+
end
|
26
|
+
|
27
|
+
def profane?(string)
|
28
|
+
scan(string) {|w| return true}
|
29
|
+
end
|
30
|
+
|
31
|
+
end
|
32
|
+
end
|
data/lib/swearjar.rb
ADDED
@@ -0,0 +1,59 @@
|
|
1
|
+
require 'yaml'
|
2
|
+
require 'fuzzy_hash'
|
3
|
+
require 'dirge'
|
4
|
+
|
5
|
+
class Swearjar
|
6
|
+
|
7
|
+
def self.default
|
8
|
+
from_language
|
9
|
+
end
|
10
|
+
|
11
|
+
def self.from_language(language = 'en')
|
12
|
+
new(~File.join('..', 'config', "#{language}.yml"))
|
13
|
+
end
|
14
|
+
|
15
|
+
attr_reader :tester, :hash
|
16
|
+
|
17
|
+
def initialize(file)
|
18
|
+
data = YAML.load_file(file)
|
19
|
+
|
20
|
+
@tester = FuzzyHash.new
|
21
|
+
@hash = {}
|
22
|
+
|
23
|
+
data['regex'].each do |pattern, type|
|
24
|
+
@tester[Regexp.new(pattern)] = type
|
25
|
+
end
|
26
|
+
|
27
|
+
data['simple'].each do |test, type|
|
28
|
+
@hash[test] = type
|
29
|
+
end
|
30
|
+
|
31
|
+
end
|
32
|
+
|
33
|
+
def scan(string, &block)
|
34
|
+
string.scan(/\b[a-zA-Z-]+\b/) do |word|
|
35
|
+
block.call(word, hash[word])
|
36
|
+
end
|
37
|
+
if match = tester.match_with_result(string)
|
38
|
+
block.call(match.last, match.first)
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
def profane?(string)
|
43
|
+
scan(string) {|word, test| return true if !test.nil?}
|
44
|
+
return false
|
45
|
+
end
|
46
|
+
|
47
|
+
def scorecard(string)
|
48
|
+
scorecard = {}
|
49
|
+
scan(string) {|word, test| test.each { |type| scorecard.key?(type) ? scorecard[type] += 1 : scorecard[type] = 1} if test}
|
50
|
+
scorecard
|
51
|
+
end
|
52
|
+
|
53
|
+
def censor(string)
|
54
|
+
censored_string = string.dup
|
55
|
+
scan(string) {|word, test| censored_string.gsub!(word, block_given? ? yield(word) : word.gsub(/\S/, '*')) if test}
|
56
|
+
censored_string
|
57
|
+
end
|
58
|
+
|
59
|
+
end
|
data/spec/spec.opts
ADDED
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require File.expand_path(File.join(File.dirname(__FILE__), '..', 'lib', 'swearjar'))
|
@@ -0,0 +1,25 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Swearjar do
|
4
|
+
|
5
|
+
it "should detect dirty words" do
|
6
|
+
Swearjar.default.profane?('fuck you jim henson').should be_true
|
7
|
+
end
|
8
|
+
|
9
|
+
it "should not detect non-dirty words" do
|
10
|
+
Swearjar.default.profane?('i love you jim henson').should be_false
|
11
|
+
end
|
12
|
+
|
13
|
+
it "should give us a scorecard" do
|
14
|
+
Swearjar.default.scorecard('fuck you jim henson').should == {:sexual=>1}
|
15
|
+
end
|
16
|
+
|
17
|
+
it "should detect multiword" do
|
18
|
+
Swearjar.default.scorecard('jim henson has a hard on').should == {:sexual=>1}
|
19
|
+
end
|
20
|
+
|
21
|
+
it "should censor a string" do
|
22
|
+
Swearjar.default.censor('jim henson has a massive hard on he is gonna use to fuck everybody').should == 'jim henson has a massive **** ** he is gonna use to **** everybody'
|
23
|
+
end
|
24
|
+
|
25
|
+
end
|
metadata
ADDED
@@ -0,0 +1,83 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: swearjar
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Joshua Hull
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
|
12
|
+
date: 2010-01-13 00:00:00 -05:00
|
13
|
+
default_executable:
|
14
|
+
dependencies:
|
15
|
+
- !ruby/object:Gem::Dependency
|
16
|
+
name: fuzzyhash
|
17
|
+
type: :runtime
|
18
|
+
version_requirement:
|
19
|
+
version_requirements: !ruby/object:Gem::Requirement
|
20
|
+
requirements:
|
21
|
+
- - ">="
|
22
|
+
- !ruby/object:Gem::Version
|
23
|
+
version: 0.0.11
|
24
|
+
version:
|
25
|
+
- !ruby/object:Gem::Dependency
|
26
|
+
name: dirge
|
27
|
+
type: :runtime
|
28
|
+
version_requirement:
|
29
|
+
version_requirements: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: 0.0.3
|
34
|
+
version:
|
35
|
+
description: Put another nickel in the swearjar.
|
36
|
+
email: joshbuddy@gmail.com
|
37
|
+
executables: []
|
38
|
+
|
39
|
+
extensions: []
|
40
|
+
|
41
|
+
extra_rdoc_files:
|
42
|
+
- README.rdoc
|
43
|
+
files:
|
44
|
+
- README.rdoc
|
45
|
+
- Rakefile
|
46
|
+
- VERSION
|
47
|
+
- config/en.yml
|
48
|
+
- lib/swearjar.rb
|
49
|
+
- lib/swearjar/tester.rb
|
50
|
+
- spec/spec.opts
|
51
|
+
- spec/spec_helper.rb
|
52
|
+
- spec/swearjar_spec.rb
|
53
|
+
has_rdoc: true
|
54
|
+
homepage: http://github.com/joshbuddy/swearjar
|
55
|
+
licenses: []
|
56
|
+
|
57
|
+
post_install_message:
|
58
|
+
rdoc_options:
|
59
|
+
- --charset=UTF-8
|
60
|
+
require_paths:
|
61
|
+
- lib
|
62
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
63
|
+
requirements:
|
64
|
+
- - ">="
|
65
|
+
- !ruby/object:Gem::Version
|
66
|
+
version: "0"
|
67
|
+
version:
|
68
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
69
|
+
requirements:
|
70
|
+
- - ">="
|
71
|
+
- !ruby/object:Gem::Version
|
72
|
+
version: "0"
|
73
|
+
version:
|
74
|
+
requirements: []
|
75
|
+
|
76
|
+
rubyforge_project:
|
77
|
+
rubygems_version: 1.3.5
|
78
|
+
signing_key:
|
79
|
+
specification_version: 3
|
80
|
+
summary: Put another nickel in the swearjar.
|
81
|
+
test_files:
|
82
|
+
- spec/spec_helper.rb
|
83
|
+
- spec/swearjar_spec.rb
|