SO 分類アルゴリズムを使用するために、データフレームの列 (ステム処理されていない) に Snowballstemmer を使用してステミングを適用したいと考えています。
したがって、私のコードは次のようになります。
df = pd.read_excel(...)
df["content"] = df['column2'].str.lower()
stopword_list = nltk.corpus.stopwords.words('dutch')
df['unstemmed'] = df['content'].apply(lambda x: ' '.join([word for word in x.split() if word not in (stopword_list)]))
df["unstemmed"] = df["unstemmed"].str.replace(r"[^a-zA-Z ]+", " ").str.strip()
df["unstemmed"] = df["unstemmed"].replace('\s+', ' ', regex=True)
df['unstemmed'] = df['unstemmed'].str.split()
df['stemmed'] = df['unstemmed'].apply(lambda x : [stemmer.stem(y) for y in x])
最初に、大文字をすべて小文字に変換し、オランダ語のストップワードをすべて削除します。これに続いて、すべての特殊文字が削除され、すべての単語が分割されます。チェックしたところ、すべての列が「オブジェクト」です。
次のエラーが表示されます: stem() に必要な位置引数が 1 つありません: 'token'
どうすればこれを解決できますか?