I'm new to NLP. I have a few doubts about PCFG parser (NLTK). My understanding is that PCFG parser will return most probable parse tree. So if I'm parsing one sentence with PCFG parser, I'll be getting one parse tree. Is my assumption right?

Moving further, PCFG parser is trained using corpus consisting of 1000 sentences, will I be getting 1000 parse tree (1 per sentence) or only one parse tree? If it is different for each sentence, are the production rules for one parse tree independent of another parse tree?

Why does the NLTK PCFG parser expect input in Penn treebank format? (I mean Penn treebank is also a parsed tree, isn't it?)

Do we have to define production rules and assign its probability explicitly? If no, how to do it programmatically?

  • Your question might fit better in StackOverflow, but yes, you (usually) get one parse tree per sentence parsed. If you train using 1000 sentences, that doesn't change. The parser expects its training data in penn treebank format, later (for clarification) just sentences, possibly tokenized and pos tagged. You don't have to explicitly define rules and probabilities, those are learned. – L3viathan Feb 9 '15 at 13:08
  • how to learn rules and probablities? – m-bhole Feb 10 '15 at 13:13
  • Take a look at this – L3viathan Feb 10 '15 at 13:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.