Skip to content

empty targets list #2

Closed
Closed
@keighrim

Description

@keighrim

Bug Description

Originally reported by @wricketts


For some Sentence objects, we see targets are empty lists. While investigating the app code, I realized this is the only spot where the sentences' targets prop is written;

app-doctr-wrapper/app.py

Lines 134 to 141 in 780430f

for word in line.words:
if word.confidence > 0.4:
start = text_document.text_value.find(word.value)
end = start + len(word.value)
token = self.Token(view.new_annotation(at_type=Uri.TOKEN), text_document, start, end)
token_bb = create_bbox(view, word.geometry, "text", representative.id)
create_alignment(view, token.region.id, token_bb.id)
sentence.add_token(token)

So an empty targets list seems to mean the OCR result showed no words in that line...? In that case , I think this wrapper app should ignore such lines instead of generating empty sentences.

Reproduction steps

(screenshot from @wricketts 's report)

screenshot_2024-03-30_at_9 07 54___pm

Expected behavior

No response

Log output

No response

Screenshots

No response

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    🐛BSomething isn't working

    Type

    No type

    Projects

    Status

    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions