I have been working on this translator for going on 5 days. This is what
the instructor gave us.
You are required to write simple French parsing program in OZ that takes an
French sentential form (given as list of strings) and flag either the
sentence is acceptable or not. Your French parser must also incorporate a
lexicon for some given French words and there associated English words. If
the sentence flag is acceptable, your program needs to translate it into
English sentence. For this exercise, you need to let your OZ program
recognize the following French grammar:
*FS **à** FNP FVP*
*FNP **à** FNP1*
*FNP **à** FNP2*
*FNP1 **à** FPRN*
*FNP2 **à** FDET FNOUN*
*FVP **à** FNP1 FVERB*
*FVP **à** FVERB FNP2*
*FPRN **à** je | me | nous | tu | te | vous | il | le | ils | les*
*FDET **à** le |les*
*FVERB **à** vois | voit | voyons | voyez | voient*
*FNoun **à** chat | chats*
*Figure 1(a)*
Your lexicon must have the following words association:
*Figure 1(b)*
To help you in starting this exercise, I need to provide you with some basic
ideas and programs. Use the followings to create a lexicon for a simple
three words,
*declare*
*Lex = lex(voit:sees*
* il:he*
* le:the*
* chat:cat*
* )*
*% Now you can browse the lexicon to say what is the corresponding English
word to chat*
*{Browse Lex.chat}*
* *
In order to use the lexicon at your program for the purpose of translation,
you need to have the following function:
* *
*fun {TranslateWord W} Lex.W end*
Indeed, you can directly use the lexicon to translate any given French
sentential form into English directly. This direct (Word for Word)
translation does not use any parsing.
*fun {TranslateText Ws}*
* {Map Ws fun {$ W} {TranslateWord W} end}*
*end*
*% Now you can enjoy translating the French sentence: il voit le chat*
*{Browse {TranslateText [il voit le chat]}}*
* *
However, this exercise requires that you parse the French sentential form
first. To help you in the parsing process, I am providing a simple parsing
program for the following English grammar:
* *
*S --> NP VP*
* NP --> john | mary*
* **VP --> walks | whistles*
This accepts sentences like
john walks
john whistles
mary walks
mary whistles
Here is the parser where it can accept or reject sentential forms:
*declare *
*proc {S P0 P}*
* P1 in*
* {NP P0 P1}*
* {Browse P0.1}*
* {VP P1 P}*
* {Browse P1.1}*
* {Browse 'Acceptable Sentence'}*
*end*
* *
*proc {NP P0 P} *
* choice *
* P0 = john|P*
* [] P0 = mary|P*
* end*
*end*
* *
*proc {VP P0 P} *
* choice *
* P0 = whistles|P*
* [] P0 = walks|P*
* end*
*end*
* *
The parser I wrote works. I can get the translator to work but it doesn't
works for multiple words. I assume that he just wants me to adjust his
translator, but I can't figure it out, and i'm starting to stress myself out
about it. Does anyone know how to help me out??
--
Kurt Breitsprecher
(807) 474-9601
[email protected]
_________________________________________________________________________________
mozart-users mailing list
[email protected]
http://www.mozart-oz.org/mailman/listinfo/mozart-users