public Dictionary parseDictionaryFromFile(File file) throws FileNotFoundException, IOException {
        Dictionary lexicon = new Dictionary();
        int linenum = 0;
        if (file.getName().endsWith("txt")) {		
            String filename = file.getPath();
            lexicon.setFile(file);
            Logger.getGlobal().finest("Parsing dictionary file " + file.getName());
			FileReader dictionary = new FileReader(filename);
            BufferedReader into = new BufferedReader(dictionary);
			while (into.ready()) {
                try {
                    String line = into.readLine().trim();
                    String[] linesplit = line.split(",");
                    if (linesplit.length > 1) {
                        if (linesplit[0].trim().length() > 0)
                            addItemToDictionary(lexicon,linesplit[0].trim(),linesplit[1].trim(),++linenum);
                    } else {
                        if (linesplit[0].trim().length() > 0)
                            addItemToDictionary(lexicon,linesplit[0].trim(),"NONE",++linenum);
                    }
                } catch (Throwable _t) {
                    Logger.getGlobal().log(
                            Level.SEVERE, "Error reading dictionary.", _t);
                }
			}
			into.close();
        }
        Logger.getGlobal().finest("Dictionary has " + lexicon.size() + " terms.");
        return lexicon;
    }