public class VocabularyBuilder {
public String[] buildVocabulary( String fileName, int count) throws IOException {
String[] vocab = new String[count];
Scanner scanner = null;
try{
scanner = new Scanner(new BufferedReader(new FileReader(fileName)));
scanner.useDelimiter("[\\.\\?!\",:;]*\\s+\"?");
HashSet<String> wordSet = new HashSet<String>();
while(scanner.hasNext()){
String word = scanner.next();
wordSet.add(word.toLowerCase());
Arrays.sort(vocab);
}
}
finally{