From 16a895dc227b23f91bc4efe70b7e68d25379c51c Mon Sep 17 00:00:00 2001 From: kenkeiras Date: Wed, 20 Sep 2017 21:11:08 -0400 Subject: [PATCH] Fix debugging logging formats. --- naive-nlu/tree_nlu/parsing.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/naive-nlu/tree_nlu/parsing.py b/naive-nlu/tree_nlu/parsing.py index 65ebf26..632a959 100644 --- a/naive-nlu/tree_nlu/parsing.py +++ b/naive-nlu/tree_nlu/parsing.py @@ -429,17 +429,17 @@ def resolve_fit(knowledge, fit, remaining_recursions): def match_fit(knowledge, tokens, matcher, ast, remaining_recursions): segment_possibilities = [([], tokens)] # Matched tokens, remaining tokens indent = ' ' * (parameters.MAX_RECURSIONS - remaining_recursions) - logging.debug(indent + 'T>', tokens) - logging.debug(indent + 'M>', matcher) + logging.debug(indent + 'T> {}'.format(tokens)) + logging.debug(indent + 'M> {}'.format(matcher)) for minisegment in matcher: possibilities_after_round = [] - logging.debug(indent + "MS", minisegment) + logging.debug(indent + "MS {}".format(minisegment)) for matched_tokens, remaining_tokens in segment_possibilities: if len(remaining_tokens) < 1: continue - logging.debug(indent + "RT", remaining_tokens[0]) - logging.debug(indent + "DEF", is_definite_minisegment(minisegment)) + logging.debug(indent + "RT {}".format(remaining_tokens[0])) + logging.debug(indent + "DEF {}".format(is_definite_minisegment(minisegment))) if is_definite_minisegment(minisegment): # What if not match -----< if match_token(knowledge, remaining_tokens[0], minisegment): @@ -455,7 +455,7 @@ def match_fit(knowledge, tokens, matcher, ast, remaining_recursions): matched_tokens + [(minisegment, remaining_tokens[:i])], remaining_tokens[i:] )) - logging.debug(indent + "## PA", len(possibilities_after_round)) + logging.debug(indent + "## PA {}".format(possibilities_after_round)) else: segment_possibilities = possibilities_after_round logging.debug(">>>> {}".format(len(segment_possibilities))) @@ -467,11 +467,11 @@ def match_fit(knowledge, tokens, matcher, ast, remaining_recursions): resolved_fits = [] for fit, _ in fully_matched_segments: - logging.debug(indent + ":::", fit) # REMIXES HAVE TO BE APPLIED BEFORE!!! + logging.debug(indent + "::: {}".format(fit)) # REMIXES HAVE TO BE APPLIED BEFORE!!! logging.debug(indent + '*' * 20) for fit, _ in fully_matched_segments: - logging.debug(indent + ":::", fit) # REMIXES HAVE TO BE APPLIED BEFORE!!! + logging.debug(indent + "::: {}".format(fit)) # REMIXES HAVE TO BE APPLIED BEFORE!!! resolved_fit = resolve_fit(knowledge, fit, remaining_recursions) if resolved_fit is not None: resolved_fits.append(resolved_fit)