Skip to content

garfix/micropam

Repository files navigation

MicroPAM (McPAM) captures the essential flavor of Robert Wilensky's PAM. It can be found in the book "Inside computer understanding", by Roger C. Schank and Christopher K. Riesbeck (1981)

This repository contains a Python port of the original Lisp code, as well as the part of the Lisp source code that was provided by the book.

MicroPAM tries to understand a story, by finding an explanation for each sentence. It works both top-down and bottom-up in the same process and uses these two techniques:

  • it is given a collection of antecedent-consequent rules that link actions to plans, plans to goals, sub-goals to goals, and goals to themes
  • it builds lists of known plans, goals and themes in the process of understanding
  • bottom-up: it tries to infer these known facts by applying the rules to the sentence, and to other inferred facts
  • top-down: it has "explained" an inferred fact when it can match it to a known fact

MicroPAM's input consists of a story in CD (Conceptual Dependency) format and produces a list of inferred plans, goals, and themes, also in that format.

Basic use of the code:

micro_pam = MicroPAM(init_rules, sub_for, plans_for, instance_of, isa_props)

story = [
    # Willa was hungry
    ['is', ['actor', ['person', ['name', ['Willa']]]], ['state', ['hunger', ['val', [5]]]]],
    # She picked up the Michelin guide
    ['grasp', ['actor', ['person', ['name', ['Willa']]]], ['object', ['book', ['type', ['restaurant-guide']]]]],
    # She got into her car
    ['ptrans', ['actor', ['person', ['name', ['Willa']]]], ['object', ['person', ['name', ['Willa']]]], ['to', ['car']]]
]

log = []
for cd in story:
    micro_pam.justify(cd, log)

print(log)

The file test.py contains a test:

python3 -m unittest test.py 

Some remarks:

  • MicroPAM bindings are in the form [ [name, value], [name, value], ...], but we'll just use a dict in the Python port
  • MicroPAM uses some apparently global variables, such as *KNOWN-THEMES*; these have been implemented as members of the MicroPAM class
  • The variable *CHAIN* changes during program execution; it is passed by reference from one function to another

About

MicroPAM (McPAM) captures the essential flavor of Robert Wilensky's PAM. It can be found in the book "Inside computer understanding", by Roger C. Schank and Christopher K. Riesbeck (1981)

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors