added decide skill
This commit is contained in:
parent
d5c76e3b91
commit
d90079873c
@ -1,6 +1,7 @@
|
|||||||
import lingua_franca
|
import lingua_franca
|
||||||
|
|
||||||
from jarvis.skills import intent_manager
|
from jarvis.skills import intent_manager
|
||||||
|
from jarvis.skills.entertainement.decide import DecideSkill
|
||||||
from jarvis.skills.entertainement.jokes import JokesSkill
|
from jarvis.skills.entertainement.jokes import JokesSkill
|
||||||
from jarvis.skills.entertainement.spotify import SpotifySkill
|
from jarvis.skills.entertainement.spotify import SpotifySkill
|
||||||
from jarvis.skills.productivity.speedtest import SpeedTestSkill
|
from jarvis.skills.productivity.speedtest import SpeedTestSkill
|
||||||
@ -17,6 +18,7 @@ if __name__ == '__main__':
|
|||||||
JokesSkill().register()
|
JokesSkill().register()
|
||||||
SpotifySkill().register()
|
SpotifySkill().register()
|
||||||
SpeedTestSkill().register()
|
SpeedTestSkill().register()
|
||||||
|
DecideSkill().register()
|
||||||
|
|
||||||
# Load all skills
|
# Load all skills
|
||||||
intent_manager.load_all_skills()
|
intent_manager.load_all_skills()
|
||||||
|
32
jarvis/skills/entertainement/decide/__init__.py
Normal file
32
jarvis/skills/entertainement/decide/__init__.py
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
import random
|
||||||
|
|
||||||
|
from adapt.intent import IntentBuilder
|
||||||
|
|
||||||
|
from jarvis.skills import Skill, SkillRegistering
|
||||||
|
from jarvis.skills.decorators import intent_handler
|
||||||
|
|
||||||
|
|
||||||
|
class DecideSkill(Skill, metaclass=SkillRegistering):
|
||||||
|
def __init__(self, data=dict):
|
||||||
|
super().__init__("DecideSkill", data)
|
||||||
|
|
||||||
|
@intent_handler(IntentBuilder("DecideIntent").require("choice1").require("choice2").optionally("OrKeyword"))
|
||||||
|
# @intent_file_handler("decide.intent", "DecideIntent")
|
||||||
|
def handle_decide(self, data):
|
||||||
|
print("decide")
|
||||||
|
|
||||||
|
print(data)
|
||||||
|
|
||||||
|
if 'choice1' in data and 'choice2' in data:
|
||||||
|
choice = bool(random.getrandbits(1))
|
||||||
|
|
||||||
|
if choice:
|
||||||
|
self.speak(data['choice1'])
|
||||||
|
else:
|
||||||
|
self.speak(data['choice2'])
|
||||||
|
else:
|
||||||
|
print("no all choice")
|
||||||
|
|
||||||
|
|
||||||
|
def create_skill(data):
|
||||||
|
return DecideSkill(data)
|
2
jarvis/skills/entertainement/decide/regex/en-us/Choice1.rx
Executable file
2
jarvis/skills/entertainement/decide/regex/en-us/Choice1.rx
Executable file
@ -0,0 +1,2 @@
|
|||||||
|
(.* (?P<Choice1>.*) or (?P<dummy>.*))
|
||||||
|
between ((?P<Choice1>.*) and (?P<dummy>.*))
|
2
jarvis/skills/entertainement/decide/regex/en-us/Choice2.rx
Executable file
2
jarvis/skills/entertainement/decide/regex/en-us/Choice2.rx
Executable file
@ -0,0 +1,2 @@
|
|||||||
|
(.* (?P<dummy2>.*) or (?P<Choice2>.*))
|
||||||
|
between ((?P<dummy2>.*) and (?P<Choice2>.*))
|
@ -0,0 +1 @@
|
|||||||
|
(?P<choice1>\w+|(\w+ au \w+)) (?:ou|et) (?P<dummy>\w+|(\w+ au \w+))
|
@ -0,0 +1 @@
|
|||||||
|
(?P<dummy>\w+|(\w+ au \w+)) (?:ou|et) (?P<choice2>\w+|(\w+ au \w+))
|
4
jarvis/skills/entertainement/decide/vocab/en-us/DecideKeyword.voc
Executable file
4
jarvis/skills/entertainement/decide/vocab/en-us/DecideKeyword.voc
Executable file
@ -0,0 +1,4 @@
|
|||||||
|
Decide
|
||||||
|
What should I wear
|
||||||
|
What should I eat
|
||||||
|
game
|
@ -0,0 +1,3 @@
|
|||||||
|
ou
|
||||||
|
et
|
||||||
|
entre
|
@ -0,0 +1,7 @@
|
|||||||
|
(décide|choisis|choisi) entre {choice1} (et|ou) {choice2}
|
||||||
|
qui-est ce qui va gagner {choice1} ou {choice2}
|
||||||
|
tu pense (que|) c'est {choice1} ou {choice2} qui gagne
|
||||||
|
entre {choice1} et {choice2}
|
||||||
|
{choice1} ou {choice2}
|
||||||
|
tu prefère (le|les|la) {choice1} (ou|ou bien) (le|les|la) {choice2}
|
||||||
|
choisi entre {choice1} et {choice2}
|
Reference in New Issue
Block a user