aws-samples / aws-samples/amazon-textract-response-parser

No confindence levels in query output (with solution)

Open
#73 0 comments 0 reactions 0 assignees View on GitHub
enhancement python
Dominant language
TypeScript
Stars
236
Forks
97
PR merge metrics
No merged PRs in 30d

Description

I would like to know the confidence level of query results, however this is not made available.
I suggest to make a small change to get_query_answers in trp2.py:

```
def get_query_answers(self, page: TBlock) -> List[List[str]]:
result_list: List[List[str]] = list()
for query in self.queries(page=page):
answers = [x for x in self.get_answers_for_query(block=query)]
if answers:
for answer in answers:
result_list.append([query.query.text, query.query.alias, answer.text, answer.confidence])
else:
result_list.append([query.query.text, query.query.alias, "", 0])
```

This will make confidence available as fourth item in the return list and maintains compatibility with previous output.

Contributor guide

Open the contributing guide

Research direction

Start in trp2.py at get_query_answers and inspect how its returned lists are consumed. Done means each answer includes answer.confidence as the fourth item, while queries without answers include 0, preserving the stated output structure.

Written by the indexing model from the issue text.

Assessment

Tech stack
aws, python
Domain
backend-api-design
Issue type
Feature
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.