bklavet / Echo-skill-to-control-Directv

amazon echo skill that will control a networked Directv Receiver so that users can control Directv with their voice
18 stars 67 forks source link

Custom Slot #3

Closed bklavet closed 7 years ago

bklavet commented 8 years ago

Reading up on the Custom Slot in the Alexa Skill Kit, and I am coming to the conclusion that all of this may work a lot better if all the remote buttons and networks were placed in a custom slot and then placed under the slot name Control. this could reduce the number of case arguments in the index file.

I have not used custom slots but it appears that if the list of values aren't incredibly large, the accuracy is better.

Any thoughts on if this would be a good direction to test out?

bklavet commented 8 years ago

I created a custom slot named Control_List, and replaced AMAZON.LITERAL with it. for the values I used the following: and will start modifying the case arguments in the Index file... Control_List : play resume pause freeze guide power turn on turn off format rewind replay stop advance fast forward record save active list recorded shows DVR exit end leave back menu info up down left right select enter channel up page up channel down page down previous CNN A&E AMC animal planet BET bravo comedy central c. span cartoon network discovery disney channel disney junior disney x.d. food network fox FX HGTV history channel lifetime MSNBC MTV MTV two national geographic nick junior spike syfy TBS TNT true TV VH one ESPN ESPN two

the utterances have been simplified to this: DirectvIntent change to {Control} DirectvIntent find {Control} DirectvIntent go to {Control} DirectvIntent {Control} DirectvIntent change to {Channel}

I have people watching stuff right now so I was only able to test a few remote buttons that wont screw up their viewing. Maybe this will work better... maybe not, but wanted to give it a whirl and see.

vmweaver commented 8 years ago

I was looking at doing a "control" custom type and a "channel Name" custom type. I will see if I can pull it together. I haven't really done much testing on it, but I think we are looking at similar ways of doing things. I should post something tonight.

bklavet commented 8 years ago

hey friend, the custom slot is working good. I have had to add more utterances and correct some capitalization I had screwed up. but in trying it out I think it has made the Index file smaller. unfortunately I broke your channel search in the process. Since the "type" under the slot "Control" was changed to "Control_List"... the DirectvIntent {channel|Control} {Channel} bombed out cause it is no longer a literal type. I have been looking to see how the Index file could be change so that if the slot "Control" is received, lambda does "A", and if slot "Channel" is received it does "B".... I can't get the thing to do both though.

bklavet commented 8 years ago

I got a chance to try out the custom slot mentioned above and the accuracy improved greatly with presets. I'm not running into any problems having the presets and the remote buttons under the one custom slot... that may change if we decide to put every network name in though. Currently I am less than 100 values on the custom slot. I have read on the developers forum that the more values the custom slot has the less reliable it is. I think I may set up a separate folder here labeled custom slot that will include what I am doing. I am thinking of removing the preset index files and utterance. They don't work very well and I think the confuse things.

vmweaver commented 8 years ago

Here is my take. I haven't fully tested it yet, but here goes: I have 2 custom slot types: ChannelName: fox | c.b.s. | n.b.c. | p.b.s | the c.w. | a.b.c. | n.b.c.s.n. | h.g.t.v | d.i.y | food network(...) Control: to play | play | resume | to pause | pause | freeze | go to guide | open guide | power(...)

My Intent is: { "intents": [ { "intent": "DirectvIntent", "slots": [ { "name": "Control", "type": "Control" }, { "name": "Channel", "type": "AMAZON.NUMBER" }, { "name": "ChannelName", "type": "ChannelName" } ] } ] }

Sample utterance: DirectvIntent {Control} DirectvIntent {Control} {ChannelName} DirectvIntent {Control} {Channel}


I then use a custom dictionary in my index file:

var channelNames = { "fox":2, "c. b. s.":4, "n. b. c.":5, "p. b. s":9, "the c.w.":11, "a. b. c.":30, . . . }

From there: case "change to channel": case "to change to channel": case "channel": if (intent.slots.Channel.value == null) { response.tell("I didn't understand the channel number you wanted."); } else { path = '/tv/tune?major=' + intent.slots.Channel.value ; }
break;

    case "goto":
    case "to goto":
        if(channelNames[intent.slots.ChannelName.value] == null) {
                     response.tell("I didn't understand the channel name you wanted.");
          }
        else {
           path = '/tv/tune?major=' + channelNames[intent.slots.ChannelName.value];
              }
       break;
vmweaver commented 8 years ago

Will need to do some testing...., though.

bklavet commented 8 years ago

I posted a folder with the custom slot working. I found this link helpful

https://developer.amazon.com/public/solutions/alexa/alexa-skills-kit/docs/alexa-skills-kit-interaction-model-reference#h2_custom_syntax

I had to make a few changes to make everything in regards to remote and presets to work correctly, but am pretty happy with this direction so far. Do you think it will be a benefit to have two custom slots for networks, and remote functions? I am finding the one working pretty well so far for both. Currently what i put out does not have the "channel search by number" working, but I will go back and see if I can't get that back on line. I changed the utterances to be a lot more forgiving in my opinion so if you want to give it a test run, maybe some of it may be useful.

vmweaver commented 8 years ago

Will look at it this weekend! Thanks!

On Fri, May 27, 2016 at 8:02 AM, bklavet notifications@github.com wrote:

I posted a folder with the custom slot working. I found this link helpful and had to make a few changes to make everything in regards to remote and presets to work correctly, but am pretty happy with this direction so far. Do you think it will be a benefit to have two custom slots for networks, and remote functions? I am finding the one working pretty well so far for both. Currently what if put out dows not have the "channel search by number" working, but I will go back and see if I can't get that back on line. I changed the utterances to be a lot more forgiving in my opinion so if you want to give it a test run, maybe some of it may be useful.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/bklavet/Echo-skill-to-control-Directv/issues/3#issuecomment-222140518, or mute the thread https://github.com/notifications/unsubscribe/ACibPSNLPoBO687XS4tBGGlSEd2AzUa7ks5qFut8gaJpZM4InoWX .

bklavet commented 8 years ago

Sounds good, was just thinking about this a little bit more. I think the AMAZON.NUMBER type could be added to the control slot values. this would allow the remotes and the presets and number search to run under one slot. Do you know a way to have the index file do what it is now with the switch case arguments and after those are exhausted, it looks to see if the skill is only numbers before it goes to the default response. If we could get that accomplished, the whole skill would work with one sole custom slot. I am learning as I go here, so this may not make much sense, but I am having trouble figuring out how the index file gets out of the Control type and jumps to another Slot.

bklavet commented 8 years ago

just an update, I moved the channel query to the default of the index. That way the skill runs down the list of values it has from the custom slot. When it comes up with no matches it then does the: if (intent.slots.Channel.value == null) { response.tell("I didn't understand."); } else { path = '/tv/tune?major=' + intent.slots.Channel.value ; }
break; This way before the error message is received it does a look to see if the Slot {Channel} has anything, if it doesn't, it changes the station. if not it gives the "I didn't understand message". I am updating the custom slot folder to show this change to the index. for Utterances I added one additional: DirectvIntent {Channel}

bklavet commented 8 years ago

mawrew19, I have been working on the intents and broke the channel number search into it's own seperate intent named "ChannelIntent". the current custom slot is working, but thought this would be a better way of going about it. { "intents": [ { "intents": "DirectvIntent", "slots": [ { "name": "Control", "type": "Control_List" } ] }, { "intent": "ChannelIntent", "slots": [ { "name": "Channel", "type": "AMAZON.NUMBER" } ] } ] }