I would like to be able to check if two words are similar (using the path similarity) in WordNet with Prolog.
I found on the internet this article doing exactly what I want.
I'll paste here the steps needed to let this work:
Download WordNet 3.0 Prolog version from http://wordnetcode.princeton.edu/3.0/WNprolog-3.0.tar.gz and unzip it in a directory of your choice. For example: c:\wn_prologDB
Set the environment variable WNDB to this newly created directory.
For example, use either the system dialog box in Control Panel
(Environment Variables), or write in a Command Prompt (cmd.exe):
set WNDB=c:\wn_prologDB
Download the modules of WN_CONNECT from https://dectau.uclm.es/bousi-prolog/applications and unzip it in a directory of your choice. For example: c:\wn
Add to the PATH environment variable the directory where this tool is located (similar to step 2 above): set PATH=c:\wn;%PATH%
Open a terminal and execute the shell script: wn.sh
I followed those steps, and run wn.bat (since I'm using windows).
As you can see from the picture, the wn_word_info
predicate is working, while I cannot understand why wn_path
is not working.
Here is the signature:
wn_path(+Word1, +Word2, -Degree)
Any tips on how I could get it to work? Or any solution to calculate path similarity?
The signature was a bit different:
wn_path(+Word1:SS_type1:W1_Sense_num, +Word2:SS_type2:W2_Sense_num, -Degree)
So this actually works:
wn_path(cat:A:B, dog:C:D, E).
Here I'm specifying only the word and the other parameters are variables, but one can specify all three the parameters.
I paste here some of the docs I found in the WN_CONNECT folder:
** wn_path(+Word1:SS_type1:W1_Sense_num, +Word2:SS_type2:W2_Sense_num, -Degree): This predicate implements the PATH similarity measure. Takes two concepts (terms -- Word:SS_type:Sense_num) and returns the degree of similarity between them. Note that we do not explicitly require information about the synset type and sense number of a word (that can be variables).