:- use_module(library('http/http_open')). assert_word(_, '') :- !. assert_word(In, W) :- downcase_atom(W, WL), line_count(In, N), assert(index(WL, N)). make_index(In, W) :- at_end_of_stream(In), assert_word(In, W), !. make_index(In, W) :- peek_char(In, C), (char_type(C, csym) -> atom_concat(W, C, W1); assert_word(In, W), W1 = ''), get_char(In, _), make_index(In, W1). :- http_open('http://www.gnu.org/licenses/gpl.txt', In, []), make_index(In, ''), close(In).