def __init__(self, string, groupCategory, directionCategory, facet, objectList, bondList): WorkspaceObject.__init__(self, string) self.groupCategory = groupCategory self.directionCategory = directionCategory self.facet = facet self.objectList = objectList self.bondList = bondList self.bondCategory = self.groupCategory.getRelatedNode(slipnet.bondCategory) leftObject = objectList[0] rightObject = objectList[-1] self.leftStringPosition = leftObject.leftStringPosition self.leftmost = self.leftStringPosition == 1 self.rightStringPosition = rightObject.rightStringPosition self.rightmost = self.rightStringPosition == len(self.string) self.descriptions = [] self.bondDescriptions = [] self.extrinsicDescriptions = [] self.outgoingBonds = [] self.incomingBonds = [] self.bonds = [] self.leftBond = None self.rightBond = None self.correspondence = None self.changed = False self.newAnswerLetter = False self.clampSalience = False self.name = '' from description import Description if self.bondList and len(self.bondList): firstFacet = self.bondList[0].facet self.addBondDescription(Description(self, slipnet.bondFacet, firstFacet)) self.addBondDescription(Description(self, slipnet.bondCategory, self.bondCategory)) self.addDescription(slipnet.objectCategory, slipnet.group) self.addDescription(slipnet.groupCategory, self.groupCategory) if not self.directionCategory: # sameness group - find letterCategory letter = self.objectList[0].getDescriptor(self.facet) self.addDescription(self.facet, letter) if self.directionCategory: self.addDescription(slipnet.directionCategory, self.directionCategory) if self.spansString(): self.addDescription(slipnet.stringPositionCategory, slipnet.whole) elif self.leftStringPosition == 1: self.addDescription(slipnet.stringPositionCategory, slipnet.leftmost) elif self.rightStringPosition == self.string.length: self.addDescription(slipnet.stringPositionCategory, slipnet.rightmost) elif self.middleObject(): self.addDescription(slipnet.stringPositionCategory, slipnet.middle) #check whether or not to add length description category probability = self.lengthDescriptionProbability() if random.random() < probability: length = len(self.objectList) if length < 6: self.addDescription(slipnet.length, slipnet.numbers[length - 1])
def __init__(self, string, position, length): WorkspaceObject.__init__(self, string) from workspace import workspace workspace.objects += [self] string.objects += [self] self.leftIndex = position self.leftmost = self.leftIndex == 1 self.rightIndex = position self.rightmost = self.rightIndex == length
def __init__(self, string, position, length): WorkspaceObject.__init__(self, string) from workspace import workspace workspace.objects += [self] string.objects += [self] self.leftIndex = position self.leftmost = self.leftIndex == 1 self.rightIndex = position self.rightmost = self.rightIndex == length
def __init__(self, string, groupCategory, directionCategory, facet, objectList, bondList): # pylint: disable=too-many-arguments WorkspaceObject.__init__(self, string) self.groupCategory = groupCategory self.directionCategory = directionCategory self.facet = facet self.objectList = objectList self.bondList = bondList self.bondCategory = self.groupCategory.getRelatedNode( slipnet.bondCategory) leftObject = objectList[0] rightObject = objectList[-1] self.leftIndex = leftObject.leftIndex self.leftmost = self.leftIndex == 1 self.rightIndex = rightObject.rightIndex self.rightmost = self.rightIndex == len(self.string) self.descriptions = [] self.bondDescriptions = [] self.extrinsicDescriptions = [] self.outgoingBonds = [] self.incomingBonds = [] self.bonds = [] self.leftBond = None self.rightBond = None self.correspondence = None self.changed = False self.newAnswerLetter = False self.clampSalience = False self.name = '' from description import Description if self.bondList and len(self.bondList): firstFacet = self.bondList[0].facet self.addBondDescription( Description(self, slipnet.bondFacet, firstFacet)) self.addBondDescription( Description(self, slipnet.bondCategory, self.bondCategory)) self.addDescription(slipnet.objectCategory, slipnet.group) self.addDescription(slipnet.groupCategory, self.groupCategory) if not self.directionCategory: # sameness group - find letterCategory letter = self.objectList[0].getDescriptor(self.facet) self.addDescription(self.facet, letter) if self.directionCategory: self.addDescription(slipnet.directionCategory, self.directionCategory) if self.spansString(): self.addDescription(slipnet.stringPositionCategory, slipnet.whole) elif self.leftIndex == 1: self.addDescription(slipnet.stringPositionCategory, slipnet.leftmost) elif self.rightIndex == self.string.length: self.addDescription(slipnet.stringPositionCategory, slipnet.rightmost) elif self.middleObject(): self.addDescription(slipnet.stringPositionCategory, slipnet.middle) self.add_length_description_category()
def __init__(self, string, groupCategory, directionCategory, facet, objectList, bondList): WorkspaceObject.__init__(self, string) self.groupCategory = groupCategory self.directionCategory = directionCategory self.facet = facet self.objectList = objectList self.bondList = bondList self.bondCategory = self.groupCategory.getRelatedNode( slipnet.bondCategory) leftObject = objectList[0] rightObject = objectList[-1] self.leftStringPosition = leftObject.leftStringPosition self.leftmost = self.leftStringPosition == 1 self.rightStringPosition = rightObject.rightStringPosition self.rightmost = self.rightStringPosition == len(self.string) self.descriptions = [] self.bondDescriptions = [] self.extrinsicDescriptions = [] self.outgoingBonds = [] self.incomingBonds = [] self.bonds = [] self.leftBond = None self.rightBond = None self.correspondence = None self.changed = False self.newAnswerLetter = False self.clampSalience = False self.name = '' from description import Description if self.bondList and len(self.bondList): firstFacet = self.bondList[0].facet self.addBondDescription( Description(self, slipnet.bondFacet, firstFacet)) self.addBondDescription( Description(self, slipnet.bondCategory, self.bondCategory)) self.addDescription(slipnet.objectCategory, slipnet.group) self.addDescription(slipnet.groupCategory, self.groupCategory) if not self.directionCategory: # sameness group - find letterCategory letter = self.objectList[0].getDescriptor(self.facet) self.addDescription(self.facet, letter) if self.directionCategory: self.addDescription(slipnet.directionCategory, self.directionCategory) if self.spansString(): self.addDescription(slipnet.stringPositionCategory, slipnet.whole) elif self.leftStringPosition == 1: self.addDescription(slipnet.stringPositionCategory, slipnet.leftmost) elif self.rightStringPosition == self.string.length: self.addDescription(slipnet.stringPositionCategory, slipnet.rightmost) elif self.middleObject(): self.addDescription(slipnet.stringPositionCategory, slipnet.middle) #check whether or not to add length description category probability = self.lengthDescriptionProbability() if random.random() < probability: length = len(self.objectList) if length < 6: self.addDescription(slipnet.length, slipnet.numbers[length - 1])
def __init__(self, string, groupCategory, directionCategory, facet, objectList, bondList): # pylint: disable=too-many-arguments WorkspaceObject.__init__(self, string) self.groupCategory = groupCategory self.directionCategory = directionCategory self.facet = facet self.objectList = objectList self.bondList = bondList self.bondCategory = self.groupCategory.getRelatedNode( slipnet.bondCategory) leftObject = objectList[0] rightObject = objectList[-1] self.leftIndex = leftObject.leftIndex self.leftmost = self.leftIndex == 1 self.rightIndex = rightObject.rightIndex self.rightmost = self.rightIndex == len(self.string) self.descriptions = [] self.bondDescriptions = [] self.extrinsicDescriptions = [] self.outgoingBonds = [] self.incomingBonds = [] self.bonds = [] self.leftBond = None self.rightBond = None self.correspondence = None self.changed = False self.newAnswerLetter = False self.clampSalience = False self.name = '' from description import Description if self.bondList and len(self.bondList): firstFacet = self.bondList[0].facet self.addBondDescription( Description(self, slipnet.bondFacet, firstFacet)) self.addBondDescription( Description(self, slipnet.bondCategory, self.bondCategory)) self.addDescription(slipnet.objectCategory, slipnet.group) self.addDescription(slipnet.groupCategory, self.groupCategory) if not self.directionCategory: # sameness group - find letterCategory letter = self.objectList[0].getDescriptor(self.facet) self.addDescription(self.facet, letter) if self.directionCategory: self.addDescription(slipnet.directionCategory, self.directionCategory) if self.spansString(): self.addDescription(slipnet.stringPositionCategory, slipnet.whole) elif self.leftIndex == 1: self.addDescription( slipnet.stringPositionCategory, slipnet.leftmost) elif self.rightIndex == self.string.length: self.addDescription( slipnet.stringPositionCategory, slipnet.rightmost) elif self.middleObject(): self.addDescription( slipnet.stringPositionCategory, slipnet.middle) self.add_length_description_category()