chunking

Chunking – regular expressions and trees

Chunking – regular expressions and trees Question: 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: I’m studying nltk in Uni, and we’re doing chunks. In the grammar I have on my notes the following code: grammar = r""" NP: …

Total answers: 1

NLTK linguistic tree traversal and extract noun phrase (NP)

NLTK linguistic tree traversal and extract noun phrase (NP) Question: I created a custom classifier based chunker: DigDug_classifier, which chunks the following sentence: sentence = “There is high signal intensity evident within the disc at T1.” To create these chunks: (S (NP There/EX) (VP is/VBZ) (NP high/JJ signal/JJ intensity/NN evident/NN) (PP within/IN) (NP the/DT disc/NN) …

Total answers: 2

how to split an iterable in constant-size chunks

how to split an iterable in constant-size chunks Question: I am surprised I could not find a "batch" function that would take as input an iterable and return an iterable of iterables. For example: for i in batch(range(0,10), 1): print i [0] [1] … [9] or: for i in batch(range(0,10), 3): print i [0,1,2] [3,4,5] …

Total answers: 20