From e5ec5737056bd4b72c9b80e897d52f97f4f2045c Mon Sep 17 00:00:00 2001 From: Mathieu Date: Tue, 14 Sep 2021 15:44:46 +0200 Subject: [PATCH] Fix replace with single braces in dialog --- jarvis/skills/__init__.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/jarvis/skills/__init__.py b/jarvis/skills/__init__.py index a36bd90..b619b6e 100644 --- a/jarvis/skills/__init__.py +++ b/jarvis/skills/__init__.py @@ -42,16 +42,17 @@ class Skill: random_line = get_random_line_from_file(file) for key, val in data.items(): - if "{{" + key + "}}" in random_line: + if "{{" + key + "}}" in random_line or "{" + key + "}" in random_line: # TODO: replace when found a better TTS engine for french # as the french tts don't support float in sentence, convert it to an integer if is_float(val): # val = str(int(float(val))) # convert a float to integer val = str(val).split(".")[0] + " virgule " + str(val).split(".")[1] - random_line = random_line.replace("{{" + key + "}}", val) + random_line = random_line.replace("{{" + key + "}}", val) + random_line = random_line.replace("{" + key + "}", val) - self.speak(random_line) + self.speak(random_line) return "Error, dialog not found for : " + dialog