mr_clean 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 2ff64e50ab311d8b920858fc10df80f15566ff37
4
- data.tar.gz: 3581283817031a95f15f3d0a575533b82d71a08e
3
+ metadata.gz: 981783c05ef0ee3efaa39108535ce765ed5c0c5d
4
+ data.tar.gz: f07f65fbf197fd22678c0ea304b2ffcc2b0ce4db
5
5
  SHA512:
6
- metadata.gz: a6f63abbd51149b4c6ac022ce8cd699a1db2dbd8521901f239b779385006769c9759d6a3213ff3f5dd124742c003e897eee30c66579029a464c29bc785164e9f
7
- data.tar.gz: 398d141ba1d67e2fe6ab6f20a076e8768ba373fe45719ad1f9a0466beea8070d0865e6d74608e43b9fd471c6e30fbf1241ea52baf3964062ff96446a7f0de742
6
+ metadata.gz: 816d8cee2ff30af48834011f9d3450a9e7457e8a4749808b0b3fe757794e150cb85f5da7b8c3695a1634a137284793d59bd1dfb5d8a0e66b88528d142cbd1c55
7
+ data.tar.gz: 2e6dfc7e359f9263c711c9e004640b37c5e3353f05e990a34468642511d1f6320810da705d4ea36f978bea025dcbc1e5376f5e1409ed895183821a047db74391
data/.gitignore CHANGED
@@ -1 +1,3 @@
1
1
  .DS_Store
2
+ mr_clean-*.gem
3
+ /tmp
data/Gemfile ADDED
@@ -0,0 +1,16 @@
1
+ source 'https://rubygems.org'
2
+
3
+ group :development, :benchmarking do
4
+ gem 'activesupport', '~> 4.0.0'
5
+ gem 'obscenity', '~> 1.0.2'
6
+ gem 'parallel', '~> 0.8.0'
7
+ gem 'profanity_filter', '~> 0.1.1'
8
+ end
9
+
10
+ group :development, :test do
11
+ gem 'debugger', '~> 1.6.1'
12
+ gem 'guard-rspec', '~> 3.0.3'
13
+ gem 'pry-rails', '~> 0.3.2'
14
+ gem 'rake', '~> 10.1.0'
15
+ gem 'rspec', '~> 2.14.1'
16
+ end
data/Gemfile.lock ADDED
@@ -0,0 +1,81 @@
1
+ GEM
2
+ remote: https://rubygems.org/
3
+ specs:
4
+ activesupport (4.0.0)
5
+ i18n (~> 0.6, >= 0.6.4)
6
+ minitest (~> 4.2)
7
+ multi_json (~> 1.3)
8
+ thread_safe (~> 0.1)
9
+ tzinfo (~> 0.3.37)
10
+ atomic (1.1.13)
11
+ coderay (1.0.9)
12
+ columnize (0.3.6)
13
+ debugger (1.6.1)
14
+ columnize (>= 0.3.1)
15
+ debugger-linecache (~> 1.2.0)
16
+ debugger-ruby_core_source (~> 1.2.3)
17
+ debugger-linecache (1.2.0)
18
+ debugger-ruby_core_source (1.2.3)
19
+ diff-lcs (1.2.4)
20
+ ffi (1.9.0)
21
+ formatador (0.2.4)
22
+ guard (1.8.2)
23
+ formatador (>= 0.2.4)
24
+ listen (>= 1.0.0)
25
+ lumberjack (>= 1.0.2)
26
+ pry (>= 0.9.10)
27
+ thor (>= 0.14.6)
28
+ guard-rspec (3.0.3)
29
+ guard (>= 1.8)
30
+ rspec (~> 2.13)
31
+ i18n (0.6.5)
32
+ listen (1.3.1)
33
+ rb-fsevent (>= 0.9.3)
34
+ rb-inotify (>= 0.9)
35
+ rb-kqueue (>= 0.2)
36
+ lumberjack (1.0.4)
37
+ method_source (0.8.2)
38
+ minitest (4.7.5)
39
+ multi_json (1.8.0)
40
+ obscenity (1.0.2)
41
+ parallel (0.8.0)
42
+ profanity_filter (0.1.1)
43
+ pry (0.9.12.2)
44
+ coderay (~> 1.0.5)
45
+ method_source (~> 0.8)
46
+ slop (~> 3.4)
47
+ pry-rails (0.3.2)
48
+ pry (>= 0.9.10)
49
+ rake (10.1.0)
50
+ rb-fsevent (0.9.3)
51
+ rb-inotify (0.9.1)
52
+ ffi (>= 0.5.0)
53
+ rb-kqueue (0.2.0)
54
+ ffi (>= 0.5.0)
55
+ rspec (2.14.1)
56
+ rspec-core (~> 2.14.0)
57
+ rspec-expectations (~> 2.14.0)
58
+ rspec-mocks (~> 2.14.0)
59
+ rspec-core (2.14.5)
60
+ rspec-expectations (2.14.2)
61
+ diff-lcs (>= 1.1.3, < 2.0)
62
+ rspec-mocks (2.14.3)
63
+ slop (3.4.6)
64
+ thor (0.18.1)
65
+ thread_safe (0.1.2)
66
+ atomic
67
+ tzinfo (0.3.37)
68
+
69
+ PLATFORMS
70
+ ruby
71
+
72
+ DEPENDENCIES
73
+ activesupport (~> 4.0.0)
74
+ debugger (~> 1.6.1)
75
+ guard-rspec (~> 3.0.3)
76
+ obscenity (~> 1.0.2)
77
+ parallel (~> 0.8.0)
78
+ profanity_filter (~> 0.1.1)
79
+ pry-rails (~> 0.3.2)
80
+ rake (~> 10.1.0)
81
+ rspec (~> 2.14.1)
data/bench/bench.rb ADDED
@@ -0,0 +1,22 @@
1
+ require 'yaml'
2
+
3
+ class Bench
4
+ class << self
5
+ def use(klass)
6
+ puts 'Loading samples.yml...'
7
+ data = YAML::load(File.open(File.expand_path('samples.yml', File.dirname(__FILE__))))
8
+
9
+ data.each_with_index do |paragraph, index|
10
+ t = profile { klass.profane?(paragraph) }
11
+ puts "#{t}\tParagraph #{index}, #{paragraph.size} chars"
12
+ end
13
+ end
14
+
15
+ def profile
16
+ start = Time.now
17
+ yield
18
+ total = "%.2f" % ((Time.now - start) * 1000.0)
19
+ return "#{total}ms"
20
+ end
21
+ end
22
+ end
data/bench/mr_clean.rb ADDED
@@ -0,0 +1,5 @@
1
+ $: << File.expand_path(File.dirname(__FILE__) + '/../')
2
+ require 'lib/mr_clean'
3
+ require 'bench/bench'
4
+
5
+ Bench.use(MrClean::Profanity)
@@ -0,0 +1,6 @@
1
+ require 'obscenity'
2
+
3
+ $: << File.expand_path(File.dirname(__FILE__) + '/../')
4
+ require 'bench/bench'
5
+
6
+ Bench.use(Obscenity)
data/bench/parallel.rb ADDED
@@ -0,0 +1,40 @@
1
+ require 'parallel'
2
+
3
+ SIZE = 20
4
+ SLEEP = true
5
+
6
+ def sequential
7
+ x = 0
8
+ SIZE.times do
9
+ r = rand
10
+ sleep r if SLEEP
11
+ puts "+ #{r}"
12
+ x += r
13
+ end
14
+ x
15
+ end
16
+
17
+ def parallel
18
+ a = []
19
+ map = lambda do |n, i|
20
+ r = rand
21
+ sleep r if SLEEP
22
+ puts "+ #{r}"
23
+ a.push r
24
+ end
25
+ Parallel.map(1..SIZE, :finish => map) {}
26
+ a.reduce(:+)
27
+ end
28
+
29
+ def profile(label)
30
+ puts label
31
+ start = Time.now
32
+ result = yield
33
+ puts "= #{result}"
34
+ total = "%.2f" % ((Time.now - start) * 1000.0)
35
+ puts "Finished in #{total}ms"
36
+ end
37
+
38
+ ARGV.include?('-s') ?
39
+ profile('Sequential') { sequential } :
40
+ profile('Parallel') { parallel }
@@ -0,0 +1,8 @@
1
+ require 'active_support'
2
+ require 'active_support/core_ext'
3
+ require 'profanity_filter'
4
+
5
+ $: << File.expand_path(File.dirname(__FILE__) + '/../')
6
+ require 'bench/bench'
7
+
8
+ Bench.use(ProfanityFilter::Base)
data/bench/samples.yml ADDED
@@ -0,0 +1,4 @@
1
+ - Asshole motherfucker.
2
+ - This is a really tiny text.
3
+ - Profanity (also called bad language, swearing or cursing) is a subset of a language's lexicon that is considered by some to be strongly impolite or offensive. It can show a desecration or debasement of someone or something, or show strong or intense emotion. Profanity can take the form of words, expressions, gestures (such as flipping the middle finger), or other social behaviours that are construed or interpreted as insulting, rude, vulgar, obscene, obnoxious, foul, desecrating, or other forms. [1] Analyses of recorded conversations reveal that roughly 80–90 spoken words each day – 0.5% to 0.7% of all words – are swear words, with usage varying from between 0% to 3.4%. In comparison, first-person plural pronouns (we, us, our) make up 1% of spoken words.[2] A three-country poll conducted by Angus Reid Public Opinion in July 2010 found that Canadians swear more often than Americans and British when talking to friends, while Britons are more likely than Canadians and Americans to hear strangers swear during a conversation.[3] As blasphemy[edit source | editbeta] The term "profane" originates from classical Latin "profanus", literally "before (outside) the temple". It carried the meaning of either "desecrating what is holy" or "with a secular purpose" as early as the 1450s CE.[4] Profanity represented secular indifference to religion or religious figures, while blasphemy was a more offensive attack on religion and religious figures, considered sinful, and a direct violation of The Ten Commandments. Profanities in the original meaning of blasphemous profanity are part of the ancient tradition of the comic cults, which laughed and scoffed at the deity or deities.[5][6] An example from Gargantua and Pantagruel is "Christ, look ye, its Mere de ... merde ... shit, Mother of God."[7][8][9] Research into swearing[edit source | editbeta] Swearing performs certain social and psychological functions, and utilize particular linguistic and neurological mechanisms; all these are avenues of research. Functionally similar behavior can be observed in chimpanzees, and may contribute to our understanding, notes New York Times author Natalie Angier.[10] Angier also notes that swearing is a widespread but perhaps underappreciated anger management technique; that "men generally curse more than women, unless said women are in a sorority, and that university provosts swear more than librarians or the staff members of the university day care center"; and that linguistic research has shown that the physiological reactions of individuals who are proud of their education are similar between exposure to obscene words and exposure to bad grammar.[10] Profane language is by no means a recent phenomenon. The Bible sometimes uses strong language, such as mention of men who "eat their own dung, and drink their own piss" in the Authorized King James Version of 1611's close translation of Hebrew text of 2 Kings 18:27. Shakespeare is replete with vulgarisms, though many are no longer readily recognized. Even the oldest traces of human writing include swear words.[citation needed] Keele University researchers Stephens, Atkins, and Kingston found that swearing relieves the effects of physical pain.[11] Stephens said "I would advise people, if they hurt themselves, to swear".[12] However, the overuse of swear words tends to diminish this effect.[12] The team earned themselves the Ig Nobel Peace Prize in 2010 for the research. In English, swears and curse words tend to be more often Germanic than Latin in terms of etymology (linguistic origin). "Shit" has a Germanic lineage, as does "fuck".[13] The more technical alternatives are Latin in origin, such as "defecate" or "fornicate". A team of neurologists and psychologists at the UCLA Easton Center for Alzheimer's Disease Research suggested that swearing may help differentiate Alzheimer's disease from frontotemporal dementia.[14]
4
+ - Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum. It is a long established fact that a reader will be distracted by the readable content of a page when looking at its layout. The point of using Lorem Ipsum is that it has a more-or-less normal distribution of letters, as opposed to using 'Content here, content here', making it look like readable English. Many desktop publishing packages and web page editors now use Lorem Ipsum as their default model text, and a search for 'lorem ipsum' will uncover many web sites still in their infancy. Various versions have evolved over the years, sometimes by accident, sometimes on purpose (injected humour and the like). Contrary to popular belief, Lorem Ipsum is not simply random text. It has roots in a piece of classical Latin literature from 45 BC, making it over 2000 years old. Richard McClintock, a Latin professor at Hampden-Sydney College in Virginia, looked up one of the more obscure Latin words, consectetur, from a Lorem Ipsum passage, and going through the cites of the word in classical literature, discovered the undoubtable source. Lorem Ipsum comes from sections 1.10.32 and 1.10.33 of "de Finibus Bonorum et Malorum" (The Extremes of Good and Evil) by Cicero, written in 45 BC. This book is a treatise on the theory of ethics, very popular during the Renaissance. The first line of Lorem Ipsum, "Lorem ipsum dolor sit amet..", comes from a line in section 1.10.32. The standard chunk of Lorem Ipsum used since the 1500s is reproduced below for those interested. Sections 1.10.32 and 1.10.33 from "de Finibus Bonorum et Malorum" by Cicero are also reproduced in their exact original form, accompanied by English versions from the 1914 translation by H. Rackham. There are many variations of passages of Lorem Ipsum available, but the majority have suffered alteration in some form, by injected humour, or randomised words which don't look even slightly believable. If you are going to use a passage of Lorem Ipsum, you need to be sure there isn't anything embarrassing hidden in the middle of text. All the Lorem Ipsum generators on the Internet tend to repeat predefined chunks as necessary, making this the first true generator on the Internet. It uses a dictionary of over 200 Latin words, combined with a handful of model sentence structures, to generate Lorem Ipsum which looks reasonable. The generated Lorem Ipsum is therefore always free from repetition, injected humour, or non-characteristic words etc.