Java API for WordNet Searching (JAWS)

As its name implies, the Java API for WordNet Searching (JAWS) is an API that provides Java applications with the ability to retrieve data from the WordNet database. It is a simple and fast API that is compatible with both the 2.1 and 3.0 versions of the WordNet database files and can be used with Java 1.4 and later. JAWS was created by Brett Spell as a project for Dr. Margaret Dunham's class on Information Retrieval at Southern Methodist University.
 

Using JAWS With Your Application

To use JAWS in your application you must do the following:
  1. Obtain a copy of the WordNet database files, which can be accomplished by downloading and installing WordNet (click here to see the installation options that are available).
  2. Download the Java Archive (JAR) file containing the compiled JAWS code (available here).
  3. When starting your application you must:
    • Include the JAR file you downloaded in your Java Virtual Machine's class path.
    • Use the wordnet.database.dir system property to specify where the WordNet database files are located. If you installed the WordNet application, the files will be found in the /dict subdirectory below your WordNet installation directory.
 
For example, let's assume the following:
  • You've downloaded the JAR file containing the JAWS executable code to a Windows machine and saved it as jaws.jar in your C:/mywork/code directory.
  • You installed WordNet to a directory named C:/WordNet-3.0/ which in turn would mean that the database files are located in C:/WordNet-3.0/dict/.
In this case, you could start a Java Virtual Machine from the command line like the one shown below, which assumes that you also have defined a class called MyApp that contains a main() method:

java -classpath .;C:/mywork/code/jaws.jar -Dwordnet.database.dir=C:/WordNet-3.0/dict MyApp
 

Getting Started With the API

From within the application you started you can use JAWS by first obtaining an instance of WordNetDatabase with code like the following, which assumes that you've performed an import of the classes in the edu.smu.tspell.wordnet package:

WordNetDatabase database = WordNetDatabase.getFileInstance();

Once you've done so, you can begin to retrieve synsets from the database as shown in the example below:

Synset[] nounFlies = database.getSynsets("fly", SynsetType.NOUN);
Synset[] allFlies = database.getSynsets("fly");

For more information on how to use JAWS you can browse the API documentation, although in most cases your application should only need to refer to the types defined in edu.smu.tspell.wordnet.
 

Changes

  • February 13, 2008 -- Removed unused code and changed version to 1.1
 

Downloads

The following files are available for download:

Name Description Links
jaws-src-1.1.jar Source code Download
jaws-bin-1.1.jar Runtime library Download
jaws-doc-1.1.zip API documentation Download -or- browse online

A small sample program is also available here that demonstrates how to use the API. It is run from the command line and displays some of the attributes of the synset(s), if any, that contain the word form you specified.

 
Last updated on February 13, 2008.