could Matcher using python multiprocessing ? #8829
meshiguge
started this conversation in
New Features & Project Ideas
Replies: 3 comments
-
Probably, yes. We're interested in trying multi-processing in |
Beta Was this translation helpful? Give feedback.
0 replies
-
import spacy
nlp = spacy.load('en' )
def task_builder(k,file):
for line in file:
lineDoc = nlp(line)
matcher = Matcher( nlp.vocab )
matcher.add('Pattern', None, pattern )
matches = matcher( lineDoc )
for each_match in matches:
do_something
pool = multiprocessing.Pool(process_num)
for k, file in enumerate(files):
pool.apply_async(task_builder, args=(k, file ) )
pool.close()
pool.join() @honnibal , but the code will hang out , could not work |
Beta Was this translation helpful? Give feedback.
0 replies
-
As a quick update, PRs to have similar support for the |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Beta Was this translation helpful? Give feedback.
All reactions