mirror of
https://github.com/explosion/spaCy.git
synced 2025-01-12 18:26:30 +03:00
* Fix merge errors in lexeme.pxd
This commit is contained in:
parent
5ad4527c42
commit
4f8e38271d
|
@ -17,7 +17,6 @@ cdef class Lexeme:
|
|||
cdef readonly attr_t orth
|
||||
|
||||
@staticmethod
|
||||
<<<<<<< HEAD
|
||||
cdef inline Lexeme from_ptr(LexemeC* lex, Vocab vocab, int vector_length):
|
||||
cdef Lexeme self = Lexeme.__new__(Lexeme, vocab, lex.orth)
|
||||
self.c = lex
|
||||
|
@ -42,22 +41,6 @@ cdef class Lexeme:
|
|||
lex.suffix = value
|
||||
elif name == CLUSTER:
|
||||
lex.cluster = value
|
||||
=======
|
||||
cdef inline int set_struct_props(Vocab vocab, LexemeC* lex, dict props) except -1:
|
||||
lex.length = props['length']
|
||||
lex.orth = vocab.strings[props['orth']]
|
||||
lex.lower = vocab.strings[props['lower']]
|
||||
lex.norm = vocab.strings[props['norm']]
|
||||
lex.shape = vocab.strings[props['shape']]
|
||||
lex.prefix = vocab.strings[props['prefix']]
|
||||
lex.suffix = vocab.strings[props['suffix']]
|
||||
|
||||
lex.cluster = props['cluster']
|
||||
lex.prob = props['prob']
|
||||
lex.sentiment = props['sentiment']
|
||||
|
||||
lex.flags = props['flags']
|
||||
>>>>>>> de
|
||||
|
||||
@staticmethod
|
||||
cdef inline attr_t get_struct_attr(const LexemeC* lex, attr_id_t feat_name) nogil:
|
||||
|
@ -87,43 +70,10 @@ cdef class Lexeme:
|
|||
else:
|
||||
return 0
|
||||
|
||||
@staticmethod
|
||||
cdef inline void set_struct_attr(LexemeC* lex, attr_id_t name, attr_t value) nogil:
|
||||
if name < (sizeof(flags_t) * 8):
|
||||
Lexeme.set_flag(lex, name, value)
|
||||
elif name == ID:
|
||||
lex.id = value
|
||||
elif name == LOWER:
|
||||
lex.lower = value
|
||||
elif name == NORM:
|
||||
lex.norm = value
|
||||
elif name == SHAPE:
|
||||
lex.shape = value
|
||||
elif name == PREFIX:
|
||||
lex.prefix = value
|
||||
elif name == SUFFIX:
|
||||
lex.suffix = value
|
||||
elif name == CLUSTER:
|
||||
lex.cluster = value
|
||||
|
||||
@staticmethod
|
||||
cdef inline bint check_flag(const LexemeC* lexeme, attr_id_t flag_id) nogil:
|
||||
<<<<<<< HEAD
|
||||
return lexeme.flags & (1 << flag_id)
|
||||
|
||||
@staticmethod
|
||||
cdef inline bint set_flag(LexemeC* lexeme, attr_id_t flag_id, bint value) nogil:
|
||||
cdef flags_t one = 1
|
||||
if value:
|
||||
lexeme.flags |= one << flag_id
|
||||
else:
|
||||
lexeme.flags &= ~(one << flag_id)
|
||||
=======
|
||||
if lexeme.flags & (1 << flag_id):
|
||||
return True
|
||||
else:
|
||||
return False
|
||||
|
||||
@staticmethod
|
||||
cdef inline bint set_flag(LexemeC* lex, attr_id_t flag_id, int value) nogil:
|
||||
cdef flags_t one = 1
|
||||
|
@ -131,4 +81,3 @@ cdef class Lexeme:
|
|||
lex.flags |= one << flag_id
|
||||
else:
|
||||
lex.flags &= ~(one << flag_id)
|
||||
>>>>>>> de
|
||||
|
|
Loading…
Reference in New Issue
Block a user