public void GenerateCorpusWords() {
        for (String doc : corpus) {
            Scanner scanner = new Scanner(doc);

            int lastIndex = 0;
            int count = 0;
            TreeMap<String, Integer> currentDocMap = new TreeMap<String, Integer>();

            try {
                while (scanner.hasNext()) {
                    String current = scanner.next();
                    lastIndex = doc.indexOf(current, lastIndex);

                    if (lastIndex != -1) {
                        count++;
                        lastIndex += current.length();
                    }
                    currentDocMap.put(current, count);
                }
            } finally {
                scanner.close();
            }
        }
    }