Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/regex/17.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何在Spark/Scala ML中使用RegexTokenizer()删除标记?_Regex_Scala_Apache Spark - Fatal编程技术网

如何在Spark/Scala ML中使用RegexTokenizer()删除标记?

如何在Spark/Scala ML中使用RegexTokenizer()删除标记?,regex,scala,apache-spark,Regex,Scala,Apache Spark,我有一个功能列,其中包含HTML标记。我想删除所有标签。 “body”列中一行数据的示例如下: "<p>Are questions related to and similar products on-topic?</p>" "are questions related to and similar products on-topic?" 以下是我的开始: val regexTokenizer = new RegexTokenizer() .setInputCol

我有一个功能列,其中包含HTML标记。我想删除所有标签。 “body”列中一行数据的示例如下:

"<p>Are questions related to and similar products on-topic?</p>"
"are questions related to and similar products on-topic?"
以下是我的开始:

val regexTokenizer = new RegexTokenizer()
  .setInputCol("body")
  .setOutputCol("removedTags")
  .setPattern("")

我想我需要修复.setPattern(),但不确定如何修复。

假设字符串中可能没有任何其他
,可能

<[^>]+>
]+>
替换为空字符串可能在某种程度上工作正常


如果您希望简化/修改/探索表达式,将在的右上面板中进行解释。如果您愿意,还可以在中查看它与一些示例输入的匹配情况