Chinese composition automatic correction system and method based on language large model
Patent Information
- Application Number
- CN202610958762.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2026-06-30
- Publication Date
- 2026-10-30
- Estimated Expiration
- 2046-06-30
AI Technical Summary
而现有的作文自动批改大多还仅停留对错字和语法识别的维度上,无法多维度进行评价,从而导致自动批改的参考性不足
本发明通过根据错别字数量计算语言基础参考分值,根据以第二文本摘要与作文题目之间计算的第一余弦相似度和各段落文本摘要与作文题目之间的各第二余弦相似度计算切题性参考分值,根据名言警句与作文题目之间的第三余弦相似度和以名言警句与所在上下文之间的第四余弦相似度计算的适用值筛选出适用名言警句,再根据适用名言警句的数量分析文采参考分值,实现对中文作文的多维度综合批改,提高自动批改的有效性和参考性;
Smart Images

Figure CN122509159B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of artificial intelligence technology, and in particular to an automatic Chinese essay grading system and method based on a large language model. Background Technology
[0002] In the context of Chinese essay grading, there have long been practical problems such as limited teacher manpower, difficulty in fully unifying grading standards, and long feedback cycles. With the development of natural language processing technology, computer-assisted automatic essay grading has gradually become a research hotspot, aiming to reduce the burden on teachers and improve grading efficiency and consistency through automation. Most existing automatic essay correction systems only focus on identifying misspelled words and grammar, failing to provide multi-dimensional evaluation and thus lacking sufficient reference value. Summary of the Invention
[0003] To address the technical problems existing in the prior art, this invention provides a method for automatic grading of Chinese essays based on a large language model, comprising the following steps: S1. Obtain the essay text to be graded and perform text processing to obtain the text paragraphs and sentence sequences; S2. Mask each Chinese character in each sentence of the sentence sequence to obtain multiple first sentences. Use a pre-trained first language model to predict the candidate characters and their probability values at the masked positions of each first sentence. Determine whether the original character is a typo based on the candidate characters and their probability values. If so, replace the original character with the corresponding candidate character. Complete the replacement of all typos in the essay text to obtain the second text. Calculate the language foundation reference score Q1 based on the number of typos. S3. Generate a second text summary based on the second text according to the preset generation requirements using the second language big model, and generate paragraph text summaries based on each text paragraph; calculate the first cosine similarity between the second text summary and the essay title, and calculate the second cosine similarity between each paragraph text summary and the essay title; calculate the relevance reference score Q2 based on the first cosine similarity and each second cosine similarity. S4. Identify famous quotes from the second text, calculate the third cosine similarity between the famous quotes and the essay title, and calculate the fourth cosine similarity between the famous quotes and their context. Analyze the applicability of the corresponding famous quotes based on the third and fourth cosine similarities, select applicable famous quotes based on the applicability values, and then analyze the essay style reference score Q3 based on the number of applicable famous quotes. S5. Calculate the comprehensive reference score Q, Q = Q1 + Q2 + Q3.
[0004] Furthermore, the pre-trained first language large model sequentially predicts the candidate characters and their probability values at the corresponding occluded positions for each first sentence, specifically as follows: Get the character sequence corresponding to the first sentence, and add a start marker at the beginning of the character sequence and an end marker at the end; The hidden state vector at each position in the character sequence is obtained through the embedding layer of the first language large model, and the hidden state vectors corresponding to each position in the current first sentence are combined to form a hidden state matrix. The hidden state matrix is calculated using a multi-layer Transformer encoder to obtain the final hidden state matrix. Extract the vector corresponding to the position with the preset masking mark in the current first sentence from the final hidden state matrix, and denote it as the first vector. Map the first vector to the preset dictionary through the preset output weight matrix to obtain the logits vector. Apply the softmax function to the logits vector to obtain the probability value of each word in the logits vector. The word with the highest probability value is selected as the candidate character at the corresponding occluded position.
[0005] Furthermore, the step of masking each character in each sentence of the sentence sequence to obtain multiple first sentences is as follows: For the i-th sentence, replace the Chinese character at the j-th position with a preset masking mark, leaving the other characters unchanged, to form a first sentence. The number of Chinese characters contained in the i-th sentence is the number of first sentences obtained from that sentence.
[0006] Furthermore, the hidden state vectors at each position in the character sequence are obtained through the embedding layer of the first language model, and the hidden state vectors corresponding to each position in the current first sentence are combined to form a hidden state matrix. Specifically, the word embedding vector, position embedding vector, and segment embedding vector are obtained for each position in the character sequence through the embedding layer of the first language model, and the sum of the three is used as the hidden state vector at the corresponding position. The hidden state vectors corresponding to each position in the current first sentence are combined to form a hidden state matrix. The hidden state matrix is calculated through a multi-layer Transformer encoder to obtain the final hidden state matrix. Specifically, each Transformer encoder uses the hidden state matrix output by the previous Transformer encoder as input to perform multi-head self-attention calculation to obtain a multi-head attention output. The hidden state matrix of the previous layer and the current multi-head attention output are added together and then normalized to obtain the first output. The current first output is then processed by a feedforward network and added together with the current first output, and then normalized again to obtain the hidden state matrix output by the current Transformer encoder. The output of the last Transformer encoder is used as the final hidden state matrix.
[0007] Furthermore, based on the candidate characters and their probability values, it is determined whether the corresponding original character is a typo, specifically as follows: If the candidate character at the corresponding obscured position is the same as the corresponding original character, then there is no typo at that position; If the candidate character at the corresponding obscured position is different from the corresponding original character, and the probability value of the candidate character is less than the preset probability threshold, then there is no typo at that position. If the candidate character at the corresponding obscured position is different from the corresponding original character, and the probability value of the candidate character is greater than or equal to the preset probability threshold, then the original character at that position is a misspelling.
[0008] Furthermore, the preset generation requirements include preset word count, summary of text content, and central idea.
[0009] Furthermore, the fourth cosine similarity between the famous quote and its context is calculated, specifically as follows: Centered on the current famous quote, a context window W is formed by expanding forward M sentences and backward M sentences; The sentences in the context window W are concatenated into a third text. The current quote and the third text are converted into semantic vectors respectively. The fourth cosine similarity is calculated based on the semantic vectors of the current quote and the third text.
[0010] Furthermore, the applicability value of the corresponding famous quote is analyzed based on the third cosine similarity and the fourth cosine similarity, specifically: SY=K3×Y3+K4×Y4, where SY is the applicability value, K3 and K4 are preset weights, K3+K4=1, and Y3 and Y4 are the third cosine similarity and the fourth cosine similarity, respectively.
[0011] Furthermore, the language foundation reference score Q1 is calculated based on the number of spelling errors, specifically as follows: Q1 = A1 - s × kf. If s × kf > KFmax, then let s × kf = KFmax. A1 is the preset full score for language basics, s is the number of misspelled words, kf is the preset deduction value for a single misspelled word, and KFmax is the preset maximum deduction value for misspelled words. The relevance score Q2 is calculated based on the first cosine similarity and each of the second cosine similarities, specifically as follows:
[0012] If Q2 > A2, then let Q2 = A2, where A2 is the preset maximum score for relevance, K1 and K2 are preset weights, K1 > K2 and K1 + K2 = 1, Y1 is the first cosine similarity, and N is the number of second cosine similarities greater than or equal to the preset similarity threshold. If N = 0, then... , The second cosine similarity of the i-th element that is greater than or equal to the preset similarity threshold; Applicable quotes are selected based on their applicability, and then the number of applicable quotes is used to analyze the writing style reference score Q3, which is as follows: Famous quotes with an applicable value greater than or equal to the preset applicable threshold are considered applicable famous quotes, and the literary talent reference score Q3 is calculated: Q3=K5×(Ms / Ns)+K6×Ms; If Q3 > A3, then let Q3 = A3, where A3 is the preset full score for literary talent, K5 and K6 are preset weights, K5 + K6 = 1, Ms is the number of applicable famous quotes, and Ns is the number of famous quotes in the second text.
[0013] This invention also provides an automatic Chinese essay grading system based on a large language model, which applies any of the above-described automatic Chinese essay grading methods based on a large language model, including: The processing module obtains the essay text to be graded and performs text processing to obtain the text paragraphs and sentence sequences; The language foundation assessment module performs character-by-character masking on each Chinese character in each sentence of the sentence sequence to obtain multiple first sentences. A pre-trained first language model is used to predict the candidate characters and their probability values at the corresponding masked positions for each first sentence. Based on the candidate characters and their probability values, it is determined whether the corresponding original character is a misspelling. If so, the original character is replaced with the corresponding candidate character. This process is repeated to replace all misspellings in the essay text to obtain the second text. The language foundation reference score Q1 is calculated based on the number of misspellings. The relevance assessment module generates a second text summary based on the second text and paragraph text summaries based on each text segment using a second language big data model based on preset generation requirements. It calculates the first cosine similarity between the second text summary and the essay title, and calculates the second cosine similarity between each paragraph text summary and the essay title. Based on the first cosine similarity and each second cosine similarity, it calculates the relevance reference score Q2. The writing quality assessment module identifies famous quotes from the second text, calculates the third cosine similarity between the famous quote and the essay title, and calculates the fourth cosine similarity between the famous quote and its context. Based on the third and fourth cosine similarities, it analyzes the applicability of the corresponding famous quote, selects applicable famous quotes based on the applicability, and then analyzes the writing quality reference score Q3 based on the number of applicable famous quotes. The comprehensive evaluation module calculates the comprehensive reference score Q, where Q = Q1 + Q2 + Q3.
[0014] Compared with the prior art, the beneficial effects of the present invention are as follows: This invention calculates a language foundation reference score based on the number of misspelled words, a relevance reference score based on the first cosine similarity between the second text summary and the essay title, and the second cosine similarity between each paragraph's text summary and the essay title, and filters out applicable quotations based on the third cosine similarity between the quotations and the essay title and the fourth cosine similarity between the quotations and their context, and then analyzes the literary style reference score based on the number of applicable quotations, thereby achieving multi-dimensional comprehensive correction of Chinese essays and improving the effectiveness and reference value of automatic correction; By generating a second text summary (i.e., a full text summary) and paragraph summaries, the highly condensed semantic representation of the summary effectively filters out redundant details, decorative sentences, and local noise in the original text, allowing the judgment of relevance to focus on the semantic matching degree between the core idea of the text and the question, thereby significantly improving the effectiveness and accuracy of the relevance reference score. By calculating the third cosine similarity between famous quotes and essay topics, and the fourth cosine similarity between famous quotes and their surrounding context, the applicability of these quotes is comprehensively quantified from two dimensions: "content relevance" and "contextual integration." This effectively identifies situations where famous quotes are cited but the content deviates from the theme, or where the quotes themselves are good but their connection to the preceding and following text is awkward. Based on this, applicable famous quotes that truly reflect literary talent are selected. The literary talent reference score obtained based on the number of applicable famous quotes improves the effectiveness and accuracy of the literary talent reference score. Attached Figure Description
[0015] The accompanying drawings, which are incorporated in and form part of this specification, illustrate embodiments consistent with the invention and, together with the description, serve to explain the principles of the invention.
[0016] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, for those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0017] Figure 1 This is a flowchart of an automatic Chinese essay grading method based on a large language model according to the present invention; Figure 2 This is a structural block diagram of an automatic Chinese essay grading system based on a large language model, according to the present invention. Detailed Implementation
[0018] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only a part of the embodiments of the present invention, and not all of them. Based on the embodiments of the present invention, all other embodiments obtained by those of ordinary skill in the art without creative effort are within the scope of protection of the present invention.
[0019] It should be noted that all directional indications (such as up, down, left, right, front, back, etc.) in the embodiments of the present invention are only used to explain the relative positional relationship and movement of each component in a certain specific posture (as shown in the figure). If the specific posture changes, the directional indication will also change accordingly.
[0020] Furthermore, the use of terms such as "first" and "second" in this invention is for descriptive purposes only and should not be construed as indicating or implying their relative importance or implicitly specifying the number of technical features indicated. Therefore, features defined with "first" and "second" may explicitly or implicitly include at least one of those features. Additionally, the technical solutions of the various embodiments can be combined with each other, but only on the basis of being achievable by those skilled in the art. When the combination of technical solutions is contradictory or impossible to implement, such a combination of technical solutions should be considered non-existent and not within the scope of protection claimed by this invention.
[0021] Example 1 See Figure 1 As shown, the present invention provides an automatic Chinese essay grading method based on a large language model, which specifically includes the following steps: S1. Obtain the essay text to be graded and perform text processing to obtain the text paragraphs and sentence sequences; S2. Mask each Chinese character in each sentence of the sentence sequence to obtain multiple first sentences. Use a pre-trained first language model to predict the candidate characters and their probability values at the masked positions of each first sentence. Determine whether the original character is a typo based on the candidate characters and their probability values. If so, replace the original character with the corresponding candidate character. Complete the replacement of all typos in the essay text to obtain the second text. Calculate the language foundation reference score Q1 based on the number of typos. S3. Generate a second text summary based on the second text according to the preset generation requirements using the second language big model, and generate paragraph text summaries based on each text paragraph; calculate the first cosine similarity between the second text summary and the essay title, and calculate the second cosine similarity between each paragraph text summary and the essay title; calculate the relevance reference score Q2 based on the first cosine similarity and each second cosine similarity. S4. Identify famous quotes from the second text, calculate the third cosine similarity between the famous quotes and the essay title, and calculate the fourth cosine similarity between the famous quotes and their context. Analyze the applicability of the corresponding famous quotes based on the third and fourth cosine similarities, select applicable famous quotes based on the applicability values, and then analyze the essay style reference score Q3 based on the number of applicable famous quotes. S5. Calculate the comprehensive reference score Q, Q = Q1 + Q2 + Q3.
[0022] The following provides a detailed explanation of each step: S1. Obtain the essay text to be graded and perform text processing to obtain the text paragraphs and sentence sequences.
[0023] In step S1, the process of obtaining the essay text to be graded specifically involves acquiring a paper document containing the user's handwritten essay using a scanning or photographic device, generating a digitized essay image, and then performing text recognition on the essay image to obtain the essay text.
[0024] In step S1, text processing is performed to obtain each text paragraph. Specifically, the composition grid is extracted from the composition image, and it is identified whether there are characters in the first two squares of each row of composition grids. If not, the row of composition grids is recorded as an indentation, and a text paragraph is formed from one indentation up to the previous row of composition grids of the next indentation.
[0025] In step S1, text processing is performed to obtain a sentence sequence. Specifically, the sentence sequence is obtained by identifying the ending punctuation marks in the essay text and dividing the text into sentences using the ending punctuation marks as sentence boundaries. The ending punctuation marks include periods, question marks, exclamation marks, and ellipses.
[0026] S2. Mask each Chinese character in each sentence of the sentence sequence to obtain multiple first sentences. Use a pre-trained first language model to predict the candidate characters and their probability values at the masked positions of each first sentence. Determine whether the original character is a typo based on the candidate characters and their probability values. If so, replace the original character with the corresponding candidate character. Complete the replacement of all typos in the essay text to obtain the second text. Calculate the language foundation reference score Q1 based on the number of typos.
[0027] In step S2, the process of masking each character in each sentence of the sentence sequence to obtain multiple first sentences is as follows: For the i-th sentence, replace the Chinese character at the j-th position with a preset masking mark, leaving the other characters unchanged, to form a first sentence. The number of Chinese characters contained in the i-th sentence is the number of first sentences obtained from that sentence.
[0028] For example, if the preset masking marker is [MASK], and the original sentence is "I went to school today", by masking "I", the first sentence obtained is "[MASK] went to school today".
[0029] In step S2, the pre-trained first language large model sequentially predicts the candidate characters and their probability values at the corresponding occluded positions for each first sentence, specifically: S21. Obtain the character sequence corresponding to the current first sentence, and add a start marker at the beginning of the character sequence and an end marker at the end; S22. The hidden state vector of each position in the character sequence is obtained through the embedding layer of the first language large model, and the hidden state vectors corresponding to each position of the current first sentence are combined into a hidden state matrix. S23. The hidden state matrix is calculated by a multi-layer Transformer encoder to obtain the final hidden state matrix; S24. Extract the vector corresponding to the position with the preset masking mark in the current first sentence from the final hidden state matrix, and denote it as the first vector. Map the first vector to the preset dictionary through the preset output weight matrix to obtain the logits vector. Apply the softmax function to the logits vector to obtain the probability value of each word in the logits vector. S25. The word with the highest probability value is selected as the candidate character at the corresponding occluded position.
[0030] In step S22, the hidden state vector at each position in the character sequence is processed through the embedding layer of the first language large model, and the hidden state vectors corresponding to each position in the current first sentence are combined to form a hidden state matrix, specifically: The word embedding vector, position embedding vector, and segment embedding vector are obtained for each position in the character sequence through the embedding layer of the first language model. The sum of the three is used as the hidden state vector of the corresponding position. The hidden state vectors corresponding to each position of the current first sentence are combined to form a hidden state matrix.
[0031] In step S23, the hidden state matrix is calculated to obtain the final hidden state matrix through a multi-layer Transformer encoder, specifically as follows: Each Transformer encoder layer uses the hidden state matrix output by the previous Transformer encoder layer as input to perform multi-head self-attention calculation to obtain multi-head attention output. The hidden state matrix of the previous layer and the current multi-head attention output are added together and then normalized to obtain the first output. The current first output is then processed by a feedforward network and added together with the current first output, and then normalized again to obtain the hidden state matrix output by the current Transformer encoder layer. The output of the last Transformer encoder layer is used as the final hidden state matrix.
[0032] The pre-built dictionary refers to the fixed vocabulary used by the first language model (i.e., the pre-trained Chinese masked language model, such as BERT, RoBERTa, etc.) during training and inference, which contains commonly used Chinese characters (Chinese characters in character sets such as GB2312 and GBK). The final hidden state matrix, each row of which corresponds to the final semantic vector (first vector) of a hidden position in the first sentence. This vector integrates the meaning of the character at that position itself and the contextual influence of all other characters in the whole sentence on it. The first vector is mapped to a preset dictionary through a preset output weight matrix to obtain a logits vector. The purpose is to convert the high-dimensional semantic representation (first vector) inside the model into an original score vector (logits) of the same size as the preset dictionary, so that the probability of each dictionary word can be obtained through the softmax function later.
[0033] In step S2, the original character is determined to be a typo based on the candidate character and its probability value. Specifically: If the candidate character at the corresponding obscured position is the same as the corresponding original character, then there is no typo at that position; If the candidate character at the corresponding obscured position is different from the corresponding original character, and the probability value of the candidate character is less than the preset probability threshold, then there is no typo at that position. If the candidate character at the corresponding obscured position is different from the corresponding original character, and the probability value of the candidate character is greater than or equal to the preset probability threshold, then the original character at that position is a misspelling.
[0034] In step S2, the language foundation reference score Q1 is calculated based on the number of spelling errors, specifically as follows: Q1 = A1 - s × kf. If s × kf > KFmax, then let s × kf = KFmax. A1 is the preset full score for basic language skills, s is the number of misspelled words, kf is the preset deduction value for a single misspelled word, and KFmax is the preset maximum deduction value for misspelled words.
[0035] S3. Generate a second text summary based on the second text according to the preset generation requirements using the second language big model, and generate paragraph text summaries based on each text paragraph; calculate the first cosine similarity between the second text summary and the essay title, and calculate the second cosine similarity between each paragraph text summary and the essay title; calculate the relevance reference score Q2 based on the first cosine similarity and each second cosine similarity.
[0036] In step S3, the second language big model calls existing language big model APIs, such as ChatGPT, KimiChat, Tongyi Qianwen, Deepseek, or Wenxin Yiyan, etc.
[0037] In step S3, the preset generation requirements include a preset generation word count, a summary of text content, and a central idea.
[0038] In step S3, the relevance reference score Q2 is calculated based on the first cosine similarity and each of the second cosine similarities, specifically as follows:
[0039] If Q2 > A2, then let Q2 = A2, where A2 is the preset maximum score for relevance, K1 and K2 are preset weights, K1 > K2 and K1 + K2 = 1, Y1 is the first cosine similarity, and N is the number of second cosine similarities greater than or equal to the preset similarity threshold. If N = 0, then... , The second cosine similarity is the i-th value that is greater than or equal to the preset similarity threshold.
[0040] In some embodiments, the generation of the second text summary based on the second text using a second language big model according to preset generation requirements can also be achieved through the following steps: S31. Input the second text and the preset generation requirements as input information into the second language big model to generate a full text summary; S32. Convert the full-text summary and the second text into semantic vectors respectively, calculate the cosine similarity between the two, and if it is greater than or equal to the second preset similarity threshold, it is directly used as the second text summary; otherwise, execute the iterative steps. The iterative steps are as follows: The full-text summary obtained before the current iteration and the second text are input together into the second language big model, and the text information in the second text that is not covered by the full-text summary obtained before the current iteration is extracted as supplementary missing text. The full-text summary, the second text, and the corresponding supplementary missing text obtained before the current iteration are input into the second language big model to generate the full-text summary output after the current iteration, and step S32 is repeated to determine whether to directly use it as the second text summary.
[0041] The iterative summary generation method in this embodiment addresses the issue that a single summary generation may miss key information, especially in long texts or essays with complex logical structures, where the model may only capture surface information and ignore deeper central ideas or argument structures.
[0042] S4. Identify famous quotes from the second text, calculate the third cosine similarity between the famous quote and the essay title, and calculate the fourth cosine similarity between the famous quote and its context. Analyze the applicability of the corresponding famous quote based on the third and fourth cosine similarities, select applicable famous quotes based on the applicability values, and then analyze the essay style reference score based on the number of applicable famous quotes.
[0043] In step S4, the second text identifies famous quotes by comparing them with a preset database of famous quotes.
[0044] In step S4, the fourth cosine similarity between the famous quote and its context is calculated, specifically as follows: Centered on the current famous quote, a context window W is formed by expanding forward M sentences and backward M sentences; The sentences in the context window W are concatenated into a third text. The current quote and the third text are converted into semantic vectors respectively. The fourth cosine similarity is calculated based on the semantic vectors of the current quote and the third text.
[0045] In step S4, the applicability value of the corresponding famous quote is analyzed based on the third cosine similarity and the fourth cosine similarity. Specifically, SY = K3 × Y3 + K4 × Y4, where SY is the applicability value, K3 and K4 are preset weights, K3 + K4 = 1, and Y3 and Y4 are the third cosine similarity and the fourth cosine similarity, respectively.
[0046] In step S4, applicable famous quotes are selected based on their applicability, and then the literary style reference score Q3 is analyzed based on the number of applicable famous quotes. Specifically: Famous sayings with an applicable value greater than or equal to the preset applicable threshold will be considered as applicable famous sayings. Calculate the reference score for writing style Q3: Q3 = K5 × (Ms / Ns) + K6 × Ms; If Q3 > A3, then let Q3 = A3, where A3 is the preset full score for literary talent, K5 and K6 are preset weights, K5 + K6 = 1, Ms is the number of applicable famous quotes, and Ns is the number of famous quotes in the second text.
[0047] Example 2 See Figure 2 As shown, this invention also provides an automatic Chinese essay grading system based on a large language model, specifically including: The processing module obtains the essay text to be graded and performs text processing to obtain the text paragraphs and sentence sequences; The language foundation assessment module performs character-by-character masking on each Chinese character in each sentence of the sentence sequence to obtain multiple first sentences. A pre-trained first language model is used to predict the candidate characters and their probability values at the corresponding masked positions for each first sentence. Based on the candidate characters and their probability values, it is determined whether the corresponding original character is a misspelling. If so, the original character is replaced with the corresponding candidate character. This process is repeated to replace all misspellings in the essay text to obtain the second text. The language foundation reference score Q1 is calculated based on the number of misspellings. The relevance assessment module generates a second text summary based on the second text and paragraph text summaries based on each text segment using a second language big data model based on preset generation requirements. It calculates the first cosine similarity between the second text summary and the essay title, and calculates the second cosine similarity between each paragraph text summary and the essay title. Based on the first cosine similarity and each second cosine similarity, it calculates the relevance reference score Q2. The writing quality assessment module identifies famous quotes from the second text, calculates the third cosine similarity between the famous quote and the essay title, and calculates the fourth cosine similarity between the famous quote and its context. Based on the third and fourth cosine similarities, it analyzes the applicability of the corresponding famous quote, selects applicable famous quotes based on the applicability, and then analyzes the writing quality reference score Q3 based on the number of applicable famous quotes. The comprehensive evaluation module calculates the comprehensive reference score Q, where Q = Q1 + Q2 + Q3.
[0048] Example 3 The present invention also provides an electronic device, including: a processor, a transmitting device, an input device, an output device, and a memory. The processor may be implemented using a general-purpose CPU (Central Processing Unit), a microprocessor, an application-specific integrated circuit, or one or more integrated circuits, and is used to execute relevant programs to implement the technical solutions provided in the embodiments of this application. The memory may be implemented using a read-only memory (ROM), a static storage device, a dynamic storage device, or a random access memory (RAM), and is used to store computer program code. The computer program code includes computer instructions. When the processor executes the computer instructions, the electronic device executes a method as described in any of the above possible implementation methods.
[0049] Example 4 The present invention also provides a computer-readable storage medium storing a computer program, the computer program including program instructions, which, when executed by a processor of an electronic device, cause the processor to perform a method as described in any of the above possible implementations.
[0050] The beneficial effects of this invention are as follows: This invention calculates a language foundation reference score based on the number of misspelled words, a relevance reference score based on the first cosine similarity between the second text summary and the essay title, and the second cosine similarity between each paragraph's text summary and the essay title, and filters out applicable quotations based on the third cosine similarity between the quotations and the essay title and the fourth cosine similarity between the quotations and their context, and then analyzes the literary style reference score based on the number of applicable quotations, thereby achieving multi-dimensional comprehensive correction of Chinese essays and improving the effectiveness and reference value of automatic correction; By generating a second text summary (i.e., a full text summary) and paragraph summaries, the highly condensed semantic representation of the summary effectively filters out redundant details, decorative sentences, and local noise in the original text, allowing the judgment of relevance to focus on the semantic matching degree between the core idea of the text and the question, thereby significantly improving the effectiveness and accuracy of the relevance reference score. By calculating the third cosine similarity between famous quotes and essay topics, and the fourth cosine similarity between famous quotes and their surrounding context, the applicability of these quotes is comprehensively quantified from two dimensions: "content relevance" and "contextual integration." This effectively identifies situations where famous quotes are cited but the content deviates from the theme, or where the quotes themselves are good but their connection to the preceding and following text is awkward. Based on this, applicable famous quotes that truly reflect literary talent are selected. The literary talent reference score obtained based on the number of applicable famous quotes improves the effectiveness and accuracy of the literary talent reference score.
[0051] In the description of this specification, the references to terms such as "an embodiment," "example," "specific example," etc., indicate that a specific feature, structure, material, or characteristic described in connection with that embodiment or example is included in at least one embodiment or example of the present invention. In this specification, the illustrative expressions of the above terms do not necessarily refer to the same embodiment or example. Furthermore, the specific features, structures, materials, or characteristics described may be combined in any suitable manner in one or more embodiments or examples.
[0052] Furthermore, the functional units in the various embodiments of this application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit. If the integrated unit is implemented as a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or all or part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes multiple instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods in the various embodiments of this application. The aforementioned storage medium includes various media capable of storing programs, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.
[0053] The above description is merely a specific embodiment of the present invention, enabling those skilled in the art to understand or implement the invention. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the invention. Therefore, the present invention is not to be limited to the embodiments shown herein, but is to be accorded the widest scope consistent with the principles and novel features claimed herein.
Claims
1. A method for automatic grading of Chinese essays based on a large language model, characterized in that, Includes the following steps: S1. Obtain the essay text to be graded and perform text processing to obtain the text paragraphs and sentence sequences; S2. Mask each Chinese character in each sentence of the sentence sequence to obtain multiple first sentences. Use a pre-trained first language model to predict the candidate characters and their probability values at the masked positions of each first sentence. Determine whether the original character is a typo based on the candidate characters and their probability values. If so, replace the original character with the corresponding candidate character. Complete the replacement of all typos in the essay text to obtain the second text. Calculate the language foundation reference score Q1 based on the number of typos. S3. Generate a second text summary based on the second text according to the preset generation requirements using the second language big model, and generate paragraph text summaries according to each text paragraph; calculate the first cosine similarity between the second text summary and the essay title, and calculate the second cosine similarity between each paragraph text summary and the essay title; calculate the relevance reference score Q2 based on the first cosine similarity and each second cosine similarity. S4. Identify famous quotes from the second text, calculate the third cosine similarity between the famous quotes and the essay title, and calculate the fourth cosine similarity between the famous quotes and their context. Analyze the applicability of the corresponding famous quotes based on the third and fourth cosine similarities, select applicable famous quotes based on the applicability values, and then analyze the essay style reference score Q3 based on the number of applicable famous quotes. S5. Calculate the comprehensive reference score Q, Q=Q1+Q2+Q3; The applicability values of the corresponding famous quotes are analyzed based on the third cosine similarity and the fourth cosine similarity, specifically as follows: SY = K3 × Y3 + K4 × Y4, where SY is the applicable value, K3 and K4 are preset weights, K3 + K4 = 1, and Y3 and Y4 are the third cosine similarity and the fourth cosine similarity, respectively. The language foundation reference score Q1 is calculated based on the number of spelling errors, specifically as follows: Q1 = A1 - s × kf. If s × kf > KFmax, then let s × kf = KFmax. A1 is the preset full score for language basics, s is the number of misspelled words, kf is the preset deduction value for a single misspelled word, and KFmax is the preset upper limit for deduction of misspelled words. The relevance score Q2 is calculated based on the first cosine similarity and each of the second cosine similarities, specifically as follows: ; If Q2 > A2, then let Q2 = A2, where A2 is the preset maximum score for relevance, K1 and K2 are preset weights, K1 > K2 and K1 + K2 = 1, Y1 is the first cosine similarity, and N is the number of second cosine similarities greater than or equal to the preset similarity threshold. The second cosine similarity of the i-th element that is greater than or equal to the preset similarity threshold; Applicable famous quotes are selected based on their applicability value. Then, the literary style reference score Q3 is analyzed based on the number of applicable famous quotes. Specifically, famous quotes with an applicability value greater than or equal to the preset applicability threshold are considered as applicable famous quotes, and the literary style reference score Q3 is calculated: Q3 = K5 × (Ms / Ns) + K6 × Ms; if Q3 > A3, then let Q3 = A3, where A3 is the preset full score for literary style, K5 and K6 are preset weights, K5 + K6 = 1, Ms is the number of applicable famous quotes, and Ns is the number of famous quotes in the second text.
2. The method for automatic grading of Chinese essays based on a large language model according to claim 1, characterized in that, The pre-trained first language large model sequentially predicts the candidate characters and their probability values at the corresponding occluded positions in each first sentence, specifically as follows: Get the character sequence corresponding to the first sentence, and add a start marker at the beginning of the character sequence and an end marker at the end; The hidden state vector at each position in the character sequence is obtained through the embedding layer of the first language large model, and the hidden state vectors corresponding to each position in the current first sentence are combined to form a hidden state matrix. The hidden state matrix is calculated using a multi-layer Transformer encoder to obtain the final hidden state matrix. Extract the vector corresponding to the position with the preset masking mark in the current first sentence from the final hidden state matrix, and denote it as the first vector. Map the first vector to the preset dictionary through the preset output weight matrix to obtain the logits vector. Apply the softmax function to the logits vector to obtain the probability value of each word in the logits vector. The word with the highest probability value is selected as the candidate character at the corresponding occluded position.
3. The method for automatic grading of Chinese essays based on a large language model according to claim 1, characterized in that, The process of masking each Chinese character in each sentence of the sentence sequence to obtain multiple first sentences is as follows: For the i-th sentence, replace the Chinese character at the j-th position with a preset masking mark, while leaving the other Chinese characters unchanged, to form a first sentence. The number of Chinese characters contained in the i-th sentence is the number of first sentences obtained from that sentence.
4. The method for automatic grading of Chinese essays based on a large language model according to claim 2, characterized in that, The hidden state vector of each position in the character sequence is obtained through the embedding layer of the first language big model, and the hidden state vectors corresponding to each position of the current first sentence are combined to form a hidden state matrix. Specifically, the word embedding vector, position embedding vector and segment embedding vector are obtained for each position in the character sequence through the embedding layer of the first language big model, and the sum of the three is used as the hidden state vector of the corresponding position. The hidden state vectors corresponding to each position of the current first sentence are combined to form a hidden state matrix. The hidden state matrix is calculated through a multi-layer Transformer encoder to obtain the final hidden state matrix. Specifically, each Transformer encoder uses the hidden state matrix output by the previous Transformer encoder as input to perform multi-head self-attention calculation to obtain a multi-head attention output. The hidden state matrix of the previous layer and the current multi-head attention output are added together and then normalized to obtain the first output. The current first output is then processed by a feedforward network and added together with the current first output, and then normalized again to obtain the hidden state matrix output by the current Transformer encoder. The output of the last Transformer encoder is used as the final hidden state matrix.
5. The method for automatic grading of Chinese essays based on a large language model according to claim 1, characterized in that, The process involves determining whether the corresponding original character is a typo based on the candidate characters and their probability values. If the candidate character at the corresponding obscured position is the same as the corresponding original character, then there is no typo at that position; If the candidate character at the corresponding obscured position is different from the corresponding original character, and the probability value of the candidate character is less than the preset probability threshold, then there is no typo at that position. If the candidate character at the corresponding obscured position is different from the corresponding original character, and the probability value of the candidate character is greater than or equal to the preset probability threshold, then the original character at that position is a misspelling.
6. The method for automatic grading of Chinese essays based on a large language model according to claim 1, characterized in that, The preset generation requirements include preset word count, summary of text content, and central idea.
7. The method for automatic grading of Chinese essays based on a large language model according to claim 1, characterized in that, Calculate the fourth cosine similarity between the famous quote and its context, specifically as follows: Centered on the current famous quote, a context window W is formed by expanding forward M sentences and backward M sentences; The sentences in the context window W are concatenated into a third text. The current quote and the third text are converted into semantic vectors respectively. The fourth cosine similarity is calculated based on the semantic vectors of the current quote and the third text.
8. An automatic Chinese essay grading system based on a large language model, employing the automatic Chinese essay grading method based on a large language model as described in any one of claims 1 to 7, characterized in that, include: The processing module is used to obtain the essay text to be graded and to perform text processing to obtain the text paragraphs and sentence sequences; The language foundation assessment module is used to mask each Chinese character in each sentence of the sentence sequence to obtain multiple first sentences. The pre-trained first language model predicts the candidate characters and their probability values at the corresponding masked positions for each first sentence. Based on the candidate characters and their probability values, it is determined whether the corresponding original character is a typo. If so, the original character is replaced with the corresponding candidate character. After replacing all typos in the essay text, the second text is obtained. The language foundation reference score Q1 is calculated based on the number of typos. The relevance assessment module is used to generate a second text summary based on the second text according to preset generation requirements using a second language big data model, and to generate paragraph text summaries based on each text paragraph; calculate the first cosine similarity between the second text summary and the essay title, and calculate the second cosine similarity between each paragraph text summary and the essay title; and calculate the relevance reference score Q2 based on the first cosine similarity and each second cosine similarity. The writing quality assessment module is used to identify famous quotes from the second text, calculate the third cosine similarity between the famous quote and the essay title, and calculate the fourth cosine similarity between the famous quote and its context. Based on the third and fourth cosine similarities, the applicability value of the corresponding famous quote is analyzed. Applicable famous quotes are selected based on the applicability value, and the writing quality reference score Q3 is analyzed based on the number of applicable famous quotes. The comprehensive evaluation module is used to calculate the comprehensive reference score Q, where Q = Q1 + Q2 + Q3; The applicability value of the corresponding famous quotes is analyzed based on the third cosine similarity and the fourth cosine similarity. Specifically, SY = K3 × Y3 + K4 × Y4, where SY is the applicability value, K3 and K4 are preset weights, K3 + K4 = 1, and Y3 and Y4 are the third cosine similarity and the fourth cosine similarity, respectively. The language foundation reference score Q1 is calculated based on the number of spelling errors, specifically as follows: Q1 = A1 - s × kf. If s × kf > KFmax, then let s × kf = KFmax. A1 is the preset full score for language basics, s is the number of misspelled words, kf is the preset deduction value for a single misspelled word, and KFmax is the preset upper limit for deduction of misspelled words. The relevance score Q2 is calculated based on the first cosine similarity and each of the second cosine similarities, specifically as follows: ; If Q2 > A2, then let Q2 = A2, where A2 is the preset maximum score for relevance, K1 and K2 are preset weights, K1 > K2 and K1 + K2 = 1, Y1 is the first cosine similarity, and N is the number of second cosine similarities greater than or equal to the preset similarity threshold. The second cosine similarity of the i-th element that is greater than or equal to the preset similarity threshold; Applicable famous quotes are selected based on their applicability value. Then, the literary style reference score Q3 is analyzed based on the number of applicable famous quotes. Specifically, famous quotes with an applicability value greater than or equal to the preset applicability threshold are considered as applicable famous quotes, and the literary style reference score Q3 is calculated: Q3 = K5 × (Ms / Ns) + K6 × Ms; if Q3 > A3, then let Q3 = A3, where A3 is the preset full score for literary style, K5 and K6 are preset weights, K5 + K6 = 1, Ms is the number of applicable famous quotes, and Ns is the number of famous quotes in the second text.
Citation Information
Patent Citations
Student homework intelligent correction method and system
CN118609152A
Composition scoring method and device, equipment and medium
CN121457459A
