From 4e8f82c0a55bd3e7a1227d752f5a1f3e6a5e6ecc Mon Sep 17 00:00:00 2001 From: kenkeiras Date: Wed, 20 Sep 2017 21:04:04 -0400 Subject: [PATCH] Add debug command. --- naive-nlu/tree_nlu/cli.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/naive-nlu/tree_nlu/cli.py b/naive-nlu/tree_nlu/cli.py index 701347e..1306d83 100644 --- a/naive-nlu/tree_nlu/cli.py +++ b/naive-nlu/tree_nlu/cli.py @@ -1,4 +1,3 @@ -import logging from .knowledge_base import KnowledgeBase from .tests import gac_100 from .modifiable_property import ( @@ -10,6 +9,12 @@ from .modifiable_property import ( bye_phrases = ['bye', 'exit'] + +def debug(knowledge): + for key in knowledge.knowledge: + print("\x1b[1m{}\x1b[0m {}".format(key, knowledge.knowledge[key])) + + def main(): knowledge = gac_100.main() while True: @@ -23,6 +28,10 @@ def main(): if not data: continue + if data == '/debug': + debug(knowledge) + continue + ret = knowledge.process(data) if ret: result, _, _ = ret