spark Tokenization的用法
来源:互联网 发布:旅行商问题背包算法 编辑:程序博客网 时间:2024/06/18 01:32
声明:版权所有,转载请联系作者并注明出处 http://blog.csdn.net/u013719780?viewmode=contents
博主简介:风雪夜归子(Allen),机器学习算法攻城狮,喜爱钻研Meachine Learning的黑科技,对Deep Learning和Artificial Intelligence充满兴趣,经常关注Kaggle数据挖掘竞赛平台,对数据、Machine Learning和Artificial Intelligence有兴趣的童鞋可以一起探讨哦,个人CSDN博客:http://blog.csdn.net/u013719780?viewmode=contents
Tokenization是将文本(例如句子)分割成单词,
RegexTokenizer是基于正则表达式进行单词分割,默认打分割方式是'\s+',
具体应用如下:
from pyspark.ml.feature import Tokenizer, RegexTokenizersentenceDataFrame = sqlContext.createDataFrame([ (0, "Hi I heard about Spark"), (1, "I wish Java could use case classes"), (2, "Logistic,regression,models,are,neat")], ["label", "sentence"])tokenizer = Tokenizer(inputCol="sentence", outputCol="words")wordsDataFrame = tokenizer.transform(sentenceDataFrame)wordsDataFrame.select("words", "label").show(5, False)regexTokenizer = RegexTokenizer(inputCol="sentence", outputCol="words", pattern="\\W")# alternatively, pattern="\\w+", gaps(False)regexTokenizer.transform(sentenceDataFrame).show(5, False)
1 0
- spark Tokenization的用法
- spark的aggregateByKey简单用法
- Tokenization for beginners
- Tokenization in C++11
- FLEX 4.6 Spark DataGrid 一些的用法
- Spark中repartition和coalesce的用法
- spark rdd checkpoint的用法注意点
- Spark中repartition和coalesce的用法
- spark rdd checkpoint的用法注意点
- Spark中repartition和coalesce的用法
- Spark中repartition和coalesce的用法
- Spark Streaming DSstream 的updateByKey用法
- Finding parts of Text--Tokenization
- spark 的transformations之map,flatMap,mapPartitions,mapPartitionsWithIndex的用法
- spark streaming updateStateByKey 用法
- spark streaming updateStateByKey 用法
- spark streaming updateStateByKey 用法
- spark streaming updateStateByKey 用法
- ActiveMQ.Advisory
- chart5 初始化和清理
- 学习笔记gulp的使用
- 数组中重复的数字
- js知识点2
- spark Tokenization的用法
- 如何监听虚拟键盘的点击事件
- js知识点3
- 关闭Adobe acrobat的自动更新功能
- chart6 访问权限控制
- js知识点4
- LeetCode-Missing Number
- 如何在myeclipse里配置多个tomcat
- vim剪切命令