Skip to content

Commit

Permalink
Replace Padatious with Adapt intent
Browse files Browse the repository at this point in the history
Since it is impossible to use wildcards and because of a [bug](MycroftAI/padatious#25) in Padatious the intent is now written with Adapt. Also the tests where updated.
  • Loading branch information
tgru committed Apr 30, 2020
1 parent c95f0c8 commit 6eb67ef
Show file tree
Hide file tree
Showing 8 changed files with 9 additions and 9 deletions.
10 changes: 6 additions & 4 deletions __init__.py
Original file line number Diff line number Diff line change
@@ -1,16 +1,18 @@
from mycroft import MycroftSkill, intent_file_handler
from adapt.intent import IntentBuilder
from mycroft import MycroftSkill, intent_handler


class HttpStatusCodeSkill(MycroftSkill):
def __init__(self):
MycroftSkill.__init__(self)

def initialize(self):
self.register_entity_file('code.entity')
return

@intent_file_handler('code.intent')
@intent_handler(IntentBuilder('').require('code').require('StatusNumber'))
def handle_code_status_http(self, message):
code = str(message.data['code'])
code = str(message.data.get('StatusNumber'))

dialog = code + '.short'
data = {'code': code}
if dialog in self.dialog_renderer.templates:
Expand Down
1 change: 1 addition & 0 deletions locale/en-us/StatusNumber.rx
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
(?P<StatusNumber>[0-9]{3})
1 change: 0 additions & 1 deletion locale/en-us/code.entity

This file was deleted.

1 change: 0 additions & 1 deletion locale/en-us/code.intent

This file was deleted.

2 changes: 2 additions & 0 deletions locale/en-us/code.voc
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
code
error
1 change: 0 additions & 1 deletion test/intent/NameKnownCode404.intent.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
{
"utterance": "code 404",
"intent_type": "code.intent",
"expected_dialog": "404.short"
}
1 change: 0 additions & 1 deletion test/intent/NameUnknownCode499.intent.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
{
"utterance": "code 499",
"intent_type": "code.intent",
"expected_dialog": "unknown.code"
}
1 change: 0 additions & 1 deletion test/intent/StartCodeNaming.intent.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
{
"utterance": "code 404",
"intent_type": "code.intent",
"expected_dialog": "code.means"
}

0 comments on commit 6eb67ef

Please sign in to comment.