aboutsummaryrefslogtreecommitdiffstats
path: root/snips_inference_agl/pipeline/configs/features.py
blob: fa12e1a5a0d9478299edf0307de7089f6c5e426f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
def default_features_factories():
    """These are the default features used by the :class:`.CRFSlotFiller`
        objects"""

    from snips_inference_agl.slot_filler.crf_utils import TaggingScheme
    from snips_inference_agl.slot_filler.feature_factory import (
        NgramFactory, IsDigitFactory, IsFirstFactory, IsLastFactory,
        ShapeNgramFactory, CustomEntityMatchFactory, BuiltinEntityMatchFactory)

    return [
        {
            "args": {
                "common_words_gazetteer_name": None,
                "use_stemming": False,
                "n": 1
            },
            "factory_name": NgramFactory.name,
            "offsets": [-2, -1, 0, 1, 2]
        },
        {
            "args": {
                "common_words_gazetteer_name": None,
                "use_stemming": False,
                "n": 2
            },
            "factory_name": NgramFactory.name,
            "offsets": [-2, 1]
        },
        {
            "args": {},
            "factory_name": IsDigitFactory.name,
            "offsets": [-1, 0, 1]
        },
        {
            "args": {},
            "factory_name": IsFirstFactory.name,
            "offsets": [-2, -1, 0]
        },
        {
            "args": {},
            "factory_name": IsLastFactory.name,
            "offsets": [0, 1, 2]
        },
        {
            "args": {
                "n": 1
            },
            "factory_name": ShapeNgramFactory.name,
            "offsets": [0]
        },
        {
            "args": {
                "n": 2
            },
            "factory_name": ShapeNgramFactory.name,
            "offsets": [-1, 0]
        },
        {
            "args": {
                "n": 3
            },
            "factory_name": ShapeNgramFactory.name,
            "offsets": [-1]
        },
        {
            "args": {
                "use_stemming": False,
                "tagging_scheme_code": TaggingScheme.BILOU.value,
            },
            "factory_name": CustomEntityMatchFactory.name,
            "offsets": [-2, -1, 0],
            "drop_out": 0.5
        },
        {
            "args": {
                "tagging_scheme_code": TaggingScheme.BIO.value,
            },
            "factory_name": BuiltinEntityMatchFactory.name,
            "offsets": [-2, -1, 0]
        },
    ]