Showing posts with label exercises. Show all posts
Showing posts with label exercises. Show all posts

Thursday, 20 December 2007

paperwork and tagsoup

paperwork

This morning, I got a ping from Human Resources, asking me very politely if I could please fill out the payroll paperwork they gave me to do before I arrived in the UK. Oops! I hate being one of those people you have to chase. I've just been doing dossier the whole time and shutting out everything else. I'm generally bad at getting this stuff under control (hence the interest of GTD). My one weak point is still that I never review my lists... Now. Good thing is that I have a legitimate excuse. Bank account still not open. So, even if I had filled out the paperwork, I would still be waiting for that to go through. That's what I ended up doing this morning, besides corresponding with people back home about GenI and old machines, etc.

GH is sending me my vertical keyboard. Yay!

start corpora acquisition

My thinking last night was that it's not use trying to build content representations when I don't even know what content I'm trying to represent. So, I think the two things I should pursue now are (A) building the PRODIGY corpora and (b) getting CRU grammars for English [that's a scary one, that]. Spent a good chunk of the afternoon just visiting recipe sites. Kinda neat. Discovered a book from the 1700s with lots of "soop" recipes. Going to focus on cakes; get lots of cake recipes, nice and controlled.

As a first step, I eventually decided to see if I could import recipes from the Woman's Institute Library of Cookery, just to sort of step into the bath. At first I was going to write this in HaXML. But then I remembered reading an article about TagSoup. Thought I would give it a whirl. Project Gutenberg texts seem to be very well behaved, so it's not because of any potential soupiness of the file that I wanted to use it. Rather, my main motivation is that I did not really have a good idea how the file was structured, that is how the author structured it when it was first written and what tags the transcribers assigned to that structure. I didn't want to think very hard, just sort of hack and explore. The impression I got from the tutorial was that TagSoup allowed you to do exactly this sort of quick and dirty hacking, the kind of thing people like to use Perl for.

It was a success! In 80 lines of code or so, I was able to extract 76 cake recipes from this book. Thanks, Neil!

The key feature here is that I was able to start out with something like a dumb one-liner and slowly grow my Haskell script as I better understood the cookbook, exploratory coding in other words. Furthermore, I didn't really have much of an API to wade through, or any articles to read, or deep concepts to learn. Learning deep concepts is great (ok, combinators don't look so deep anymore, but back then...) because it's useful in the long term. But sometimes, you just want to roll up your sleeves and get hacking. I can't stress this enough: the key feature of this library is quick-startiness. If you just want to parse some HTML and not hurt your brain, give TagSoup a try! (*)

(*) Or other libraries like it. Google tells me that the Tag Soup idea has been around for quite some time.

Note to Future-Eric: This would make a great exercise. Start small and point out little extra requirements here and there.

DROP DOUGHNUTS


(Sufficient for 2 Dozen Doughnuts)


2 c. flour
3 tsp. baking powder
1/2 tsp. salt
1/4 tsp. nutmeg
1/4 tsp. cinnamon
1/2 c. sugar
1 egg
1/2 c. milk
1 Tb. melted fat


Mix and sift the dry ingredients. Beat the egg, add the milk to it, and
pour the liquid into the dry ingredients. Add the melted fat. Drop by
teaspoonfuls into hot fat and fry the same as for doughnuts.