reinforceAssociation method

void reinforceAssociation(
  1. String entity1,
  2. String entity2, {
  3. double strength = 0.2,
})

Reinforces the association between two entities/concepts.

strength can be negative to weaken the association.

Implementation

void reinforceAssociation(
  String entity1,
  String entity2, {
  double strength = 0.2,
}) {
  final key = _associationKey(entity1, entity2);
  final current = _associations[key] ?? 0.0;
  _associations[key] = (current + strength).clamp(-1.0, 1.0);
  _logger.debug(
      'Association "$entity1" ↔ "$entity2": '
      '${_associations[key]!.toStringAsFixed(2)}');
}