Handle the possibility of remixes not working.
This commit is contained in:
parent
6693b7deb0
commit
460ad73bba
@ -295,6 +295,8 @@ def reprocess_language_knowledge(knowledge_base, examples):
|
|||||||
def reverse_remix(tree_section, remix):
|
def reverse_remix(tree_section, remix):
|
||||||
result_section = []
|
result_section = []
|
||||||
for origin in remix:
|
for origin in remix:
|
||||||
|
if origin >= len(tree_section):
|
||||||
|
return None
|
||||||
result_section.append(copy.deepcopy(tree_section[origin]))
|
result_section.append(copy.deepcopy(tree_section[origin]))
|
||||||
return result_section + tree_section[len(remix):]
|
return result_section + tree_section[len(remix):]
|
||||||
|
|
||||||
@ -332,6 +334,9 @@ def resolve_fit(knowledge, fit, remaining_recursions):
|
|||||||
else:
|
else:
|
||||||
((result_type, remixer), tokens) = element
|
((result_type, remixer), tokens) = element
|
||||||
remixed_tokens = reverse_remix(tokens, remixer)
|
remixed_tokens = reverse_remix(tokens, remixer)
|
||||||
|
if remixed_tokens is None:
|
||||||
|
return None
|
||||||
|
|
||||||
minifit = get_fit(knowledge, remixed_tokens, remaining_recursions - 1)
|
minifit = get_fit(knowledge, remixed_tokens, remaining_recursions - 1)
|
||||||
if minifit is None:
|
if minifit is None:
|
||||||
return None
|
return None
|
||||||
|
Loading…
Reference in New Issue
Block a user