Package tipy :: Module db
[hide private]
[frames] | no frames]

Module db

source code

Classes to connect to databases.

Classes [hide private]
  OpenFileError
  DatabaseConnector
Implement methods for accessing the databases.
  SqliteDatabaseConnector
Database connector for sqlite databases.
Functions [hide private]
 
insert_ngrams(ngramMap, n, outfile, append=False, createIndex=False, callback=None)
Insert every n-grams of the map in the database.
source code
Variables [hide private]
  __package__ = 'tipy'
Function Details [hide private]

insert_ngrams(ngramMap, n, outfile, append=False, createIndex=False, callback=None)

source code 

Insert every n-grams of the map in the database.

This function open a database and insert or update every n-grams of the given list in it.

Parameters:
  • ngramMap (list) - The list of n-grams to insert or update.
  • n (int) - The n in n-gram.
  • outfile (str) - Path to the database.
  • append (bool) - Indicate weither the n-gram should be append to the database. If the database isn't empty, this function could raise conflict when trying to insert an n-gram which is already in the database. When such conflicts happen the append value is important:
    • True: conflicting records count values are updated.
    • False: conflicting records are replaced by new records.
  • createIndex (bool) - Indicate weither the database table indexes should be created.
  • callback (fun(float, ...)) - The callback is used to show the progress percentage. In the gui a callback method is implemented to update a progress bar showing the n-grams insertion progress (cf. py).