trenni-words 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: d7799c8f3ebb143a9cac7a462489baef5be218db
4
+ data.tar.gz: 81108021f079e77716c68818900e4a28f5ba597d
5
+ SHA512:
6
+ metadata.gz: c30f973e07e73da49d43327ba29c528ad91899a2e76d0a58ce1b447780189835248f0ccd61461d6e7bbfeb7aa61b21ae07c6c3fd9c2836d46a6a88702bc7abec
7
+ data.tar.gz: f6e1295674bf1ed0b050da603c850c94d73ad2c2b9ac8a1097f468f4d0c997018e6fe57062185217a3c1047e57128a4f89b8d0e801ce4b01271296e9d2225fea
@@ -0,0 +1,9 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
data/.rspec ADDED
@@ -0,0 +1,4 @@
1
+ --color
2
+ --format documentation
3
+ --backtrace
4
+ --warnings
@@ -0,0 +1,9 @@
1
+
2
+ SimpleCov.start do
3
+ add_filter "/spec/"
4
+ end
5
+
6
+ if ENV['TRAVIS']
7
+ require 'coveralls'
8
+ Coveralls.wear!
9
+ end
@@ -0,0 +1,14 @@
1
+ language: ruby
2
+ sudo: false
3
+ rvm:
4
+ - 2.1.8
5
+ - 2.2.4
6
+ - 2.3.0
7
+ - ruby-head
8
+ - rbx-2
9
+ env:
10
+ - COVERAGE=true
11
+ matrix:
12
+ allow_failures:
13
+ - rvm: "rbx-2"
14
+ - rvm: "ruby-head"
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in trenni-words.gemspec
4
+ gemspec
@@ -0,0 +1,63 @@
1
+ # Trenni::Words
2
+
3
+ Trenni::Words provides an obscenity/profanity filter. It loads it's data efficiently from a file which contains either patterns or strings.
4
+
5
+ [![Build Status](https://secure.travis-ci.org/ioquatix/trenni-words.svg)](http://travis-ci.org/ioquatix/trenni-words)
6
+ [![Code Climate](https://codeclimate.com/github/ioquatix/trenni-words.svg)](https://codeclimate.com/github/ioquatix/trenni-words)
7
+ [![Coverage Status](https://coveralls.io/repos/ioquatix/trenni-words/badge.svg)](https://coveralls.io/r/ioquatix/trenni-words)
8
+
9
+ ## Installation
10
+
11
+ Add this line to your application's Gemfile:
12
+
13
+ ```ruby
14
+ gem 'trenni-words'
15
+ ```
16
+
17
+ And then execute:
18
+
19
+ $ bundle
20
+
21
+ Or install it yourself as:
22
+
23
+ $ gem install trenni-words
24
+
25
+ ## Usage
26
+
27
+ For filtering obscenity:
28
+
29
+ filter = Trenni::Words::Filter.for_obscenity
30
+ filter.apply("Crap on the floor")
31
+ # "**** on the floor"
32
+
33
+ ## Contributing
34
+
35
+ 1. Fork it
36
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
37
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
38
+ 4. Push to the branch (`git push origin my-new-feature`)
39
+ 5. Create new Pull Request
40
+
41
+ ## License
42
+
43
+ Released under the MIT license.
44
+
45
+ Copyright, 2016, by [Samuel G. D. Williams](http://www.codeotaku.com/samuel-williams).
46
+
47
+ Permission is hereby granted, free of charge, to any person obtaining a copy
48
+ of this software and associated documentation files (the "Software"), to deal
49
+ in the Software without restriction, including without limitation the rights
50
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
51
+ copies of the Software, and to permit persons to whom the Software is
52
+ furnished to do so, subject to the following conditions:
53
+
54
+ The above copyright notice and this permission notice shall be included in
55
+ all copies or substantial portions of the Software.
56
+
57
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
58
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
59
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
60
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
61
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
62
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
63
+ THE SOFTWARE.
@@ -0,0 +1,12 @@
1
+ require "bundler/gem_tasks"
2
+ require "rspec/core/rake_task"
3
+
4
+ RSpec::Core::RakeTask.new(:spec) do |task|
5
+ begin
6
+ require('simplecov/version')
7
+ task.rspec_opts = %w{--require simplecov} if ENV['COVERAGE']
8
+ rescue LoadError
9
+ end
10
+ end
11
+
12
+ task :default => :spec
@@ -0,0 +1,27 @@
1
+ # Copyright, 2016, by Samuel G. D. Williams. <http://www.codeotaku.com>
2
+ #
3
+ # Permission is hereby granted, free of charge, to any person obtaining a copy
4
+ # of this software and associated documentation files (the "Software"), to deal
5
+ # in the Software without restriction, including without limitation the rights
6
+ # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7
+ # copies of the Software, and to permit persons to whom the Software is
8
+ # furnished to do so, subject to the following conditions:
9
+ #
10
+ # The above copyright notice and this permission notice shall be included in
11
+ # all copies or substantial portions of the Software.
12
+ #
13
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
+ # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
+ # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16
+ # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
+ # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
+ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19
+ # THE SOFTWARE.
20
+
21
+ require_relative 'words/version'
22
+ require_relative 'words/filter'
23
+
24
+ module Trenni
25
+ module Words
26
+ end
27
+ end
@@ -0,0 +1,63 @@
1
+ # Copyright, 2016, by Samuel G. D. Williams. <http://www.codeotaku.com>
2
+ #
3
+ # Permission is hereby granted, free of charge, to any person obtaining a copy
4
+ # of this software and associated documentation files (the "Software"), to deal
5
+ # in the Software without restriction, including without limitation the rights
6
+ # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7
+ # copies of the Software, and to permit persons to whom the Software is
8
+ # furnished to do so, subject to the following conditions:
9
+ #
10
+ # The above copyright notice and this permission notice shall be included in
11
+ # all copies or substantial portions of the Software.
12
+ #
13
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
+ # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
+ # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16
+ # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
+ # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
+ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19
+ # THE SOFTWARE.
20
+
21
+ module Trenni
22
+ module Words
23
+ # Filters patterns from a block of text.
24
+ class Filter
25
+ def initialize(patterns)
26
+ @patterns = Regexp.union(*patterns)
27
+ end
28
+
29
+ def replace(match)
30
+ '*' * match.length
31
+ end
32
+
33
+ def apply(text)
34
+ text.gsub(@patterns, &self.method(:replace))
35
+ end
36
+
37
+ def =~ text
38
+ @patterns =~ text
39
+ end
40
+
41
+ # Convert a string into a regexp. If the string starts with a `/`, it's considered a raw regexp.
42
+ def self.regexp_from_wildcard(string)
43
+ if string.start_with? '/'
44
+ return Regexp.new(string[1...-1], Regexp::IGNORECASE)
45
+ else
46
+ return Regexp.new('\b' + string + '\b', Regexp::IGNORECASE)
47
+ end
48
+ end
49
+
50
+ def self.load_file(path)
51
+ patterns = File.readlines(path).collect do |line|
52
+ self.regexp_from_wildcard(line.chomp!)
53
+ end
54
+
55
+ Filter.new(patterns)
56
+ end
57
+
58
+ def self.for_obscenity
59
+ @obscenity_filter ||= self.load_file(File.expand_path("obscenity.txt", __dir__))
60
+ end
61
+ end
62
+ end
63
+ end
@@ -0,0 +1,369 @@
1
+ /fu+ck/
2
+ /cu+nt/
3
+ 4r5e
4
+ 5h1t
5
+ 5hit
6
+ a55
7
+ anal
8
+ anus
9
+ ar5e
10
+ arrse
11
+ arse
12
+ ass
13
+ asses
14
+ assfukka
15
+ asshole
16
+ assholes
17
+ asswhole
18
+ a_s_s
19
+ b!tch
20
+ b00bs
21
+ b17ch
22
+ b1tch
23
+ ballbag
24
+ ballsack
25
+ bastard
26
+ beastial
27
+ beastiality
28
+ bellend
29
+ bestial
30
+ bestiality
31
+ bi+ch
32
+ biatch
33
+ bitch
34
+ bitcher
35
+ bitchers
36
+ bitches
37
+ bitchin
38
+ bitching
39
+ bloody
40
+ blow job
41
+ blowjob
42
+ blowjobs
43
+ boiolas
44
+ bollock
45
+ bollok
46
+ boner
47
+ boob
48
+ boobs
49
+ booobs
50
+ boooobs
51
+ booooobs
52
+ booooooobs
53
+ breasts
54
+ buceta
55
+ butt
56
+ butthole
57
+ buttmuch
58
+ buttplug
59
+ c0ck
60
+ c0cksucker
61
+ carpet muncher
62
+ cawk
63
+ chink
64
+ cipa
65
+ cl1t
66
+ clit
67
+ clitoris
68
+ clits
69
+ cnut
70
+ cock
71
+ cock-sucker
72
+ cockface
73
+ cockhead
74
+ cockmunch
75
+ cockmuncher
76
+ cocks
77
+ cocksuck
78
+ cocksucked
79
+ cocksucker
80
+ cocksucking
81
+ cocksucks
82
+ cocksuka
83
+ cocksukka
84
+ cok
85
+ cokmuncher
86
+ coksucka
87
+ coon
88
+ cox
89
+ crap
90
+ cum
91
+ cummer
92
+ cumming
93
+ cums
94
+ cumshot
95
+ cunilingus
96
+ cunillingus
97
+ cunnilingus
98
+ cyalis
99
+ cyberfuc
100
+ d1ck
101
+ damn
102
+ dick
103
+ dickhead
104
+ dildo
105
+ dildos
106
+ dink
107
+ dinks
108
+ dirsa
109
+ dlck
110
+ doggin
111
+ dogging
112
+ donkeyribber
113
+ doosh
114
+ duche
115
+ dyke
116
+ ejaculate
117
+ ejaculated
118
+ ejaculates
119
+ ejaculating
120
+ ejaculatings
121
+ ejaculation
122
+ ejakulate
123
+ f u c k
124
+ f u c k e r
125
+ f4nny
126
+ fag
127
+ fagging
128
+ faggitt
129
+ faggot
130
+ faggs
131
+ fagot
132
+ fagots
133
+ fags
134
+ fanny
135
+ fannyflaps
136
+ fanyy
137
+ fatass
138
+ fcuk
139
+ fcuker
140
+ fcuking
141
+ feck
142
+ fecker
143
+ felching
144
+ fellate
145
+ fellatio
146
+ flange
147
+ fook
148
+ fooker
149
+ fudge packer
150
+ fudgepacker
151
+ fuk
152
+ fuker
153
+ fukker
154
+ fukkin
155
+ fuks
156
+ fukwhit
157
+ fukwit
158
+ fux
159
+ fux0r
160
+ f_u_c_k
161
+ gangbang
162
+ gangbanged
163
+ gangbangs
164
+ gaylord
165
+ gaysex
166
+ goatse
167
+ hardcoresex
168
+ heshe
169
+ hoar
170
+ hoare
171
+ hoer
172
+ homo
173
+ hore
174
+ horniest
175
+ horny
176
+ hotsex
177
+ jack-off
178
+ jackoff
179
+ jap
180
+ jerk-off
181
+ jism
182
+ jiz
183
+ jizm
184
+ jizz
185
+ kawk
186
+ knob
187
+ knobead
188
+ knobed
189
+ knobend
190
+ knobhead
191
+ knobjocky
192
+ knobjokey
193
+ kock
194
+ kondum
195
+ kondums
196
+ kum
197
+ kummer
198
+ kumming
199
+ kums
200
+ kunilingus
201
+ l3i+ch
202
+ l3itch
203
+ labia
204
+ m0f0
205
+ m0fo
206
+ m45terbate
207
+ ma5terb8
208
+ ma5terbate
209
+ masochist
210
+ master-bate
211
+ masterb8
212
+ masterbat*
213
+ masterbat3
214
+ masterbate
215
+ masterbation
216
+ masterbations
217
+ masturbate
218
+ mo-fo
219
+ mof0
220
+ mofo
221
+ muff
222
+ mutha
223
+ muthafecker
224
+ muther
225
+ n1gga
226
+ n1gger
227
+ nazi
228
+ nigg3r
229
+ nigg4h
230
+ nigga
231
+ niggah
232
+ niggas
233
+ niggaz
234
+ nigger
235
+ niggers
236
+ nob
237
+ nob jokey
238
+ nobhead
239
+ nobjocky
240
+ nobjokey
241
+ numbnuts
242
+ nutsack
243
+ orgasim
244
+ orgasims
245
+ orgasm
246
+ orgasms
247
+ p0rn
248
+ pawn
249
+ pecker
250
+ penis
251
+ phonesex
252
+ phuck
253
+ phuk
254
+ phuked
255
+ phuking
256
+ phukked
257
+ phukking
258
+ phuks
259
+ phuq
260
+ pimpis
261
+ piss
262
+ pissed
263
+ pisser
264
+ pissers
265
+ pisses
266
+ pissflaps
267
+ pissin
268
+ pissing
269
+ pissoff
270
+ poop
271
+ porn
272
+ porno
273
+ pornography
274
+ pornos
275
+ prick
276
+ pricks
277
+ pron
278
+ pube
279
+ pusse
280
+ pussi
281
+ pussies
282
+ pussy
283
+ pussys
284
+ rectum
285
+ retard
286
+ rimjaw
287
+ rimming
288
+ s hit
289
+ s.o.b.
290
+ sadist
291
+ schlong
292
+ screwing
293
+ scroat
294
+ scrote
295
+ scrotum
296
+ semen
297
+ sex
298
+ sh!+
299
+ sh!t
300
+ sh1t
301
+ shag
302
+ shagger
303
+ shaggin
304
+ shagging
305
+ shemale
306
+ shi+
307
+ shit
308
+ shitdick
309
+ shite
310
+ shited
311
+ shitey
312
+ shitfull
313
+ shithead
314
+ shiting
315
+ shitings
316
+ shits
317
+ shitted
318
+ shitter
319
+ shitters
320
+ shitting
321
+ shittings
322
+ /shit+y/
323
+ skank
324
+ slut
325
+ sluts
326
+ smegma
327
+ smut
328
+ snatch
329
+ son-of-a-bitch
330
+ spac
331
+ spunk
332
+ s_h_i_t
333
+ t1tt1e5
334
+ t1tties
335
+ teets
336
+ teez
337
+ testical
338
+ testicle
339
+ tit
340
+ tits
341
+ titt
342
+ tittie5
343
+ titties
344
+ tittywank
345
+ titwank
346
+ tosser
347
+ turd
348
+ tw4t
349
+ twat
350
+ twathead
351
+ twatty
352
+ twunt
353
+ twunter
354
+ v14gra
355
+ v1gra
356
+ vagina
357
+ viagra
358
+ vulva
359
+ w00se
360
+ wang
361
+ wank
362
+ wanker
363
+ wanky
364
+ whoar
365
+ whore
366
+ willies
367
+ willy
368
+ xrated
369
+ xxx
@@ -0,0 +1,25 @@
1
+ # Copyright, 2016, by Samuel G. D. Williams. <http://www.codeotaku.com>
2
+ #
3
+ # Permission is hereby granted, free of charge, to any person obtaining a copy
4
+ # of this software and associated documentation files (the "Software"), to deal
5
+ # in the Software without restriction, including without limitation the rights
6
+ # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7
+ # copies of the Software, and to permit persons to whom the Software is
8
+ # furnished to do so, subject to the following conditions:
9
+ #
10
+ # The above copyright notice and this permission notice shall be included in
11
+ # all copies or substantial portions of the Software.
12
+ #
13
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
+ # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
+ # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16
+ # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
+ # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
+ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19
+ # THE SOFTWARE.
20
+
21
+ module Trenni
22
+ module Words
23
+ VERSION = "1.0.0"
24
+ end
25
+ end
@@ -0,0 +1,23 @@
1
+ # coding: utf-8
2
+ require_relative 'lib/trenni/words/version'
3
+
4
+ Gem::Specification.new do |spec|
5
+ spec.name = "trenni-words"
6
+ spec.version = Trenni::Words::VERSION
7
+ spec.authors = ["Samuel Williams"]
8
+ spec.email = ["samuel.williams@oriontransfer.co.nz"]
9
+
10
+ spec.summary = %q{Provides a basic profanity/obscenity filter.}
11
+ spec.homepage = "https://github.com/ioquatix/trenni-words"
12
+
13
+ spec.files = `git ls-files -z`.split("\x0").reject do |f|
14
+ f.match(%r{^(test|spec|features)/})
15
+ end
16
+ spec.bindir = "bin"
17
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
18
+ spec.require_paths = ["lib"]
19
+
20
+ spec.add_development_dependency "bundler", "~> 1.13"
21
+ spec.add_development_dependency "rake", "~> 10.0"
22
+ spec.add_development_dependency "rspec", "~> 3.0"
23
+ end
metadata ADDED
@@ -0,0 +1,97 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: trenni-words
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.0
5
+ platform: ruby
6
+ authors:
7
+ - Samuel Williams
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2016-12-21 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1.13'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.13'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '10.0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '10.0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rspec
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '3.0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '3.0'
55
+ description:
56
+ email:
57
+ - samuel.williams@oriontransfer.co.nz
58
+ executables: []
59
+ extensions: []
60
+ extra_rdoc_files: []
61
+ files:
62
+ - ".gitignore"
63
+ - ".rspec"
64
+ - ".simplecov"
65
+ - ".travis.yml"
66
+ - Gemfile
67
+ - README.md
68
+ - Rakefile
69
+ - lib/trenni/words.rb
70
+ - lib/trenni/words/filter.rb
71
+ - lib/trenni/words/obscenity.txt
72
+ - lib/trenni/words/version.rb
73
+ - trenni-words.gemspec
74
+ homepage: https://github.com/ioquatix/trenni-words
75
+ licenses: []
76
+ metadata: {}
77
+ post_install_message:
78
+ rdoc_options: []
79
+ require_paths:
80
+ - lib
81
+ required_ruby_version: !ruby/object:Gem::Requirement
82
+ requirements:
83
+ - - ">="
84
+ - !ruby/object:Gem::Version
85
+ version: '0'
86
+ required_rubygems_version: !ruby/object:Gem::Requirement
87
+ requirements:
88
+ - - ">="
89
+ - !ruby/object:Gem::Version
90
+ version: '0'
91
+ requirements: []
92
+ rubyforge_project:
93
+ rubygems_version: 2.5.2
94
+ signing_key:
95
+ specification_version: 4
96
+ summary: Provides a basic profanity/obscenity filter.
97
+ test_files: []