Package tipy :: Module drvr :: Class Driver
[hide private]
[frames] | no frames]

Class Driver

source code

The Driver class gather classes inctances and variables of the program.

Class Hierarchy for Driver
Class Hierarchy for Driver

Instance Methods [hide private]
 
__init__(self, callback, configFile='')
The driver class.
source code
list
predict(self)
Request suggested words to predictors.
source code
 
learn_from_buffers(self)
Simple ContextMonitor.update() wrapper for comprehension sake.
source code
 
make_completion(self, suggestion)
Simple ContextMonitor.make_completion() wrapper.
source code
 
close_databases(self)
Close every opened predictors database.
source code
drvr.Configuration
make_config(self)
Initialize the config dictionary.
source code
Method Details [hide private]

__init__(self, callback, configFile='')
(Constructor)

source code 

The driver class. It hold every elements needed for the prediction.

Parameters:
  • callback (Callback) - The callback is used to access the input buffers from anywhere.
  • configFile (str) - Path of the configuration file.

predict(self)

source code 

Request suggested words to predictors.

This method:

  • Do the next two steps until it cannot get more suggestions.
  • Call the prdct.PredictorActivator.predict which:
    • Call the prdct.Predictor.predict method of each predictors in the predictorRegistry. Each predict() method should return a Prediction instance containing the suggested words computed by the predictor (it may be empty).
    • Merge the Prediction instances into a single Prediction instance.
  • Select the best suggestions in the Prediction instance and remove the excess.
  • Learn from what the user have typped.
  • Return the selected suggestions.
Returns: list
The suggested words list.

make_config(self)

source code 

Initialize the config dictionary.

This method first try to read the configuration file and parse it into a Configuration instance (dictionary). If the config file is empty or dosen't exists, than a default config dictionary is created.

Returns: drvr.Configuration
The Configuration instance holding every settings (dictionary style).