1.9 KiB
1.9 KiB
README_rule.md
Overview
rule.py implements the Rule system, a key component of the Copycat system that manages the transformation rules used in analogical reasoning. It handles the creation, evaluation, and application of rules that describe how to transform strings based on their properties and relationships.
Core Components
Ruleclass: Main class that represents a transformation rule- Rule evaluation system
- Rule translation and application system
Key Features
- Defines transformation rules with facets, descriptors, categories, and relations
- Evaluates rule strength based on multiple factors
- Supports rule translation through concept slippages
- Handles string transformations based on rules
- Manages rule compatibility with correspondences
Rule Components
facet: The aspect of the object to change (e.g., length)descriptor: The property being changedcategory: The type of object being changedrelation: The transformation to apply
Main Methods
updateInternalStrength(): Calculate rule strengthupdateExternalStrength(): Update external strengthactivateRuleDescriptions(): Activate rule-related conceptsbuildTranslatedRule(): Apply rule to target stringincompatibleRuleCorrespondence(): Check rule-correspondence compatibilityruleEqual(): Compare rules for equality
Rule Types
- Length-based rules (predecessor, successor)
- Character-based rules (predecessor, successor)
- Category-based rules
Dependencies
- Requires
workspaceStructureandformulasmodules - Uses
loggingfor debug output - Used by the main
copycatmodule
Notes
- Rules are evaluated based on conceptual depth and descriptor sharing
- Rule strength is calculated using weighted averages
- Rules can be translated through concept slippages
- The system supports both single-character and length-based transformations
- Rules can be incompatible with certain correspondences