mirror of
https://github.com/explosion/spaCy.git
synced 2025-05-31 19:23:05 +03:00
Clean up dead parsing code
This commit is contained in:
parent
ca12764772
commit
363aa47b40
|
@ -529,8 +529,6 @@ cdef class Parser:
|
||||||
const float* feat_weights,
|
const float* feat_weights,
|
||||||
int nr_class, int nr_feat, int nr_piece) nogil:
|
int nr_class, int nr_feat, int nr_piece) nogil:
|
||||||
'''This only works with no hidden layers -- fast but inaccurate'''
|
'''This only works with no hidden layers -- fast but inaccurate'''
|
||||||
#for i in cython.parallel.prange(next_step.size(), num_threads=4, nogil=True):
|
|
||||||
# self._parse_step(next_step[i], feat_weights, nr_class, nr_feat)
|
|
||||||
token_ids = <int*>calloc(nr_feat, sizeof(int))
|
token_ids = <int*>calloc(nr_feat, sizeof(int))
|
||||||
scores = <float*>calloc(nr_class * nr_piece, sizeof(float))
|
scores = <float*>calloc(nr_class * nr_piece, sizeof(float))
|
||||||
is_valid = <int*>calloc(nr_class, sizeof(int))
|
is_valid = <int*>calloc(nr_class, sizeof(int))
|
||||||
|
|
|
@ -62,27 +62,3 @@ cdef class StateClass:
|
||||||
n0 = words[self.B(0)]
|
n0 = words[self.B(0)]
|
||||||
n1 = words[self.B(1)]
|
n1 = words[self.B(1)]
|
||||||
return ' '.join((third, second, top, '|', n0, n1))
|
return ' '.join((third, second, top, '|', n0, n1))
|
||||||
|
|
||||||
@classmethod
|
|
||||||
def nr_context_tokens(cls):
|
|
||||||
return 13
|
|
||||||
|
|
||||||
def set_context_tokens(self, int[::1] output):
|
|
||||||
output[0] = self.B(0)
|
|
||||||
output[1] = self.B(1)
|
|
||||||
output[2] = self.S(0)
|
|
||||||
output[3] = self.S(1)
|
|
||||||
output[4] = self.S(2)
|
|
||||||
output[5] = self.L(self.S(0), 1)
|
|
||||||
output[6] = self.L(self.S(0), 2)
|
|
||||||
output[6] = self.R(self.S(0), 1)
|
|
||||||
output[7] = self.L(self.B(0), 1)
|
|
||||||
output[8] = self.R(self.S(0), 2)
|
|
||||||
output[9] = self.L(self.S(1), 1)
|
|
||||||
output[10] = self.L(self.S(1), 2)
|
|
||||||
output[11] = self.R(self.S(1), 1)
|
|
||||||
output[12] = self.R(self.S(1), 2)
|
|
||||||
|
|
||||||
for i in range(13):
|
|
||||||
if output[i] != -1:
|
|
||||||
output[i] += self.c.offset
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user