mirror of
https://github.com/explosion/spaCy.git
synced 2024-12-25 01:16:28 +03:00
Fix code explosion from long enum in Python 3, Cython 0.24+
This commit is contained in:
parent
8a829eb98c
commit
11f2a05ede
|
@ -1,4 +1,4 @@
|
|||
cpdef enum symbol_t:
|
||||
cdef enum symbol_t:
|
||||
NIL
|
||||
IS_ALPHA
|
||||
IS_ASCII
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
# coding: utf8
|
||||
#cython: optimize.unpack_method_calls=False
|
||||
|
||||
from __future__ import unicode_literals
|
||||
|
||||
IDS = {
|
||||
|
@ -458,4 +460,11 @@ IDS = {
|
|||
"xcomp": xcomp
|
||||
}
|
||||
|
||||
NAMES = [it[0] for it in sorted(IDS.items(), key=lambda it: it[1])]
|
||||
def sort_nums(x):
|
||||
return x[1]
|
||||
|
||||
NAMES = [it[0] for it in sorted(IDS.items(), key=sort_nums)]
|
||||
# Unfortunate hack here, to work around problem with long cpdef enum
|
||||
# (which is generating an enormous amount of C++ in Cython 0.24+)
|
||||
# We keep the enum cdef, and just make sure the names are available to Python
|
||||
locals().update(IDS)
|
||||
|
|
Loading…
Reference in New Issue
Block a user