Sentence

Description

Finding parts of speech in a sentence

Source: The Art of Prolog

Download

Program source code: sentence.pl

Listing

/*
	verb(Sentence,Verb) :-
		Verb is a verb in the list of words Sentence.
*/
 
	verb(Sentence,Word) :- member(Word,Sentence), verb(Word).
	noun(Sentence,Word) :- member(Word,Sentence), noun(Word).
	article(Sentence,Word) :- member(Word,Sentence), article(Word).
 
	/* Vocabulary */
 
	noun(man). 		noun(woman).
	article(a).		verb(loves).
 
%	Program 14.1: Finding parts of speech in a sentence

Comments

pl/prolog/pllib/sentence.txt · ostatnio zmienione: 2019/06/27 15:50 (edycja zewnętrzna)
www.chimeric.de Valid CSS Driven by DokuWiki do yourself a favour and use a real browser - get firefox!! Recent changes RSS feed Valid XHTML 1.0