mirror of
https://github.com/explosion/spaCy.git
synced 2025-06-24 23:13:04 +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
|
NIL
|
||||||
IS_ALPHA
|
IS_ALPHA
|
||||||
IS_ASCII
|
IS_ASCII
|
||||||
|
|
|
@ -1,4 +1,6 @@
|
||||||
# coding: utf8
|
# coding: utf8
|
||||||
|
#cython: optimize.unpack_method_calls=False
|
||||||
|
|
||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
IDS = {
|
IDS = {
|
||||||
|
@ -458,4 +460,11 @@ IDS = {
|
||||||
"xcomp": xcomp
|
"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