|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--net.sf.classifier4J.bayesian.JDBCWordsDataSource
A JDBC based datasource. It requires a table of the following structure (tested in MySQL 4):
CREATE TABLE word_probability ( word VARCHAR(255) NOT NULL, category VARCHAR(20) NOT NULL, match_count INT DEFAULT 0 NOT NULL, nonmatch_count INT DEFAULT 0 NOT NULL, PRIMARY KEY(word, category) )
It will truncate any word longer than 255 characters to 255 characters
Constructor Summary | |
JDBCWordsDataSource(IJDBCConnectionManager cm)
Create a JDBCWordsDataSource using the DEFAULT_CATEGORY ("DEFAULT") |
Method Summary | |
void |
addMatch(java.lang.String word)
Add a matching word to the data source |
void |
addMatch(java.lang.String category,
java.lang.String word)
Add a matching word to the data source |
void |
addNonMatch(java.lang.String word)
Add a non-matching word to the data source |
void |
addNonMatch(java.lang.String category,
java.lang.String word)
Add a non-matching word to the data source |
WordProbability |
getWordProbability(java.lang.String word)
|
WordProbability |
getWordProbability(java.lang.String category,
java.lang.String word)
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public JDBCWordsDataSource(IJDBCConnectionManager cm) throws WordsDataSourceException
cm
- The connection manager to useMethod Detail |
public WordProbability getWordProbability(java.lang.String category, java.lang.String word) throws WordsDataSourceException
getWordProbability
in interface ICategorisedWordsDataSource
category
- the category to check againstword
- The word to calculate the probability of
WordsDataSourceException
- If there is a fatal problem. For
example, the database is unavailablepublic WordProbability getWordProbability(java.lang.String word) throws WordsDataSourceException
getWordProbability
in interface IWordsDataSource
word
- The word to calculate the probability of
WordsDataSourceException
- If there is a fatal problem. For
example, the database is unavailablepublic void addMatch(java.lang.String category, java.lang.String word) throws WordsDataSourceException
ICategorisedWordsDataSource
addMatch
in interface ICategorisedWordsDataSource
category
- the category add the match toword
- the word that matches
WordsDataSourceException
- If there is a fatal problem. For
example, the database is unavailablepublic void addMatch(java.lang.String word) throws WordsDataSourceException
IWordsDataSource
addMatch
in interface IWordsDataSource
word
- the word that matches
WordsDataSourceException
- If there is a fatal problem. For
example, the database is unavailablepublic void addNonMatch(java.lang.String category, java.lang.String word) throws WordsDataSourceException
ICategorisedWordsDataSource
addNonMatch
in interface ICategorisedWordsDataSource
category
- the category add the non-match toword
- the word that does not match
WordsDataSourceException
- If there is a fatal problem. For
example, the database is unavailablepublic void addNonMatch(java.lang.String word) throws WordsDataSourceException
IWordsDataSource
addNonMatch
in interface IWordsDataSource
word
- the word that does not match
WordsDataSourceException
- If there is a fatal problem. For
example, the database is unavailable
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |