snarkify 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +15 -0
- data/.gitignore +34 -0
- data/Gemfile.lock +17 -0
- data/README.md +16 -0
- data/gemfile +2 -0
- data/lib/snarkify.rb +6 -0
- data/lib/snarkify/dictionary.rb +8 -0
- data/lib/snarkify/dictionary.yml +103 -0
- data/lib/snarkify/dictionary_loader.rb +5 -0
- data/lib/snarkify/dictionary_parser.rb +7 -0
- data/lib/snarkify/snarkify.rb +8 -0
- data/lib/snarkify/word_replacer.rb +8 -0
- data/lib/snarkify/word_substitution.rb +21 -0
- data/rakefile +7 -0
- data/snarkify.gemspec +20 -0
- metadata +58 -0
checksums.yaml
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
---
|
2
|
+
!binary "U0hBMQ==":
|
3
|
+
metadata.gz: !binary |-
|
4
|
+
YTY5YmZmOGM2ODQzYjVkYWUyOWRjNjU3MWUwNjdhMTQ4NjQxODE3Yw==
|
5
|
+
data.tar.gz: !binary |-
|
6
|
+
NTU1ZTQ3ODZkNjkyMDEyODRmMWJkMjRlMzI4ZDc2ZGVhZTc0MjAzYg==
|
7
|
+
SHA512:
|
8
|
+
metadata.gz: !binary |-
|
9
|
+
ZWQzMzljMjBkMDhmMmE0OTA2ZTMxZjZhNDFkZGM3ZjU5N2MwNjhkZTU2YWUy
|
10
|
+
NTVhNTg4OWY1Mjk1YmUwYjNlZjExZjMzMGY1YjE4MTU4YzY2NGQwMmZiZDcw
|
11
|
+
ZDhkODY3MWZmZTFlYTZiNjk4YjE3NGZjZDdkN2JkNmY1ZjBlYjU=
|
12
|
+
data.tar.gz: !binary |-
|
13
|
+
NTE2YjNmZjNiOTY3MjBkM2EyN2E5M2M0ZjNmMjAyOWM4NzVhN2VjMWI2YzUx
|
14
|
+
NjA0MjZjMDRlZWVkNGQ0YzU4Y2MyNzJjOWNiZDRjNmVjYWU5MjhiN2U3NDBk
|
15
|
+
Yzk5YjJiN2QwZDYxZmU2NDAwOGI3MDRiZmY0MTFhZTllMjI3NTE=
|
data/.gitignore
ADDED
@@ -0,0 +1,34 @@
|
|
1
|
+
*.gem
|
2
|
+
*.rbc
|
3
|
+
/.config
|
4
|
+
/coverage/
|
5
|
+
/InstalledFiles
|
6
|
+
/pkg/
|
7
|
+
/spec/reports/
|
8
|
+
/test/tmp/
|
9
|
+
/test/version_tmp/
|
10
|
+
/tmp/
|
11
|
+
|
12
|
+
## Specific to RubyMotion:
|
13
|
+
.dat*
|
14
|
+
.repl_history
|
15
|
+
build/
|
16
|
+
|
17
|
+
## Documentation cache and generated files:
|
18
|
+
/.yardoc/
|
19
|
+
/_yardoc/
|
20
|
+
/doc/
|
21
|
+
/rdoc/
|
22
|
+
|
23
|
+
## Environment normalisation:
|
24
|
+
/.bundle/
|
25
|
+
/lib/bundler/man/
|
26
|
+
|
27
|
+
# for a library or gem, you might want to ignore these files since the code is
|
28
|
+
# intended to run in multiple environments; otherwise, check them in:
|
29
|
+
# Gemfile.lock
|
30
|
+
# .ruby-version
|
31
|
+
# .ruby-gemset
|
32
|
+
|
33
|
+
# unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
|
34
|
+
.rvmrc
|
data/Gemfile.lock
ADDED
data/README.md
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
snarkify
|
2
|
+
========
|
3
|
+
|
4
|
+
A gem to replace positive words with insults
|
5
|
+
|
6
|
+
# TODO
|
7
|
+
* create sample JSON file
|
8
|
+
-good word:bad words
|
9
|
+
-index:{good words:bad words}
|
10
|
+
* load JSON file
|
11
|
+
* parse load into word objects
|
12
|
+
* method to search for good words and replace with bad
|
13
|
+
|
14
|
+
* build gem
|
15
|
+
* submit to rubygems
|
16
|
+
* download and test
|
data/gemfile
ADDED
data/lib/snarkify.rb
ADDED
@@ -0,0 +1,6 @@
|
|
1
|
+
require_relative './snarkify/snarkify'
|
2
|
+
require_relative './snarkify/word_substitution'
|
3
|
+
require_relative './snarkify/dictionary'
|
4
|
+
require_relative './snarkify/dictionary_parser'
|
5
|
+
require_relative './snarkify/dictionary_loader'
|
6
|
+
require_relative './snarkify/word_replacer'
|
@@ -0,0 +1,103 @@
|
|
1
|
+
---
|
2
|
+
- good:
|
3
|
+
- love
|
4
|
+
- like
|
5
|
+
- enjoy
|
6
|
+
- appreciate
|
7
|
+
- adore
|
8
|
+
bad:
|
9
|
+
- hate
|
10
|
+
- despise
|
11
|
+
- resent
|
12
|
+
- dislike
|
13
|
+
- detest
|
14
|
+
|
15
|
+
- good:
|
16
|
+
- happy
|
17
|
+
- joyful
|
18
|
+
- excited
|
19
|
+
- cheerful
|
20
|
+
- content
|
21
|
+
- delighted
|
22
|
+
- glad
|
23
|
+
- pleased
|
24
|
+
- thrilled
|
25
|
+
- calm
|
26
|
+
bad:
|
27
|
+
- angry
|
28
|
+
- pissed
|
29
|
+
- resentful
|
30
|
+
- disappointed
|
31
|
+
- miserable
|
32
|
+
- troubled
|
33
|
+
- morose
|
34
|
+
- enraged
|
35
|
+
- furious
|
36
|
+
- offended
|
37
|
+
- insulted
|
38
|
+
- vexed
|
39
|
+
- incensed
|
40
|
+
|
41
|
+
- good:
|
42
|
+
- cool
|
43
|
+
- awesome
|
44
|
+
- great
|
45
|
+
- magnificent
|
46
|
+
- stunning
|
47
|
+
- wonderful
|
48
|
+
- fine
|
49
|
+
- brilliant
|
50
|
+
- excellent
|
51
|
+
- marvelous
|
52
|
+
- superb
|
53
|
+
- super
|
54
|
+
- good
|
55
|
+
bad:
|
56
|
+
- terrible
|
57
|
+
- shite
|
58
|
+
- bollocks
|
59
|
+
- crap
|
60
|
+
- wank
|
61
|
+
- drivel
|
62
|
+
|
63
|
+
- good:
|
64
|
+
- beautiful
|
65
|
+
- gorgeous
|
66
|
+
- lovely
|
67
|
+
- cute
|
68
|
+
- charming
|
69
|
+
- good looking
|
70
|
+
- handsome
|
71
|
+
- magnificent
|
72
|
+
- pretty
|
73
|
+
- amazing
|
74
|
+
- incredible
|
75
|
+
bad:
|
76
|
+
- ugly
|
77
|
+
- hideous
|
78
|
+
- grotesque
|
79
|
+
- deformed
|
80
|
+
- gross
|
81
|
+
|
82
|
+
- good:
|
83
|
+
- friend
|
84
|
+
- pal
|
85
|
+
- mate
|
86
|
+
- buddy
|
87
|
+
- partner
|
88
|
+
- wife
|
89
|
+
- husband
|
90
|
+
- girlfriend
|
91
|
+
- boyfriend
|
92
|
+
bad:
|
93
|
+
- enemy
|
94
|
+
- asshole
|
95
|
+
- tosser
|
96
|
+
- tosspot
|
97
|
+
- foe
|
98
|
+
- nemesis
|
99
|
+
|
100
|
+
- good:
|
101
|
+
- miss you
|
102
|
+
bad:
|
103
|
+
- hope you die in a fire
|
@@ -0,0 +1,21 @@
|
|
1
|
+
class WordSubstitution
|
2
|
+
attr_reader :good_words
|
3
|
+
|
4
|
+
def initialize(params)
|
5
|
+
@good_words = params.fetch("good")
|
6
|
+
@bad_words = params.fetch("bad")
|
7
|
+
end
|
8
|
+
|
9
|
+
def snarkify!(content)
|
10
|
+
@good_words.each do |word|
|
11
|
+
content.gsub!(/([^a-zA-Z])#{word}([^a-zA-Z])/im, "\\1#{get_bad_word}\\2")
|
12
|
+
end
|
13
|
+
content
|
14
|
+
end
|
15
|
+
|
16
|
+
private
|
17
|
+
|
18
|
+
def get_bad_word
|
19
|
+
@bad_words.sample
|
20
|
+
end
|
21
|
+
end
|
data/rakefile
ADDED
data/snarkify.gemspec
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
lib = File.expand_path('../lib', __FILE__)
|
2
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
3
|
+
|
4
|
+
Gem::Specification.new do |spec|
|
5
|
+
spec.name = 'snarkify'
|
6
|
+
spec.version = '0.0.4'
|
7
|
+
spec.date = '2014-08-28'
|
8
|
+
spec.summary = "Replace positive words with insults"
|
9
|
+
spec.description = "Replaces all the positive words in given content with negative words, taking into account punctuation and larger words, etc"
|
10
|
+
spec.authors = ["James Robinson"]
|
11
|
+
spec.email = 'james.michael.robinson@gmail.com'
|
12
|
+
spec.files = ["lib/snarkify.rb"]
|
13
|
+
spec.homepage = 'http://rubygems.org/gems/snarkify'
|
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
|
+
end
|
metadata
ADDED
@@ -0,0 +1,58 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: snarkify
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.4
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- James Robinson
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2014-08-28 00:00:00.000000000 Z
|
12
|
+
dependencies: []
|
13
|
+
description: Replaces all the positive words in given content with negative words,
|
14
|
+
taking into account punctuation and larger words, etc
|
15
|
+
email: james.michael.robinson@gmail.com
|
16
|
+
executables: []
|
17
|
+
extensions: []
|
18
|
+
extra_rdoc_files: []
|
19
|
+
files:
|
20
|
+
- .gitignore
|
21
|
+
- Gemfile.lock
|
22
|
+
- README.md
|
23
|
+
- gemfile
|
24
|
+
- lib/snarkify.rb
|
25
|
+
- lib/snarkify/dictionary.rb
|
26
|
+
- lib/snarkify/dictionary.yml
|
27
|
+
- lib/snarkify/dictionary_loader.rb
|
28
|
+
- lib/snarkify/dictionary_parser.rb
|
29
|
+
- lib/snarkify/snarkify.rb
|
30
|
+
- lib/snarkify/word_replacer.rb
|
31
|
+
- lib/snarkify/word_substitution.rb
|
32
|
+
- rakefile
|
33
|
+
- snarkify.gemspec
|
34
|
+
homepage: http://rubygems.org/gems/snarkify
|
35
|
+
licenses:
|
36
|
+
- MIT
|
37
|
+
metadata: {}
|
38
|
+
post_install_message:
|
39
|
+
rdoc_options: []
|
40
|
+
require_paths:
|
41
|
+
- lib
|
42
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
43
|
+
requirements:
|
44
|
+
- - ! '>='
|
45
|
+
- !ruby/object:Gem::Version
|
46
|
+
version: '0'
|
47
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
48
|
+
requirements:
|
49
|
+
- - ! '>='
|
50
|
+
- !ruby/object:Gem::Version
|
51
|
+
version: '0'
|
52
|
+
requirements: []
|
53
|
+
rubyforge_project:
|
54
|
+
rubygems_version: 2.1.5
|
55
|
+
signing_key:
|
56
|
+
specification_version: 4
|
57
|
+
summary: Replace positive words with insults
|
58
|
+
test_files: []
|