Here's a quick but comprehensive introduction to the idea of splitting tasks into a MapReduce model.
The four important functions involved are:
Map (the mapper function)
EmitIntermediate(the intermediate key,value pairs emitted by the mapper functions)
Reduce (the reducer function)
Emit (the final output, after summarization from the Reduce functions)
We provide you with a single system, single thread version of a basic MapReduce implementation.
The task is to compute the word-frequency-counts of the different words in an input chunk of text. The code for the MapReduce class, reading and splitting the text into words, parts of IO etc. has already been provided.
However certain parts of the mapper and reducer functions are incomplete. You need to replace the questionmarks (?). Your task is to fill up these question marks appropriately, such that the program works, and outputs the number of times each word occurs.
Also, this program outputs certain information to the error stream. This information has been logged to help beginners gain a better understanding of the the intermediate steps in a map-reduce process.
Currently, we provide the base code in Ruby, java and python.
A given fragment of text. The code for IO as well as word tokenization has already been provided by us. Only make additions to the mapper and reducer functions to complete them, as suitable.
Key-value pairs, in JSON format. The 'key' is a word from the input text and the 'value' is the number of times it occurs.
Military general and first emperor of France, Napoleon Bonaparte was born on August 15, 1769, in Ajaccio, Corsica, France. One of the most celebrated leaders in the history of the West, he revolutionized military organization and training, sponsored Napoleonic Code, reorganized education and established the long-lived Concordat with the papacy. He died on May 5, 1821, on the island of St. Helena in the South Atlantic Ocean.
Considered one of the world's greatest military leaders, Napoleon Bonaparte was born on August 15, 1769, in Ajaccio, Corsica, France. He was the fourth, and second surviving, child of Carlo Buonaparte, a lawyer, and his wife, Letizia Ramolino.
By the time around Napoleon's birth, Corsica's occupation by the French had drawn considerable local resistance. Carlo Buonaparte had at first supported the nationalists siding with their leader, Pasquale Paoli. But after Paoli was forced to flee the island, Carlo switched his allegiance to the French. After doing so he was appointed assessor of the judicial district of Ajaccio in 1771, a plush job that eventually enabled him to enroll his two sons, Joseph and Napoleon, in France's College d'Autun.
Eventually, Napoleon ended up at the military college of Brienne, where he studied for five years, before moving on to the military academy in Paris. In 1785, while Napoleon was at the academy, his father died of stomach cancer. This propelled Napoleon to take the reins as the head of the family. Graduating early from the military academy, Napoleon, now second lieutenant of artillery, returned to Corsica in 1786.