girls_just_want_to_have_puns 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: d60aecd293699a7463802d39e103e2cce632a58d
4
+ data.tar.gz: f7e7819389b99f00e75c371acbec7fe324c3215f
5
+ SHA512:
6
+ metadata.gz: 506c2f1ddc7fcd820081bc48400c0d3aa07ec906849bac80ba99aefad1169b94aac5c2d85bf3b0ab273b5628c00d1ab7816adcaf8124865d3ed700ead4aabab1
7
+ data.tar.gz: 7ce4d7300f488f9936943de0ec7c43b0335e49bd449177ab4d09f9542ec2f65af9da10b1a775e20786edc77b61d6fb434c40d6efbe75772a252897a6f2f4104a
@@ -0,0 +1,17 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ Gemfile.lock
7
+ InstalledFiles
8
+ _yardoc
9
+ coverage
10
+ doc/
11
+ lib/bundler/man
12
+ pkg
13
+ rdoc
14
+ spec/reports
15
+ test/tmp
16
+ test/version_tmp
17
+ tmp
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in girls_just_want_to_have_puns.gemspec
4
+ gemspec
data/LICENSE ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2012 Ian C. Anderson
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,29 @@
1
+ # GirlsJustWantToHavePuns
2
+
3
+ TODO: Write a gem description
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ gem 'girls_just_want_to_have_puns'
10
+
11
+ And then execute:
12
+
13
+ $ bundle
14
+
15
+ Or install it yourself as:
16
+
17
+ $ gem install girls_just_want_to_have_puns
18
+
19
+ ## Usage
20
+
21
+ TODO: Write usage instructions here
22
+
23
+ ## Contributing
24
+
25
+ 1. Fork it
26
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
27
+ 3. Commit your changes (`git commit -am 'Added some feature'`)
28
+ 4. Push to the branch (`git push origin my-new-feature`)
29
+ 5. Create new Pull Request
@@ -0,0 +1,13 @@
1
+ #!/usr/bin/env rake
2
+ require "rubygems"
3
+ require "bundler/setup"
4
+ require "bundler/gem_tasks"
5
+ require "girls_just_want_to_have_puns"
6
+
7
+ namespace :phrases do
8
+
9
+ task :refresh do
10
+ GirlsJustWantToHavePuns::PhraseService.refresh_sources
11
+ end
12
+
13
+ end
@@ -0,0 +1,20 @@
1
+ # -*- encoding: utf-8 -*-
2
+ require File.expand_path('../lib/girls_just_want_to_have_puns/version', __FILE__)
3
+
4
+ Gem::Specification.new do |gem|
5
+ gem.authors = ["Ian C. Anderson"]
6
+ gem.email = ["anderson.ian.c@gmail.com"]
7
+ gem.description = %q{Generate puns by incorporating a keyword into a phrase.}
8
+ gem.summary = %q{Generate puns by incorporating a keyword into a phrase.}
9
+ gem.homepage = ""
10
+
11
+ gem.files = `git ls-files`.split($\)
12
+ gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
13
+ gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
14
+ gem.name = "girls_just_want_to_have_puns"
15
+ gem.require_paths = ["lib"]
16
+ gem.version = GirlsJustWantToHavePuns::VERSION
17
+ gem.add_dependency('nokogiri', '>= 1.5.5')
18
+ gem.add_development_dependency('rake')
19
+ gem.add_development_dependency('rspec')
20
+ end
@@ -0,0 +1,14 @@
1
+ require "girls_just_want_to_have_puns/version"
2
+ require "girls_just_want_to_have_puns/pun_generator"
3
+
4
+ module GirlsJustWantToHavePuns
5
+
6
+ def self.pun(keyword, options = {})
7
+ PunGenerator.new(keyword, options).pun
8
+ end
9
+
10
+ def self.puns(keyword, options = {})
11
+ PunGenerator.new(keyword, options).puns
12
+ end
13
+
14
+ end
@@ -0,0 +1,10 @@
1
+ class Phrase
2
+
3
+ attr_reader :category, :text
4
+
5
+ def initialize(category, text)
6
+ @category = category
7
+ @text = text
8
+ end
9
+
10
+ end
@@ -0,0 +1,25 @@
1
+ require 'girls_just_want_to_have_puns/phrase_sources/wikipedia_beatles_songs_phrase_source'
2
+ require 'girls_just_want_to_have_puns/phrase_sources/wikipedia_idioms_phrase_source'
3
+ require 'girls_just_want_to_have_puns/phrase_sources/wikipedia_oscar_winning_films_phrase_source'
4
+
5
+ module GirlsJustWantToHavePuns
6
+ class PhraseService
7
+
8
+ def phrases
9
+ self.class.sources.flat_map(&:phrases)
10
+ end
11
+
12
+ def self.refresh_sources
13
+ sources.each(&:refresh)
14
+ end
15
+
16
+ def self.sources
17
+ [
18
+ WikipediaIdiomsPhraseSource,
19
+ WikipediaBeatlesSongsPhraseSource,
20
+ WikipediaOscarWinningFilmsPhraseSource
21
+ ]
22
+ end
23
+
24
+ end
25
+ end
@@ -0,0 +1,19 @@
1
+ require 'girls_just_want_to_have_puns/phrase'
2
+
3
+ module GirlsJustWantToHavePuns
4
+
5
+ class PhraseSource
6
+
7
+ def self.phrases
8
+ @phrases ||= File.readlines(cache_filepath).map(&:chomp).map do |phrase|
9
+ Phrase.new(friendly_name, phrase)
10
+ end
11
+ end
12
+
13
+ def self.phrase_directory
14
+ 'phrases'
15
+ end
16
+
17
+ end
18
+
19
+ end
@@ -0,0 +1,32 @@
1
+ require 'nokogiri'
2
+ require 'open-uri'
3
+
4
+ require 'girls_just_want_to_have_puns/phrase_sources/phrase_source'
5
+
6
+ module GirlsJustWantToHavePuns
7
+ class WikipediaBeatlesSongsPhraseSource < PhraseSource
8
+
9
+ def self.refresh
10
+ doc = Nokogiri::HTML(open('http://en.wikipedia.org/wiki/List_of_songs_recorded_by_the_Beatles'))
11
+
12
+ songs = doc.css('#mw-content-text table.wikitable tr td:first-child a').map do |song|
13
+ song.content
14
+ end
15
+
16
+ Dir.mkdir(phrase_directory) unless Dir.exists? phrase_directory
17
+ File.open(cache_filepath, 'w') do |phrases_file|
18
+ phrases_file.write(songs.join("\n")) if songs.any?
19
+ end
20
+ end
21
+
22
+ def self.cache_filepath
23
+ File.expand_path(File.join(File.dirname(__FILE__), "../", phrase_directory, "beatles_songs.txt"))
24
+ end
25
+
26
+ def self.friendly_name
27
+ 'Beatles songs'
28
+ end
29
+
30
+ end
31
+ end
32
+
@@ -0,0 +1,31 @@
1
+ require 'nokogiri'
2
+ require 'open-uri'
3
+
4
+ require 'girls_just_want_to_have_puns/phrase_sources/phrase_source'
5
+
6
+ module GirlsJustWantToHavePuns
7
+ class WikipediaIdiomsPhraseSource < PhraseSource
8
+
9
+ def self.refresh
10
+ doc = Nokogiri::HTML(open('http://en.wiktionary.org/wiki/Appendix:English_idioms'))
11
+
12
+ idioms = doc.css('#mw-content-text div div table tr td ul li a').map do |idiom|
13
+ idiom.content
14
+ end
15
+
16
+ Dir.mkdir(phrase_directory) unless Dir.exists? phrase_directory
17
+ File.open(cache_filepath, 'w') do |phrases_file|
18
+ phrases_file.write(idioms.join("\n")) if idioms.any?
19
+ end
20
+ end
21
+
22
+ def self.cache_filepath
23
+ File.expand_path(File.join(File.dirname(__FILE__), "../", phrase_directory, "wikipedia_idioms.txt"))
24
+ end
25
+
26
+ def self.friendly_name
27
+ 'English idioms'
28
+ end
29
+
30
+ end
31
+ end
@@ -0,0 +1,32 @@
1
+ require 'nokogiri'
2
+ require 'open-uri'
3
+
4
+ require 'girls_just_want_to_have_puns/phrase_sources/phrase_source'
5
+
6
+ module GirlsJustWantToHavePuns
7
+ class WikipediaOscarWinningFilmsPhraseSource < PhraseSource
8
+
9
+ def self.refresh
10
+ doc = Nokogiri::HTML(open('http://en.wikipedia.org/wiki/List_of_Academy_Award-winning_films'))
11
+
12
+ songs = doc.css('#mw-content-text table.wikitable tr td:first-child a').map do |song|
13
+ song.content
14
+ end
15
+
16
+ Dir.mkdir(phrase_directory) unless Dir.exists? phrase_directory
17
+ File.open(cache_filepath, 'w') do |phrases_file|
18
+ phrases_file.write(songs.join("\n")) if songs.any?
19
+ end
20
+ end
21
+
22
+ def self.cache_filepath
23
+ File.expand_path(File.join(File.dirname(__FILE__), "../", phrase_directory, "oscar_winning_movies.txt"))
24
+ end
25
+
26
+ def self.friendly_name
27
+ 'Oscar-winning movies'
28
+ end
29
+
30
+ end
31
+ end
32
+
@@ -0,0 +1,297 @@
1
+ 12-Bar Original
2
+ Across the Universe
3
+ Act Naturally
4
+ Ain't She Sweet
5
+ All I've Got to Do
6
+ All My Loving
7
+ All Things Must Pass
8
+ All Together Now
9
+ All You Need Is Love
10
+ And I Love Her
11
+ And Your Bird Can Sing
12
+ Anna (Go to Him)
13
+ Another Girl
14
+ Any Time at All
15
+ Ask Me Why
16
+ Baby It's You
17
+ Baby, You're a Rich Man
18
+ Baby's in Black
19
+ Back in the U.S.S.R.
20
+ Bad Boy
21
+ Bad to Me
22
+ The Ballad of John and Yoko
23
+ Beautiful Dreamer
24
+ Because
25
+ Being for the Benefit of Mr. Kite!
26
+ Bésame Mucho
27
+ Birthday
28
+ Blackbird
29
+ Blue Jay Way
30
+ Boys
31
+ Can't Buy Me Love
32
+ Carnival of Light
33
+ Carol
34
+ Carry That Weight
35
+ Cayenne
36
+ Chains
37
+ Child of Nature
38
+ Christmas Time (Is Here Again)
39
+ Circles
40
+ Clarabella
41
+ Come and Get It
42
+ Come Together
43
+ The Continuing Story of Bungalow Bill
44
+ Cry Baby Cry
45
+ Cry for a Shadow
46
+ Crying, Waiting, Hoping
47
+ A Day in the Life
48
+ Day Tripper
49
+ Dear Prudence
50
+ Devil in Her Heart
51
+ Dig a Pony
52
+ Dig It
53
+ Dizzy, Miss Lizzy
54
+ Do You Want to Know a Secret
55
+ Doctor Robert
56
+ Don't Bother Me
57
+ Don't Ever Change
58
+ Don't Let Me Down
59
+ Don't Pass Me By
60
+ Drive My Car
61
+ Eight Days a Week
62
+ Eleanor Rigby
63
+ The End
64
+ Every Little Thing
65
+ Everybody's Got Something to Hide Except Me and My Monkey
66
+ Everybody's Trying to Be My Baby
67
+ Fixing a Hole
68
+ Flying
69
+ The Fool on the Hill
70
+ For No One
71
+ For You Blue
72
+ Free as a Bird
73
+ From Me to You
74
+ From Us to You
75
+ Get Back
76
+ Getting Better
77
+ Girl
78
+ Glad All Over
79
+ Glass Onion
80
+ Golden Slumbers
81
+ Good Day Sunshine
82
+ Good Morning, Good Morning
83
+ Good Night
84
+ Got to Get You into My Life
85
+ Hallelujah, I Love Her So
86
+ Happiness Is a Warm Gun
87
+ A Hard Day's Night
88
+ Heather
89
+ Hello, Goodbye
90
+ Hello Little Girl
91
+ Help!
92
+ Helter Skelter
93
+ Her Majesty
94
+ Here Comes the Sun
95
+ Here, There and Everywhere
96
+ Hey Bulldog
97
+ Hey Jude
98
+ Hippy Hippy Shake
99
+ Hold Me Tight
100
+ Honey Don't
101
+ Honey Pie
102
+ How Do You Do It?
103
+ I Am the Walrus
104
+ I Call Your Name
105
+ I Don't Want to Spoil the Party
106
+ I Feel Fine
107
+ I Forgot to Remember to Forget
108
+ I Got a Woman
109
+ I Got to Find My Baby
110
+ I Lost My Little Girl
111
+ I Me Mine
112
+ I Need You
113
+ I Saw Her Standing There
114
+ I Should Have Known Better
115
+ I Wanna Be Your Man
116
+ I Want to Hold Your Hand
117
+ I Want to Tell You
118
+ I Want You (She's So Heavy)
119
+ I Will
120
+ If I Fell
121
+ If I Needed Someone
122
+ If You've Got Trouble
123
+ I'll Be Back
124
+ I'll Be on My Way
125
+ I'll Cry Instead
126
+ I'll Follow the Sun
127
+ I'll Get You
128
+ I'll Keep You Satisfied
129
+ I'm a Loser
130
+ I'm Down
131
+ I'm Gonna Sit Right Down and Cry (Over You)
132
+ I'm Happy Just to Dance with You
133
+ I'm In Love
134
+ I'm Looking Through You
135
+ I'm Only Sleeping
136
+ I'm So Tired
137
+ I'm Talking About You
138
+ In My Life
139
+ In Spite of All the Danger
140
+ The Inner Light
141
+ It Won't Be Long
142
+ It's All Too Much
143
+ It's Only Love
144
+ I've Got a Feeling
145
+ I've Just Seen a Face
146
+ Johnny B. Goode
147
+ Julia
148
+ Junk
149
+ Kansas City
150
+ Hey, Hey, Hey, Hey
151
+ Keep Your Hands Off My Baby
152
+ Komm Gib Mir Deine Hand
153
+ Lady Madonna
154
+ Leave My Kitten Alone
155
+ Lend Me Your Comb
156
+ Let It Be
157
+ Like Dreamers Do
158
+ Little Child
159
+ Lonesome Tears in My Eyes
160
+ The Long and Winding Road
161
+ Long, Long, Long
162
+ Long Tall Sally
163
+ Love Me Do
164
+ Love of the Loved
165
+ Love You To
166
+ Lovely Rita
167
+ Lucille
168
+ Lucy in the Sky with Diamonds
169
+ Madman
170
+ Maggie Mae
171
+ Magical Mystery Tour
172
+ Martha My Dear
173
+ Matchbox
174
+ Maxwell's Silver Hammer
175
+ Mean Mr. Mustard
176
+ Memphis, Tennessee
177
+ Michelle
178
+ Misery
179
+ Money (That's What I Want)
180
+ Moonlight Bay
181
+ Mother Nature's Son
182
+ Mr. Moonlight
183
+ My Bonnie
184
+ The Night Before
185
+ No Reply
186
+ Norwegian Wood (This Bird Has Flown)
187
+ Not a Second Time
188
+ Not Guilty
189
+ Nothin' Shakin' (But the Leaves on the Trees)
190
+ Nowhere Man
191
+ Ob-La-Di, Ob-La-Da
192
+ Octopus's Garden
193
+ Oh! Darling
194
+ Old Brown Shoe
195
+ One After 909
196
+ Only a Northern Song
197
+ Paperback Writer
198
+ Penny Lane
199
+ Piggies
200
+ Please Mr. Postman
201
+ Please Please Me
202
+ Polythene Pam
203
+ P.S. I Love You
204
+ Rain
205
+ Real Love
206
+ Revolution
207
+ Revolution 1
208
+ Revolution 9
209
+ Rip It Up
210
+ Shake, Rattle, and Roll
211
+ Blue Suede Shoes
212
+ Rock and Roll Music
213
+ Rocky Raccoon
214
+ Roll Over Beethoven
215
+ Run for Your Life
216
+ The Saints
217
+ Savoy Truffle
218
+ Searchin'
219
+ September in the Rain
220
+ Sexy Sadie
221
+ Sgt. Pepper's Lonely Hearts Club Band
222
+ Sgt. Pepper's Lonely Hearts Club Band (Reprise)
223
+ She Came in Through the Bathroom Window
224
+ She Loves You
225
+ She Said She Said
226
+ She's a Woman
227
+ She's Leaving Home
228
+ The Sheik of Araby
229
+ A Shot of Rhythm and Blues
230
+ Shout
231
+ Sie Liebt Dich
232
+ Slow Down
233
+ Soldier of Love (Lay Down Your Arms)
234
+ Some Other Guy
235
+ Something
236
+ Sour Milk Sea
237
+ Step Inside Love/Los Paranoias
238
+ Strawberry Fields Forever
239
+ Sun King
240
+ Sure to Fall (In Love with You)
241
+ Sweet Little Sixteen
242
+ Take Good Care of My Baby
243
+ Taking a Trip to Carolina
244
+ A Taste of Honey
245
+ Taxman
246
+ Teddy Boy
247
+ Tell Me What You See
248
+ Tell Me Why
249
+ Thank You Girl
250
+ That Means a Lot
251
+ That'll Be the Day
252
+ That's All Right (Mama)
253
+ There's a Place
254
+ Things We Said Today
255
+ Think for Yourself
256
+ This Boy
257
+ Three Cool Cats
258
+ Ticket to Ride
259
+ Till There Was You
260
+ Tip of My Tongue
261
+ To Know Her is to Love Her
262
+ Tomorrow Never Knows
263
+ Too Much Monkey Business
264
+ Twist and Shout
265
+ Two of Us
266
+ Wait
267
+ Watching Rainbows
268
+ We Can Work It Out
269
+ What Goes On
270
+ What You're Doing
271
+ What's The New Mary Jane
272
+ When I Get Home
273
+ When I'm Sixty-Four
274
+ While My Guitar Gently Weeps
275
+ Why Don't We Do It in the Road?
276
+ Wild Honey Pie
277
+ With a Little Help from My Friends
278
+ Within You Without You
279
+ Woman
280
+ The Word
281
+ Words of Love
282
+ Yellow Submarine
283
+ Yer Blues
284
+ Yes It Is
285
+ Yesterday
286
+ You Can't Do That
287
+ You Know My Name (Look Up the Number)
288
+ You Know What to Do
289
+ You Like Me Too Much
290
+ You Never Give Me Your Money
291
+ You Won't See Me
292
+ You'll Be Mine
293
+ Young Blood
294
+ Your Mother Should Know
295
+ You're Going to Lose That Girl
296
+ You've Got to Hide Your Love Away
297
+ You've Really Got a Hold on Me