analysisPipe = new Each(analysisPipe, new ParseEmailFunction());
// We'll get output that has ANALYZED_EMAIL_FIELDS in it. We want to group by
// the message-id field, and then do an aggregation on that of the scores.
analysisPipe = new GroupBy(analysisPipe, new Fields(FieldNames.MESSAGE_ID));
analysisPipe = new Every(analysisPipe, new CalcMessageScoreBuffer(), Fields.RESULTS);
// Now we want to sum the scores for each user, which is another grouping/summing.
analysisPipe = new GroupBy(analysisPipe, new Fields(FieldNames.EMAIL_ADDRESS));
analysisPipe = new Every(analysisPipe, new SumScoresBuffer(), Fields.RESULTS);
// Let's filter out anybody with an uninteresting score.
ExpressionFilter filter = new ExpressionFilter(String.format("%s <= 0.0", FieldNames.SUMMED_SCORE), Double.class);
analysisPipe = new Each(analysisPipe, filter);