From 3bf7b23754f184edfcff8ae2299f60459020467f Mon Sep 17 00:00:00 2001 From: Franck Dary <franck.dary@etu.univ-amu.fr> Date: Tue, 7 Aug 2018 15:23:53 +0200 Subject: [PATCH] Changed the name TapeMachine into TransitionMachine --- CMakeLists.txt | 4 +-- MLP/CMakeLists.txt | 1 - decoder/CMakeLists.txt | 2 +- decoder/include/Decoder.hpp | 16 +++++------ decoder/src/Decoder.cpp | 6 ++-- decoder/src/macaon_decode.cpp | 4 +-- maca_common/CMakeLists.txt | 1 - tape_machine/CMakeLists.txt | 6 ---- trainer/CMakeLists.txt | 2 +- trainer/include/Trainer.hpp | 26 ++++++++--------- trainer/src/Trainer.cpp | 8 +++--- trainer/src/macaon_train.cpp | 4 +-- transition_machine/CMakeLists.txt | 6 ++++ .../include/Action.hpp | 0 .../include/ActionBank.hpp | 0 .../include/ActionSet.hpp | 0 .../include/BD.hpp | 0 .../include/Classifier.hpp | 2 +- .../include/Config.hpp | 22 +++++++-------- .../include/FeatureBank.hpp | 0 .../include/FeatureModel.hpp | 0 .../include/Oracle.hpp | 0 .../include/TransitionMachine.hpp | 28 +++++++++---------- .../src/Action.cpp | 0 .../src/ActionBank.cpp | 0 .../src/ActionSet.cpp | 0 .../src/BD.cpp | 0 .../src/Classifier.cpp | 0 .../src/Config.cpp | 0 .../src/FeatureBank.cpp | 0 .../src/FeatureModel.cpp | 0 .../src/Oracle.cpp | 0 .../src/TransitionMachine.cpp | 16 +++++------ 33 files changed, 76 insertions(+), 78 deletions(-) delete mode 100644 tape_machine/CMakeLists.txt create mode 100644 transition_machine/CMakeLists.txt rename {tape_machine => transition_machine}/include/Action.hpp (100%) rename {tape_machine => transition_machine}/include/ActionBank.hpp (100%) rename {tape_machine => transition_machine}/include/ActionSet.hpp (100%) rename {tape_machine => transition_machine}/include/BD.hpp (100%) rename {tape_machine => transition_machine}/include/Classifier.hpp (99%) rename {tape_machine => transition_machine}/include/Config.hpp (82%) rename {tape_machine => transition_machine}/include/FeatureBank.hpp (100%) rename {tape_machine => transition_machine}/include/FeatureModel.hpp (100%) rename {tape_machine => transition_machine}/include/Oracle.hpp (100%) rename tape_machine/include/TapeMachine.hpp => transition_machine/include/TransitionMachine.hpp (76%) rename {tape_machine => transition_machine}/src/Action.cpp (100%) rename {tape_machine => transition_machine}/src/ActionBank.cpp (100%) rename {tape_machine => transition_machine}/src/ActionSet.cpp (100%) rename {tape_machine => transition_machine}/src/BD.cpp (100%) rename {tape_machine => transition_machine}/src/Classifier.cpp (100%) rename {tape_machine => transition_machine}/src/Config.cpp (100%) rename {tape_machine => transition_machine}/src/FeatureBank.cpp (100%) rename {tape_machine => transition_machine}/src/FeatureModel.cpp (100%) rename {tape_machine => transition_machine}/src/Oracle.cpp (100%) rename tape_machine/src/TapeMachine.cpp => transition_machine/src/TransitionMachine.cpp (84%) diff --git a/CMakeLists.txt b/CMakeLists.txt index 67b47e0..7d11440 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -24,13 +24,13 @@ set(CMAKE_CXX_FLAGS_DEBUG "-g3") set(CMAKE_CXX_FLAGS_RELEASE "-Ofast") include_directories(maca_common/include) -include_directories(tape_machine/include) +include_directories(transition_machine/include) include_directories(trainer/include) include_directories(decoder/include) include_directories(MLP/include) add_subdirectory(maca_common) -add_subdirectory(tape_machine) +add_subdirectory(transition_machine) add_subdirectory(trainer) add_subdirectory(decoder) add_subdirectory(MLP) diff --git a/MLP/CMakeLists.txt b/MLP/CMakeLists.txt index ead6801..a88a15e 100644 --- a/MLP/CMakeLists.txt +++ b/MLP/CMakeLists.txt @@ -2,5 +2,4 @@ FILE(GLOB SOURCES src/*.cpp) #compiling library add_library(MLP STATIC ${SOURCES}) -target_link_libraries(MLP tape_machine) target_link_libraries(MLP dynet) diff --git a/decoder/CMakeLists.txt b/decoder/CMakeLists.txt index 06d2a73..4542dfb 100644 --- a/decoder/CMakeLists.txt +++ b/decoder/CMakeLists.txt @@ -1,7 +1,7 @@ FILE(GLOB SOURCES src/*.cpp) add_executable(macaon_decode src/macaon_decode.cpp) -target_link_libraries(macaon_decode tape_machine) +target_link_libraries(macaon_decode transition_machine) target_link_libraries(macaon_decode decoder) target_link_libraries(macaon_decode ${Boost_PROGRAM_OPTIONS_LIBRARY}) install(TARGETS macaon_decode DESTINATION bin) diff --git a/decoder/include/Decoder.hpp b/decoder/include/Decoder.hpp index 228a875..190e322 100644 --- a/decoder/include/Decoder.hpp +++ b/decoder/include/Decoder.hpp @@ -6,20 +6,20 @@ #ifndef DECODER__H #define DECODER__H -#include "TapeMachine.hpp" +#include "TransitionMachine.hpp" #include "BD.hpp" #include "Config.hpp" -/// @brief A simple object capable of using a trained TapeMachine to process a given BD. +/// @brief A simple object capable of using a trained TransitionMachine to process a given BD. class Decoder { private : - /// @brief The trained TapeMachine - TapeMachine & tm; + /// @brief The trained TransitionMachine + TransitionMachine & tm; /// @brief The BD we need to fill BD & bd; - /// @brief The current configuration of the TapeMachine + /// @brief The current configuration of the TransitionMachine Config & config; public : @@ -28,10 +28,10 @@ class Decoder /// /// At the start of the function, bd must contain the input.\n /// At the end of the function, bd will be terminal. - /// @param tm The trained TapeMachine + /// @param tm The trained TransitionMachine /// @param bd The BD we need to fill - /// @param config The current configuration of the TapeMachine - Decoder(TapeMachine & tm, BD & bd, Config & config); + /// @param config The current configuration of the TransitionMachine + Decoder(TransitionMachine & tm, BD & bd, Config & config); /// @brief Fill bd using tm. void decode(); }; diff --git a/decoder/src/Decoder.cpp b/decoder/src/Decoder.cpp index fe3fcef..843333b 100644 --- a/decoder/src/Decoder.cpp +++ b/decoder/src/Decoder.cpp @@ -1,7 +1,7 @@ #include "Decoder.hpp" #include "util.hpp" -Decoder::Decoder(TapeMachine & tm, BD & bd, Config & config) +Decoder::Decoder(TransitionMachine & tm, BD & bd, Config & config) : tm(tm), bd(bd), config(config) { } @@ -10,7 +10,7 @@ void Decoder::decode() { while (!config.isFinal()) { - TapeMachine::State * currentState = tm.getCurrentState(); + TransitionMachine::State * currentState = tm.getCurrentState(); Classifier * classifier = currentState->classifier; config.setCurrentStateName(¤tState->name); @@ -27,7 +27,7 @@ void Decoder::decode() fprintf(stderr, "WARNING (%s) : action \'%s\' is not appliable.\n", ERRINFO, predictedAction.c_str()); action->apply(config); - TapeMachine::Transition * transition = tm.getTransition(predictedAction); + TransitionMachine::Transition * transition = tm.getTransition(predictedAction); tm.takeTransition(transition); config.moveHead(transition->headMvt); } diff --git a/decoder/src/macaon_decode.cpp b/decoder/src/macaon_decode.cpp index 255c6fe..40b4aa3 100644 --- a/decoder/src/macaon_decode.cpp +++ b/decoder/src/macaon_decode.cpp @@ -3,7 +3,7 @@ #include <boost/program_options.hpp> #include "BD.hpp" #include "Config.hpp" -#include "TapeMachine.hpp" +#include "TransitionMachine.hpp" #include "Decoder.hpp" namespace po = boost::program_options; @@ -86,7 +86,7 @@ int main(int argc, char * argv[]) tmFilename = expPath + tmFilename; bdFilename = expPath + bdFilename; - TapeMachine tapeMachine(tmFilename, false, expPath); + TransitionMachine tapeMachine(tmFilename, false, expPath); BD bd(bdFilename, mcdFilename); Config config(bd, expPath); diff --git a/maca_common/CMakeLists.txt b/maca_common/CMakeLists.txt index 21076c3..e7a36d6 100644 --- a/maca_common/CMakeLists.txt +++ b/maca_common/CMakeLists.txt @@ -3,4 +3,3 @@ FILE(GLOB SOURCES src/*.cpp) #compiling library add_library(maca_common STATIC ${SOURCES}) target_link_libraries(maca_common fasttext) -#target_link_libraries(maca_common dynet) diff --git a/tape_machine/CMakeLists.txt b/tape_machine/CMakeLists.txt deleted file mode 100644 index 8ce7444..0000000 --- a/tape_machine/CMakeLists.txt +++ /dev/null @@ -1,6 +0,0 @@ -FILE(GLOB SOURCES src/*.cpp) - -#compiling library -add_library(tape_machine STATIC ${SOURCES}) -target_link_libraries(tape_machine maca_common) -target_link_libraries(tape_machine MLP) diff --git a/trainer/CMakeLists.txt b/trainer/CMakeLists.txt index cb806a6..cf48282 100644 --- a/trainer/CMakeLists.txt +++ b/trainer/CMakeLists.txt @@ -1,7 +1,7 @@ FILE(GLOB SOURCES src/*.cpp) add_executable(macaon_train src/macaon_train.cpp) -target_link_libraries(macaon_train tape_machine) +target_link_libraries(macaon_train transition_machine) target_link_libraries(macaon_train trainer) target_link_libraries(macaon_train ${Boost_PROGRAM_OPTIONS_LIBRARY}) install(TARGETS macaon_train DESTINATION bin) diff --git a/trainer/include/Trainer.hpp b/trainer/include/Trainer.hpp index aa00705..f33e714 100644 --- a/trainer/include/Trainer.hpp +++ b/trainer/include/Trainer.hpp @@ -6,11 +6,11 @@ #ifndef TRAINER__H #define TRAINER__H -#include "TapeMachine.hpp" +#include "TransitionMachine.hpp" #include "BD.hpp" #include "Config.hpp" -/// @brief An object capable of training a TapeMachine given a BD initialized with training examples. +/// @brief An object capable of training a TransitionMachine given a BD initialized with training examples. class Trainer { public : @@ -20,18 +20,18 @@ class Trainer private : - /// @brief The TapeMachine that will be trained. - TapeMachine & tm; + /// @brief The TransitionMachine that will be trained. + TransitionMachine & tm; /// @brief The BD initialized with training examples. BD & trainBD; - /// @brief The configuration of the TapeMachine while processing trainBD. + /// @brief The configuration of the TransitionMachine while processing trainBD. Config & trainConfig; /// @brief The BD initialized with dev examples. /// /// Can be nullptr if dev is not used in this training. BD * devBD; - /// @brief The configuration of the TapeMachine while processing devBD. + /// @brief The configuration of the TransitionMachine while processing devBD. /// /// Can be nullptr if dev is not used in this training. Config * devConfig; @@ -47,9 +47,9 @@ class Trainer private : - /// @brief Train the TapeMachine using batches of examples. + /// @brief Train the TransitionMachine using batches of examples. /// - /// For each epoch all the Classifier of the TapeMachine are fed all the + /// For each epoch all the Classifier of the TransitionMachine are fed all the /// training examples, at the end of the epoch Classifier are evaluated on /// the devBD if available, and each Classifier will be saved only if its score /// on the current epoch is its all time best.\n @@ -103,19 +103,19 @@ class Trainer /// @brief Construct a new Trainer without a dev set. /// - /// @param tm The TapeMachine to use. + /// @param tm The TransitionMachine to use. /// @param bd The BD to use. /// @param config The config to use. - Trainer(TapeMachine & tm, BD & bd, Config & config); + Trainer(TransitionMachine & tm, BD & bd, Config & config); /// @brief Construct a new Trainer with a dev set. /// - /// @param tm The TapeMachine to use. + /// @param tm The TransitionMachine to use. /// @param bd The BD corresponding to the training dataset. /// @param config The Config corresponding to bd. /// @param devBD The BD corresponding to the dev dataset. /// @param devConfig The Config corresponding to devBD. - Trainer(TapeMachine & tm, BD & bd, Config & config, BD * devBD, Config * devConfig); - /// @brief Train the TapeMachine. + Trainer(TransitionMachine & tm, BD & bd, Config & config, BD * devBD, Config * devConfig); + /// @brief Train the TransitionMachine. /// /// @param nbIter The number of training epochs. /// @param batchSize The size of each batch. diff --git a/trainer/src/Trainer.cpp b/trainer/src/Trainer.cpp index 2b9bb19..b3c1c49 100644 --- a/trainer/src/Trainer.cpp +++ b/trainer/src/Trainer.cpp @@ -1,14 +1,14 @@ #include "Trainer.hpp" #include "util.hpp" -Trainer::Trainer(TapeMachine & tm, BD & bd, Config & config) +Trainer::Trainer(TransitionMachine & tm, BD & bd, Config & config) : tm(tm), trainBD(bd), trainConfig(config) { this->devBD = nullptr; this->devConfig = nullptr; } -Trainer::Trainer(TapeMachine & tm, BD & bd, Config & config, BD * devBD, Config * devConfig) : tm(tm), trainBD(bd), trainConfig(config), devBD(devBD), devConfig(devConfig) +Trainer::Trainer(TransitionMachine & tm, BD & bd, Config & config, BD * devBD, Config * devConfig) : tm(tm), trainBD(bd), trainConfig(config), devBD(devBD), devConfig(devConfig) { } @@ -17,7 +17,7 @@ void Trainer::getExamplesByClassifier(std::map<Classifier*, MLP::Examples> & exa { while (!config.isFinal()) { - TapeMachine::State * currentState = tm.getCurrentState(); + TransitionMachine::State * currentState = tm.getCurrentState(); Classifier * classifier = currentState->classifier; config.setCurrentStateName(¤tState->name); classifier->initClassifier(config); @@ -41,7 +41,7 @@ void Trainer::getExamplesByClassifier(std::map<Classifier*, MLP::Examples> & exa //fprintf(stderr, "Action : %s\n", neededActionName.c_str()); - TapeMachine::Transition * transition = tm.getTransition(neededActionName); + TransitionMachine::Transition * transition = tm.getTransition(neededActionName); tm.takeTransition(transition); config.moveHead(transition->headMvt); } diff --git a/trainer/src/macaon_train.cpp b/trainer/src/macaon_train.cpp index d1a011a..01720f6 100644 --- a/trainer/src/macaon_train.cpp +++ b/trainer/src/macaon_train.cpp @@ -3,7 +3,7 @@ #include <boost/program_options.hpp> #include "BD.hpp" #include "Config.hpp" -#include "TapeMachine.hpp" +#include "TransitionMachine.hpp" #include "Trainer.hpp" namespace po = boost::program_options; @@ -100,7 +100,7 @@ int main(int argc, char * argv[]) trainFilename = expPath + trainFilename; devFilename = expPath + devFilename; - TapeMachine tapeMachine(tmFilename, true, expPath); + TransitionMachine tapeMachine(tmFilename, true, expPath); BD trainBD(BDfilename, MCDfilename); Config trainConfig(trainBD, expPath); diff --git a/transition_machine/CMakeLists.txt b/transition_machine/CMakeLists.txt new file mode 100644 index 0000000..56c1cff --- /dev/null +++ b/transition_machine/CMakeLists.txt @@ -0,0 +1,6 @@ +FILE(GLOB SOURCES src/*.cpp) + +#compiling library +add_library(transition_machine STATIC ${SOURCES}) +target_link_libraries(transition_machine maca_common) +target_link_libraries(transition_machine MLP) diff --git a/tape_machine/include/Action.hpp b/transition_machine/include/Action.hpp similarity index 100% rename from tape_machine/include/Action.hpp rename to transition_machine/include/Action.hpp diff --git a/tape_machine/include/ActionBank.hpp b/transition_machine/include/ActionBank.hpp similarity index 100% rename from tape_machine/include/ActionBank.hpp rename to transition_machine/include/ActionBank.hpp diff --git a/tape_machine/include/ActionSet.hpp b/transition_machine/include/ActionSet.hpp similarity index 100% rename from tape_machine/include/ActionSet.hpp rename to transition_machine/include/ActionSet.hpp diff --git a/tape_machine/include/BD.hpp b/transition_machine/include/BD.hpp similarity index 100% rename from tape_machine/include/BD.hpp rename to transition_machine/include/BD.hpp diff --git a/tape_machine/include/Classifier.hpp b/transition_machine/include/Classifier.hpp similarity index 99% rename from tape_machine/include/Classifier.hpp rename to transition_machine/include/Classifier.hpp index dce07cd..0dd55fa 100644 --- a/tape_machine/include/Classifier.hpp +++ b/transition_machine/include/Classifier.hpp @@ -139,7 +139,7 @@ class Classifier /// @brief Initialize the underlying neural network. /// /// Using the Config and the FeatureModel, the size of the input and output layers of the neural network will be computed. Using the topology string, the hidden layers will be computed. - /// @param config A Configuration of the TapeMachine. + /// @param config A Configuration of the TransitionMachine. void initClassifier(Config & config); /// @brief Save the trained neural network of this Classifier into a file. /// diff --git a/tape_machine/include/Config.hpp b/transition_machine/include/Config.hpp similarity index 82% rename from tape_machine/include/Config.hpp rename to transition_machine/include/Config.hpp index 7dbb45a..7f0773b 100644 --- a/tape_machine/include/Config.hpp +++ b/transition_machine/include/Config.hpp @@ -9,7 +9,7 @@ #include <vector> #include "BD.hpp" -/// @brief Configuration of a TapeMachine. +/// @brief Configuration of a TransitionMachine. /// It consists of a multi-tapes buffer, a stack and a head. class Config { @@ -40,9 +40,9 @@ class Config private : - /// @brief The name of the current state of the TapeMachine. + /// @brief The name of the current state of the TransitionMachine. std::string * currentStateName; - /// @brief For each state of the TapeMachine, an history of the Action that have been applied to this Config. + /// @brief For each state of the TransitionMachine, an history of the Action that have been applied to this Config. std::map< std::string, std::vector<std::string> > actionHistory; public : @@ -102,19 +102,19 @@ class Config bool isFinal(); /// @brief Reset the Config as it was just after the reading of the input. void reset(); - /// @brief Get the name of the current state in the TapeMachine. + /// @brief Get the name of the current state in the TransitionMachine. /// - /// @return the name of the current state in the TapeMachine. + /// @return the name of the current state in the TransitionMachine. std::string & getCurrentStateName(); - /// @brief Set the name of the current state in the TapeMachine. + /// @brief Set the name of the current state in the TransitionMachine. /// - /// This function does not change the current state in the TapeMachine.\n - /// But it has to be called everytime the TapeMachine's current state change, in order to notify the Config of this change. - /// @param name The name of the current state in the TapeMachine. + /// This function does not change the current state in the TransitionMachine.\n + /// But it has to be called everytime the TransitionMachine's current state change, in order to notify the Config of this change. + /// @param name The name of the current state in the TransitionMachine. void setCurrentStateName(std::string * const name); - /// @brief Get the history of Action of the current state in the TapeMachine. + /// @brief Get the history of Action of the current state in the TransitionMachine. /// - /// @return The history of Action of the current state in the TapeMachine. + /// @return The history of Action of the current state in the TransitionMachine. std::vector<std::string> & getCurrentStateHistory(); }; diff --git a/tape_machine/include/FeatureBank.hpp b/transition_machine/include/FeatureBank.hpp similarity index 100% rename from tape_machine/include/FeatureBank.hpp rename to transition_machine/include/FeatureBank.hpp diff --git a/tape_machine/include/FeatureModel.hpp b/transition_machine/include/FeatureModel.hpp similarity index 100% rename from tape_machine/include/FeatureModel.hpp rename to transition_machine/include/FeatureModel.hpp diff --git a/tape_machine/include/Oracle.hpp b/transition_machine/include/Oracle.hpp similarity index 100% rename from tape_machine/include/Oracle.hpp rename to transition_machine/include/Oracle.hpp diff --git a/tape_machine/include/TapeMachine.hpp b/transition_machine/include/TransitionMachine.hpp similarity index 76% rename from tape_machine/include/TapeMachine.hpp rename to transition_machine/include/TransitionMachine.hpp index 56bd995..d899888 100644 --- a/tape_machine/include/TapeMachine.hpp +++ b/transition_machine/include/TransitionMachine.hpp @@ -1,20 +1,20 @@ -/// @file TapeMachine.hpp +/// @file TransitionMachine.hpp /// @author Franck Dary /// @version 1.0 /// @date 2018-08-07 -#ifndef TAPEMACHINE__H -#define TAPEMACHINE__H +#ifndef TRANSITIONMACHINE__H +#define TRANSITIONMACHINE__H #include "Classifier.hpp" -/// @brief The purpose of a TapeMachine is to predict a sequence of Action, that will transform an initial Config into a terminal Config. +/// @brief The purpose of a TransitionMachine is to predict a sequence of Action, that will transform an initial Config into a terminal Config. /// /// The terminal Config will contains more information than the initial one, for /// instance if the initial Config consists of words, the final Config could consist of words + their part of speech tags.\n -/// The TapeMachine is made of states, linked together by Transition. Every step is associated with a Classifier.\n +/// The TransitionMachine is made of states, linked together by Transition. Every step is associated with a Classifier.\n /// The predictions are made by classifiers, which at each step give a weight to every possible Action. The most probable Action will then be chosen and the corresponding Transition will be taken.\n -class TapeMachine +class TransitionMachine { public : @@ -38,7 +38,7 @@ class TapeMachine Transition(State * dest, const std::string & prefix, int mvt); }; - /// @brief A State of the TapeMachine. Can be seen as a graph node. + /// @brief A State of the TransitionMachine. Can be seen as a graph node. struct State { /// @brief The name of this State. @@ -70,18 +70,18 @@ class TapeMachine public : - /// @brief The name of this TapeMachine. + /// @brief The name of this TransitionMachine. std::string name; public : - /// @brief Read and construct a new TapeMachine from a file. + /// @brief Read and construct a new TransitionMachine from a file. /// - /// @param filename The name of the file containing the TapeMachine. + /// @param filename The name of the file containing the TransitionMachine. /// @param trainMode Whether or not the program is in train mode. /// @param expPath The absolute path of the current experiment. - TapeMachine(const std::string & filename, bool trainMode, const std::string & expPath); - /// @brief Get the current TapeMachine state. + TransitionMachine(const std::string & filename, bool trainMode, const std::string & expPath); + /// @brief Get the current TransitionMachine state. /// /// @return The current state. State * getCurrentState(); @@ -95,9 +95,9 @@ class TapeMachine /// /// @param transition The Transition to take. void takeTransition(Transition * transition); - /// @brief Return all the Classifier used by this TapeMachine. + /// @brief Return all the Classifier used by this TransitionMachine. /// - /// @return All the Classifier used by this TapeMachine. + /// @return All the Classifier used by this TransitionMachine. std::vector<Classifier*> & getClassifiers(); }; diff --git a/tape_machine/src/Action.cpp b/transition_machine/src/Action.cpp similarity index 100% rename from tape_machine/src/Action.cpp rename to transition_machine/src/Action.cpp diff --git a/tape_machine/src/ActionBank.cpp b/transition_machine/src/ActionBank.cpp similarity index 100% rename from tape_machine/src/ActionBank.cpp rename to transition_machine/src/ActionBank.cpp diff --git a/tape_machine/src/ActionSet.cpp b/transition_machine/src/ActionSet.cpp similarity index 100% rename from tape_machine/src/ActionSet.cpp rename to transition_machine/src/ActionSet.cpp diff --git a/tape_machine/src/BD.cpp b/transition_machine/src/BD.cpp similarity index 100% rename from tape_machine/src/BD.cpp rename to transition_machine/src/BD.cpp diff --git a/tape_machine/src/Classifier.cpp b/transition_machine/src/Classifier.cpp similarity index 100% rename from tape_machine/src/Classifier.cpp rename to transition_machine/src/Classifier.cpp diff --git a/tape_machine/src/Config.cpp b/transition_machine/src/Config.cpp similarity index 100% rename from tape_machine/src/Config.cpp rename to transition_machine/src/Config.cpp diff --git a/tape_machine/src/FeatureBank.cpp b/transition_machine/src/FeatureBank.cpp similarity index 100% rename from tape_machine/src/FeatureBank.cpp rename to transition_machine/src/FeatureBank.cpp diff --git a/tape_machine/src/FeatureModel.cpp b/transition_machine/src/FeatureModel.cpp similarity index 100% rename from tape_machine/src/FeatureModel.cpp rename to transition_machine/src/FeatureModel.cpp diff --git a/tape_machine/src/Oracle.cpp b/transition_machine/src/Oracle.cpp similarity index 100% rename from tape_machine/src/Oracle.cpp rename to transition_machine/src/Oracle.cpp diff --git a/tape_machine/src/TapeMachine.cpp b/transition_machine/src/TransitionMachine.cpp similarity index 84% rename from tape_machine/src/TapeMachine.cpp rename to transition_machine/src/TransitionMachine.cpp index 0639c6b..29f1fd7 100644 --- a/tape_machine/src/TapeMachine.cpp +++ b/transition_machine/src/TransitionMachine.cpp @@ -1,9 +1,9 @@ -#include "TapeMachine.hpp" +#include "TransitionMachine.hpp" #include "File.hpp" #include "util.hpp" #include <cstring> -TapeMachine::TapeMachine(const std::string & filename, bool trainMode, const std::string & expPath) +TransitionMachine::TransitionMachine(const std::string & filename, bool trainMode, const std::string & expPath) { auto badFormatAndAbort = [&filename](const std::string & errInfo) { @@ -96,25 +96,25 @@ TapeMachine::TapeMachine(const std::string & filename, bool trainMode, const std } } -TapeMachine::State::State(const std::string & name, Classifier * classifier) +TransitionMachine::State::State(const std::string & name, Classifier * classifier) { this->name = name; this->classifier = classifier; } -TapeMachine::Transition::Transition(State * dest, const std::string & prefix, int mvt) +TransitionMachine::Transition::Transition(State * dest, const std::string & prefix, int mvt) { this->dest = dest; this->actionPrefix = prefix; this->headMvt = mvt; } -TapeMachine::State * TapeMachine::getCurrentState() +TransitionMachine::State * TransitionMachine::getCurrentState() { return currentState; } -TapeMachine::Transition * TapeMachine::getTransition(const std::string & action) +TransitionMachine::Transition * TransitionMachine::getTransition(const std::string & action) { for (auto & transition : currentState->transitions) { @@ -129,12 +129,12 @@ TapeMachine::Transition * TapeMachine::getTransition(const std::string & action) return nullptr; } -void TapeMachine::takeTransition(Transition * transition) +void TransitionMachine::takeTransition(Transition * transition) { currentState = transition->dest; } -std::vector<Classifier*> & TapeMachine::getClassifiers() +std::vector<Classifier*> & TransitionMachine::getClassifiers() { return classifiers; } -- GitLab