Recover the quadrilateral of a text span. Args: line_dir: (tuple) 'line["dir"]' of the owning line. span: the span. Returns: The quadrilateral enveloping the span's text.
(line_dir: tuple, span: dict)
| 5026 | |
| 5027 | |
| 5028 | def recover_quad(line_dir: tuple, span: dict) -> Quad: |
| 5029 | """Recover the quadrilateral of a text span. |
| 5030 | |
| 5031 | Args: |
| 5032 | line_dir: (tuple) 'line["dir"]' of the owning line. |
| 5033 | span: the span. |
| 5034 | Returns: |
| 5035 | The quadrilateral enveloping the span's text. |
| 5036 | """ |
| 5037 | if type(line_dir) is not tuple or len(line_dir) != 2: |
| 5038 | raise ValueError("bad line dir argument") |
| 5039 | if type(span) is not dict: |
| 5040 | raise ValueError("bad span argument") |
| 5041 | return recover_bbox_quad(line_dir, span, span["bbox"]) |
| 5042 | |
| 5043 | |
| 5044 | def recover_line_quad(line: dict, spans: list = None) -> Quad: |
no test coverage detected
searching dependent graphs…