public static Counter<String> readWeightsPlain(String filename) throws IOException {
  LineNumberReader reader=new LineNumberReader(new FileReader(filename));
  Counter<String> wts=new ClassicCounter<String>();
  for (String line; (line=reader.readLine()) != null; ) {
    String[] input=line.split(" ");
    if (input.length != 2) {
      reader.close();
      throw new IOException("Illegal input in weight file " + filename + ": "+ line);
    }
    wts.setCount(input[0],Double.parseDouble(input[1]));
  }
  reader.close();
  return wts;
}

public static Counter < String > readWeightsPlain ( String filename ) throws IOException { LineNumberReader reader = new LineNumberReader ( new FileReader ( filename ) ) ; Counter < String > wts = new ClassicCounter < String > ( ) ; for ( String line ; ( line = reader . readLine ( ) ) != null ; ) { String [ ] input = line . split ( " " ) ; if ( input . length != 2 ) { reader . close ( ) ; throw new IOException ( "Illegal input in weight file " + filename + ": " + line ) ; } wts . setCount ( input [ 0 ] , Double . parseDouble ( input [ 1 ] ) ) ; } reader . close ( ) ; return wts ; }
read weights from a plain text file .
