Skip to content

Commit

Permalink
Fix Issue #600: Missing setters for Token attribute.
Browse files Browse the repository at this point in the history
  • Loading branch information
honnibal committed Nov 2, 2016
1 parent 125c910 commit 05a8b75
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions spacy/tokens/token.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,12 @@ cdef class Token:
property tag:
def __get__(self):
return self.c.tag
def __set__(self, int tag):
# TODO: The behaviour here --- that it fails when we don't have the
# tag in the 'reverse index' --- really sucks. But we can't fix it
# here if we don't fix it elsewhere...
self.vocab.morphology.assign_tag(self.c,
self.vocab.morphology.reverse_index[tag])

property dep:
def __get__(self):
Expand Down Expand Up @@ -537,6 +543,8 @@ cdef class Token:
property tag_:
def __get__(self):
return self.vocab.strings[self.c.tag]
def __set__(self, tag):
self.tag = self.vocab.strings[tag]

property dep_:
def __get__(self):
Expand Down

0 comments on commit 05a8b75

Please sign in to comment.