CSC384 Assignment #2 Announcements

This webpage answers questions about A2.


What is the chart(4) predicate? I don't think you mentioned it on the handout and towards the end you said: "as well as chart parser atoms called chart(4)".

chart(4) is an atom, not a predicate. It's meant to store the chart parser entries that are created as the chart parsing algorithm progresses. The fields for it are the POS non-terminal rule being completed, the beginning and end positions for the completed portion of this non-terminal, and the POS tags that it still needs to be completed.

You are welcome to modify the code to create chart parser entries in your own way. I simply offer this implementation of the chart entries as a suggestion.


What is the analyseChart predicate? You are using it in main.pl but I don't see it defined any place else. Do we have to define it?

analyseChart takes in the list of the words of the sentence, and scans the chart entries to report on the sentences that got parsed from this sentence. It uses write(1) to tell the user how many sentences were parsed, and how many used all the words in the sentence.

I haven't provided you with this predicate, so you'll have to create it on your own. Here's a little code snippet, to help you along your way:

   analyseChart(WordList) :-
     length(WordList, TotalLength),
     findall(EndPosition, chart(sentence, 0, EndPosition, []), EndPositionList),
     length(EndPositionList, SentenceCount),
     delete(EndPosList, TotalLength, InvalidPositionList),
     length(InvalidPositionList, InvalidTotal),
     ValidTotal is SentenceCount - InvalidTotal,     
      

Enjoy :)


In semantics.pl I see "analyseSemantics" predicates but I dont think they are being called anyplace else like in makeQuery etc. Do we have to call these?

Unlike analyseChart, this is a predicate that I have given you, but haven't told you where it might be used. You'll find that it will come in handy when your parse tree has been created, and you wish to extract the branch of the tree that corresponds to a particular part-of-speech, specified in the first parameter of analyseSemantics