From 38271016db07236ba4b674bc16cec9e22d15ac3a Mon Sep 17 00:00:00 2001 From: Luka Date: Tue, 5 Nov 2019 09:26:21 +0100 Subject: [PATCH] Fixed output - no more bracelets later --- dependency-parsetree.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/dependency-parsetree.py b/dependency-parsetree.py index a63f828..37c7181 100644 --- a/dependency-parsetree.py +++ b/dependency-parsetree.py @@ -202,7 +202,11 @@ def printable_answers(query): # res.extend(printable_answers(node_action[1:-1])) # res.extend([node_actions[-1]]) for node_action in node_actions: - res.extend(printable_answers(node_action)) + # if command in bracelets remove them and treat command as new query + if node_action[0] == '(' and node_action[-1] == ')': + res.extend(printable_answers(node_action[1:-1])) + else: + res.extend([node_action]) return res else: return [query]