Não pode escolher mais do que 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.

adjusters.py 934 B

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."""