mirror of
https://github.com/explosion/spaCy.git
synced 2024-12-24 17:06:29 +03:00
cleanup
This commit is contained in:
parent
0f0f07318a
commit
349107daa3
|
@ -20,8 +20,6 @@ from spacy.lang.en import English
|
|||
def test_issue3869(sentence):
|
||||
"""Test that the Doc's count_by function works consistently"""
|
||||
nlp = English()
|
||||
|
||||
print()
|
||||
doc = nlp(sentence)
|
||||
|
||||
count = 0
|
||||
|
|
|
@ -7,7 +7,6 @@ from ..typedefs cimport attr_t
|
|||
from ..attrs cimport attr_id_t
|
||||
|
||||
|
||||
|
||||
cdef attr_t get_token_attr(const TokenC* token, attr_id_t feat_name) nogil
|
||||
|
||||
|
||||
|
|
|
@ -14,7 +14,6 @@ from collections import Counter
|
|||
import numpy
|
||||
import numpy.linalg
|
||||
import struct
|
||||
from libc.stdint cimport int64_t
|
||||
import srsly
|
||||
from thinc.neural.util import get_array_module, copy_array
|
||||
|
||||
|
@ -712,7 +711,6 @@ cdef class Doc:
|
|||
cdef int i
|
||||
cdef attr_t attr
|
||||
cdef size_t count
|
||||
cdef int64_t this_value
|
||||
|
||||
if counts is None:
|
||||
counts = Counter()
|
||||
|
@ -722,13 +720,11 @@ cdef class Doc:
|
|||
# Take this check out of the loop, for a bit of extra speed
|
||||
if exclude is None:
|
||||
for i in range(self.length):
|
||||
this_value = get_token_attr(&self.c[i], attr_id)
|
||||
counts[this_value] += 1
|
||||
counts[get_token_attr(&self.c[i], attr_id)] += 1
|
||||
else:
|
||||
for i in range(self.length):
|
||||
if not exclude(self[i]):
|
||||
attr = get_token_attr(&self.c[i], attr_id)
|
||||
counts[attr] += 1
|
||||
counts[get_token_attr(&self.c[i], attr_id)] += 1
|
||||
if output_dict:
|
||||
return dict(counts)
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user