public class DBWordNet
extends java.lang.Object
// Execute this only once to create the database!
Database database=new OracleDatabase("scott","tiger");
DBWordNet.construct(database, new File("wordnet/prologversion"));
// Use this code to access the data
Database database=new OracleDatabase("scott","tiger");
DBWordNet wordnet = new DBWordNet(database);
System.out.println(wordnet.synsetsFor("house"));
---> 103413667, 103413668, 103413669 (or similar)
System.out.println(wordnet.glossFor(103413667));
---> a dwelling that serves as living quarters for one or more families
| Modifier and Type | Class and Description |
|---|---|
static class |
DBWordNet.Table
One enum per SQL table
|
| Modifier and Type | Field and Description |
|---|---|
protected Database |
database
Holds the database
|
| Constructor and Description |
|---|
DBWordNet(Database db)
Constructs a new DBWordNet, basing on a filled database
|
| Modifier and Type | Method and Description |
|---|---|
static void |
construct(Database db,
java.io.File wordNetFolder)
Fills the database with WordNet data
|
Database |
getDatabase()
Returns the database
|
java.lang.String |
glossFor(int synset)
Returns the gloss for a synset
|
static void |
main(java.lang.String[] args) |
java.util.List<java.lang.Integer> |
synsetsFor(java.lang.String word)
Returns synsets for a word
|
java.util.List<java.lang.Integer> |
targetSynsets(DBWordNet.Table relation,
int source)
Returns target synsets for a relation and a source synset
|
java.util.List<java.lang.String> |
wordsFor(int synset)
Returns words of a synset
|
protected Database database
public DBWordNet(Database db)
public static void construct(Database db, java.io.File wordNetFolder) throws java.sql.SQLException, java.io.IOException
java.sql.SQLExceptionjava.io.IOExceptionpublic java.util.List<java.lang.Integer> targetSynsets(DBWordNet.Table relation, int source) throws java.sql.SQLException
java.sql.SQLExceptionpublic java.util.List<java.lang.Integer> synsetsFor(java.lang.String word)
throws java.sql.SQLException
java.sql.SQLExceptionpublic java.util.List<java.lang.String> wordsFor(int synset)
throws java.sql.SQLException
java.sql.SQLExceptionpublic java.lang.String glossFor(int synset)
throws java.sql.SQLException
java.sql.SQLExceptionpublic static void main(java.lang.String[] args)
throws java.lang.Exception
args - java.lang.Exceptionpublic Database getDatabase()