04 2021 档案

摘要:一、词频统计: 1.读文本文件生成RDD lines >>> lines = sc.textFile('file:///home/hadoop/word.txt') 2.将一行一行的文本分割成单词 words flatmap() >>> words=lines.flatMap(lambda line 阅读全文
posted @ 2021-04-17 16:58 隔壁老尤 阅读(72) 评论(0) 推荐(0)
摘要:import operator import os #打开文件 speech_text='' try: f = open(os.path.abspath('text.txt'),'r') speech_text = f.read() f.close() except: print("File Ope 阅读全文
posted @ 2021-04-09 15:38 隔壁老尤 阅读(49) 评论(0) 推荐(0)
摘要:一、词频统计: 1.读文本文件生成RDD lines 2.将一行一行的文本分割成单词 words flatmap() lines=sc.textFile("file:///usr/local/spark/mycode/wordcount/word.txt") words = lines.flatMa 阅读全文
posted @ 2021-04-05 13:29 隔壁老尤 阅读(94) 评论(0) 推荐(0)