politician_salad 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: d17b71def9914ff3da63504de48596969157f788
4
+ data.tar.gz: 30bfdbd897b07c987ebebcbe4718bc790998f1ef
5
+ SHA512:
6
+ metadata.gz: 5c5c410c921bf196d103238d14550da4eb7882fd7089bf352d1e0408523ed4339930c25aa569fdbef3064dcdb00cc966f44d2ea6496f79c85d9dea103eec2cc3
7
+ data.tar.gz: bb7ea40eb60727042f7bb763ae287ef38ae41a74b08d21e51f2d505d86a8f2084f409c0b65837583c938c67215026cd61a9de08f804b71eebcf465738a419942
@@ -0,0 +1,9 @@
1
+ require_relative './base.rb'
2
+
3
+ module PoliticianSalad
4
+ class BarackObama < PoliticianSalad::Base
5
+ def self.source_filename
6
+ './lib/obama.txt'
7
+ end
8
+ end
9
+ end
data/lib/base.rb ADDED
@@ -0,0 +1,26 @@
1
+ require 'marky_markov'
2
+
3
+ module PoliticianSalad
4
+ class Base
5
+ def self.sentence(n_sentences = 1)
6
+ markov_chain.generate_n_sentences(n_sentences).capitalize
7
+ end
8
+
9
+ def self.sentences(n_sentences = 1)
10
+ markov_chain.generate_n_sentences(n_sentences).split(". ").map do |sentence|
11
+ sentence.capitalize.strip
12
+ end
13
+ end
14
+
15
+ def self.word(n_words = 5)
16
+ markov_chain.generate_n_words(n_words)
17
+ end
18
+
19
+ def self.markov_chain
20
+ markov = MarkyMarkov::TemporaryDictionary.new
21
+ markov.parse_file self.source_filename
22
+
23
+ markov
24
+ end
25
+ end
26
+ end
@@ -0,0 +1,9 @@
1
+ require_relative './base.rb'
2
+
3
+ module PoliticianSalad
4
+ class DonaldTrump < PoliticianSalad::Base
5
+ def self.source_filename
6
+ './lib/trump.txt'
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,9 @@
1
+ require_relative './base.rb'
2
+
3
+ module PoliticianSalad
4
+ class HillaryClinton < PoliticianSalad::Base
5
+ def self.source_filename
6
+ './lib/hillary.txt'
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,4 @@
1
+ require 'base'
2
+ require 'donald_trump'
3
+ require 'barack_obama'
4
+ require 'hillary_clinton'
metadata ADDED
@@ -0,0 +1,50 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: politician_salad
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Ricardo Fleury
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2016-09-15 00:00:00.000000000 Z
12
+ dependencies: []
13
+ description: Fake sentences and words from your favorite (or most despised) politician's
14
+ speeches using a Markov chain implementation in Ruby
15
+ email: rfleury2@gmail.com
16
+ executables: []
17
+ extensions: []
18
+ extra_rdoc_files: []
19
+ files:
20
+ - lib/barack_obama.rb
21
+ - lib/base.rb
22
+ - lib/donald_trump.rb
23
+ - lib/hillary_clinton.rb
24
+ - lib/politician_salad.rb
25
+ homepage: http://rubygems.org/gems/politician_salad
26
+ licenses:
27
+ - MIT
28
+ metadata: {}
29
+ post_install_message:
30
+ rdoc_options: []
31
+ require_paths:
32
+ - lib
33
+ required_ruby_version: !ruby/object:Gem::Requirement
34
+ requirements:
35
+ - - ">="
36
+ - !ruby/object:Gem::Version
37
+ version: '0'
38
+ required_rubygems_version: !ruby/object:Gem::Requirement
39
+ requirements:
40
+ - - ">="
41
+ - !ruby/object:Gem::Version
42
+ version: '0'
43
+ requirements: []
44
+ rubyforge_project:
45
+ rubygems_version: 2.4.6
46
+ signing_key:
47
+ specification_version: 4
48
+ summary: Fake sentences and words from your favorite (or most despised) politician's
49
+ speeches
50
+ test_files: []