public static synchronized void setProperties ( Properties props ) { wordLimit = Integer . parseInt ( props . getProperty ( TOKEN_COUNT_LIMIT_PROPERTY , "0" ) ) ; String filterProp = props . getProperty ( TOKEN_FILTER_PROPERTY ) ; filter = ( filterProp != null ) ? TokenFilter . loadFromSpecification ( filterProp , resourceFinder ) : null ; // NOTE: future implementations may interpret the value of this property // to decide which stemmer to use String stemmerProp = props . getProperty ( STEMMER_PROPERTY ) ; if ( stemmerProp != null ) stemmer = ReflectionUtil . < Stemmer > getObjectInstance ( stemmerProp ) ; String compoundTokensProp = props . getProperty ( COMPOUND_TOKENS_FILE_PROPERTY ) ; if ( compoundTokensProp != null ) { // Load the tokens from file compoundTokens = new LinkedHashSet < String > ( ) ; try { BufferedReader br = resourceFinder . open ( compoundTokensProp ) ; for ( String line = null ; ( line = br . readLine ( ) ) != null ; ) { compoundTokens . add ( line ) ; } // For any currently processing threads, update their mapped // iterator with the new set of tokens for ( Map . Entry < Thread , CompoundWordIterator > e : compoundIterators . entrySet ( ) ) { // Create an empy dummy BufferedReader, which will be // discarded upon the next .reset() call to the iterator BufferedReader dummyBuffer = new BufferedReader ( new StringReader ( "" ) ) ; e . setValue ( new CompoundWordIterator ( dummyBuffer , compoundTokens ) ) ; } } catch ( IOException ioe ) { // rethrow throw new IOError ( ioe ) ; } } else { // If the user did not specify a set of compound tokens, null out // the set, in the event that there was one previously compoundTokens = null ; } String replacementProp = props . getProperty ( TOKEN_REPLACEMENT_FILE_PROPERTY ) ; if ( replacementProp != null ) { try { BufferedReader br = resourceFinder . open ( replacementProp ) ; replacementMap = new HashMap < String , String > ( ) ; String line = null ; while ( ( line = br . readLine ( ) ) != null ) { String [ ] termReplacement = line . split ( "\\s+" ) ; replacementMap . put ( termReplacement [ 0 ] , termReplacement [ 1 ] ) ; } } catch ( IOException ioe ) { throw new IOError ( ioe ) ; } } else replacementMap = null ; }
Reconfigures the type of iterator returned by this factory based on the specified properties .