Переглянути джерело

保存入库时调大svg2png的分辨率并对分式的latex调大尺寸

莺声燕语 2 роки тому
батько
коміт
97ec7f9dfa
7 змінених файлів з 277 додано та 231 видалено
  1. 168 174
      .idea/workspace.xml
  2. 3 0
      configs.py
  3. 1 1
      server.py
  4. 20 15
      utils/field_eq2latex.py
  5. 2 2
      utils/image_convert.py
  6. 79 39
      utils/ruku_opera.py
  7. 4 0
      utils/washutil.py

+ 168 - 174
.idea/workspace.xml

@@ -2,11 +2,13 @@
 <project version="4">
   <component name="ChangeListManager">
     <list default="true" id="264b59ce-0122-420f-a5d3-3ffa8b015ccb" name="Default Changelist" comment="">
-      <change beforePath="$PROJECT_DIR$/ceshi.py" beforeDir="false" afterPath="$PROJECT_DIR$/ceshi.py" afterDir="false" />
-      <change beforePath="$PROJECT_DIR$/structure/danti_structure.py" beforeDir="false" afterPath="$PROJECT_DIR$/structure/danti_structure.py" afterDir="false" />
-      <change beforePath="$PROJECT_DIR$/structure/structure_main.py" beforeDir="false" afterPath="$PROJECT_DIR$/structure/structure_main.py" afterDir="false" />
-      <change beforePath="$PROJECT_DIR$/utils/html_again_parse.py" beforeDir="false" afterPath="$PROJECT_DIR$/utils/html_again_parse.py" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/configs.py" beforeDir="false" afterPath="$PROJECT_DIR$/configs.py" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/server.py" beforeDir="false" afterPath="$PROJECT_DIR$/server.py" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/utils/field_eq2latex.py" beforeDir="false" afterPath="$PROJECT_DIR$/utils/field_eq2latex.py" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/utils/image_convert.py" beforeDir="false" afterPath="$PROJECT_DIR$/utils/image_convert.py" afterDir="false" />
       <change beforePath="$PROJECT_DIR$/utils/ruku_opera.py" beforeDir="false" afterPath="$PROJECT_DIR$/utils/ruku_opera.py" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/utils/washutil.py" beforeDir="false" afterPath="$PROJECT_DIR$/utils/washutil.py" afterDir="false" />
     </list>
     <option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" />
     <option name="SHOW_DIALOG" value="false" />
@@ -32,102 +34,85 @@
   </component>
   <component name="FileEditorManager">
     <leaf SIDE_TABS_SIZE_LIMIT_KEY="300">
-      <file pinned="false" current-in-tab="false">
-        <entry file="file://$PROJECT_DIR$/structure/structure_main.py">
+      <file pinned="false" current-in-tab="true">
+        <entry file="file://$PROJECT_DIR$/utils/ruku_opera.py">
           <provider selected="true" editor-type-id="text-editor">
-            <state relative-caret-position="119">
-              <caret line="218" selection-start-line="218" selection-end-line="218" />
+            <state relative-caret-position="251">
+              <caret line="195" column="52" lean-forward="true" selection-start-line="195" selection-start-column="52" selection-end-line="195" selection-end-column="52" />
               <folding>
-                <element signature="e#47#72#0" expanded="true" />
-                <element signature="e#4704#4745#0" />
-                <element signature="e#6213#6246#0" />
+                <element signature="e#24#46#0" expanded="true" />
+                <element signature="e#19847#19883#0" />
+                <element signature="e#22125#22147#0" />
               </folding>
             </state>
           </provider>
         </entry>
       </file>
       <file pinned="false" current-in-tab="false">
-        <entry file="file://$PROJECT_DIR$/utils/html_again_parse.py">
+        <entry file="file://$PROJECT_DIR$/utils/image_convert.py">
           <provider selected="true" editor-type-id="text-editor">
-            <state relative-caret-position="204">
-              <caret line="160" lean-forward="true" selection-start-line="160" selection-end-line="160" />
+            <state relative-caret-position="145">
+              <caret line="18" column="4" selection-start-line="18" selection-start-column="4" selection-end-line="18" selection-end-column="4" />
               <folding>
-                <element signature="e#24#33#0" expanded="true" />
+                <element signature="e#0#36#0" expanded="true" />
               </folding>
             </state>
           </provider>
         </entry>
       </file>
       <file pinned="false" current-in-tab="false">
-        <entry file="file://$PROJECT_DIR$/structure/dati2slave.py">
+        <entry file="file://$PROJECT_DIR$/utils/diffi_label.py">
           <provider selected="true" editor-type-id="text-editor">
-            <state relative-caret-position="303">
-              <caret line="172" column="38" lean-forward="true" selection-start-line="172" selection-start-column="38" selection-end-line="172" selection-end-column="38" />
+            <state relative-caret-position="204">
+              <caret line="9" column="4" selection-start-line="9" selection-start-column="4" selection-end-line="9" selection-end-column="4" />
               <folding>
-                <element signature="e#46#55#0" expanded="true" />
-                <element signature="e#5987#6021#0" />
+                <element signature="e#0#11#0" expanded="true" />
               </folding>
             </state>
           </provider>
         </entry>
       </file>
       <file pinned="false" current-in-tab="false">
-        <entry file="file://$PROJECT_DIR$/structure/final_structure.py">
-          <provider selected="true" editor-type-id="text-editor">
-            <state relative-caret-position="99">
-              <caret line="85" selection-start-line="85" selection-end-line="85" />
-              <folding>
-                <element signature="e#11#20#0" expanded="true" />
-              </folding>
-            </state>
-          </provider>
-        </entry>
-      </file>
-      <file pinned="false" current-in-tab="true">
-        <entry file="file://$PROJECT_DIR$/utils/ruku_opera.py">
+        <entry file="file://$PROJECT_DIR$/ceshi.py">
           <provider selected="true" editor-type-id="text-editor">
-            <state relative-caret-position="138">
-              <caret line="506" column="26" selection-start-line="506" selection-start-column="22" selection-end-line="506" selection-end-column="26" />
+            <state relative-caret-position="7820">
+              <caret line="234" selection-start-line="234" selection-end-line="234" />
               <folding>
-                <element signature="e#24#46#0" expanded="true" />
+                <element signature="e#47#96#0" expanded="true" />
               </folding>
             </state>
           </provider>
         </entry>
       </file>
       <file pinned="false" current-in-tab="false">
-        <entry file="file://$PROJECT_DIR$/utils/ruku_test.py">
+        <entry file="file://$PROJECT_DIR$/utils/washutil.py">
           <provider selected="true" editor-type-id="text-editor">
-            <state relative-caret-position="616">
-              <caret line="859" column="41" lean-forward="true" selection-start-line="859" selection-start-column="41" selection-end-line="859" selection-end-column="41" />
+            <state relative-caret-position="72">
+              <caret line="18" column="38" lean-forward="true" selection-start-line="18" selection-start-column="38" selection-end-line="18" selection-end-column="38" />
               <folding>
-                <element signature="e#24#46#0" expanded="true" />
-                <element signature="e#1334#4074#0" />
-                <element signature="e#2169#2246#0" />
+                <element signature="e#689#1758#0" />
+                <element signature="e#1800#4219#0" />
               </folding>
             </state>
           </provider>
         </entry>
       </file>
       <file pinned="false" current-in-tab="false">
-        <entry file="file://$PROJECT_DIR$/ceshi.py">
+        <entry file="file://$PROJECT_DIR$/utils/field_eq2latex.py">
           <provider selected="true" editor-type-id="text-editor">
-            <state relative-caret-position="203">
-              <caret line="233" column="32" lean-forward="true" selection-start-line="233" selection-start-column="32" selection-end-line="233" selection-end-column="32" />
-              <folding>
-                <element signature="e#47#96#0" expanded="true" />
-              </folding>
+            <state relative-caret-position="69">
+              <caret line="294" column="23" lean-forward="true" selection-start-line="294" selection-start-column="23" selection-end-line="294" selection-end-column="23" />
             </state>
           </provider>
         </entry>
       </file>
       <file pinned="false" current-in-tab="false">
-        <entry file="file://$PROJECT_DIR$/utils/washutil.py">
+        <entry file="file://$PROJECT_DIR$/configs.py">
           <provider selected="true" editor-type-id="text-editor">
-            <state relative-caret-position="120">
-              <caret line="346" column="25" lean-forward="true" selection-start-line="346" selection-start-column="25" selection-end-line="346" selection-end-column="25" />
+            <state relative-caret-position="3672">
+              <caret line="112" column="4" selection-start-line="112" selection-start-column="4" selection-end-line="112" selection-end-column="4" />
               <folding>
-                <element signature="e#138#153#0" expanded="true" />
+                <element signature="e#46#60#0" expanded="true" />
               </folding>
             </state>
           </provider>
@@ -136,8 +121,8 @@
       <file pinned="false" current-in-tab="false">
         <entry file="file://$PROJECT_DIR$/server.py">
           <provider selected="true" editor-type-id="text-editor">
-            <state relative-caret-position="-345">
-              <caret line="72" column="36" lean-forward="true" selection-start-line="72" selection-start-column="36" selection-end-line="72" selection-end-column="36" />
+            <state relative-caret-position="287">
+              <caret line="210" column="45" lean-forward="true" selection-start-line="210" selection-start-column="45" selection-end-line="210" selection-end-column="66" />
               <folding>
                 <element signature="e#105#118#0" expanded="true" />
               </folding>
@@ -148,8 +133,8 @@
       <file pinned="false" current-in-tab="false">
         <entry file="file://$PROJECT_DIR$/structure/danti_structure.py">
           <provider selected="true" editor-type-id="text-editor">
-            <state relative-caret-position="34">
-              <caret line="31" column="20" lean-forward="true" selection-start-line="31" selection-start-column="20" selection-end-line="31" selection-end-column="20" />
+            <state relative-caret-position="2992">
+              <caret line="95" column="16" selection-start-line="95" selection-start-column="16" selection-end-line="95" selection-end-column="16" />
               <folding>
                 <element signature="e#64#73#0" expanded="true" />
               </folding>
@@ -168,36 +153,36 @@
   </component>
   <component name="FindInProjectRecents">
     <findStrings>
-      <find>is_danti</find>
-      <find>选项格式不正确</find>
-      <find>susp_pic</find>
-      <find>查重结果</find>
-      <find>cha</find>
-      <find>ans_s_index</find>
-      <find>uf</find>
-      <find>保存</find>
-      <find>sub1</find>
-      <find>html</find>
-      <find>正确操作</find>
-      <find>6666</find>
-      <find>666</find>
-      <find>is_slave</find>
-      <find>999</find>
       <find>table</find>
       <find>见解析</find>
       <find>br</find>
       <find>入库失败</find>
       <find>answer_type</find>
-      <find>slave2regroup</find>
       <find>subject</find>
       <find>判断题</find>
       <find>12</find>
       <find>正确</find>
-      <find>repeat_check</find>
-      <find>print</find>
       <find>data</find>
       <find>9f</find>
       <find>post</find>
+      <find>ut</find>
+      <find>fe</find>
+      <find>[\</find>
+      <find>slave2regroup</find>
+      <find>2222222222222222</find>
+      <find>get_diff</find>
+      <find>33333333333</find>
+      <find>自动</find>
+      <find>kps_auto</find>
+      <find>kps_label_time</find>
+      <find>repeat_check</find>
+      <find>callback_user</find>
+      <find>print</find>
+      <find>auto_mark_result</find>
+      <find>get_kps_auto</find>
+      <find>svg2png</find>
+      <find>urllib</find>
+      <find>&lt;img src</find>
     </findStrings>
     <replaceStrings>
       <replace>cur_type</replace>
@@ -252,14 +237,12 @@
         <option value="$PROJECT_DIR$/utils/topic_no.py" />
         <option value="$PROJECT_DIR$/ruku_test.py" />
         <option value="$PROJECT_DIR$/app_test.py" />
-        <option value="$PROJECT_DIR$/utils/image_convert.py" />
         <option value="$PROJECT_DIR$/utils/equation_extract.py" />
         <option value="$PROJECT_DIR$/test.py" />
         <option value="$PROJECT_DIR$/utils/xuanzuoti2slave.py" />
         <option value="$PROJECT_DIR$/utils/qcloud_bucket.py" />
         <option value="$PROJECT_DIR$/utils/ruku2.py" />
         <option value="$PROJECT_DIR$/utils/stem_ans_split.py" />
-        <option value="$PROJECT_DIR$/utils/field_eq2latex.py" />
         <option value="$PROJECT_DIR$/svg_data1.pickle" />
         <option value="$PROJECT_DIR$/struct_items1.pickle" />
         <option value="$PROJECT_DIR$/utils/ruku_opera2.py" />
@@ -268,18 +251,20 @@
         <option value="$PROJECT_DIR$/structure/final_structure.py" />
         <option value="$PROJECT_DIR$/structure/three_parse_structure.py" />
         <option value="$PROJECT_DIR$/utils/pic_pos_judge.py" />
-        <option value="$PROJECT_DIR$/server.py" />
-        <option value="$PROJECT_DIR$/utils/washutil.py" />
         <option value="$PROJECT_DIR$/structure/ans_structure.py" />
         <option value="$PROJECT_DIR$/utils/item_type_line.py" />
         <option value="$PROJECT_DIR$/structure/option.py" />
-        <option value="$PROJECT_DIR$/configs.py" />
         <option value="$PROJECT_DIR$/structure/dati2slave.py" />
         <option value="$PROJECT_DIR$/structure/danti_structure.py" />
         <option value="$PROJECT_DIR$/structure/structure_main.py" />
         <option value="$PROJECT_DIR$/utils/html_again_parse.py" />
+        <option value="$PROJECT_DIR$/utils/washutil.py" />
+        <option value="$PROJECT_DIR$/configs.py" />
+        <option value="$PROJECT_DIR$/utils/field_eq2latex.py" />
+        <option value="$PROJECT_DIR$/server.py" />
         <option value="$PROJECT_DIR$/ceshi.py" />
         <option value="$PROJECT_DIR$/utils/ruku_opera.py" />
+        <option value="$PROJECT_DIR$/utils/image_convert.py" />
       </list>
     </option>
   </component>
@@ -334,7 +319,7 @@
     <property name="SHARE_PROJECT_CONFIGURATION_FILES" value="true" />
     <property name="WebServerToolWindowFactoryState" value="false" />
     <property name="ignore_missing_gitignore" value="true" />
-    <property name="last_opened_file_path" value="$PROJECT_DIR$/../new_tiku_structure_v3_art" />
+    <property name="last_opened_file_path" value="$PROJECT_DIR$/../../parse_online58" />
     <property name="nodejs_interpreter_path.stuck_in_default_project" value="undefined stuck path" />
     <property name="nodejs_npm_path_reset_for_default_project" value="true" />
     <property name="settings.editor.selected.configurable" value="com.jetbrains.python.configuration.PyActiveSdkModuleConfigurable" />
@@ -361,7 +346,7 @@
       </list>
     </option>
   </component>
-  <component name="RunManager" selected="Python.ceshi">
+  <component name="RunManager" selected="Python.image_convert">
     <configuration name="ceshi" type="PythonConfigurationType" factoryName="Python" temporary="true">
       <module name="parse_online58" />
       <option name="INTERPRETER_OPTIONS" value="" />
@@ -383,7 +368,7 @@
       <option name="INPUT_FILE" value="" />
       <method v="2" />
     </configuration>
-    <configuration name="danti_structure" type="PythonConfigurationType" factoryName="Python" temporary="true">
+    <configuration name="field_eq2latex" type="PythonConfigurationType" factoryName="Python" temporary="true">
       <module name="parse_online58" />
       <option name="INTERPRETER_OPTIONS" value="" />
       <option name="PARENT_ENVS" value="true" />
@@ -391,11 +376,11 @@
         <env name="PYTHONUNBUFFERED" value="1" />
       </envs>
       <option name="SDK_HOME" value="" />
-      <option name="WORKING_DIRECTORY" value="$PROJECT_DIR$/structure" />
+      <option name="WORKING_DIRECTORY" value="$PROJECT_DIR$/utils" />
       <option name="IS_MODULE_SDK" value="true" />
       <option name="ADD_CONTENT_ROOTS" value="true" />
       <option name="ADD_SOURCE_ROOTS" value="true" />
-      <option name="SCRIPT_NAME" value="$PROJECT_DIR$/structure/danti_structure.py" />
+      <option name="SCRIPT_NAME" value="$PROJECT_DIR$/utils/field_eq2latex.py" />
       <option name="PARAMETERS" value="" />
       <option name="SHOW_COMMAND_LINE" value="false" />
       <option name="EMULATE_TERMINAL" value="false" />
@@ -404,7 +389,7 @@
       <option name="INPUT_FILE" value="" />
       <method v="2" />
     </configuration>
-    <configuration name="html_again_parse" type="PythonConfigurationType" factoryName="Python" temporary="true">
+    <configuration name="image_convert" type="PythonConfigurationType" factoryName="Python" temporary="true">
       <module name="parse_online58" />
       <option name="INTERPRETER_OPTIONS" value="" />
       <option name="PARENT_ENVS" value="true" />
@@ -416,7 +401,7 @@
       <option name="IS_MODULE_SDK" value="true" />
       <option name="ADD_CONTENT_ROOTS" value="true" />
       <option name="ADD_SOURCE_ROOTS" value="true" />
-      <option name="SCRIPT_NAME" value="$PROJECT_DIR$/utils/html_again_parse.py" />
+      <option name="SCRIPT_NAME" value="$PROJECT_DIR$/utils/image_convert.py" />
       <option name="PARAMETERS" value="" />
       <option name="SHOW_COMMAND_LINE" value="false" />
       <option name="EMULATE_TERMINAL" value="false" />
@@ -483,19 +468,19 @@
       <method v="2" />
     </configuration>
     <list>
-      <item itemvalue="Python.ceshi" />
-      <item itemvalue="Python.danti_structure" />
-      <item itemvalue="Python.html_again_parse" />
       <item itemvalue="Python.server" />
       <item itemvalue="Python.structure_main" />
+      <item itemvalue="Python.ceshi" />
+      <item itemvalue="Python.field_eq2latex" />
+      <item itemvalue="Python.image_convert" />
     </list>
     <recent_temporary>
       <list>
         <item itemvalue="Python.server" />
+        <item itemvalue="Python.image_convert" />
         <item itemvalue="Python.ceshi" />
+        <item itemvalue="Python.field_eq2latex" />
         <item itemvalue="Python.structure_main" />
-        <item itemvalue="Python.danti_structure" />
-        <item itemvalue="Python.html_again_parse" />
       </list>
     </recent_temporary>
   </component>
@@ -783,7 +768,14 @@
       <option name="project" value="LOCAL" />
       <updated>1659608749818</updated>
     </task>
-    <option name="localTasksCounter" value="40" />
+    <task id="LOCAL-00040" summary="保存入库回调带上请求头">
+      <created>1662636471871</created>
+      <option name="number" value="00040" />
+      <option name="presentableId" value="LOCAL-00040" />
+      <option name="project" value="LOCAL" />
+      <updated>1662636471871</updated>
+    </task>
+    <option name="localTasksCounter" value="41" />
     <servers />
   </component>
   <component name="TodoView">
@@ -804,7 +796,7 @@
       <window_info id="Favorites" order="2" sideWeight="0.50144094" side_tool="true" weight="0.15773447" />
       <window_info anchor="bottom" id="Message" order="0" />
       <window_info anchor="bottom" id="Find" order="1" />
-      <window_info active="true" anchor="bottom" id="Run" order="2" sideWeight="0.499391" visible="true" weight="0.30418718" />
+      <window_info active="true" anchor="bottom" id="Run" order="2" sideWeight="0.499391" visible="true" weight="0.35714287" />
       <window_info anchor="bottom" id="Terminal" order="3" weight="0.13423645" />
       <window_info anchor="bottom" id="Debug" order="4" sideWeight="0.499391" weight="0.34852216" />
       <window_info anchor="bottom" id="Cvs" order="5" weight="0.25" />
@@ -822,14 +814,14 @@
       <window_info anchor="right" id="Database" order="4" />
     </layout>
     <layout-to-restore>
-      <window_info content_ui="combo" id="Project" order="0" sideWeight="0.4985591" visible="true" weight="0.1992561" />
+      <window_info content_ui="combo" id="Project" order="0" sideWeight="0.4985591" visible="true" weight="0.21360256" />
       <window_info id="Structure" order="1" sideWeight="0.50144094" side_tool="true" weight="0.15773447" />
       <window_info id="Favorites" order="2" sideWeight="0.50144094" side_tool="true" weight="0.15773447" />
       <window_info anchor="bottom" id="Message" order="0" />
       <window_info anchor="bottom" id="Find" order="1" />
-      <window_info active="true" anchor="bottom" id="Run" order="2" sideWeight="0.499391" visible="true" weight="0.36699507" />
+      <window_info active="true" anchor="bottom" id="Run" order="2" sideWeight="0.499391" visible="true" weight="0.432266" />
       <window_info anchor="bottom" id="Terminal" order="3" weight="0.13423645" />
-      <window_info anchor="bottom" id="Debug" order="4" sideWeight="0.499391" weight="0.32142857" />
+      <window_info anchor="bottom" id="Debug" order="4" sideWeight="0.499391" weight="0.34852216" />
       <window_info anchor="bottom" id="Cvs" order="5" weight="0.25" />
       <window_info anchor="bottom" id="Inspection" order="6" weight="0.4" />
       <window_info anchor="bottom" id="TODO" order="7" weight="0.32881773" />
@@ -849,7 +841,6 @@
     <option name="version" value="1" />
   </component>
   <component name="VcsManagerConfiguration">
-    <MESSAGE value="单题解析中对&amp;nbsp;清洗" />
     <MESSAGE value="css清洗中保留下划线特征、日志格式更新" />
     <MESSAGE value="htmlwash中保留“&lt;td rowspan”标签" />
     <MESSAGE value="导致渲染问题的公式规范化处理及&amp;amp;符号处理" />
@@ -874,19 +865,20 @@
     <MESSAGE value="取消从解析中自动提取答案" />
     <MESSAGE value="option_label_correct中修改con_list2的bug" />
     <MESSAGE value="判断题更新" />
-    <option name="LAST_COMMIT_MESSAGE" value="判断题更新" />
+    <MESSAGE value="保存入库回调带上请求头" />
+    <option name="LAST_COMMIT_MESSAGE" value="保存入库回调带上请求头" />
   </component>
   <component name="XDebuggerManager">
     <breakpoint-manager>
       <breakpoints>
         <line-breakpoint suspend="THREAD" type="python-line">
           <url>file://$PROJECT_DIR$/utils/field_eq2latex.py</url>
-          <line>360</line>
+          <line>365</line>
           <option name="timeStamp" value="118" />
         </line-breakpoint>
         <line-breakpoint suspend="THREAD" type="python-line">
           <url>file://$PROJECT_DIR$/utils/ruku_opera.py</url>
-          <line>852</line>
+          <line>892</line>
           <option name="timeStamp" value="131" />
         </line-breakpoint>
         <line-breakpoint suspend="THREAD" type="python-line">
@@ -956,7 +948,7 @@
         </line-breakpoint>
         <line-breakpoint enabled="true" suspend="THREAD" type="python-line">
           <url>file://$PROJECT_DIR$/utils/ruku_opera.py</url>
-          <line>862</line>
+          <line>902</line>
           <option name="timeStamp" value="197" />
         </line-breakpoint>
         <line-breakpoint enabled="true" suspend="THREAD" type="python-line">
@@ -1027,13 +1019,6 @@
     </expressions>
   </component>
   <component name="editorHistoryManager">
-    <entry file="file://C:/Anaconda3/Lib/site-packages/flask/app.py">
-      <provider selected="true" editor-type-id="text-editor">
-        <state relative-caret-position="418">
-          <caret line="2097" selection-start-line="2097" selection-end-line="2097" />
-        </state>
-      </provider>
-    </entry>
     <entry file="file://$PROJECT_DIR$/res_folder/2021_04_02_16_05_45.html">
       <provider selected="true" editor-type-id="text-editor">
         <state relative-caret-position="-2040" />
@@ -1068,16 +1053,6 @@
       </provider>
     </entry>
     <entry file="file://$PROJECT_DIR$/struct_items2.pickle" />
-    <entry file="file://$PROJECT_DIR$/utils/image_convert.py">
-      <provider selected="true" editor-type-id="text-editor">
-        <state relative-caret-position="204">
-          <caret line="28" column="15" selection-start-line="28" selection-start-column="15" selection-end-line="28" selection-end-column="15" />
-          <folding>
-            <element signature="e#0#36#0" expanded="true" />
-          </folding>
-        </state>
-      </provider>
-    </entry>
     <entry file="file://$USER_HOME$/.PyCharmCE2019.1/system/python_stubs/1013586911/builtins.py">
       <provider selected="true" editor-type-id="text-editor">
         <state relative-caret-position="68">
@@ -1205,13 +1180,6 @@
         </state>
       </provider>
     </entry>
-    <entry file="file://$PROJECT_DIR$/utils/field_eq2latex.py">
-      <provider selected="true" editor-type-id="text-editor">
-        <state relative-caret-position="1721">
-          <caret line="219" column="4" selection-start-line="219" selection-start-column="4" selection-end-line="219" selection-end-column="4" />
-        </state>
-      </provider>
-    </entry>
     <entry file="file://C:/Anaconda3/Lib/bisect.py">
       <provider selected="true" editor-type-id="text-editor">
         <state relative-caret-position="156">
@@ -1240,16 +1208,6 @@
         </state>
       </provider>
     </entry>
-    <entry file="file://$PROJECT_DIR$/utils/diffi_label.py">
-      <provider selected="true" editor-type-id="text-editor">
-        <state relative-caret-position="510">
-          <caret line="18" column="37" selection-start-line="18" selection-start-column="37" selection-end-line="18" selection-end-column="37" />
-          <folding>
-            <element signature="e#0#11#0" expanded="true" />
-          </folding>
-        </state>
-      </provider>
-    </entry>
     <entry file="file://$PROJECT_DIR$/test.py">
       <provider selected="true" editor-type-id="text-editor">
         <state relative-caret-position="890">
@@ -1333,22 +1291,33 @@
         </state>
       </provider>
     </entry>
-    <entry file="file://$PROJECT_DIR$/configs.py">
+    <entry file="file://$PROJECT_DIR$/utils/html_again_parse.py">
       <provider selected="true" editor-type-id="text-editor">
-        <state relative-caret-position="55">
-          <caret line="113" lean-forward="true" selection-start-line="113" selection-end-line="113" />
+        <state relative-caret-position="5338">
+          <caret line="160" selection-start-line="160" selection-end-line="160" />
           <folding>
-            <element signature="e#46#60#0" expanded="true" />
+            <element signature="e#24#33#0" expanded="true" />
+          </folding>
+        </state>
+      </provider>
+    </entry>
+    <entry file="file://$PROJECT_DIR$/structure/structure_main.py">
+      <provider selected="true" editor-type-id="text-editor">
+        <state relative-caret-position="4114">
+          <caret line="142" column="28" selection-start-line="142" selection-start-column="28" selection-end-line="142" selection-end-column="28" />
+          <folding>
+            <element signature="e#47#72#0" expanded="true" />
+            <element signature="e#4704#4745#0" />
+            <element signature="e#6213#6246#0" />
           </folding>
         </state>
       </provider>
     </entry>
     <entry file="file://$PROJECT_DIR$/structure/dati2slave.py">
       <provider selected="true" editor-type-id="text-editor">
-        <state relative-caret-position="303">
-          <caret line="172" column="38" lean-forward="true" selection-start-line="172" selection-start-column="38" selection-end-line="172" selection-end-column="38" />
+        <state relative-caret-position="102">
+          <caret line="3" column="9" selection-start-line="3" selection-start-column="9" selection-end-line="3" selection-end-column="9" />
           <folding>
-            <element signature="e#46#55#0" expanded="true" />
             <element signature="e#5987#6021#0" />
           </folding>
         </state>
@@ -1356,7 +1325,7 @@
     </entry>
     <entry file="file://$PROJECT_DIR$/structure/final_structure.py">
       <provider selected="true" editor-type-id="text-editor">
-        <state relative-caret-position="99">
+        <state relative-caret-position="2788">
           <caret line="85" selection-start-line="85" selection-end-line="85" />
           <folding>
             <element signature="e#11#20#0" expanded="true" />
@@ -1364,86 +1333,111 @@
         </state>
       </provider>
     </entry>
-    <entry file="file://$PROJECT_DIR$/structure/structure_main.py">
+    <entry file="file://$PROJECT_DIR$/utils/ruku_test.py">
       <provider selected="true" editor-type-id="text-editor">
-        <state relative-caret-position="119">
-          <caret line="218" selection-start-line="218" selection-end-line="218" />
+        <state relative-caret-position="27540">
+          <caret line="859" column="41" selection-start-line="859" selection-start-column="41" selection-end-line="859" selection-end-column="41" />
           <folding>
-            <element signature="e#47#72#0" expanded="true" />
-            <element signature="e#4704#4745#0" />
-            <element signature="e#6213#6246#0" />
+            <element signature="e#24#46#0" expanded="true" />
+            <element signature="e#1334#4074#0" />
+            <element signature="e#2169#2246#0" />
           </folding>
         </state>
       </provider>
     </entry>
-    <entry file="file://$PROJECT_DIR$/utils/html_again_parse.py">
+    <entry file="file://C:/Anaconda3/Lib/site-packages/wand/image.py">
       <provider selected="true" editor-type-id="text-editor">
-        <state relative-caret-position="204">
-          <caret line="160" lean-forward="true" selection-start-line="160" selection-end-line="160" />
-          <folding>
-            <element signature="e#24#33#0" expanded="true" />
-          </folding>
+        <state relative-caret-position="805">
+          <caret line="9050" column="8" selection-start-line="9050" selection-start-column="8" selection-end-line="9050" selection-end-column="8" />
         </state>
       </provider>
     </entry>
-    <entry file="file://$PROJECT_DIR$/utils/ruku_test.py">
+    <entry file="file://$PROJECT_DIR$/utils/diffi_label.py">
       <provider selected="true" editor-type-id="text-editor">
-        <state relative-caret-position="616">
-          <caret line="859" column="41" lean-forward="true" selection-start-line="859" selection-start-column="41" selection-end-line="859" selection-end-column="41" />
+        <state relative-caret-position="204">
+          <caret line="9" column="4" selection-start-line="9" selection-start-column="4" selection-end-line="9" selection-end-column="4" />
           <folding>
-            <element signature="e#24#46#0" expanded="true" />
-            <element signature="e#1334#4074#0" />
-            <element signature="e#2169#2246#0" />
+            <element signature="e#0#11#0" expanded="true" />
           </folding>
         </state>
       </provider>
     </entry>
     <entry file="file://$PROJECT_DIR$/ceshi.py">
       <provider selected="true" editor-type-id="text-editor">
-        <state relative-caret-position="203">
-          <caret line="233" column="32" lean-forward="true" selection-start-line="233" selection-start-column="32" selection-end-line="233" selection-end-column="32" />
+        <state relative-caret-position="7820">
+          <caret line="234" selection-start-line="234" selection-end-line="234" />
           <folding>
             <element signature="e#47#96#0" expanded="true" />
           </folding>
         </state>
       </provider>
     </entry>
-    <entry file="file://$PROJECT_DIR$/server.py">
+    <entry file="file://$PROJECT_DIR$/configs.py">
       <provider selected="true" editor-type-id="text-editor">
-        <state relative-caret-position="-345">
-          <caret line="72" column="36" lean-forward="true" selection-start-line="72" selection-start-column="36" selection-end-line="72" selection-end-column="36" />
+        <state relative-caret-position="3672">
+          <caret line="112" column="4" selection-start-line="112" selection-start-column="4" selection-end-line="112" selection-end-column="4" />
           <folding>
-            <element signature="e#105#118#0" expanded="true" />
+            <element signature="e#46#60#0" expanded="true" />
           </folding>
         </state>
       </provider>
     </entry>
     <entry file="file://$PROJECT_DIR$/structure/danti_structure.py">
       <provider selected="true" editor-type-id="text-editor">
-        <state relative-caret-position="34">
-          <caret line="31" column="20" lean-forward="true" selection-start-line="31" selection-start-column="20" selection-end-line="31" selection-end-column="20" />
+        <state relative-caret-position="2992">
+          <caret line="95" column="16" selection-start-line="95" selection-start-column="16" selection-end-line="95" selection-end-column="16" />
           <folding>
             <element signature="e#64#73#0" expanded="true" />
           </folding>
         </state>
       </provider>
     </entry>
+    <entry file="file://$PROJECT_DIR$/server.py">
+      <provider selected="true" editor-type-id="text-editor">
+        <state relative-caret-position="287">
+          <caret line="210" column="45" lean-forward="true" selection-start-line="210" selection-start-column="45" selection-end-line="210" selection-end-column="66" />
+          <folding>
+            <element signature="e#105#118#0" expanded="true" />
+          </folding>
+        </state>
+      </provider>
+    </entry>
+    <entry file="file://$PROJECT_DIR$/utils/field_eq2latex.py">
+      <provider selected="true" editor-type-id="text-editor">
+        <state relative-caret-position="69">
+          <caret line="294" column="23" lean-forward="true" selection-start-line="294" selection-start-column="23" selection-end-line="294" selection-end-column="23" />
+        </state>
+      </provider>
+    </entry>
     <entry file="file://$PROJECT_DIR$/utils/washutil.py">
       <provider selected="true" editor-type-id="text-editor">
-        <state relative-caret-position="120">
-          <caret line="346" column="25" lean-forward="true" selection-start-line="346" selection-start-column="25" selection-end-line="346" selection-end-column="25" />
+        <state relative-caret-position="72">
+          <caret line="18" column="38" lean-forward="true" selection-start-line="18" selection-start-column="38" selection-end-line="18" selection-end-column="38" />
           <folding>
-            <element signature="e#138#153#0" expanded="true" />
+            <element signature="e#689#1758#0" />
+            <element signature="e#1800#4219#0" />
+          </folding>
+        </state>
+      </provider>
+    </entry>
+    <entry file="file://$PROJECT_DIR$/utils/image_convert.py">
+      <provider selected="true" editor-type-id="text-editor">
+        <state relative-caret-position="145">
+          <caret line="18" column="4" selection-start-line="18" selection-start-column="4" selection-end-line="18" selection-end-column="4" />
+          <folding>
+            <element signature="e#0#36#0" expanded="true" />
           </folding>
         </state>
       </provider>
     </entry>
     <entry file="file://$PROJECT_DIR$/utils/ruku_opera.py">
       <provider selected="true" editor-type-id="text-editor">
-        <state relative-caret-position="138">
-          <caret line="506" column="26" selection-start-line="506" selection-start-column="22" selection-end-line="506" selection-end-column="26" />
+        <state relative-caret-position="251">
+          <caret line="195" column="52" lean-forward="true" selection-start-line="195" selection-start-column="52" selection-end-line="195" selection-end-column="52" />
           <folding>
             <element signature="e#24#46#0" expanded="true" />
+            <element signature="e#19847#19883#0" />
+            <element signature="e#22125#22147#0" />
           </folding>
         </state>
       </provider>

+ 3 - 0
configs.py

@@ -87,6 +87,7 @@ class TestingCfg:  # testing
     old_img_ip = "http://192.168.1.140:8800/ser_static"
     mathpix_ip = "http://192.168.1.208:8001/segment/formula/"
     kps_phy_ip = "http://192.168.1.86:11088/phy_mark_and_connect"
+    kps_Hmath_ip = "http://192.168.1.192:13356/auto_labels"
     repeat_ip = "http://192.168.1.192:8866/api/repeat/subject"
     # repeat_ip = "http://82.156.68.22:8888/repeat/subject"  # 全学科查重
     # repeat_ip = "http://82.156.68.22:8888/api/repeat/subject"  # 保存入库查重
@@ -109,6 +110,7 @@ class ProductionCfg:  # production
     old_img_ip = "http://82.156.255.225:11086/ser_static"
     mathpix_ip = "http://10.19.1.11:7080/segment/formula/"
     kps_phy_ip = "http:/49.232.72.198:11088/phy_mark_and_connect"
+    kps_Hmath_ip = ""
     repeat_ip = "http://10.19.1.18:8866/api/repeat/subject"
     callback_url_taskcheck = "http://api.tk.zhixinhuixue.com/v1/interior-api/record"
 
@@ -157,6 +159,7 @@ old_img_ip = config_class.old_img_ip
 RawImg_UploadFolder = config_class.raw_img_upload_folder
 mathpix_ip = config_class.mathpix_ip
 kps_phy_ip = config_class.kps_phy_ip
+kps_Hmath_ip = config_class.kps_Hmath_ip
 callback_url_taskcheck = config_class.callback_url_taskcheck
 repeat_ip = config_class.repeat_ip
 

+ 1 - 1
server.py

@@ -203,7 +203,7 @@ def ruku():
         # try:
             res = Ruku(items_list, ocr_html_data, svg_data, str(wordid), callback_info, subject).save()
             logger.info("【入库】==结束==> word_id:{}".format(wordid))
-            pprint(res)
+            # pprint(res)
             logger.info(json.dumps({"log_level": "info",
                          "paper_id": wordid,
                          "status": "任务结束",

+ 20 - 15
utils/field_eq2latex.py

@@ -181,9 +181,14 @@ def zifu_match_combine(split_eq):
                             new_split_eq.extend(split_eq[k + 1:])
                             return zifu_match_combine(new_split_eq)
                     elif bef_left_kuohao == "\\r":
+                        print(':::', "".join(split_eq[k - subk - 1 - 1:k + 1]))
                         info1 = re.search(r"\\r\((.*?)\)$", "".join(split_eq[k - subk - 1 - 1:k + 1]))
                         if info1:
-                            new_s = "\sqrt{{{}}}".format(re.sub("^\s*,", "", info1.group(1)))
+                            if re.search("<sup>\d</sup>\s*,", info1.group(1)):
+                                lft, right = re.split("(?<=</sup>)\s*,", info1.group(1))
+                                new_s = "\sqrt[{}]{{{}}}".format(re.search("<sup>(\d)</sup>", lft).group(1), right)
+                            else:
+                                new_s = "\sqrt{{{}}}".format(re.sub("^\s*,", "", info1.group(1)))
                             new_split_eq = split_eq[:k - subk - 1 - 1]
                             if new_split_eq and new_split_eq[-1] == "(":
                                 new_s = "{" + new_s + "}"
@@ -316,7 +321,7 @@ def get_latex(item, is_reparse=0, wordid="123456", must_latex=0):
         new_eqs.append(file_path)
         eqcode = "】【".join(new_eqs)
         try:
-            requests.get(r"http://localhost:9001/FieldEq/Eq2Png/?eqcode=" + eqcode, timeout=30)
+            requests.get(r"http://localhost:9001/FieldEq/Eq2Png/?eqcode=" + eqcode, timeout=3)
         except:
             pass
         # 在生成图片的文件夹中对应判断图片再进行替换
@@ -356,21 +361,21 @@ if __name__ == '__main__':
     # f = "eq \\f(\\f(1,2)×0.82,0.2×10)】【eq \\f(6,1)】【eq \\f(\\x\\to(OC)-\\x\\to(OA),2T)】【C:/Users/Python/Desktop/test/temp"
     # res = requests.get(r"http://localhost:9001/FieldEq/Eq2Png/?eqcode=" + f, timeout=30).text
     # print(json.loads(res).replace("\r\n", ""))
-    f = "【解】解析 (1)因OB绳处于竖直方向,所以B球处于平衡状态,AB绳上的拉力为零,OB绳对小球的拉力F<sub>OB</sub>=mg. (3分)<br/>(2)A球在重力mg、水平拉力F和OA绳的拉力F<sub>OA</sub>三力作用下平衡,所以OA绳对小球的拉力F<sub>OA</sub>=【域公式:eq \\\\f(mg,cos 60°)】=2mg. (3分)<br/>(3)作用力F=mgtan 60°=【域公式:eq \\\\r(3)】mg. (3分)<br/>答案 (1)mg (2)2mg (3)【域公式:eq \\\\r(3)】mg"
-    # f = "【域公式:eq \\f(v<sub>0</sub>,a)】"
-    aa = get_latex(f, )
+    # f = "【解】解析 (1)因OB绳处于竖直方向,所以B球处于平衡状态,AB绳上的拉力为零,OB绳对小球的拉力F<sub>OB</sub>=mg. (3分)<br/>(2)A球在重力mg、水平拉力F和OA绳的拉力F<sub>OA</sub>三力作用下平衡,所以OA绳对小球的拉力F<sub>OA</sub>=【域公式:eq \\\\f(mg,cos 60°)】=2mg. (3分)<br/>(3)作用力F=mgtan 60°=【域公式:eq \\\\r(3)】mg. (3分)<br/>答案 (1)mg (2)2mg (3)【域公式:eq \\\\r(3)】mg"
+    f = "B.【域公式:eq \\r(<sup>3</sup>,\\f(1,4))】"
+    aa = get_latex(f, 1)
     print(aa)
 
-    tt = r"${ } _ { n H C H O } \rightarrow f H _ { 2 } C - O _ { n }$"
-    def sub1(ss):
-        if re.search(r"\\left.*?\\right|\\right.*?\\left", ss.group(1)) is None:
-            # res = re.sub(r"\\left(?!right|arrow)|\\right(?!left|arrow)", "", ss.group(1))
-            res = re.sub(r"\\left(?![a-z])|\\right(?![a-z])", "", ss.group(1))
-            return res
-        return ss.group(1)
-    tt = re.sub(r"(\$.*?(\\left(?![a-z])|\\right(?![a-z])).*?\$)", sub1, tt)
-    # re1 = latex_wash(tt)
-    print(tt)
+    # tt = r"${ } _ { n H C H O } \rightarrow f H _ { 2 } C - O _ { n }$"
+    # def sub1(ss):
+    #     if re.search(r"\\left.*?\\right|\\right.*?\\left", ss.group(1)) is None:
+    #         # res = re.sub(r"\\left(?!right|arrow)|\\right(?!left|arrow)", "", ss.group(1))
+    #         res = re.sub(r"\\left(?![a-z])|\\right(?![a-z])", "", ss.group(1))
+    #         return res
+    #     return ss.group(1)
+    # tt = re.sub(r"(\$.*?(\\left(?![a-z])|\\right(?![a-z])).*?\$)", sub1, tt)
+    # # re1 = latex_wash(tt)
+    # print(tt)
     # item = "【域公式:eq \\f(【域公式:eq \\f(6,1)】,3)】geeghe】threthtrh"
     # new_eqs2raw = {}  # 域代码_原始文本
     # for i in re.finditer("【域公式:(.*?)】", item):

+ 2 - 2
utils/image_convert.py

@@ -18,12 +18,12 @@ def wmf2png(old_src):
 
 def svg2png(old_src):
     """svg转png"""
-    with wima(filename=old_src, resolution=200, background=Color('rgba( 0, 0, 0, 0.0)'), format='png') as img:
+    with wima(filename=old_src, resolution=400, background=Color('rgba( 0, 0, 0, 0.0)'), format='png') as img:
         newfilename = os.path.splitext(old_src)[0] + ".png"
         img.save(filename=newfilename)
         return img.size, newfilename
 
 
 if __name__ == '__main__':
-    fn = r"F:\zwj\Text_Structure\img_folder\61c173e17af641e9016b4518\svg_mjmath\MJMATH-1640071921249450.svg"
+    fn = r"F:\zwj\Text_Structure\img_folder\0213441313131\svg_mjmath\MJMATH-1652453454103257.svg"
     svg2png(fn)

+ 79 - 39
utils/ruku_opera.py

@@ -206,9 +206,14 @@ class Ruku():
                     imgname_online = "/zyk/uploadfiles/wording/" + str(self.wordid) + "/{}".format(os.path.basename(img_path))
                     put_key_mjmath.append(imgname_online)
                     mj_ltx = svgp_ltx[img_path.replace(".png", ".svg")]  #.replace("\\\\", "\\")
+                    w = shape[0] / 4
+                    h = shape[1] / 4
+                    if re.search(r"\\frac", mj_ltx.replace(" ", '')):
+                        w = shape[0] / 4 * 1.6
+                        h = shape[1] / 4 * 1.6
                     mjmath_online = '<img src="http://' + configs.public_bucket_addr + imgname_online \
                                     + '" width="{}" height="{}" data-type="math" data-latex="{}" />'.format(
-                        shape[0] / 2, shape[1] / 2, "${}$".format(mj_ltx))
+                        int(w), int(h), "${}$".format(mj_ltx))  # shape[0] / 2
                     self.ltx2url[mj_ltx] = mjmath_online
             logger.info(json.dumps({"log_level": "info",
                                     "paper_id": self.wordid,
@@ -427,8 +432,6 @@ class Ruku():
                     #         new_one_item[k] = one_items[k]
                         # else:  # 有的题本来就没有options字段
                         #     logger.info("----【paper_id:{}】第{}道题{}字段有问题".format(self.wordid, one_items["topic_num"], k))
-                # if self.subject == "高中物理":
-                #     new_one_item["label_auto"], kps_label_time = self.get_phy_kps_auto(one_items, kps_label_time)
                 items_res_to_xbk.append(new_one_item)
 
             # 5>> ocr-htmlt中图片地址替换成云上地址
@@ -468,7 +471,6 @@ class Ruku():
         else:  # 本地没有新图片时
             # -----------难度、知识点自动标注------------------------
             diffs_xbk, self.items_list = self.get_diff(self.items_list)  # 难度
-
             if self.callback_url:
                 for nn, one_items in enumerate(self.items_list):
                     new_one_item = {}
@@ -492,9 +494,6 @@ class Ruku():
                     # for k in keys_items:
                     #     if k in one_items:
                     #         new_one_item[k] = one_items[k]
-                    #  知识点自动标注
-                    # if self.subject == "高中物理":
-                    #     new_one_item["label_auto"], kps_label_time = self.get_phy_kps_auto(one_items, kps_label_time)
                     items_res_to_xbk.append(new_one_item)
 
                 res_xbk = {"items": items_res_to_xbk, "errcode": 0, "errmsg": "ok", "callback_type": 2}
@@ -503,6 +502,9 @@ class Ruku():
                                         "repeat_time": repeat_time}, ensure_ascii=False))
         # 先传一份到校本题库,再返回结果
         if self.callback_url:
+            #  知识点自动标注--批量
+            if self.subject == "高中数学" and self.source == "qtk": # :
+                res_xbk = self.get_kps_auto(res_xbk)
             # 回调前,将结果保存本地一份
             self.save_post_file(res_xbk)
             have_err = self.callback_user(res_xbk, self.callback_url)
@@ -537,10 +539,13 @@ class Ruku():
                         one_items["parse"] += "<br/>({})".format(idn + 1) + s["parse"]
                     if "options" in s and s["options"]:
                         one_items["stem"] += "<br/>" + "<br/>".join(["{}、{}".format(chr(ord('@') + idm + 1),
-                                                                                    option) for idm, option in
-                                                                     enumerate(s["options"])])
+                                                         option) for idm, option in enumerate(s["options"])])
                 one_items["slave"] = []
+            if "btt_id" in one_items["checkType"] and one_items["checkType"]["btt_id"] not in [5, 6, 7]:
+                one_items["stem"] = re.sub(r'<span style="color:RGB\(50%,40%,30%\); blank space">(__{2,})</span>',
+                                           r"\1", one_items["stem"])
         else:
+        # if "btt_id" in one_items["checkType"] and one_items["checkType"]["btt_id"] == 13:
             # 将小问答案没拆出来的部分放入公共解析字段中
             if "slave" in one_items and one_items["slave"] and one_items["key"] and \
                     all([True if not s["key"].strip() else False for s in one_items["slave"]]):  # 带小题的且小题答案都为空
@@ -596,9 +601,9 @@ class Ruku():
         re_f = open(new_fpath, 'w', encoding='utf-8')
         json.dump(parse_res, re_f,ensure_ascii=False)
 
-    def get_phy_kps_auto(self, one_items, kps_label_time):
+    def get_kps_auto(self, all_items):
         """
-        调取物理自动标注的端口获取考点
+        调取自动标注的端口获取考点
         :return:
         """
         def phy_kps(input_data):
@@ -611,25 +616,60 @@ class Ruku():
                         label_auto.update(res)
             return label_auto
 
+        def Hmath_kps(input_data):
+            label_auto = []
+            try:
+                r = requests.post(configs.kps_Hmath_ip, json=input_data)  # json={"input_data": item}
+                if r.status_code == 200:
+                    res = r.json()['data']  # eval(r.text)
+                    if res:
+                        label_auto = res
+            except Exception as e:
+                logger.info("----【paper_id:{}】标注服务异常:{}".format(self.wordid, e))
+                return "保存入库高中数学标注服务异常"
+            return label_auto
+
         t1= time.time()
-        temp_items = {"server_state": 11,
-                      "fine_state": 0,
-                      "add_parse_state": 1}
-        one_info = {"topic_id": one_items["topic_num"],
-                    "content": one_items["stem"],
-                    "option": one_items["options"] if "options" in one_items else [],
-                    "parse": one_items["parse"],
-                    "kpl_codes": [], "ori_sences": [], "ori_kpl_codes": [],
-                    "topic_type_id": one_items["checkType"]["id"]}
-        temp_items["info"] = one_info
-        # 散题
-        # temp_items["parse"] = str(one_items["key"]) + "<br/>" + one_items["parse"]
-        # if "analysis" in one_items:
-        #     temp_items["parse"] += "<br/>" + one_items["analysis"]
-        auto_kps = phy_kps(temp_items)
-        print("自动标注考点:", auto_kps)
-        kps_label_time += time.time() - t1
-        return auto_kps, kps_label_time
+        # 高中物理
+        # temp_items = {"server_state": 11,
+        #               "fine_state": 0,
+        #               "add_parse_state": 1}
+        # one_info = {"topic_id": one_items["topic_num"],
+        #             "content": one_items["stem"],
+        #             "option": one_items["options"] if "options" in one_items else [],
+        #             "parse": one_items["parse"],
+        #             "kpl_codes": [], "ori_sences": [], "ori_kpl_codes": [],
+        #             "topic_type_id": one_items["checkType"]["id"]}
+        # temp_items["info"] = one_info
+        # 高中数学
+        # stems = one_items["stem"]
+        # if "slave" in one_items and one_items["slave"]:
+        #     stem_l = [s["slave_no"] + s["stem"] + "<br/>"+ "<br/>".join(s["options"])
+        #               if "options" in s and s["options"] else s["slave_no"] + s["stem"] for s in one_items["slave"]]
+        #     stems += "<br/>".join(stem_l)
+        items = all_items["items"]
+        items_info = {"subject_id": subject_id[self.subject],
+                     "topics": [{"topic_id": one_items["id"],
+                                 "topic_type_id": one_items["checkType"]["id"],
+                                 "content": one_items["stem"],
+                                 "parse": one_items["parse"],
+                                 "option": one_items["options"],
+                                 "slave": one_items["slave"]} for one_items in items]
+                     }
+
+        auto_kps = Hmath_kps(items_info)
+        if type(auto_kps) == str:
+            pass
+        else:
+            for nn, one_items in enumerate(all_items["items"]):
+                one_items.update({"auto_mark_result": auto_kps[nn]})
+            # all_items["items"] = [lambda x:one_items.update({"auto_mark_result": auto_kps[nn]})
+            #                       for nn, one_items in enumerate(all_items["items"])]
+        # print("自动标注考点:", auto_kps)
+        logger.info(json.dumps({"log_level": "info",
+                                "paper_id": self.wordid,
+                                "automark_time": time.time() - t1}, ensure_ascii=False))
+        return all_items
 
     def img2latex(self):
         # 3>> 统计结构化试题data-latex为空的图片,再ocr-latex处理并替换
@@ -669,16 +709,16 @@ class Ruku():
         # -------------------------------------------------------------------
 
     def get_diff(self, items_res_to_zyk):
-        # -----------难度和知识点自动标注------------------------
-        t11 = time.time()
-        diffs_xbk = [""] * len(items_res_to_zyk)
-        if self.subject == "高中数学":
-            from multiprocessing.dummy import Pool as ThreadPool
-            pool = ThreadPool(2)  # 比# pool = multiprocessing.Pool(3)速度快
-            diff_info = list(pool.map(get_item_diff, items_res_to_zyk))
-            items_res_to_zyk = [f[0] for f in diff_info]
-            diffs_xbk = [f[1] for f in diff_info]
-            logger.info("----【paper_id:{}】结构化试题中难度标注时间:{}".format(self.wordid, time.time() - t11))
+        # -----------难度自动标注------------------------
+        # t11 = time.time()
+        diffs_xbk = [3] * len(items_res_to_zyk)
+        # if self.subject == "高中数学":  # 难度自动标注暂时不用了
+        #     from multiprocessing.dummy import Pool as ThreadPool
+        #     pool = ThreadPool(2)  # 比# pool = multiprocessing.Pool(3)速度快
+        #     diff_info = list(pool.map(get_item_diff, items_res_to_zyk))
+        #     items_res_to_zyk = [f[0] for f in diff_info]
+        #     diffs_xbk = [f[1] for f in diff_info]
+        #     logger.info("----【paper_id:{}】结构化试题中难度标注时间:{}".format(self.wordid, time.time() - t11))
         return diffs_xbk, items_res_to_zyk
 
     def repeat_check(self, id, one_items, repeat_time):

+ 4 - 0
utils/washutil.py

@@ -749,6 +749,10 @@ def convert_huanhang(items_list):
                 items_list[k] = configs.answer_type[v]
             else:
                 items_list[k] = convert_huanhang(v)
+        if "answer_type" in items_list and items_list["answer_type"] == 2:
+            if ("slave" not in items_list or not items_list["slave"]) and "stem" in items_list:
+                items_list["stem"] = re.sub(r"(__{2,})", r'<span style="color:RGB(50%,40%,30%); blank space">\1</span>',
+                                            items_list["stem"])
     elif isinstance(items_list, str):
         item_str = items_list.strip().replace("\n\n", "\n")
         item_str = re.sub(r'(</table>)(<br\s*/?>|\n)+', r"\1", item_str)