@Override
	public Boolean[] segment(Utterance utterance, boolean training, boolean trace) {
		// Get info about the utterance. Since the segmentation is a copy,
		// don't worry about modifying it
		Boolean[] segmentation = utterance.getBoundariesCopy();
		String[] units = utterance.getUnits();

		// Track probabilities in a window around the current position. This can be optimized by
		// saving the previous TP lookups rather than computing them again and again.
		for (int i = 1; i < units.length - 2; i++) {
			double prevProb = transProb(units[i - 1], units[i]);
			double currProb = transProb(units[i], units[i + 1]);
			double nextProb = transProb(units[i + 1], units[i + 2]);
			// Insert a boundary if we're in a "trough"; the preceding and following TPs are higher
			if (prevProb > currProb && nextProb > currProb) {
				segmentation[i] = true;
				segs++;
			}
		}

		// Increment the words used in the utterance and update probabilities if we're training.
		if (training) {
			lexicon.incUtteranceWords(utterance.getUnits(), utterance.getStresses(), segmentation,
					null);
			train(utterance);
		}

		return segmentation;
	}