def gen_group_image(self, token, depth=1):
"""Generates the images based on the node that represents this group.
Args:
token: The Treenode node.
depth: integer 1 by default, as we are only interested in the first level.
Returns:
A string with the image path.
"""
e = Digraph(self.argv.tetre_word, format=GroupImageNameGenerator.file_extension)
e.attr('node', shape='box')
current_id = self.current_token_id
e.node(str(current_id), token.pos_)
self.group_to_graph_recursive_with_depth(token, current_id, e, depth)
name_generator = GroupImageNameGenerator(self.base_image_name, self.argv.tetre_word, str(self.current_group_id))
e.render(name_generator.get_render_path())
self.current_group_id += 1
return name_generator.get_base_path_with_extension()
评论列表
文章目录