question: protected final void fillSentence ( Element sentence , Utterance utterance ) { Document doc = sentence . getOwnerDocument ( ) ; Relation tokenRelation = utterance . getRelation ( Relation . TOKEN ) ; if ( tokenRelation == null ) return ; Item tokenItem = tokenRelation . getHead ( ) ; Relation phraseRelation = utterance . getRelation ( Relation . PHRASE ) ; Item phraseItem = null ; if ( phraseRelation != null ) { phraseItem = phraseRelation . getHead ( ) ; while ( phraseItem != null ) { Element phrase = MaryXML . createElement ( doc , MaryXML . PHRASE ) ; sentence . appendChild ( phrase ) ; Element insertHere = phrase ; while ( tokenItem != null && tokenItem . getDaughter ( ) . findItem ( "R:Phrase.parent" ) . equals ( phraseItem ) ) { FeatureSet tokenFeatures = tokenItem . getFeatures ( ) ; if ( tokenFeatures . isPresent ( XML2UttBase . PROSODY_START ) ) { Element prosody = insertProsodySettings ( insertHere , tokenFeatures ) ; if ( prosody != null ) { insertHere = prosody ; } } insertToken ( tokenItem , phrase , true ) ; if ( tokenFeatures . isPresent ( XML2UttBase . PROSODY_END ) ) { assert insertHere . getTagName ( ) . equals ( MaryXML . PROSODY ) ; insertHere = ( Element ) insertHere . getParentNode ( ) ; } tokenItem = tokenItem . getNext ( ) ; } phraseItem = phraseItem . getNext ( ) ; } } else { Element insertHere = sentence ; while ( tokenItem != null ) { FeatureSet tokenFeatures = tokenItem . getFeatures ( ) ; if ( tokenFeatures . isPresent ( XML2UttBase . PROSODY_START ) ) { Element prosody = insertProsodySettings ( insertHere , tokenFeatures ) ; if ( prosody != null ) { insertHere = prosody ; } } insertToken ( tokenItem , insertHere ) ; if ( tokenFeatures . isPresent ( XML2UttBase . PROSODY_END ) ) { if ( insertHere . getTagName ( ) . equals ( MaryXML . PROSODY ) ) { insertHere = ( Element ) insertHere . getParentNode ( ) ; } } tokenItem = tokenItem . getNext ( ) ; } } }
target:  Depending on the data type, find the right information in the utterance and insert it into the sentence.