aboutsummaryrefslogtreecommitdiffstats
path: root/snips_inference_agl/entity_parser/custom_entity_parser_usage.py
diff options
context:
space:
mode:
authorMalik Talha <talhamalik727x@gmail.com>2023-10-22 21:06:23 +0500
committerJan-Simon Moeller <jsmoeller@linuxfoundation.org>2023-10-23 14:38:13 +0000
commit697a1adce1e463079e640b55d6386cf82d7bd6bc (patch)
tree86e299cc7fe12b10c2e549f640924b61c7d07a95 /snips_inference_agl/entity_parser/custom_entity_parser_usage.py
parent97029ab8141e654a170a2282106f854037da294f (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/entity_parser/custom_entity_parser_usage.py')
-rw-r--r--snips_inference_agl/entity_parser/custom_entity_parser_usage.py23
1 files changed, 23 insertions, 0 deletions
diff --git a/snips_inference_agl/entity_parser/custom_entity_parser_usage.py b/snips_inference_agl/entity_parser/custom_entity_parser_usage.py
new file mode 100644
index 0000000..72d420a
--- /dev/null
+++ b/snips_inference_agl/entity_parser/custom_entity_parser_usage.py
@@ -0,0 +1,23 @@
+from __future__ import unicode_literals
+
+from enum import Enum, unique
+
+
+@unique
+class CustomEntityParserUsage(Enum):
+ WITH_STEMS = 0
+ """The parser is used with stemming"""
+ WITHOUT_STEMS = 1
+ """The parser is used without stemming"""
+ WITH_AND_WITHOUT_STEMS = 2
+ """The parser is used both with and without stemming"""
+
+ @classmethod
+ def merge_usages(cls, lhs_usage, rhs_usage):
+ if lhs_usage is None:
+ return rhs_usage
+ if rhs_usage is None:
+ return lhs_usage
+ if lhs_usage == rhs_usage:
+ return lhs_usage
+ return cls.WITH_AND_WITHOUT_STEMS