Week 13

I have resolved the issue of iterators and am now able to output the multiple noun phrases properly. An example sentence that I tested this with was "big jack and pretty and handsome and beautiful and strong john fought and watched a nice movie". Of course, this also works fine with sentences containing only one noun phrase, such as "mary is beautiful".

I am now working on identifying the subject(s) and object(s) noun phrases with respect to the verb, so as to form the predicate. I have started simple, by working on simple sentences that have only one verb and one subject-object pair. I have also assumed that the subject noun phrase appears before the verb in the sentence, while the object noun phrase appears after. Of course, this is an overly simplistic assumption, since even in my own test sentences I have found some that do not take this form, such as "jack and john fought". However, I am using this as a starting point.

I first identify the location of the verb in the sentence, then find the first noun phrase appearing before the verb. This is chosen to be the subject. I then locate the first noun phrase after the verb. This is the object. I have successfully coded this and done a few sample runs with simple sentences that assume such a form. I have saved some images of these sample runs.




My next step will be to handle multiple noun phrases, as well as multiple verbs. At this stage, I will still assume that they take this form (i.e., subject appears before verb and object appears after).


I have modified the code such that it can accept multiple subjects for one verb, assuming the sentence still takes the same form (i.e., (multiple subjects), (verb), (object)). The following shows a sample run.

The predicate is formed correctly. Following this, I will adopt a similar approach and allow multiple objects as well. After I have successfully done that (which should be easy), I will look into handling other sentence forms, such as "jack and john fought" (i.e., sentences that do not follow the form subject(s)-verb-object(s)), as well as sentences with multiple verbs, e.g. "big jack and pretty and handsome and beautiful and strong john fought and watched a nice movie".

During the week, I have also written up a short submission to Prof Fernando, at his request, since we are submitting a paper for the BlogWall project. The document is attached in this post.
  

BlogWall WriteUp


Comments