提问人:npl 提问时间:11/17/2023 最后编辑:egleasenpl 更新时间:11/17/2023 访问量:27
如何将一致性方法(来自 nlkt)应用于数据框中的每一行,以查找出现我定义的一组单词的所有上下文?
How can I apply the concordance method (from nlkt) to each line on my Data Frame to find all the contexts which appear a set of words that I defined?
问:
我想将一致性方法应用于我的消息列中的每一行消息,以找出这些单词(学习、研究等)出现的上下文。
df['Message_tokenized'] = df['Message_tokenized'].apply(Text)
df['Concordance_Results'] = df['Message_tokenized'].apply(lambda text: text.concordance(r'\b(?:study|studies|studying|studied|learn|learning|learned|homework|research|researching|papers?|presentation|thesis|tests?|finals|grades?)\b'))
当我运行此代码时,输出得到“不匹配”。我该怎么做?
答: 暂无答案
评论