@Override public void flatMap(String value, Collector<Word> out) { // normalize and split the line String[] tokens = value.toLowerCase().split("\\W+"); // emit the pairs for (String token : tokens) { if (token.length() > 0) { out.collect(new Word(token, 1)); } } } }
@Override public void flatMap(String value, Collector<Word> out) { // normalize and split the line String[] tokens = value.toLowerCase().split("\\W+"); // emit the pairs for (String token : tokens) { if (token.length() > 0) { out.collect(new Word(token, 1)); } } } }
@Override public Word reduce(Word value1, Word value2) throws Exception { return new Word(value1.word, value1.frequency + value2.frequency); } });
@Override public Word reduce(Word value1, Word value2) throws Exception { return new Word(value1.word,value1.frequency + value2.frequency); } });
@Override public void flatMap(String value, Collector<Word> out) { // normalize and split the line String[] tokens = value.toLowerCase().split("\\W+"); // emit the pairs for (String token : tokens) { if (token.length() > 0) { out.collect(new Word(token, 1)); } } } }
@Override public Word reduce(Word value1, Word value2) throws Exception { return new Word(value1.word, value1.frequency + value2.frequency); } });
@Override public void flatMap(String value, Collector<Word> out) { // normalize and split the line String[] tokens = value.toLowerCase().split("\\W+"); // emit the pairs for (String token : tokens) { if (token.length() > 0) { out.collect(new Word(token, 1)); } } } }
@Override public Word reduce(Word value1, Word value2) throws Exception { return new Word(value1.word, value1.frequency + value2.frequency); } });