a slightly random blog from a slightly random comp sci student


Behold! The wondrous Philosophy Generator. Or possibly, the Great Poetry Generator. I’m not too sure.

What’s this about? Well, I recently have been working on a project for Computational Linguistics in which I have to go through scores and scores of sentences and come up with the grammatical structure of each utterance, making something called a “Context-Free Grammar” out of the mess, which should be able to generate (syntactically, a.k.a. structurally) correct sentences.

This is what a Context-Free Grammar (CFG) would look like:

S -> NP VP
NP -> Det Noun
VP -> Verb

What does all this gobbledeegook mean? Okay, well, for those who are a little ignorant of the linguistic terms (or get confused with all these awful capital letters – like myself), “S” usually means “Sentence,” and the arrow means that it is composed of two basic elements: a “Noun Phrase” and a “Verb Phrase,” where a Noun Phrase is composed of a “Det”erminer (like “a” or “the”) and a Noun (I’m sure you know what that means). Whew! Anyways, these rules can be used to understand the structure of sentences like:

“The pumpkin eats the human.”
Where:
S = NP VP
NP = Det Noun = “The pumpkin”
VP = “eats”
NP2 = “the human”

So we get a “Tree”-ish looking structure like this:

(S
  (NP
    (Det "The") (Noun "pumpkin") )
  (VP
    (Verb "eats") 
    (NP
      (Det "the") (Noun "human") ) ) )

Now, just imagine building a CFG for every single conceivable rule in the English language. That is not a trivial task; therein lies the reason why I’ve been glued to my computer for the entire day, and the day before, and some of the day before, and a little bit of the day before, and, uh… some other days. A little. Nevertheless! Not simple, I tell you.

Sparing my readers any more technical or linguistic hocus-pocus, I’ll just show you the, uh, fruits of my labour so far (well, an excerpt, anyways). I gave a generator a whole slew of CFG rules and some vocabulary to work with, and this is what I got:

  • five trusty strangers y’ are .
  • now ?
  • be temperate halves … if — do 5.5 silly Saxons bleed to nights ?
  • one place goes from the trusty five legs ?
  • you or thirty just strangers y’ ‘re or be further you : knnnniggets not speak an other and every officer ?
  • nights run … where ?
  • five snakes you are , so this anarcho-syndicalist migrates no thought .
  • another sacred many sacred ants goes from no unable legs and another 5,000 pansy knnnniggets come Saxons !
  • ah , each winter migrates of one old many Saxons ?
  • thppppt ?
  • any mean five special legs cover : and when do they become every castle ?
  • be silly every away !
  • Sir Lancelot this person be ?
  • be silly one emperor , and any sovereign not cover each victory !
  • mountains help me !
  • go , and another 5.5 nights blow or snakes quiet they : or any inherent covers through each English that hard legs and mountains should pass to England !

Aaaaas you can see, this is not… quite… perfect yet; I’m not just talking about semantics though. Those can be a little off. However, the syntax still does need some work, as in the phrase ‘you or thirty just strangers [you're] or be further you’. That’s a little odd.

However, as I was tapping my chin, scratching my head and trying to figure out where I went wrong. I realized two things; 1) I had already spent far too long on this today and was starting to go mad (I’m sure I would start speaking like my generator any moment if I didn’t stop), and 2) this could be a breakthrough in poetry/philosophy! Some of these phrases seem to incite deep thought… I mean, after reading ‘be silly every away!’ don’t you think that there’s some cutesy happy-go-lucky philosophy that the computer is trying to impart unto us? Surely, it must be so.

Anyways, I’m off to work on my Philosophy Generator. I mean, my Computational Linguistics project. Uh, well, maybe not too much more today. Think I to you and you and they starts will talking in England this sort of away will I. If I’m not careful. Thppppt!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.

%d bloggers like this: