public void specifyAmbiguousValues ( JCas jcas ) { // build up a list with all found TIMEX expressions List < Timex3 > linearDates = new ArrayList < Timex3 > ( ) ; FSIterator iterTimex = jcas . getAnnotationIndex ( Timex3 . type ) . iterator ( ) ; // Create List of all Timexes of types "date" and "time" while ( iterTimex . hasNext ( ) ) { Timex3 timex = ( Timex3 ) iterTimex . next ( ) ; if ( timex . getTimexType ( ) . equals ( "DATE" ) || timex . getTimexType ( ) . equals ( "TIME" ) ) { linearDates . add ( timex ) ; } if ( timex . getTimexType ( ) . equals ( "DURATION" ) && ! timex . getEmptyValue ( ) . equals ( "" ) ) { linearDates . add ( timex ) ; } } ////////////////////////////////////////////// // go through list of Date and Time timexes // ////////////////////////////////////////////// for ( int i = 0 ; i < linearDates . size ( ) ; i ++ ) { Timex3 t_i = ( Timex3 ) linearDates . get ( i ) ; String value_i = t_i . getTimexValue ( ) ; String valueNew = value_i ; // handle the value attribute only if we have a TIME or DATE if ( t_i . getTimexType ( ) . equals ( "TIME" ) || t_i . getTimexType ( ) . equals ( "DATE" ) ) valueNew = specifyAmbiguousValuesString ( value_i , t_i , i , linearDates , jcas ) ; // handle the emptyValue attribute for any type if ( t_i . getEmptyValue ( ) != null && t_i . getEmptyValue ( ) . length ( ) > 0 ) { String emptyValueNew = specifyAmbiguousValuesString ( t_i . getEmptyValue ( ) , t_i , i , linearDates , jcas ) ; t_i . setEmptyValue ( emptyValueNew ) ; } t_i . removeFromIndexes ( ) ; Logger . printDetail ( t_i . getTimexId ( ) + " DISAMBIGUATION PHASE: foundBy:" + t_i . getFoundByRule ( ) + " text:" + t_i . getCoveredText ( ) + " value:" + t_i . getTimexValue ( ) + " NEW value:" + valueNew ) ; t_i . setTimexValue ( valueNew ) ; t_i . addToIndexes ( ) ; linearDates . set ( i , t_i ) ; } }
Under - specified values are disambiguated here . Only Timexes of types date and time can be under - specified .