Search code examples
pythonnlpnltklinguistics

Parsing a sentence as many different ways as possible with shif-reduce parser in NLTK?


I am trying to finish a question and it asks me to parse a sentence using the shift-reduce parser and it's default grammar. It asks me to parse a sentence as many different ways as possible and asks for the number of different trees.

Can anyone know what does that mean with an example if possible please? I thought there was only one tree that would satisfy the sentence?


Solution

  • There can be two or more parse trees for a sentence. Natural language is ambiguous. One sentence can convey different meanings. This is because a word can have two different meanings. Ambiguity can also occur when punctuations are missing.

    Take a look at this example.