Home | Trees | Indices | Help |
|
---|
|
object --+ | DatabaseConnector
Implement methods for accessing the databases.
![]() |
Class Hierarchy for DatabaseConnector |
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
tuple |
|
||
int |
|
||
int |
|
||
int |
|
||
list |
|
||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
Inherited from |
|
|||
singleQuoteRegex = re.compile(r'\'')
|
|
|||
Inherited from |
|
DababaseConnector creator.
|
Creates a table in the database to store n-gram of a given n.
|
Drop a n-gram table in the database.
|
Create the index for the table storing n-gram of given n.
|
Drop the index for the table storing n-gram of given n.
|
Create the database tables and indexes if they don't exists. This is usefull to avoid crash when trying to hit an unexisting table. |
Returns all ngrams that are in every tables of the database.
Note: The result is convert to tuple before being returned because it is used as a dictionary key and only immutable types can be used as dictionary key, so list cannot. |
Compute the occurences sum of every n-grams of given n in database.
|
Compute the number of n-grams in the n-grams table of given n.
|
Retrieve the number of occurences of a given ngram in the database.
|
Retrieve the n-gram records which complete the given n-gram. For instance, if ngram is: ['on', 'the', 'ta'] Then the returned records would be somthing like: [['on', 'the', 'table' ], 5] [['on', 'the', 'take' ], 1] [['on', 'the', 'taskbar'], 1]
Note: the query makes sure the n-grams are returned in descending order according to their number of occurences. This is important because the predictors predict() methods which would call this method can limit their suggestion number so the most probable suggestions (which are based on most frequent n-grams) must be append to the list first. |
Insert an n-gram with its number of occurences into the database.
|
Update an n-gram number of occurences in the database.
Warning: The ngram has to be in the database, otherwise this method will fail. |
Remove a given ngram from the databae.
Warning: The ngram has to be in the database, otherwise this method will fail. |
Home | Trees | Indices | Help |
|
---|
Generated by Epydoc 3.0.1 on Tue Jul 14 21:07:50 2015 | http://epydoc.sourceforge.net |