|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objecttextmaven.dictionaries.BaseDictionary
textmaven.dictionaries.Dictionary
textmaven.dictionaries.DBDictionary
Implements a database backed dictionary.
The current implementation is tested with MySQL. For supporting a different database it should
be sufficient to overwrite the methods:
Further the configuration has to be adapted appropriately.
Field Summary | |
static java.lang.String[] |
NDX_DIR_LIST
|
Fields inherited from interface textmaven.Globals |
C_ATTR_CLASSNAME, C_DICT_BASE_TYPE, C_DICT_TYPE, C_SERVER_BASE_TYPE, C_STEMMER_BASE_TYPE, C_WRITER_BASE_TYPE, CONFIG_FILE, DEFAULT_SENTENCES, DEFAULT_SEPARATOR, NEW_PARA, T_COL_DICTIONARY, T_COL_HOMONYMID, T_COL_ID, T_COL_LEXKEY, T_COL_TRANSLATION, T_COL_WORDCLASS, VERBOSE |
Constructor Summary | |
DBDictionary()
Constructor |
Method Summary | |
void |
close()
Performs close operations on the source. |
boolean |
containsKey(java.lang.String key)
Checks whether a key is contained in the dictionary. |
java.lang.String |
getIndexFile()
|
IDatabaseServer |
getServer()
Gets server used when accessing the database. |
java.lang.String |
getTableName()
|
boolean |
isAutoCommit()
|
java.util.Iterator |
keys()
Returns all keys as specified in dictionary. |
java.util.Iterator |
keysWithPrefix(java.lang.String prefix)
Returns all keys starting with the specified prefix |
void |
open()
Opens connection to datasource |
void |
setAutoCommit(java.lang.String autoCommit)
|
void |
setIndexFile(java.lang.String indexFileName)
|
void |
setServer(IDatabaseServer server)
Sets server which is to be used for database lookups |
void |
setTableName(java.lang.String tableName)
|
java.util.Iterator |
translations()
Returns all translations available in the dictionary. |
java.util.Iterator |
translations(java.lang.String word)
Retrieves available translations for a given word. |
void |
write(Translation t)
Writes translation to database. |
Methods inherited from class textmaven.dictionaries.Dictionary |
getStemmer, keys, setStemmer |
Methods inherited from class textmaven.dictionaries.BaseDictionary |
getDescription, getId, getLanguage, setDescription, setId, setLanguage, toString |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Methods inherited from interface textmaven.dictionaries.IDictionary |
keys |
Methods inherited from interface textmaven.dictionaries.IBaseDictionary |
getDescription, getId, getLanguage, setDescription, setId, setLanguage |
Field Detail |
public static final java.lang.String[] NDX_DIR_LIST
Constructor Detail |
public DBDictionary()
Method Detail |
public IDatabaseServer getServer()
public void setServer(IDatabaseServer server)
server
- The server to set.public java.lang.String getIndexFile()
public void setIndexFile(java.lang.String indexFileName)
indexFileName
- The indexFileName to set.public java.lang.String getTableName()
public void setTableName(java.lang.String tableName)
tableName
- The tableName to set.public void write(Translation t)
write
in interface IDictionaryWriter
IDictionaryWriter.write(textmaven.dictionaries.Translation)
public java.util.Iterator translations(java.lang.String word)
IDictionary
The word is retrieved from the dictionary as passed in as parameter. If no translation is found, an empty iterator.
translations
in interface IDictionary
translations
in class Dictionary
public java.util.Iterator translations()
IDictionary
translations
in interface IDictionary
Translation
public boolean containsKey(java.lang.String key)
IDictionary
containsKey
in interface IDictionary
containsKey
in class Dictionary
public java.util.Iterator keys()
IDictionary
keys
in interface IDictionary
keys
in class Dictionary
public java.util.Iterator keysWithPrefix(java.lang.String prefix)
IDictionary
keysWithPrefix
in interface IDictionary
prefix
-
public void open()
IBaseDictionary
open
in interface IBaseDictionary
open
in class Dictionary
public void close()
IBaseDictionary
close
in interface IBaseDictionary
close
in class Dictionary
public boolean isAutoCommit()
public void setAutoCommit(java.lang.String autoCommit)
autoCommit
- The autoCommit to set.
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |