|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object javatools.database.DBWordNet
public class DBWordNet
This class is part of the Java Tools (see http://mpii.de/yago-naga/javatools).
It is licensed under the Creative Commons Attribution License
(see http://creativecommons.org/licenses/by/3.0) by
the YAGO-NAGA team (see http://mpii.de/yago-naga).
This class provides a wrapping for WordNet
by a database. The database can be e.g. an OracleDatabase or a MySQLDatabase.
Before creating instances of this class, you have to build the
database by the construct-method. This method requires the Prolog-version of WordNet,
which can be downloaded from the WordNet-website.
Example:
// 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
Nested Class Summary | |
---|---|
static class |
DBWordNet.Table
One enum per SQL table |
Constructor Summary | |
---|---|
DBWordNet(Database db)
Constructs a new DBWordNet, basing on a filled database |
Method Summary | |
---|---|
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 |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public DBWordNet(Database db)
Method Detail |
---|
public static void construct(Database db, java.io.File wordNetFolder) throws java.sql.SQLException, java.io.IOException
java.sql.SQLException
java.io.IOException
public java.util.List<java.lang.Integer> targetSynsets(DBWordNet.Table relation, int source) throws java.sql.SQLException
java.sql.SQLException
public java.util.List<java.lang.Integer> synsetsFor(java.lang.String word) throws java.sql.SQLException
java.sql.SQLException
public java.util.List<java.lang.String> wordsFor(int synset) throws java.sql.SQLException
java.sql.SQLException
public java.lang.String glossFor(int synset) throws java.sql.SQLException
java.sql.SQLException
public static void main(java.lang.String[] args) throws java.lang.Exception
args
-
java.lang.Exception
public Database getDatabase()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |