* Add missing properties in Lexeme class

This commit is contained in:
Matthew Honnibal 2015-08-26 19:16:28 +02:00
parent 76996f4145
commit 3acf60df06

View File

@ -29,6 +29,10 @@ cdef class Lexeme:
self.c = <LexemeC*><void*>vocab.get_by_orth(vocab.mem, orth) self.c = <LexemeC*><void*>vocab.get_by_orth(vocab.mem, orth)
assert self.c.orth == orth assert self.c.orth == orth
property orth_:
def __get__(self):
return self.vocab.strings[self.c.orth]
property lower: property lower:
def __get__(self): return self.c.lower def __get__(self): return self.c.lower
def __set__(self, int x): self.c.lower = x def __set__(self, int x): self.c.lower = x
@ -49,9 +53,13 @@ cdef class Lexeme:
def __get__(self): return self.c.suffix def __get__(self): return self.c.suffix
def __set__(self, int x): self.c.suffix = x def __set__(self, int x): self.c.suffix = x
property orth_: property cluster:
def __get__(self): def __get__(self): return self.c.suffix
return self.vocab.strings[self.c.orth] def __set__(self, int x): self.c.suffix = x
property prob:
def __get__(self): return self.c.suffix
def __set__(self, int x): self.c.suffix = x
property lower_: property lower_:
def __get__(self): return self.vocab.strings[self.c.lower] def __get__(self): return self.vocab.strings[self.c.lower]
@ -73,6 +81,10 @@ cdef class Lexeme:
def __get__(self): return self.c.suffix def __get__(self): return self.c.suffix
def __set__(self, unicode x): self.c.suffix = self.vocab.strings[x] def __set__(self, unicode x): self.c.suffix = self.vocab.strings[x]
property flags:
def __get__(self): return self.c.flags
def __set__(self, flags_t x): self.c.flags = x
property is_oov: property is_oov:
def __get__(self): return Lexeme.check_flag(self.c, IS_OOV) def __get__(self): return Lexeme.check_flag(self.c, IS_OOV)
def __set__(self, attr_id_t x): Lexeme.set_flag(self.c, IS_OOV, x) def __set__(self, attr_id_t x): Lexeme.set_flag(self.c, IS_OOV, x)