lang-model/naive-nlu/tree_nlu/depth_meter.py

12 lines
352 B
Python
Raw Normal View History

import sys
2017-05-23 17:04:10 +00:00
from . import parameters
2017-05-21 12:12:25 +00:00
def show_depth(depth: int, zoom: int=2):
offset = int((parameters.MAX_RECURSIONS - depth) / (2 / zoom))
2017-05-21 12:08:29 +00:00
2017-05-21 12:12:25 +00:00
depth = depth * zoom
2017-05-21 12:08:29 +00:00
offset -= int(depth % 2)
sys.stdout.write("\r|\x1b[K" + (u'' * int(depth / 2)) + (u'' * int(depth % 2)) + ' ' * offset + "|\x1b[7m \x1b[0m\b")
sys.stdout.flush()