public void read(String dataFilename) {
        int length, count, word, n, nd, nw;

        System.out.println("reading data from " + dataFilename);

        try {
            Vector<Document> cdocs = new Vector<Document>();
            BufferedReader br = new BufferedReader(new FileReader(dataFilename));
            nd = 0;
            nw = 0;
            String line = "";
            while ((line = br.readLine()) != null) {
                String[] fields = line.split(" ");
                if (fields[0].equals("") || fields[0].equals(""))
                    continue;
                Document d = new Document();
                cdocs.add(d);
                length = Integer.parseInt(fields[0]);
                d.setLength(length);
                d.setTotal(0);
                d.setWords(new int[length]);
                d.setCounts(new int[length]);

                for (n = 0; n < length; n++) {
                    // fscanf(fileptr, "%10d:%10d", &word, &count);
                    String[] numbers = fields[n + 1].split(":");
                    if (numbers[0].equals("") || numbers[0].equals(""))
                        continue;
                    word = Integer.parseInt(numbers[0]);
                    count = (int) Float.parseFloat(numbers[1]);
                    word = word - OFFSET;
                    d.setWord(n, word);
                    d.setCount(n, count);
                    d.setTotal(d.getTotal() + count);
                    if (word >= nw) {
                        nw = word + 1;
                    }
                }

                nd++;
            }
            numDocs = nd;
            numTerms = nw;
            docs = (Document[]) cdocs.toArray(new Document[] {});
            System.out.println("number of docs    : " + nd);
            System.out.println("number of terms   : " + nw);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }