mirror of
https://github.com/explosion/spaCy.git
synced 2024-11-10 19:57:17 +03:00
* Rename ATTR_IDS to attrs.IDS. Rename ATTR_NAMES to attrs.NAMES. Rename UNIV_POS_IDS to parts_of_speech.IDS
This commit is contained in:
parent
3cea417852
commit
94bafc1417
|
@ -1,4 +1,4 @@
|
|||
ATTR_IDS = {
|
||||
IDS = {
|
||||
"NULL_ATTR": NULL_ATTR,
|
||||
"IS_ALPHA": IS_ALPHA,
|
||||
"IS_ASCII": IS_ASCII,
|
||||
|
@ -87,4 +87,4 @@ ATTR_IDS = {
|
|||
}
|
||||
|
||||
# ATTR IDs, in order of the symbol
|
||||
ATTR_NAMES = [key for key, value in sorted(ATTR_IDS.items(), key=lambda item: item[1])]
|
||||
NAMES = [key for key, value in sorted(IDS.items(), key=lambda item: item[1])]
|
||||
|
|
|
@ -6,7 +6,7 @@ try:
|
|||
except ImportError:
|
||||
import json
|
||||
|
||||
from .parts_of_speech import UNIV_POS_NAMES
|
||||
from .parts_of_speech import IDS as POS_IDS
|
||||
from .parts_of_speech cimport ADJ, VERB, NOUN, PUNCT
|
||||
|
||||
|
||||
|
@ -24,7 +24,7 @@ cdef class Morphology:
|
|||
self.rich_tags[i].id = i
|
||||
self.rich_tags[i].name = self.strings[tag_str]
|
||||
self.rich_tags[i].morph = 0
|
||||
self.rich_tags[i].pos = UNIV_POS_NAMES[props['pos'].upper()]
|
||||
self.rich_tags[i].pos = POS_IDS[props['pos'].upper()]
|
||||
self.reverse_index[self.rich_tags[i].name] = i
|
||||
self._cache = PreshMapArray(self.n_tags)
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
from __future__ import unicode_literals
|
||||
|
||||
|
||||
UNIV_POS_NAMES = {
|
||||
IDS = {
|
||||
"NO_TAG": NO_TAG,
|
||||
"ADJ": ADJ,
|
||||
"ADP": ADP,
|
||||
|
@ -23,3 +23,6 @@ UNIV_POS_NAMES = {
|
|||
"EOL": EOL,
|
||||
"SPACE": SPACE
|
||||
}
|
||||
|
||||
|
||||
NAMES = [key for key, value in sorted(IDS.items(), key=lambda item: item[1])]
|
||||
|
|
|
@ -14,7 +14,6 @@ from ..typedefs cimport attr_t, flags_t
|
|||
from ..attrs cimport attr_id_t
|
||||
from ..attrs cimport ID, ORTH, NORM, LOWER, SHAPE, PREFIX, SUFFIX, LENGTH, CLUSTER
|
||||
from ..attrs cimport POS, LEMMA, TAG, DEP, HEAD, SPACY, ENT_IOB, ENT_TYPE
|
||||
from ..parts_of_speech import UNIV_POS_NAMES
|
||||
from ..parts_of_speech cimport CONJ, PUNCT, NOUN
|
||||
from ..parts_of_speech cimport univ_pos_t
|
||||
from ..lexeme cimport Lexeme
|
||||
|
|
|
@ -9,7 +9,7 @@ import numpy
|
|||
|
||||
|
||||
from ..lexeme cimport Lexeme
|
||||
from ..parts_of_speech import UNIV_POS_NAMES
|
||||
from .. import parts_of_speech
|
||||
|
||||
from ..attrs cimport LEMMA
|
||||
from ..attrs cimport ID, ORTH, NORM, LOWER, SHAPE, PREFIX, SUFFIX, LENGTH, CLUSTER
|
||||
|
@ -318,7 +318,7 @@ cdef class Token:
|
|||
|
||||
property pos_:
|
||||
def __get__(self):
|
||||
return _pos_id_to_string[self.c.pos]
|
||||
return parts_of_speech.NAMES[self.c.pos]
|
||||
|
||||
property tag_:
|
||||
def __get__(self):
|
||||
|
@ -363,6 +363,3 @@ cdef class Token:
|
|||
|
||||
property like_email:
|
||||
def __get__(self): return Lexeme.c_check_flag(self.c.lex, LIKE_EMAIL)
|
||||
|
||||
|
||||
_pos_id_to_string = {id_: string for string, id_ in UNIV_POS_NAMES.items()}
|
||||
|
|
Loading…
Reference in New Issue
Block a user