Test document automatic segmentation method and system, device and storage medium
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- SUZHOU LINGGUANG EDUCATION TECHNOLOGY CO LTD
- Filing Date
- 2022-12-22
- Publication Date
- 2026-08-07
AI Technical Summary
上述申请具有以下缺点,1)需要人工编辑Word格式文档,对试卷按照一定的规则进行标注;2)同时算法上判断比较机械,对试题的格式有要求,若不符合规定的格式,则不好判别
[0015] The beneficial effects of this invention are: 1) This invention has a high degree of automation, requiring no manual editing of documents and no human intervention from beginning to end; 2) It has a high degree of intelligence, requiring no special marking of key information and preventing parsing failures or errors due to a punctuation error or similar minor formatting mistake; 3) It is more in line with teachers' question-setting habits, allowing teachers to directly write test question documents according to traditional practices without needing to learn any new usage methods.
Smart Images

Figure CN115984860B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to a method, system, device, and storage medium for automatic segmentation of test question documents, belonging to the field of computer technology. Background Technology
[0002] Currently, most educational software systems rely on manual input and segmentation of test question documents uploaded by teachers, or require teachers to input test questions according to specified software and operating procedures.
[0003] The above methods for inputting and segmenting questions require a lot of manual labor, lack automation and intelligence, or require teachers to learn new software usage methods, which does not conform to teachers' habits of using office software to write test questions and cannot meet the needs of users.
[0004] For example, CN102193906A discloses a method for automatically importing WORD format test papers into a database system, which includes: editing the WORD format test paper and marking the test paper according to certain rules; the marking includes: using separators to mark the question types, major question numbers, and minor question numbers in the test paper; and then performing the following steps: dividing the WORD format test paper into multiple new documents according to the markings, with each new document containing one question, and renaming and saving these new documents; reading out all the number of segments of the entire WORD test paper according to the separators between the questions, and then cyclically scanning all segments, parsing the read question types, major question numbers, minor question numbers, and the new document corresponding to each question into the database respectively; and adding auxiliary information to different major question numbers and minor question numbers in the database. The advantages of this invention are: (1) importing WORD format test papers into the database system makes the storage and management of test papers electronic and automated; (2) facilitating the retrieval and use of test papers, providing convenience for teaching and scientific research. The above application has the following disadvantages: 1) It requires manual editing of Word format documents and marking of the test papers according to certain rules; 2) At the same time, the algorithm is relatively mechanical and has requirements on the format of the test questions. If the format does not meet the requirements, it is difficult to judge. Summary of the Invention
[0005] To address the aforementioned problems, this invention provides a method, system, device, and storage medium for automatically segmenting test question documents.
[0006] This invention provides the following technical solution: The first aspect of this invention discloses a method for automatically segmenting test question documents, characterized by comprising the following steps: S1: Read and parse the uploaded document content; S2: Classify and label the text characters in the parsed document; S3: Organize potential question numbers for documents after classification tags; S4: Evaluate and filter the potential question numbers obtained in S3; S5: Arrange and combine the potential question numbers after processing in S4, and then comprehensively evaluate and screen them; S6: Assign document content to corresponding question numbers: Assign the document content parsed in S1 to the question numbers obtained in the previous step S5, based on its position. The assignment is done from top to bottom and left to right according to the question number's position. For example: If a character, illustration, or formula appears after the nth question number and before the (n+1)th question number, then this character, illustration, or formula is assigned to the nth question number. S7: Display and archive the results of the S6 segmentation.
[0007] Prior to this, the document content read in S1 includes each text character in the document and its position, as well as illustrations and formulas; the parsing process includes format conversion, first converting to PDF to facilitate file reading and writing.
[0008] Prior to this, the classification in S2 is as follows: Arabic numerals, Chinese numerals, decimal points or commas, left parentheses, right parentheses, and other common characters.
[0009] Preferably, the S3 sorting process is as follows: S31) First, sort the text characters after the classification mark from top to bottom and from left to right, and then determine whether each character and its subsequent characters are on the same horizontal line, as well as the horizontal distance between characters in the same line. S32) If characters in the same line are on the same horizontal line and the horizontal distance between characters is within the preset value, and the distance between characters is less than the width of one character, they will be merged into one text line; S33) After merging and sorting, Arabic numerals and Chinese numerals are selected as potential question numbers.
[0010] Prior to this, the evaluation and selection process for question S4 is as follows: S41) Check the number of ordinary characters in the same line as the potential question number and preceding it. If the number is n and the evaluation value is p, then the calculation formula is: ; S42) Check the format of the character before and after the potential question number. For parentheses, decimal points, and commas, the evaluation value remains unchanged if the format conforms to the teacher's question-setting habits. Otherwise, the evaluation value is reduced. If a format that does not conform to the teacher's habits is found, such as mismatched parentheses, no parentheses, no decimal point, and no comma, the evaluation value is halved. S43) For other situations that do not conform to the teacher's habits, lower his evaluation value. For example, if the position is too far to the right, the font is too big or too small, etc., if it is found that does not conform to the teacher's habits, the evaluation value will be halved again. S44) If the final evaluation value is lower than the preset value, or if it can be determined that it is not a question number, such as a number greater than 200 or a negative number (because teachers usually start question numbers from 1, and the number of questions in an exam or assignment will not exceed 200), or if the final evaluation value after step S4 is less than 0.01, it will be directly eliminated; questions that cannot be ruled out will still be retained.
[0011] Preferably, the specific process of S5 is as follows: S51) Sort the potential question numbers from top to bottom and from left to right according to their positions; S52) Start recursion. At each recursion, try to insert a potential question number and evaluate the current accumulated question number permutations. When trying to insert, there may be a maximum of 5 attempts, corresponding to the previous 4 levels of nested structure and one skip. In order to speed up the recursion, an evaluation score stack is established to record the score in the recursion process. When a new recursion occurs, it will check whether the score is higher than the record in this stack to avoid repeated and meaningless calculations. S53) The evaluation content includes the evaluation value of the potential question number itself obtained in S4, as well as whether the format of the current question number combination is consistent, whether the question numbers are consecutive, and whether the question number inclusion relationship conforms to the teacher's habits, and conducts a comprehensive evaluation of all aspects. After evaluation (S54), proceed to the next level of recursion; S55) During the recursive process, record the best evaluation and the corresponding question number combination at any time; (S56) After the recursion is completed, the combination of question numbers with the highest evaluation score will be used as the final selection result.
[0012] The second aspect of this invention is disclosed: an automatic test document segmentation system, characterized in that it includes... The document upload module is used by users to upload edited test question documents; A segmentation calculation module is used to execute the automatic test document segmentation method disclosed in the first aspect; The display and archiving module is used to show users the results of automatic segmentation and save them to the system.
[0013] A third aspect of the present invention discloses an electronic device, characterized in that it includes a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor, when executed, implements the automatic test document segmentation method described in the first aspect.
[0014] A fourth aspect of the present invention is disclosed: a computer-readable storage medium, characterized in that a computer program stored therein causes a processor to execute the test document automatic segmentation method described in the first aspect.
[0015] The beneficial effects of this invention are: 1) This invention has a high degree of automation, requiring no manual editing of documents and no human intervention from beginning to end; 2) It has a high degree of intelligence, requiring no special marking of key information and preventing parsing failures or errors due to a punctuation error or similar minor formatting mistake; 3) It is more in line with teachers' question-setting habits, allowing teachers to directly write test question documents according to traditional practices without needing to learn any new usage methods. Attached Figure Description
[0016] The accompanying drawings are provided to further illustrate the invention and form part of the specification. They are used in conjunction with embodiments of the invention to explain the invention and do not constitute a limitation thereof. In the drawings: Figure 1 This is a flowchart of the automatic test document segmentation method of the present invention; Figure 2 This is a structural diagram of the automatic test document segmentation system of the present invention; Figure 3 This is a screenshot of the original document uploaded by the teacher of this invention; Figure 4 This is a screenshot showing the screening of potential question numbers according to the steps of this invention; Figure 5 The final effect diagram of the method of the present invention is shown. Detailed Implementation
[0017] Example 1 As shown in the figure, the method for automatically segmenting test question documents includes the following steps: Please refer to this carefully. Figure 3 S1: Reads and parses the uploaded document content; the user is a teacher, and the uploaded document is in either Word or PDF format. Reading the document content includes each text character and its position, as well as illustrations and formulas; the parsing process includes format conversion. If it is in Word format, it is first converted to PDF format for easier reading and writing; if it is already in PDF format, no further format conversion is performed.
[0018] S2: Classify and mark the text characters in the parsed document; the text characters are classified as follows: Arabic numerals, Chinese numerals, decimal points or commas, left parentheses, right parentheses, and other ordinary characters, totaling 6 formats.
[0019] S3: Compile potential question numbers from the documents after classification tags; the process of compiling potential question numbers is as follows: S31) First, sort the text characters after the classification mark from top to bottom and from left to right, and then determine whether each character and its subsequent characters are on the same horizontal line, as well as the horizontal distance between characters in the same line. S32) If characters in the same line are on the same horizontal line and the horizontal distance between characters is within the preset value, and the distance between characters is less than the width of one character, they will be merged into one text line; S33) After merging and sorting, Arabic numerals and Chinese numerals are selected as potential question numbers.
[0020] S4: Evaluate and filter the potential question numbers obtained in S3; the process of evaluating and filtering question numbers is as follows: S41) Check the number of ordinary characters in the same line as the potential question number and preceding it. If the number is n and the evaluation value is p, then the calculation formula is: ; S42) Check the format of the character before and after the potential question number. For parentheses, decimal points, and commas, the evaluation value remains unchanged if the format conforms to the teacher's question-setting habits. Otherwise, the evaluation value is reduced. If a format that does not conform to the teacher's habits is found, such as mismatched parentheses, no parentheses, no decimal point, and no comma, the evaluation value is halved. S43) For other situations that do not conform to the teacher's habits, lower his evaluation value. For example, if the position is too far to the right, the font is too big or too small, etc., if it is found that does not conform to the teacher's habits, the evaluation value will be halved again. (S44) If the final evaluation value is lower than the preset value, or if it can be determined that the question cannot be a question number (determined by: a number greater than 200 or a negative number, as teachers typically start question numbers from 1, and the number of questions in an exam or assignment will not exceed 200), or if the final evaluation value after step S4 is less than 0.01, the question will be directly eliminated. Questions whose possibility cannot be ruled out will still be retained. Please refer to this section for details. Figure 4 Green represents a higher rating, and red represents a lower rating.
[0021] S5: Arrange and combine the potential question numbers processed in S4, and then comprehensively evaluate and filter them; the specific process of evaluation and filtering is as follows: S51) Sort the potential question numbers from top to bottom and from left to right according to their positions; S52) Start recursion. At each recursion, try to insert a potential question number and evaluate the current accumulated question number permutations. When trying to insert, there may be a maximum of 5 attempts, corresponding to the previous 4 levels of nested structure and one skip. In order to speed up the recursion, an evaluation score stack is established to record the score in the recursion process. When a new recursion occurs, it will check whether the score is higher than the record in this stack to avoid repeated and meaningless calculations. S53) The evaluation content includes the evaluation value of the potential question number itself obtained in S4, as well as whether the format of the current question number combination is consistent, whether the question numbers are consecutive, and whether the question number inclusion relationship conforms to the teacher's habits, and conducts a comprehensive evaluation of all aspects. After evaluation (S54), proceed to the next level of recursion; S55) During the recursive process, record the best evaluation and the corresponding question number combination at any time; (S56) After the recursion is completed, the combination of question numbers with the highest evaluation score will be used as the final selection result.
[0022] Please refer to this carefully. Figure 5 S6: Assign document content to corresponding question numbers: Assign the document content parsed in S1 to the question numbers obtained in the previous step S5, based on its position. The assignment is done from top to bottom and left to right according to the question number's position. For example: If a character, illustration, or formula appears after the nth question number and before the (n+1)th question number, then this character, illustration, or formula is assigned to the nth question number. S7: Display and archive the results of the S6 segmentation.
[0023] Example 2 This invention also includes an automatic test document segmentation system, characterized in that it comprises: The document upload module is used by users to upload edited test question documents; The segmentation calculation module is used to execute the automatic test document segmentation method disclosed in Example 1; The display and archiving module is used to show users the results of automatic segmentation and save them to the system.
[0024] Example 3 This invention also provides an electronic device, characterized in that it includes a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the automatic test document segmentation method described in Embodiment 1.
[0025] Example 4 This invention also provides a computer-readable storage medium, characterized in that the computer program stored therein causes a processor to execute the test document automatic segmentation method described in Embodiment 1.
[0026] Those skilled in the art will understand that embodiments of the present invention can be provided as methods, apparatus, or computer program products. Therefore, embodiments of the present invention can take the form of entirely hardware embodiments, entirely software embodiments, or embodiments combining software and hardware aspects. Furthermore, embodiments of the present invention can take the form of computer program products implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0027] The above description is merely a preferred embodiment of the present invention and is not intended to limit the present invention. Although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art can still modify the technical solutions described in the foregoing embodiments or make equivalent substitutions for some of the technical features. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the present invention should be included within the protection scope of the present invention.
Claims
1. A method for automatically segmenting test question documents, characterized in that, Includes the following steps: S1: Read and parse the uploaded document content; reading the document content includes each text character and its position, as well as illustrations and formulas; the parsing process includes format conversion to facilitate file reading and writing; S2: Classify and label the text characters in the parsed document; the classification labels include Arabic numerals, Chinese numerals, decimal points or commas, left parentheses, right parentheses, and other common characters; S3: Compile potential question numbers from the documents after the category tags: S31) First, sort the text characters after the classification mark from top to bottom and from left to right, and then determine whether each character and its subsequent characters are on the same horizontal line, as well as the horizontal distance between characters in the same line. S32) If characters in the same line are on the same horizontal line and the horizontal distance between characters is within the preset value, and the distance between characters is less than the width of one character, they will be merged into one text line; S33) After merging and sorting, Arabic numerals and Chinese numerals are selected as potential question numbers; S4: Evaluate and filter the potential question numbers obtained in S3: S41) Check the number of ordinary characters in the same line as the potential question number and preceding it. If the number is n and the evaluation value is p, then the calculation formula is: ; S42) Check the format of the character before and after the potential question number. For parentheses, decimal points, and commas, the evaluation value remains unchanged if the format conforms to the teacher's question-setting habits; otherwise, the evaluation value is reduced. S43) For other situations that do not conform to the teacher's habits, lower his evaluation score; S44) If the final evaluation value is lower than the preset value, or if it can be determined that it is not a question number, it will be directly eliminated; questions that cannot be ruled out will still be retained. S5: Arrange and combine the potential question numbers after processing in S4, and then comprehensively evaluate and filter them. S51) Sort the potential question numbers from top to bottom and from left to right according to their positions; S52) Start recursion. At each recursion, try to insert a potential question number and evaluate the current accumulated question number permutations and combinations. In order to speed up the recursion, build an evaluation score stack, record the score in the recursion process in this stack, and when a new recursion occurs, check whether the score is higher than the record in this stack to avoid repeated meaningless calculations. S53) The evaluation content includes the evaluation value of the potential question number itself obtained in S4, as well as whether the format of the current question number combination is consistent, whether the question numbers are consecutive, and whether the question number inclusion relationship conforms to the teacher's habits. After evaluation (S54), proceed to the next level of recursion; S55) During the recursive process, record the best evaluation and the corresponding question number combination at any time; (S56) After the recursion is completed, the combination of question numbers with the highest evaluation score will be used as the final selection result; S6: Assign document content to corresponding question numbers: Assign the document content information parsed from S1 to the question numbers obtained from S5 according to its position. S7: Display and archive the results of the S6 segmentation.
2. An automatic test paper document segmentation system, characterized in that, include The document upload module is used by users to upload edited test question documents; A segmentation calculation module is used to execute the automatic test document segmentation method as described in claim 1; The display and archiving module is used to show users the results of automatic segmentation and save them to the system.
3. An electronic device, characterized in that, It includes a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor, when executed, implements the automatic test document segmentation method as described in claim 1.
4. A computer-readable storage medium, characterized in that, The computer program stored therein enables the processor to execute the automatic test document segmentation method as described in claim 1.
Citation Information
Patent Citations
Method for automatically introducing examination paper in WORD format into database system
CN102193906A
Character detection method and device, detection equipment and storage medium
CN111767908A
Handwritten question number-based objective question marking method, apparatus and device, and storage medium
CN113159014A
Test paper information processing method and system
CN115359495A