Demagic WorkspaceStructure. NFC.
This commit is contained in:
@ -5,7 +5,8 @@ class Bond(WorkspaceStructure):
|
||||
# pylint: disable=too-many-arguments
|
||||
def __init__(self, source, destination, bondCategory, bondFacet,
|
||||
sourceDescriptor, destinationDescriptor):
|
||||
WorkspaceStructure.__init__(self)
|
||||
from context import context as ctx
|
||||
WorkspaceStructure.__init__(self, ctx)
|
||||
slipnet = self.ctx.slipnet
|
||||
self.source = source
|
||||
self.string = self.source.string
|
||||
|
||||
@ -4,7 +4,12 @@ import random
|
||||
|
||||
import codeletMethods
|
||||
import formulas
|
||||
from bond import Bond
|
||||
from codelet import Codelet
|
||||
from correspondence import Correspondence
|
||||
from description import Description
|
||||
from group import Group
|
||||
from rule import Rule
|
||||
|
||||
|
||||
NUMBER_OF_BINS = 7
|
||||
@ -192,8 +197,6 @@ class Coderack(object):
|
||||
The new codelet has urgency a function of
|
||||
the degree of conceptual-depth of the descriptions in the rule
|
||||
"""
|
||||
from rule import Rule
|
||||
|
||||
rule = Rule(facet, description, category, relation)
|
||||
rule.updateStrength()
|
||||
if description and relation:
|
||||
@ -206,8 +209,6 @@ class Coderack(object):
|
||||
|
||||
def proposeCorrespondence(self, initialObject, targetObject,
|
||||
conceptMappings, flipTargetObject, oldCodelet):
|
||||
from correspondence import Correspondence
|
||||
|
||||
correspondence = Correspondence(initialObject, targetObject,
|
||||
conceptMappings, flipTargetObject)
|
||||
for mapping in conceptMappings:
|
||||
@ -227,8 +228,6 @@ class Coderack(object):
|
||||
oldCodelet, urgency, correspondence)
|
||||
|
||||
def proposeDescription(self, objekt, type_, descriptor, oldCodelet):
|
||||
from description import Description
|
||||
|
||||
description = Description(objekt, type_, descriptor)
|
||||
descriptor.buffer = 100.0
|
||||
urgency = type_.activation
|
||||
@ -242,7 +241,6 @@ class Coderack(object):
|
||||
|
||||
def proposeGroup(self, objects, bondList, groupCategory, directionCategory,
|
||||
bondFacet, oldCodelet):
|
||||
from group import Group
|
||||
slipnet = self.ctx.slipnet
|
||||
bondCategory = groupCategory.getRelatedNode(slipnet.bondCategory)
|
||||
bondCategory.buffer = 100.0
|
||||
@ -255,8 +253,6 @@ class Coderack(object):
|
||||
|
||||
def proposeBond(self, source, destination, bondCategory, bondFacet,
|
||||
sourceDescriptor, destinationDescriptor, oldCodelet):
|
||||
from bond import Bond
|
||||
|
||||
bondFacet.buffer = 100.0
|
||||
sourceDescriptor.buffer = 100.0
|
||||
destinationDescriptor.buffer = 100.0
|
||||
|
||||
@ -7,7 +7,8 @@ import formulas
|
||||
class Correspondence(WorkspaceStructure):
|
||||
def __init__(self, objectFromInitial, objectFromTarget,
|
||||
conceptMappings, flipTargetObject):
|
||||
WorkspaceStructure.__init__(self)
|
||||
from context import context as ctx
|
||||
WorkspaceStructure.__init__(self, ctx)
|
||||
self.objectFromInitial = objectFromInitial
|
||||
self.objectFromTarget = objectFromTarget
|
||||
self.conceptMappings = conceptMappings
|
||||
|
||||
@ -4,7 +4,8 @@ from workspaceStructure import WorkspaceStructure
|
||||
|
||||
class Description(WorkspaceStructure):
|
||||
def __init__(self, workspaceObject, descriptionType, descriptor):
|
||||
WorkspaceStructure.__init__(self)
|
||||
from context import context as ctx
|
||||
WorkspaceStructure.__init__(self, ctx)
|
||||
self.object = workspaceObject
|
||||
self.string = workspaceObject.string
|
||||
self.descriptionType = descriptionType
|
||||
|
||||
@ -3,7 +3,8 @@ from workspaceStructure import WorkspaceStructure
|
||||
|
||||
class Replacement(WorkspaceStructure):
|
||||
def __init__(self, objectFromInitial, objectFromModified, relation):
|
||||
WorkspaceStructure.__init__(self)
|
||||
from context import context as ctx
|
||||
WorkspaceStructure.__init__(self, ctx)
|
||||
self.objectFromInitial = objectFromInitial
|
||||
self.objectFromModified = objectFromModified
|
||||
self.relation = relation
|
||||
|
||||
@ -7,7 +7,8 @@ import formulas
|
||||
|
||||
class Rule(WorkspaceStructure):
|
||||
def __init__(self, facet, descriptor, category, relation):
|
||||
WorkspaceStructure.__init__(self)
|
||||
from context import context as ctx
|
||||
WorkspaceStructure.__init__(self, ctx)
|
||||
self.facet = facet
|
||||
self.descriptor = descriptor
|
||||
self.category = category
|
||||
|
||||
@ -8,7 +8,8 @@ from workspaceStructure import WorkspaceStructure
|
||||
class WorkspaceObject(WorkspaceStructure):
|
||||
# pylint: disable=too-many-instance-attributes
|
||||
def __init__(self, workspaceString):
|
||||
WorkspaceStructure.__init__(self)
|
||||
from context import context as ctx
|
||||
WorkspaceStructure.__init__(self, ctx)
|
||||
self.string = workspaceString
|
||||
self.descriptions = []
|
||||
self.extrinsicDescriptions = []
|
||||
|
||||
@ -7,8 +7,7 @@ def abstract_call(objekt, name):
|
||||
|
||||
|
||||
class WorkspaceStructure(object):
|
||||
def __init__(self):
|
||||
from context import context as ctx
|
||||
def __init__(self, ctx):
|
||||
self.ctx = ctx
|
||||
self.string = None
|
||||
self.internalStrength = 0.0
|
||||
|
||||
Reference in New Issue
Block a user