Skip to content
Advertisement

Chunking – regular expressions and trees

I’m a total noob so sorry if I’m asking something obvious. My question is twofold, or rather it’s two questions in the same topic:

  1. I’m studying nltk in Uni, and we’re doing chunks. In the grammar I have on my notes the following code:
JavaScript

What is the “$” symbol for in this case? I know it’s “end of the line” in regex, but what does it stand for here?

  1. Also, in my text book there’s a Tree that’s been printed without using the .draw() function, to this result:
JavaScript

How the heck one does that???

Thanks in advance to anybody who’ll have the patience to school this noob :D

Advertisement

Answer

This is the code of your example:

JavaScript

The tree of:

JavaScript

enter image description here

I found this link where you can learn a lot.

The $ symbol is a special character in regular expressions, and must be backslash escaped in order to match the tag PP$.

$ Example:

JavaScript
User contributions licensed under: CC BY-SA
9 People found this is helpful
Advertisement