コード例 #1
0
ファイル: codeletMethods.py プロジェクト: jtauber/co.py.cat
def top_down_description_scout(codelet):
    descriptionType = codelet.arguments[0]
    chosenObject = chooseUnmodifiedObject('totalSalience', workspace.objects)
    assert chosenObject
    __showWhichStringObjectIsFrom(chosenObject)
    descriptions = chosenObject.getPossibleDescriptions(descriptionType)
    assert descriptions and len(descriptions)
    values = [n.activation for n in descriptions]
    i = selectListPosition(values)
    chosenProperty = descriptions[i]
    coderack.proposeDescription(chosenObject, chosenProperty.category(), chosenProperty, codelet)
コード例 #2
0
ファイル: codeletMethods.py プロジェクト: jtauber/co.py.cat
def bottom_up_description_scout(codelet):
    chosenObject = chooseUnmodifiedObject('totalSalience', workspace.objects)
    assert chosenObject
    __showWhichStringObjectIsFrom(chosenObject)
    description = chooseRelevantDescriptionByActivation(chosenObject)
    assert description
    sliplinks = similarPropertyLinks(description.descriptor)
    assert sliplinks and len(sliplinks)
    values = [sliplink.degreeOfAssociation() * sliplink.destination.activation for sliplink in sliplinks]
    i = selectListPosition(values)
    chosen = sliplinks[i]
    chosenProperty = chosen.destination
    coderack.proposeDescription(chosenObject, chosenProperty.category(), chosenProperty, codelet)