Skip to content

Commit

Permalink
Use current_predicate/2 instead of current/functor/2
Browse files Browse the repository at this point in the history
  • Loading branch information
ekaf committed Feb 19, 2024
1 parent 4f92c30 commit d8dd4ca
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 27 deletions.
18 changes: 0 additions & 18 deletions pred_format.pl

This file was deleted.

6 changes: 2 additions & 4 deletions wn2csv.pl
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
/*
# https://github.com/ekaf/wordnet-prolog/raw/master/wn2csv.pl
(c) 2020 Eric Kafe, CC BY 4.0, https://creativecommons.org/licenses/by/4.0/
(c) 2020-24 Eric Kafe, CC BY 4.0, https://creativecommons.org/licenses/by/4.0/
SWI-prolog program to convert all WordNet databases to comma-separated CSV files
*/

:-consult('pred_format.pl').
:-consult('wn_load.pl').

pred2file(P):-
Expand All @@ -21,8 +20,7 @@
list2csv([B|T],S1,S2).

out2csv(P):-
current_functor(P,A),
pred2arity(P,A,L),
pred2arity(P,_,L),
apply(P,L),
list2csv(L,'',S),
writeln(S),
Expand Down
9 changes: 7 additions & 2 deletions wn_load.pl
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
# https://github.com/ekaf/wordnet-prolog/raw/master/wn_load.pl
(c) 2020 Eric Kafe, CC BY 4.0, https://creativecommons.org/licenses/by/4.0/
(c) 2020-24 Eric Kafe, CC BY 4.0, https://creativecommons.org/licenses/by/4.0/
SWI-prolog program to load all WordNet databases
*/
Expand Down Expand Up @@ -31,10 +31,15 @@
Load WN
------------------------------------------ */

pred2arity(P,A,L):-
current_predicate(P,Term),
Term =.. [P|L],
length(L,A).

loadpred(P):-
swritef(F,'prolog/wn_%w.pl',[P]),
consult(F),
current_functor(P,A),
pred2arity(P,A,_),
writef('Loaded %w (%w/%w)\n',[F,P,A]).

loadwn:-
Expand Down
5 changes: 2 additions & 3 deletions wn_valid.pl
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
# https://github.com/ekaf/wordnet-prolog/raw/master/wn_valid.pl
(c) 2020 Eric Kafe, CC BY 4.0, https://creativecommons.org/licenses/by/4.0/
(c) 2020-24 Eric Kafe, CC BY 4.0, https://creativecommons.org/licenses/by/4.0/
SWI-prolog program testing for some potential issues in WordNet:
Expand Down Expand Up @@ -67,7 +67,7 @@
member(R,L),
swritef(F,'wn_%w.pl',[R]),
writef('Checking symmetry in %w relation (%w):\n',[R,F]),
current_functor(R,N),
pred2arity(R,N,_),
symrel(N,R),
false.
symcheck:-
Expand Down Expand Up @@ -148,7 +148,6 @@
(N>0 -> outdups(N,P); ok).

check_duplicates:-
consult('pred_format.pl'),
allwn(LR),
member(P,LR),
pred2arity(P,A,L),
Expand Down

0 comments on commit d8dd4ca

Please sign in to comment.