Fix debugging logging formats.

This commit is contained in:
kenkeiras 2017-09-20 21:11:08 -04:00
parent 4e8f82c0a5
commit 16a895dc22

View File

@ -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)