Saturday, October 5, 2013

Saturday: Sometimes I can't not do something

First, though, the Saturday pictures.  There was sushi:
Standard unagi. 
I tried the tempura banana as well.  Not bad, although it's a bit too much for one sitting.
Then I went to look at books, and to see if I wanted to get a Nook HD, since they're rather cheap now.  It looks decent, but it doesn't have a standard usb charger/input thing.  That's a bit of a problem, as I don't really care to travel around with 99 chargers.  I'll keep looking, I think.  I also discovered that there's a Martin Gardner biography, which I picked up.  Thank you, B&N, for indexing math biographies in the math section, instead of the biography section.
They also had the Epic Gassy Jake on sale.  I did not buy that.
Now back to the thing that once I imagined, I couldn't not make.  EGJ reminded me of Adventure Time, and the AT Mad Libs book I got in Texas.  I tried to find another one of those to add to the pile of games and things I've left there, but was unsuccessful.  This led to me thinking about what Mad Libs really is.  Basically, you take a paragraph, extract out random words, replace them with a set of links to a list of parts of speech.  This means you can probably automate their construction.

Now, wikipedia has basically an infinite supply of paragraphs, and the first paragraph of wikipedia stories tend to be reasonably self-contained and short.  So, if you grab the first paragraph for a keyword, you have a reasonable source.  Next, you can randomly choose words from that paragraph, but you still need to figure out what part of speech they are.  One option would be to attempt to write a parser to identify the part of speech from context.  The only problem with that is that it's kind of super hard, and a lot more work than is probably necessary.  This is doubly true when you remember that wikipedia has a dictionary as well, and those pages have an easily parseable part of speech values in the contents box.

So, dance things around, do some stop-word exclusion, filter out things that get in the way, and blammo: perl script generated mad libs:

A puppy is a juvenile dog. Some puppies can weigh 1–3lb , while larger ones 
can weigh up to 15–23lb . All healthy puppies grow quickly after birth. A 
puppy's coat color may change as the puppy grows older, as is commonly seen in 
breeds such as the Yorkshire Terrier. In vernacular English, puppy refers 
specifically to dogs while pup may often be used for other mammals such as 
seals, giraffes, guinea pigs, or even rats. 
      Noun    [0]: ____________________________________________
 Adjective    [1]: ____________________________________________
      Noun    [2]: ____________________________________________
      Verb    [3]: ____________________________________________
      Noun    [4]: ____________________________________________
    Adverb    [5]: ____________________________________________
 Adjective    [6]: ____________________________________________
      Verb    [7]: ____________________________________________
    Adverb    [8]: ____________________________________________
      Noun    [9]: ____________________________________________
      Noun   [10]: ____________________________________________
      Noun   [11]: ____________________________________________
      Noun   [12]: ____________________________________________
A [Noun 0] is a [Adjective 1] [Noun 2] Some puppies can [Verb 3] 1–3lb , 
while larger [Noun 4] can weigh [Adverb 5] to 15–23lb . All [Adjective 6] 
puppies [Verb 7] [Adverb 8] after [Noun 9] A puppy's [Noun 10] [Noun 11] may 
[Noun 12] as the puppy grows older, as is commonly seen in breeds such as the 
Yorkshire Terrier. In vernacular English, puppy refers specifically to dogs 
while pup may often be used for other mammals such as seals, giraffes, guinea 
pigs, or even rats. 

You can see that there are still two problems.  First, due to the way I do the replacement, all the madlib words fall in the front of the text.  I need to do some sort of counting for multiple words, and randomly select which instance is replaced.  The other issue (that doesn't actually show up here) is that madlib word "k" can occur before word "k-1".  This is really just an annoyance, but it probably should be fixed as well.

  • Animal gifs.
  • Pokemon.
    • I'm sorry.  I was ok with these mega evolutions, and I really like Charizard (although Mega Charizard X looks dumb), but MewTwo is supposed to be basically invincible.  I don't like this.
    • Nor this.  Pokemon doesn't need some sort of harsh gritty reality.  If it did, you'd have to start wondering how much Jesse and James pay in doctor bills.
  • Doctor Bills.
    • This is why this shit is important.
    • "He had heard of the online marketplace for insurance that opened on Oct. 1 under the Affordable Care Act. “I just don’t trust it,” said Mr. Tripcony, who has an equal distrust of President Obama. “I don’t like him, and I don’t feel comfortable with anything he’s got to do with.” Mr. Tripcony said he had a better idea for a system to provide health care at a fair price. “I think it should be the same for everybody,” he said. “One big company, whether owned by the government or private.” Informed that he had described the single-payer system that Mr. Obama abandoned when Republican critics called it socialized medicine, he said, “Yeah, I know, it’s crazy.”" You're a fuckhead, Mr. Tripcony.  You're basically the reason we can't have nice things.  "I don't like this guy, even though he's trying to help me, and I'm going to continue to not like him and what he does.  Moreso, my solution to the problem is actually the kind of thing I rail against due to my own ignorance."

No comments:

Post a Comment