Search Top Index
HELP LERNGRAM Chris Mellish, February 1983 LERNGRAM is a very simple program for learning concepts involving English sentences. The program assumes at the start that every sentence that it will ever encounter is grammatical according to the following grammar (expressed in PROLOG grammar rules): s(s(NP,VP)) --> np(NP), vp(VP). np(np(D,A,N)) --> det(D), adjs(A), noun(N). adjs(adjs(As)) --> noadjs(As). adjs(adjs(As)) --> someadjs(As). noadjs(noadjs) --> . someadjs(someadjs(A,As)) --> adj(A), adjs(As). adj(adj(A)) --> sizeadj(A). adj(adj(A)) --> colouradj(A). sizeadj(sizeadj(big)) --> [big]. sizeadj(sizeadj(small)) --> [small]. colouradj(colouradj(red)) --> [red]. colouradj(colouradj(blue)) --> [blue]. det(det(a)) --> [a]. det(det(the)) --> [the]. noun(noun(man)) --> [man]. noun(noun(block)) --> [block]. vp(vp(VP)) --> transvp(VP). vp(vp(VP)) --> verb(VP). transvp(transvp(V,NP)) --> verb(V), np(NP). verb(verb(sees)) --> [sees]. verb(verb(hates)) --> [hates]. Given this grammar, the task of the program is to learn a concept that the user has thought up. Example concepts that it can learn are: A sentence with a transitive verb phrase A sentence whose subject has at least two adjectives A sentence whose subject and object both have the noun "block" It learns these concepts by being given examples and non-examples of sentences which fit the concept, in the same style as Winston's program. The program is in the PROLOG library, and so to load it, run PROLOG and type: library(lerngram). to the PROLOG prompt. To actually run it, use the predicate 'talk' (with no arguments). The program uses the methods of concept learning outlined in TEACH *PARPAR, and prints messages indicating its progress in isolating the concept. Its representation of "partial parse trees" is as PROLOG terms, with the first element of a tree providing the functor, and "=" entries represented by PROLOG uninstantiated variables. Thus, for instance, the tree [world [object block] [object =] [relations [touchrel [touchingrel =]] [displacementrel above] ] ] would be represented by the term: world( object(block), object(X), relations( touchrel(touchingrel(Y)), displacementrel(above) ) ) Note that PROLOG uninstantiated variables are printed out as _1, _2, _3, etc.