Set base logging level as info, remove unused debug strings.

This commit is contained in:
kenkeiras 2017-05-22 22:06:49 +02:00
parent 393527590c
commit f338fb786d
4 changed files with 9 additions and 36 deletions

View file

@ -133,26 +133,11 @@ def apply_remix(tokens, remix):
def build_remix_matrix(knowledge_base, tokens, atom, similar):
# logging.debug("+" * 20)
tokens = list(tokens)
tokens, matcher, result = make_template(knowledge_base, tokens, atom)
similar_matcher, similar_result, similar_result_resolved, _ = similar
# logging.debug("NEW:")
# logging.debug("Tokens:", tokens)
# logging.debug("Matcher:", matcher)
# logging.debug("Result:", result)
# logging.debug("---")
# logging.debug("Similar:")
# logging.debug("Matcher:", similar_matcher)
# logging.debug("Result:", similar_result)
start_bounds, end_bounds = find_bounds(matcher, similar_matcher)
# logging.debug("---")
# logging.debug("Bounds:")
# logging.debug("Start:", start_bounds)
# logging.debug("End: ", end_bounds)
for i, element in (end_bounds + start_bounds[::-1]):
matcher.pop(i)
@ -161,15 +146,10 @@ def build_remix_matrix(knowledge_base, tokens, atom, similar):
possible_remixes = get_possible_remixes(knowledge_base, matcher, similar_matcher)
chosen_remix = possible_remixes[0]
# logging.debug("New tokens:", tokens)
# logging.debug("-" * 20)
return chosen_remix, (start_bounds, end_bounds)
def get_possible_remixes(knowledge_base, matcher, similar_matcher):
# logging.debug("*" * 20)
# logging.debug(matcher)
# logging.debug(similar_matcher)
matrix = []
for element in matcher:
@ -183,8 +163,6 @@ def get_possible_remixes(knowledge_base, matcher, similar_matcher):
indexes = all_indexes(similar_matcher, element)
matrix.append(indexes)
# logging.debug(matrix)
# logging.debug([list(x) for x in list(zip(*matrix))])
# TODO: do some scoring to find the most "interesting combination"
return [list(x) for x in list(zip(*matrix))]
@ -304,19 +282,14 @@ def get_matching(sample, other):
def reprocess_language_knowledge(knowledge_base, examples):
examples = knowledge_base.examples + examples
logging.debug('\n'.join(map(str, knowledge_base.examples)))
logging.debug("--")
pattern_examples = []
for i, sample in enumerate(examples):
other = examples[:i] + examples[i + 1:]
match = get_matching(sample, other)
logging.debug("->", match)
if len(match) > 0:
sample = (match, sample[1],)
pattern_examples.append(sample)
logging.debug("---")
logging.debug("\x1b[7m--\x1b[0m")
return pattern_examples