Spelling: neighbour -> neighbor.
The old code mixed both spellings; we might as well be consistent.
This commit is contained in:
@ -163,13 +163,13 @@ class Bond(WorkspaceStructure):
|
|||||||
except ZeroDivisionError:
|
except ZeroDivisionError:
|
||||||
return 0.0
|
return 0.0
|
||||||
|
|
||||||
def sameNeighbours(self, other):
|
def sameNeighbors(self, other):
|
||||||
if self.leftObject == other.leftObject:
|
if self.leftObject == other.leftObject:
|
||||||
return True
|
return True
|
||||||
return self.rightObject == other.rightObject
|
return self.rightObject == other.rightObject
|
||||||
|
|
||||||
def getIncompatibleBonds(self):
|
def getIncompatibleBonds(self):
|
||||||
return [b for b in self.string.bonds if self.sameNeighbours(b)]
|
return [b for b in self.string.bonds if self.sameNeighbors(b)]
|
||||||
|
|
||||||
def get_source(self):
|
def get_source(self):
|
||||||
return self.source
|
return self.source
|
||||||
|
|||||||
@ -8,7 +8,7 @@ from slipnet import slipnet
|
|||||||
import temperature
|
import temperature
|
||||||
import formulas
|
import formulas
|
||||||
from workspaceFormulas import chooseDirectedNeighbor
|
from workspaceFormulas import chooseDirectedNeighbor
|
||||||
from workspaceFormulas import chooseNeighbour
|
from workspaceFormulas import chooseNeighbor
|
||||||
from coderack import coderack
|
from coderack import coderack
|
||||||
from workspaceObject import WorkspaceObject
|
from workspaceObject import WorkspaceObject
|
||||||
from letter import Letter
|
from letter import Letter
|
||||||
@ -202,7 +202,7 @@ def description_builder(codelet):
|
|||||||
def bottom_up_bond_scout(codelet):
|
def bottom_up_bond_scout(codelet):
|
||||||
source = chooseUnmodifiedObject('intraStringSalience', workspace.objects)
|
source = chooseUnmodifiedObject('intraStringSalience', workspace.objects)
|
||||||
__showWhichStringObjectIsFrom(source)
|
__showWhichStringObjectIsFrom(source)
|
||||||
destination = chooseNeighbour(source)
|
destination = chooseNeighbor(source)
|
||||||
assert destination
|
assert destination
|
||||||
logging.info('destination: %s', destination)
|
logging.info('destination: %s', destination)
|
||||||
bondFacet = __getBondFacet(source, destination)
|
bondFacet = __getBondFacet(source, destination)
|
||||||
@ -335,7 +335,7 @@ def top_down_bond_scout__category(codelet):
|
|||||||
category = codelet.arguments[0]
|
category = codelet.arguments[0]
|
||||||
source = __getScoutSource(category, formulas.localBondCategoryRelevance,
|
source = __getScoutSource(category, formulas.localBondCategoryRelevance,
|
||||||
'bond')
|
'bond')
|
||||||
destination = chooseNeighbour(source)
|
destination = chooseNeighbor(source)
|
||||||
logging.info('source: %s, destination: %s', source, destination)
|
logging.info('source: %s, destination: %s', source, destination)
|
||||||
assert destination
|
assert destination
|
||||||
bondFacet = __getBondFacet(source, destination)
|
bondFacet = __getBondFacet(source, destination)
|
||||||
@ -398,7 +398,7 @@ def bond_builder(codelet):
|
|||||||
assert (bond.source in workspace.objects or
|
assert (bond.source in workspace.objects or
|
||||||
bond.destination in workspace.objects)
|
bond.destination in workspace.objects)
|
||||||
for stringBond in bond.string.bonds:
|
for stringBond in bond.string.bonds:
|
||||||
if bond.sameNeighbours(stringBond) and bond.sameCategories(stringBond):
|
if bond.sameNeighbors(stringBond) and bond.sameCategories(stringBond):
|
||||||
if bond.directionCategory:
|
if bond.directionCategory:
|
||||||
bond.directionCategory.buffer = 100.0
|
bond.directionCategory.buffer = 100.0
|
||||||
bond.category.buffer = 100.0
|
bond.category.buffer = 100.0
|
||||||
|
|||||||
@ -144,8 +144,8 @@ class SlipNet(object):
|
|||||||
|
|
||||||
def __addInitialLinks(self):
|
def __addInitialLinks(self):
|
||||||
self.sliplinks = []
|
self.sliplinks = []
|
||||||
self.__link_items_to_their_neighbours(self.letters)
|
self.__link_items_to_their_neighbors(self.letters)
|
||||||
self.__link_items_to_their_neighbours(self.numbers)
|
self.__link_items_to_their_neighbors(self.numbers)
|
||||||
# letter categories
|
# letter categories
|
||||||
for letter in self.letters:
|
for letter in self.letters:
|
||||||
self.__addInstanceLink(self.letterCategory, letter, 97.0)
|
self.__addInstanceLink(self.letterCategory, letter, 97.0)
|
||||||
@ -216,7 +216,7 @@ class SlipNet(object):
|
|||||||
# letter to group
|
# letter to group
|
||||||
self.__addSlipLink(self.letter, self.group, length=90.0)
|
self.__addSlipLink(self.letter, self.group, length=90.0)
|
||||||
self.__addSlipLink(self.group, self.letter, length=90.0)
|
self.__addSlipLink(self.group, self.letter, length=90.0)
|
||||||
# direction-position, direction-neighbour, position-neighbour
|
# direction-position, direction-neighbor, position-neighbor
|
||||||
self.__addBidirectionalLink(self.left, self.leftmost, 90.0)
|
self.__addBidirectionalLink(self.left, self.leftmost, 90.0)
|
||||||
self.__addBidirectionalLink(self.right, self.rightmost, 90.0)
|
self.__addBidirectionalLink(self.right, self.rightmost, 90.0)
|
||||||
self.__addBidirectionalLink(self.right, self.leftmost, 100.0)
|
self.__addBidirectionalLink(self.right, self.leftmost, 100.0)
|
||||||
@ -272,7 +272,7 @@ class SlipNet(object):
|
|||||||
self.slipnodes += [slipnode]
|
self.slipnodes += [slipnode]
|
||||||
return slipnode
|
return slipnode
|
||||||
|
|
||||||
def __link_items_to_their_neighbours(self, items):
|
def __link_items_to_their_neighbors(self, items):
|
||||||
previous = items[0]
|
previous = items[0]
|
||||||
for item in items[1:]:
|
for item in items[1:]:
|
||||||
self.__addNonSlipLink(previous, item, label=self.successor)
|
self.__addNonSlipLink(previous, item, label=self.successor)
|
||||||
|
|||||||
@ -47,7 +47,7 @@ def chooseUnmodifiedObject(attribute, inObjects):
|
|||||||
return formulas.chooseObjectFromList(objects, attribute)
|
return formulas.chooseObjectFromList(objects, attribute)
|
||||||
|
|
||||||
|
|
||||||
def chooseNeighbour(source):
|
def chooseNeighbor(source):
|
||||||
objects = []
|
objects = []
|
||||||
for objekt in workspace.objects:
|
for objekt in workspace.objects:
|
||||||
if objekt.string != source.string:
|
if objekt.string != source.string:
|
||||||
|
|||||||
Reference in New Issue
Block a user