soap 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +15 -0
- data/.document +5 -0
- data/Gemfile +12 -0
- data/Gemfile.lock +18 -0
- data/LICENSE.txt +20 -0
- data/README.rdoc +19 -0
- data/Rakefile +35 -0
- data/VERSION +1 -0
- data/lib/soap.rb +36 -0
- data/lib/words.txt +146 -0
- data/soap.gemspec +57 -0
- data/test/helper.rb +18 -0
- data/test/test_soap.rb +28 -0
- metadata +100 -0
checksums.yaml
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
---
|
2
|
+
!binary "U0hBMQ==":
|
3
|
+
metadata.gz: !binary |-
|
4
|
+
ZTFjN2Y5MjQ1NDU3ZjNlNjI4NDU2MWNmNjkxMThkZmY1NzM0NGYzZA==
|
5
|
+
data.tar.gz: !binary |-
|
6
|
+
ZGE1YTRjN2NiMjM2NzA3N2E2ZDQxYWIyNTNhMGRlMDUwNmY4NzUyNQ==
|
7
|
+
SHA512:
|
8
|
+
metadata.gz: !binary |-
|
9
|
+
MGQ5OWM4MTQ5OGY5N2Y1YmExNjhiOThmY2U5ZDVhMjE3ZGIzYmVjNDI4MzBk
|
10
|
+
OTlkZWQxMGI4MDhiYTNkNmU4MDY1MzZmNWU5NzlhZWI0OWE3ZTA5YWUzYTEw
|
11
|
+
OWJkY2JmMTE3MmY5NzRjY2FkNmNkM2QyYmMxNzY0ZjQ3ZmJjYTk=
|
12
|
+
data.tar.gz: !binary |-
|
13
|
+
YWY0NmVlNDc3MTY2Zjc2ZWE3ZTk1Yzg4MDZkYmRmYTVlYTIxOTdiYjVjZGQy
|
14
|
+
ODZiYTVjOGYxMjViNzJiOTQ3MzQ3MGY4MjgxYjA0Y2RhNTJmY2NlZDkzNmNk
|
15
|
+
YjgyNGVkMzQxNmM1NjZlYThiZTgxMWZkMDIwMDk2ZGJmZTlmNTA=
|
data/.document
ADDED
data/Gemfile
ADDED
@@ -0,0 +1,12 @@
|
|
1
|
+
source "http://rubygems.org"
|
2
|
+
# Add dependencies required to use your gem here.
|
3
|
+
# Example:
|
4
|
+
# gem "activesupport", ">= 2.3.5"
|
5
|
+
|
6
|
+
# Add dependencies to develop your gem here.
|
7
|
+
# Include everything needed to run rake, tests, features, etc.
|
8
|
+
group :development do
|
9
|
+
gem "bundler", "~> 1.0.0"
|
10
|
+
gem "jeweler", "~> 1.6.4"
|
11
|
+
gem 'activesupport', "~>3.0.11"
|
12
|
+
end
|
data/Gemfile.lock
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
GEM
|
2
|
+
remote: http://rubygems.org/
|
3
|
+
specs:
|
4
|
+
activesupport (3.0.11)
|
5
|
+
git (1.2.5)
|
6
|
+
jeweler (1.6.4)
|
7
|
+
bundler (~> 1.0)
|
8
|
+
git (>= 1.2.5)
|
9
|
+
rake
|
10
|
+
rake (0.9.2.2)
|
11
|
+
|
12
|
+
PLATFORMS
|
13
|
+
ruby
|
14
|
+
|
15
|
+
DEPENDENCIES
|
16
|
+
activesupport (~> 3.0.11)
|
17
|
+
bundler (~> 1.0.0)
|
18
|
+
jeweler (~> 1.6.4)
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright (c) 2012 Jason Nochlin
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.rdoc
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
= soap
|
2
|
+
|
3
|
+
Description goes here.
|
4
|
+
|
5
|
+
== Contributing to soap
|
6
|
+
|
7
|
+
* Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet
|
8
|
+
* Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it
|
9
|
+
* Fork the project
|
10
|
+
* Start a feature/bugfix branch
|
11
|
+
* Commit and push until you are happy with your contribution
|
12
|
+
* Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.
|
13
|
+
* Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.
|
14
|
+
|
15
|
+
== Copyright
|
16
|
+
|
17
|
+
Copyright (c) 2012 Jason Nochlin. See LICENSE.txt for
|
18
|
+
further details.
|
19
|
+
|
data/Rakefile
ADDED
@@ -0,0 +1,35 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
require 'rubygems'
|
4
|
+
require 'bundler'
|
5
|
+
begin
|
6
|
+
Bundler.setup(:default, :development)
|
7
|
+
rescue Bundler::BundlerError => e
|
8
|
+
$stderr.puts e.message
|
9
|
+
$stderr.puts "Run `bundle install` to install missing gems"
|
10
|
+
exit e.status_code
|
11
|
+
end
|
12
|
+
require 'rake'
|
13
|
+
|
14
|
+
require 'jeweler'
|
15
|
+
Jeweler::Tasks.new do |gem|
|
16
|
+
# gem is a Gem::Specification... see http://docs.rubygems.org/read/chapter/20 for more options
|
17
|
+
gem.name = "soap"
|
18
|
+
gem.homepage = "http://github.com/hundredwatt/soap"
|
19
|
+
gem.license = "MIT"
|
20
|
+
gem.summary = "A simple gem that detects the presence of any profanity in a string. Useful for URL shorteners"
|
21
|
+
gem.description = "Simple profanity detection"
|
22
|
+
gem.email = "hundredwatt@gmail.com"
|
23
|
+
gem.authors = ["Jason Nochlin"]
|
24
|
+
# dependencies defined in Gemfile
|
25
|
+
end
|
26
|
+
Jeweler::RubygemsDotOrgTasks.new
|
27
|
+
|
28
|
+
require 'rake/testtask'
|
29
|
+
Rake::TestTask.new(:test) do |test|
|
30
|
+
test.libs << 'lib' << 'test'
|
31
|
+
test.pattern = 'test/**/test_*.rb'
|
32
|
+
test.verbose = true
|
33
|
+
end
|
34
|
+
|
35
|
+
task :default => :test
|
data/VERSION
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
1.0.0
|
data/lib/soap.rb
ADDED
@@ -0,0 +1,36 @@
|
|
1
|
+
module Soap
|
2
|
+
WORDS = File.read(File.expand_path('../words.txt', __FILE__)).split("\n")
|
3
|
+
LETTERS = {
|
4
|
+
'a' => 'a4',
|
5
|
+
'b' => 'b6',
|
6
|
+
'c' => 'c',
|
7
|
+
'd' => 'd',
|
8
|
+
'e' => 'e3',
|
9
|
+
'f' => 'f',
|
10
|
+
'g' => 'g9',
|
11
|
+
'h' => 'h',
|
12
|
+
'i' => 'i1l',
|
13
|
+
'j' => 'j',
|
14
|
+
'k' => 'k',
|
15
|
+
'l' => 'i1l',
|
16
|
+
'm' => 'm',
|
17
|
+
'n' => 'n',
|
18
|
+
'o' => 'o0',
|
19
|
+
'p' => 'p',
|
20
|
+
'q' => 'q',
|
21
|
+
'r' => 'r',
|
22
|
+
's' => 's',
|
23
|
+
't' => 't1',
|
24
|
+
'u' => 'u',
|
25
|
+
'v' => 'v',
|
26
|
+
'w' => 'w',
|
27
|
+
'x' => 'x',
|
28
|
+
'y' => 'y',
|
29
|
+
'z' => 'z',
|
30
|
+
}
|
31
|
+
CHAR_CLASSES = LETTERS.inject({}) { |acc,(letter,set_string)| acc[letter] = '['+set_string+']'; acc }
|
32
|
+
PATTERN = %r{#{WORDS.map {|word| word.split('').map{|letter|CHAR_CLASSES[letter]}.join('') }.join('|')}}
|
33
|
+
def self.detect_profanity(test_string)
|
34
|
+
not test_string.downcase.match(PATTERN).nil?
|
35
|
+
end
|
36
|
+
end
|
data/lib/words.txt
ADDED
@@ -0,0 +1,146 @@
|
|
1
|
+
shit
|
2
|
+
piss
|
3
|
+
fuck
|
4
|
+
cunt
|
5
|
+
cock
|
6
|
+
suck
|
7
|
+
tits
|
8
|
+
poop
|
9
|
+
ass
|
10
|
+
lick
|
11
|
+
hole
|
12
|
+
ball
|
13
|
+
bitch
|
14
|
+
blow
|
15
|
+
bun
|
16
|
+
bum
|
17
|
+
butt
|
18
|
+
chink
|
19
|
+
jerk
|
20
|
+
crap
|
21
|
+
balls
|
22
|
+
beaver
|
23
|
+
belly
|
24
|
+
bitch
|
25
|
+
blow
|
26
|
+
boner
|
27
|
+
bucket
|
28
|
+
cunt
|
29
|
+
bum
|
30
|
+
butch
|
31
|
+
butt
|
32
|
+
butt
|
33
|
+
fucker
|
34
|
+
butt
|
35
|
+
hair
|
36
|
+
chink
|
37
|
+
circle
|
38
|
+
jerk
|
39
|
+
clam
|
40
|
+
clit
|
41
|
+
cobia
|
42
|
+
cock
|
43
|
+
cocks
|
44
|
+
cooter
|
45
|
+
crap
|
46
|
+
cum
|
47
|
+
cummer
|
48
|
+
cums
|
49
|
+
cunt
|
50
|
+
cunts
|
51
|
+
damn
|
52
|
+
dick
|
53
|
+
dike
|
54
|
+
dildo
|
55
|
+
dildos
|
56
|
+
dink
|
57
|
+
dinks
|
58
|
+
dong
|
59
|
+
douche
|
60
|
+
dyke
|
61
|
+
fag
|
62
|
+
fagget
|
63
|
+
faggit
|
64
|
+
faggot
|
65
|
+
faggs
|
66
|
+
fagot
|
67
|
+
fagots
|
68
|
+
fags
|
69
|
+
fart
|
70
|
+
farted
|
71
|
+
farts
|
72
|
+
farty
|
73
|
+
fatass
|
74
|
+
fatso
|
75
|
+
fuck
|
76
|
+
fucked
|
77
|
+
fucker
|
78
|
+
fuckin
|
79
|
+
fuckme
|
80
|
+
fucks
|
81
|
+
fuk
|
82
|
+
fuks
|
83
|
+
gaysex
|
84
|
+
gonads
|
85
|
+
gook
|
86
|
+
guinne
|
87
|
+
hard
|
88
|
+
homo
|
89
|
+
hooker
|
90
|
+
horny
|
91
|
+
hotsex
|
92
|
+
hussy
|
93
|
+
jack
|
94
|
+
jap
|
95
|
+
jerk
|
96
|
+
jism
|
97
|
+
jiz
|
98
|
+
jizm
|
99
|
+
jizz
|
100
|
+
kike
|
101
|
+
kock
|
102
|
+
kondum
|
103
|
+
kraut
|
104
|
+
kum
|
105
|
+
kummer
|
106
|
+
kums
|
107
|
+
lesbo
|
108
|
+
merde
|
109
|
+
mick
|
110
|
+
muff
|
111
|
+
nigger
|
112
|
+
orgasm
|
113
|
+
pecker
|
114
|
+
penis
|
115
|
+
phuk
|
116
|
+
phuked
|
117
|
+
phuks
|
118
|
+
phuq
|
119
|
+
pimp
|
120
|
+
piss
|
121
|
+
pissed
|
122
|
+
pissrr
|
123
|
+
pisses
|
124
|
+
pissin
|
125
|
+
prick
|
126
|
+
pricks
|
127
|
+
pussy
|
128
|
+
pussys
|
129
|
+
queer
|
130
|
+
retard
|
131
|
+
screw
|
132
|
+
shit
|
133
|
+
shited
|
134
|
+
shits
|
135
|
+
shitty
|
136
|
+
slag
|
137
|
+
sleaze
|
138
|
+
slut
|
139
|
+
sluts
|
140
|
+
smut
|
141
|
+
snatch
|
142
|
+
spunk
|
143
|
+
twat
|
144
|
+
whore
|
145
|
+
wop
|
146
|
+
sex
|
data/soap.gemspec
ADDED
@@ -0,0 +1,57 @@
|
|
1
|
+
# Generated by jeweler
|
2
|
+
# DO NOT EDIT THIS FILE DIRECTLY
|
3
|
+
# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
|
4
|
+
# -*- encoding: utf-8 -*-
|
5
|
+
|
6
|
+
Gem::Specification.new do |s|
|
7
|
+
s.name = "soap"
|
8
|
+
s.version = "1.0.0"
|
9
|
+
|
10
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
|
+
s.authors = ["Jason Nochlin"]
|
12
|
+
s.date = "2012-02-25"
|
13
|
+
s.description = "Simple profanity detection"
|
14
|
+
s.email = "hundredwatt@gmail.com"
|
15
|
+
s.extra_rdoc_files = [
|
16
|
+
"LICENSE.txt",
|
17
|
+
"README.rdoc"
|
18
|
+
]
|
19
|
+
s.files = [
|
20
|
+
".document",
|
21
|
+
"Gemfile",
|
22
|
+
"Gemfile.lock",
|
23
|
+
"LICENSE.txt",
|
24
|
+
"README.rdoc",
|
25
|
+
"Rakefile",
|
26
|
+
"VERSION",
|
27
|
+
"lib/soap.rb",
|
28
|
+
"lib/words.txt",
|
29
|
+
"soap.gemspec",
|
30
|
+
"test/helper.rb",
|
31
|
+
"test/test_soap.rb"
|
32
|
+
]
|
33
|
+
s.homepage = "http://github.com/hundredwatt/soap"
|
34
|
+
s.licenses = ["MIT"]
|
35
|
+
s.require_paths = ["lib"]
|
36
|
+
s.rubygems_version = "1.8.10"
|
37
|
+
s.summary = "A simple gem that detects the presence of any profanity in a string. Useful for URL shorteners"
|
38
|
+
|
39
|
+
if s.respond_to? :specification_version then
|
40
|
+
s.specification_version = 3
|
41
|
+
|
42
|
+
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
43
|
+
s.add_development_dependency(%q<bundler>, ["~> 1.0.0"])
|
44
|
+
s.add_development_dependency(%q<jeweler>, ["~> 1.6.4"])
|
45
|
+
s.add_development_dependency(%q<activesupport>, ["~> 3.0.11"])
|
46
|
+
else
|
47
|
+
s.add_dependency(%q<bundler>, ["~> 1.0.0"])
|
48
|
+
s.add_dependency(%q<jeweler>, ["~> 1.6.4"])
|
49
|
+
s.add_dependency(%q<activesupport>, ["~> 3.0.11"])
|
50
|
+
end
|
51
|
+
else
|
52
|
+
s.add_dependency(%q<bundler>, ["~> 1.0.0"])
|
53
|
+
s.add_dependency(%q<jeweler>, ["~> 1.6.4"])
|
54
|
+
s.add_dependency(%q<activesupport>, ["~> 3.0.11"])
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
data/test/helper.rb
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'bundler'
|
3
|
+
begin
|
4
|
+
Bundler.setup(:default, :development)
|
5
|
+
rescue Bundler::BundlerError => e
|
6
|
+
$stderr.puts e.message
|
7
|
+
$stderr.puts "Run `bundle install` to install missing gems"
|
8
|
+
exit e.status_code
|
9
|
+
end
|
10
|
+
require 'test/unit'
|
11
|
+
require 'active_support'
|
12
|
+
|
13
|
+
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
|
14
|
+
$LOAD_PATH.unshift(File.dirname(__FILE__))
|
15
|
+
require 'soap'
|
16
|
+
|
17
|
+
class Test::Unit::TestCase
|
18
|
+
end
|
data/test/test_soap.rb
ADDED
@@ -0,0 +1,28 @@
|
|
1
|
+
require 'helper'
|
2
|
+
|
3
|
+
class TestSoap < Test::Unit::TestCase
|
4
|
+
def test_does_not_raise_exception
|
5
|
+
Soap.detect_profanity('a')
|
6
|
+
end
|
7
|
+
def test_detect_anything_that_looks_profane
|
8
|
+
[
|
9
|
+
['SHiT', true],
|
10
|
+
['plain', false],
|
11
|
+
['cock', true],
|
12
|
+
['p3n1s', true],
|
13
|
+
].
|
14
|
+
each do |test, result|
|
15
|
+
assert(Soap.detect_profanity(test) == result, "Incorrectly detected #{test}")
|
16
|
+
end
|
17
|
+
end
|
18
|
+
def test_n_random_strings_for_detection_frequency
|
19
|
+
length = 10
|
20
|
+
n = 10000
|
21
|
+
(1..n).
|
22
|
+
map { ActiveSupport::SecureRandom.base64(length).to_s.gsub('/', '+')[0,length] }.
|
23
|
+
select { |i| Soap.detect_profanity(i) }.
|
24
|
+
count.tap { |profanities|
|
25
|
+
puts "#{profanities} detected in #{n} strings of length #{length}"
|
26
|
+
}
|
27
|
+
end
|
28
|
+
end
|
metadata
ADDED
@@ -0,0 +1,100 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: soap
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.0.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Jason Nochlin
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2012-02-25 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.0.0
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ~>
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 1.0.0
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: jeweler
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ~>
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: 1.6.4
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ~>
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: 1.6.4
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: activesupport
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ~>
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: 3.0.11
|
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.11
|
55
|
+
description: Simple profanity detection
|
56
|
+
email: hundredwatt@gmail.com
|
57
|
+
executables: []
|
58
|
+
extensions: []
|
59
|
+
extra_rdoc_files:
|
60
|
+
- LICENSE.txt
|
61
|
+
- README.rdoc
|
62
|
+
files:
|
63
|
+
- .document
|
64
|
+
- Gemfile
|
65
|
+
- Gemfile.lock
|
66
|
+
- LICENSE.txt
|
67
|
+
- README.rdoc
|
68
|
+
- Rakefile
|
69
|
+
- VERSION
|
70
|
+
- lib/soap.rb
|
71
|
+
- lib/words.txt
|
72
|
+
- soap.gemspec
|
73
|
+
- test/helper.rb
|
74
|
+
- test/test_soap.rb
|
75
|
+
homepage: http://github.com/hundredwatt/soap
|
76
|
+
licenses:
|
77
|
+
- MIT
|
78
|
+
metadata: {}
|
79
|
+
post_install_message:
|
80
|
+
rdoc_options: []
|
81
|
+
require_paths:
|
82
|
+
- lib
|
83
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
84
|
+
requirements:
|
85
|
+
- - ! '>='
|
86
|
+
- !ruby/object:Gem::Version
|
87
|
+
version: '0'
|
88
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
89
|
+
requirements:
|
90
|
+
- - ! '>='
|
91
|
+
- !ruby/object:Gem::Version
|
92
|
+
version: '0'
|
93
|
+
requirements: []
|
94
|
+
rubyforge_project:
|
95
|
+
rubygems_version: 2.2.1
|
96
|
+
signing_key:
|
97
|
+
specification_version: 3
|
98
|
+
summary: A simple gem that detects the presence of any profanity in a string. Useful
|
99
|
+
for URL shorteners
|
100
|
+
test_files: []
|