Updated decide skill
This commit is contained in:
parent
f28b927bc5
commit
a6144c65e8
@ -1,22 +1,17 @@
|
|||||||
import random
|
import random
|
||||||
|
|
||||||
from adapt.intent import IntentBuilder
|
|
||||||
|
|
||||||
from jarvis.skills import Skill, SkillRegistering
|
from jarvis.skills import Skill, SkillRegistering
|
||||||
from jarvis.skills.decorators import intent_handler
|
from jarvis.skills.decorators import intent_file_handler
|
||||||
|
|
||||||
|
|
||||||
class DecideSkill(Skill, metaclass=SkillRegistering):
|
class DecideSkill(Skill, metaclass=SkillRegistering):
|
||||||
def __init__(self, data=dict):
|
def __init__(self, data=dict):
|
||||||
super().__init__("DecideSkill", data)
|
super().__init__("DecideSkill", data)
|
||||||
|
|
||||||
@intent_handler(IntentBuilder("DecideIntent").require("choice1").require("choice2").optionally("OrKeyword"))
|
@intent_file_handler("decide.intent", "DecideIntent")
|
||||||
# @intent_file_handler("decide.intent", "DecideIntent")
|
def handle_decide_intent(self, data):
|
||||||
def handle_decide(self, data):
|
|
||||||
print("decide")
|
print("decide")
|
||||||
|
|
||||||
print(data)
|
|
||||||
|
|
||||||
if 'choice1' in data and 'choice2' in data:
|
if 'choice1' in data and 'choice2' in data:
|
||||||
choice = bool(random.getrandbits(1))
|
choice = bool(random.getrandbits(1))
|
||||||
|
|
||||||
|
@ -1,2 +0,0 @@
|
|||||||
(.* (?P<choice1>.*) or (?P<dummy>.*))
|
|
||||||
between ((?P<choice1>.*) and (?P<dummy>.*))
|
|
@ -1,2 +0,0 @@
|
|||||||
(.* (?P<dummy2>.*) or (?P<choice2>.*))
|
|
||||||
between ((?P<dummy2>.*) and (?P<choice2>.*))
|
|
@ -1 +0,0 @@
|
|||||||
(?P<choice1>\w+|(\w+ au \w+)) (?:ou|et) (?P<dummy1>\w+|(\w+ au \w+))
|
|
@ -1 +0,0 @@
|
|||||||
(?P<dummy2>\w+|(\w+ au \w+)) (?:ou|et) (?P<choice2>\w+|(\w+ au \w+))
|
|
@ -1,4 +0,0 @@
|
|||||||
Decide
|
|
||||||
What should I wear
|
|
||||||
What should I eat
|
|
||||||
game
|
|
@ -1,3 +0,0 @@
|
|||||||
ou
|
|
||||||
et
|
|
||||||
entre
|
|
@ -4,4 +4,4 @@ tu pense (que|) c'est {choice1} ou {choice2} qui gagne
|
|||||||
entre {choice1} et {choice2}
|
entre {choice1} et {choice2}
|
||||||
{choice1} ou {choice2}
|
{choice1} ou {choice2}
|
||||||
tu prefère (le|les|la) {choice1} (ou|ou bien) (le|les|la) {choice2}
|
tu prefère (le|les|la) {choice1} (ou|ou bien) (le|les|la) {choice2}
|
||||||
choisi entre {choice1} et {choice2}
|
(choisi|choisis) entre {choice1} et {choice2}
|
||||||
|
Reference in New Issue
Block a user