コード例 #1
0
 def from_config(cls, config):
     engine = cls()
     retriever_config = config.get("retriever_config")
     if retriever_config is not None:
         retriever_cls = find_class(retriever_config["class"])
         engine.frequent_query_retriever = retriever_cls.from_config(retriever_config)
     return cls()
コード例 #2
0
 def from_config(cls, config):
     pipeline_config = config["parser_pipeline"]
     parser_pipeline_cls = find_class(pipeline_config["class"])
     parser_pipeline = parser_pipeline_cls.from_config(pipeline_config)
     dispatcher_config = config.get("dispatcher")
     if dispatcher_config:
         dispatcher_cls = find_class(dispatcher_config["class"])
         dispatcher = dispatcher_cls.from_config(dispatcher_config)
     else:
         dispatcher = None
     dispatcher_config = config.get("prompter_dispatcher")
     if dispatcher_config:
         dispatcher_cls = find_class(dispatcher_config["class"])
         prompter_dispatcher = dispatcher_cls.from_config(dispatcher_config)
     else:
         prompter_dispatcher = None
     return cls(parser_pipeline, dispatcher, prompter_dispatcher)
コード例 #3
0
 def from_config(cls, config):
     parser_config = config.get("parser")
     if parser_config:
         parser_cls = find_class(parser_config["class"])
         parser = parser_cls.from_config(parser_config)
     else:
         parser = None
     tracker_store_config = config["tracker_store"]
     tracker_store_cls = find_class(tracker_store_config["class"])
     tracker_store = tracker_store_cls.from_config(tracker_store_config)
     policy_config = config["policy"]
     policy_cls = find_class(policy_config["class"])
     policy = policy_cls.from_config(policy_config)
     agent_name = config["agent_name"]
     intents = config["intents"]
     slots = []
     for slot_config in config["slots"]:
         slot_cls = find_class(slot_config["class"])
         slots.append(slot_cls.from_config(slot_config))
     prompt_trigger = config.get("prompt_trigger", None)
     return cls(agent_name, parser, tracker_store, policy, intents, slots,
                prompt_trigger)
コード例 #4
0
 def from_config(cls, config):
     policies = []
     for policy_config in config["policies"]:
         policy_cls = find_class(policy_config["class"])
         policies.append(policy_cls.from_config(policy_config))
     return cls(policies)
コード例 #5
0
ファイル: pipeline.py プロジェクト: lawRossi/Broca
 def from_config(cls, config):
     pipeline = cls()
     for parser_config in config["parsers"]:
         parser_cls = find_class(parser_config["class"])
         pipeline.add_parser(parser_cls.from_config(parser_config))
     return pipeline