If I keep the n_process of the nlp.pipe equal to 1 such as nlp.pipe(n_process = 1), there is no issue; however, whenever I increase n_process to any numbers larger than 1 such as 2 or 3 or 12, the Pycharm IDE is stopped working. My code:
import tensorflow
import pandas as pd
import spacy
from spacy import displacy
from spacy.matcher import Matcher
comment_sentiment_data = pd.read_pickle("comment_sentiment_data.pkl")
nlp = spacy.load("en_core_web_lg")
from datetime import datetime
start_time = datetime.now()
matcher = Matcher(nlp.vocab)
pattern = [{"TEXT": {"IN": ["#", "$"]}, "OP": "+"}, {"TEXT": {"REGEX": "[A-Za-z]+"}}]
matcher.add("stockHashTag", [pattern])
doc = nlp.pipe(comment_sentiment_data["body"][:5000], n_process=2, batch_size=10000,disable=['parser', 'tagger', 'ner','attribute_ruler', 'lemmatizer'])
doc1 = list(doc)
matches = [matcher(subdoc) for subdoc in doc1]
outside = []
for t,sub in zip(matches,doc1):
inside = []
for x in t:
inside.append(sub[x[1]:x[2]])
outside.append(inside)
end_time = datetime.now()
print(end_time - start_time)
At line doc1 = list(doc), the code stops working. If n_process is 1, the code finishes in almost 4 seconds. I am using spaCy 3.2.4.