"Jonathan L Cunningham" <jlc@sofluc.demon.co.uk.spam> writes:
> Date: Wed, 9 Jun 1999 10:00:52 +0100
>
> Didn't Masoud Yazdani do some PhD research on this topic using
> pop11 back in the '80s at the University of Sussex?
Yes. I can't recall how far the work got. I seem to recall that he
used Prolog rather than pop-11.
> But I haven't looked at the comp.ai.nat-lang group for years, so
> I don't know what the discussion was about, and his research may
> not be relevant to the discussion. (I've given up reading the
> comp.ai newsgroups due to the generally low signal-to-noise ratio
> last time I looked.)
comp.ai is now moderated, which reduces the noise.
Whether it increases the signal is another question!
> David Whitten wrote in message ...
> >
> >On a different newsgroup (comp.ai.nat-lang)
> >there has been discussion of an AI program that generates
> >stories semi-automatically.
> >
> >Has anyone done something like this in Pop-11 ?
The library described in TEACH GRAMMAR allows you to create a grammar
and a lexicon and then randomly generate output that accords with the
grammar and the lexicon. You can also generate a parser for the grammar
and lexicon. The file is accessible at:
ftp://ftp.cs.bham.ac.uk/pub/dist/poplog/teach/grammar
I thought I would try creating a story grammar and using it to generate
stories.
A story has a beginning and a middle and an end. So here goes.
;;; The sentence generator is defined in LIB GRAMMAR
uses grammar
;;; Define a VERY simple story grammar.
;;; We have to use "s" for the top level category.
;;; So let "s" stand for story
vars story_grammar =
[
;;; a story has three parts
[s [s_begin period s_middle period s_end period]]
;;; the first part
[s_begin [villain_np villain_vp]]
;;; the second part
[s_middle [hero_np hero_vp]]
;;; the third part
[s_end [happy_end] [sad_end]]
;;; There are two kinds of endings, each of two forms.
;;; repeat a form to get a higher probability of choosing it
[happy_end [rejoice][happy_np happy_vp][happy_np happy_vp]]
[sad_end [regret][regret_np regret_vp][regret_np regret_vp]]
;;; there are several kinds of noun phrases
[villain_np
[det villain_adj villain_noun]
[det villain_noun]
[villain_np prep_phrase]]
[hero_np
[det hero_adj hero_noun]
[det hero_noun]
[hero_np prep_phrase]]
[victim_np
[det victim_adj victim_noun]
[det victim_noun]
[victim_np prep_phrase]]
[happy_np [det happy_noun]]
[regret_np [det regret_adj regret_noun]]
;;; several kinds of verp phrases
[villain_vp [villain_verb victim_np]]
[hero_vp [hero_verb villain_np]]
[happy_vp [happy_verb happy_adv]]
[regret_vp [regret_verb regret_adv]]
[prep_phrase [prep noun_phrase]]
[noun_phrase [det noun] [det adj noun]]
];
vars story_lexicon =
[
[period .]
[villain_adj wily wicked brazen stupid mindless brutal thuggish]
[villain_noun crook thug thief burglar robber ogre conman deceiver]
[hero_adj bold selfless observant attentive brave clever assiduous kind]
[hero_noun warrior woman man knight policeman policewoman doctor detective]
[victim_adj innocent young polite nervous harmless mild]
[victim_noun child woman beggar man boy student professor]
[happy_noun hero heroine knight princess prince lady clown general]
[regret_adj unhappy woeful sad distraught dismayed dejected downtrodden]
[regret_noun hero heroine victim lad lass ]
[villain_verb murdered cheated robbed betrayed threatened mugged]
[hero_verb found detected slew unmasked challenged defeated reported]
[happy_verb celebrated smiled ran jumped strolled cheered sneered]
[happy_adv happily blithely joyfully excitedly triumphantly gleefully]
[regret_verb walked prayed wept sat cried died mourned]
[regret_adv gloomily sadly regretfully morosely mournfully]
[prep over under beside near at in on within above]
[det the each every some one a]
[noun chair mountain house river bridge car caravan road yard]
[adj big small narrow wide brown green blue deserted ancient
ugly attractive famous]
[regret alas woe how_sad NO oh_dear ouch]
[rejoice hooray great cool wonderful cheers yup OK]
];
;;; increase recursion level for the generator
20 -> maxlevel;
generate(story_grammar, story_lexicon) ==>
;;; giving that command several times produced the following
** [a stupid crook threatened some harmless student above the river beside some ugly yard over
each house over one ugly mountain . every clever policewoman under some river unmasked
one brutal robber within a chair . cool .]
** [one mindless thief under a green yard mugged one woman . one brave policewoman found a
deceiver . the sad lass walked sadly .]
** [a thug in every big car under a blue caravan murdered a nervous beggar . a kind policeman
defeated one brutal robber beside each blue car . hooray .]
** [each thief cheated a beggar . some selfless warrior found a thug . great .]
** [a ogre betrayed every polite professor . the doctor slew each wily robber . cheers .]
** [some thug threatened each child . some brave warrior detected a brazen robber . one dismayed
heroine cried gloomily .]
** [each robber threatened some innocent woman . every selfless policewoman unmasked every
thuggish thug . some downtrodden heroine prayed regretfully .]
** [every conman beside every brown chair cheated some harmless beggar under some caravan on
every small caravan . each woman on a deserted caravan challenged some thug . every
general cheered joyfully .]
** [the wily robber threatened one beggar . the detective detected each brazen robber . woe
.]
** [some mindless burglar betrayed a innocent man . one observant policewoman defeated some
wily crook . every dismayed heroine sat sadly .]
;;; We can also create a story analyser
setup(story_grammar, story_lexicon);
;;; that defines a parser called "s". apply it to one of the stories
s([one mindless thief under a green yard mugged one woman . one brave
policewoman found a deceiver . the sad lass walked sadly .]) ==>
** [s [s_begin [villain_np
[villain_np [det one] [villain_adj mindless] [villain_noun thief]]
[prep_phrase [prep under] [noun_phrase [det a] [adj green] [noun yard]]]]
[villain_vp
[villain_verb mugged]
[victim_np [det one] [victim_noun woman]]]]
[period .]
[s_middle [hero_np [det one] [hero_adj brave] [hero_noun policewoman]]
[hero_vp [hero_verb found] [villain_np [det a] [villain_noun deceiver]]]]
[period .]
[s_end [sad_end [regret_np [det the] [regret_adj sad] [regret_noun lass]]
[regret_vp [regret_verb walked] [regret_adv sadly]]]]
[period .]]
I hope all that makes some kind of sense.
Aaron
===
--
Aaron Sloman, ( http://www.cs.bham.ac.uk/~axs/ )
School of Computer Science, The University of Birmingham, B15 2TT, UK
EMAIL A.Sloman AT cs.bham.ac.uk (NB: Anti Spam address)
PAPERS: ftp://ftp.cs.bham.ac.uk/pub/groups/cog_affect/0-INDEX.html
|