cf-swearjar 1.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 +2 -0
- data/Gemfile +3 -0
- data/README.rdoc +28 -0
- data/Rakefile +18 -0
- data/cf-swearjar.gemspec +37 -0
- data/lib/config/en.yml +1521 -0
- data/lib/swearjar/tester.rb +32 -0
- data/lib/swearjar/version.rb +3 -0
- data/lib/swearjar.rb +63 -0
- data/spec/data/swear.yml +2 -0
- data/spec/spec.opts +7 -0
- data/spec/spec_helper.rb +1 -0
- data/spec/swearjar_spec.rb +48 -0
- metadata +113 -0
data/.gitignore
ADDED
data/Gemfile
ADDED
data/README.rdoc
ADDED
@@ -0,0 +1,28 @@
|
|
1
|
+
= Swearjar
|
2
|
+
|
3
|
+
Simple profanity detection with content analysis. Added a larger dictionary to joshbuddy's version but many of the reasons are simply listed as "offensive" to save time.
|
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'
|
21
|
+
|
22
|
+
To load from a custom yaml file, you can do the following
|
23
|
+
|
24
|
+
sj = Swearjar.new
|
25
|
+
sj.load_file('my_yaml.yml')
|
26
|
+
|
27
|
+
The YAML file can have two sections, `simple` and `regex`. For an example, see `lib/config/en.yml`.
|
28
|
+
|
data/Rakefile
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
task :default => :spec
|
4
|
+
|
5
|
+
require 'spec'
|
6
|
+
require 'spec/rake/spectask'
|
7
|
+
task :spec => 'spec:all'
|
8
|
+
namespace(:spec) do
|
9
|
+
Spec::Rake::SpecTask.new(:all) do |t|
|
10
|
+
t.spec_opts ||= []
|
11
|
+
t.spec_opts << "-rubygems"
|
12
|
+
t.spec_opts << "--options" << "spec/spec.opts"
|
13
|
+
t.spec_files = FileList['spec/**/*_spec.rb']
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
require 'bundler'
|
18
|
+
Bundler::GemHelper.install_tasks
|
data/cf-swearjar.gemspec
ADDED
@@ -0,0 +1,37 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
|
3
|
+
require File.join(File.dirname(__FILE__), 'lib', 'swearjar', 'version')
|
4
|
+
|
5
|
+
Gem::Specification.new do |s|
|
6
|
+
s.name = 'cf-swearjar'
|
7
|
+
s.version = Swearjar::VERSION
|
8
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
9
|
+
s.authors = ["Joshua Hull"]
|
10
|
+
s.summary = "Put another nickel in the swearjar. Simple profanity detection with content analysis"
|
11
|
+
s.description = "#{s.summary}."
|
12
|
+
s.email = %q{joshbuddy@gmail.com}
|
13
|
+
s.extra_rdoc_files = ['README.rdoc']
|
14
|
+
s.files = `git ls-files`.split("\n")
|
15
|
+
s.homepage = %q{http://github.com/joshbuddy/swearjar}
|
16
|
+
s.rdoc_options = ["--charset=UTF-8"]
|
17
|
+
s.require_paths = ["lib"]
|
18
|
+
s.rubygems_version = %q{1.3.7}
|
19
|
+
s.test_files = `git ls-files`.split("\n").select{|f| f =~ /^spec/}
|
20
|
+
s.rubyforge_project = 'swearjar'
|
21
|
+
|
22
|
+
# dependencies
|
23
|
+
s.add_runtime_dependency 'fuzzyhash', '~> 0.0.11'
|
24
|
+
s.add_development_dependency 'rake', '~> 0.8.7'
|
25
|
+
s.add_development_dependency 'rspec', '~> 1.3.0'
|
26
|
+
|
27
|
+
if s.respond_to? :specification_version then
|
28
|
+
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
29
|
+
s.specification_version = 3
|
30
|
+
|
31
|
+
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
32
|
+
else
|
33
|
+
end
|
34
|
+
else
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|