Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
public class SplitSentence implements IBasicBolt {
public void prepare(Map conf, TopologyContext context) {
public void execute(Tuple tuple, BasicOutputCollector collector) {
String sentence = tuple.getString(0);
for(String word: sentence.split(" ")) {
collector.emit(new Values(word));
public void cleanup() {
public void declareOutputFields(OutputFieldsDeclarer declarer) {
declarer.declare(new Fields("word"));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.