我想将代码转换为迭代代码,因为即使使用passby递归限制我也有递归错误
ps = PorterStemmer()
train_text = train["comment_text"]
train_corpus = []
for i in range(0, len(train_text)):
data = re.sub("[^a-zA-Z]", ' ', train_text[i]).lower().split()
data = [ps.stem(word) for word in data if not word in set(stopwords.words("english"))]
data = ' '.join(data)
train_corpus.append(data)