There are both written and programming parts to this homework. The written part will be turned in via CourseWeb to facilitate automatic grading.
This multiple choice part of the homework will be automatically graded. You can only submit your answers once, which will trigger the grading. I will go over the answers in class after the assignment deadline has passed.
Alphabet
3 #number of alphabets
1 2 3 #alphabets, split by '\t'
States
2 #number of states
HOT COLD #states, split by '\t'
StartProbability #prior probabilities of the states, the order is the same as before
0.8 0.2
TransitionProbability #transition probability matrix(T), N*N, N is the number of states, T[i][j] = p(s_j|s_i)
0.7 0.3
0.4 0.6
EmissionProbability #emission probability matrix(E), N*M, N is the number of states, M is the number of alphabets. E[i][j] = p(a_j|s_i)
0.2 0.4 0.4
0.5 0.4 0.1
Your 3 programs (which you should call earley_parse_basic, earley_parse_a1, earley_parse_a2) should each accept two command line parameters. An example is shown below. The first parameter is the filename of the grammar and lexicon; the second one is the input sentence that you want to parse. Your program should output to standard output the appropriate results for each version of the parser. For earley_parse_basic, the output is just whether the string is recognized or not. For earley_parse_a1, the output should in addition include all parse tree(s) for the input sentence. You can define how to print your parse tree output yourself. For early_parse_a3, you need to output some processing information to show how you eliminate some predictions from the basic algorithm.
Grammar
S->NP VP
S->Aux NP VP
S->VP
NP->Pronoun
NP->Proper-Noun
NP->Det Nominal
Nominal->Noun
Nominal->Nominal Noun
Nominal->Nominal PP
VP->Verb
VP->Verb NP
VP->Verb NP PP
VP->Verb PP
VP->VP PP
PP->Preposition NP
Lexicon #grammar and lexicon are split by a blank line
Det->that|this|the|a
Noun->book|flight|meal|money
Verb->book|include|prefer
Pronoun->I|she|me
Proper-Noun->Houston|NWA
Aux->does
Preposition->from|to|on|near|through