* Fix spacy.wsd module

This commit is contained in:
Matthew Honnibal 2015-07-06 09:33:26 +02:00
parent eb3057d806
commit 5ec2ce4dcb
3 changed files with 14 additions and 15 deletions

View File

@ -10,22 +10,21 @@ from thinc.typedefs cimport atom_t, weight_t, feat_t
cimport cython cimport cython
from .typedefs cimport flags_t from ..typedefs cimport flags_t
from .structs cimport TokenC from ..structs cimport TokenC
from .strings cimport StringStore from ..strings cimport StringStore
from .tokens cimport Tokens from ..tokens cimport Tokens
from .senses cimport N_SENSES, encode_sense_strs from .supersenses cimport N_SENSES, encode_supersense_strs
from .senses cimport NO_SENSE, N_Tops, J_all, J_pert, A_all, J_ppl, V_body from .supersenses cimport NO_SENSE, N_Tops, J_all, J_pert, A_all, J_ppl, V_body
from .gold cimport GoldParse from ..gold cimport GoldParse
from .parts_of_speech cimport NOUN, VERB, ADV, ADJ, N_UNIV_TAGS from ..parts_of_speech cimport NOUN, VERB, ADV, ADJ, N_UNIV_TAGS
from . cimport parts_of_speech from .. cimport parts_of_speech
from os import path from os import path
import json import json
cdef enum: cdef enum:
P2W P2W
P2p P2p

View File

@ -1,6 +1,6 @@
# Enum of Wordnet supersenses # Enum of Wordnet supersenses
cimport parts_of_speech from ..typedefs cimport flags_t
from .typedefs cimport flags_t from .. cimport parts_of_speech
cpdef enum: cpdef enum:
NO_SENSE NO_SENSE
@ -52,4 +52,4 @@ cpdef enum:
N_SENSES N_SENSES
cdef flags_t encode_sense_strs(sense_names) except 0 cdef flags_t encode_supersense_strs(sense_names) except 0

View File

@ -1,5 +1,5 @@
from __future__ import unicode_literals from __future__ import unicode_literals
cimport parts_of_speech from .. cimport parts_of_speech
lexnames_str = """ lexnames_str = """
@ -56,7 +56,7 @@ STRINGS = tuple(line.split()[1] for line in lexnames_str.split('\n'))
IDS = dict((sense_str, i) for i, sense_str in enumerate(STRINGS)) IDS = dict((sense_str, i) for i, sense_str in enumerate(STRINGS))
cdef flags_t encode_sense_strs(sense_names) except 0: cdef flags_t encode_supersense_strs(sense_names) except 0:
cdef flags_t sense_bits = 0 cdef flags_t sense_bits = 0
if len(sense_names) == 0: if len(sense_names) == 0:
return sense_bits | (1 << NO_SENSE) return sense_bits | (1 << NO_SENSE)