Find all the words of the same word. Now, take part of the dataset (below) to complete the project.
Project requirements
An English book contains thousands of words or phrases, and now we need to find all the anagrams (crossword puzzles) of the same alphabet in a large number of words.
Thinking analysis
Based on the above requirements, we have completed the following steps:
1. In the Map stage, each word (word) is sorted alphabetically by Sortedword and then output key/value key value pair (Sortedword,word).
2. In the Reduce phase, all anagrams (crossword puzzles) of the same letter group are counted.
1 First, open the MyEclipse,
Under Com.dajiangtai.hadoop.test package, create a new anagram class. Add the Main method.
2. Under the following folder, create a new anagram folder
3 Uploading a data source Anagram.txt
In the location of the Anagram folder, right-click, upload fles to DFS,
4, write the code in the Anagram.java. See Anagram.java.txt
Once the code is written, you can then run the 1 Java application.
After the refresh, the following.
5, Next, click part-r-00000 (186.1 kb,r3), then appear.
Well, at the moment, it's running successfully locally.
6, now, need to go to the cluster to run successfully, how to do it?
Export, Hadoop, export,
Java, JAR file, next
7, because, in Hadoop, these dependent racks are there, so we do not need to superfluous again packaging.
Take a name for the rack package, for Anagram.jar, first create a new folder jar in the D disk, store it in D:\JAR\anagram.jar, and click Finish.
8. Next, use Xshell to connect to CentOS.
9, RZ, open D:\JAR\anagram.jar, upload to CentOS
10. Execution of Orders
Hadoop jar Anagram.jar com.dajiangtai.hadoop.test.anagram/anagram//anagram/out/
11. View Results
Hadoop fs-text/anagram/out/part-r-00000
A quick introduction to the MapReduce program to find a crossword puzzle of the same alphabet