From f71baac6700156904091e1269298582f453be5c9 Mon Sep 17 00:00:00 2001 From: Franck Dary <franck.dary@lis-lab.fr> Date: Sat, 16 Apr 2022 20:58:27 +0200 Subject: [PATCH] Only update stack_dist and stack_size when on state parser --- reading_machine/src/Transition.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/reading_machine/src/Transition.cpp b/reading_machine/src/Transition.cpp index 47ecca4..a50d38a 100644 --- a/reading_machine/src/Transition.cpp +++ b/reading_machine/src/Transition.cpp @@ -101,14 +101,14 @@ void Transition::apply(Config & config, float entropy) { if (config.hasColIndex("STACK_SIZE")) { - auto & curValue = config.get("STACK_SIZE", config.getWordIndex(), 0); - if (std::string(curValue).empty()) + auto & curValue = config.getLastNotEmptyHyp("STACK_SIZE", config.getWordIndex()); + if (std::string(curValue).empty() and config.getState() == "parser") curValue = fmt::format("{}", config.getStackSize()); } if (config.hasColIndex("STACK_DIST")) { - auto & curValue = config.get("STACK_DIST", config.getWordIndex(), 0); - if (std::string(curValue).empty()) + auto & curValue = config.getLastNotEmptyHyp("STACK_DIST", config.getWordIndex()); + if (std::string(curValue).empty() and config.getState() == "parser") { if (config.hasStack(0) and config.hasStack(1)) curValue = fmt::format("{}", config.getStack(0) - config.getStack(1)); -- GitLab