From 1d70db58aaaaa19a20799f056872bbc43168e19a Mon Sep 17 00:00:00 2001 From: Matthew Honnibal Date: Fri, 30 Sep 2016 20:19:53 +0200 Subject: [PATCH] Revert "Changes to iterators.pyx for new StringStore scheme" This reverts commit 4f794b215a8c3ec8103fd949d2e8048edac31dd9. --- spacy/syntax/iterators.pyx | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/spacy/syntax/iterators.pyx b/spacy/syntax/iterators.pyx index 9714cd76a..aeb4e635c 100644 --- a/spacy/syntax/iterators.pyx +++ b/spacy/syntax/iterators.pyx @@ -4,9 +4,9 @@ from spacy.parts_of_speech cimport NOUN, PROPN, PRON def english_noun_chunks(doc): labels = ['nsubj', 'dobj', 'nsubjpass', 'pcomp', 'pobj', 'attr', 'ROOT', 'root'] - np_deps = [doc.vocab.strings.intern(label) for label in labels] - conj = doc.vocab.strings.intern('conj') - np_label = doc.vocab.strings.intern('NP') + np_deps = [doc.vocab.strings[label] for label in labels] + conj = doc.vocab.strings['conj'] + np_label = doc.vocab.strings['NP'] 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 @@ -27,9 +27,10 @@ def english_noun_chunks(doc): # just "eine Tasse", same for "das Thema Familie" def german_noun_chunks(doc): labels = ['sb', 'oa', 'da', 'nk', 'mo', 'ag', 'ROOT', 'root', 'cj', 'pd', 'og', 'app'] - np_label = doc.vocab.strings.intern('NP') - np_deps = set(doc.vocab.strings.intern(label) for label in labels) - close_app = doc.vocab.strings.intern('nk') + np_label = doc.vocab.strings['NP'] + np_deps = set(doc.vocab.strings[label] for label in labels) + close_app = doc.vocab.strings['nk'] + rbracket = 0 for i, word in enumerate(doc): if i < rbracket: