profane 0.0.1

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/.gitignore ADDED
@@ -0,0 +1,17 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ Gemfile.lock
7
+ InstalledFiles
8
+ _yardoc
9
+ coverage
10
+ doc/
11
+ lib/bundler/man
12
+ pkg
13
+ rdoc
14
+ spec/reports
15
+ test/tmp
16
+ test/version_tmp
17
+ tmp
data/.rvmrc ADDED
@@ -0,0 +1 @@
1
+ rvm use --create 1.9.3@profane
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in profane.gemspec
4
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2013 Jonan Scheffler
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,72 @@
1
+ # Profane
2
+
3
+ Profane is a basic profanity filter designed to filter and detect keywords based
4
+ on an internal or external dictionary, or a combination of both.
5
+
6
+ ## Installation
7
+
8
+ Add this line to your application's Gemfile:
9
+
10
+ gem 'profane'
11
+
12
+ And then execute:
13
+
14
+ $ bundle
15
+
16
+ Or install it yourself as:
17
+
18
+ $ gem install profane
19
+
20
+ ## Configuration
21
+
22
+ You can include words from your own dictionary in a hash or a yaml file, where
23
+ the key is the target word and the value is an obfuscated replacement you would
24
+ like to use.
25
+
26
+ Adding words to the dictionary with a hash:
27
+ ```
28
+ Profane.configure(dictionary: { obscenity: 'obs******', vulgarity: 'vul******' })
29
+ ```
30
+
31
+ Adding words to the dictionary with a yml file:
32
+ ```
33
+ Profane.configure(dictionary_file: 'config/dictionary.yml')
34
+ ```
35
+
36
+ You can override the entire dictionary with your own by setting
37
+ use_internal_dictionary to false.
38
+ ```
39
+ Profane.configure(dictionary: { obscenity: 'obs******' }, use_internal_dictionary: false)
40
+ Profane.configure(dictionary_file: 'config/dictionary.yml', use_internal_dictionary: false)
41
+ ```
42
+
43
+ If you set a key to '' in the dictionary profane will use the default strategy
44
+ of overwriting the entire word (exempting punctuation) with '*'. You can pass an
45
+ alternative character to use with the filter_character option.
46
+ ```
47
+ Profane.configure(filter_character: '&')
48
+ ```
49
+ Note that if you want to actually replace words with blank string you can use ''
50
+ as your default character.
51
+
52
+ ## Usage
53
+
54
+ Filter profanity from a bit of text:
55
+ ```
56
+ Profane::Filter.filter('Voldemort!')
57
+ => '*********!')
58
+ ```
59
+
60
+ Detect profanity in a bit of text:
61
+ ```
62
+ Profane::Filter.profane?('If you come to a fork in the road, take it.')
63
+ => 'false'
64
+ ```
65
+
66
+ ## Contributing
67
+
68
+ 1. Fork it
69
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
70
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
71
+ 4. Push to the branch (`git push origin my-new-feature`)
72
+ 5. Create new Pull Request
data/Rakefile ADDED
@@ -0,0 +1,7 @@
1
+ require "bundler/gem_tasks"
2
+ require "rspec/core/rake_task"
3
+
4
+ RSpec::Core::RakeTask.new
5
+
6
+ task :default => :spec
7
+ task :test => :spec
@@ -0,0 +1,453 @@
1
+ ---
2
+ 4r5e: ''
3
+ 5h1t: ''
4
+ 5hit: ''
5
+ a55: ''
6
+ anal: ''
7
+ anus: ''
8
+ ar5e: ''
9
+ arrse: ''
10
+ arse: ''
11
+ ass: ''
12
+ ass-fucker: ''
13
+ asses: ''
14
+ assfucker: ''
15
+ assfukka: ''
16
+ asshole: ''
17
+ assholes: ''
18
+ asswhole: ''
19
+ a_s_s: ''
20
+ b!tch: ''
21
+ b00bs: ''
22
+ b17ch: ''
23
+ b1tch: ''
24
+ ballbag: ''
25
+ balls: ''
26
+ ballsack: ''
27
+ bastard: ''
28
+ beastial: ''
29
+ beastiality: ''
30
+ bellend: ''
31
+ bestial: ''
32
+ bestiality: ''
33
+ bi+ch: ''
34
+ biatch: ''
35
+ bitch: ''
36
+ bitcher: ''
37
+ bitchers: ''
38
+ bitches: ''
39
+ bitchin: ''
40
+ bitching: ''
41
+ bloody: ''
42
+ blow job: ''
43
+ blowjob: ''
44
+ blowjobs: ''
45
+ boiolas: ''
46
+ bollock: ''
47
+ bollok: ''
48
+ boner: ''
49
+ boob: ''
50
+ boobs: ''
51
+ booobs: ''
52
+ boooobs: ''
53
+ booooobs: ''
54
+ boooooobs: ''
55
+ booooooobs: ''
56
+ breasts: ''
57
+ buceta: ''
58
+ bugger: ''
59
+ bum: ''
60
+ bunny fucker: ''
61
+ butt: ''
62
+ butthole: ''
63
+ buttmuch: ''
64
+ buttplug: ''
65
+ c0ck: ''
66
+ c0cksucker: ''
67
+ carpet muncher: ''
68
+ cawk: ''
69
+ chink: ''
70
+ cipa: ''
71
+ cl1t: ''
72
+ clit: ''
73
+ clitoris: ''
74
+ clits: ''
75
+ cnut: ''
76
+ cock: ''
77
+ cock-sucker: ''
78
+ cockface: ''
79
+ cockhead: ''
80
+ cockmunch: ''
81
+ cockmuncher: ''
82
+ cocks: ''
83
+ ! 'cocksuck ': ''
84
+ ! 'cocksucked ': ''
85
+ cocksucker: ''
86
+ cocksucking: ''
87
+ ! 'cocksucks ': ''
88
+ cocksuka: ''
89
+ cocksukka: ''
90
+ cok: ''
91
+ cokmuncher: ''
92
+ coksucka: ''
93
+ coon: ''
94
+ cox: ''
95
+ crap: ''
96
+ cum: ''
97
+ cummer: ''
98
+ cumming: ''
99
+ cums: ''
100
+ cumshot: ''
101
+ cunilingus: ''
102
+ cunillingus: ''
103
+ cunnilingus: ''
104
+ cunt: ''
105
+ ! 'cuntlick ': ''
106
+ ! 'cuntlicker ': ''
107
+ ! 'cuntlicking ': ''
108
+ cunts: ''
109
+ cyalis: ''
110
+ cyberfuc: ''
111
+ ! 'cyberfuck ': ''
112
+ ! 'cyberfucked ': ''
113
+ cyberfucker: ''
114
+ cyberfuckers: ''
115
+ ! 'cyberfucking ': ''
116
+ d1ck: ''
117
+ damn: ''
118
+ dick: ''
119
+ dickhead: ''
120
+ dildo: ''
121
+ dildos: ''
122
+ dink: ''
123
+ dinks: ''
124
+ dirsa: ''
125
+ dlck: ''
126
+ dog-fucker: ''
127
+ doggin: ''
128
+ dogging: ''
129
+ donkeyribber: ''
130
+ doosh: ''
131
+ duche: ''
132
+ dyke: ''
133
+ ejaculate: ''
134
+ ejaculated: ''
135
+ ! 'ejaculates ': ''
136
+ ! 'ejaculating ': ''
137
+ ejaculatings: ''
138
+ ejaculation: ''
139
+ ejakulate: ''
140
+ f u c k: ''
141
+ f u c k e r: ''
142
+ f4nny: ''
143
+ fag: ''
144
+ fagging: ''
145
+ faggitt: ''
146
+ faggot: ''
147
+ faggs: ''
148
+ fagot: ''
149
+ fagots: ''
150
+ fags: ''
151
+ fanny: ''
152
+ fannyflaps: ''
153
+ fannyfucker: ''
154
+ fanyy: ''
155
+ fatass: ''
156
+ fcuk: ''
157
+ fcuker: ''
158
+ fcuking: ''
159
+ feck: ''
160
+ fecker: ''
161
+ felching: ''
162
+ fellate: ''
163
+ fellatio: ''
164
+ ! 'fingerfuck ': ''
165
+ ! 'fingerfucked ': ''
166
+ ! 'fingerfucker ': ''
167
+ fingerfuckers: ''
168
+ ! 'fingerfucking ': ''
169
+ ! 'fingerfucks ': ''
170
+ fistfuck: ''
171
+ ! 'fistfucked ': ''
172
+ ! 'fistfucker ': ''
173
+ ! 'fistfuckers ': ''
174
+ ! 'fistfucking ': ''
175
+ ! 'fistfuckings ': ''
176
+ ! 'fistfucks ': ''
177
+ flange: ''
178
+ fook: ''
179
+ fooker: ''
180
+ fuck: ''
181
+ fucka: ''
182
+ fucked: ''
183
+ fucker: ''
184
+ fuckers: ''
185
+ fuckhead: ''
186
+ fuckheads: ''
187
+ fuckin: ''
188
+ fucking: ''
189
+ fuckings: ''
190
+ fuckingshitmotherfucker: ''
191
+ ! 'fuckme ': ''
192
+ fucks: ''
193
+ fuckwhit: ''
194
+ fuckwit: ''
195
+ fudge packer: ''
196
+ fudgepacker: ''
197
+ fuk: ''
198
+ fuker: ''
199
+ fukker: ''
200
+ fukkin: ''
201
+ fuks: ''
202
+ fukwhit: ''
203
+ fukwit: ''
204
+ fux: ''
205
+ fux0r: ''
206
+ f_u_c_k: ''
207
+ gangbang: ''
208
+ ! 'gangbanged ': ''
209
+ ! 'gangbangs ': ''
210
+ gaylord: ''
211
+ gaysex: ''
212
+ goatse: ''
213
+ God: ''
214
+ god-dam: ''
215
+ god-damned: ''
216
+ goddamn: ''
217
+ goddamned: ''
218
+ ! 'hardcoresex ': ''
219
+ hell: ''
220
+ heshe: ''
221
+ hoar: ''
222
+ hoare: ''
223
+ hoer: ''
224
+ homo: ''
225
+ hore: ''
226
+ horniest: ''
227
+ horny: ''
228
+ hotsex: ''
229
+ ! 'jack-off ': ''
230
+ jackoff: ''
231
+ jap: ''
232
+ ! 'jerk-off ': ''
233
+ jism: ''
234
+ ! 'jiz ': ''
235
+ ! 'jizm ': ''
236
+ jizz: ''
237
+ kawk: ''
238
+ knob: ''
239
+ knobead: ''
240
+ knobed: ''
241
+ knobend: ''
242
+ knobhead: ''
243
+ knobjocky: ''
244
+ knobjokey: ''
245
+ kock: ''
246
+ kondum: ''
247
+ kondums: ''
248
+ kum: ''
249
+ kummer: ''
250
+ kumming: ''
251
+ kums: ''
252
+ kunilingus: ''
253
+ l3i+ch: ''
254
+ l3itch: ''
255
+ labia: ''
256
+ lmfao: ''
257
+ lust: ''
258
+ lusting: ''
259
+ m0f0: ''
260
+ m0fo: ''
261
+ m45terbate: ''
262
+ ma5terb8: ''
263
+ ma5terbate: ''
264
+ masochist: ''
265
+ master-bate: ''
266
+ masterb8: ''
267
+ masterbat*: ''
268
+ masterbat3: ''
269
+ masterbate: ''
270
+ masterbation: ''
271
+ masterbations: ''
272
+ masturbate: ''
273
+ mo-fo: ''
274
+ mof0: ''
275
+ mofo: ''
276
+ mothafuck: ''
277
+ mothafucka: ''
278
+ mothafuckas: ''
279
+ mothafuckaz: ''
280
+ ! 'mothafucked ': ''
281
+ mothafucker: ''
282
+ mothafuckers: ''
283
+ mothafuckin: ''
284
+ ! 'mothafucking ': ''
285
+ mothafuckings: ''
286
+ mothafucks: ''
287
+ mother fucker: ''
288
+ motherfuck: ''
289
+ motherfucked: ''
290
+ motherfucker: ''
291
+ motherfuckers: ''
292
+ motherfuckin: ''
293
+ motherfucking: ''
294
+ motherfuckings: ''
295
+ motherfuckka: ''
296
+ motherfucks: ''
297
+ muff: ''
298
+ mutha: ''
299
+ muthafecker: ''
300
+ muthafuckker: ''
301
+ muther: ''
302
+ mutherfucker: ''
303
+ n1gga: ''
304
+ n1gger: ''
305
+ nazi: ''
306
+ nigg3r: ''
307
+ nigg4h: ''
308
+ nigga: ''
309
+ niggah: ''
310
+ niggas: ''
311
+ niggaz: ''
312
+ nigger: ''
313
+ ! 'niggers ': ''
314
+ nob: ''
315
+ nob jokey: ''
316
+ nobhead: ''
317
+ nobjocky: ''
318
+ nobjokey: ''
319
+ numbnuts: ''
320
+ nutsack: ''
321
+ ! 'orgasim ': ''
322
+ ! 'orgasims ': ''
323
+ orgasm: ''
324
+ ! 'orgasms ': ''
325
+ p0rn: ''
326
+ pawn: ''
327
+ pecker: ''
328
+ penis: ''
329
+ penisfucker: ''
330
+ phonesex: ''
331
+ phuck: ''
332
+ phuk: ''
333
+ phuked: ''
334
+ phuking: ''
335
+ phukked: ''
336
+ phukking: ''
337
+ phuks: ''
338
+ phuq: ''
339
+ pigfucker: ''
340
+ pimpis: ''
341
+ piss: ''
342
+ pissed: ''
343
+ pisser: ''
344
+ pissers: ''
345
+ ! 'pisses ': ''
346
+ pissflaps: ''
347
+ ! 'pissin ': ''
348
+ pissing: ''
349
+ ! 'pissoff ': ''
350
+ poop: ''
351
+ porn: ''
352
+ porno: ''
353
+ pornography: ''
354
+ pornos: ''
355
+ prick: ''
356
+ ! 'pricks ': ''
357
+ pron: ''
358
+ pube: ''
359
+ pusse: ''
360
+ pussi: ''
361
+ pussies: ''
362
+ pussy: ''
363
+ ! 'pussys ': ''
364
+ rectum: ''
365
+ retard: ''
366
+ rimjaw: ''
367
+ rimming: ''
368
+ s hit: ''
369
+ s.o.b.: ''
370
+ sadist: ''
371
+ schlong: ''
372
+ screwing: ''
373
+ scroat: ''
374
+ scrote: ''
375
+ scrotum: ''
376
+ semen: ''
377
+ sex: ''
378
+ sh!+: ''
379
+ sh!t: ''
380
+ sh1t: ''
381
+ shag: ''
382
+ shagger: ''
383
+ shaggin: ''
384
+ shagging: ''
385
+ shemale: ''
386
+ shi+: ''
387
+ shit: ''
388
+ shitdick: ''
389
+ shite: ''
390
+ shited: ''
391
+ shitey: ''
392
+ shitfuck: ''
393
+ shitfull: ''
394
+ shithead: ''
395
+ shiting: ''
396
+ shitings: ''
397
+ shits: ''
398
+ shitted: ''
399
+ shitter: ''
400
+ ! 'shitters ': ''
401
+ shitting: ''
402
+ shittings: ''
403
+ ! 'shitty ': ''
404
+ skank: ''
405
+ slut: ''
406
+ sluts: ''
407
+ smegma: ''
408
+ smut: ''
409
+ snatch: ''
410
+ son-of-a-bitch: ''
411
+ spac: ''
412
+ spunk: ''
413
+ s_h_i_t: ''
414
+ t1tt1e5: ''
415
+ t1tties: ''
416
+ teets: ''
417
+ teez: ''
418
+ testical: ''
419
+ testicle: ''
420
+ tit: ''
421
+ titfuck: ''
422
+ tits: ''
423
+ titt: ''
424
+ tittie5: ''
425
+ tittiefucker: ''
426
+ titties: ''
427
+ tittyfuck: ''
428
+ tittywank: ''
429
+ titwank: ''
430
+ tosser: ''
431
+ turd: ''
432
+ tw4t: ''
433
+ twat: ''
434
+ twathead: ''
435
+ twatty: ''
436
+ twunt: ''
437
+ twunter: ''
438
+ v14gra: ''
439
+ v1gra: ''
440
+ vagina: ''
441
+ viagra: ''
442
+ vulva: ''
443
+ w00se: ''
444
+ wang: ''
445
+ wank: ''
446
+ wanker: ''
447
+ wanky: ''
448
+ whoar: ''
449
+ whore: ''
450
+ willies: ''
451
+ willy: ''
452
+ xrated: ''
453
+ xxx: ''
@@ -0,0 +1,39 @@
1
+ module Profane
2
+ class Filter
3
+ attr_accessor :dictionary, :character, :dictionary_regex
4
+
5
+ def initialize
6
+ @dictionary = Profane.dictionary
7
+ @character = Profane.character
8
+ end
9
+
10
+ def filter(phrase)
11
+ new_phrase = phrase.split(' ').map do |word|
12
+ cleanse!(word)
13
+ end
14
+
15
+ Array(new_phrase).join(' ')
16
+ end
17
+
18
+ def profane?(phrase)
19
+ phrase = phrase.downcase.split(' ')
20
+
21
+ dictionary.keys.each do |key|
22
+ return true unless phrase.grep(/(\b|\W)#{key.downcase}(\b|\W)/).empty?
23
+ end
24
+
25
+ false
26
+ end
27
+
28
+ def cleanse!(word)
29
+ value = dictionary[word.match(/\w+/).to_s]
30
+ return word unless value
31
+
32
+ if value == ''
33
+ word.gsub!(/\w/, character)
34
+ else
35
+ value
36
+ end
37
+ end
38
+ end
39
+ end
@@ -0,0 +1,3 @@
1
+ module Profane
2
+ VERSION = "0.0.1"
3
+ end
data/lib/profane.rb ADDED
@@ -0,0 +1,69 @@
1
+ require 'yaml'
2
+ require 'profane/version'
3
+ require 'profane/filter'
4
+
5
+ module Profane
6
+ DICTIONARY_PATH = 'config/dictionary.yml'
7
+
8
+ def self.configure(options)
9
+ config.merge!(options)
10
+ end
11
+
12
+ def self.config
13
+ @config ||= set_default_config
14
+ end
15
+
16
+ def self.set_default_config
17
+ @config = { use_internal_dictionary: true }
18
+ end
19
+
20
+ def self.dictionary
21
+ stringify_keys(load_dictionary)
22
+ end
23
+
24
+ def self.stringify_keys(hash)
25
+ hash.keys.each do |key|
26
+ hash[key.to_s] = hash.delete(key)
27
+ end
28
+
29
+ hash
30
+ end
31
+
32
+ def self.character
33
+ config[:filter_character] || '*'
34
+ end
35
+
36
+ def self.load_dictionary
37
+ yaml_dictionary = load_yaml_dictionary
38
+
39
+ if config[:use_internal_dictionary]
40
+ yaml_dictionary.merge (config[:dictionary] || {})
41
+ else
42
+ config[:dictionary]
43
+ end
44
+ end
45
+
46
+ def self.load_yaml_dictionary
47
+ custom_dictionary = load_custom_yaml_dictionary
48
+
49
+ if config[:use_internal_dictionary]
50
+ load_internal_yaml_dictionary.merge custom_dictionary
51
+ else
52
+ custom_dictionary
53
+ end
54
+ end
55
+
56
+ def self.load_internal_yaml_dictionary
57
+ internal_dictionary = YAML.load(File.read(DICTIONARY_PATH))
58
+ end
59
+
60
+ def self.load_custom_yaml_dictionary
61
+ path = config[:dictionary_file]
62
+
63
+ if path && File.exist?(path)
64
+ YAML.load(File.read(config[:dictionary_file]))
65
+ else
66
+ {}
67
+ end
68
+ end
69
+ end
data/profane.gemspec ADDED
@@ -0,0 +1,25 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'profane/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "profane"
8
+ spec.version = Profane::VERSION
9
+ spec.authors = ["Jonan Scheffler"]
10
+ spec.email = ["jonanscheffler@gmail.com"]
11
+ spec.description = %q{A simple, flexible profanity filter.}
12
+ spec.summary = %q{Profane is a basic profanity filter designed to filter and detect keywords based on an internal or external dictionary, or a combination of both.}
13
+ spec.homepage = "http://github.com/1337807/profane"
14
+ spec.license = "MIT"
15
+
16
+ spec.files = `git ls-files`.split($/)
17
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
18
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
+ spec.require_paths = ["lib"]
20
+
21
+ spec.add_development_dependency "bundler", "~> 1.3"
22
+ spec.add_development_dependency "rake"
23
+ spec.add_development_dependency "rspec"
24
+ spec.add_development_dependency "yaml"
25
+ end
data/profanity.txt ADDED
@@ -0,0 +1,452 @@
1
+ 4r5e
2
+ 5h1t
3
+ 5hit
4
+ a55
5
+ anal
6
+ anus
7
+ ar5e
8
+ arrse
9
+ arse
10
+ ass
11
+ ass-fucker
12
+ asses
13
+ assfucker
14
+ assfukka
15
+ asshole
16
+ assholes
17
+ asswhole
18
+ a_s_s
19
+ b!tch
20
+ b00bs
21
+ b17ch
22
+ b1tch
23
+ ballbag
24
+ balls
25
+ ballsack
26
+ bastard
27
+ beastial
28
+ beastiality
29
+ bellend
30
+ bestial
31
+ bestiality
32
+ bi+ch
33
+ biatch
34
+ bitch
35
+ bitcher
36
+ bitchers
37
+ bitches
38
+ bitchin
39
+ bitching
40
+ bloody
41
+ blow job
42
+ blowjob
43
+ blowjobs
44
+ boiolas
45
+ bollock
46
+ bollok
47
+ boner
48
+ boob
49
+ boobs
50
+ booobs
51
+ boooobs
52
+ booooobs
53
+ boooooobs
54
+ booooooobs
55
+ breasts
56
+ buceta
57
+ bugger
58
+ bum
59
+ bunny fucker
60
+ butt
61
+ butthole
62
+ buttmuch
63
+ buttplug
64
+ c0ck
65
+ c0cksucker
66
+ carpet muncher
67
+ cawk
68
+ chink
69
+ cipa
70
+ cl1t
71
+ clit
72
+ clitoris
73
+ clits
74
+ cnut
75
+ cock
76
+ cock-sucker
77
+ cockface
78
+ cockhead
79
+ cockmunch
80
+ cockmuncher
81
+ cocks
82
+ cocksuck
83
+ cocksucked
84
+ cocksucker
85
+ cocksucking
86
+ cocksucks
87
+ cocksuka
88
+ cocksukka
89
+ cok
90
+ cokmuncher
91
+ coksucka
92
+ coon
93
+ cox
94
+ crap
95
+ cum
96
+ cummer
97
+ cumming
98
+ cums
99
+ cumshot
100
+ cunilingus
101
+ cunillingus
102
+ cunnilingus
103
+ cunt
104
+ cuntlick
105
+ cuntlicker
106
+ cuntlicking
107
+ cunts
108
+ cyalis
109
+ cyberfuc
110
+ cyberfuck
111
+ cyberfucked
112
+ cyberfucker
113
+ cyberfuckers
114
+ cyberfucking
115
+ d1ck
116
+ damn
117
+ dick
118
+ dickhead
119
+ dildo
120
+ dildos
121
+ dink
122
+ dinks
123
+ dirsa
124
+ dlck
125
+ dog-fucker
126
+ doggin
127
+ dogging
128
+ donkeyribber
129
+ doosh
130
+ duche
131
+ dyke
132
+ ejaculate
133
+ ejaculated
134
+ ejaculates
135
+ ejaculating
136
+ ejaculatings
137
+ ejaculation
138
+ ejakulate
139
+ f u c k
140
+ f u c k e r
141
+ f4nny
142
+ fag
143
+ fagging
144
+ faggitt
145
+ faggot
146
+ faggs
147
+ fagot
148
+ fagots
149
+ fags
150
+ fanny
151
+ fannyflaps
152
+ fannyfucker
153
+ fanyy
154
+ fatass
155
+ fcuk
156
+ fcuker
157
+ fcuking
158
+ feck
159
+ fecker
160
+ felching
161
+ fellate
162
+ fellatio
163
+ fingerfuck
164
+ fingerfucked
165
+ fingerfucker
166
+ fingerfuckers
167
+ fingerfucking
168
+ fingerfucks
169
+ fistfuck
170
+ fistfucked
171
+ fistfucker
172
+ fistfuckers
173
+ fistfucking
174
+ fistfuckings
175
+ fistfucks
176
+ flange
177
+ fook
178
+ fooker
179
+ fuck
180
+ fucka
181
+ fucked
182
+ fucker
183
+ fuckers
184
+ fuckhead
185
+ fuckheads
186
+ fuckin
187
+ fucking
188
+ fuckings
189
+ fuckingshitmotherfucker
190
+ fuckme
191
+ fucks
192
+ fuckwhit
193
+ fuckwit
194
+ fudge packer
195
+ fudgepacker
196
+ fuk
197
+ fuker
198
+ fukker
199
+ fukkin
200
+ fuks
201
+ fukwhit
202
+ fukwit
203
+ fux
204
+ fux0r
205
+ f_u_c_k
206
+ gangbang
207
+ gangbanged
208
+ gangbangs
209
+ gaylord
210
+ gaysex
211
+ goatse
212
+ God
213
+ god-dam
214
+ god-damned
215
+ goddamn
216
+ goddamned
217
+ hardcoresex
218
+ hell
219
+ heshe
220
+ hoar
221
+ hoare
222
+ hoer
223
+ homo
224
+ hore
225
+ horniest
226
+ horny
227
+ hotsex
228
+ jack-off
229
+ jackoff
230
+ jap
231
+ jerk-off
232
+ jism
233
+ jiz
234
+ jizm
235
+ jizz
236
+ kawk
237
+ knob
238
+ knobead
239
+ knobed
240
+ knobend
241
+ knobhead
242
+ knobjocky
243
+ knobjokey
244
+ kock
245
+ kondum
246
+ kondums
247
+ kum
248
+ kummer
249
+ kumming
250
+ kums
251
+ kunilingus
252
+ l3i+ch
253
+ l3itch
254
+ labia
255
+ lmfao
256
+ lust
257
+ lusting
258
+ m0f0
259
+ m0fo
260
+ m45terbate
261
+ ma5terb8
262
+ ma5terbate
263
+ masochist
264
+ master-bate
265
+ masterb8
266
+ masterbat*
267
+ masterbat3
268
+ masterbate
269
+ masterbation
270
+ masterbations
271
+ masturbate
272
+ mo-fo
273
+ mof0
274
+ mofo
275
+ mothafuck
276
+ mothafucka
277
+ mothafuckas
278
+ mothafuckaz
279
+ mothafucked
280
+ mothafucker
281
+ mothafuckers
282
+ mothafuckin
283
+ mothafucking
284
+ mothafuckings
285
+ mothafucks
286
+ mother fucker
287
+ motherfuck
288
+ motherfucked
289
+ motherfucker
290
+ motherfuckers
291
+ motherfuckin
292
+ motherfucking
293
+ motherfuckings
294
+ motherfuckka
295
+ motherfucks
296
+ muff
297
+ mutha
298
+ muthafecker
299
+ muthafuckker
300
+ muther
301
+ mutherfucker
302
+ n1gga
303
+ n1gger
304
+ nazi
305
+ nigg3r
306
+ nigg4h
307
+ nigga
308
+ niggah
309
+ niggas
310
+ niggaz
311
+ nigger
312
+ niggers
313
+ nob
314
+ nob jokey
315
+ nobhead
316
+ nobjocky
317
+ nobjokey
318
+ numbnuts
319
+ nutsack
320
+ orgasim
321
+ orgasims
322
+ orgasm
323
+ orgasms
324
+ p0rn
325
+ pawn
326
+ pecker
327
+ penis
328
+ penisfucker
329
+ phonesex
330
+ phuck
331
+ phuk
332
+ phuked
333
+ phuking
334
+ phukked
335
+ phukking
336
+ phuks
337
+ phuq
338
+ pigfucker
339
+ pimpis
340
+ piss
341
+ pissed
342
+ pisser
343
+ pissers
344
+ pisses
345
+ pissflaps
346
+ pissin
347
+ pissing
348
+ pissoff
349
+ poop
350
+ porn
351
+ porno
352
+ pornography
353
+ pornos
354
+ prick
355
+ pricks
356
+ pron
357
+ pube
358
+ pusse
359
+ pussi
360
+ pussies
361
+ pussy
362
+ pussys
363
+ rectum
364
+ retard
365
+ rimjaw
366
+ rimming
367
+ s hit
368
+ s.o.b.
369
+ sadist
370
+ schlong
371
+ screwing
372
+ scroat
373
+ scrote
374
+ scrotum
375
+ semen
376
+ sex
377
+ sh!+
378
+ sh!t
379
+ sh1t
380
+ shag
381
+ shagger
382
+ shaggin
383
+ shagging
384
+ shemale
385
+ shi+
386
+ shit
387
+ shitdick
388
+ shite
389
+ shited
390
+ shitey
391
+ shitfuck
392
+ shitfull
393
+ shithead
394
+ shiting
395
+ shitings
396
+ shits
397
+ shitted
398
+ shitter
399
+ shitters
400
+ shitting
401
+ shittings
402
+ shitty
403
+ skank
404
+ slut
405
+ sluts
406
+ smegma
407
+ smut
408
+ snatch
409
+ son-of-a-bitch
410
+ spac
411
+ spunk
412
+ s_h_i_t
413
+ t1tt1e5
414
+ t1tties
415
+ teets
416
+ teez
417
+ testical
418
+ testicle
419
+ tit
420
+ titfuck
421
+ tits
422
+ titt
423
+ tittie5
424
+ tittiefucker
425
+ titties
426
+ tittyfuck
427
+ tittywank
428
+ titwank
429
+ tosser
430
+ turd
431
+ tw4t
432
+ twat
433
+ twathead
434
+ twatty
435
+ twunt
436
+ twunter
437
+ v14gra
438
+ v1gra
439
+ vagina
440
+ viagra
441
+ vulva
442
+ w00se
443
+ wang
444
+ wank
445
+ wanker
446
+ wanky
447
+ whoar
448
+ whore
449
+ willies
450
+ willy
451
+ xrated
452
+ xxx:1
@@ -0,0 +1,102 @@
1
+ require 'spec_helper'
2
+
3
+ describe 'Profane::Filter' do
4
+ before do
5
+ Profane.set_default_config
6
+ end
7
+
8
+ context "#filter" do
9
+ it "filters words from the dictionary using the default character" do
10
+ filter = Profane::Filter.new
11
+
12
+ filter.filter('fuck').should == '****'
13
+ end
14
+
15
+ it "filters words from the dictionary ignoring punctuation" do
16
+ filter = Profane::Filter.new
17
+
18
+ filter.filter('fuck!').should == '****!'
19
+ end
20
+
21
+ it "filters words from the dictionary using a custom character" do
22
+ Profane.configure(filter_character: '&')
23
+ filter = Profane::Filter.new
24
+
25
+ filter.filter('fuck!').should == '&&&&!'
26
+
27
+ Profane.configure(filter_character: '*')
28
+ end
29
+
30
+ context "when configured with a custom dictionary" do
31
+ it "filters words from the custom dictionary with string keys" do
32
+ Profane.configure(dictionary: { 'shit' => '' })
33
+ filter = Profane::Filter.new
34
+
35
+ filter.filter('shit!?').should == '****!?'
36
+ end
37
+
38
+ it "filters words from the custom dictionary with symbol keys" do
39
+ Profane.configure(dictionary: { :shit => '' })
40
+ filter = Profane::Filter.new
41
+
42
+ filter.filter('shit!?').should == '****!?'
43
+ end
44
+
45
+ it "filters words from the default dictionary" do
46
+ Profane.stub(:load_yaml_dictionary).and_return({ 'shit' => '' })
47
+ filter = Profane::Filter.new
48
+
49
+ filter.filter('shit!?').should == '****!?'
50
+ end
51
+ end
52
+
53
+ context "when configured not to use the internal dictionary" do
54
+ before do
55
+ Profane.configure(dictionary: { 'shit' => '' }, use_internal_dictionary: false)
56
+ end
57
+
58
+ it "filters words from the custom dictionary" do
59
+ filter = Profane::Filter.new
60
+ filter.filter('shit!?').should == '****!?'
61
+ end
62
+
63
+ it "doesn't filter words from the default dictionary" do
64
+ filter = Profane::Filter.new
65
+ filter.filter('fuck!?').should == 'fuck!?'
66
+ end
67
+ end
68
+ end
69
+
70
+ context "#profane?" do
71
+ it "returns false if the phrase is not profane" do
72
+ filter = Profane::Filter.new
73
+ filter.profane?('this is not profane').should be_false
74
+ end
75
+
76
+ it "detects the presence of words from the default dictionary" do
77
+ filter = Profane::Filter.new
78
+ filter.profane?('fuck').should be_true
79
+ end
80
+
81
+ it "detects the presence of words from the custom dictionary" do
82
+ Profane.configure(dictionary: { 'microsoft' => '' })
83
+ filter = Profane::Filter.new
84
+ filter.profane?('microsoft').should be_true
85
+ end
86
+
87
+ it "ignores case" do
88
+ filter = Profane::Filter.new
89
+ filter.profane?('ruby is the SHIT').should be_true
90
+ end
91
+
92
+ it "detects profanity in quotes" do
93
+ filter = Profane::Filter.new
94
+ filter.profane?("ruby is the 'SHIT'").should be_true
95
+ end
96
+
97
+ it "detects profanity surrounded by non-word characters" do
98
+ filter = Profane::Filter.new
99
+ filter.profane?("ruby is the -SHIT-").should be_true
100
+ end
101
+ end
102
+ end
@@ -0,0 +1,20 @@
1
+ require 'spec_helper'
2
+
3
+ describe Profane do
4
+ before do
5
+ Profane.set_default_config
6
+ end
7
+
8
+ context "without configuration options" do
9
+ it "loads the default dictionary" do
10
+ Profane.dictionary['fuck'].should == ''
11
+ end
12
+ end
13
+
14
+ context "with configuration options" do
15
+ it "includes the supplied configuration options with the defaults" do
16
+ Profane.configure(dictionary: { geega: 'bobby pants' })
17
+ Profane.config[:dictionary][:geega].should == 'bobby pants'
18
+ end
19
+ end
20
+ end
@@ -0,0 +1 @@
1
+ require 'profane'
metadata ADDED
@@ -0,0 +1,129 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: profane
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Jonan Scheffler
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2013-05-01 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: bundler
16
+ requirement: !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ~>
20
+ - !ruby/object:Gem::Version
21
+ version: '1.3'
22
+ type: :development
23
+ prerelease: false
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ~>
28
+ - !ruby/object:Gem::Version
29
+ version: '1.3'
30
+ - !ruby/object:Gem::Dependency
31
+ name: rake
32
+ requirement: !ruby/object:Gem::Requirement
33
+ none: false
34
+ requirements:
35
+ - - ! '>='
36
+ - !ruby/object:Gem::Version
37
+ version: '0'
38
+ type: :development
39
+ prerelease: false
40
+ version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ! '>='
44
+ - !ruby/object:Gem::Version
45
+ version: '0'
46
+ - !ruby/object:Gem::Dependency
47
+ name: rspec
48
+ requirement: !ruby/object:Gem::Requirement
49
+ none: false
50
+ requirements:
51
+ - - ! '>='
52
+ - !ruby/object:Gem::Version
53
+ version: '0'
54
+ type: :development
55
+ prerelease: false
56
+ version_requirements: !ruby/object:Gem::Requirement
57
+ none: false
58
+ requirements:
59
+ - - ! '>='
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ - !ruby/object:Gem::Dependency
63
+ name: yaml
64
+ requirement: !ruby/object:Gem::Requirement
65
+ none: false
66
+ requirements:
67
+ - - ! '>='
68
+ - !ruby/object:Gem::Version
69
+ version: '0'
70
+ type: :development
71
+ prerelease: false
72
+ version_requirements: !ruby/object:Gem::Requirement
73
+ none: false
74
+ requirements:
75
+ - - ! '>='
76
+ - !ruby/object:Gem::Version
77
+ version: '0'
78
+ description: A simple, flexible profanity filter.
79
+ email:
80
+ - jonanscheffler@gmail.com
81
+ executables: []
82
+ extensions: []
83
+ extra_rdoc_files: []
84
+ files:
85
+ - .gitignore
86
+ - .rvmrc
87
+ - Gemfile
88
+ - LICENSE.txt
89
+ - README.md
90
+ - Rakefile
91
+ - config/dictionary.yml
92
+ - lib/profane.rb
93
+ - lib/profane/filter.rb
94
+ - lib/profane/version.rb
95
+ - profane.gemspec
96
+ - profanity.txt
97
+ - spec/profane/filter_spec.rb
98
+ - spec/profane_spec.rb
99
+ - spec/spec_helper.rb
100
+ homepage: http://github.com/1337807/profane
101
+ licenses:
102
+ - MIT
103
+ post_install_message:
104
+ rdoc_options: []
105
+ require_paths:
106
+ - lib
107
+ required_ruby_version: !ruby/object:Gem::Requirement
108
+ none: false
109
+ requirements:
110
+ - - ! '>='
111
+ - !ruby/object:Gem::Version
112
+ version: '0'
113
+ required_rubygems_version: !ruby/object:Gem::Requirement
114
+ none: false
115
+ requirements:
116
+ - - ! '>='
117
+ - !ruby/object:Gem::Version
118
+ version: '0'
119
+ requirements: []
120
+ rubyforge_project:
121
+ rubygems_version: 1.8.25
122
+ signing_key:
123
+ specification_version: 3
124
+ summary: Profane is a basic profanity filter designed to filter and detect keywords
125
+ based on an internal or external dictionary, or a combination of both.
126
+ test_files:
127
+ - spec/profane/filter_spec.rb
128
+ - spec/profane_spec.rb
129
+ - spec/spec_helper.rb