aboutsummaryrefslogtreecommitdiffstats
path: root/snips_inference_agl/entity_parser/custom_entity_parser_usage.py
blob: 72d420a1e693a2e743a1220e16a1bdf577437f9c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
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