PLOGHELP LERNGRAM                            Chris Mellish February 1983
                                 Revised by Kathryn Seifert  August 1986

Library program for learning concepts about English sentences

Keywords: learning, grammar, natural language


LERNGRAM is a very simple program for learning concepts involving
English sentences.  Initially, the program assumes that every sentence
that it will ever encounter is grammatical according to the following
grammar (expressed in Prolog grammar rules, see
PLOGHELP * GRAMMAR_RULE):

    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 actually run it, use the predicate 'talk' (with no arguments):

    ?- talk.

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)
                   )
             )


-- RELATED DOCUMENTATION ----------------------------------------------

PLOGHELP * GRAMMARS
 Overview of HELP files dealing with grammars and natural language

PLOGHELP * GRAMMAR_RULE
 Prolog facilities for expressing definite clause grammars

TEACH * PARPAR
 POP-11 TEACH file describing the use of partial parse trees in concept
 learning
