From 13fad36e492f71245e0d137581a72c39275ae9ad Mon Sep 17 00:00:00 2001 From: Matthew Honnibal Date: Fri, 20 May 2016 10:11:05 +0200 Subject: [PATCH] * Cosmetic change to english noun chunks iterator -- use enumerate instead of range loop --- spacy/syntax/iterators.pyx | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/spacy/syntax/iterators.pyx b/spacy/syntax/iterators.pyx index c2003a28c..9ceb0c0bf 100644 --- a/spacy/syntax/iterators.pyx +++ b/spacy/syntax/iterators.pyx @@ -7,8 +7,7 @@ def english_noun_chunks(doc): np_deps = [doc.vocab.strings[label] for label in labels] conj = doc.vocab.strings['conj'] np_label = doc.vocab.strings['NP'] - for i in range(len(doc)): - word = doc[i] + for i, word in enumerate(doc): if word.pos in (NOUN, PROPN, PRON) and word.dep in np_deps: yield word.left_edge.i, word.i+1, np_label elif word.pos == NOUN and word.dep == conj: