Independent Study Report, November 6, 1999

By Daniel Wilson

This week I have continued studying natural language processing through Dr. Dougherty’s book. I have also written a very basic grammar for imperative sentences. This grammar recognizes sentences of the form Verb {, determiner}, Noun. The idea behind targeting this kind of sentence is that this is the simplest way to give a command.

/*imp_sent1.pro by Daniel Wilson*/

/*Borrows heavily from g0802 by Dr. Dougherty*/

imp_sent(X) :- vp(X).
vp(X) :- v(A), np(B), append(A,B,X).
np(X) :- n(X).
np(X) :-det(A),n(B),append(A,B,X).

 

/*np(X) :- n(X).*/

/*np(X) :- det(A),np(B), append(A,B,X). */

The lines at the end commented out would allow for a noun phrase to contain infinitely many determiners. Unfortunately, the recursive definition causes an infinite loop.

I have also begun writing a lexicon for use with this project. It contains just enough words to test the grammar, hopefully with words an end user would use. Note that each word is inside of square brackets. That means that each entry in the lexicon is a list of one element. The processing within the grammar requires that lists be used. The good thing about that is that it allows multi-word "words" to be entered.

/*lex1.pro*/

v([list]).
v([show]).
v([change]).
n([file]).
n([files]).
n([disk]).
n([space]).
n([path]).
n([directory]).
n([environment]).
det([free]).
det([a]).
det([an]).
det([the]).

I need to accomplish three tasks by the end of this month. First, I need to build a larger and more robust grammar and a sufficient lexicon. Second, I must increase the scope of my semantic analysis to make the shell useful. Third, I must tie it all together and handle I/O with a C/C++ module. If I allot one week for each task, I will have the shell finished by the end of the month.

That looks like a reasonable schedule, with only a couple technical difficulties to work through. First, recursion in Prolog is not working right. Both the first two weeks work appear to depend on getting that working. That will be my major focus the next few days. Second, combining C and Prolog routines may be difficult. The Gnu Prolog manual explains how to do it, but the learning curve may be steep. If I can find good documentation on the two technical areas, I should have the shell finished by the end of the month and be ready to write the report on the project.

1