l2e_vocab_blacklist 1.4.0 → 1.4.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/l2e_vocab_blacklist.rb +20 -5
- metadata +35 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 961fbfdac8784d0b36b9f7033c6edd08d612fe59
|
4
|
+
data.tar.gz: 62a79a688e431dc1de578d76376683c1fa21065e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 077cc3e0930530edd3d22058d8cf2bdf0858d960826d08577156ede226a732adad62ca79915503488253b6c6d75c3e86dd8b175e79fea33101b94e3d0a861c70
|
7
|
+
data.tar.gz: bc9a4355b382f83a0cef504ff9da74ff2dc509c776f7e1e21c03176cdaef3eeaac3029d9b945804ccb553e0d12ddcdd90ee2055791509f47b499827804b398c5
|
data/lib/l2e_vocab_blacklist.rb
CHANGED
@@ -3,7 +3,7 @@ require 'csv'
|
|
3
3
|
|
4
4
|
class VocabBlacklist
|
5
5
|
|
6
|
-
# Returns true or false, check to see if the
|
6
|
+
# Returns true or false, check to see if the string is on the blacklist
|
7
7
|
def self.blacklisted?(str, age = "0")
|
8
8
|
# Sanitize string
|
9
9
|
str = str.downcase.strip
|
@@ -40,9 +40,14 @@ class VocabBlacklist
|
|
40
40
|
|
41
41
|
end
|
42
42
|
|
43
|
-
def self.censor(str, age = "0", replace_with = "
|
43
|
+
def self.censor(str, age = "0", replace_with = "*")
|
44
44
|
PHRASES.each do |bad_phrase|
|
45
|
-
|
45
|
+
# match number of characters for any replace_with that is 1 character
|
46
|
+
if replace_with.length == 1
|
47
|
+
str.gsub!(/#{ bad_phrase }/i, replace_with * bad_phrase.length)
|
48
|
+
else
|
49
|
+
str.gsub!(/#{ bad_phrase }/i, replace_with)
|
50
|
+
end
|
46
51
|
end
|
47
52
|
|
48
53
|
whitelisted_phrases = self.whitelist_matches(str)
|
@@ -57,11 +62,21 @@ class VocabBlacklist
|
|
57
62
|
|
58
63
|
if !is_whitelisted
|
59
64
|
if check_full_words_csv(word, age)
|
60
|
-
|
65
|
+
# match number of characters for any replace_with that is 1 character
|
66
|
+
if replace_with.length == 1
|
67
|
+
sub_working_word.gsub!(/#{ word }/i, replace_with * word.length)
|
68
|
+
else
|
69
|
+
sub_working_word.gsub!(/#{ word }/i, replace_with)
|
70
|
+
end
|
61
71
|
end
|
62
72
|
|
63
73
|
if GREEDY_WORDS.any? { |w| word.include?(w) }
|
64
|
-
|
74
|
+
# match number of characters for any replace_with that is 1 character
|
75
|
+
if replace_with.length == 1
|
76
|
+
sub_working_word = replace_with * sub_working_word.length
|
77
|
+
else
|
78
|
+
sub_working_word = replace_with
|
79
|
+
end
|
65
80
|
end
|
66
81
|
end
|
67
82
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: l2e_vocab_blacklist
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.4.
|
4
|
+
version: 1.4.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Greg Sherrid
|
@@ -11,7 +11,35 @@ autorequire:
|
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
13
|
date: 2018-04-02 00:00:00.000000000 Z
|
14
|
-
dependencies:
|
14
|
+
dependencies:
|
15
|
+
- !ruby/object:Gem::Dependency
|
16
|
+
name: activesupport-inflector
|
17
|
+
requirement: !ruby/object:Gem::Requirement
|
18
|
+
requirements:
|
19
|
+
- - '>='
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: '0'
|
22
|
+
type: :runtime
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
requirements:
|
26
|
+
- - '>='
|
27
|
+
- !ruby/object:Gem::Version
|
28
|
+
version: '0'
|
29
|
+
- !ruby/object:Gem::Dependency
|
30
|
+
name: i18n
|
31
|
+
requirement: !ruby/object:Gem::Requirement
|
32
|
+
requirements:
|
33
|
+
- - '>='
|
34
|
+
- !ruby/object:Gem::Version
|
35
|
+
version: '0'
|
36
|
+
type: :runtime
|
37
|
+
prerelease: false
|
38
|
+
version_requirements: !ruby/object:Gem::Requirement
|
39
|
+
requirements:
|
40
|
+
- - '>='
|
41
|
+
- !ruby/object:Gem::Version
|
42
|
+
version: '0'
|
15
43
|
description: Detect words and partial-words that shouldn't be used on Learn2Earn Whooo's
|
16
44
|
Reading website
|
17
45
|
email: greg@whooosreading.org
|
@@ -19,11 +47,11 @@ executables: []
|
|
19
47
|
extensions: []
|
20
48
|
extra_rdoc_files: []
|
21
49
|
files:
|
22
|
-
- README.md
|
23
50
|
- lib/l2e_vocab_blacklist.rb
|
24
|
-
- lib/l2e_vocab_blacklist/blacklists/full_words.csv
|
25
51
|
- lib/l2e_vocab_blacklist/blacklists/greedy_words.txt
|
52
|
+
- lib/l2e_vocab_blacklist/blacklists/full_words.csv
|
26
53
|
- lib/l2e_vocab_blacklist/blacklists/whitelist.csv
|
54
|
+
- README.md
|
27
55
|
homepage: https://github.com/whooosreading/l2e_vocab_blacklist
|
28
56
|
licenses:
|
29
57
|
- All rights reserved, for now
|
@@ -34,17 +62,17 @@ require_paths:
|
|
34
62
|
- lib
|
35
63
|
required_ruby_version: !ruby/object:Gem::Requirement
|
36
64
|
requirements:
|
37
|
-
- -
|
65
|
+
- - '>='
|
38
66
|
- !ruby/object:Gem::Version
|
39
67
|
version: '0'
|
40
68
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
41
69
|
requirements:
|
42
|
-
- -
|
70
|
+
- - '>='
|
43
71
|
- !ruby/object:Gem::Version
|
44
72
|
version: '0'
|
45
73
|
requirements: []
|
46
74
|
rubyforge_project:
|
47
|
-
rubygems_version: 2.
|
75
|
+
rubygems_version: 2.0.3
|
48
76
|
signing_key:
|
49
77
|
specification_version: 4
|
50
78
|
summary: L2E Vocab Blacklist
|