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

Class LastOccurPredictor

source code

object --+    
         |    
 Predictor --+
             |
            LastOccurPredictor

Compute predictions based on their last occurences and frequencies.

Class Hierarchy for LastOccurPredictor
Class Hierarchy for LastOccurPredictor

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)
LastOccurPredictor creator.
source code
Prediction
predict(self, maxPartialPredictionSize, stopList=[])
Compute the predictions using a simple exponential decay method.
source code
 
learn(self, text)
This predictor has no ability to learn.
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 

LastOccurPredictor 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 

Compute the predictions using a simple exponential decay method.

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, text)

source code 

This predictor has no ability to learn.

Overrides: Predictor.learn