From d536a34e3c0bbfbbafd0f9cd908a6ac8d703157c Mon Sep 17 00:00:00 2001 From: Franck Dary <franck.dary@lis-lab.fr> Date: Fri, 19 Feb 2021 11:24:24 +0100 Subject: [PATCH] Added special columns STACK_SIZE et STACK_DIST --- reading_machine/src/Transition.cpp | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/reading_machine/src/Transition.cpp b/reading_machine/src/Transition.cpp index f32925c..bbf35cb 100644 --- a/reading_machine/src/Transition.cpp +++ b/reading_machine/src/Transition.cpp @@ -99,6 +99,23 @@ Transition::Transition(const std::string & name) void Transition::apply(Config & config, float entropy) { + if (config.hasColIndex("STACK_SIZE")) + { + auto & curValue = config.get("STACK_SIZE", config.getWordIndex(), 0); + if (curValue.get().empty()) + curValue = fmt::format("{}", config.getStackSize()); + } + if (config.hasColIndex("STACK_DIST")) + { + auto & curValue = config.get("STACK_DIST", config.getWordIndex(), 0); + if (curValue.get().empty()) + { + if (config.hasStack(0) and config.hasStack(1)) + curValue = fmt::format("{}", config.getStack(0) - config.getStack(1)); + else + curValue = fmt::format("_"); + } + } if (config.hasColIndex("ENTROPY")) { bool mean = true; -- GitLab