Esempio n. 1
0
 def get_slot_name(self):
     if Utils.checkKeysInDict(self.data, ['response', 'directives']):
         directive = self.data['response']['directives']
         if directive and Utils.checkKeysInDict(
                 directive[0],
             ['slotToElicit']) and directive[0]['slotToElicit']:
             return directive[0]['slotToElicit']
     return None
Esempio n. 2
0
 def get_location(self):
     if Utils.checkKeysInDict(
             self.data,
         ['context', 'System', 'user', 'userInfo', 'location', 'geo']):
         return self.data['context']['System']['user']['userInfo'][
             'location']['geo']
     return None
Esempio n. 3
0
 def get_botid(self):
     if Utils.checkKeysInDict(
             self.data,
         ['context', 'System', 'application', 'applicationId']):
         return self.data['context']['System']['application'][
             'applicationId']
     return None
Esempio n. 4
0
    def getUserInfo(self):
        '''

        :return:
        '''
        if Utils.checkKeysInDict(self.data, ['user_info']):
            return self.data['user_info']
        return None
Esempio n. 5
0
 def get_app_launcher_context(self):
     '''
     获取设备app安装列表
     :return:
     '''
     if Utils.checkKeysInDict(self.data, ['context', 'AppLauncher']):
         return self.data['context']['AppLauncher']
     return None
Esempio n. 6
0
 def get_audio_player_context(self):
     '''
     获取设备音频播放的状态
     :return:
     '''
     if Utils.checkKeysInDict(self.data, ['context', 'AudioPlayer']):
         return self.data['context']['AudioPlayer']
     return None
Esempio n. 7
0
    def is_dialog_state_completed(self):

        if Utils.checkKeysInDict(self.data, ['request', 'dialogState']):
            return self.data['request']['dialogState'] == 'COMPLETED'
        return False
Esempio n. 8
0
    def get_user_id(self):

        if Utils.checkKeysInDict(self.data,
                                 ['context', 'System', 'user', 'userId']):
            return self.data['context']['System']['user']['userId']
        return None
Esempio n. 9
0
    def get_device_id(self):

        if Utils.checkKeysInDict(self.data,
                                 ['context', 'System', 'device', 'deviceId']):
            return self.data['context']['System']['device']['deviceId']
        return None
Esempio n. 10
0
    def get_session_id(self):

        if Utils.checkKeysInDict(self.data, ['session', 'sessionId']):
            return self.data['session']['sessionId']
        return None
Esempio n. 11
0
    def get_reson(self):

        if Utils.checkKeysInDict(self.data, ['request', 'reason']):
            return self.data['request']['reason']
        return None
Esempio n. 12
0
    def get_timestamp(self):

        if Utils.checkKeysInDict(self.data, ['request', 'timestamp']):
            return self.data['request']['timestamp']
        return None
Esempio n. 13
0
    def getReprompt(self):

        if Utils.checkKeysInDict(self.data,
                                 ['response', 'reprompt', 'outputSpeech']):
            return self.data['response']['reprompt']['outputSpeech']
        return None
Esempio n. 14
0
 def getShouldEndSession(self):
     if Utils.checkKeysInDict(self.data, ['response', 'shouldEndSession']):
         return self.data['response']['shouldEndSession']
     pass
Esempio n. 15
0
 def getOutputSpeech(self):
     if Utils.checkKeysInDict(self.data, ['response', 'outputSpeech']):
         return self.data['response']['outputSpeech']
Esempio n. 16
0
    def getRequestId(self):

        if Utils.checkKeysInDict(self.data, ['request', 'requestId']):
            return self.data['request']['requestId']

        return None