本文整理汇总了Python中adapt.intent.IntentBuilder方法的典型用法代码示例。如果您正苦于以下问题:Python intent.IntentBuilder方法的具体用法?Python intent.IntentBuilder怎么用?Python intent.IntentBuilder使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类adapt.intent
的用法示例。
在下文中一共展示了intent.IntentBuilder方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: initialize
# 需要导入模块: from adapt import intent [as 别名]
# 或者: from adapt.intent import IntentBuilder [as 别名]
def initialize(self):
refresh_tagged_items_intent = IntentBuilder("RefreshTaggedItemsIntent").require("RefreshTaggedItemsKeyword").build()
self.register_intent(refresh_tagged_items_intent, self.handle_refresh_tagged_items_intent)
onoff_status_intent = IntentBuilder("OnOff_StatusIntent").require("OnOffStatusKeyword").require("Command").require("Item").build()
self.register_intent(onoff_status_intent, self.handle_onoff_status_intent)
dimmer_status_intent = IntentBuilder("Dimmer_StatusIntent").require("DimmerStatusKeyword").require("Item").optionally("BrigthPercentage").build()
self.register_intent(dimmer_status_intent, self.handle_dimmer_status_intent)
what_status_intent = IntentBuilder("What_StatusIntent").require("WhatStatusKeyword").require("Item").require("RequestType").build()
self.register_intent(what_status_intent, self.handle_what_status_intent)
setTemp_status_intent = IntentBuilder("SetTemp_StatusIntent").require("ThermostatStatusKeyword").require("Item").require("TempValue").build()
self.register_intent(setTemp_status_intent, self.handle_setTemp_status_intent)
示例2: configure
# 需要导入模块: from adapt import intent [as 别名]
# 或者: from adapt.intent import IntentBuilder [as 别名]
def configure(self):
self.__engine = IntentDeterminationEngine()
actions = ['on', 'off']
self.__register_entity(actions, self.ACTIONS)
locations = ['living', 'kitchen', 'hollway', 'wemo']
self.__register_entity(locations, self.NAME)
actuator_types = ['light', 'switch', 'courtains', 'door']
self.__register_entity(actuator_types, self.ACTUATOR_TYPE)
actuator_intent = IntentBuilder("ActuatorIntent") \
.require(self.ACTIONS) \
.require(self.ACTUATOR_TYPE) \
.require(self.NAME) \
.build()
self.__engine.register_intent_parser(actuator_intent)
self.__commands_map = [
{'entities' : {'name' : 'living', 'type' : 'light'}, 'actuator' : 'livingLight'},
{'entities' : {'name' : 'living', 'type' : 'courtains'}, 'actuator' : 'livingCourtains'},
{'entities' : {'name' : 'hollway', 'type' : 'light'}, 'actuator' : 'holwayLight'},
{'entities' : {'name' : 'wemo', 'type' : 'switch'}, 'actuator' : 'wemoSwitch1'},
]
return self
示例3: _register_common_intents
# 需要导入模块: from adapt import intent [as 别名]
# 或者: from adapt.intent import IntentBuilder [as 别名]
def _register_common_intents(self):
"""
Register common intents, these include basically all intents
except the intents to start playback.
"""
intent = IntentBuilder('NextIntent').require('NextKeyword')
self.register_intent(intent, self.handle_next)
intent = IntentBuilder('PrevIntent').require('PrevKeyword')
self.register_intent(intent, self.handle_prev)
intent = IntentBuilder('PauseIntent').require('PauseKeyword')
self.register_intent(intent, self.handle_pause)
intent = IntentBuilder('PlayIntent') \
.one_of('PlayKeyword', 'ResumeKeyword')
self.register_intent(intent, self.handle_play)
intent = IntentBuilder('CurrentlyPlayingIntent') \
.require('CurrentlyPlayingKeyword')
self.register_intent(intent, self.handle_currently_playing)
示例4: initialize
# 需要导入模块: from adapt import intent [as 别名]
# 或者: from adapt.intent import IntentBuilder [as 别名]
def initialize(self):
logger.info('initializing SwedishRadio')
self.load_data_files(dirname(__file__))
super(SwedishRadio, self).initialize()
for c in self.sr.channels.keys():
self.register_vocabulary(c, 'ChannelKeyword')
intent = IntentBuilder('PlayChannelIntent' + self.name)\
.require('PlayKeyword')\
.require('ChannelKeyword')\
.build()
self.register_intent(intent, self.handle_play_channel)
intent = IntentBuilder('PlayFromIntent' + self.name)\
.require('PlayKeyword')\
.require('ChannelKeyword')\
.require('NameKeyword')\
.build()
self.register_intent(intent, self.handle_play_channel)
示例5: initialize
# 需要导入模块: from adapt import intent [as 别名]
# 或者: from adapt.intent import IntentBuilder [as 别名]
def initialize(self):
search_actor_intent = IntentBuilder("SearchActorIntent"). \
require("SearchActorKeyword").require("Actor").build()
self.register_intent(search_actor_intent,
self.handle_search_actor_intent)
upcoming_intent = IntentBuilder("UpcomingIntent"). \
require("UpcomingKeyword").build()
self.register_intent(upcoming_intent,
self.handle_upcoming_intent)
now_playing_intent = IntentBuilder("NowPlayingIntent"). \
require("NowPlayingKeyword").build()
self.register_intent(now_playing_intent,
self.handle_now_playing_intent)
movie_intent = IntentBuilder("MovieIntent"). \
require("MovieKeyword").require("Movie").build()
self.register_intent(movie_intent,
self.handle_movie_intent)
popular_tv_intent = IntentBuilder("PopularTvIntent"). \
require("PopularTvKeyword").build()
self.register_intent(popular_tv_intent,
self.handle_popular_tv_intent)
示例6: initialize
# 需要导入模块: from adapt import intent [as 别名]
# 或者: from adapt.intent import IntentBuilder [as 别名]
def initialize(self):
"""This function will initialize the Skill for Blinking an LED
This creates two intents
* IoCommandIntent - Will fire for any command that controlls the LED
* SystemQueryIntent - Will fire for any system command
The SystemQueryIntent was desinged for debug info while testing
and is not required going forward.
"""
self.load_data_files(dirname(__file__))
command_intent = IntentBuilder("IoCommandIntent").require("command").require("ioobject").optionally("ioparam").build()
system_intent = IntentBuilder("SystemQueryIntent").require("question").require("systemobject").build()
self.register_intent(command_intent, self.handle_command_intent)
self.register_intent(system_intent, self.handle_system_intent)
示例7: initialize
# 需要导入模块: from adapt import intent [as 别名]
# 或者: from adapt.intent import IntentBuilder [as 别名]
def initialize(self):
self.times = []
self.skill_events = self.config
self.intent_parser = IntentParser(self.emitter)
for e in self.skill_events:
self.register_vocabulary(e, 'EventKeyword')
logger.debug(e)
if 'time' in self.skill_events[e]:
self.add_skill_event(e)
intent = IntentBuilder('EventIntent') \
.require('EventKeyword') \
.build()
self.register_intent(intent, self.handle_run_event)
self.register_vocabulary('cancel events', 'CancelEventsKeyword')
intent = IntentBuilder('CancelEventsIntent') \
.require('CancelEventsKeyword') \
.build()
self.register_intent(intent, self.handle_cancel_events)
self.emitter.on('recognizer_loop:audio_output_end',
self.ready_to_continue)
self.schedule()
示例8: initialize
# 需要导入模块: from adapt import intent [as 别名]
# 或者: from adapt.intent import IntentBuilder [as 别名]
def initialize(self):
self.manager = ObjectivesManager(self.emitter)
self.parser = IntentParser(self.emitter)
self.emitter.on("register_objective", self.register_objective)
self.emitter.on("execute_objective", self.handle_execute_objective_intent)
prefixes = [
'Objective', 'obj']
self.__register_prefixed_regex(prefixes, "(?P<Objective>.*)")
execute_objective_intent = IntentBuilder("ExecuteObjectiveIntent"). \
require("Objective").build()
self.register_intent(execute_objective_intent, self.handle_execute_objective_intent)
available_objectives_intent = IntentBuilder("AvailableObjectivesIntent"). \
require("ObjectiveKeyword").build()
self.register_intent(available_objectives_intent, self.handle_available_objectives)
activate_intent = IntentBuilder("ActiveSkillIntent"). \
require("ActivateKeyword").build()
self.register_intent(activate_intent, self.handle_set_on_top_active_list())
示例9: initialize
# 需要导入模块: from adapt import intent [as 别名]
# 或者: from adapt.intent import IntentBuilder [as 别名]
def initialize(self):
speaker_rec_test_intent = IntentBuilder("SpeakerRecTestIntent"). \
require("SpeakerRecTestKeyword").build()
self.register_intent(speaker_rec_test_intent, self.handle_speaker_rec_test_intent)
start_voice_training_intent = IntentBuilder("StartVoiceTrainingIntent"). \
require("StartVoiceTrainingKeyword").require("User").build()
self.register_intent(start_voice_training_intent, self.handle_start_voice_training_intent)
end_voice_training_intent = IntentBuilder("EndTrainingIntent"). \
require("EndVoiceTrainingKeyword").build()
self.register_intent(end_voice_training_intent, self.handle_end_voice_training_intent)
示例10: initialize
# 需要导入模块: from adapt import intent [as 别名]
# 或者: from adapt.intent import IntentBuilder [as 别名]
def initialize(self):
self.load_data_files(dirname(__file__))
krunner_plasma_desktopskill_intent = IntentBuilder("KrunnerKeywordIntent").\
require("KrunnerPlasmaDesktopSkillKeyword").build()
self.register_intent(krunner_plasma_desktopskill_intent, self.handle_krunner_plasma_desktopskill_intent)
krunner_plasma_recentskill_intent = IntentBuilder("RecentFilesIntent").\
require("RecentFileKeyword").build()
self.register_intent(krunner_plasma_recentskill_intent, self.handle_krunner_plasma_recentskill_intent)
示例11: __build_switch_intent
# 需要导入模块: from adapt import intent [as 别名]
# 或者: from adapt.intent import IntentBuilder [as 别名]
def __build_switch_intent(self):
intent = IntentBuilder("switchIntent").require("SwitchActionKeyword") \
.require("Action").require("Entity").build()
self.register_intent(intent, self.handle_switch_intent)
示例12: __build_light_set_intent
# 需要导入模块: from adapt import intent [as 别名]
# 或者: from adapt.intent import IntentBuilder [as 别名]
def __build_light_set_intent(self):
intent = IntentBuilder("LightSetBrightnessIntent") \
.optionally("LightsKeyword").require("SetVerb") \
.require("Entity").require("BrightnessValue").build()
self.register_intent(intent, self.handle_light_set_intent)
示例13: __build_light_adjust_intent
# 需要导入模块: from adapt import intent [as 别名]
# 或者: from adapt.intent import IntentBuilder [as 别名]
def __build_light_adjust_intent(self):
intent = IntentBuilder("LightAdjBrightnessIntent") \
.optionally("LightsKeyword") \
.one_of("IncreaseVerb", "DecreaseVerb", "LightBrightenVerb",
"LightDimVerb") \
.require("Entity").optionally("BrightnessValue").build()
self.register_intent(intent, self.handle_light_adjust_intent)
示例14: __build_automation_intent
# 需要导入模块: from adapt import intent [as 别名]
# 或者: from adapt.intent import IntentBuilder [as 别名]
def __build_automation_intent(self):
intent = IntentBuilder("AutomationIntent").require(
"AutomationActionKeyword").require("Entity").build()
self.register_intent(intent, self.handle_automation_intent)
示例15: __build_sensor_intent
# 需要导入模块: from adapt import intent [as 别名]
# 或者: from adapt.intent import IntentBuilder [as 别名]
def __build_sensor_intent(self):
intent = IntentBuilder("SensorIntent").require(
"SensorStatusKeyword").require("Entity").build()
# TODO - Sensors - Locks, Temperature, etc
self.register_intent(intent, self.handle_sensor_intent)