I have been trying to cythonize the following loop, however I can't seem to cdef
the np.array([],str)
. When compiling, array is not recognised as being part of numpy.
import numpy as np
from textblob import TextBlob
def arr_blob_corr(str_arr1):
ph1=np.array([],str)
for n1 in range(0,str_arr1.shape[0]):
ph2=TextBlob(str_arr1[n1].lower()).correct().raw
ph1=np.append(ph1,ph2)
return ph1
I have tried
cdef np.ndarray arr2=np.ndarray(arr1,str)
and
cdef np.nrray arr2=np.array(arr1,str)
To no avail.