library(readin)
read_in(
-Sentence)
is_period/1
) at the end of a line. There may be any number
of tabs and spaces between that stop and the end of the line. It then breaks
the characters up into "words", where a "word" is
is_alpha/1
), which is converted to lowercase
and returned as a Prolog atom
is_digit/1
), which is returned as a
Prolog integer (plus and minus signs become separate atoms).
The resulting list is returned in Sentence. The punctuation mark that terminated the sentence is included in the list. Here is an example:
| ?- read_in(X). |: This is an example. An example of read-in. In |: it there are +00003 sentences! X = [this,is,an,example,.,an,example,of,read,-, in,.,in,it,there,are,+,3,sentences,!]
Note that the end-of-line character, and any spaces and tabs following the sentence terminator, are consumed. It is important that the end-of-line character be consumed; otherwise subsequent prompts will behave unpredictably.