question: private void doTreeTag ( JCas jcas ) { try { if ( ttProc == null ) { ttProc = new TreeTaggerProcess ( ttprops . getTreeTaggingProcess ( ) ) ; } Logger . printDetail ( component , "TreeTagger (pos tagging) with: " + ttprops . parFileName ) ; AnnotationIndex ai = jcas . getAnnotationIndex ( Token . type ) ; List < String > tokenStrings = new ArrayList < > ( ) ; List < Token > tokens = new ArrayList < > ( ) ; for ( FSIterator fsi = ai . iterator ( ) ; fsi . hasNext ( ) ; ) { Token token = ( Token ) fsi . next ( ) ; tokenStrings . add ( token . getCoveredText ( ) ) ; tokens . add ( token ) ; } ttreader = new TreeTaggerReader ( tokens , ttProc . getStdout ( ) , jcas , annotate_sentences ) ; ttwriter = new TreeTaggerWriter ( tokenStrings , ttProc . getStdin ( ) ) ; Thread rThread = new Thread ( ttreader ) ; Thread wThread = new Thread ( ttwriter ) ; rThread . start ( ) ; wThread . start ( ) ; rThread . join ( ) ; wThread . join ( ) ; } catch ( IOException | InterruptedException e ) { e . printStackTrace ( ) ; } }
target:  based on tokens from the jcas object, adds part of speech (POS) and sentence tags to the jcas object using the treetagger program.