phones	-  extract information from a text file and assert Prolog facts 
------

Files in this directory:

phones.nl     - PTN code to extract information from a text file & assert facts
phones_gr.gr  - the grammar rules for the text file 
phones.txt    - the text file containing grade information
demo.nl	      - a demo file manipulating the asserted facts.


To Run
------

% ../../ptn				% load ptn

NU-Prolog 1.6.4
1?- gr2nl(phones_gr).			% translate grammar rules
true.					% create ".nl" file - once only

2?- consult(phones_gr).			% consult grammar rules
Consulting phones_gr.nl.		% (ignore warning)	
Warning: descendent/2 redefined
true.					  

3?- consult(phones).			% consult the program to assert facts 
Consulting phones.nl.
true.

4?- phones('phones.txt').		% extract information from text
true.					% file, and assert facts
					% takes a minute
5?- consult(demo).
Consulting demo.nl.			% consult demo file
true.

6?- demo.				% run demo
Staff whose office is on level 2:

Alistair MOFFAT
Andrew DAVISON
Gary EDDY
Guozhu DONG
.....
.....

PhD students and telephone numbers :

Charlie PANG 9193
David KINNY 6637922
Doug PALMER 9193
.....
.....

true.
7?-


Some Explanation
----------------

Phones is a non-programming example of using PTN to manipulate information 
set out in a form for which a grammar can readily be declared.

The example is a text file containing staff and student details, like names
telephone numbers, room numbers etc. They are divided into sections, each
with a title, and each person's details are on a separate line. There are
one or two field delimiters, which are ',' between Surname(s) and
Firstname(s) and in the case of the engineering faculty section, a ',' is
placed between the Firstname(s) and the Job(s).


{Liz Haywood May 1994}

