Skip to content

ekaf/wordnet-prolog

Repository files navigation

wordnet-prolog

https://github.com/ekaf/wordnet-prolog

Wordnet-prolog includes new versions of the WNprolog databases, compiled by Eric Kafe (https://github.com/ekaf/wordnet-prolog), and bundled with a copy of the original WNprolog-3.0 documentation (c) 2012 Princeton University.

License

The code and logic in this repository are licensed under the Apache License 2.0.

The WordNet documentation and database files in this release are subject to the following third-party license:

Full attribution details and copyright notices are maintained in the NOTICE file.

WNprolog-3.1

WNprolog-3.1 is a Prolog version of WordNet 3.1. The Prolog databases were generated from the original WordNet 3.1 databases (c) 2011 Princeton University,

Some missing links were added, in order to enforce full symmetry of the symmetric relations. Also, this version avoids duplicates, and contains only unique facts:

  • wn_ant.pl: 7988
  • wn_at.pl: 1278
  • wn_cls.pl: 9559
  • wn_cs.pl: 221
  • wn_der.pl: 74781
  • wn_ent.pl: 408
  • wn_exc.pl: 6053
  • wn_fr.pl: 21684
  • wn_g.pl: 117791
  • wn_hyp.pl: 89172
  • wn_ins.pl: 8589
  • wn_mm.pl: 12288
  • wn_mp.pl: 9111
  • wn_ms.pl: 797
  • wn_per.pl: 8074
  • wn_ppl.pl: 73
  • wn_sa.pl: 4054
  • wn_sim.pl: 21434
  • wn_sk.pl: 207272
  • wn_s.pl: 207272
  • wn_syntax.pl: 1054
  • wn_vgp.pl: 1744
  • total: 810697

Other Prolog versions of WordNet

The wordnet-prolog repository also includes alternative branches with Prolog versions of WordNet 3.0 and Open English Wordnet.

These are available for download as compressed packages, from the Github Releases menu.

Utilities:

The following are standard Prolog programs, intended for compatibility with the ISO-Prolog standard:

wn_morphy.pl is a Prolog lemmatizer, similar to morphy, the morphological processor from WordNet.

wn_valid.pl is a Prolog program testing for some potential issues in WordNet:

  • check_keys: ambiguous sense keys, pointing to more than one synset
  • symcheck: missing symmetry in the symmetric relations
  • asymcheck: direct loops in the asymmetric relations
  • hypself: self-hyponymous word forms
  • check_duplicates: find duplicate clauses

The accompanying wn_query.pl file is a Prolog program implementing some common WordNet use cases, and a few formal checks, like symmetry and transitive loop detection.

For convenient inter-operation with other projects, the wn2csv.pl program converts the Prolog databases to comma-separated CSV files, which can be easily imported into most database systems.

Type "make valid" or "make query" to run the Prolog programs, or "make csv" to generate CSV databases.

News (2020):

CSV versions of the WordNet databases (output by wn2csv.pl) are now available through the wncsv project at:

https://github.com/ekaf/wncsv

News (2025):

  • Added utils.pl: system-independent implementations of non-standard predicates.
  • Added timeit.pl to time predicate calls.

The programs have been made less specific to SWI by Daniel Diaz and Eric Kafe. To achieve this, we have favored ISO Prolog and commonly supported extensions (such as format/2). The corresponding PRs (#8 and #10) include more info about the changes.

The Makefile design has been revised so that the desired Prolog can be passed as a parameter with:

make PL=

Currently, in addition to SWI Prolog (swi), GNU Prolog (gprolog) or Trealla Prolog (tpl) can also be used. It should be easy to add support for other systems.

For ex. to run wn_valid.pl with the default SWI-Prolog:

make valid

Or specify PL=gprolog to use gprolog instead of the default:

make valid PL=gprolog

News (2026):

  • Speed up the transitive relation closures, for ex. thyp in wn_query.
  • 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.