←Select platform

QuestionsAnswers Property

Summary

A Dictionary<string, QuestionAnswers> that associates fields with their answers.

Syntax
C#
VB
C++
Java
public Dictionary<string, QuestionAnswers> QuestionsAnswers { get; set; } 
public String getQuestionsAnswers(); 
public void setQuestionsAnswers( 
   java.util.Map<java.lang.String string  
   QuestionAnswers> questionAnswers 
); 
Public Property QuestionsAnswers() As Dictionary(Of String, QuestionAnswers) 
   Get 
   Set 
public:  
   property Dictionary<String^, QuestionAnswers^>^ QuestionsAnswers 
   { 
      Dictionary<String^, QuestionAnswers^>^ get() 
      void set(Dictionary<String^, QuestionAnswers^>^ value) 
   } 

Property Value

Dictionary<string, QuestionAnswers> object

Remarks

The key in this dictionary is a string that identifies a field. This string should be unique and mapped to a field. To generate a unique string the formatted string contains the page number, the field name and the OmrCollection name, where PageNumber specifies the form page where the OMR field exists. OmrFieldName is the name for the OMR field. OmrCollectionName is the name of the OMR collection of interest inside the OMR field.

Example
C#
using Leadtools; 
using Leadtools.Barcode; 
using Leadtools.Codecs; 
using Leadtools.Forms.Processing.Omr; 
using Leadtools.Ocr; 
 
private static void GenerateStatistics(List<IRecognitionForm> recognitionForms, IRecognitionForm answers) 
{ 
   OmrAnalysisEngine omrAnalysisEngine = new OmrAnalysisEngine(recognitionForms, answers); 
 
   omrAnalysisEngine.GradeForms(); 
 
   // Table generation helpers 
   const string columnSeparator = "  "; 
   List<List<string>> lines = new List<List<string>>(); 
   List<int> widths = new List<int>(); 
   void AddLine(List<string> line) 
   { 
      while (widths.Count < line.Count) 
         widths.Add(0); 
      for (int i = 0; i < line.Count; i++) 
         widths[i] = Math.Max(widths[i], line[i].Length); 
      lines.Add(line); 
   } 
 
   // Generate the table 
   foreach (KeyValuePair<string, QuestionAnswers> kvp in omrAnalysisEngine.QuestionsAnswers) 
   { 
      List<string> line = new List<string>() { kvp.Key, kvp.Value.Answer }; 
      foreach (KeyValuePair<string, int> stat in kvp.Value.AnswersCount) 
         line.Add($"{stat.Key}: {stat.Value}"); 
      AddLine(line); 
   } 
 
   // Display the header 
   if (widths.Count < 2) 
      Console.WriteLine($"Field{columnSeparator}Answer{columnSeparator}Breakdown"); 
   else 
   { 
      widths[0] = Math.Max(widths[0], "Field".Length); 
      widths[1] = Math.Max(widths[1], "Answer".Length); 
      Console.WriteLine($"{"Field".PadRight(widths[0])}{columnSeparator}{"Answer".PadRight(widths[1])}{columnSeparator}Breakdown"); 
   } 
 
   // Display the results 
   foreach (List<string> line in lines) 
   { 
      for (int i = 0; i < line.Count; i++) 
      { 
         if (i > 0) 
            Console.Write(columnSeparator); 
         Console.Write($"{line[i].PadRight(widths[i])}"); 
      } 
      Console.WriteLine(); 
   } 
} 

Requirements

Target Platforms

Help Version 20.0.2020.3.31
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2020 LEAD Technologies, Inc. All Rights Reserved.

Leadtools.Forms.Processing.Omr Assembly