Nelze vybrat více než 25 témat Téma musí začínat písmenem nebo číslem, může obsahovat pomlčky („-“) a může být dlouhé až 35 znaků.

12345678910111213141516171819202122232425
  1. """adjusters.py -- adjust the gathered Features
  2. This is usually done to either modify to reduce the Features in some way.
  3. For example:
  4. - TargetTimeAdjuster: drop Features until the target time is reached
  5. - FeatureCountAdjuster: drop Features until the target number of Features is reached
  6. TODO: Consider eg a generic PredicateAdjuster -- supply a predicate/lambda that will be used to determine whether to keep a Feature or not.
  7. """
  8. class Adjuster():
  9. """Generic Adjuster class. Expects a list of Features and returns a list of Features."""
  10. def __init__(self, features: list=[]):
  11. """Initialize the Adjuster with Features.
  12. NOTE: an empty feature list is permitted, since a FeatureExtractor may not produce features. Adjusters subclassing should be aware of this.
  13. """
  14. self.features = features
  15. def adjust(self):
  16. """Adjust the Features. Override this method in subclasses."""