public static List doFeatureGen ( Map map , String text , List markList , boolean label ) { markList . clear ( ) ; //Find out positions of .!? and store them in the markList int nextPos = 0 ; while ( ( nextPos = StringUtils . findFirstOf ( text , ".!?" , nextPos + 1 ) ) != - 1 ) markList . add ( new Integer ( nextPos ) ) ; //Generate context predicates at those positions List results = new ArrayList ( ) ; for ( int i = 0 ; i < markList . size ( ) ; ++ i ) { int curPos = ( ( Integer ) markList . get ( i ) ) . intValue ( ) ; String record = genCPs ( map , text , curPos ) ; //Assign label to feature string if it is specified if ( label ) { int idx = StringUtils . findFirstNotOf ( text , " \t" , curPos + 1 ) ; if ( idx == - 1 || ( text . charAt ( idx ) == ' ' ) ) { //end of sentence record += " " + "y" ; } else record += " " + "n" ; } results . add ( record ) ; } return results ; }
Generate context predicates for a specified text return string representing the context predicates .