def para_spell_corr(dicowsc, pdser): # Parallelisation nb_cpu = mp.cpu_count() p = mp.Pool(processes=nb_cpu) split_serie = np.array_split(pdser, nb_cpu) splserdico = [(split_serie[i], dicowsc) for i in range(nb_cpu)] pool_results = p.map(map_spell_corr, splserdico) p.close() p.join() # merging parts processed by different processes parts = pd.concat(pool_results, axis=0) return parts
def parallel_serie_stem(pdser): # Parallelisation nb_cpu = mp.cpu_count() p = mp.Pool(processes=nb_cpu) split_serie = np.array_split(pdser, nb_cpu) pool_results = p.map(map_stem, split_serie) p.close() p.join() # merging parts processed by different processes parts = pd.concat(pool_results, axis=0) return parts
def para_split(lwordref, pdser): dwordcost = dict((str(k), log((i+1)*log(len(lwordref)))) for i, k in enumerate(lwordref)) # Parallelisation nb_cpu = mp.cpu_count() p = mp.Pool(processes=nb_cpu) split_serie = np.array_split(pdser, nb_cpu) splserdico = [(split_serie[i], dwordcost) for i in range(nb_cpu)] pool_results = p.map(map_split, splserdico) p.close() p.join() # merging parts processed by different processes parts = pd.concat(pool_results, axis=0) return parts
def para_split(lwordref, pdser): dwordcost = dict((str(k), log((i + 1) * log(len(lwordref)))) for i, k in enumerate(lwordref)) # Parallelisation nb_cpu = mp.cpu_count() p = mp.Pool(processes=nb_cpu) split_serie = np.array_split(pdser, nb_cpu) splserdico = [(split_serie[i], dwordcost) for i in range(nb_cpu)] pool_results = p.map(map_split, splserdico) p.close() p.join() # merging parts processed by different processes parts = pd.concat(pool_results, axis=0) return parts