From 6640386b25c60fda419cc8fd112eb4d64786bf8c Mon Sep 17 00:00:00 2001 From: Matthew Honnibal Date: Tue, 7 Apr 2015 06:00:43 +0200 Subject: [PATCH] * Fix Issue #43: TAG attr not supported. Also add DEP attr, while I'm at it. Need better way of ensuring future changes don't break in similar way. --- spacy/attrs.pxd | 1 + tests/test_array.py | 10 ++++++++++ 2 files changed, 11 insertions(+) diff --git a/spacy/attrs.pxd b/spacy/attrs.pxd index bd373c733..d0727d287 100644 --- a/spacy/attrs.pxd +++ b/spacy/attrs.pxd @@ -78,5 +78,6 @@ cpdef enum attr_id_t: LEMMA POS TAG + DEP diff --git a/tests/test_array.py b/tests/test_array.py index b55d87eab..7a08fbb8f 100644 --- a/tests/test_array.py +++ b/tests/test_array.py @@ -29,3 +29,13 @@ def test_tag(): assert feats_array[3][1] == tokens[3].tag +def test_dep(): + text = u'A nice sentence.' + tokens = EN(text) + feats_array = tokens.to_array((attrs.ORTH, attrs.DEP)) + assert feats_array[0][1] == tokens[0].dep + assert feats_array[1][1] == tokens[1].dep + assert feats_array[2][1] == tokens[2].dep + assert feats_array[3][1] == tokens[3].dep + +