def multi_scrub_text(reviews):
'''
Function to lemmatize text - utilizes multiprocessing for parallelization
INPUT:
reviews: array-like, pandas DataFrame column containing review texts
OUTPUT:
lemmatized: pandas DataFrame column with cleaned texts
'''
lemmatized = []
cpus = cpu_count() - 1
pool = Pool(processes=cpus)
lemmatized = pool.map(lemmatize_text, reviews)
pool.close()
pool.join()
return lemmatized
评论列表
文章目录