public boolean prune() {

        boolean ret = false;
        int red = 0;

        Set<Character> alphabet = I.next.keySet();
        int n = 0;
        for (Character c : alphabet) {
            n += I.next(c).getTimes();
        }

        double K = (2 * alphabet.size() + 4) * (Math.log(n) / Math.log(2)) * ratio;
        double sum = 0;

        Set<State> terminal = I.getTerminal();

        for (State t : terminal) {
            sum = 0;
            String u = t.getFullName();
            String w = u.substring(1, u.length());
            for (Character c : alphabet) {


                double uc = condProb(u + c);
                double wc = condProb(w + c);
                if ((uc > 0) && (wc > 0)) {
                    sum += uc * (Math.log(uc / wc) / Math.log(2)) * times(u);
                }
            }

            // si l'estat es irrelevant l'eliminem
            if (sum < K) {
                t.delete();
                ret = true;
                red++;
            }
        }

        return ret;
    }