protected void generateLanguageModel() {
		double totalWord = 0;

		for (_Doc d : m_corpus.getCollection()) {
			if (d instanceof _ParentDoc)
				continue;
			_SparseFeature[] fv = d.getSparse();
			for (int i = 0; i < fv.length; i++) {
				int wid = fv[i].getIndex();
				double val = fv[i].getValue();

				totalWord += val;
				if (m_wordSstat.containsKey(wid)) {
					double oldVal = m_wordSstat.get(wid);
					m_wordSstat.put(wid, oldVal + val);
				} else {
					m_wordSstat.put(wid, val);
				}
			}
		}

		for (int wid : m_wordSstat.keySet()) {
			double val = m_wordSstat.get(wid);
			double prob = val / totalWord;
			m_wordSstat.put(wid, prob);
		}
	}