Assignment 2: Matching and similarity

Due Sunday, 2006-09-10

Write two Python functions, each of which takes a pattern and a generalization (see below):

Pattern is meant to represent some object using a symbolic style of representation; there could be embedding within pattern because it could have parts, which are also patterns. Generalization is meant to represent a generalization over a bunch of objects, for example, the meaning of a noun. It uses the same type of representation format as pattern so that comparison and matching is relatively straightforward; embedding is also possible within generalization. For this assignment, you don't need to use any variables in your representation for generalizations. Create a few examples of patterns and generalizations to test your functions; these don't have to look like real objects or meanings. Save everything in one file (match.py) with your name and email address at the top.

>>> is_inst(obj1, fribbit)
False
>>> is_inst(obj2, fribbit)
True
>>> similarity(obj1, fribbit)
0.5
>>> similarity(obj2, fribbit)
0.5
>>> similarity(obj3, fribbit)
-0.625

Home

Calendar

Coursework

Notes

Code

HLW


IU | COGS | CSCI

Contact instructor