Now you can pass an ATT file directly to the constructor and it will parse it for you.
To implement undo you just need to store the ctx objects that step() returns and for weights you just need to change the type signature from (in C++ terms) map<State, vector<string>> to map<State, vector<pair<string, double>>> (which affects the concatenation logic in epsilon_closure() and _product() but not really anything else).
Now you can pass an ATT file directly to the constructor and it will parse it for you.
To implement undo you just need to store the
ctx
objects thatstep()
returns and for weights you just need to change the type signature from (in C++ terms)map<State, vector<string>>
tomap<State, vector<pair<string, double>>>
(which affects the concatenation logic inepsilon_closure()
and_product()
but not really anything else).