public void loadDirectory ( String lexDir ) throws IOException { File path = new File ( lexDir ) ; if ( ! path . exists ( ) ) { throw new IOException ( "Lexicon directory [" + lexDir + "] does'n exists." ) ; } /* * load all the lexicon file under the lexicon path * that start with "lex-" and end with ".lex". */ File [ ] files = path . listFiles ( new FilenameFilter ( ) { @ Override public boolean accept ( File dir , String name ) { return ( name . startsWith ( "lex-" ) && name . endsWith ( ".lex" ) ) ; } } ) ; for ( File file : files ) { load ( file ) ; } }
load the all the words from all the files under a specified lexicon directory