From 264620e0d74ec426f24ba9e1f149a39da62c2376 Mon Sep 17 00:00:00 2001 From: beckydvn Date: Thu, 17 Aug 2023 19:09:15 +0000 Subject: [PATCH] deploy: 68ce9195a39fe90bf031e62be28b945a3370f803 --- .../custom_actions/slot_fill.html | 21 ++++++++++++++----- .../parsers/pddl_for_rollout.html | 2 +- .../for_generating/parsers/pddl_parser.html | 10 ++++++--- _static/pygments.css | 1 + 4 files changed, 25 insertions(+), 9 deletions(-) diff --git a/_modules/plan4dial/for_generating/custom_actions/slot_fill.html b/_modules/plan4dial/for_generating/custom_actions/slot_fill.html index 9303426..721b686 100644 --- a/_modules/plan4dial/for_generating/custom_actions/slot_fill.html +++ b/_modules/plan4dial/for_generating/custom_actions/slot_fill.html @@ -253,14 +253,23 @@

Source code for plan4dial.for_generating.custom_actions.slot_fill

# store the intent based on the refined combo. # if we are only extracting one entity of multiple, use the intent for # just that entity; otherwise use the "overarching" intent - next_out["intent"] = ( - config_entities[list(refined_combo.keys())[0]]["single_slot_intent"] - if len(refined_combo) == 1 and len(entities) > 1 - else overall_intent - ) outcome_name = "".join( f"{entity}_{certainty}-" for entity, certainty in refined_combo.items() )[:-1] + if len(refined_combo) == 1 and len(entities) > 1: + single_slot_int = config_entities[list(refined_combo.keys())[0]][ + "single_slot_intent" + ] + if list(refined_combo.values())[0] == "maybe-found": + next_out["intent_cfg"] = f"{single_slot_int}__{outcome_name}" + next_out["intent"] = single_slot_int + else: + # make intent name more specific to avoid duplicate intent names + if list(refined_combo.values()) != [ + "found" for _ in range(len(entities)) + ]: + next_out["intent_cfg"] = f"{overall_intent}__{outcome_name}" + next_out["intent"] = overall_intent # add the updates based on what's in this refined combo (again, ignoring # what we didn't find) for entity, certainty in refined_combo.items(): @@ -433,6 +442,8 @@

Source code for plan4dial.for_generating.custom_actions.slot_fill

] = { "updates": slot_unclear_updates, "intent": config_entity["single_slot_intent"], + "intent_cfg": f"{config_entity['single_slot_intent']}\ +__{entity}_maybe-found", } if "fallback_message_variants" in config_entity: single_slot["fallback_message_variants"] = config_entity[ diff --git a/_modules/plan4dial/for_generating/parsers/pddl_for_rollout.html b/_modules/plan4dial/for_generating/parsers/pddl_for_rollout.html index 6f90c5f..9cd77d2 100644 --- a/_modules/plan4dial/for_generating/parsers/pddl_for_rollout.html +++ b/_modules/plan4dial/for_generating/parsers/pddl_for_rollout.html @@ -120,7 +120,7 @@

Source code for plan4dial.for_generating.parsers.pddl_for_rollout

actions[act]["effect"][out["name"]] = list( get_update_fluents( configuration_data["context_variables"], out["updates"] - ) + ).difference(set(actions[act]["condition"])) ) # return the actions, and initial state, and all fluents return { diff --git a/_modules/plan4dial/for_generating/parsers/pddl_parser.html b/_modules/plan4dial/for_generating/parsers/pddl_parser.html index 53ade51..0848742 100644 --- a/_modules/plan4dial/for_generating/parsers/pddl_parser.html +++ b/_modules/plan4dial/for_generating/parsers/pddl_parser.html @@ -301,9 +301,10 @@

Source code for plan4dial.for_generating.parsers.pddl_parser

""" act_param = f"{TAB}(:action {act}\n{TAB * 2}:parameters()" + pre_fluents = get_precond_fluents(context_variables, act_config["condition"]) # convert the preconditions precond = _fluents_to_pddl( - fluents=get_precond_fluents(context_variables, act_config["condition"]), + pre_fluents, tabs=2, name_wrap=":precondition", and_wrap=True, @@ -318,9 +319,12 @@

Source code for plan4dial.for_generating.parsers.pddl_parser

for out_config in act_config["effect"]["outcomes"]: if "updates" in out_config: # for each outcome, get the update fluents - update_fluents = get_update_fluents( - context_variables, out_config["updates"] + update_fluents = set( + get_update_fluents(context_variables, out_config["updates"]) ) + # we don't want to add fluents in the effect that are already + # in the precondition + update_fluents = update_fluents.difference(pre_fluents) # add the outcome to the effect string effects += _fluents_to_pddl( fluents=update_fluents, diff --git a/_static/pygments.css b/_static/pygments.css index 08bec68..84ab303 100644 --- a/_static/pygments.css +++ b/_static/pygments.css @@ -17,6 +17,7 @@ span.linenos.special { color: #000000; background-color: #ffffc0; padding-left: .highlight .cs { color: #3D7B7B; font-style: italic } /* Comment.Special */ .highlight .gd { color: #A00000 } /* Generic.Deleted */ .highlight .ge { font-style: italic } /* Generic.Emph */ +.highlight .ges { font-weight: bold; font-style: italic } /* Generic.EmphStrong */ .highlight .gr { color: #E40000 } /* Generic.Error */ .highlight .gh { color: #000080; font-weight: bold } /* Generic.Heading */ .highlight .gi { color: #008400 } /* Generic.Inserted */