amazon-textract-response-parser
amazon-textract-response-parser copied to clipboard
No confindence levels in query output (with solution)
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.