MCPcopy Create free account
hub / github.com/chatdoc-com/OCRFlux / TableTree

Class TableTree

eval/eval_table_to_html_olmocr.py:14–31  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

12
13
14class TableTree(Tree):
15 def __init__(self, tag, colspan=None, rowspan=None, content=None, *children):
16 self.tag = tag
17 self.colspan = colspan
18 self.rowspan = rowspan
19 self.content = content
20 self.children = list(children)
21
22 def bracket(self):
23 """Show tree using brackets notation"""
24 if self.tag == 'td':
25 result = '"tag": %s, "colspan": %d, "rowspan": %d, "text": %s' % \
26 (self.tag, self.colspan, self.rowspan, self.content)
27 else:
28 result = '"tag": %s' % self.tag
29 for child in self.children:
30 result += child.bracket()
31 return "{{{}}}".format(result)
32
33
34class CustomConfig(Config):

Callers 1

load_html_treeMethod · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected