bindExplicit method
BindingResult
bindExplicit({
- required Concept concept1,
- required Concept concept2,
- required RelationshipType relationshipType,
- double? strength,
- ConceptEdge? existingEdge,
- String label = '',
Explicitly binds concept1 to concept2 with a specified
relationshipType and optional strength.
If existingEdge is non-null it is reinforced rather than replaced.
Implementation
BindingResult bindExplicit({
required Concept concept1,
required Concept concept2,
required RelationshipType relationshipType,
double? strength,
ConceptEdge? existingEdge,
String label = '',
}) {
if (existingEdge != null) {
final reinforced = math.min(
1.0,
existingEdge.strength + _reinforcementRate,
);
_logger.debug(
'Reinforced binding: ${concept1.id} ↔ ${concept2.id} '
'(${existingEdge.strength.toStringAsFixed(2)} → '
'${reinforced.toStringAsFixed(2)})');
return BindingResult(
conceptId1: concept1.id,
conceptId2: concept2.id,
strength: reinforced,
relationshipType: relationshipType,
label: label,
wasReinforced: true,
);
}
final s = strength ?? _baseBindingStrength;
_logger.debug(
'New binding: "${concept1.content}" ↔ "${concept2.content}" '
'(${relationshipType.name}, ${s.toStringAsFixed(2)})');
return BindingResult(
conceptId1: concept1.id,
conceptId2: concept2.id,
strength: s,
relationshipType: relationshipType,
label: label,
wasReinforced: false,
);
}