Closed TathagataChakraborti closed 5 days ago
Not sure I understand, do you want me to write to json "map \"new_york\" query" instead?
I am guessing I would need something like
#include <regex>
...
std::string name = operators[plan[0]].get_name()
name = std::regex_replace(name, std::regex("\\""), "\\\\"");
...
added here: https://github.com/IBM/kstar/blob/main/src/search/plan_manager.cc#L113C24-L113C53
do you want me to write to json "map \"new_york\" query" instead
No I think the problem is inside the package reading from the output of fast downward. Coz I am getting back an empty list of plans with the decoding error for the step map "new york" query
Try with the attached PDDL.
Okay, let me rephrase. A valid json would have an escape character before "
. So, the json generated by K* is not a valid json. That's why it fails on reading.
I don't think thats the problem. "It" here is K itself! The packages asks for the files directly as input so by then the escaping into text has already happened. The strings with "s then get passed all the way through to the planner as is. So the problem is at reading the sas plan output files when it is trying to generate the output JSON to return back (its not a case of an invalid JSON generated by K coz it does not return the doc string it returns the JSON object).
There is no actual reading of sas plan files, the code I referred to above is dumping the plans into JSON. The action names are strings, they have the "
inside, but without escape characters, and when written the way they are, the JSON does not have the escape characters as well, which makes the JSON invalid. I did the dump to JSON myself instead of using a JSON library, maybe such libraries do know how to handle the string with " correctly. Or I can just do the ad-hoc fix.
I see, up to you how / if you want to handle it. I am transforming the names before sending anyway but in general you might want to cover it for other users.
If this is not an issue for nl2flow, then maybe the issue should be opened on the K* git? I have never experienced or asked about it until now, so I assume this is not urgent.
Ok closing this and logging it in kstar for posterity.
When object names have "s in them, the planner works fine but Kstar errors out.
download pddl
Of course, one can say such strings are not allowed, but I feel that if the planner handles it then the package should be able to forward that information correctly.