Package net.didion.jwnl.utilities
Class DictionaryToDatabaseWithUsageCount
java.lang.Object
net.didion.jwnl.utilities.DictionaryToDatabaseWithUsageCount
DictionaryToDatabase is used to transfer a WordNet file database into an actual
database structure.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate ConnectionThe database connection.private MapMapping of database id's to synset offset id's.private static intprivate static final MessageLogOur message log.private MapMapping of synset offset id's to database id's.private static longprivate MapMaps the usage. -
Constructor Summary
ConstructorsConstructorDescriptionCreate a new DictionaryToDatabase with a database connection. -
Method Summary
Modifier and TypeMethodDescriptionvoidcreateTables(String scriptFilePath) Create the database tables.voidInserts the data into the database.private voidloadSenseKeyAndUsage(String filename) loads the sense key usage from a file.static voidRun the program, requires 4 arguments.private static intnextId()private voidstoreExceptions(Iterator itr) Store the exceptions file.private voidstoreIndexWords(Iterator itr) Store all the index words.private voidStore the index word synsets.private voidstoreSynsets(Iterator itr) Store all of the synsets in the database.
-
Field Details
-
LOG
Our message log. -
INTERNAL_ID
private static int INTERNAL_ID -
TIME
private static long TIME -
connection
The database connection. -
idToSynsetOffset
Mapping of database id's to synset offset id's. 1 to 1. -
synsetOffsetToId
Mapping of synset offset id's to database id's. 1:1. -
usageMap
Maps the usage. The key is 'offset:lemma', the object[] contains the sense key (string) and the usage count (integer).
-
-
Constructor Details
-
DictionaryToDatabaseWithUsageCount
Create a new DictionaryToDatabase with a database connection. JWNL already initialized.- Parameters:
conn- - the database connection
-
-
Method Details
-
main
Run the program, requires 4 arguments. See DictionaryToDatabase.txt for more documentation.- Parameters:
args-
-
nextId
private static int nextId() -
createTables
Create the database tables.- Parameters:
scriptFilePath- - the sql script filename- Throws:
IOExceptionSQLException
-
insertData
Inserts the data into the database. Iterates through the various POS, then stores all the index words, synsets, exceptions of that POS.- Throws:
Exception
-
storeIndexWords
Store all the index words.- Parameters:
itr- - the part of speech iterator- Throws:
SQLException
-
storeSynsets
Store all of the synsets in the database.- Parameters:
itr-- Throws:
SQLException
-
storeIndexWordSynsets
Store the index word synsets.- Throws:
SQLException
-
loadSenseKeyAndUsage
loads the sense key usage from a file.- Throws:
SQLException
-
storeExceptions
Store the exceptions file.- Parameters:
itr-- Throws:
SQLException
-