Smartness update! A single letter is both "leftmost" and "rightmost".
Before this change, Copycat was unable to formulate more than the empty rule for
abc : abd :: f : f
abc : dbc :: f : f
abc : aac :: f : f
After this change, Copycat strongly prefers
abc : abd :: f : g ("Replace the rightmost letter with its successor")
abc : dbc :: f : d ("Replace the leftmost letter with d")
abc : aac :: f : e ("Replace the middle letter with its predecessor")
This commit is contained in:
@ -15,17 +15,13 @@ class Letter(WorkspaceObject):
|
|||||||
def describe(self, position, length):
|
def describe(self, position, length):
|
||||||
slipnet = self.ctx.slipnet
|
slipnet = self.ctx.slipnet
|
||||||
if length == 1:
|
if length == 1:
|
||||||
self.addDescription(slipnet.stringPositionCategory,
|
self.addDescription(slipnet.stringPositionCategory, slipnet.single)
|
||||||
slipnet.single)
|
if self.leftmost:
|
||||||
if self.leftmost and length > 1: # ? why check length ?
|
self.addDescription(slipnet.stringPositionCategory, slipnet.leftmost)
|
||||||
self.addDescription(slipnet.stringPositionCategory,
|
if self.rightmost:
|
||||||
slipnet.leftmost)
|
self.addDescription(slipnet.stringPositionCategory, slipnet.rightmost)
|
||||||
if self.rightmost and length > 1: # ? why check length ?
|
if position * 2 == length + 1:
|
||||||
self.addDescription(slipnet.stringPositionCategory,
|
self.addDescription(slipnet.stringPositionCategory, slipnet.middle)
|
||||||
slipnet.rightmost)
|
|
||||||
if length > 2 and position * 2 == length + 1:
|
|
||||||
self.addDescription(slipnet.stringPositionCategory,
|
|
||||||
slipnet.middle)
|
|
||||||
|
|
||||||
def __repr__(self):
|
def __repr__(self):
|
||||||
return '<Letter: %s>' % self.__str__()
|
return '<Letter: %s>' % self.__str__()
|
||||||
|
|||||||
Reference in New Issue
Block a user