Tap leftSink = getPlatform().getTextFile( getOutputPath( "left" ), SinkMode.REPLACE );
Tap rightSink = getPlatform().getTextFile( getOutputPath( "right" ), SinkMode.REPLACE );
Pipe uniques = new Pipe( "unique" );
uniques = new Each( uniques, new Fields( "line" ), new RegexSplitGenerator( new Fields( "word" ), "\\s" ) );
uniques = new GroupBy( uniques, new Fields( "word" ) );
uniques = new Every( uniques, new Fields( "word" ), new First( Fields.ARGS ), Fields.REPLACE );
// uniques = new Each( uniques, new Debug( true ) );
Pipe fielded = new Pipe( "fielded" );
fielded = new Each( fielded, new Fields( "line" ), new RegexSplitter( "\\s" ) );
// fielded = new Each( fielded, new Debug( true ) );
Pipe inner = new CoGroup( "inner", fielded, new Fields( 0 ), uniques, new Fields( "word" ), new InnerJoin() );
Pipe outer = new CoGroup( "outer", fielded, new Fields( 0 ), uniques, new Fields( "word" ), new OuterJoin() );