MapReduce编程小案例.4th—倒排索引创建
需求:有大量的文本文档,如下所示:
a.txt
hello tom hello jim hello kitty hello rose |
b.txt
hello jerry hello jim hello kitty hello jack |
c.txt
hello jerry hello java hello c++ hello c++ |
需要得到以下结果:
hello a.txt-->4 b.txt-->4 c.txt-->4 java c.txt-->1 jerry b.txt-->1 c.txt-->1 .... |
思路:
1、先写一个mr程序:统计出每个单词在每个文件中的总次数
hello-a.txt 4
hello-b.txt 4
hello-c.txt 4
java-c.txt 1