Revert "Changes to iterators.pyx for new StringStore scheme"

This reverts commit 4f794b215a.
This commit is contained in:
Matthew Honnibal 2016-09-30 20:19:53 +02:00
parent de01e427fd
commit 1d70db58aa
1 changed files with 7 additions and 6 deletions

View File

@ -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: