How to Extract Confidence from this string

Hi Everyone ,
Below is the string from where we need to extract every Confidence value for doing average

“{"DocumentId":"BELL CITY OF NORTH BAY 272919106-190410 - Copy (2).pdf","ResultsVersion":0,"ResultsDocument":{"Bounds":{"StartPage":0,"PageCount":1,"TextStartIndex":0,"TextLength":2379},"Language":"eng","DocumentGroup":"","DocumentCategory":"","DocumentTypeId":"NoGroup.NoCategory.Invoices","DocumentTypeName":"Invoices","DocumentTypeDataVersion":0,"DataVersion":0,"DocumentTypeSource":"Automatic","DocumentTypeField":{"Components":,"Value":"Invoices","UnformattedValue":"","Reference":{"TextStartIndex":0,"TextLength":0,"Tokens":},"DerivedFields":,"Confidence":1.0,"OperatorConfirmed":false,"OcrConfidence":-1.0},"Fields":[{"FieldId":"NoGroup.NoCategory.Invoices.Name","FieldName":"Name","FieldType":"Text","IsMissing":false,"DataSource":"Automatic","Values":[{"Components":,"Value":"City North Bay","UnformattedValue":"City North Bay","Reference":{"TextStartIndex":50,"TextLength":17,"Tokens":[{"TextStartIndex":50,"TextLength":4,"Page":0,"PageWidth":612.0,"PageHeight":792.0,"Boxes":[[34.4,148.8,16.0,8.5333]]},{"TextStartIndex":58,"TextLength":5,"Page":0,"PageWidth":612.0,"PageHeight":792.0,"Boxes":[[34.4,176.0,21.6,7.2]]},{"TextStartIndex":64,"TextLength":3,"Page":0,"PageWidth":612.0,"PageHeight":792.0,"Boxes":[[34.6667,199.7333,14.9333,8.5333]]}]},"DerivedFields":,"Confidence":0.681967854,"OperatorConfirmed":false,"OcrConfidence":1.0}],"DataVersion":0,"OperatorConfirmed":false},{"FieldId":"NoGroup.NoCategory.Invoices.Vendor-address","FieldName":"Vendor-address","FieldType":"Text","IsMissing":false,"DataSource":"Automatic","Values":[{"Components":,"Value":"200 McIntyre St., East P.O. Box 360 North Bay, Ontario Canada P1B 8H8","UnformattedValue":"200 McIntyre St., East P.O. Box 360 North Bay, Ontario Canada P1B 8H8","Reference":{"TextStartIndex":69,"TextLength":105,"Tokens":[{"TextStartIndex":69,"TextLength":3,"Page":0,"PageWidth":612.0,"PageHeight":792.0,"Boxes":[[47.4667,148.8,12.2667,6.1333]]},{"TextStartIndex":73,"TextLength":8,"Page":0,"PageWidth":612.0,"PageHeight":792.0,"Boxes":[[47.2,162.4,27.4667,7.4667]]},{"TextStartIndex":82,"TextLength":4,"Page":0,"PageWidth":612.0,"PageHeight":792.0,"Boxes":[[47.4667,191.4667,10.6667,6.6667]]},{"TextStartIndex":87,"TextLength":4,"Page":0,"PageWidth":612.0,"PageHeight":792.0,"Boxes":[[47.2,203.7333,14.6667,6.4]]},{"TextStartIndex":102,"TextLength":4,"Page":0,"PageWidth":612.0,"PageHeight":792.0,"Boxes":[[54.9333,149.0667,13.3333,6.1333]]},{"TextStartIndex":107,"TextLength":3,"Page":0,"PageWidth":612.0,"PageHeight":792.0,"Boxes":[[55.2,164.0,12.5333,5.8667]]},{"TextStartIndex":111,"TextLength":3,"Page":0,"PageWidth":612.0,"PageHeight":792.0,"Boxes":[[54.9333,177.8667,12.2667,6.1333]]},{"TextStartIndex":115,"TextLength":5,"Page":0,"PageWidth":612.0,"PageHeight":792.0,"Boxes":[[62.9333,149.0667,17.3333,6.1333]]},{"TextStartIndex":121,"TextLength":4,"Page":0,"PageWidth":612.0,"PageHeight":792.0,"Boxes":[[62.9333,168.2667,13.0667,7.4667]]},{"TextStartIndex":126,"TextLength":7,"Page":0,"PageWidth":612.0,"PageHeight":792.0,"Boxes":[[62.6667,183.2,23.7333,6.4]]},{"TextStartIndex":160,"TextLength":6,"Page":0,"PageWidth":612.0,"PageHeight":792.0,"Boxes":[[70.4,149.0667,25.0667,6.4]]},{"TextStartIndex":167,"TextLength":3,"Page":0,"PageWidth":612.0,"PageHeight":792.0,"Boxes":[[70.4,177.3333,13.6,6.4]]},{"TextStartIndex":171,"TextLength":3,"Page":0,"PageWidth":612.0,"PageHeight":792.0,"Boxes":[[70.4,192.2667,13.6,6.4]]}]},"DerivedFields":,"Confidence":0.8681279,"OperatorConfirmed":false,"OcrConfidence":0.87}],"DataVersion":0,"OperatorConfirmed":false},{"FieldId":"NoGroup.NoCategory.Invoices.Billing-Name","FieldName":"Billing-Name","FieldType":"Text","IsMissing":false,"DataSource":"Automatic","Values":[{"Components":,"Value":"BELL CANADA","UnformattedValue":"BELL CANADA","Reference":{"TextStartIndex":422,"TextLength":11,"Tokens":[{"TextStartIndex":422,"TextLength":4,"Page":0,"PageWidth":612.0,"PageHeight":792.0,"Boxes":[[153.0667,63.4667,29.0667,12.0]]},{"TextStartIndex":427,"TextLength":6,"Page":0,"PageWidth":612.0,"PageHeight":792.0,"Boxes":[[153.0667,96.0,49.6,12.0]]}]},"DerivedFields":,"Confidence":0.95861274,"OperatorConfirmed":false,"OcrConfidence":1.0}],"DataVersion":0,"OperatorConfirmed":false},{"FieldId":"NoGroup.NoCategory.Invoices.Date","FieldName":"Date","FieldType":"Text","IsMissing":false,"DataSource":"Automatic","Values":[{"Components":,"Value":"2019-04-10","UnformattedValue":"4/10/19","Reference":{"TextStartIndex":290,"TextLength":7,"Tokens":[{"TextStartIndex":290,"TextLength":7,"Page":0,"PageWidth":612.0,"PageHeight":792.0,"Boxes":[[126.1333,108.8,33.3333,10.1333]]}]},"DerivedFields":,"Confidence":0.752421737,"OperatorConfirmed":false,"OcrConfidence":1.0}],"DataVersion":0,"OperatorConfirmed":false},{"FieldId":"NoGroup.NoCategory.Invoices.Total","FieldName":"Total","FieldType":"Text","IsMissing":false,"DataSource":"Automatic","Values":[{"Components":,"Value":"420.28","UnformattedValue":"420.28","Reference":{"TextStartIndex":646,"TextLength":6,"Tokens":[{"TextStartIndex":646,"TextLength":6,"Page":0,"PageWidth":612.0,"PageHeight":792.0,"Boxes":[[193.6,510.4,33.0667,9.0667]]}]},"DerivedFields":,"Confidence":0.9369031,"OperatorConfirmed":false,"OcrConfidence":1.0}],"DataVersion":0,"OperatorConfirmed":false},{"FieldId":"NoGroup.NoCategory.Invoices.Account","FieldName":"Account","FieldType":"Text","IsMissing":true,"DataSource":"Automatic","Values":,"DataVersion":0,"OperatorConfirmed":false},{"FieldId":"NoGroup.NoCategory.Invoices.Billing-address","FieldName":"Billing-address","FieldType":"Text","IsMissing":false,"DataSource":"Automatic","Values":[{"Components":,"Value":"PO BOX 3521 / ATTN FIN SVCS UT C/O BGIS 0&M SOLUTIONS INC MARKHAM ON L3R 0N4","UnformattedValue":"PO BOX 3521 / ATTN FIN SVCS UT C/O BGIS 0&M SOLUTIONS INC MARKHAM ON L3R 0N4","Reference":{"TextStartIndex":480,"TextLength":134,"Tokens":[{"TextStartIndex":480,"TextLength":2,"Page":0,"PageWidth":612.0,"PageHeight":792.0,"Boxes":[[166.4,63.4667,17.0667,12.0]]},{"TextStartIndex":483,"TextLength":3,"Page":0,"PageWidth":612.0,"PageHeight":792.0,"Boxes":[[166.4,84.0,25.0667,12.0]]},{"TextStartIndex":487,"TextLength":4,"Page":0,"PageWidth":612.0,"PageHeight":792.0,"Boxes":[[166.4,112.5333,26.9333,12.0]]},{"TextStartIndex":492,"TextLength":1,"Page":0,"PageWidth":612.0,"PageHeight":792.0,"Boxes":[[166.4,142.9333,3.2,12.0]]},{"TextStartIndex":494,"TextLength":4,"Page":0,"PageWidth":612.0,"PageHeight":792.0,"Boxes":[[166.4,149.6,31.4667,12.0]]},{"TextStartIndex":499,"TextLength":3,"Page":0,"PageWidth":612.0,"PageHeight":792.0,"Boxes":[[166.4,184.2667,19.4667,12.0]]},{"TextStartIndex":503,"TextLength":4,"Page":0,"PageWidth":612.0,"PageHeight":792.0,"Boxes":[[166.4,207.2,32.2667,12.0]]},{"TextStartIndex":508,"TextLength":2,"Page":0,"PageWidth":612.0,"PageHeight":792.0,"Boxes":[[166.4,242.9333,16.0,12.0]]},{"TextStartIndex":538,"TextLength":3,"Page":0,"PageWidth":612.0,"PageHeight":792.0,"Boxes":[[179.2,63.4667,21.3333,12.0]]},{"TextStartIndex":542,"TextLength":4,"Page":0,"PageWidth":612.0,"PageHeight":792.0,"Boxes":[[179.2,88.0,28.5333,12.0]]},{"TextStartIndex":547,"TextLength":3,"Page":0,"PageWidth":612.0,"PageHeight":792.0,"Boxes":[[179.2,120.0,24.8,12.0]]},{"TextStartIndex":551,"TextLength":9,"Page":0,"PageWidth":612.0,"PageHeight":792.0,"Boxes":[[179.2,148.0,69.3333,12.0]]},{"TextStartIndex":561,"TextLength":3,"Page":0,"PageWidth":612.0,"PageHeight":792.0,"Boxes":[[179.2,220.8,20.5333,12.0]]},{"TextStartIndex":596,"TextLength":7,"Page":0,"PageWidth":612.0,"PageHeight":792.0,"Boxes":[[192.5333,63.4667,61.0667,12.0]]},{"TextStartIndex":604,"TextLength":2,"Page":0,"PageWidth":612.0,"PageHeight":792.0,"Boxes":[[192.5333,128.0,17.8667,12.0]]},{"TextStartIndex":607,"TextLength":3,"Page":0,"PageWidth":612.0,"PageHeight":792.0,"Boxes":[[192.5333,149.3333,22.1333,12.0]]},{"TextStartIndex":611,"TextLength":3,"Page":0,"PageWidth":612.0,"PageHeight":792.0,"Boxes":[[192.5333,174.6667,22.1333,12.0]]}]},"DerivedFields":,"Confidence":0.5085025,"OperatorConfirmed":false,"OcrConfidence":1.0}],"DataVersion":0,"OperatorConfirmed":false}],"Tables":},"ExtractorPayloads":,"BusinessRulesResults":}”

Thanks and Regards

Hi,

How about the following using String manipulation?

Sample20230913-3L.zip (4.1 KB)

It may be better to use Json parse if it’s valid json.

Regards,

If it is the extraction results variable from DU, you can directly access confidences.
For each field in extractionResult.fields:
field.values(0).confidence will give you the confidence value. You can put a for each loop and add the confidences in that if thats the case.

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.