Writing stroke correction method, device, equipment, medium and program product
Patent Information
- Application Number
- CN202511568994.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-10-30
- Publication Date
- 2026-10-30
- Estimated Expiration
- 2045-10-30
AI Technical Summary
[0003]然而,传统笔顺评估主要依赖教师人工观察,存在效率低、主观性强的问题,难以在线上教育的场景中进行应用,现有技术多聚焦于静态字形识别,难以准确捕捉动态书写过程中的笔顺错误,无法对连笔、断笔等常见错误类型进行有效判别,制约了教学效果的提升
[0010]本发明一个实施例实现了获取用户书写汉字的轨迹数据;通过笔画时序分类模型,确定轨迹数据对应的用户笔画标签序列,其中,用户笔画标签序列用于表征用户书写汉字的输入笔画顺序;基于标准笔顺规则,匹配用户笔画标签序列和标准笔画标签序列,确定笔顺批改结果;根据笔顺批改结果生成笔顺批改报告。通过轨迹数据精准还原书写过程,利用笔画时序分类模型将动态书写转化为结构化标签序列,再与标准笔顺规则进行多维度匹配,从而实现细粒度、高准确率的笔顺批改,并为用户提供可解释的反馈。
Smart Images

Figure CN121459372B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of online education technology, and in particular to a method, apparatus, device, medium, and program product for correcting the stroke order of handwriting. Background Technology
[0002] Teaching Chinese character writing is an important part of basic education. Mastering the correct stroke order directly affects students' writing efficiency and their understanding of Chinese character structure. With the deep integration of information technology into education, online writing instruction has become a new educational trend.
[0003] However, traditional stroke order assessment mainly relies on teachers' manual observation, which has problems of low efficiency and strong subjectivity, making it difficult to apply in online education scenarios. Existing technologies mostly focus on static character shape recognition, which is difficult to accurately capture stroke order errors in the dynamic writing process and cannot effectively identify common error types such as connected strokes and broken strokes, thus restricting the improvement of teaching effectiveness. Summary of the Invention
[0004] In view of this, embodiments of the present invention provide a method for correcting the writing stroke order. One or more embodiments of the present invention also relate to a writing stroke order correction device, a computing device, a computer-readable storage medium, and a computer program product, to address the technical deficiencies existing in the prior art.
[0005] According to a first aspect of the present invention, a method for correcting the writing stroke order is provided, comprising: Obtain the trajectory data of the user writing Chinese characters; By using a stroke-time classification model, the user stroke label sequence corresponding to the trajectory data is determined. The user stroke label sequence is used to represent the input stroke order of the user writing Chinese characters. Based on standard stroke order rules, the stroke order correction result is determined by matching the user's stroke label sequence with the standard stroke label sequence. Generate a stroke order correction report based on the stroke order correction results.
[0006] According to a second aspect of the present invention, a writing stroke order correction device is provided, comprising: The acquisition module is configured to acquire trajectory data of Chinese characters written by the user; The determination module is configured to determine the user stroke label sequence corresponding to the trajectory data through a stroke temporal classification model, wherein the user stroke label sequence is used to represent the input stroke order of the user writing Chinese characters; The matching module is configured to match the user's stroke label sequence with the standard stroke label sequence based on the standard stroke order rules to determine the stroke order correction result. The generation module is configured to generate a stroke order correction report based on the stroke order correction results.
[0007] According to a third aspect of the present invention, a computing device is provided, comprising: Memory and processor; The memory is used to store computer programs / instructions, and the processor is used to execute the computer programs / instructions. When the computer programs / instructions are executed by the processor, they implement the steps of the above-described method for correcting the writing stroke order.
[0008] According to a fourth aspect of the present invention, a computer-readable storage medium is provided that stores a computer program / instructions, which, when executed by a processor, implement the steps of the above-described method for correcting the writing stroke order.
[0009] According to a fifth aspect of the present invention, a computer program product is provided, including a computer program / instructions that, when executed by a processor, implement the steps of the above-described method for correcting the writing stroke order.
[0010] One embodiment of this invention acquires trajectory data of a user writing Chinese characters; through a stroke temporal classification model, it determines the user's stroke label sequence corresponding to the trajectory data, wherein the user's stroke label sequence is used to represent the input stroke order of the user writing Chinese characters; based on standard stroke order rules, it matches the user's stroke label sequence and the standard stroke label sequence to determine the stroke order correction result; and generates a stroke order correction report based on the stroke order correction result. By accurately reconstructing the writing process through trajectory data, using a stroke temporal classification model to transform dynamic writing into a structured label sequence, and then performing multi-dimensional matching with standard stroke order rules, it achieves fine-grained, high-accuracy stroke order correction and provides interpretable feedback to the user. Attached Figure Description
[0011] Figure 1 This is a flowchart of a method for correcting the stroke order of writing, provided in one embodiment of the present invention; Figure 2 This is a flowchart illustrating the process of a method for correcting the stroke order of writing, provided in one embodiment of the present invention. Figure 3 This is a schematic diagram of the structure of a writing stroke order correction system provided in one embodiment of the present invention; Figure 4 This is a schematic diagram of a writing stroke order correction device provided in one embodiment of the present invention; Figure 5 This is a structural block diagram of a computing device provided in one embodiment of the present invention. Detailed Implementation
[0012] Numerous specific details are set forth in the following description to provide a full understanding of the invention. However, the invention can be practiced in many other ways different from those described herein, and those skilled in the art can make similar extensions without departing from the spirit of the invention. Therefore, the invention is not limited to the specific embodiments disclosed below.
[0013] The terminology used in one or more embodiments of the present invention is for the purpose of describing particular embodiments only and is not intended to limit the scope of the invention. The singular forms “a,” “the,” and “the” used in one or more embodiments of the invention and the appended claims are also intended to include the plural forms unless the context clearly indicates otherwise. It should also be understood that the term “and / or” used in one or more embodiments of the invention refers to and includes any or all possible combinations of one or more associated listed items.
[0014] It should be understood that although the terms first, second, etc., may be used to describe various information in one or more embodiments of the present invention, such information should not be limited to these terms. These terms are only used to distinguish information of the same type from one another. For example, first may also be referred to as second without departing from the scope of one or more embodiments of the present invention, and similarly, second may also be referred to as first. Depending on the context, the word "if" as used herein may be interpreted as "when," "when," or "in response to a determination."
[0015] Furthermore, it should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in one or more embodiments of the present invention are all information and data authorized by the user or fully authorized by all parties. Moreover, the collection, use and processing of related data must comply with the relevant laws, regulations and standards of the relevant countries and regions, and corresponding operation entry points are provided for users to choose to authorize or refuse.
[0016] First, the terminology used in one or more embodiments of the present invention will be explained.
[0017] SVTR (Scene Text Recognition with a Single Visual Model): A single visual model for scene text recognition, an advanced text recognition technology architecture.
[0018] OCR (Optical Character Recognition): A technology that converts text in an image into editable text.
[0019] With the booming development of online education and digital teaching, electronic writing devices such as tablets and smart handwriting screens have been widely used in Chinese language classrooms and home learning scenarios, providing a brand-new interactive platform and data foundation for Chinese character writing instruction. Especially in the basic education stage, the cultivation of Chinese character writing ability remains an important component of core literacy in Chinese language education, and there is an urgent need for intelligent means to support efficient and precise teaching assistance.
[0020] However, in online or self-directed learning environments lacking in-person teacher guidance, students' stroke order accuracy during writing is difficult to monitor effectively and receive timely feedback. Traditional teaching methods, which rely on visual correction by teachers, cannot be replicated in remote settings, leading to stroke order errors remaining uncorrected for extended periods and impacting the development of good writing habits and understanding of Chinese character structure.
[0021] Currently, the mainstream technology mainly relies on optical character recognition (OCR) to statically recognize handwritten Chinese characters and determine whether the final character shape is correct. This method focuses on "what character is written," confirming the accuracy of the text content by comparing it with a standard character set, and is widely used in scenarios such as automatic homework grading and handwriting input.
[0022] However, such technologies only focus on the writing result and completely ignore the dynamic information of the writing process. They cannot obtain the order of strokes, writing direction and connection status, so they cannot identify whether the stroke order conforms to the standard, and they cannot diagnose and provide feedback on typical errors such as extra strokes, missing strokes, connected strokes, and reversed strokes. Therefore, they cannot meet the core needs of teaching Chinese character stroke order.
[0023] To address the aforementioned issues, this invention introduces an improved SVTR model to analyze the temporal characteristics of the writing process in real time from ordinary visual signals, achieving accurate identification of stroke type, order, and direction. Based on this, an objective and unified stroke order evaluation system is constructed, which can not only automatically detect various stroke order errors, but also generate traceable and interpretable personalized feedback based on individual user differences. Thus, in a digital teaching scenario without teacher intervention, it effectively supports the standardized learning and intelligent correction of Chinese character stroke order.
[0024] This invention provides a method for correcting the writing stroke order. It also relates to a writing stroke order correction device, a computing device, a computer-readable storage medium, and a computer program product, which will be described in detail in the following embodiments.
[0025] See Figure 1 , Figure 1 This is a flowchart of a method for correcting the stroke order of writing provided in an embodiment of the present invention, which specifically includes the following steps.
[0026] Step 102: Obtain the trajectory data of the user writing Chinese characters.
[0027] Herein, the trajectory data refers to time-series handwriting information generated when a user writes Chinese characters on an electronic writing device, which includes a point coordinate sequence, timestamps, and pressure values, and is used to represent the position change of the pen tip on the plane, the writing moment, and the applied force intensity during the writing process.
[0028] In practical applications, the system collects raw signals during the user's writing process in real time through a touch or electromagnetic induction system built into the electronic writing device. When the user writes in the writing area using a stylus or a finger, the device continuously records the position of the pen tip at each moment at a fixed sampling frequency to form a point coordinate sequence composed of horizontal and vertical coordinates (x,y); at the same time, the timestamp (t) corresponding to each coordinate point is synchronously recorded to reflect the chronological order of writing; in addition, if the device supports pressure sensing, the pressure value (p) of each point will also be collected synchronously to assist in judging pen-down and pen-up actions as well as stroke thickness changes. During the collection process, the system continuously monitors writing events, starts recording from the user's first pen-down until the final pen-up ends, ensuring that the entire writing process of a single Chinese character is completely covered. The obtained raw trajectory data is stored in a structured form, usually a list containing multiple data points, each of which contains coordinate, time and pressure information, constituting the raw input for subsequent preprocessing and model analysis.
[0029] For the step of "acquiring trajectory data of Chinese characters written by the user", one optional manner is to collect trajectory data through a capacitive touch screen paired with an active stylus, which is applicable to ordinary tablet devices and can obtain high-frequency coordinate and time information; another optional implementation manner is to use a graphics tablet system adopting Electromagnetic Resonance (EMR) or Active Electrostatic (AES) technology, which can capture coordinate, time and pressure information with high precision at the same time, and is suitable for educational or professional scenarios with higher requirements for writing details.
[0030] In a specific embodiment of the present invention, the user writes the Chinese character "Yong" on a smart learning terminal equipped with a touch screen. The system starts data collection when detecting that the stylus first contacts the screen, continuously records the pen tip position at a frequency of 200 times per second to obtain a series of (x,y) coordinate points; at the same time, the system timestamp corresponding to each coordinate point is recorded, which is accurate to the millisecond level; since the terminal supports pressure sensing, the system also synchronously acquires the pressure value of each point, ranging from 0 to 255. Throughout the writing process, from the pen-down of the first stroke "dot" to the pen-up of the last stroke "right-falling stroke", the system collects a total of 428 trajectory points, each of which contains (x,y,t,p) quadruple information. After the collection is completed, the system encapsulates the trajectory data into a structured data object and transmits it to the next processing module. The entire collection process is completed in real time in the background, which does not affect the user's normal writing experience, and ensures data integrity and timing consistency.
[0031] Step 104: Determine the user stroke label sequence corresponding to the trajectory data through the stroke temporal classification model. The user stroke label sequence is used to represent the input stroke order of the user writing Chinese characters.
[0032] Among them, the user stroke label sequence refers to an ordered sequence consisting of integers or sets of integers. Each element corresponds to an actual stroke written by the user. Its value is used to represent the corresponding position or attribute of the stroke in the standard stroke order. For example, a single positive integer represents matching a certain standard stroke, multiple positive integers represent connected strokes, 0 represents redundant strokes, and -1 represents ignored items. This sequence is used to represent the input stroke order of the user's Chinese characters and its mapping relationship with the standard stroke order.
[0033] In practical applications, the system first preprocesses the acquired raw trajectory data, including identifying pen lifting and lowering events based on pressure values and timestamps, and segmenting the continuous trajectory into several discrete strokes. Then, the trajectory points of each stroke are rendered into image frames in chronological order, and all frames are stitched together according to the writing sequence to form a temporal feature image sequence. This sequence preserves both spatial morphology and encodes the writing dynamics. Next, this temporal feature image sequence is input into a pre-trained stroke temporal classification model. This model is based on an improved SVTR architecture, and its task objective has been changed from character recognition and reconstruction to stroke temporal classification. Internally, the model replaces "character components" with "stroke components" to adapt to basic stroke types such as horizontal, vertical, left-falling, and right-falling strokes. During inference, the model analyzes the input sequence frame by frame or stroke by stroke, outputting a label vector sequence that corresponds one-to-one with the user's actual written strokes—the user stroke label sequence. Each label vector can contain one or more integers, reflecting the standardized stroke order number or special mark corresponding to that stroke.
[0034] For the step "determine the user stroke label sequence corresponding to the trajectory data through the stroke temporal classification model", one option is to use an end-to-end trained convolutional-attention hybrid model, directly taking the original trajectory point sequence (after normalization) as input, and outputting the label sequence through temporal modeling; another option is to first convert the trajectory data into an image frame sequence, and then process it using a visual Transformer or an improved SVTR model. This method makes fuller use of spatial morphological information and is suitable for the recognition of complex stroke types.
[0035] In a specific embodiment of the present invention, when a user writes the Chinese character "shui" (water), after the system collects the trajectory data, it first identifies three pen-down events according to pressure mutations and time intervals, and segments the data into three actual strokes. Subsequently, the trajectory points of each stroke are respectively rendered into a 28×28 pixel binary image, which are arranged into a three-frame image sequence in the writing order. This sequence is spliced with the final writing result image to form a composite input image containing temporal context. The system inputs this image into a stroke temporal classification model. After multi-layer feature extraction and temporal alignment, the model outputs the user's stroke label sequence as [[1],[2,3],[4]]. The first stroke corresponds to the standard first stroke "vertical hook", the second stroke is recognized by the model as corresponding to both the standard second and third strokes because the user writes the "horizontal-pie" stroke in a connected manner, and the third stroke corresponds to the standard fourth stroke "na" (right-falling stroke). This label sequence completely reflects the mapping relationship between the stroke order and structure during the user's writing process, and serves as the direct input for the subsequent comparison module.
[0036] Further, the trajectory data includes a point coordinate sequence, time information and pressure information; determining the user stroke label sequence corresponding to the trajectory data through the stroke temporal classification model includes: segmenting the point coordinate sequence into a plurality of user strokes based on the time information and the pressure information, wherein each user stroke corresponds to a trajectory point sequence; arranging the trajectory point sequences of the respective user strokes in chronological order according to the time information to obtain an image stroke frame sequence, wherein the image stroke frame sequence is used to represent the writing state at each time point; splicing the image stroke frame sequence with the image of the Chinese character written by the user to form a temporal feature sequence, and inputting the temporal feature sequence into the stroke temporal classification model to obtain the user stroke label sequence.
[0037] The point coordinate sequence represents the position record of the continuous movement of the pen tip on the plane during the user's writing process, and is composed of a series of (x,y) coordinates; the time information refers to the collection time corresponding to each coordinate point, which is used to reflect the writing sequence and speed change; the pressure information refers to the force value exerted by the pen tip on the screen during writing, which is used to assist in judging the pen-down and pen-up actions; the user stroke refers to a writing unit formed between one continuous pen-down action and the subsequent pen-up action, corresponding to a continuous trajectory point sequence; the image stroke frame sequence is a sequence formed by arranging the images generated by rendering each user stroke in the writing order, which is used to represent the writing state at each time point; the temporal feature sequence is a composite input formed by splicing the image stroke frame sequence and the image of the finally written Chinese character, which is used to encode the writing process dynamics and the final character structure at the same time.
[0038] In practical applications, the system first receives raw trajectory data containing a sequence of point coordinates, time information, and pressure information. Then, based on abrupt changes in the pressure information (e.g., an abrupt rise from zero to non-zero indicates pen-down, and an abrupt drop from non-zero to zero indicates pen-lift) combined with time intervals (a long period with no points is regarded as pen-lift), the continuous sequence of point coordinates is segmented into several discrete user strokes, where each user stroke corresponds to a continuous sequence of trajectory points. Next, the system sorts these user strokes according to the time information to ensure their order is consistent with the actual writing process. After that, the trajectory point sequence of each user stroke is rendered into a binary image of a fixed size (for example, 28×28 pixels) to form an image stroke frame, and all frames are arranged in the writing order to constitute an image stroke frame sequence. At the same time, the system performs normalization processing on the complete Chinese character image finally written by the user. Finally, the image stroke frame sequence and the complete Chinese character image are concatenated in the channel or spatial dimension to form a unified temporal feature sequence, which is input into a pre-trained stroke temporal classification model, and the model outputs a user stroke label sequence accordingly.
[0039] For the step "obtaining a user stroke label sequence based on trajectory data and a stroke temporal classification model", an optional manner is concatenation in the spatial dimension, that is, each frame of image stroke and the complete Chinese character image are concatenated horizontally or vertically to form a wider or taller input image; another optional implementation manner is concatenation in the channel dimension, where the complete Chinese character image is used as an additional channel to be stacked with the image stroke frame sequence to form a multi-channel temporal input, so as to preserve the independence of each frame while introducing global glyph context.
[0040] In a specific embodiment of the present invention, a user writes the Chinese character "tian", and the system collects raw data containing 512 trajectory points, each point including a (x,y,t,p) quadruple. The system detects two events where the pressure jumps from 0 to non-zero, and in combination with a silent period with a time interval greater than 200 milliseconds, segments the trajectory into two user strokes: the first stroke is "horizontal", including the first 120 points; the second stroke is a continuous writing of "pie and na", including the last 392 points. Then, the system renders the two segments of trajectories into two frames of 28×28 binary images in chronological order to form an image stroke frame sequence. At the same time, the overall image of the character "tian" finally written by the user is normalized to 28×28 pixels. The system concatenates the two frames of stroke images and the complete character image in the channel dimension to form a 28×28×3 temporal feature tensor. The tensor is input into the stroke temporal classification model, and the model outputs the user stroke label sequence as [[1],[2,3]], which accurately reflects the situation that the user's first stroke is correct, and in the second stroke, the standard second stroke "pie" and the third stroke "na" are written continuously.
[0041] Based on this, the system achieves accurate stroke segmentation by integrating time and pressure information, and constructs a temporal feature sequence that includes process dynamics and global character shape, enabling the model to simultaneously perceive local stroke shape and overall writing context, significantly improving the accuracy and robustness of stroke order recognition.
[0042] Step 106: Based on the standard stroke order rules, match the user's stroke label sequence with the standard stroke label sequence to determine the stroke order correction result.
[0043] The standard stroke label sequence refers to the stroke order sequence defined according to the Chinese character writing standards stipulated by the state or education department. Each element is a positive integer starting from 1 and corresponding to the first stroke, second stroke, ... Nth stroke in the standard writing. The stroke order correction result refers to the judgment conclusion on whether the user's writing behavior conforms to the standard in terms of order, quantity, and structure, including types such as correct, incorrect, extra strokes, missing strokes, connected strokes, and broken strokes.
[0044] In practical applications, the system first retrieves the total number of standard strokes and the standard stroke label sequence corresponding to the currently written Chinese character from the Chinese character knowledge base. Then, it logically compares each element in the user's stroke label sequence with the standard sequence. The system initializes a used label set to record the standard stroke numbers that have been correctly matched and iterates through each stroke label in the user's sequence: if the label is a single positive integer equal to the size of the used set plus one, it is considered correct; if the label value already appears in the set, it is considered a duplicate and marked as a multiple-stroke error; if the label value is less than but not in order, it is considered a stroke order error; if the label contains multiple positive integers and no special values, it is considered a continuous stroke; if the label contains 0, it is marked as a redundant stroke; if it contains -1, the stroke is ignored and not included in the evaluation. Furthermore, the system checks whether adjacent strokes have the same standard label appearing repeatedly to identify broken stroke errors. The entire matching process strictly follows the standard stroke order rules to ensure the consistency and objectivity of the correction logic.
[0045] For the step "Based on the standard stroke order rules, match the user stroke label sequence and the standard stroke label sequence to determine the stroke order correction result", one option is to use a state machine-driven sequential verification mechanism, which verifies each stroke by maintaining the current expected stroke number and the processed state; another option is to construct an alignment matrix between user labels and standard labels, use a dynamic programming algorithm to find the optimal matching path, and classify the error type based on the path features.
[0046] In a specific embodiment of the present invention, a user writes the Chinese character "木", and the system retrieves its standard stroke label sequence from the knowledge base as [1, 2, 3, 4], corresponding to four strokes: horizontal, vertical, left-falling, and right-falling. The stroke label sequence actually output by the user is [[1],[3],[2],[4]]. The system initializes the used label set as empty, traverses the first stroke [1], marks it as correct because 1 is equal to 0+1, and updates the set to {1}; for the second stroke [3], since 3 is not equal to 1+1 and is not in the set, it is marked as a stroke order error, and the set is not updated temporarily; for the third stroke [2], at this time 2 is still not equal to the current expected value 2 (because the second stroke was not completed correctly), but 2 is not in the set, so it is still marked as a stroke order error; for the fourth stroke [4], the expected value is confused due to the previous errors, but 4 is not used and is the last stroke, so it is determined to be correct in combination with the context. Finally, the system outputs the correction result as [CORRECT, WRONG, WRONG, CORRECT]. The entire matching process is strictly based on standard rules, without introducing subjective judgment, ensuring the result is reproducible.
[0047] Further, matching the user stroke label sequence and the standard stroke label sequence based on standard stroke order rules to determine a stroke order correction result includes: traversing each user stroke label in the user stroke label sequence, matching with the standard stroke label sequence based on the standard stroke order rules to determine the stroke order correction result of the user stroke label; generating the stroke order correction result according to the stroke order correction result of each user stroke label.
[0048] Wherein, the standard stroke order rule refers to the Chinese character writing order criterion defined by national language and character specifications or educational standards, which is embodied as a standard stroke label sequence, that is, an integer sequence that continuously increases starting from 1, and each integer uniquely corresponds to one standard stroke; the user stroke label refers to each element in the user stroke label sequence, which can be a single positive integer, a set of multiple positive integers, 0 (redundant stroke) or -1 (ignored item); the stroke order correction result refers to the judgment conclusion on whether each user stroke label conforms to the standard rule, including types such as CORRECT, WRONG (order error), CONNECTED (connected strokes), MULTI (multiple strokes), BROKEN (broken stroke); the final stroke order correction result is a sequence composed of the judgment results of each user stroke label in the writing order.
[0049] In practical applications, the system first obtains the total number of standard strokes N corresponding to the current Chinese character from the Chinese character standard knowledge base, and constructs a standard stroke label sequence [1,2,3,...,N]. Subsequently, the system initializes a set of matched standard strokes used_set and the current expected stroke number expected=1. Next, iterate through each user stroke label in the user stroke label sequence: if the label is a single positive integer v, check if v is equal to expected; if they are equal, mark it as CORRECT, add v to used_set, and increment expected by 1; if v is less than expected and is already in used_set, mark it as MULTI; if v is greater than expected but not in order, mark it as WRONG; if the label is a list containing multiple positive integers (e.g., [2,3]), check if these integers are consecutive and start from expected; if so, mark it as CONNECTED, add all related numbers to used_set, and update expected to the maximum value + 1; if the label is [0], mark it as MULTI; if the label is [-1], mark it as IGNORE and skip it. In addition, if the same standard stroke number is written multiple times in a non-contiguous case (e.g., [2], [2] appear consecutively), the last one is marked as BROKEN. After the traversal is complete, the system will combine the judgment results corresponding to each user's strokes in order to form a complete stroke order correction result sequence.
[0050] For the step "matching user stroke label sequences and standard stroke label sequences based on standard stroke order rules to determine the stroke order correction result", one option is to use a state-driven sequential verification mechanism to achieve linear matching by maintaining the expected pointer and used_set; another option is to construct an alignment graph between user labels and standard labels, use a finite state automaton (FSA) to identify legal and illegal conversion paths, and classify error types accordingly.
[0051] In a specific embodiment of the present invention, the user writes the Chinese character "木", and the standard stroke label sequence is [1,2,3,4]. The user's stroke label sequence is [[1],[3],[2],[4]]. The system initializes used_set=∅, expected=1. Process the first stroke [1]: 1==expected, mark it as CORRECT, used_set={1}, expected=2. Process the second stroke [3]: 3≠2 and 3 is unused, but 2 is skipped, mark it as WRONG, used_set remains {1}, expected stays at 2. Process the third stroke [2]: 2==expected, but due to the abnormal context caused by the previous error, the system still determines it as WRONG (because the standard rule requires a strict order, and 2 should be before 3), or marks it as CORRECT and updates the status according to the fault tolerance strategy; this embodiment adopts the strict strategy, marks it as WRONG, used_set={1}, expected remains unchanged. Process the fourth stroke [4]: 4 is unused, but expected is still 2, the system checks whether it is the last stroke and the rest of the strokes are covered, and determines it as CORRECT in combination with the rules. The final stroke order correction result is [CORRECT, WRONG, WRONG, CORRECT]. This result completely reflects the problem that the order of the 2nd and 3rd strokes is reversed in the user's writing.
[0052] Based on this, the system precisely aligns the user's writing behavior with the standard stroke order through a stroke-by-stroke traversal and rule-driven matching mechanism, which not only identifies order errors, but also distinguishes complex situations such as joined strokes, extra strokes, and broken strokes, providing a logically rigorous and fine-grained determination basis for the subsequent generation of an interpretable correction report.
[0053] Further, determining the stroke order correction result of the user's stroke label includes: querying whether the current user's stroke label is an invalid label based on the standard stroke order rule and the standard stroke label sequence, where the invalid label is a label indicating that no stroke is recognized; if yes, determining that the stroke order correction result of the current user's stroke label is an unknown error; if not, judging the basic stroke compliance of the current user's stroke label based on the standard stroke label sequence.
[0054] Herein, the invalid label refers to a special mark that cannot correspond to any standard stroke semantics, which is usually used to represent the situation where the model does not recognize a valid stroke, such as an empty label, an all-zero vector, or a preset placeholder (for example, [-1] means to be ignored in some contexts, but is regarded as invalid if there is no corresponding semantics in stroke order determination); the unknown error refers to a correction result that cannot be classified into a known error type (such as joined strokes, extra strokes, etc.) due to an invalid label; the basic stroke compliance refers to whether the user's stroke label meets the basic legitimacy requirements in terms of numerical range, structural form, and mapping relationship with the standard sequence, and its specific determination logic will be expanded in subsequent steps.
[0055] In practical applications, when traversing the user's stroke tag sequence, the system first queries the current user's stroke tag according to predefined invalid tag rules. These rules are constrained by both the standard stroke order rules and the standard stroke tag sequence. For example, if the total number of standard strokes is N, any tag containing integers less than 0 or greater than N+1, non-integer elements, empty lists, or tags that do not conform to the continuous stroke format (such as non-contiguous integers) may be initially considered invalid. However, whether a tag is specifically determined as invalid depends on its context within the overall sequence. The system matches the current user's stroke tag against the invalid tag pattern library. If it fully matches any invalid pattern, the stroke order correction result is determined to be "unknown error." If it does not match, the tag is considered to have basic semantic validity and proceeds to the subsequent stroke basic compliance judgment process. This step only completes the initial validity screening and does not involve deep rule verification such as order, quantity, or continuity, reserving a logical interface for the subsequent compliance analysis.
[0056] For the step "determine the stroke order correction result of the user's stroke label", one option is to quickly filter invalid labels based on regular expressions or type checks; another option is to perform constant-time judgment by querying a pre-built invalid label hash table to improve processing efficiency.
[0057] In one specific embodiment of the present invention, when a user writes a Chinese character, if the pen tip briefly slides and fails to form a valid stroke, the model outputs an empty list [] as a stroke label for that user. After obtaining this label, the system, based on the standard stroke label sequence [1,2,3,4] and the invalid label definition rules, determines that the empty list does not belong to any valid stroke representation (it is neither a single positive integer, nor a continuous set of integers, nor a preset valid special value such as 0 or -1), and therefore classifies it as an invalid label. The system then determines that the stroke order correction result for this user's stroke label is "unknown error" and records the positional anomaly, but does not perform subsequent compliance analysis, leaving it for processing other valid labels in later steps.
[0058] Based on this, the system effectively isolates abnormal inputs caused by recognition failures through a pre-emptive invalid label screening mechanism, avoids misjudging meaningless labels as specific stroke order errors, and ensures the logical purity of subsequent compliance judgments.
[0059] Furthermore, the basic compliance of strokes includes whether there are multiple stroke errors and whether there are consecutive stroke errors; the judgment based on the standard stroke label sequence to determine the basic compliance of the current user's stroke labels includes: based on the standard stroke label sequence, determining whether the current user's stroke labels contain redundant stroke labels, wherein redundant stroke labels are stroke labels not included in the standard stroke label sequence; if so, it is determined that the stroke order correction result of the current user's stroke labels is multiple stroke errors; if not, it is determined whether the current user's stroke labels contain consecutive stroke errors.
[0060] Among them, stroke basic compliance refers to whether the user's stroke labels meet the basic requirements of the standard stroke order rules in terms of both numerical legality and reasonable combination. Redundant stroke labels refer to positive integer numbers in the user's stroke labels that are not within the range of the standard stroke label sequence. For example, the maximum standard sequence number is 4, but the label contains 5. Multiple stroke errors refer to the user writing extra strokes that do not exist in the standard stroke order, and their labels are marked as redundant stroke labels. Continuous stroke errors refer to the user merging two or more consecutive standard strokes that should be written separately into one stroke, which is manifested as the user's stroke labels containing multiple consecutive positive integers. However, whether this merging behavior constitutes an error needs to be further judged in conjunction with the standard rules. Here, only the identification of whether there is a continuous stroke form is completed.
[0061] In practical applications, after confirming that the current user's stroke label is not invalid, the system first extracts all positive integer elements from the label (ignoring special values such as 0 or -1) to form a set of stroke numbers to be checked. Then, the system obtains the standard stroke label sequence corresponding to the current Chinese character, typically a set of consecutive integers from 1 to N. The system iterates through each element in the set of stroke numbers to be checked, checking if it belongs to the standard stroke label sequence: if any element is not in the standard sequence (e.g., greater than N or less than 1), the system determines that the user's stroke label contains redundant stroke labels, immediately classifies its stroke order correction result as "multiple stroke errors," and terminates further compliance analysis of the current label. If all elements are within the standard sequence range, the system further checks whether the label contains two or more positive integers: if so, it determines that there is a continuous stroke form and enters the continuous stroke error judgment sub-process; if it is only a single positive integer, it is considered that there are no multiple strokes or continuous strokes, and basic compliance is passed, leaving subsequent steps to judge issues such as order or repetition. This process strictly relies on the standard stroke label sequence as the legality boundary to ensure objective and consistent judgment.
[0062] For the step "Judging the basic compliance of the current user's stroke label based on the standard stroke label sequence", one option is to store the standard stroke label sequence as a set structure and realize the redundant label detection with O(1) time complexity through member query; another option is to pre-calculate the maximum number N of the standard sequence, quickly filter out obviously out-of-bounds labels by judging only the numerical range (1≤v≤N), and then perform accurate verification on the labels within the boundary, which is suitable for large-scale batch processing scenarios.
[0063] In a specific embodiment of the present invention, a user writes the Chinese character "shui" (water), whose standard stroke label sequence is [1, 2, 3, 4]. The currently processed user stroke labels are [2, 5]. The system first extracts the positive integer elements {2, 5}, and queries the range of the standard sequence. Since 5>4 and is not in the standard sequence, the system determines that an extra stroke label is included, and then confirms that the stroke order correction result for this user's stroke labels is "extra stroke error". In another case, the user's stroke labels are [2, 3], all elements are within the range of [1, 4], the system determines that there are no extra strokes, and then recognizes that there is a cursive stroke form because the labels contain two elements, and enters the cursive stroke error judgment process. The whole process only focuses on the inclusion relationship between the label content and the standard sequence as well as the number of elements, and does not involve the writing order or temporal context.
[0064] Based on this, the system realizes accurate interception of extra stroke errors and preliminary identification of cursive stroke forms by strictly comparing the numerical range and element composition of the user's stroke labels and the standard stroke label sequence, which provides structured input for subsequently distinguishing legitimate cursive strokes from non-compliant cursive strokes.
[0065] Further, judging whether there is a cursive stroke error in the current user's stroke labels includes: judging whether the standard stroke label sequence contains a plurality of identical standard stroke labels; if yes, determining that the stroke order correction result of the current user's stroke labels is cursive writing; if not, checking the stroke order correctness of the user's stroke label sequence.
[0066] Herein, the cursive stroke error means that the user combines two different standard strokes that should have been written separately twice or more into one continuous writing, and this combination behavior does not conform to the standard stroke order rules; cursive writing here specifically refers to a cursive stroke behavior judged to be compliant (such as connected writing allowed in certain fonts), but is used as an intermediate judgment state in this step; that the standard stroke label sequence contains a plurality of identical standard stroke labels means that there are elements with repeated values in the standard sequence, for example, [1, 2, 2, 3] indicates that the second and third strokes are both strokes of the same type (such as two "dots"), in this case, it may be considered permissible for the user to write these two strokes in a connected manner; the stroke order correctness of the user's stroke label sequence refers to whether the writing order of each of the user's strokes strictly follows the sequential relationship of the standard sequence, and the specific inspection logic thereof is developed in subsequent steps.
[0067] In practical applications, after the system confirms that the current user's stroke label does not contain redundant strokes and includes two or more positive integers, it enters the joined-stroke error judgment process. The system first extracts all standard stroke numbers in the user's stroke label, for example, [2,3]. Subsequently, the system queries the standard stroke label sequence corresponding to the current Chinese character, and checks whether there are any two or more positions with the same stroke number (i.e., repeated values). If there are indeed repeated numbers in the standard sequence (for example, the standard sequence of the Chinese character "Xiao" is [1,2,2], which contains two "dots"), the system considers that the user's joined writing of these strokes of the same type is within the acceptable range, and determines that the stroke order correction result of the current user's stroke label is "joined-stroke writing" (that is, non-error joined strokes); if all numbers in the standard sequence are unique (for example, the standard sequence of the Chinese character "Mu" is [1,2,3,4]), any joined writing of two different numbers by the user is regarded as non-compliant, but this step does not directly determine it as an error for the time being. Instead, the label is marked as having a joined-stroke form, and is sent to the subsequent step of "checking the stroke order correctness of the user's stroke label sequence" to comprehensively judge in the context whether a joined-stroke error is constituted. This design avoids misjudging the joined writing behavior of legal repeated strokes at the local label level.
[0068] For the step of "judging whether there is a joined-stroke error in the current user's stroke label", an optional method is to pre-construct a multiset of standard stroke labels for each Chinese character, and quickly judge whether there is repetition by counting the occurrence frequency of each number; another optional implementation manner is to explicitly mark the stroke pairs allowed for joined writing in the standard knowledge base, and only when the user's joined writing combination matches the list, it is regarded as compliant, which is applicable to scenarios with clear teaching definitions for joined-stroke rules.
[0069] In a specific embodiment of the present invention, the user writes the Chinese character "Xiao", whose standard stroke label sequence is [1,2,2], indicating that the first stroke is "vertical hook", and both the second and third strokes are "dots". The user joins the two "dots" into one stroke, and the output user stroke label is [2,2]. The system detects that the label contains multiple identical numbers, and then queries the standard sequence, finding that the number 2 does appear twice, so it is determined that the joined writing behavior is the joined writing of repeated strokes allowed by the standard, and the stroke order correction result is determined as "joined-stroke writing". In another situation, the user writes the Chinese character "Mu", whose standard sequence is [1,2,3,4], and the user outputs the label [2,3]. The system queries the standard sequence, finds that both 2 and 3 appear uniquely with no repeated numbers, so it does not determine it as a compliant joined stroke, but transmits the label to the subsequent steps, and judges in combination with the overall order whether a joined-stroke error is constituted.
[0070] Based on this, by checking whether there are repeated numbers in the standard stroke label sequence, the system effectively distinguishes legal joined strokes caused by repeated stroke types from illegal joined strokes caused by order confusion, avoids misjudgment of Chinese characters with repeated strokes, and improves the semantic accuracy of joined-stroke recognition.
[0071] Further, checking the stroke order correctness of the user's stroke label sequence includes: creating a set of matched labels, wherein the set of matched labels is used to record user stroke labels that have been correctly matched; and checking the stroke order correctness of the user's stroke label sequence based on the current user stroke labels and the set of matched labels.
[0072] Among them, the matched tag set refers to a dynamically updated set data structure used to record the standard stroke numbers corresponding to the user stroke tags that have been confirmed by the system as correct and in the correct order during the user's writing process; the current user stroke tag refers to the user stroke tag being verified, the content of which is one or more standard stroke numbers; the correctness of stroke order refers to whether the order in which the user writes each stroke strictly follows the ascending order of the standard stroke tag sequence, and skipping, backtracking or disordering is not allowed.
[0073] In practical applications, after initial screening for multiple strokes and consecutive strokes, the system enters the stroke order correctness check stage. The system initializes an empty set of matched tags and sets the standard stroke number expected to match to 1. When processing the current user's stroke tag, the system first parses all the standard stroke numbers it contains. If the tag is a single number v, it checks if v is equal to the current expected number: if so, v is added to the set of matched tags, the current expected number is incremented by 1, and the stroke is marked as CORRECT; if v is less than the current expected number and is already in the set of matched tags, it is considered a duplicate and marked as BROKEN or multiple strokes; if v is greater than the current expected number, it indicates that intermediate strokes were skipped and is marked as WRONG. If the tag has multiple numbers (e.g., [v1, v2, ..., v...]), it is considered a duplicate. k The system first verifies whether these numbers form a continuous increasing sequence starting from the current expected number (i.e., v1=expected, v2=expected+1,…). If so, all numbers are added to the set of matched labels, and the expected number is updated to v. k +1 and mark it as CONNECTED; if it is not consecutive or the starting number does not match, it is considered an order error and marked as WRONG. The entire process relies on the set of matched tags to ensure that each standard stroke is matched correctly only once, and the order is irreversible.
[0074] For the step "Check the correctness of the stroke order of the user's stroke label sequence", one option is to maintain only the current expected number without explicitly storing the matched set, and implicitly guarantee uniqueness through sequential increment logic; another option is to maintain both the matched set and the expected number to support more complex fault tolerance strategies (such as allowing partial backtracking or skipping specific strokes), which is suitable for advanced teaching scenarios.
[0075] In a specific embodiment of the present invention, a user writes the Chinese character "Yong", and the standard stroke label sequence is [1, 2, 3, 4, 5]. The system initializes the matched label set as ∅, and the expected number is 1. The user label of the first stroke is [1], which is equal to the expected number, marked as CORRECT, the set is updated to {1}, and the expected number becomes 2. The label of the second stroke is [3], which is not equal to 2 and 3 is not in the set, but 2 is skipped, the system determines it as WRONG, the set remains unchanged, and the expected number is still 2. The label of the third stroke is [2], which is equal to the current expected number, but since 3 has appeared in the preceding sequence, the system still determines it as WRONG in combination with the context (or refuses to accept the lagging stroke in the strict mode), and the set is not updated. The label of the fourth stroke is [4], the expected number is still 2, 4 has not been matched and is not consecutive, marked as WRONG. The label of the fifth stroke is [5], which is marked as WRONG in the same way. The entire checking process strictly relies on the collaborative state of the matched label set and the expected number to ensure rigorous sequence logic.
[0076] Based on this, the system dynamically maintains the matched label set and the expected number, realizes real-time and strict verification of the user's writing order, effectively identifies typical stroke order errors such as stroke skipping, reversed strokes, and lagging supplementary writing, and provides timing consistency guarantee for generating high-precision correction results.
[0077] Further, each user stroke label corresponds to a standard stroke order number; based on the current user stroke label and the matched label set, checking the stroke order correctness of the user stroke label sequence includes: obtaining the number of elements in the matched label set; taking the starting stroke label in the user stroke label sequence as the current stroke label, and obtaining the standard stroke order number corresponding to the current stroke label; judging whether the current standard stroke order number is equal to the number of elements plus one; if yes, adding the current stroke label to the matched label set, taking the subsequent stroke label of the current stroke label as the current stroke label, and returning to execute the step of obtaining the standard stroke order number corresponding to the current stroke label; if not, determining that the stroke order correction result of the current user stroke label is a stroke order error.
[0078] Herein, that each user stroke label corresponds to a standard stroke order number means that each positive integer element in the user stroke label is mapped to a specific stroke position number in the standard stroke order (for example, 1 represents the first stroke "horizontal"); the matched label set refers to a set that records the standard stroke order numbers corresponding to the user strokes that have been confirmed by the system to be written correctly in sequence; the number of elements is the number of standard stroke order numbers already contained in the set, which is used to deduce the number of the stroke that should be written currently (i.e., the number of elements plus one); the current stroke label refers to the user stroke label that is being verified; the subsequent stroke label refers to the next label immediately following the current stroke label in the user stroke label sequence.
[0079] In practical applications, after the system enters the stroke order correctness checking phase, it first acquires the number of elements in the matched label set, which is denoted as matched_count. Then, the starting stroke label in the user's stroke label sequence is set as the current stroke label, and the standard stroke order number corresponding to this current stroke label is acquired (if it is a single integer, the value is directly taken; if it is a multi-integer joined stroke, the minimum value among them is taken as the starting order number). The system judges whether the standard stroke order number is equal to matched_count+1: if yes, it indicates that the current stroke is exactly the next stroke to be written in the standard sequence, the system adds all standard stroke order numbers contained in the current stroke label to the matched label set, sets the next label in the user's stroke label sequence as the new current stroke label, returns to the step to re-acquire its corresponding standard stroke order number and continues the judgment; if no, it indicates that the current stroke skips the stroke that should be written first or the order is disordered, the system immediately determines the stroke order correction result of the current user's stroke label as "stroke order error", and terminates further order verification on this label sequence. This process proceeds in a linear traversal manner, ensuring that each writing step strictly follows the previous result.
[0080] For the step "check the stroke order correctness of the user's stroke label sequence based on the current user stroke label and the matched label set", an optional method is to process only single-numbered labels, and disassemble joined-stroke labels into a plurality of virtual strokes in advance before performing order verification; another optional implementation manner is that in the joined-stroke label scenario, it is required that the multiple standard stroke order numbers contained therein must form a continuous integer sequence starting from matched_count+1, otherwise the whole is regarded as a stroke order error.
[0081] In a specific embodiment of the present invention, the user writes the Chinese character "Mu" (meaning tree), and the standard stroke order numbers are 1 to 4. The user's stroke label sequence is [[1],[3],[2],[4]]. The system initializes the matched label set to be empty, with the number of elements being 0. The first stroke [1] is taken as the current stroke label, its standard stroke order number is 1, which is equal to 0+1, so it is added to the set, the set becomes {1}, the number of elements is 1, and the next label [3] becomes the current stroke label. Its standard stroke order number is 3, which is not equal to 1+1=2, the system determines that there is a stroke order error, the correction result of this label is set to WRONG, and subsequent labels no longer participate in the order correctness judgment (or are only used for other error type analysis). The entire process strictly follows the rule that "the next stroke to be written must be the current number of matched elements plus one", ensuring the certainty and traceability of order verification.
[0082] Based on this, the system dynamically derives the expected stroke number by using the number of matched labels, and strictly requires the current stroke to match the expected value, so as to realize stroke-by-stroke, linear, non-backtracking verification of the writing order, which effectively prevents the missed judgment of typical stroke order errors such as stroke skipping and reversed strokes.
[0083] Furthermore, the stroke order correction method also includes: determining the number of tags in the user's stroke tag sequence; and, if the number of elements equals the number of tags, determining that the current user's stroke order correction result is correct.
[0084] Among them, the number of tags in the user's stroke tag sequence refers to the number of stroke units actually written by the user, that is, the total number of elements in the sequence; the number of elements refers to the number of standard stroke sequence numbers contained in the matched tag set, representing the number of strokes that have been confirmed by the system as being written in sequence and validly; correct writing means that the user not only has the correct stroke order, but also the number of strokes is completely consistent with the standard, with no omissions, no redundancies, no merging or splitting.
[0085] In practical applications, after verifying the stroke order of the user's stroke label sequence stroke by stroke, the system performs an integrity verification. First, the system counts the total number of labels in the user's stroke label sequence, denoted as `total_labels`; simultaneously, it obtains the number of elements in the matched label set, denoted as `matched_count`. Then, the system determines whether `matched_count` equals `total_labels`: if they are equal, it means that each stroke label written by the user has been successfully matched to its corresponding position in the standard stroke order, with no extra or unrecognized strokes, and the system determines the current user's stroke order correction result as "correctly written"; if they are not equal, even if some strokes are in the correct order, there is still an inconsistency in the overall number of strokes, and it is not considered completely correct. The specific error type (such as missing strokes, broken strokes causing label splitting, etc.) is further analyzed by other modules. This step serves as the final closed-loop condition for judging stroke order correctness, ensuring the integrity and rigor of the correction conclusion.
[0086] For the step "determine the number of tags in the user's stroke tag sequence; if the number of elements equals the number of tags, determine that the stroke order correction result of the current user's stroke tag is correct", one option is to count synchronously during the sequential verification process to avoid repeated traversal of the sequence; another option is to compare the number of tags with the total number of standard strokes, and only determine that the writing is correct when the number of user tags, the number of matched, and the total number of standard strokes are consistent. This is suitable for teaching assessment scenarios with extremely high requirements for completeness.
[0087] In a specific embodiment of the present invention, the user writes the Chinese character "十", whose standard stroke order has two strokes: [1] horizontal stroke and [2] vertical stroke. The actual stroke label sequence output by the user is [[1],[2]], and the number of labels is 2. In the sequential verification, the system has matched [1] and [2] in sequence, and the matched label set is {1, 2} with 2 elements. Since the number of elements is equal to the number of labels, and each stroke passes the sequential verification, the system finally determines that the writing is "correct writing" as a whole. If the user only writes one stroke, the number of labels is 1 and the number of elements is also 1, but since all standard strokes are not completed, the system will recognize it as a missing stroke in other logics; while this step only confirms that there is no omission through the consistent quantity on the premise that all labels are correctly matched, so as to give the final correct judgment.
[0088] Based on this, the system compares the consistency between the number of matched strokes and the number of actual writing labels of the user, and further verifies the writing completeness on the basis of ensuring the compliance of the order, so as to avoid misjudgment caused by missing the last stroke or implicit absence, thereby realizing the accurate confirmation of "completely correct" writing.
[0089] Step 108: Generate a stroke order correction report according to the stroke order correction result.
[0090] The stroke order correction report refers to comprehensive feedback content including overall evaluation, error location, visual annotation and text suggestions, which is used to clearly convey the user's writing standard status and specific improvement directions; the overall evaluation is used to summarize whether the user's writing as a whole meets the standard, the error location is used to indicate which specific stroke has what kind of problem, the visual annotation intuitively presents the correct and wrong strokes on the writing image in the form of color or animation, and the text suggestions provide targeted writing guidance sentences.
[0091] In practical applications, the system first parses each stroke determination type in the stroke order correction result, including correct, wrong, extra stroke, connected strokes, broken stroke, etc., counts the overall number of errors and type distribution, and generates an overall evaluation statement, such as "The stroke order is basically correct, but there is one instance of connected strokes" or "There are many stroke order errors, and focused practice on the writing sequence is required". Subsequently, the system accurately locates each error, for example, "The 2nd stroke and the 3rd stroke are written connectedly" or "The 3rd stroke is in the wrong order and should be written after the 2nd stroke", and organizes this information into a structured error list. At the same time, the system calls the user's original writing image, and superimposes visual marks on it: correct strokes are displayed in green, wrong order is highlighted in red, connected strokes are indicated by orange connecting lines, extra strokes are marked with gray dashed lines, and broken strokes are identified in blue segments. In addition, the system matches preset natural language templates according to the error type to generate specific text suggestions, such as "The vertical stroke should be written separately, do not write it connected with the pie stroke" or "The third stroke should be a pie stroke, and the writing direction needs to be from the upper right to the lower left". Finally, the system integrates the above content into a correction report in a unified format, presents it in a combined graphic and text manner through the user interface, and supports the playback of the writing process animation for comparison with the standard stroke order demonstration.
[0092] For the step of "generating a stroke order correction report according to the stroke order correction result", an optional manner is to adopt a template-driven report generation mechanism, pre-define text and visual rules corresponding to various types of errors, and dynamically fill in according to the correction result; another optional implementation manner is to introduce a natural language generation model, which automatically generates fluent and personalized suggestion statements based on error semantics, so as to improve the naturalness and adaptability of feedback.
[0093] In a specific embodiment of the present invention, after the user writes the Chinese character "yong", the stroke order correction result output by the system is [CORRECT, CONNECTED, CORRECT, MULTI]. Based on this, the system generates an overall evaluation: "The stroke order is not standardized, including one instance of connected strokes and one extra stroke". The error localization part points out: "The 2nd stroke and the 3rd stroke are written connectedly; the 5th stroke is an extra stroke, and the standard 'yong' character has only 4 strokes". On the image of the "yong" character written by the user, the first stroke is displayed in green, the second stroke (the connected part) is highlighted in orange and marked with "connected stroke", the third and fourth strokes are restored to green, and the fifth stroke is marked with a gray dashed line and labeled "extra". The text suggestion module outputs: "The dot and the horizontal折hook should be written in two separate strokes, do not write them connectedly; the 'yong' character has no fifth stroke, please do not add an extra stroke". This report is displayed in the form of a card on the interface, the user can click on any stroke to view the detailed description, and can start the standard stroke order animation for comparative learning. The entire report generation process is fully automated, and the content strictly corresponds to the user's actual errors.
[0094] Furthermore, a stroke order correction report is generated based on the stroke order correction results, including: determining the overall writing evaluation based on the stroke order correction results of each user's stroke tags; generating error location information, wherein the error location information is used to associate the erroneous strokes with the error type; generating visual feedback information, wherein the visual feedback information is used to differentiate the strokes of different stroke order correction results; generating text suggestion information, wherein the text suggestion information is used to describe the stroke order errors and provide improvement guidance; and generating a stroke order correction report based on the overall writing evaluation, error location information, generated visual feedback information, and text suggestion information.
[0095] The overall handwriting evaluation refers to a general conclusion generated after statistically analyzing the error types and quantities based on the stroke order correction results (such as CORRECT, WRONG, MULTI, CONNECTED, etc.) of each user's stroke tags, such as "correctly written," "incorrect in sequence," or "contains multiple strokes and connected strokes." Error location information refers to a data structure that establishes a mapping relationship between each erroneous stroke and its specific error type, used to accurately indicate "which stroke is which type of error." Visual feedback information refers to a graphical expression on the user's original handwriting image, applying differentiated visual markers (such as color, line type, or animation) to each stroke according to different correction results. Text suggestion information refers to natural language guidance statements generated by matching preset language templates according to error types, used to explain the reasons for errors and provide improvement suggestions. The stroke order correction report is an organic integration of the above four types of information, constituting the final feedback output for the user.
[0096] In practical applications, the system first traverses the stroke order correction results of all user stroke labels, counts the quantity and distribution of correct cases and various types of errors, and generates an overall writing evaluation accordingly. If all results are CORRECT, the evaluation is "correct writing"; if WRONG exists, "order error" is emphasized; if MULTI or CONNECTED is included, it is classified as "non-standard writing", etc. Subsequently, the system constructs error localization information, records the position in the sequence (e.g., the 2nd stroke), original label content (e.g., [3]) and error type (e.g., WRONG) for each non-CORRECT label, to form a structured error list. Next, the system invokes the original trajectory or rendered image of the user's writing, and applies visualization rules to each stroke: CORRECT strokes are displayed as green solid lines, WRONG strokes are highlighted in red, MULTI strokes are displayed as gray dashed lines, CONNECTED strokes are marked with orange connection lines, and BROKEN strokes are marked with blue segments, ensuring clear visual distinction. Meanwhile, the system retrieves the corresponding text suggestion templates according to the error type, for example, "The 2nd stroke should be a vertical stroke, but it is written as a pie stroke in practice" or "Please do not connect the 2nd stroke and the 3rd stroke", to generate targeted text suggestion information. Finally, the system places the overall evaluation at the top of the report, and sequentially presents the error localization list, visualized writing image and text suggestions below, to combine them into a stroke order correction report with a unified structure, which is displayed through the user interface.
[0097] For the step of "generating a stroke order correction report according to the stroke order correction results, an optional manner is to adopt a static template filling mechanism, predefine the format of each block of the report, and dynamically inject content according to the correction results; another optional implementation manner is to introduce a lightweight natural language generation module, which automatically generates coherent and personalized suggestion statements in combination with error semantics, so as to improve the naturalness and adaptability of feedback.
[0098] In a specific embodiment of the present invention, the user writes the Chinese character "mu", and the stroke order correction result is [CORRECT, WRONG, WRONG, CORRECT]. The system counts 2 WRONG cases, and generates an overall evaluation: "There is an order error in the stroke order". The error localization information records: "The 2nd stroke: label [3], error type: stroke order error; The 3rd stroke: label [2], error type: stroke order error". In the visual feedback, the 1st and 4th strokes are displayed in green, and the 2nd and 3rd strokes are highlighted in red. The text suggestion information is generated: "The 2nd stroke should be a vertical stroke (the standard 2nd stroke), but a pie stroke (the standard 3rd stroke) is written; the 3rd stroke should be written after the 2nd stroke, please practice according to the order of 'vertical stroke first, then pie stroke'". The system integrates the above contents into a report card with both images and texts, including an evaluation title, an error list, an annotated image and suggestion text, to fully present the correction conclusion.
[0099] Based on this, the system integrates multi-dimensional information to transform machine-readable correction results into teaching-use feedback content. It not only clarifies the location and type of errors but also provides visual comparisons and language guidance, significantly improving users' understanding of stroke order standards and their willingness to correct them.
[0100] Furthermore, text suggestion information is generated, including: calling the corresponding standard stroke order description template based on the error type; filling the sequence number of the erroneous stroke and the sequence number of the standard stroke into the standard stroke order description template to generate text suggestion information.
[0101] The error types include stroke order errors (WRONG), multiple stroke errors (MULTI), connected stroke errors (CONNECTED), and broken stroke errors (BROKEN). The standard stroke order description template is a language template pre-compiled according to the Chinese character writing teaching standards. Each type of error corresponds to one or more templates, for example, "The {user_idx} stroke should be the {std_idx} stroke: {std_stroke_name}". The sequence number of the erroneous stroke indicates the position of the erroneous stroke in the user's stroke label sequence (counting from 1). The standard stroke sequence number indicates the correct standard stroke order number that the stroke should correspond to. The text suggestion information is the final generated natural language sentence used to explain the error to the user and provide directions for correction.
[0102] In practical applications, after completing stroke order correction, the system first identifies the error type for each non-CORRECT user stroke tag. Then, based on the type, it retrieves the corresponding standard stroke order description template from the template library. For example, if the type is WRONG, the sequence error template is retrieved; if it's MULTI, the redundant stroke template is retrieved. Next, the system extracts the position of the current erroneous stroke in the user's sequence as the erroneous stroke number (e.g., the 2nd stroke), and combines this with its tag content to determine the corresponding standard stroke number (e.g., it should be 2 instead of 3). Simultaneously, the system can query the corresponding stroke name (e.g., "vertical" or "left-falling stroke") from the Chinese character stroke order knowledge base. Finally, these parameters are filled into placeholders in the template to generate complete text suggestion information. The entire process requires no manual intervention, ensuring that the suggested content is standardized, consistent, and aligned with teaching standards.
[0103] For the step "Generate text suggestion information", one option is to use static template matching, with each type of error corresponding to a fixed template; another option is to dynamically select template variants based on the error context, such as providing more detailed explanations for high-frequency errors to improve the adaptability of the feedback.
[0104] In a specific embodiment of the present invention, when a user writes the Chinese character "mu" (wood), the label for the 2nd stroke is [3], which is determined as WRONG. The system identifies the error type as stroke order error, and invokes the template: "The {user_idx}th stroke shall be the {std_idx}th stroke: {std_stroke_name}". Wherein, user_idx=2 (the user's 2nd stroke), std_idx=2 (the standard 2nd stroke is "vertical"), std_stroke_name="vertical". After filling in the values, the generated text suggestion information is: "The 2nd stroke shall be the 2nd stroke: vertical". If the user writes an extra stroke with label [0], the system invokes the MULTI template: "The {user_idx}th stroke is an extra stroke, and the standard Chinese character 'mu' has a total of 4 strokes", and the corresponding suggestion is generated after filling in user_idx=5.
[0105] Based on this, the system converts structured error data into natural language suggestions conforming to the teaching context through a templating mechanism, ensuring that the feedback content is accurate, standardized and easy to understand, and effectively supporting users' independent error correction and stroke order learning.
[0106] Further, the writing stroke order correcting method further comprises: acquiring a user's historical correction records; analyzing the user's error pattern based on the historical correction records; adjusting the stroke order correction report based on the error pattern.
[0107] Wherein, the historical correction records refer to the stroke order correction results, error types, error stroke positions and corresponding feedback information of the user's past writing tasks stored by the system; the error pattern refers to a specific error type or stroke combination that stably appears in the user's multiple writing processes, such as "often reversing the order of the 'vertical' stroke and the 'left-falling' stroke" or "frequently connecting the 2nd and 3rd strokes"; adjusting the stroke order correction report refers to adaptively modifying the feedback focus, suggestion content or evaluation scale according to the error pattern when generating the current report.
[0108] In practical applications, before generating the current stroke order correction report, the system first obtains the user's historical correction records from the user account, including the error type distribution, high-frequency erroneous stroke positions and error repetition frequency of the recent N writing tasks. Subsequently, the system analyzes the user's error patterns through clustering or rule matching: if a certain type of error (such as joined strokes or order errors) occurs more than a threshold, it is marked as a "repeated error"; if the overall error rate continues to decrease, it is determined that the user is in a progress stage. Based on the analysis results, the system dynamically adjusts the report content: for recurring errors, it not only emphasizes their historical repetitiveness in the text suggestions (such as "You have joined the 2nd and 3rd strokes many times"), but also attaches targeted practice suggestions (such as "It is recommended to practice characters with independent left-falling and right-falling stroke structures such as 'mu' and 'shui'"); for beginners, the report provides more detailed descriptions of stroke names and writing directions, while for advanced users, basic descriptions are simplified to focus on advanced specifications; in addition, if the user performs well for a long time, the system can moderately relax the judgment on slight deviations caused by minor joined strokes or speed, so as to avoid affecting writing fluency due to excessive error correction, and otherwise increase the evaluation strictness.
[0109] In a specific embodiment of the present invention, the user made the error of "reversing the order of the 2nd stroke and the 3rd stroke" 3 times in the past 5 practices. When the same problem occurs again in writing the character "yong" this time, when generating the report, in addition to conventional error localization, the system adds in the text suggestions: "This error has occurred many times, it is recommended to focus on practicing the standard order of 'dot→horizontal fold hook→horizontal撇→right-falling stroke'", and recommends a special practice character set. Meanwhile, since the user's recent overall accuracy rate has increased to 85%, the system does not mark a minor joined stroke in this time as an error, but only makes a prompt annotation, which reflects the dynamic adaptation of the evaluation scale.
[0110] Based on this, by integrating historical error patterns, the system enables the stroke order correction report to shift from static evaluation to dynamic guidance, realizing personalized adaptation in the three dimensions of feedback focus, practice suggestions and evaluation strictness, and significantly improving the accuracy of teaching intervention and user learning efficiency.
[0111] The present invention provides a writing stroke order correction method, which accurately restores the writing process through trajectory data, converts dynamic writing into a structured label sequence using a stroke time sequence classification model, and then performs multi-dimensional matching with standard stroke order rules, so as to achieve fine-grained and high-accuracy stroke order correction, and provide interpretable feedback for users.
[0112] The following is combined with the attached Figure 2 , Figure 2 is a flowchart of the processing procedure of the writing stroke order correction method provided by an embodiment of the present invention, which specifically includes the following steps.
[0113] Step 202: Writing data collection and preprocessing.
[0114] Specifically, the system collects continuous stroke trajectory data of Chinese characters written by the user through a terminal device. The collected data undergoes preprocessing, including cropping the Chinese character writing area and converting the stroke trajectories into a time-sequential sequence of image stroke frames. The specific implementation steps are as follows: First, the touch system of the electronic writing device captures the user's handwriting data, including point coordinate sequences (x, y), timestamps (t), and pressure values (p). Then, based on the lifting and lowering times of the pen, the continuous stroke points are segmented into discrete strokes. Finally, the original point sequence is rendered into an image sequence, with each frame representing the writing state at a specific time point. The stroke data is organized chronologically to form a temporal feature sequence, which is then stitched together with a complete handwritten Chinese character image to form a single image, serving as input for subsequent models.
[0115] Step 204: Input the Chinese character stroke order recognition model.
[0116] Specifically, the preprocessed sequence of written images is input into a specially improved SVTR model to achieve high-precision recognition of Chinese character stroke order. At the task level, this model reconstructs the text recognition objective of traditional SVTR into a "stroke temporal classification" task. The output is no longer a character, but a sequence of stroke categories aligned with the writing time. Each element represents the type of stroke written at the current time (e.g., horizontal, vertical, left-falling, right-falling stroke) or the start and end markers of the stroke. At the structural level, the model adapts the original concept of "character components" to "stroke components" to better fit the semantic units of stroke order recognition. The model is trained with a large amount of diverse labeled data, including standard writing samples of various fonts and styles, dynamic writing data with precise stroke order annotations, and negative samples containing common stroke order errors, thus possessing the ability to recognize both standard writing and abnormal patterns.
[0117] In the application phase, the model parses the user's writing process into a two-dimensional integer vector named "user_labels," where each sub-vector corresponds to a stroke actually written by the user and is mapped to its corresponding position in the standard stroke order through its value: a single positive integer indicates a correct match to a standard stroke, multiple positive integers indicate connected strokes, 0 indicates redundant strokes, and -1 indicates ignored items. This label sequence serves as the core input for subsequent stroke order comparison and correction modules, providing a structured basis for accurately identifying various problems such as incorrect order, extra strokes, missing strokes, connected strokes, and broken strokes, thereby supporting fine-grained and interpretable intelligent correction.
[0118] Step 206: Receive the stroke sequence actually written by the user and its corresponding standard stroke order labels (user_labels) and the total number of strokes of the standard Chinese characters (final_label_count).
[0119] Specifically, it includes the actual stroke sequence written by the user, its corresponding standard stroke order labels (user_labels), and the total number of strokes in the standard Chinese characters (final_label_count).
[0120] Step 208: Initialize the result list and the set of used tags.
[0121] Specifically, the initialization results list and the used label set are used to record the correction results of each stroke and track the labels that have been processed.
[0122] Step 210: Preprocessing and initialization.
[0123] Specifically, the system first initializes a result vector and a set of tags used to track the data, then iterates through each user's strokes for analysis. For each stroke, the system starts with a CORRECT assumption and then confirms or modifies this judgment through a series of checks.
[0124] Step 212: Filter invalid tags.
[0125] Specifically, first, the algorithm checks the validity of each stroke label. If a label value is greater than the standard total number of strokes, the stroke is marked as an unknown error (UNKNOWN). This usually indicates that the model has encountered an anomaly in recognition, or that the user has written content that is completely unexpected. Mathematically, for any label l, if l > final_label_count, then the stroke is marked as UNKNOWN.
[0126] Step 214: Multi-item detection.
[0127] Specifically, if a stroke's label set contains 0, it means that the stroke does not correspond to any standard stroke, i.e., it is a redundant stroke. In this case, the stroke is marked as a MULTI. The criterion is: if l=0 exists in the stroke label set, then it is marked as MULTI.
[0128] Step 216: Ignore tag processing.
[0129] Specifically, if a stroke label contains -1, it indicates that the stroke is designated as something to be ignored and will not participate in the grading evaluation. This is typically used to handle certain special cases or testing scenarios. Judgment condition: If l=-1 exists in the stroke label set, then it is marked as IGNORE.
[0130] Step 218: Continuous stroke detection.
[0131] Specifically, when one stroke corresponds to multiple different standard stroke labels (the size of the label set is greater than 1 and does not contain 0 or -1), it indicates that the user has written multiple strokes that should have been written separately in a connected manner. This situation is marked as a connected stroke error (CONNECTED). The judgment condition: if the size of the label set is greater than 1 and no special labels (0 or -1) are contained, it is marked as CONNECTED.
[0132] Step 220: Check the correctness of stroke order.
[0133] Specifically, 6. For a stroke with only a single label, the algorithm judges whether the stroke order is correct by checking the relationship between its label value and the set of used labels: If the current label value is equal to the number of used labels plus 1, it indicates that the stroke order is correct If the current label has appeared before, it indicates that it is a repeatedly written stroke, which is marked as a special extra-stroke error Otherwise, it is marked as a stroke order error, indicating that the writing order does not conform to the standard Mathematical expression: Let the current label be l, and the set of used labels be S: If l=|S|+1, it is marked as CORRECT If l∈S, it is marked as MULTI (repeated stroke) Otherwise, it is marked as WRONG (stroke order error) Step 222: Broken stroke detection.
[0134] Specifically, for a stroke that is determined to be correct, the algorithm will also check whether there is a broken stroke situation. If the label of the current stroke also appears in the label set of the previous stroke, it indicates that the user has divided a stroke that should be completed continuously into multiple segments for writing, and this situation is marked as a broken stroke error (BROKEN). The judgment condition: Let the current stroke label be l, and the previous stroke label set be P. If l∈P, it is marked as BROKEN.
[0135] By parsing the user's writing process into a structured sequence of stroke labels and performing multi-dimensional comparison with the standard stroke order rules, various types of stroke order errors can be accurately identified. In a correct writing scenario (for example, the Chinese character "mu" is written in the order of [1], [2], [3], [4]), the system determines all strokes as correct; when the order is reversed (for example, [1], [3], [2], [4]), the system marks the corresponding stroke as "stroke order error"; if the user writes multiple standard strokes as one stroke (for example, [2,3]), it is identified as "connected stroke error"; if a stroke that does not belong to the standard stroke order appears (the label is [0]), it is determined as "extra stroke error"; if the same standard stroke is written in multiple segments (for example, [2], [2] appear consecutively), it is identified as "broken stroke error".
[0136] Based on the comparison results, the system generates a structured correction report, including an overall evaluation (e.g., "correct stroke order" or "incorrect"), specific error location (e.g., "the second stroke is out of order"), visual feedback (highlighting various strokes in different colors on the written image), and targeted textual suggestions (e.g., "the third stroke should be a vertical stroke, not a vertical hook"). Furthermore, the feedback mechanism supports personalized adaptation: adjusting the level of detail in feedback based on the user's historical error patterns, pushing specific exercises for frequently occurring errors, and dynamically adjusting the severity of the assessment as the learning progresses, thereby achieving accurate, explainable, and evolving intelligent stroke order correction.
[0137] See Figure 3 As shown, Figure 3 This is a schematic diagram of a handwriting stroke order correction system provided in one embodiment of the present invention. The user writes Chinese characters on an electronic device through a "user writing input terminal." The data is captured in real time by a "handwriting data acquisition module" and transmitted to a "data preprocessing module." This module performs cropping, segmentation, and image processing on the original trajectory data to generate a temporal feature sequence. This sequence is then fed into a "stroke order recognition model" to identify the stroke type and order, outputting a user stroke label sequence. This sequence is then entered into a "stroke order comparison and analysis module" to match it with standard stroke order rules, determining whether the stroke order, quantity, and shape are correct. Next, an "error classification and evaluation module" classifies the differences, identifying specific error types such as extra strokes, missing strokes, connected strokes, and broken strokes. Finally, a "feedback generation module" comprehensively evaluates the results to generate a correction report containing an overall evaluation, error location, visual annotations, and textual suggestions. This report is presented to the user in a combined text and image format through a "user interface display module," achieving fully automated and intelligent stroke order correction.
[0138] Corresponding to the above method embodiments, Figure 4 This is a schematic diagram of a writing stroke order correction device provided in one embodiment of the present invention. Figure 4 As shown, the device includes: The acquisition module 402 is configured to acquire trajectory data of Chinese characters written by the user; The determination module 404 is configured to determine the user stroke label sequence corresponding to the trajectory data through a stroke temporal classification model, wherein the user stroke label sequence is used to characterize the input stroke order of the user writing Chinese characters. Matching module 406 is configured to match the user's stroke label sequence and the standard stroke label sequence based on the standard stroke order rules to determine the stroke order correction result. The generation module 408 is configured to generate a stroke order correction report based on the stroke order correction results.
[0139] Optionally, the trajectory data includes a sequence of point coordinates, time information, and pressure information. Accordingly, the determining module 404 is further configured to divide the sequence of point coordinates into multiple user strokes based on the time information and pressure information, wherein each user stroke corresponds to a sequence of trajectory points; arrange the sequence of trajectory points of each user stroke in chronological order according to the time information to obtain an image stroke frame sequence, wherein the image stroke frame sequence is used to represent the writing state at each time point; concatenate the image stroke frame sequence with an image of the user writing Chinese characters to form a temporal feature sequence, and input the temporal feature sequence into a stroke temporal classification model to obtain a user stroke label sequence.
[0140] Optionally, the matching module 406 is further configured to determine the stroke order correction result of each user stroke label in the user stroke label sequence based on the standard stroke order rule matching and the standard stroke label sequence; and generate a stroke order correction result based on the stroke order correction result of each user stroke label.
[0141] Optionally, the matching module 406 is further configured to query whether the current user's stroke label is an invalid label based on the standard stroke order rules and the standard stroke label sequence, wherein an invalid label is a label that indicates that no stroke was identified; if yes, the stroke order correction result of the current user's stroke label is determined to be an unknown error; if no, the basic compliance of the current user's stroke label is determined based on the standard stroke label sequence.
[0142] Optionally, ensuring basic stroke compliance includes whether there are multiple stroke errors and whether there are consecutive stroke errors. Accordingly, the matching module 406 is further configured to determine, based on the standard stroke label sequence, whether the stroke labels of the current user's stroke label contain redundant stroke labels, wherein redundant stroke labels are stroke labels not included in the standard stroke label sequence; if yes, determine that the stroke order correction result of the current user's stroke label is a multiple stroke error; if no, determine whether the current user's stroke label has consecutive stroke errors.
[0143] Optionally, the matching module 406 is further configured to determine whether the standard stroke label sequence contains multiple identical standard stroke labels; if so, determine that the stroke order correction result of the current user's stroke label is cursive writing; if not, check the correctness of the stroke order of the user's stroke label sequence.
[0144] Optionally, the matching module 406 is further configured to create a set of matched tags, wherein the set of matched tags is used to record user stroke tags that have been correctly matched; and to check the correctness of the stroke order of the user stroke tag sequence based on the current user stroke tags and the set of matched tags.
[0145] Optionally, each user's stroke label corresponds to a standard stroke sequence number; accordingly, the matching module 406 is further configured to obtain the number of elements in the matched label set; take the starting stroke label in the user's stroke label sequence as the current stroke label, and obtain the standard stroke sequence number corresponding to the current stroke label; determine whether the current standard stroke sequence number is equal to the number of elements plus one; if yes, add the current stroke label to the matched label set, and take the subsequent stroke label of the current stroke label as the current stroke label, and return to execute the step of obtaining the standard stroke sequence number corresponding to the current stroke label; if no, determine that the stroke order correction result of the current user's stroke label is a stroke order error.
[0146] Optionally, the matching module 406 is further configured to determine the number of tags in the user's stroke tag sequence; and if the number of elements equals the number of tags, determine that the stroke order correction result of the current user's stroke tag is correct.
[0147] Optionally, the generation module 408 is further configured to determine the overall writing evaluation based on the stroke order correction results of each user's stroke tags; Generate error location information, which is used to associate incorrect strokes with error types; generate visual feedback information, which is used to differentiate the strokes in different stroke order correction results; generate text suggestion information, which is used to describe stroke order errors and provide improvement guidance; and generate a stroke order correction report based on the overall writing evaluation, error location information, visual feedback information, and text suggestion information.
[0148] Optionally, the generation module 408 is further configured to call the corresponding standard stroke order description template based on the error type; fill the sequence number of the erroneous stroke and the sequence number of the standard stroke into the standard stroke order description template to generate text suggestion information.
[0149] Optionally, the stroke order correction device also includes an adjustment module configured to acquire the user's historical correction records; analyze the user's error patterns based on the historical correction records; and adjust the stroke order correction report based on the error patterns.
[0150] One embodiment of the present invention provides a writing stroke order correction device. An acquisition module 402 collects real-time trajectory data of a user writing Chinese characters, providing basic input for subsequent analysis. A determination module 404 uses a stroke temporal classification model to convert the trajectory data into a structured user stroke label sequence, accurately representing the actual writing order. A matching module 406, based on standard stroke order rules, performs multi-dimensional comparisons between the user label sequence and the standard stroke label sequence to accurately determine the correctness of the stroke order. A generation module 408 automatically generates a stroke order correction report containing an overall evaluation, error location, and improvement suggestions based on the comparison results. By accurately reconstructing the writing process using trajectory data, converting dynamic writing into a structured label sequence using a stroke temporal classification model, and then performing multi-dimensional matching with standard stroke order rules, fine-grained and highly accurate stroke order correction is achieved, providing interpretable feedback to the user.
[0151] The above is a schematic scheme of a writing stroke order correction device according to this embodiment. It should be noted that the technical solution of this writing stroke order correction device and the technical solution of the writing stroke order correction method described above belong to the same concept. For details not described in detail in the technical solution of the writing stroke order correction device, please refer to the description of the technical solution of the writing stroke order correction method described above.
[0152] Figure 5 A structural block diagram of a computing device 500 according to an embodiment of the present invention is shown. The components of the computing device 500 include, but are not limited to, a memory 510 and a processor 520. The processor 520 is connected to the memory 510 via a bus 530, and a database 550 is used to store data.
[0153] The computing device 500 also includes an access device 540, which enables the computing device 500 to communicate via one or more networks 560. Examples of these networks include Public Switched Telephone Network (PSTN), Local Area Network (LAN), Wide Area Network (WAN), Personal Area Network (PAN), or combinations of communication networks such as the Internet. The access device 540 may include one or more of any type of wired or wireless network interface (e.g., a network interface card (NIC)), such as an IEEE 802.11 Wireless Local Area Network (WLAN) wireless interface, a Wi-MAX (Worldwide Interoperability for Microwave Access) interface, an Ethernet interface, a Universal Serial Bus (USB) interface, a cellular network interface, a Bluetooth interface, or a Near Field Communication (NFC) interface.
[0154] In one embodiment of the present invention, the above-mentioned components of the computing device 500 and Figure 5 Other components, not shown, can also be connected to each other, for example, via a bus. It should be understood that... Figure 5 The illustrated block diagram of the computing device is for illustrative purposes only and is not intended to limit the scope of the invention. Those skilled in the art can add or replace other components as needed.
[0155] The computing device 500 can be any type of stationary or mobile computing device, including mobile computers or mobile computing devices (e.g., tablet computers, personal digital assistants, laptop computers, notebook computers, netbooks, etc.), mobile phones (e.g., smartphones), wearable computing devices (e.g., smartwatches, smart glasses, etc.) or other types of mobile devices, or stationary computing devices such as desktop computers or personal computers (PCs). The computing device 500 can also be a mobile or stationary server.
[0156] The processor 520 is used to execute the following computer program / instruction, which, when executed by the processor, implements the steps of the above-mentioned method for correcting the writing stroke order.
[0157] The various embodiments in this invention are described in a progressive manner. Similar or identical parts between embodiments can be referred to interchangeably. Each embodiment focuses on its differences from other embodiments. In particular, the computing device embodiment is relatively simple in description because it is fundamentally similar to the stroke order correction method embodiment; relevant parts can be referred to in the description of the stroke order correction method embodiment.
[0158] An embodiment of the present invention also provides a computer-readable storage medium storing a computer program / instructions that, when executed by a processor, implement the steps of the above-described method for correcting the writing stroke order.
[0159] The various embodiments in this invention are described in a progressive manner. Similar or identical parts between embodiments can be referred to interchangeably. Each embodiment focuses on its differences from other embodiments. In particular, the computer-readable storage medium embodiment is described simply because it is substantially similar to the stroke order correction method embodiment; relevant parts can be referred to in the description of the stroke order correction method embodiment.
[0160] An embodiment of the present invention also provides a computer program product, including a computer program / instruction, which, when executed by a processor, implements the steps of the above-described method for correcting the writing stroke order.
[0161] The above is an illustrative scheme of a computer program product according to this embodiment. It should be noted that the technical solution of this computer program product and the technical solution of the above-described method for correcting writing stroke order belong to the same concept. For details not described in detail in the technical solution of the computer program product, please refer to the description of the technical solution of the above-described method for correcting writing stroke order.
[0162] The foregoing has described specific embodiments of the invention. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps described in the claims may be performed in a different order than that shown in the embodiments and may still achieve the desired results. Furthermore, the processes depicted in the drawings do not necessarily require the specific or sequential order shown to achieve the desired results. In some embodiments, multitasking and parallel processing are also possible or may be advantageous.
[0163] The computer instructions include computer program code, which may be in the form of source code, object code, executable file, or certain intermediate forms. The computer-readable medium may include: any entity or device capable of carrying the computer program code, recording media, USB flash drive, portable hard drive, magnetic disk, optical disk, computer memory, read-only memory (ROM), random access memory (RAM), electrical carrier signals, telecommunication signals, and software distribution media, etc. It should be noted that the content included in the computer-readable medium may be appropriately added or removed according to the requirements of patent practice. For example, in some regions, according to patent practice, computer-readable media may not include electrical carrier signals and telecommunication signals.
[0164] It should be noted that, for the sake of simplicity, the foregoing method embodiments are all described as a series of actions. However, those skilled in the art should understand that the embodiments of the present invention are not limited to the described order of actions, because according to the embodiments of the present invention, some steps can be performed in other orders or simultaneously. Furthermore, those skilled in the art should also understand that the embodiments described in the specification are preferred embodiments, and the actions and modules involved are not necessarily essential to the embodiments of the present invention.
[0165] In the above embodiments, the descriptions of each embodiment have different focuses. For parts not described in detail in a certain embodiment, please refer to the relevant descriptions of other embodiments.
[0166] The preferred embodiments of the present invention disclosed above are merely illustrative of the invention. The optional embodiments do not exhaustively describe all details, nor do they limit the invention to the specific implementations described. Clearly, many modifications and variations can be made based on the embodiments of the present invention. These embodiments are selected and specifically described to better explain the principles and practical applications of the present invention, thereby enabling those skilled in the art to better understand and utilize the invention. The present invention is limited only by the claims and their full scope and equivalents.
Claims
1. A method for correcting the stroke order of handwriting, characterized in that, include: The trajectory data of a user writing Chinese characters is obtained, wherein the trajectory data includes a sequence of point coordinates, time information, and pressure information; Based on the time information and the pressure information, the point coordinate sequence is divided into multiple user strokes. The trajectory point sequences of each user stroke are arranged in chronological order according to the time information to obtain an image stroke frame sequence. The image stroke frame sequence is then concatenated with the image of the user writing Chinese characters to form a temporal feature sequence. The temporal feature sequence is then input into a stroke temporal classification model to obtain a user stroke label sequence. The user stroke label sequence is used to characterize the input stroke order of the user writing Chinese characters. Each user stroke corresponds to a trajectory point sequence. The image stroke frame sequence is used to represent the writing state at each time point. Based on standard stroke order rules, the stroke order correction result is determined by matching the user's stroke label sequence with the standard stroke label sequence. A stroke order correction report is generated based on the stroke order correction results.
2. The method according to claim 1, characterized in that, The process of matching the user's stroke label sequence with the standard stroke label sequence based on standard stroke order rules to determine the stroke order correction result includes: Traverse each user stroke label in the user stroke label sequence, and determine the stroke order correction result of the user stroke label by matching it with the standard stroke label sequence based on the standard stroke order rules. Generate stroke order correction results based on the stroke order correction results of each user's stroke tags.
3. The method according to claim 2, characterized in that, Determining the stroke order correction result of the user's stroke label includes: Based on the standard stroke order rules and the standard stroke label sequence, query whether the current user's stroke label is an invalid label, wherein the invalid label is a label that indicates that no stroke was identified; If so, determine that the stroke order correction result of the current user's stroke label is an unknown error; If not, determine the basic compliance of the strokes of the current user's stroke tags based on the standard stroke tag sequence.
4. The method according to claim 3, characterized in that, The basic compliance of the strokes includes whether there are multiple stroke errors and whether there are connected stroke errors; the determination of the basic compliance of the current user's stroke tags based on the standard stroke tag sequence includes: Based on the standard stroke tag sequence, determine whether the stroke tags of the current user's stroke tags contain redundant stroke tags, wherein the redundant stroke tags are stroke tags not included in the standard stroke tag sequence. If so, determine that the stroke order correction result of the current user's stroke label is multiple stroke errors; If not, determine whether there is a stroke error in the current user's stroke label.
5. The method according to claim 4, characterized in that, The step of determining whether the current user's stroke label has a continuous stroke error includes: Determine whether the standard stroke label sequence contains multiple identical standard stroke labels; If so, determine that the stroke order correction result of the current user's stroke label is cursive writing; If not, check the correctness of the stroke order of the user's stroke label sequence.
6. The method according to claim 5, characterized in that, The step of checking the stroke order correctness of the user's stroke label sequence includes: Create a set of matched tags, wherein the set of matched tags is used to record user stroke tags that have been correctly matched; Based on the current user stroke labels and the set of matched labels, check the correctness of the stroke order of the user stroke label sequence.
7. The method according to claim 6, characterized in that, Each user stroke label corresponds to a standard stroke sequence number; the step of checking the stroke order correctness of the user stroke label sequence based on the current user stroke label and the set of matched labels includes: Get the number of elements in the set of matched tags; Take the starting stroke label in the user stroke label sequence as the current stroke label, and obtain the standard stroke sequence number corresponding to the current stroke label; Determine whether the current standard pen sequence number is equal to the number of elements plus one; If so, add the current stroke label to the set of matched labels, and use the subsequent stroke label of the current stroke label as the current stroke label, then return to the step of obtaining the standard stroke sequence number corresponding to the current stroke label; If not, then the stroke order correction result of the current user's stroke label is determined to be an error.
8. The method according to claim 7, characterized in that, The method further includes: Determine the number of tags in the user stroke tag sequence; If the number of elements is equal to the number of tags, the stroke order correction result of the current user's stroke tag is determined to be correct.
9. The method according to claim 2, characterized in that, The step of generating a stroke order correction report based on the stroke order correction results includes: Based on the stroke order correction results of each user's stroke tags, the overall handwriting evaluation is determined; Generate error location information, wherein the error location information is used to associate the erroneous stroke with the error type; Generate visual feedback information, wherein the visual feedback information is used to differentiate the strokes of different stroke order correction results; Generate text suggestion information, wherein the text suggestion information is used to describe stroke order errors and provide guidance for improvement; A stroke order correction report is generated based on the overall writing evaluation, the error location information, the generated visual feedback information, and the text suggestion information.
10. The method according to claim 9, characterized in that, The generated text suggestion information includes: Based on the error type, the corresponding standard stroke order description template is invoked; The sequence number of the incorrect stroke and the sequence number of the standard stroke are entered into the standard stroke order description template to generate the text suggestion information.
11. The method according to claim 1, characterized in that, The method further includes: Retrieve the user's historical correction records; Analyze user error patterns based on the historical correction records; Based on the error pattern, adjust the stroke order correction report.
12. A writing stroke order correction device, characterized in that, include: The acquisition module is configured to acquire trajectory data of Chinese characters written by the user, wherein the trajectory data includes a sequence of point coordinates, time information, and pressure information; The determination module is configured to, based on the time information and the pressure information, segment the point coordinate sequence into multiple user strokes, arrange the trajectory point sequences of each user stroke in chronological order according to the time information to obtain an image stroke frame sequence, concatenate the image stroke frame sequence with the image of the user writing Chinese characters to form a temporal feature sequence, and input the temporal feature sequence into a stroke temporal classification model to obtain a user stroke label sequence. The user stroke label sequence is used to characterize the input stroke order of the user writing Chinese characters, each user stroke corresponds to a trajectory point sequence, and the image stroke frame sequence is used to represent the writing state at each time point. The matching module is configured to match the user's stroke label sequence and the standard stroke label sequence based on standard stroke order rules to determine the stroke order correction result; The generation module is configured to generate a stroke order correction report based on the stroke order correction results.
13. A computing device, characterized in that, include: Memory and processor; The memory is used to store computer programs / instructions, and the processor is used to execute the computer programs / instructions. When the computer programs / instructions are executed by the processor, they implement the steps of the writing stroke order correction method according to any one of claims 1-11.
14. A computer-readable storage medium, characterized in that, It stores a computer program / instruction that, when executed by a processor, implements the steps of the writing stroke order correction method according to any one of claims 1-11.
15. A computer program product, characterized in that, Includes a computer program / instruction that, when executed by a processor, implements the steps of the writing stroke order correction method according to any one of claims 1-11.
Citation Information
Patent Citations
Online handwritten signature character segmentation method and system, storage medium and electronic equipment
CN114283417A
Chinese character stroke extraction method based on domain self-adaption
CN120126160A
