python-documentai-toolbox icon indicating copy to clipboard operation
python-documentai-toolbox copied to clipboard

Expose Confidence and Language Detected in Wrapper Document

Open sarath-mec opened this issue 10 months ago • 2 comments

Thanks for stopping by to let us know something could be better!

PLEASE READ: If you have a support contract with Google, please create an issue in the support console instead of filing on GitHub. This will ensure a timely response.

Is your feature request related to a problem? Please describe. In the Wrapper Document, is there a way to retrieve the

  • confidence at Token Level
  • detectedLanguages and their confidence

Describe the solution you'd like Expose Confidence and Language from Token

Describe alternatives you've considered

Additional context

sarath-mec avatar Feb 01 '25 15:02 sarath-mec

Hi, you can access this data from any class that inherits from _BasePageElement by doing the following:

token = Token(...) # Example Token
print(token.documentai_object.layout.confidence)
print(token.documentai_object.detected_languages)

This should also apply for any element within Page

holtskinner avatar Apr 29 '25 15:04 holtskinner

Thank you

sarath-mec avatar Apr 29 '25 17:04 sarath-mec