首页 > 解决方案 > 根据我扫描的列表单词拆分句子

问题描述

我有一个单词列表,如下所示:

a <-c ("swipe","swiped", "electric", "blower", "shock", "wipe", "capacitor", "resistor")

我有一个需要拆分的句子:

b <- c("swipedshockelectricwipeblower") 

我需要以下输出:

c <- ("swiped", "shock", "electric", "wipe", "blower")

而且我不需要像下面这样的输出(因为我的单词列表中都有刷卡和刷卡)

c_wrong <- ("swipe", "d", "shock", "electric", "wipe", "blower")

标签: r

解决方案


推荐阅读