private void addParseEvents ( final List < Event > parseEvents , Parse [ ] chunks ) { int ci = 0 ; while ( ci < chunks . length ) { // System.err.println("parserEventStream.addParseEvents: chunks=" + // Arrays.asList(chunks)); final Parse c = chunks [ ci ] ; final Parse parent = c . getParent ( ) ; if ( parent != null ) { final String type = parent . getType ( ) ; String outcome ; if ( firstChild ( c , parent ) ) { outcome = type + "-" + BioCodec . START ; } else { outcome = type + "-" + BioCodec . CONTINUE ; } // System.err.println("parserEventStream.addParseEvents: // chunks["+ci+"]="+c+" label=" +outcome + " bcg=" + bcg); c . setLabel ( outcome ) ; if ( this . etype == ParserEventTypeEnum . BUILD ) { parseEvents . add ( new Event ( outcome , this . bcg . getContext ( chunks , ci ) ) ) ; } int start = ci - 1 ; while ( start >= 0 && chunks [ start ] . getParent ( ) == parent ) { start -- ; } if ( lastChild ( c , parent ) ) { if ( this . etype == ParserEventTypeEnum . CHECK ) { parseEvents . add ( new Event ( ShiftReduceParser . COMPLETE , this . kcg . getContext ( chunks , type , start + 1 , ci ) ) ) ; } // perform reduce int reduceStart = ci ; while ( reduceStart >= 0 && chunks [ reduceStart ] . getParent ( ) == parent ) { reduceStart -- ; } reduceStart ++ ; chunks = reduceChunks ( chunks , ci , parent ) ; ci = reduceStart - 1 ; // ci will be incremented at end of loop } else { if ( this . etype == ParserEventTypeEnum . CHECK ) { parseEvents . add ( new Event ( ShiftReduceParser . INCOMPLETE , this . kcg . getContext ( chunks , type , start + 1 , ci ) ) ) ; } } } ci ++ ; } }
Adds events for parsing ( post tagging and chunking to the specified list of events for the specified parse chunks .