RecognitionOptions.py 847 B

123456789101112131415161718192021222324252627
  1. class RecognitionOptions(object):
  2. """
  3. This Class is representing a Speech To Text (STT) Recognition elements with name and parameters
  4. .. note:: must be defined in the settings.yml
  5. """
  6. def __init__(self, energy_threshold=4000, adjust_for_ambient_noise_second=0):
  7. self.energy_threshold = energy_threshold
  8. self.adjust_for_ambient_noise_second = adjust_for_ambient_noise_second
  9. def __str__(self):
  10. return str(self.serialize())
  11. def serialize(self):
  12. return {
  13. 'energy_threshold': self.energy_threshold,
  14. 'adjust_for_ambient_noise_second': self.adjust_for_ambient_noise_second
  15. }
  16. def __eq__(self, other):
  17. """
  18. This is used to compare 2 objects
  19. :param other:
  20. :return:
  21. """
  22. return self.__dict__ == other.__dict__