How to parse "I say: 'I love you'" to [I, say, I love you] 
Author Message
 How to parse "I say: 'I love you'" to [I, say, I love you]

The program

tok([String,[A|B]) :- fronttoken(String,A,String2), tok(String2,B).
tok(_,[]).

parse "I say ' I love you'" to [I, say, I, love, you], but how to parse
to ["I", "say", "I love you"] ?

Please help.




Fri, 23 Jun 1995 19:33:29 GMT  
 How to parse "I say: 'I love you'" to [I, say, I love you]


Quote:
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



Sat, 24 Jun 1995 19:08:51 GMT  
 How to parse "I say: 'I love you'" to [I, say, I love you]

Quote:


>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)).
>?-  phrase(report(R),['I',say,'I',love,you]).

>     R=[I,say,I,love,you]

        All variables in my program are a string or a list of string, instead
of term nor word nor atom. I want to parse a string "I say 'I love you'" to
a list of string ["I", "say", "'I love you'"].

-? tok("I say 'I love you'", R).

R=["I", "say", "'I love you'"]

        How to do so ?



Sun, 25 Jun 1995 07:35:43 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. dialog box always says "save"

2. Love "Python Cookbook"

3. Infected with "Love Letter" virus

4. better way to say 'recursive join'

5. '"""' and linefeed characters

6. MF Visual Object COBOL - Love it, hate it, love it

7. say/pull combo leaving cursor after say?

8. I say 2 you say 1

9. Parsing ""D""?

10. I'm in love with Clarion, but...

11. Love's exception handling

12. For What It's Worth, or How I Learned To Love Y2K

 

 
Powered by phpBB® Forum Software