Add progress bar visuals to tests.
This commit is contained in:
parent
8e304b2a09
commit
e0a5f02c34
3 changed files with 31 additions and 4 deletions
|
@ -1,4 +1,5 @@
|
|||
from ..knowledge_base import KnowledgeBase
|
||||
from ..utils.visuals import show_progbar
|
||||
|
||||
def _assert(args):
|
||||
assert(args)
|
||||
|
@ -670,14 +671,20 @@ def main():
|
|||
knowledge=base_knowledge,
|
||||
)
|
||||
|
||||
for example_type, data in examples:
|
||||
total = len(examples)
|
||||
|
||||
for i, (example_type, data) in enumerate(examples):
|
||||
if example_type == 'full_example':
|
||||
affirmation = {
|
||||
'text': data['affirmation'],
|
||||
'parsed': data['parsed'][1],
|
||||
}
|
||||
question = data
|
||||
|
||||
show_progbar(i, total, data['affirmation'])
|
||||
differences = knowledge.train([affirmation])
|
||||
|
||||
show_progbar(i, total, data['text'])
|
||||
differences = knowledge.train([question])
|
||||
|
||||
result, _, _ = knowledge.process(data['text'])
|
||||
|
@ -690,7 +697,10 @@ def main():
|
|||
f(knowledge)
|
||||
|
||||
elif example_type == 'text_example':
|
||||
show_progbar(i, total, data['affirmation'])
|
||||
affirmation = data['affirmation']
|
||||
|
||||
show_progbar(i, total, data['question'])
|
||||
question = data['question']
|
||||
|
||||
_, _, _ = knowledge.process(affirmation)
|
||||
|
@ -701,3 +711,5 @@ def main():
|
|||
|
||||
else:
|
||||
raise NotImplementedError('Example type: {}'.format(example_type))
|
||||
|
||||
print("\r\x1b[K", end='')
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue