Prolog

The quickest and best way to become familiar with wnconnect's Prolog implementation is through a few examples.

[An example of use is also given in the main page of the user guide for the graphical user interface (GUI) version (here) in the discussion on common file number.]

Let's look at the following screen snapshot:

  1. The main file (shown in the background) is connection.pl.
    It defines the predicate connect/2 and the breadth-first search strategy used for looking through the database of semantic relations.
  2. In the foreground, we have Sicstus Prolog running in a terminal window.
  3. ?- restore(connection). loads the entire Prolog database and search code in a single command.
  4. ?- connect(happy/a,unhappy/a) looks for all possible paths between happy and unhappy restricted to category adjective (a) only.
  5. ?- ctr_set(15,1), ctr(16,1). sets counters 15 and 16 to 1.
    Counter 15: (0) default: find all paths. (1) find shortest path.
    Counter 16: (0) default. (1) shows WordNet synset ids and offsets.
  6. Next, ?- connect(mend,tear). finds the shortest path between mend and tear unrestricted by category.