home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!pipex!bnr.co.uk!uknet!edcastle!aiai!ken
- From: ken@aiai.ed.ac.uk (Ken Johnson)
- Newsgroups: comp.lang.prolog
- Subject: Re: How to parse "I say: 'I love you'" to [I, say, I love you]
- Message-ID: <8085@skye.ed.ac.uk>
- Date: 5 Jan 93 11:08:51 GMT
- References: <1i97a9INN8h@sol.deakin.OZ.AU>
- Followup-To: comp.lang.prolog
- Organization: William's Wonderful Wonky Widget Warehouse
- Lines: 37
-
-
- In article <1i97a9INN8h@sol.deakin.OZ.AU> huang@deakin.OZ.AU (Weiguang
- Huang) writes:
-
- # but how to parse to ["I", "say", "I love you"] ?
-
- The following will do what you want, but I don't think what you describe
- is really what you want to do. Instead of a list, you should really
- generate a term expressing the structure of the original, so [I, say, I,
- love, you] should really parse to a term such as
-
- say('I',love('I',you)).
-
-
- report([P,V|St]) --> pronoun(P), verb(V), quotation(St).
-
- quotation([P1,V,P2]) --> pronoun(P1), verb(V), pronoun(P2).
-
- pronoun('I') --> ['I'].
- pronoun(you) --> [you].
-
- verb(say) --> [say].
- verb(love) --> [love].
-
- This is how it works:
-
- ?- phrase(report(R),['I',say,'I',love,you]).
-
- R=[I,say,I,love,you]
-
-
-
- --
- Son, all the pretty, intelligent, || Ken Johnson healthy young women are taken. || A I Applications Institute
- It's a basic rule of the universe, || 80 South Bridge and if you don't like it, || Edinburgh, Scotland EH1 1HN
- go somewhere else. || Phone 031-650 2756 Fax 031-650 6513
- -- my dad 1906-1992 || E-mail ken@aiai.ed.ac.uk
-