public void addTimexAnnotation ( String timexType , int begin , int end , Sentence sentence , String timexValue , String timexQuant , String timexFreq , String timexMod , String emptyValue , String timexId , String foundByRule , JCas jcas ) { Timex3 annotation = new Timex3 ( jcas ) ; annotation . setBegin ( begin ) ; annotation . setEnd ( end ) ; annotation . setFilename ( sentence . getFilename ( ) ) ; annotation . setSentId ( sentence . getSentenceId ( ) ) ; annotation . setEmptyValue ( emptyValue ) ; FSIterator iterToken = jcas . getAnnotationIndex ( Token . type ) . subiterator ( sentence ) ; String allTokIds = "" ; while ( iterToken . hasNext ( ) ) { Token tok = ( Token ) iterToken . next ( ) ; if ( tok . getBegin ( ) <= begin && tok . getEnd ( ) > begin ) { annotation . setFirstTokId ( tok . getTokenId ( ) ) ; allTokIds = "BEGIN<-->" + tok . getTokenId ( ) ; } if ( ( tok . getBegin ( ) > begin ) && ( tok . getEnd ( ) <= end ) ) { allTokIds = allTokIds + "<-->" + tok . getTokenId ( ) ; } } annotation . setAllTokIds ( allTokIds ) ; annotation . setTimexType ( timexType ) ; annotation . setTimexValue ( timexValue ) ; annotation . setTimexId ( timexId ) ; annotation . setFoundByRule ( foundByRule ) ; if ( ( timexType . equals ( "DATE" ) ) || ( timexType . equals ( "TIME" ) ) ) { if ( ( timexValue . startsWith ( "X" ) ) || ( timexValue . startsWith ( "UNDEF" ) ) ) { annotation . setFoundByRule ( foundByRule + "-relative" ) ; } else { annotation . setFoundByRule ( foundByRule + "-explicit" ) ; } } if ( ! ( timexQuant == null ) ) { annotation . setTimexQuant ( timexQuant ) ; } if ( ! ( timexFreq == null ) ) { annotation . setTimexFreq ( timexFreq ) ; } if ( ! ( timexMod == null ) ) { annotation . setTimexMod ( timexMod ) ; } annotation . addToIndexes ( ) ; this . timex_counter ++ ; Logger . printDetail ( annotation . getTimexId ( ) + "EXTRACTION PHASE: " + " found by:" + annotation . getFoundByRule ( ) + " text:" + annotation . getCoveredText ( ) ) ; Logger . printDetail ( annotation . getTimexId ( ) + "NORMALIZATION PHASE:" + " found by:" + annotation . getFoundByRule ( ) + " text:" + annotation . getCoveredText ( ) + " value:" + annotation . getTimexValue ( ) ) ; }
Add timex annotation to CAS object .