public Map<String, F1Measure> evaluateExamples(ExampleInput[] inputs,
			ExampleOutput[] corrects, ExampleOutput[] predicteds) {

		// Temporary sets to store the correct and predicted entities within
		// each example.
		HashSet<TypedEntity> correctEntities = new HashSet<TypedEntity>();
		HashSet<TypedEntity> predictedEntities = new HashSet<TypedEntity>();

		// Store the results for each class and one more for the overall
		// performance.
		TreeMap<String, F1Measure> res = new TreeMap<String, F1Measure>();

		// The overall performance.
		F1Measure overall = new F1Measure("overall");
		res.put(overall.getCaption(), overall);

		// Evaluate each sentence.
		for (int idxSeq = 0; idxSeq < corrects.length; ++idxSeq) {
			ExampleInput inputSeq = inputs[idxSeq];
			ExampleOutput correctSeq = corrects[idxSeq];
			ExampleOutput predictedSeq = predicteds[idxSeq];

			// Extract the correct entities.
			decodeEntities(inputSeq, correctSeq, correctEntities);

			// Extract the predicted entities.
			decodeEntities(inputSeq, predictedSeq, predictedEntities);

			// Count the total number of entities (nobjects) and the number of
			// correctly identified entities (nfullycorrect).
			for (TypedEntity ent : correctEntities) {
				// Skip ignored chunk types.
				if (validChunkTypes != null
						&& !validChunkTypes.contains(ent.getType()))
					continue;

				// Get (or create) the result for this type.
				F1Measure resCurClass = getResultByClass(res, ent.getType());

				resCurClass.incNumObjects();
				overall.incNumObjects();

				if (predictedEntities.contains(ent)) {
					resCurClass.incNumCorrectlyPredicted();
					overall.incNumCorrectlyPredicted();
				}
			}

			// Count the number of misidentified entities.
			for (TypedEntity ent : predictedEntities) {
				// Skip ignored chunk types.
				if (validChunkTypes != null
						&& !validChunkTypes.contains(ent.getType()))
					continue;

				F1Measure resCurClass = getResultByClass(res, ent.getType());
				resCurClass.incNumPredicted();
				overall.incNumPredicted();
			}

			// Clear the sets.
			correctEntities.clear();
			predictedEntities.clear();
		}

		return res;
	}