Skip to content

visualizer.get_box is a duplicate of utils_visual.bbox_from_span #445

@HiromuHota

Description

@HiromuHota

Describe the bug

visualizer.get_box below is a duplicate of utils_visual.bbox_from_span

def get_box(span: SpanMention) -> Bbox:
"""Get the bounding box."""
return Bbox(
min(span.get_attrib_tokens("page")),
min(span.get_attrib_tokens("top")),
min(span.get_attrib_tokens("left")),
max(span.get_attrib_tokens("bottom")),
max(span.get_attrib_tokens("right")),
)

def bbox_from_span(span) -> Bbox: # type: ignore
warnings.warn(
"bbox_from_span(span) is deprecated. Use span.get_bbox() instead.",
DeprecationWarning,
)
from fonduer.candidates.models.span_mention import TemporarySpanMention # noqa
if isinstance(span, TemporarySpanMention) and span.sentence.is_visual():
return Bbox(
span.get_attrib_tokens("page")[0],
min(span.get_attrib_tokens("top")),
max(span.get_attrib_tokens("bottom")),
min(span.get_attrib_tokens("left")),
max(span.get_attrib_tokens("right")),
)
else:
return None

utils_visual.bbox_from_span is now deprecated. So should visualizer.get_box.

To Reproduce

N/A

Expected behavior

visualizer.get_box is deprecated.

Error Logs/Screenshots

N/A

Environment (please complete the following information):

  • Fonduer Version: 0.8.2

Additional context

utils_visual.bbox_from_span got now deprecated by #429.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions