aws-samples / aws-samples/amazon-textract-response-parser
Get confidence scores Data Frame
- Dominant language
- TypeScript
- Stars
- 236
- Forks
- 97
- PR merge metrics
- No merged PRs in 30d
Description
Hi all, I have just recently started to work with Textract and I think a simple feature could be added. This took me a while to figure out...
I was interested in getting the confidence scores directly in a Data Frame, so then I wrote the following script to get it:
``` python
def get_scores_table(document):
table = [["" for _ in range(document.column_count)] for _ in range(document.row_count)]
for cell in document.table_cells:
table[cell.row_index - 1][cell.col_index - 1] = " ".join([str(w.confidence) for w in cell.words])
return pd.DataFrame(table)
```
It is indeed a very simple script, but the documentation could have a function or an option to a function that extracts such scores. It took me a while to figure out even thought I believe this should be a main feature in the documentation given that corporations, when building projects using tools like Textract, will be concerned about the accuracy of results.
Yes it is accurate, but being able to easily display these confidences is a feature that more people might be seeking out there.
Contributor guide
Assessment
This issue has not been assessed yet.