Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
201 changes: 0 additions & 201 deletions LICENSE

This file was deleted.

17 changes: 17 additions & 0 deletions LICENSE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
This software contains multiple components under different licenses:

1. PROLOG LIBRARY CODE
- License: Apache License 2.0
- SPDX: Apache-2.0
- Files: All files in root directory
- [Text](LICENSES/Apache-2.0.txt)
- [Online](https://www.apache.org/licenses/LICENSE-2.0)

2. WORDNET DOCUMENTATION and DATABASE FILES:
- License: WordNet License
- SPDX: WordNet
- Files: Files in doc/ and prolog/ directories
- [Text](LICENSES/WordNet.txt)
- [Online](https://opensource.org/license/wordnet)

Individual file headers contain SPDX-License-Identifier tags.
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -130,8 +130,10 @@ make valid PL=gprolog

## News (2026):

- Speed up the transitive relation closures, for ex. [_thyp_ in wn_query](wn_query.pl).
- Transitive relation closures in linear time
- Use no hard cut.
- Use call/N instead of univ (=..).
- Add loader.pl, to load files only once.
- Quote strings and fix quotes in CSV output.
- Add SPDX license and copyright tags
- Portable output predicates tells/1 and tolds/0
77 changes: 77 additions & 0 deletions isotell.pl
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
/* -----------------------------------------------------------------------------
isotell.pl

ISO-compatible replacements for tell/1 and told/0.

SPDX-FileCopyrightText: 2026 Eric Kafe <kafe@megadoc.net>
SPDX-License-Identifier: Apache-2.0
Licensed under the Apache License, Version 2.0

Provides tells/1 and tolds/0 with proper stack semantics.
Use these instead of tell/told for portable code across Prolog systems.
------------------------------------------------------------------------------ */

:- dynamic(openstreams/2).
:- dynamic(laststream/1).

% Ensure output stack is initialized (useful if initialization/1 is not run,
% or if the dynamic facts were cleared).
ensure_iniout :-
( laststream(_)
-> true
; iniout
).

% Safely open file and add to stack
tells(Filename) :-
ensure_iniout,
catch(open(Filename, write, Stream), _, fail),
catch(set_output(Stream), _, (catch(close(Stream), _, true), fail)),
% update stack
( catch(retract(laststream(N0)), _, fail)
-> true
; % Shouldn't happen because ensure_iniout/0 ran, but be defensive
N0 = 0
),
N is N0 + 1,
catch(assertz(laststream(N)), _, true),
catch(assertz(openstreams(N, Stream)), _, true).

% Safely close top stream and restore previous
tolds :-
ensure_iniout,
( catch(retract(laststream(N0)), _, fail)
-> true
; N0 = 0
),
( N0 =< 0
-> % underflow: restore recorded default output if we have it
catch(assertz(laststream(0)), _, true),
( openstreams(0, Default)
-> catch(set_output(Default), _, true)
; true
)
; % normal pop
( retract(openstreams(N0, Stream))
-> catch(close(Stream), _, true)
; true
),
N is N0 - 1,
catch(assertz(laststream(N)), _, true),
( openstreams(N, StreamPrev)
-> catch(set_output(StreamPrev), _, true)
; true
)
).

% Always reset to clean state on initialization
iniout :-
catch(retractall(laststream(_)), _, true),
catch(retractall(openstreams(_, _)), _, true),
catch(assertz(laststream(0)), _, true),
( catch(current_output(Default), _, fail)
-> catch(assertz(openstreams(0, Default)), _, true)
; true
).

:- initialization(iniout).
2 changes: 1 addition & 1 deletion loader.pl
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
iniloader:-
current_predicate(safe_consult/1) -> true
; assertz((
safe_consult(File) :-
safe_consult(File) :- % Replaces ensure_loaded/1 (ISO)
( already_loaded(File)
-> format('~N% Info: ~w already loaded. Skipping.~n', [File])
; (
Expand Down
44 changes: 38 additions & 6 deletions output/wn_query.pl-Output-3.1

Large diffs are not rendered by default.

13 changes: 7 additions & 6 deletions output/wn_valid.pl-Output-3.1
Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,12 @@ Morphological Info: [exc]
Loading prolog/wn_exc
% Consulting: prolog/wn_exc ... Done.

mk_ski executed in 0.12 seconds.
load_wn executed in 12.47 seconds.
mk_ski executed in 0.11 seconds.
Searching for ambiguous sense keys
OK

check_keys executed in 0.22 seconds.
check_keys executed in 0.24 seconds.
Loading prolog/wn_sk
% Info: prolog/wn_sk already loaded. Skipping.
Symmetric relations: [sim,ant,der,vgp]
Expand All @@ -82,7 +83,7 @@ Checking symmetry in vgp relation (wn_vgp.pl):
OK


symcheck executed in 0.27 seconds.
symcheck executed in 0.29 seconds.
Loading prolog/wn_g
% Info: prolog/wn_g already loaded. Skipping.
Asymmetric relations: [hyp,ins,mm,mp,ms,cls]
Expand Down Expand Up @@ -123,12 +124,12 @@ Looping cls-t:
OK


asymcheck executed in 0.12 seconds.
asymcheck executed in 0.11 seconds.

Empty (i.e. wordless) synsets:
OK

wordless executed in 0.12 seconds.
wordless executed in 0.11 seconds.

Semantic Relations: [at,cs,ent,hyp,ins,mm,mp,ms,sim]
Loading prolog/wn_at
Expand Down Expand Up @@ -250,4 +251,4 @@ Checking duplicates in exc/3
OK


check_duplicates executed in 2.08 seconds.
check_duplicates executed in 2.09 seconds.
1 change: 0 additions & 1 deletion prolog/wn_g.pl
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@

For more information, see: https://wordnet.princeton.edu
-------------------------------------------------------- */
:-encoding('iso_latin_1').
g(100001740,'that which is perceived or known or inferred to have its own distinct existence (living or nonliving)').
g(100001930,'an entity that has physical existence').
g(100002137,'a general concept formed by extracting common features from specific examples').
Expand Down
5 changes: 3 additions & 2 deletions timeit.pl
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,11 @@
% Measure the time taken to execute a given Goal once, and print the elapsed time.
current_time(StartTime),
call(Goal), % Always execute the Goal
Goal =.. [P|_],
(
StartTime == error
-> format('Timing unavailable for ~w.~n', [Goal])
-> format('Timing unavailable for ~w.~n', [P])
; current_time(EndTime),
Elapsed is EndTime - StartTime,
format('~w executed in ~2f seconds.~n', [Goal, Elapsed])
format('~w executed in ~2f seconds.~n', [P, Elapsed])
).
Loading