Get Confidence for a particular field - DU

Hi All,

Is it possible to get multiple confidences for a field mentioned in extracted results?
I am trying to extract “Confidence=0.5” and “OcrConfidence=0.541581869”

In general, I am getting confidence as “1” if using this expression - ExtractionResults.AsDataSet(True).Tables(“Simple Fields”)(0)(“Off Peak c/kWh” & " - Confidence").ToString

{
DataSource=Automatic,
DataVersion=0,
FieldId=“Utilities.Electricity.Rate.ShoulderUsage”,
FieldName=“Shoulder c/kWh”,
FieldType=Number,
IsMissing=true,
OperatorConfirmed=false,
Values=ResultsValue[0]
{

    }
  },
  ResultsDataPoint 
  {
    DataSource=Automatic,
    DataVersion=0,
    FieldId="Utilities.Electricity.Rate.OffPeakUsage",
    FieldName="Off Peak c/kWh",
    FieldType=Number,
    IsMissing=false,
    OperatorConfirmed=false,
    Values=ResultsValue[2] 
    {
      ResultsValue 
      {
        Components=ResultsDataPoint[0] 
        {
          
        },
        Confidence=1,
        DerivedFields=ResultsDerivedField[1] 
        {
          ResultsDerivedField 
          {
            FieldId="Value",
            Value="16.00" 
          }
        },
        OcrConfidence=0.913318455,
        OperatorConfirmed=false,
        Reference=ResultsContentReference 
        {
          TextLength=0,
          TextStartIndex=0,
          Tokens=ResultsValueTokens[1] 
          {
            ResultsValueTokens 
            {
              Boxes=Box[1] 
              {
                T:339.92,L:495.55,W:28.61,H:20.43 
              },
              Page=1,
              PageHeight=842,
              PageWidth=595,
              TextLength=0,
              TextStartIndex=0 
            }
          }
        },
        UnformattedValue="",
        Value="16.0" 
      },
      ResultsValue 
      {
        Components=ResultsDataPoint[0] 
        {
          
        },
        Confidence=0.5,
        DerivedFields=ResultsDerivedField[1] 
        {
          ResultsDerivedField 
          {
            FieldId="Value",
            Value="" 
          }
        },
        OcrConfidence=0.541581869,
        OperatorConfirmed=false,
        Reference=ResultsContentReference 
        {
          TextLength=0,
          TextStartIndex=0,
          Tokens=ResultsValueTokens[1] 
          {
            ResultsValueTokens 
            {
              Boxes=Box[1] 
              {
                T:344.325,L:46.785,W:20.28,H:8.84 
              },
              Page=1,
              PageHeight=842,
              PageWidth=595,
              TextLength=0,
              TextStartIndex=0 
            }
          }
        },
        UnformattedValue="",
        Value="All cor" 
      }
    }
  },

Please help @Lahiru.Fernando @mtu

HI @Mamidi_Sravani

Yes, it is possible to get multiple extraction confidence values for a selected fields from the ExtractionResults variable (if multiple confidence & values exist for a field).

I would recommend to navigate through the variable structure, and locate the field that repeats. Get that into another variable, and loop through it to get all the confidence levels and values captured for the field.

I did something similar on a video. But that doesn’t represent what you are trying to do here, but it gives an idea on how to navigate through the ExtractionResults data to identify what we need to get.

Check the “Building signature extraction flow” section of the video.

Let me know if this helps, or if you are confused… I can help.

Thanks
Lahiru

1 Like

Thank you for your quick reply @Lahiru.Fernando

I can able to extract what I require

Results = ExtractionResults.ResultsDocument.Fields.Where(Function (f) f.FieldID=“Utilities.Electricity.Rate.OffPeakUsage”).First - Variable type as ‘UiPath.DocumentProcessing.Contracts.Results.ResultsDataPoint’

Then with reference to the above Confidence = Results.Values(1).Confidence

But I can’t able to find the Variable Type for Confidence. It says Value of Type ‘Single’

Hi @Mamidi_Sravani

Yes, it is possible to get the multiple extraction confidence score values for the each and every field which you create the Fieldnames in the taxonomy or alternatively, for a selected set of fields using the ExtractionResult variable.
Steps:
1.use the assign activity and create a variable and that should be in system.data.datatable.
2.value = "YourVaraible ".AsDataset(True,True).Tables(0).DefaultView.ToTable

For the reference please check the below screen shot

Hope It Helpful
Thanks!