class MarkovChainLanguageModel {

	public void train(Locale language, String example, String encoding) throws UnsupportedEncodingException {
		if (!chains.containsKey(language)) {
			chains.put(language, new Matrix(256 + 1, 256 + 1));
			chainCounts.put(language, new long[256 + 1]);
		}

		final Matrix chain = chains.get(language);
		final long[] chainCount = chainCounts.get(language);
		final byte[] data = example.getBytes(encoding);

		int currentIndex = 0;
		final double[][] chainData = chain.getArray();
		for (final byte b : data) {
			final int newIndex = (b & 0xff) + 1;
			chainData[currentIndex][newIndex] = chainData[currentIndex][newIndex] + 1;
			chainCount[currentIndex] += 1;
			currentIndex = newIndex;
		}

	}

	public  MarkovChainLanguageModel();

}