?? readin.pro
字號:
% File readin.pl - Prolog program to read in a file of sentences
% using built in library(readin)
% To use readin from standard input, used CTRL-D for eol, CTRL-Z for eof
% readin tokenizes words on blanks, punctuations, and white spaces and
% removes whitespaces. readin reads up to 1st line that ends in '.'
% See reference manual for more details
:- ensure_loaded(library(readin)).
%process: current input stream is assumed to have been established before
process :- % used to read in sentence using Prolog library read_in
% repeat is a procedural predicate used for iteration
repeat, %repeat until the complete file is processed
read_in(X), %creates list X using library builtin
(X = end_of_file, seen, !;
X = [''], seen, !;
test(X,F), %test is a predicate that can be used to process sentence
fail
).
%process: established Infile as current input stream before processing
process(Infile) :- see(Infile), process.
%test(+Sentence,-ProcessedSentence) is a predicate for testing sentence readin
% It writes out sentence to standard output
test(S,S) :- write(S), %this could be substituted with a predicate that processes S
nl.
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -