public class DBWordNet extends 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,
File wordNetFolder)
Fills the database with WordNet data
|
Database |
getDatabase()
Returns the database
|
String |
glossFor(int synset)
Returns the gloss for a synset
|
static void |
main(String[] args) |
List<Integer> |
synsetsFor(String word)
Returns synsets for a word
|
List<Integer> |
targetSynsets(DBWordNet.Table relation,
int source)
Returns target synsets for a relation and a source synset
|
List<String> |
wordsFor(int synset)
Returns words of a synset
|
protected Database database
public DBWordNet(Database db)
public static void construct(Database db, File wordNetFolder) throws SQLException, IOException
SQLExceptionIOExceptionpublic List<Integer> targetSynsets(DBWordNet.Table relation, int source) throws SQLException
SQLExceptionpublic List<Integer> synsetsFor(String word) throws SQLException
SQLExceptionpublic List<String> wordsFor(int synset) throws SQLException
SQLExceptionpublic String glossFor(int synset) throws SQLException
SQLExceptionpublic Database getDatabase()
Copyright © 2018. All rights reserved.