mirror of
https://github.com/simon987/hexlib.git
synced 2025-04-10 06:06:41 +00:00
Use imap instead of map
This commit is contained in:
parent
67c09cc10c
commit
60273fb6bd
@ -24,11 +24,12 @@ nltk.download("wordnet", quiet=True)
|
|||||||
lemmatizer = WordNetLemmatizer()
|
lemmatizer = WordNetLemmatizer()
|
||||||
|
|
||||||
|
|
||||||
def clean_multicore(texts, processes, **kwargs):
|
def clean_multicore(texts, processes, chunk_size=10000, **kwargs):
|
||||||
pool = Pool(processes=processes)
|
pool = Pool(processes=processes)
|
||||||
return pool.map(
|
yield from pool.imap(
|
||||||
func=partial(preprocess, **kwargs),
|
func=partial(preprocess, **kwargs),
|
||||||
iterable=texts,
|
iterable=texts,
|
||||||
|
chunksize=chunk_size
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user