Add remix application sample.
This commit is contained in:
parent
c6eaf056aa
commit
099af2a815
@ -63,6 +63,10 @@ def integrate_language(knowledge_base, example):
|
|||||||
print("Tx:", tokens)
|
print("Tx:", tokens)
|
||||||
print("Mx:", matcher)
|
print("Mx:", matcher)
|
||||||
print("Rx:", result)
|
print("Rx:", result)
|
||||||
|
print("Remix:", remix)
|
||||||
|
after_remix = apply_remix(tokens[len(start_bounds):-len(end_bounds)], remix)
|
||||||
|
assert(len(after_remix) + len(start_bounds) + len(end_bounds) == len(tokens))
|
||||||
|
print(" \\->", after_remix)
|
||||||
print("#########")
|
print("#########")
|
||||||
|
|
||||||
break
|
break
|
||||||
@ -75,6 +79,13 @@ def integrate_language(knowledge_base, example):
|
|||||||
return tokens, matcher, result
|
return tokens, matcher, result
|
||||||
|
|
||||||
|
|
||||||
|
def apply_remix(tokens, remix):
|
||||||
|
rebuilt = []
|
||||||
|
for i in remix:
|
||||||
|
rebuilt.append(tokens[i])
|
||||||
|
return rebuilt
|
||||||
|
|
||||||
|
|
||||||
def build_remix_matrix(knowledge_base, text, atom, similar):
|
def build_remix_matrix(knowledge_base, text, atom, similar):
|
||||||
# print("+" * 20)
|
# print("+" * 20)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user