您好我想从Spark中的字符串中删除停用词。
说我输入字符串" Hello-people" ,然后我希望输出为(hello people),但我得到的是(hellopeople)
我的代码是:
def processLine(s: String, stopWords: Set[String]): Seq[String] = {
s.replaceAll("[^a-zA-Z ]", "").toLowerCase().split("\\s+")
s.filter(!stopWords.contains(_))
s.toSeq
}
答案 0 :(得分:0)
试试这个:
MetadataPropertyHandling
在replaceAll中只有一个变化," "而不是""