mirror of https://github.com/explosion/spaCy.git
Fix gaps in Lexeme API. Closes #1031
This commit is contained in:
parent
83e1b5f1e3
commit
0ae3807d7d
|
@ -159,6 +159,10 @@ cdef class Lexeme:
|
|||
def __get__(self):
|
||||
return self.c.id
|
||||
|
||||
property lex_id:
|
||||
def __get__(self):
|
||||
return self.c.id
|
||||
|
||||
property repvec:
|
||||
def __get__(self):
|
||||
raise AttributeError("lex.repvec has been renamed to lex.vector")
|
||||
|
@ -173,6 +177,11 @@ cdef class Lexeme:
|
|||
def __get__(self):
|
||||
return self.vocab.strings[self.c.orth]
|
||||
|
||||
property text:
|
||||
def __get__(self):
|
||||
return self.vocab.strings[self.c.orth]
|
||||
|
||||
|
||||
property lower:
|
||||
def __get__(self): return self.c.lower
|
||||
def __set__(self, int x): self.c.lower = x
|
||||
|
|
|
@ -0,0 +1,13 @@
|
|||
from ...vocab import Vocab
|
||||
|
||||
def test_lexeme_text():
|
||||
vocab = Vocab()
|
||||
lex = vocab[u'the']
|
||||
assert lex.text == u'the'
|
||||
|
||||
|
||||
def test_lexeme_lex_id():
|
||||
vocab = Vocab()
|
||||
lex1 = vocab[u'the']
|
||||
lex2 = vocab[u'be']
|
||||
assert lex1.lex_id != lex2.lex_id
|
Loading…
Reference in New Issue