Friday, November 28, 2008

Context Free Grammars

I find the entire concept interesting to say the least. There is actually a set of rules for a language that can denote a sandwich. I plan to head to subway with a large index card printed with rules on the front and point to it as I order. But the guy behind the counter could create some kind of infinite sandwich which will end up costing me a pretty penny.

Anyways, I did notice that the example with "a mat beside the dog and a cat saw the mat" was... was close enough to a perfect sentence. BUT, It does get really close to that lolspeak crap that everyone on the internet uses these days.

A simple example: Internets, Intarnets, Interweb, Intarweb, lol internet etc.

S-> CABC
A -> Inter | Intar | Inner
B -> web | net | webs | nets | tube | tubes
C -> lol | ""

Oh man, now I feel retarded. I was about to post a more complex example but my IQ dropped dangerously into the zone reserved for Microsoft Fanboys and /b/tards.

Anyways, another thought. If you had a room full of monkeys and Context free Grammars, eventually they would produce the works of shakespeare.


edit: also waiting for approval to submit A3 related posts I have stored up.
edit2: looking at what I wrote a couple of days later, I realize I may have done something wrong.

No comments: