schema_struct_auto.h 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140
  1. #pragma once
  2. #include <string>
  3. #include <vector>
  4. namespace identify{
  5. namespace autoschema{
  6. //主观题类型
  7. enum ASCH_QUESTION_SCORE_TYPE{
  8. SINGLE_SCORE,
  9. MUTIL_SCORE
  10. };
  11. //客观题输出类型
  12. enum ASCH_OMR_OUT_TYPE{
  13. OMR_OUT_TYPE_SINGLE_NONSTRICT_ERROR,// 输出一个或*号,若解析中有0个、2个或2个以上涂点被填涂,输出*号
  14. OMR_OUT_TYPE_SINGLE_NONSTRICT,// 输出一个,若解析中有2个或2个以上涂点被填涂,则从中选出一个作为该组结果
  15. OMR_OUT_TYPE_SINGLE_STRICT,// 输出一个,若解析中有2个或2个以上涂点被填涂,则认为用户多选,输出多选字符
  16. OMR_OUT_TYPE_MUTIL_STRICT,//输出多选字符
  17. };
  18. struct ASCH_SCHEMA_RECT_FIELD{
  19. int centerx;
  20. int centery;
  21. int width;
  22. int height;
  23. };
  24. struct ASCH_KEGUANTI_QUESTION_LOCATEPOINT_INDEX{
  25. int indexs[4];
  26. int &operator[](int index){
  27. return indexs[index];
  28. }
  29. };
  30. struct ASCH_question_basic{
  31. std::string question_code;
  32. int question_index;
  33. };
  34. struct ASCH_SCHEMA_ELEMENT_FIELD :ASCH_SCHEMA_RECT_FIELD{
  35. int index;
  36. };
  37. struct ASCH_SchemaLocatePoint :ASCH_SCHEMA_ELEMENT_FIELD{//定位点
  38. };
  39. struct ASCH_SchemaLocateArea :ASCH_SCHEMA_ELEMENT_FIELD{//区域定位点
  40. };
  41. struct ASCH_SchemaLoacteCross :ASCH_SCHEMA_ELEMENT_FIELD{//交叉点定位
  42. };
  43. struct ASCH_SchemaCode :ASCH_SCHEMA_ELEMENT_FIELD{//条码、二维码
  44. };
  45. enum ASCH_DIRECTION{
  46. Horizontal,
  47. Vertical,
  48. DIR_UNKNOWN,
  49. };
  50. struct ASCH_SCHEMA_MATRIX :ASCH_SCHEMA_ELEMENT_FIELD{
  51. int nRows;
  52. int nCols;
  53. float optionWidth;
  54. float optionHeight;
  55. ASCH_DIRECTION direction;
  56. char outputchars[256];
  57. };
  58. typedef ASCH_SCHEMA_MATRIX ASCH_TIANTUKAOHAO;
  59. struct ASCH_SchemaItem :ASCH_SCHEMA_ELEMENT_FIELD{//填涂项
  60. //填涂项输出字符
  61. char OutChar;
  62. int keguanti_question_locate_point_index;
  63. };
  64. struct ASCH_SchemaGroup :ASCH_SCHEMA_ELEMENT_FIELD, ASCH_question_basic{//填涂组
  65. //本组涂点涂点数量
  66. int itemCount;
  67. //记录本组涂点位置索引
  68. std::vector<int> itemIndex;
  69. //OMR 输出类型
  70. ASCH_OMR_OUT_TYPE omr_out_type;
  71. };
  72. struct ASCH_SchemaCutArea :ASCH_SCHEMA_ELEMENT_FIELD{//切割区域
  73. //是否该题第一个区域
  74. bool isfirst;
  75. //裁切区域名称(当isfirst为真时有效)
  76. std::string area_name;
  77. //该区域对应的题目索引(当isfirst为真时有效)
  78. int question_index;
  79. };
  80. struct ASCH_SchemaQuestionScore :ASCH_SCHEMA_ELEMENT_FIELD, ASCH_question_basic{//题目分数
  81. ASCH_QUESTION_SCORE_TYPE type;
  82. struct Point{
  83. int x;
  84. int y;
  85. }lt, rt, lb, rb;
  86. //填涂框数量
  87. int count;
  88. int questionLocatePointIndex[2];
  89. int valid_option_count;
  90. };
  91. struct ASCH_SchemaPage{
  92. ASCH_SchemaPage(){
  93. group_spacer = ';';
  94. hei_du_ling_min_du = 4;
  95. height = 0;
  96. index = 0;
  97. option_spacer = ',';
  98. unselect_char = '*';
  99. user_float_heidu = 4;
  100. width = 0;
  101. worthwhileBlk = 4;
  102. }
  103. //从0开始的页面
  104. int index;
  105. int width;
  106. int height;
  107. std::string paper_id;
  108. std::string student_code;
  109. std::vector<ASCH_SchemaLocatePoint> locatePoints;
  110. std::vector<ASCH_SchemaLocatePoint> questionLocatePoints;
  111. //客观题题目定位点的索引
  112. std::vector<ASCH_KEGUANTI_QUESTION_LOCATEPOINT_INDEX> keguantiQuestionLocatePointIndexs;
  113. std::vector<ASCH_SchemaLoacteCross> locateCrosses;
  114. std::vector<ASCH_SchemaLocateArea> locateAreas;
  115. std::vector<ASCH_SchemaCode> codes;
  116. std::vector<ASCH_SchemaGroup> groups;
  117. std::vector<ASCH_SchemaItem> items;
  118. std::vector<ASCH_TIANTUKAOHAO> tiantukaohaos;
  119. std::vector<ASCH_SchemaCutArea> cutAreas;
  120. std::vector<ASCH_SchemaQuestionScore> question_score;
  121. //黑度整体浮动系数
  122. int user_float_heidu;
  123. //黑度选中灵敏度
  124. int worthwhileBlk;
  125. //多个选项之间的间隔字符
  126. char option_spacer;
  127. //选择题没有选择时的输出字符
  128. char unselect_char;
  129. //两组选择题之间的间隔字符
  130. char group_spacer;
  131. //
  132. int hei_du_ling_min_du;
  133. };
  134. typedef std::vector<ASCH_SchemaPage> ASCH_Schema;
  135. }
  136. }