mirror of
https://github.com/explosion/spaCy.git
synced 2025-06-05 05:33:15 +03:00
* Add pos_tags attr to Vocab.
This commit is contained in:
parent
935bcdf3e5
commit
abc43b852d
|
@ -28,6 +28,7 @@ cdef class Vocab:
|
||||||
cdef Pool mem
|
cdef Pool mem
|
||||||
cpdef readonly StringStore strings
|
cpdef readonly StringStore strings
|
||||||
cdef vector[const LexemeC*] lexemes
|
cdef vector[const LexemeC*] lexemes
|
||||||
|
cdef readonly object pos_tags
|
||||||
|
|
||||||
cdef const LexemeC* get(self, Pool mem, UniStr* s) except NULL
|
cdef const LexemeC* get(self, Pool mem, UniStr* s) except NULL
|
||||||
cdef int _add_lex_to_vocab(self, hash_t key, const LexemeC* lex) except -1
|
cdef int _add_lex_to_vocab(self, hash_t key, const LexemeC* lex) except -1
|
||||||
|
|
|
@ -30,10 +30,12 @@ EMPTY_LEXEME.repvec = EMPTY_VEC
|
||||||
cdef class Vocab:
|
cdef class Vocab:
|
||||||
'''A map container for a language's LexemeC structs.
|
'''A map container for a language's LexemeC structs.
|
||||||
'''
|
'''
|
||||||
def __init__(self, data_dir=None, get_lex_props=None, load_vectors=True):
|
def __init__(self, data_dir=None, get_lex_props=None, load_vectors=True,
|
||||||
|
pos_tags=None):
|
||||||
self.mem = Pool()
|
self.mem = Pool()
|
||||||
self._map = PreshMap(2 ** 20)
|
self._map = PreshMap(2 ** 20)
|
||||||
self.strings = StringStore()
|
self.strings = StringStore()
|
||||||
|
self.pos_tags = pos_tags if pos_tags is not None else {}
|
||||||
self.lexemes.push_back(&EMPTY_LEXEME)
|
self.lexemes.push_back(&EMPTY_LEXEME)
|
||||||
self.lexeme_props_getter = get_lex_props
|
self.lexeme_props_getter = get_lex_props
|
||||||
self.repvec_length = 0
|
self.repvec_length = 0
|
||||||
|
|
Loading…
Reference in New Issue
Block a user