predictNextConcept method
Predicts what concept is likely to follow conceptId based on
observed sequences. Returns a list of (conceptId, confidence) pairs.
Implementation
List<MapEntry<String, double>> predictNextConcept(String conceptId) {
final predictions = <MapEntry<String, double>>[];
final antFreq = _conceptFreq[conceptId] ?? 1;
for (final entry in _sequences.entries) {
final parts = entry.key.split('→');
if (parts.length != 2) continue;
if (parts[0] != conceptId) continue;
final confidence = entry.value / antFreq;
if (confidence >= 0.1) {
predictions.add(MapEntry(parts[1], confidence));
}
}
predictions.sort((a, b) => b.value.compareTo(a.value));
return predictions;
}