Skip to content

Commit 1fe94e5

Browse files
committed
fix parsing with store guest
1 parent c68f32f commit 1fe94e5

1 file changed

Lines changed: 6 additions & 12 deletions

File tree

bt_nodes/hri/src/hri/dialog/store_guest_info.cpp

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -88,29 +88,23 @@ std::string obtain_guest_id(const std::string & json)
8888

8989
static std::string sanitize_turtle_literal(const std::string & s)
9090
{
91-
// Strip ALL backslashes unconditionally — LLM-generated descriptions never need
92-
// legitimate escape sequences, and the KB parser (OWL/Turtle) chokes on anything
93-
// that isn't one of the five valid escapes (\t \n \r \\ \").
94-
// Also strip dots (.) which break Turtle statement terminators.
91+
// Strip ALL backslashes and dots unconditionally
9592
std::string result;
9693
result.reserve(s.size());
9794

9895
for (size_t i = 0; i < s.size(); ++i) {
9996
char c = s[i];
10097
if (c == '\\') {
101-
// Drop ALL backslashes unconditionally — skip the backslash.
102-
// If there is a following character, keep it (it's the intended content).
103-
if (i + 1 < s.size()) {
104-
++i;
105-
result += s[i];
106-
}
107-
// Trailing backslash at end of string: just drop it
98+
// Completely drop backslashes
99+
continue;
108100
} else if (c == '"') {
109101
result += "\\\""; // escape bare double quotes for Turtle
110102
} else if (c == '\n') {
111-
result += ' '; // newlines → space (cleaner than \n inside a single-line literal)
103+
result += ' '; // newlines → space
112104
} else if (c == '\r') {
113105
// skip carriage returns
106+
} else if (c == '.') {
107+
// skip dots
114108
} else {
115109
result += c;
116110
}

0 commit comments

Comments
 (0)