Exemple #1
0
    def setUp(self) -> None:
        config = {
            "engines": {
                "adapt": {
                    "enabled": True
                },
                "palavreado": {
                    "enabled": True
                }
            }
        }
        intents = IntentBox(config=config)

        intents.register_regex_entity("Location",
                                      [r'\b(at|in|for) (?P<Location>.*)'])
        intents.register_entity("time", ["time", "hours", "hour"])
        intents.register_keyword_intent("time_in_location",
                                        ["time", "Location"])

        self.intents = intents
    def setUp(self) -> None:
        intents = IntentBox(strategy=IntentDeterminationStrategy.SINGLE_INTENT)

        # sample based intents

        weather = ["weather"]
        hello = ["hey", "hello", "hi", "greetings"]
        joke = ["tell me a joke", "i want a joke", "say a joke", "tell joke"]
        lights_on = [
            "turn on the lights", "lights on", "turn lights on",
            "turn the lights on"
        ]
        lights_off = [
            "turn off the lights", "lights off", "turn lights off",
            "turn the lights off"
        ]
        music = [
            "play music", "play some songs", "play heavy metal",
            "play some jazz", "play rock", "play some music"
        ]
        call = ["call {person}", "phone {person}"]

        intents.register_intent("weather", weather)
        intents.register_intent("hello", hello)
        intents.register_intent("joke", joke)
        intents.register_intent("lights_on", lights_on)
        intents.register_intent("lights_off", lights_off)
        intents.register_intent("play_music", music)
        intents.register_intent("call_person", call)

        # keyword based intents
        weather = ["weather"]
        hello = ["hey", "hello", "hi", "greetings"]
        name = ["name is"]
        joke = ["joke"]
        play = ["play"]
        say = ["say", "tell"]
        music = ["music", "jazz", "metal", "rock", "songs"]
        door = ["door", "doors"]
        light = ["light", "lights"]
        on = ["activate", "on", "engage", "open"]
        off = ["deactivate", "off", "disengage", "close"]

        intents.register_entity("weather", weather)
        intents.register_entity("hello", hello)
        intents.register_entity("name", name)
        intents.register_entity("joke", joke)
        intents.register_entity("door", door)
        intents.register_entity("lights", light)
        intents.register_entity("on", on)
        intents.register_entity("off", off)
        intents.register_entity("play", play)
        intents.register_entity("music", music)
        intents.register_entity("say", say)

        intents.register_keyword_intent("weather", ["weather"], ["say"])
        intents.register_keyword_intent("hello", ["hello"])
        intents.register_keyword_intent("name", ["name"])
        intents.register_keyword_intent("joke", ["joke"], ["say"])
        intents.register_keyword_intent("lights_on", ["lights", "on"])
        intents.register_keyword_intent("lights_off", ["lights", "off"])
        intents.register_keyword_intent("door_open", ["door", "on"])
        intents.register_keyword_intent("door_close", ["door", "off"])
        intents.register_keyword_intent("play_music", ["play", "music"])

        self.intents = intents
Exemple #3
0
from pprint import pprint
from intentBox import IntentBox, IntentDeterminationStrategy

intents = IntentBox(strategy=IntentDeterminationStrategy.SEGMENT_REMAINDER)

# sample based intents

weather = ["weather"]
hello = ["hey", "hello", "hi", "greetings"]
joke = ["tell me a joke", "i want a joke", "say a joke", "tell joke"]
lights_on = [
    "turn on the lights", "lights on", "turn lights on", "turn the lights on"
]
lights_off = [
    "turn off the lights", "lights off", "turn lights off",
    "turn the lights off"
]
music = [
    "play music", "play some songs", "play heavy metal", "play some jazz",
    "play rock", "play some music"
]
call = ["call {person}", "phone {person}"]

intents.register_intent("weather", weather)
intents.register_intent("hello", hello)
intents.register_intent("joke", joke)
intents.register_intent("lights_on", lights_on)
intents.register_intent("lights_off", lights_off)
intents.register_intent("play_music", music)
intents.register_intent("call_person", call)
Exemple #4
0
    def setUp(self) -> None:
        config = {
            "engines": {
                "nebulento": {
                    "enabled": True
                },
                "adapt": {
                    "enabled": False
                },
                "palavreado": {
                    "enabled": False
                },
                "padacioso": {
                    "enabled": False
                },
                "padaos": {
                    "enabled": False
                },
                "padatious": {
                    "enabled": False
                }
            }
        }
        intents = IntentBox(
            config=config,
            strategy=IntentDeterminationStrategy.SEGMENT_REMAINDER)

        # sample based intents

        weather = ["weather"]
        hello = ["hey", "hello", "hi", "greetings"]
        joke = ["tell me a joke", "i want a joke", "say a joke", "tell joke"]
        lights_on = [
            "turn on the lights", "lights on", "turn lights on",
            "turn the lights on"
        ]
        lights_off = [
            "turn off the lights", "lights off", "turn lights off",
            "turn the lights off"
        ]
        music = [
            "play music", "play some songs", "play heavy metal",
            "play some jazz", "play rock", "play some music"
        ]
        call = ["call {person}", "phone {person}"]

        intents.register_intent("weather", weather)
        intents.register_intent("hello", hello)
        intents.register_intent("joke", joke)
        intents.register_intent("lights_on", lights_on)
        intents.register_intent("lights_off", lights_off)
        intents.register_intent("play_music", music)
        intents.register_intent("call_person", call)

        # keyword based intents
        weather = ["weather"]
        hello = ["hey", "hello", "hi", "greetings"]
        name = ["name is"]
        joke = ["joke"]
        play = ["play"]
        say = ["say", "tell"]
        music = ["music", "jazz", "metal", "rock", "songs"]
        door = ["door", "doors"]
        light = ["light", "lights"]
        on = ["activate", "on", "engage", "open"]
        off = ["deactivate", "off", "disengage", "close"]

        intents.register_entity("weather", weather)
        intents.register_entity("hello", hello)
        intents.register_entity("name", name)
        intents.register_entity("joke", joke)
        intents.register_entity("door", door)
        intents.register_entity("lights", light)
        intents.register_entity("on", on)
        intents.register_entity("off", off)
        intents.register_entity("play", play)
        intents.register_entity("music", music)
        intents.register_entity("say", say)

        intents.register_keyword_intent("weather", ["weather"])
        intents.register_keyword_intent("hello", ["hello"])
        intents.register_keyword_intent("name", ["name"])
        intents.register_keyword_intent("joke", ["joke"], ["say"])
        intents.register_keyword_intent("lights_on", ["lights", "on"])
        intents.register_keyword_intent("lights_off", ["lights", "off"])
        intents.register_keyword_intent("door_open", ["door", "on"])
        intents.register_keyword_intent("door_close", ["door", "off"])
        intents.register_keyword_intent("play_music", ["play", "music"])

        self.intents = intents