home *** CD-ROM | disk | FTP | other *** search
-
-
- Listing 6
-
- TRANSFORMATION TO COMPLETED ACTION
-
-
- done_it_prompt( Command, Done ) :-
- action( Command, Action),
- !,
- object( Command, Object),
- !,
- singular( Object, S_object),
- !,
- past( Action, Past),
- !,
- concat([S_object, $ $, Past,$.$], Done).
-
- % find past form of verb given present
- past( Action, Past) :-
- list_text( List, Action), !,
- reverse( List, List1), !,
- past_hlpr( List1, List2), !,
- reverse( List2, List3), !,
- list_text( List3, Past).
-
- past_hlpr( [`s, `e | T] , [`d, `e | T] ) :- !.
- past_hlpr( [ `e | T] , [`d, `e | T] ) :- !.
- past_hlpr( T , [`d, `e | T] ) :- !.
-
- singular( Plural, Singular) :-
- string_length( Plural, N),
- M is N-1 ,
- nth_char(M, Plural, `s),
- substring( Plural , 0, M, Singular).
-
- ---------------- end of listing -----------------------------------