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 and is maintained by Brett Spell, who is currently an adjunct member of the faculty in the Computer Science and Engineering (CSE) department at Southern Methodist University. On this page you'll find the following information: | ||||||||||||||||||||||||||||||
Using JAWS With Your ApplicationTo use JAWS in your application you must do the following:
|
||||||||||||||||||||||||||||||
Specifying the Database Directory | ||||||||||||||||||||||||||||||
The WordNet database files are found in the dict subdirectory
below your WordNet installation directory. For example, if you installed
WordNet in C:\WordNet-3.0\ the database files will be
located in the C:\WordNet-3.0\dict\ directory.You can either set the wordnet.database.dir property within
your code or it can be done externally. To set it from within your code
you must use the
setProperty()
method in the
System
class as in the following example:
wordnet.database.dir
property externally (outside your code) depends on how you're executing your
application. If you're running your code from within an Integrated Development
Environment (IDE) such as Eclipse you'll
need to use that IDE's support for setting system properties. For example,
Eclipse allows you to specify "VM Arguments" and you would need to include an
entry like the following in the list of arguments to use when running your code:
-D option as shown in the next section of these
instructions.
|
||||||||||||||||||||||||||||||
Starting Your Application | ||||||||||||||||||||||||||||||
Let's assume the following:
MyApp that contains a main() method:
java -classpath .;C:\mywork\code\jaws-bin.jar -Dwordnet.database.dir=C:\WordNet-3.0\dict MyApp |
||||||||||||||||||||||||||||||
Getting Started With the APIFrom 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 animport of the classes in the
edu.smu.tspell.wordnet
package:
Once you've done so, you can begin to retrieve synsets from the database as shown in the example below. This code retrieves all noun synsets for "fly" and loops through each one printing its first word form, its description, and the number of hyponyms associated with that noun synset:
|
||||||||||||||||||||||||||||||
| 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 the edu.smu.tspell.wordnet package. | ||||||||||||||||||||||||||||||
Downloads | ||||||||||||||||||||||||||||||
The following files are available for download:
| ||||||||||||||||||||||||||||||
Example Program | ||||||||||||||||||||||||||||||
|
A small sample program is available for download here that demonstrates how to use the API. It displays some of the attributes of the synset(s), if any, that contain the word form specified as the first argument specified when the program is executed. |
||||||||||||||||||||||||||||||
Changes
|
||||||||||||||||||||||||||||||