Guest User

Untitled

a guest
Nov 22nd, 2017
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.54 KB | None | 0 0
  1. public static class TokenizerMapper extends Mapper<Object, Text, Text, IntWritable> {
  2. private static final Pattern pattern = Pattern.compile("\"([^\"]*)\"");
  3. private final static IntWritable one = new IntWritable(1);
  4. private Text word = new Text();
  5.  
  6. public void map(Object key, Text value, Context context) throws IOException, InterruptedException {
  7. Matcher matcher = pattern.matcher(value.toString());
  8. if (matcher.find()) {
  9. word.set(matcher.group(0));
  10. context.write(word, one);
  11. }
  12. }
  13. }
Add Comment
Please, Sign In to add comment