haiku_gadget 1.0.4 → 1.0.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/haiku_gadget/dictionary.rb +17 -2
- data/lib/haiku_gadget/version.rb +1 -1
- data/lib/words.yml +11 -9
- data/spec/haiku_gadget/haiku_gadget_spec.rb +18 -0
- data/test_haiku.rb +3 -0
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bfa1e32af2124a0410f4e05bb99b282db65ea886
|
4
|
+
data.tar.gz: 45e4b90a13b256686855d207ca78cd476014a10b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 19ceb10c6c502dbae34c9169e71f3ed034a1f416ed65c4026a6de3e17f35f7108d343785441cb913e368a6d47691ca577312a2fc847c19b72225c9be898877eb
|
7
|
+
data.tar.gz: 44e9f5fa36e64a72ec25229a0ff629c56d074534bcc1778f072506efcb37e5fd980390fb6db6b3479d11dcb068f4f41506d5cf73a58e488e54cb8a75712c6594
|
@@ -89,6 +89,23 @@ module HaikuGadget
|
|
89
89
|
out
|
90
90
|
end
|
91
91
|
|
92
|
+
def self.contains_word_anywhere?(word)
|
93
|
+
@@dict.each do |key, array|
|
94
|
+
return true if array.flatten.include? word
|
95
|
+
end
|
96
|
+
false
|
97
|
+
end
|
98
|
+
|
99
|
+
def self.contains_valid_data_types?
|
100
|
+
@@dict.each do |key, array|
|
101
|
+
array.flatten.each do |item|
|
102
|
+
puts "error: #{item} in #{key.to_s} is a #{item.class}" if item.class != String
|
103
|
+
return false unless item.is_a? String
|
104
|
+
end
|
105
|
+
end
|
106
|
+
true
|
107
|
+
end
|
108
|
+
|
92
109
|
# force load of dictionary from yaml file now
|
93
110
|
def self.load(path = DEFAULT_DICT_PATH)
|
94
111
|
dict = YAML.load_file(File.expand_path(path, File.dirname(__FILE__)))
|
@@ -97,8 +114,6 @@ module HaikuGadget
|
|
97
114
|
Dictionary.complete_plurality(dict, wt)
|
98
115
|
end
|
99
116
|
|
100
|
-
#ap dict
|
101
|
-
|
102
117
|
dict
|
103
118
|
end
|
104
119
|
|
data/lib/haiku_gadget/version.rb
CHANGED
data/lib/words.yml
CHANGED
@@ -1,10 +1,12 @@
|
|
1
1
|
---
|
2
|
+
# the word 'no' must be in quotes, otherwise it gets parsed as false
|
3
|
+
|
2
4
|
:transition_join: [
|
3
5
|
[so, and, or, plus, but, yet, while, when, if, then, thus, hence, now]
|
4
6
|
]
|
5
7
|
|
6
8
|
:determiner_common: [
|
7
|
-
[the, [no, some, your, my, his, her, its, their, our]]
|
9
|
+
[the, ['no', some, your, my, his, her, its, their, our]]
|
8
10
|
]
|
9
11
|
:determiner_singular: [
|
10
12
|
[a, [this, that]]
|
@@ -23,8 +25,8 @@
|
|
23
25
|
]
|
24
26
|
|
25
27
|
:adjective_common: [
|
26
|
-
[red, fresh, weird, burnt, white, flat, round, weak, old, new, young, swell, sweet, dazed, vague, warmed, cool, strong, blue, clear, soft, hard, black, big, small, tight, loose, long, short, wry, young, green, bold, good, bad, kind, mean, wet, dry, free, light, dark, dim, wise, grim, huge, worn, numb, wild, tall, short, hot, cold, sad, gray, green, gold, raw, rich, poor, bored, dull, calm, smart, dumb, grand, keen, bright, bent, foul, close, chrome, low, last, first, next, fun, high, late, quaint, top, lost, cute, real, strict, fast, slow, rough, damp, smooth, [north, west, south, east]],
|
27
|
-
[orange, mental, tired, gloomy, murky, salty, doomed, ecstatic, balanced, frayed, frosted, confused, opened, tasty, frozen, boiling, slimy, failed, crazed, oblong, broken, silver, faulty, limestone, opaque, silly, spinning, busted, lazy, flying, awesome, folded, rhythmic, floating, smoking, twisted, wispy, uncooked, complex, bubbly, immobile, bankrupt, moving, crispy, laundered, rounded,
|
28
|
+
[red, fresh, weird, burnt, white, flat, round, weak, old, new, young, swell, sweet, dazed, vague, warmed, cool, strong, blue, clear, soft, hard, black, big, small, tight, loose, long, short, wry, young, green, bold, good, bad, kind, mean, wet, dry, free, light, dark, dim, wise, grim, huge, worn, numb, wild, tall, short, hot, cold, sad, gray, green, gold, raw, rich, poor, bored, dull, calm, smart, dumb, grand, keen, bright, bent, foul, close, chrome, low, last, first, next, fun, high, late, quaint, top, lost, cute, real, strict, fast, slow, rough, damp, smooth, clean, great, [north, west, south, east]],
|
29
|
+
[orange, mental, tired, gloomy, murky, salty, doomed, ecstatic, balanced, frayed, frosted, confused, opened, tasty, frozen, boiling, slimy, failed, crazed, oblong, broken, silver, faulty, limestone, opaque, silly, spinning, busted, lazy, flying, awesome, folded, rhythmic, floating, smoking, twisted, wispy, uncooked, complex, bubbly, immobile, bankrupt, moving, crispy, laundered, rounded, ample, dirty, catered, constrained, cosmic, choking, ballistic, red-faced, bizarre, sanded, roasted, inverted, spastic, dapper, swanky, able, fabled, stable, leaning, correct, staggered, wrong, curved, open, evil, closed, edgy, pricey, costly, fancy, stranded, meager, modest, humble, slimy, simple, unkind, unwound, teenage, heavy, standard, hollow, eager, rotten, unwise, grounded, boring, crazy, major, minor, naive, valid, random, happy, endless, human, splendid, certain, somber, livid, lonely, jealous, dreary, lovely, cheerful, secure, renowned, spicy, drunken, bulky, breaded, better, shorter, smaller, larger, smarter, faster, longer, distant, wealthy, dismayed, vital, colored, abstract, vivid, ancient, bitter, sour, airy, timely, sunny, current, funky, skinny, bloody, girly, boyish, roomy, royal, marine, varied, fuzzy, helpful, crafty, silky, plastic, laser, upper, lower, cloudy, stronger, weaker, bigger, taller, greater, [northern, western, southern, eastern]],
|
28
30
|
[redundant, respected, uncovered, populous, required, unstable, communist, communal, religious, circular, feminine, masculine, incorrect, underwater, embarrassed, misshapen, glorious, hovering, uncaring, expanded, insulted, discovered, commissioned, considered, opulent, casual, ultimate, imminent, exacting, creative, furious, destructive, modulated, digital, analog, essential, albino, nuclear, atomic, chocolate, overweight, invalid, possible, advertised, natural, terrific, pot-bellied, amazing, confident, exacting, finished, primary, lunatic, satisfied, impressive, lunatic, noteworthy, suitable, musical, eternal, skydiving, expected, parallel],
|
29
31
|
[undulating, incredible, unforgiving, acceptable, elaborate, necessary, stimulated, measurable, recommended, mandatory, honorable, identical, overstated, altruistic, generated, extraneous, aluminum, obfuscated, appropriate, symbiotic, calculated, mysterious, unknowable, beautiful, contemplative, incapable, overbearing, high quality, low quality, microbial, questionable, knowledgeable, elemental, hilarious, inferior, meticulous]
|
30
32
|
]
|
@@ -38,26 +40,26 @@
|
|
38
40
|
]
|
39
41
|
|
40
42
|
:noun_common: [
|
41
|
-
[thing, bug, head, toe, eye, phone, web, ball, hand, ear, sheet, bed, car, truck, plane, brain, day, sun, square, bike, lake, creek, stone, moon, shoe, yacht, field, task, thought, sword, wig, boy, girl, prince, kid, pet, fig, moth, dog, bun, cat, bat, oar, lip, grain, soul, ape, duck, ray, beam, leg, rat, bear, boar, boat, door, goon, gob, plank, brick, stake, cube, ant, cord, bowl, chord, crate, wire, wreath, spear, isle, tree, wheel, hut, hat, gnat, spot, pond, cork, star, tribe, wine, beer, drink, film, bum, cup, rock, hook, path, king, queen, jack, mob, skill, job, house, cow, chair, disk, pit, hole, card, face, hill, mound, knob, zoo, light, fool, pill, quark, cloud, glove, sock, boot, slave, shrub, cook, pie, bird, snake, worm, tank, pen, weed, flute, nest, pot, bee, pan, gem, mom, dad, son, jeep, train, nun, pal, month, year, week, poem, shark, yak, joke, owl, skunk, worm, egg, cake, pea, grape, bean, spore, seed, fruit, wing, fire, world, heart, rod, board, nail, end, ring, sea, key, god, word, night, knight, bone, room, toy, side, top, book, name, game, ship, test, park, time, bag, school, clone, shop, store, war, whale, frog, trail],
|
43
|
+
[thing, bug, head, toe, eye, phone, web, ball, hand, ear, sheet, bed, car, truck, plane, brain, day, sun, square, bike, lake, creek, stone, moon, shoe, yacht, field, task, thought, sword, wig, boy, girl, prince, kid, pet, fig, moth, dog, bun, cat, bat, oar, lip, grain, soul, ape, duck, ray, beam, leg, rat, bear, boar, boat, door, goon, gob, plank, brick, stake, cube, ant, cord, bowl, chord, crate, wire, wreath, spear, isle, tree, wheel, hut, hat, gnat, spot, pond, cork, star, tribe, wine, beer, drink, film, bum, cup, rock, hook, path, king, queen, jack, mob, skill, job, house, cow, chair, disk, pit, hole, card, face, hill, mound, knob, zoo, light, fool, pill, quark, cloud, glove, sock, boot, slave, shrub, cook, pie, bird, snake, worm, tank, pen, weed, flute, nest, pot, bee, pan, gem, mom, dad, son, jeep, train, nun, pal, month, year, week, poem, shark, yak, joke, owl, skunk, worm, egg, cake, pea, grape, bean, spore, seed, fruit, wing, fire, world, heart, rod, board, nail, end, ring, sea, key, god, word, night, knight, bone, room, toy, side, top, book, name, game, ship, test, park, time, bag, school, clone, shop, store, war, whale, frog, trail, mind],
|
42
44
|
[zombie, ninja, pirate, monkey, robot, hot dog, space ship, rain drop, circle, tv, flower, typhoon, garden, cookie, taco, gyro, mountain, painting, river, meadow, island, message, morsel, marble, mitten, trombone, nugget, chicken, donkey, llama, hamster, raisin, nation, rocket, bottle, anvil, sunset, muskrat, treasure, coastline, building, lighthouse, concept, forest, python, dinner, hammer, robber, jacket, singer, puppet, valley, comet, scooter, joker, pebble, kayak, gorilla, airplane, table, atom, movie, poster, fountain, missile, pimple, player, shovel, window, rooster, biscuit, raven, eagle, question, vampire, peon, otter, camel, suburb, towel, turkey, pencil, planet, viking, squirrel, snowboard, dweller, lemon, photo, item, skillet, mother, father, brother, sister, elder, aardvark, apple, object, pickle, staple, wizard, raccoon, tadpole, spigot, daughter, mantra, pizza, calzone, vision, haiku, pixel, onion, glacier, penguin, cobra, dolphin, spider, trumpet, donut, ion, aura, geezer, freedom, attempt, pigeon, teacher, battle, laser, [sunday, monday, tuesday, wednesday, thursday, friday, saturday]],
|
43
45
|
[samurai, spatula, tornado, hurricane, restaurant, computer, radio, stereo, commuter, newspaper, hairdryer, photograph, sombrero, burrito, telephone, animal, bicycle, dinosaur, iguana, kangaroo, umbrella, hiking boot, dishwasher, asteroid, meteor, cruise liner, oil tanker, apple pie, gorilla, tricycle, artichoke, musician, visitor, universe, disaster, piano, canteloupe, pyramid, article, location, banana],
|
44
46
|
[fortune cookie, ecosystem, obligation, generator, generation, ambassador, elevator, watermelon, convertible, calculator, harmonica, operation, invitation, kindergarten, helicopter, alligator, caterpillar, constellation, germination, politician, corporation, advertisement, declaration, astronomer, variation, civilization, perimeter, population, denominator, semicircle, operator, aquarium, disappointment, kaleidoscope, television, orangutan, washing machine, environment]
|
45
47
|
]
|
46
48
|
:noun_singular: [
|
47
|
-
[fish, man, child, box, sky, beach, sheep, church, mouse, fox, goose, wish, life],
|
49
|
+
[fish, man, child, box, sky, beach, sheep, church, mouse, fox, goose, wish, life, foot],
|
48
50
|
[hobby, woman, baby, country, princess, person, hero, werewolf],
|
49
51
|
[enemy, remedy, nebula, library, factory, mosquito, buffalo, potato],
|
50
52
|
[bacteria, reality, discovery, super hero, territory, deficiency, activity, calamity, emergency]
|
51
53
|
]
|
52
54
|
:noun_plural: [
|
53
|
-
[fish, men, skies, sheep, mice, geese, lives],
|
55
|
+
[fish, men, skies, sheep, mice, geese, lives, feet],
|
54
56
|
[women, children, babies, countries, cities, boxes, cattle, people, grizzlies, heroes, foxes, beaches, churches, wishes, werewolves],
|
55
57
|
[enemies, hobbies, remedies, libraries, factories, potatoes, mosquitoes, buffaloes],
|
56
58
|
[bacteria, realities, discoveries, super heroes, territories, activities, calamities, emergencies]
|
57
59
|
]
|
58
60
|
|
59
61
|
:mass_noun_determiner: [
|
60
|
-
[the, [all, some, no], [your, my, his, her, our, their]]
|
62
|
+
[the, [all, some, 'no'], [your, my, his, her, our, their]]
|
61
63
|
]
|
62
64
|
|
63
65
|
:mass_noun: [
|
@@ -68,7 +70,7 @@
|
|
68
70
|
]
|
69
71
|
|
70
72
|
:verb_common: [
|
71
|
-
[bloom, drain, pat, climb, bend, give, take, pour, yank, clip, spread, build, shape, hate, throw, find, hear, see, smell, taste, eat, like, wake, tempt, smack, fold, farm, sip, lure, rip, rock, poke, warm, pull, grab, shove, pet, cut, get, bang, bust, bet, trick, lick, steal, boil, toast, dunk, gulp, meet, dig, form, roll, bathe, trap, treat, feed, hack, kick, heal, blast, lift, draw, cook, shake, bring, see, want, need, feel, love, hug, break, make, shock, paint, gain, kill, fund, hire, read, bake, own, rob, herd, rent, move, pay, jab, stop, start, turn, tear, fire, eye, scare, ask, win, make, ship, test, ride, clone, train, drive, know, buy, store, save, help],
|
73
|
+
[bloom, drain, pat, climb, bend, give, take, pour, yank, clip, spread, build, shape, hate, throw, find, hear, see, smell, taste, eat, like, wake, tempt, smack, fold, farm, sip, lure, rip, rock, poke, warm, pull, grab, shove, pet, cut, get, bang, bust, bet, trick, lick, steal, boil, toast, dunk, gulp, meet, dig, form, roll, bathe, trap, treat, feed, hack, kick, heal, blast, lift, draw, cook, shake, bring, see, want, need, feel, love, hug, break, make, shock, paint, gain, kill, fund, hire, read, bake, own, rob, herd, rent, move, pay, jab, stop, start, turn, tear, fire, eye, scare, ask, win, make, ship, test, ride, clone, train, drive, know, buy, store, save, help, clean],
|
72
74
|
[consume, destroy, attack, nurture, explore, open, construct, befriend, explain, target, retain, prevent, protest, direct, procure, locate, staple, strangle, topple, avoid, reveal, survey, maintain, fasten, harden, straighten, offer, transform, tickle, question, deceive, mislead, support, become, revive, connect, iron, annoy, forget, handle, answer, inspect, behold, design, acquire, obtain, believe, dazzle, honor, master, gather, savor, adjust, expect, create, instruct, afford, succeed, battle],
|
73
75
|
[imagine, examine, interrupt, activate, agitate, animate, apprehend, calibrate, captivate, celebrate, complicate, decimate, decipher, dishonor, dominate, enliven, generate, jettison, isolate, medicate, nominate, orient, overwhelm, recycle, terminate, violate, discover, calculate]
|
74
76
|
]
|
@@ -84,7 +86,7 @@
|
|
84
86
|
]
|
85
87
|
|
86
88
|
:verb_self_common: [
|
87
|
-
[wake, jump, speed, climb, live, hope, fail, float, fall, slow, creep, sleep, groan, moan, coast, suck, walk, run, wait, think, land, scream, crawl, play, smile, glow, wave, dream, yell, work, feel, nap, quake, whine, trek, learn, weep, sob, speak, hide, pose, laugh, bathe, burn, grow, shrink, feast, warn, stray, peek, creak, flow, come, feed, cope, heal, race, read, dig, dwell, move, pray, gawk, breed, sag, spit, stand, stop, swerve, eat, lust, shine, end, bleed, drop, open, shake, start, fart, tear, turn, sail, sing, ask, sin, point, ail, flail, fold, die, smell, groove, shout, lie, dine, win, write, train, drive, know, jive, hop, shop, paint, drink, bend, spread, sulk, wail, tire],
|
89
|
+
[wake, jump, speed, climb, live, hope, fail, float, fall, slow, creep, sleep, groan, moan, coast, suck, walk, run, wait, think, land, scream, crawl, play, smile, glow, wave, dream, yell, work, feel, nap, quake, whine, trek, learn, weep, sob, speak, hide, pose, laugh, bathe, burn, grow, shrink, feast, warn, stray, peek, creak, flow, come, feed, cope, heal, race, read, dig, dwell, move, pray, gawk, breed, sag, spit, stand, stop, swerve, eat, lust, shine, end, bleed, drop, open, shake, start, fart, tear, turn, sail, sing, ask, sin, point, ail, flail, fold, die, smell, groove, shout, lie, dine, win, write, train, drive, know, jive, hop, shop, paint, drink, bend, spread, sulk, wail, tire, clean],
|
88
90
|
[survive, ponder, wonder, travel, transform, falter, wallow, improve, believe, boogie, crumble, giggle, complain, forget, persist, explore, exist, arrive, await, agree, connect, engage, haggle, return, rotate, resist, dabble, murmur, mature, protest, gossip, growl, begin, approve, clamber, attack, perform, abide, achieve, succeed, explode, constrict, topple, dazzle, question],
|
89
91
|
[concentrate, speculate, hesitate, meditate, calculate, celebrate, co-exist, consider, continue, deviate, disagree, disbelieve, disconnect, elevate, imagine, meander, navigate, overact, postulate, propagate, radiate, recover, replicate, duplicate, surrender, terminate, understand, undulate, hibernate, self-destruct]
|
90
92
|
]
|
@@ -49,6 +49,24 @@ module HaikuGadget
|
|
49
49
|
end
|
50
50
|
end
|
51
51
|
|
52
|
+
it 'should contain some random expected words' do
|
53
|
+
|
54
|
+
%w(banana advise the sadly moon red my).each do |word|
|
55
|
+
|
56
|
+
expect(Dictionary.contains_word_anywhere? word).to eq true
|
57
|
+
|
58
|
+
end
|
59
|
+
|
60
|
+
end
|
61
|
+
|
62
|
+
# this test ensures that no words are being parsed as data types other than String,
|
63
|
+
# for example, the word 'no' gets parsed as false and needs to be in quotes in the YAML file
|
64
|
+
it 'should contain only string data types (inside arrays)' do
|
65
|
+
|
66
|
+
expect(Dictionary.contains_valid_data_types?).to eq true
|
67
|
+
|
68
|
+
end
|
69
|
+
|
52
70
|
end
|
53
71
|
|
54
72
|
describe 'with single possibility test dictionary' do
|
data/test_haiku.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# test functionality from the command line
|
2
|
+
|
1
3
|
require File.expand_path('lib/haiku_gadget.rb', File.dirname(__FILE__))
|
2
4
|
|
3
5
|
puts HaikuGadget.haiku "\n"
|
@@ -8,3 +10,4 @@ require File.expand_path('lib/haiku_gadget.rb', File.dirname(__FILE__))
|
|
8
10
|
puts HaikuGadget.middle_line
|
9
11
|
puts HaikuGadget.bottom_line
|
10
12
|
|
13
|
+
|