protected void collectFeatures ( String prefix , String suffix , String previous , String next , char eosChar ) { buf . append ( "x=" ) ; buf . append ( prefix ) ; collectFeats . add ( buf . toString ( ) ) ; buf . setLength ( 0 ) ; if ( ! prefix . equals ( "" ) ) { collectFeats . add ( Integer . toString ( prefix . length ( ) ) ) ; if ( isFirstUpper ( prefix ) ) { collectFeats . add ( "xcap" ) ; } if ( inducedAbbreviations . contains ( prefix + eosChar ) ) { collectFeats . add ( "xabbrev" ) ; } char c = prefix . charAt ( 0 ) ; if ( prefix . length ( ) == 1 && Character . isLetter ( c ) && Character . isUpperCase ( c ) && eosChar == ' ' ) { // looks like name abb collectFeats . add ( "xnabb" ) ; } } buf . append ( "v=" ) ; buf . append ( previous ) ; collectFeats . add ( buf . toString ( ) ) ; buf . setLength ( 0 ) ; if ( ! previous . equals ( "" ) ) { if ( isFirstUpper ( previous ) ) { collectFeats . add ( "vcap" ) ; } if ( inducedAbbreviations . contains ( previous ) ) { collectFeats . add ( "vabbrev" ) ; } } buf . append ( "s=" ) ; buf . append ( suffix ) ; collectFeats . add ( buf . toString ( ) ) ; buf . setLength ( 0 ) ; if ( ! suffix . equals ( "" ) ) { if ( isFirstUpper ( suffix ) ) { collectFeats . add ( "scap" ) ; } if ( inducedAbbreviations . contains ( suffix ) ) { collectFeats . add ( "sabbrev" ) ; } } buf . append ( "n=" ) ; buf . append ( next ) ; collectFeats . add ( buf . toString ( ) ) ; buf . setLength ( 0 ) ; if ( ! next . equals ( "" ) ) { if ( isFirstUpper ( next ) ) { collectFeats . add ( "ncap" ) ; } if ( inducedAbbreviations . contains ( next ) ) { collectFeats . add ( "nabbrev" ) ; } } }
Determines some of the features for the sentence detector and adds them to list features .