Machine Learning
John Samuel
CPE Lyon
Year: 2018-2019
Email: john(dot)samuel(at)cpe(dot)fr
Extracting named entities and assigning them to specific categories.
A Prolog program contains clauses of the following form.
Head :- Body.
A clause with empty body is called fact.
cat(bob).
cat(alice).
$ prolog
GNU Prolog 1.4.5 (64 bits)
Compiled Feb 5 2017, 10:30:08 with gcc
By Daniel Diaz
Copyright (C) 1999-2016 Daniel Diaz
| ?- [user].
compiling user for byte code...
cat(tom).
cat(alice).
user compiled, 2 lines read - 241 bytes written, 12239 ms
(4 ms) yes
| ?-
?- cat(X).
X = tom ?
yes
| ?- cat(bob).
no
| ?- [user].
compiling user for byte code...
cat(tom).
cat(alice).
allcats(L) :- findall(X, cat(X), L).
user compiled, 3 lines read - 490 bytes written, 10638 ms
yes
| ?- allcats(L).
L = [tom,alice]
yes
| ?- [user].
compiling user for byte code...
friend(bob, alice).
friend(alice, kevin).
friend(bob, thomas).
friend(bob, peter).
user compiled, 4 lines read - 486 bytes written, 77256 ms
(10 ms) yes
| ?- friend(bob, X).
X = alice ? a
X = thomas
X = peter
(1 ms) yes