public static void main(String args[]) throws IOException { MyIn in = new MyIn(); Spelling spelling = Spelling.getInstance(); while (in.hasNextLine()) { System.out.println(spelling.correct(in.nextLine())); } }
public Spelling(MyIn in) throws IOException { while (in.hasNextLine()) { String[] split = in.nextLine().split("\t"); nWords.put(split[0], Double.parseDouble(split[1])); } }