diff options
author | 2023-10-22 21:06:23 +0500 | |
---|---|---|
committer | 2023-10-23 14:38:13 +0000 | |
commit | 697a1adce1e463079e640b55d6386cf82d7bd6bc (patch) | |
tree | 86e299cc7fe12b10c2e549f640924b61c7d07a95 /snips_inference_agl/pipeline/configs/config.py | |
parent | 97029ab8141e654a170a2282106f854037da294f (diff) |
Add Snips Inference Module
Add slightly modified version of the original Snips NLU
library. This module adds support for Python upto version
3.10.
Bug-AGL: SPEC-4856
Signed-off-by: Malik Talha <talhamalik727x@gmail.com>
Change-Id: I6d7e9eb181e6ff4aed9b6291027877ccb9f0d846
Diffstat (limited to 'snips_inference_agl/pipeline/configs/config.py')
-rw-r--r-- | snips_inference_agl/pipeline/configs/config.py | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/snips_inference_agl/pipeline/configs/config.py b/snips_inference_agl/pipeline/configs/config.py new file mode 100644 index 0000000..4267fa2 --- /dev/null +++ b/snips_inference_agl/pipeline/configs/config.py @@ -0,0 +1,49 @@ +from __future__ import unicode_literals + +from abc import ABCMeta, abstractmethod, abstractproperty +from builtins import object + +from future.utils import with_metaclass + + +class Config(with_metaclass(ABCMeta, object)): + @abstractmethod + def to_dict(self): + pass + + @classmethod + def from_dict(cls, obj_dict): + raise NotImplementedError + + +class ProcessingUnitConfig(with_metaclass(ABCMeta, Config)): + """Represents the configuration object needed to initialize a + :class:`.ProcessingUnit`""" + + @abstractproperty + def unit_name(self): + raise NotImplementedError + + def set_unit_name(self, value): + pass + + def get_required_resources(self): + return None + + +class DefaultProcessingUnitConfig(dict, ProcessingUnitConfig): + """Default config implemented as a simple dict""" + + @property + def unit_name(self): + return self["unit_name"] + + def set_unit_name(self, value): + self["unit_name"] = value + + def to_dict(self): + return self + + @classmethod + def from_dict(cls, obj_dict): + return cls(obj_dict) |