tipy :: prdct :: MemorizePredictor :: Class MemorizePredictor
[hide private]
[frames] | no frames]

Class MemorizePredictor

source code

object --+    
         |    
 Predictor --+
             |
            MemorizePredictor

Predict words based on memorized (learnt) input tokens patterns.

This predictor is capable of tokens memorization. It memorize the inputed tokens and try to predict the suggestion using memorized tokens and n-grams (group of consecutive tokens).

Class Hierarchy for MemorizePredictor
Class Hierarchy for MemorizePredictor

Nested Classes [hide private]
    Inherited from Predictor
  __metaclass__
Metaclass for defining Abstract Base Classes (ABCs).
Instance Methods [hide private]
 
__init__(self, config, contextMonitor, predictorName=None)
MemorizePredictor creator.
source code
Prediction
predict(self, maxPartialPredictionSize, stopList)
Predict words based on memorized input tokens.
source code
 
learn(self, change)
Learn what need to be learnt by tokens in the memory file.
source code
 
init_mem_trigg(self, memTrigger) source code
 
init_rolling_window(self, rollingWindow, memFile) source code
 
update_rolling_window(self, rollingWindow, token) source code

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __str__, __subclasshook__

Class Variables [hide private]
  __abstractmethods__ = frozenset([])
    Inherited from Predictor
  _abc_cache = <_weakrefset.WeakSet object at 0x7f2a42360550>
  _abc_negative_cache = <_weakrefset.WeakSet object at 0x7f2a423...
  _abc_negative_cache_version = 39
  _abc_registry = <_weakrefset.WeakSet object at 0x7f2a42360490>
Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self, config, contextMonitor, predictorName=None)
(Constructor)

source code 

MemorizePredictor creator.

Parameters:
  • config (drvr.Configuration) - The config is used to retrieve the predictor settings from the config file.
  • contextMonitor (ContextMonitor) - The contextMonitor is needed because it allow the predictor to get the input buffers tokens.
  • predictorName (str) - The custom name of the configuration using this predictor.
Overrides: object.__init__

predict(self, maxPartialPredictionSize, stopList)

source code 

Predict words based on memorized input tokens.

Parameters:
  • maxPartialPredictionSize (int) - Maximum number of suggestion to compute. If this number is reached, the suggestions list is immediatly return. DatabaseConnector.ngram_table_tp() returns the records in descending order according to their number of occurences so the most probable suggestions will be added to the list first. This result in no suggestion quality loss, regardless of the desired number of suggestions.
  • stopList (list) - The stoplist is a list of undesirable words. Any suggestion which is in the stopList won't be added to the suggestions list.
Returns: Prediction
A list of every suggestions possible (limited to maxPartialPredictionSize).
Overrides: Predictor.predict

learn(self, change)

source code 

Learn what need to be learnt by tokens in the memory file.

Parameters:
  • change (str) - The part of the left input buffer which represent the last change.
Overrides: Predictor.learn