public void addWord(String word) {
        if (word.length() < 1) {
            System.err.println("Cannot extract n-grams from " + word);
            System.exit(1);
        }


        if (this.unit == Unit.CHAR) {
            word = word + EOW;
            String s = new String();
            while (s.length() < order) {
                s += BOW;
            }
            for (int last = 0; last < word.length(); ++last) {
                s = tail(s) + word.charAt(last);
                for (int first = 0; first <= s.length(); ++first) {
                    addEntry(s.substring(first));
                }
            }
        } else {
            String nword = syl.split(word);
            nword = nword + "-" + EOW;


            String toadd = "";
            for (int i = 0; i < order; i++) {
                toadd += BOW + "-";
            }

            int numsyl = syl.countSyllables(nword);
            nword = toadd + nword;
            String neww;
            for (int i = 0; i < numsyl;) {
                neww = syl.getSyl(nword, ++i, (int)(i + order - 1));

                for (int first = 0; first <= order; ++first) {
                    addEntry(syl.getSyl(neww, first, (int)order));
                }

            }

        }
    }