0

I would like to transform that code in to iterative code, because i had recursion error even with passby recursion limit

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)
user9176398
  • 441
  • 1
  • 4
  • 15
  • Dont do what you're doing. Take a look at https://stackoverflow.com/questions/47769818/why-is-my-nltk-function-slow-when-processing-the-dataframe and also – alvas May 04 '18 at 00:48
  • I do not see any recursion in your code. What is your problem? On a side note, move `set(stopwords.words("english"))` outside of the loop because you are creating a _new_ set at each iteration. – DYZ May 05 '18 at 06:10
  • why did i get "recursion error : limit exceded" so ? – user9176398 May 05 '18 at 06:39

0 Answers0