Chinese character splitting method, device, equipment and storage medium based on stroke information
Through a Chinese character splitting method based on stroke information, Chinese characters are split using feature vectors and neural network models, which solves the problems of low accuracy and efficiency of Chinese character splitting in the existing technology and realizes efficient Chinese character recognition on low-performance devices.
Patent Information
- Application Number
- CN202311218203.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-09-20
- Publication Date
- 2025-09-12
- Estimated Expiration
- 2043-09-20
AI Technical Summary
Existing Chinese character segmentation methods based on image processing technology lack accuracy when recognizing handwritten Chinese characters, have high computational complexity, and require a large amount of hardware computing power and memory, making them difficult to apply to most devices.
A Chinese character splitting method based on stroke information is adopted. By obtaining the stroke information of the touch device, the feature vector and neural network model are used to split the Chinese characters, simplifying the feature extraction process and constructing a fully connected network structure with three hidden layers.
It improves the accuracy and recognition efficiency of Chinese character segmentation, reduces the demand for hardware resources, and is suitable for low-performance devices.
Smart Images

Figure CN117315692B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of computer text recognition, and in particular to a Chinese character splitting method, device, equipment and storage medium based on stroke information. Background Art
[0002] With the development of computer input methods, handwriting input has evolved from simple single-word input to short sentence input. Users can write a short Chinese sentence on a touch screen, allowing the input method program to enter the entire handwritten text into the input box at once. Specifically, the program generally first uses Chinese character segmentation technology to separate each Chinese character in the sentence, then performs text recognition on each character separately, and finally inputs the recognized text.
[0003] At present, most of the handwritten Chinese character segmentation technologies are implemented through image processing technology. However, due to the large number of Chinese characters, diverse fonts, and different writing habits or writing scenarios of the writers, for example, cursive writing, and the lack of writing space on the screen resulting in slight overlap of written Chinese characters, it is difficult to accurately identify and split the written Chinese characters through image-based Chinese character segmentation technology. At the same time, image processing technology has many feature extraction links and high computational complexity, and is not well suited for most devices. Furthermore, the handwritten Chinese character segmentation model implemented based on image processing technology is generally constructed through a feature extraction module and a feature context information calculation module. However, during the operation of the model, it is necessary to ensure sufficient hardware computing power support, and due to the large model structure, it requires a large amount of memory on the device, and the recognition speed is slow. Therefore, how to simplify the Chinese character segmentation model and improve the recognition efficiency of the model has become a problem that needs to be solved urgently in this field. Summary of the Invention
[0004] The embodiments of the present invention provide a Chinese character splitting method, apparatus, device and storage medium based on stroke information, which can effectively solve the problem of accurately splitting handwritten Chinese characters using image-based Chinese character splitting technology.
[0005] An embodiment of the present invention provides a Chinese character splitting method based on stroke information, comprising:
[0006] Acquire a sentence containing a plurality of Chinese characters transmitted by the touch device;
[0007] Traversing each stroke in the sentence, extracting the currently traversed stroke in each traversal and adding it to a preset stroke set;
[0008] Calculating a feature vector between a current stroke set and a next stroke to be traversed, transmitting the feature vector to a preset Chinese character segmentation model so that the Chinese character segmentation model determines whether the currently traversed stroke is the last stroke of a Chinese character; if the currently traversed stroke is determined to be the last stroke of a Chinese character, treating all strokes in the current stroke set as strokes of a single Chinese character, and clearing the current stroke set;
[0009] After each stroke in the sentence is traversed, the last stroke of several Chinese characters in the sentence is used as each splitting point of the sentence.
[0010] Furthermore, traversing each stroke in the sentence includes:
[0011] Obtaining stroke information of each stroke in the sentence; wherein the stroke information is a set of coordinates of a plurality of screen sampling points generated by the touch device when inputting a stroke on the touch device, and an input time of each screen sampling point;
[0012] Taking the input time of the first screen sampling point of each stroke as the input time of each stroke;
[0013] Each stroke in the sentence is traversed in the order of the input time of the strokes.
[0014] Furthermore, the calculation of the feature vector between the current stroke set and the next stroke to be traversed includes:
[0015] Obtaining the stroke information of the strokes in the current stroke set and the stroke information of the next stroke to be traversed;
[0016] determining a feature vector between the current stroke set and the next stroke to be traversed based on the stroke information of each stroke in the current stroke set and the stroke information of the next stroke to be traversed;
[0017] The eigenvector includes: a first eigenvalue, a second eigenvalue, a third eigenvalue, a fourth eigenvalue, and a fifth eigenvalue;
[0018] The first characteristic value is the difference between the maximum horizontal coordinate value of the strokes included in the stroke set and the minimum horizontal coordinate value of the next stroke to be traversed;
[0019] The second characteristic value is the height and width of the stroke set;
[0020] The third characteristic value is the distance between the coordinates of the first screen sampling point of the currently traversed stroke and the coordinates of the first screen sampling point of the next stroke to be traversed;
[0021] The fourth eigenvalue is the distance between the coordinates of the last screen sampling point of the currently traversed stroke and the coordinates of the last screen sampling point of the next stroke to be traversed;
[0022] The fifth characteristic value is the ratio of the height of the stroke set to the height of the sentence.
[0023] Furthermore, the Chinese character splitting model determines whether the currently traversed stroke is the last stroke of a Chinese character, including:
[0024] The Chinese character splitting model outputs a splitting probability for representing whether all the strokes in the current stroke set form a character according to the feature vector;
[0025] When the split probability is greater than a preset split threshold, determining that the currently traversed stroke is the last stroke of a Chinese character;
[0026] When the split probability is not greater than a preset split threshold, it is determined that the currently traversed stroke is not the last stroke of a Chinese character.
[0027] Furthermore, the construction of the Chinese character splitting model includes:
[0028] collecting a plurality of training sentences containing a plurality of Chinese characters transmitted by the touch device;
[0029] Traversing each training stroke in the training sentence, extracting the currently traversed training stroke during each traversal and adding it to a preset training set, and calculating a feature vector between the training set and the next training stroke to be traversed; and assigning a corresponding label to the feature vector; wherein the label includes: a first label for indicating that all strokes in the training set can form a Chinese character, and a second label for indicating that all strokes in the training set cannot form a Chinese character;
[0030] The feature vector and the corresponding label corresponding to the currently traversed training stroke are used as a piece of training data; after the traversal is completed, a stroke training data set containing a plurality of training data is obtained;
[0031] The stroke training data set is used and input into a pre-built neural network model for training. When the training is completed, the Chinese character segmentation model is obtained.
[0032] Furthermore, the Chinese character splitting model structure is a fully connected network structure including three hidden layers.
[0033] Another embodiment of the present invention provides a Chinese character splitting device based on stroke information, comprising:
[0034] A Chinese character acquisition module, used to acquire a sentence containing a plurality of Chinese characters transmitted by the touch device;
[0035] A stroke traversal module, configured to traverse each stroke in the sentence, and extract the currently traversed stroke during each traversal and add it to a preset stroke set;
[0036] a Chinese character splitting module, configured to calculate a feature vector between a current stroke set and a next stroke to be traversed, and transmit the feature vector to a preset Chinese character splitting model so that the Chinese character splitting model determines whether the currently traversed stroke is the last stroke of a Chinese character; if the currently traversed stroke is determined to be the last stroke of a Chinese character, all strokes in the current stroke set are considered as strokes of a Chinese character, and the current stroke set is cleared;
[0037] The split point confirmation module is used to use the last stroke of several Chinese characters in the sentence as the split points of the sentence after traversing each stroke in the sentence.
[0038] Furthermore, the Chinese character splitting device based on stroke information further includes: a model building module;
[0039] The model building module is used to collect several training sentences containing several Chinese characters transmitted by a touch device; traverse each training stroke in the training sentence, extract the currently traversed training stroke at each traversal and add it to a preset training set, calculate the feature vector between the training set and the next training stroke to be traversed, and assign a corresponding label to the feature vector; wherein the label includes: a first label for representing that all strokes in the training set can form a Chinese character, and a second label for representing that all strokes in the training set cannot form a Chinese character; the feature vector and the corresponding label corresponding to the currently traversed training stroke are used as a piece of training data; after the traversal is completed, a stroke training data set containing several training data is obtained; the stroke training data set is used to input into a pre-built neural network model for training, and when the training is completed, the Chinese character segmentation model is obtained.
[0040] Another embodiment of the present invention provides a device, which is a terminal device, including a processor, a memory, and a computer program stored in the memory and configured to be executed by the processor, and when the processor executes the computer program, it implements any one of the above-mentioned Chinese character splitting methods based on stroke information.
[0041] Another embodiment of the present invention provides a storage medium, which is a computer-readable storage medium and includes a stored computer program, wherein when the computer program is running, the device where the computer-readable storage medium is located is controlled to execute any of the above-mentioned Chinese character splitting methods based on stroke information.
[0042] The following beneficial effects are achieved by implementing the present invention:
[0043] The present invention traverses each stroke of several Chinese characters acquired by a touch device, adds the currently traversed stroke to a preset stroke set during each traversal, calculates the feature vector between the traversed stroke and the stroke to be added in the current stroke set, and inputs the feature vector into a preset Chinese character splitting model so that the Chinese character splitting model determines whether the currently traversed stroke is the last stroke of a Chinese character. When the traversal is completed, the last stroke of several Chinese characters in the sentence is used as each splitting point of the sentence, thereby accurately splitting the several Chinese characters. This avoids the situation where Chinese character splitting is difficult due to the different writing habits or writing scenes of the writer. Furthermore, the Chinese character splitting model does not involve complex image feature extraction algorithms, has high recognition efficiency, and can be applied to many low-performance devices. BRIEF DESCRIPTION OF THE DRAWINGS
[0044] Figure 1 The figure is a flow chart of a Chinese character splitting method based on stroke information provided by one embodiment of the present invention.
[0045] Figure 2 It is a schematic diagram of the construction process of the Chinese character segmentation model provided by one embodiment of the present invention.
[0046] Figure 3 It is a structural diagram of a Chinese character splitting device based on stroke information provided by one embodiment of the present invention.
[0047] Figure 4 Schematic diagram of collected training sentences provided by one embodiment of the present invention.
[0048] Figure 5 This is a schematic diagram of Chinese character splitting results of a Chinese character splitting method based on stroke information provided by one embodiment of the present invention. DETAILED DESCRIPTION
[0049] The following will clearly and completely describe the technical solutions in the embodiments of the present invention in conjunction with the accompanying drawings. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. All other embodiments obtained by ordinary technicians in this field based on the embodiments of the present invention without making any creative efforts shall fall within the scope of protection of the present invention.
[0050] See also Figure 1 , is a flow chart of a Chinese character splitting method based on stroke information provided by one embodiment of the present invention, comprising:
[0051] S1. Obtaining a sentence containing several Chinese characters transmitted by a touch device;
[0052] In a preferred embodiment of the present invention, the touch-sensitive device is an electronic device capable of receiving touch signals and generating corresponding screen sampling point data based on the touch signals, including but not limited to: a digitizer, a tablet computer, and a touch-screen mobile phone. The screen sampling point data includes, for example, the coordinates of the screen sampling point and the time the screen sampling point was input. This allows a user, using a capacitive stylus or a finger, to write a sentence containing several Chinese characters on the touch-sensitive device, and the device can generate a set of screen sampling point data corresponding to each stroke based on the traces of each stroke.
[0053] S2, traversing each stroke in the sentence, extracting the currently traversed stroke in each traversal and adding it to a preset stroke set;
[0054] In a preferred embodiment of the present invention, a basic stroke that constitutes a Chinese character, such as a horizontal stroke, vertical stroke, or vertical fold, is referred to as a stroke. A series of basic strokes written continuously during writing is also referred to as a stroke. Furthermore, a stroke set is pre-set, and during each traversal, the currently traversed stroke is added to the set to form a new stroke set.
[0055] Preferably, traversing each stroke in the sentence includes:
[0056] S21. Obtaining stroke information of each stroke in the sentence; wherein the stroke information is a set of coordinates of a plurality of screen sampling points generated by the touch device when inputting a stroke on the touch device, and the input time of each screen sampling point;
[0057] S22. Taking the input time of the first screen sampling point of each stroke as the input time of each stroke; and traversing each stroke in the sentence in the order of the stroke input time.
[0058] In a preferred embodiment of the present invention, when the acquired stroke information for each stroke does not include the input time of each screen sampling point of the stroke, the strokes in the sentence are traversed from small to large based on the horizontal coordinate of the first screen sampling point of each stroke, based on the writing order of the current Chinese character from left to right. This ensures that each stroke added to the stroke set also includes the order characteristics of the strokes when they were written.
[0059] S3. Calculate a feature vector between the current stroke set and the next stroke to be traversed, and transmit the feature vector to a preset Chinese character segmentation model, so that the Chinese character segmentation model determines whether the currently traversed stroke is the last stroke of a Chinese character. If it is determined that the currently traversed stroke is the last stroke of a Chinese character, treat all strokes in the current stroke set as strokes of one Chinese character, and clear the current stroke set.
[0060] In one embodiment of the present invention, a Chinese character splitting model is preset for identifying whether the currently traversed stroke is the last stroke of a Chinese character. When the Chinese character splitting model determines that the currently traversed stroke is the last stroke of a Chinese character, it is determined that the strokes contained in the current stroke set can constitute a Chinese character, and the current stroke set is cleared. During the next traversal, the traversed stroke is added to the cleared stroke set.
[0061] Preferably, the calculating of the feature vector between the current stroke set and the next stroke to be traversed includes:
[0062] S31, obtaining the stroke information of the strokes in the current stroke set and the stroke information of the next stroke to be traversed;
[0063] S32, determining a feature vector between the current stroke set and the next stroke to be traversed based on the stroke information of each stroke in the current stroke set and the stroke information of the next stroke to be traversed;
[0064] The eigenvector includes: a first eigenvalue, a second eigenvalue, a third eigenvalue, a fourth eigenvalue, and a fifth eigenvalue;
[0065] The first characteristic value is the difference between the maximum horizontal coordinate value of the strokes included in the stroke set and the minimum horizontal coordinate value of the next stroke to be traversed;
[0066] The second characteristic value is the height and width of the stroke set;
[0067] The third characteristic value is the distance between the coordinates of the first screen sampling point of the currently traversed stroke and the coordinates of the first screen sampling point of the next stroke to be traversed;
[0068] The fourth eigenvalue is the distance between the coordinates of the last screen sampling point of the currently traversed stroke and the coordinates of the last screen sampling point of the next stroke to be traversed;
[0069] The fifth characteristic value is the ratio of the height of the stroke set to the height of the sentence.
[0070] It should be noted that the number of eigenvalues contained in the feature vector is usually 8 to 15. In addition to the five eigenvalues, the feature vector also contains other eigenvalues. The other eigenvalues can enable the feature vector to carry more stroke feature information, such as the writing order characteristics of Chinese characters, the writing order characteristics of strokes, and the position characteristics of adjacent strokes.
[0071] In a preferred embodiment of the present invention, a corresponding bounding box is provided for each stroke set. The bounding box represents the minimum rectangle that can enclose all the strokes contained in the stroke set. Correspondingly, the bounding box corresponding to the statement is also the minimum rectangle that can enclose all the strokes contained in the statement. The width and height of the rectangle are parallel to the x-axis and y-axis of the two-dimensional coordinate axes of the touch device screen, respectively. It is understood that after a new stroke is added to the stroke set, the bounding box of the stroke set is updated based on the stroke information contained in the current stroke set.
[0072] Therefore, this embodiment can also calculate the eigenvalues in the eigenvector in the following manner: the first eigenvalue is the difference between the maximum horizontal coordinate of the bounding box of the stroke set and the minimum horizontal coordinate of the bounding box of the next stroke to be traversed. The second eigenvalue is obtained by taking the difference between the maximum horizontal coordinate and the minimum horizontal coordinate of the bounding box of the stroke set as the width of the stroke set, and taking the difference between the maximum vertical coordinate and the minimum vertical coordinate as the height of the stroke set. The third eigenvalue is obtained by calculating the distance between the coordinates of the first screen sampling point of the currently traversed stroke and the coordinates of the first screen sampling point of the next stroke to be traversed using the formula for the distance between two coordinate points. Similarly, the fourth eigenvalue is obtained by calculating the distance between the coordinates of the last screen sampling point of the currently traversed stroke and the coordinates of the last screen sampling point of the next stroke to be traversed using the formula for the distance between two coordinate points. The fifth eigenvalue is the ratio of the height of the bounding box of the stroke set to the height of the bounding box corresponding to the statement.
[0073] The present invention traverses several strokes of the sentence according to the input order of the strokes or the writing order of Chinese characters, and calculates the feature vectors between the current stroke set and the next stroke to be traversed, so that the feature vectors obtained by calculation carry the sequence characteristics of the writing order of each stroke, the trajectory sequence characteristics of the strokes when writing, and the relative position characteristics between the strokes, etc., which is equivalent to the working premise of extracting part of the features of the preset Chinese character splitting model, so that the preset Chinese character splitting model can reduce the hidden layer used for feature extraction, and directly identify the last stroke of each Chinese character faster and more accurately based on the input feature vector.
[0074] Preferably, the Chinese character splitting model determines whether the currently traversed stroke is the last stroke of a Chinese character, including:
[0075] The Chinese character splitting model outputs a splitting probability for representing whether all the strokes in the current stroke set form a character according to the feature vector;
[0076] When the split probability is greater than a preset split threshold, determining that the currently traversed stroke is the last stroke of a Chinese character;
[0077] When the split probability is not greater than a preset split threshold, it is determined that the currently traversed stroke is not the last stroke of a Chinese character.
[0078] It can be understood that, in this embodiment, the last stroke can be a basic stroke that constitutes the Chinese character shape, that is, a horizontal stroke, a vertical stroke, a vertical fold, etc.; it can also be several basic strokes written continuously during writing.
[0079] S4. After traversing each stroke in the sentence, the last stroke of several Chinese characters in the sentence is used as each splitting point of the sentence.
[0080] In a preferred embodiment of the present invention, after the traversal is completed, the last stroke of each Chinese character contained in the sentence can be determined, and the last stroke of all the Chinese characters can be used as the splitting points of the sentence. It can be understood that the first splitting point and the strokes contained before it are all the strokes of the first Chinese character written in the sentence. After the first splitting point, the strokes contained between any splitting point and the adjacent previous splitting point are the strokes that constitute the same Chinese character.
[0081] An embodiment of the present invention provides a Chinese character splitting method based on stroke information, which traverses each stroke of several Chinese characters obtained by a touch device, adds the currently traversed stroke to a preset stroke set during each traversal, calculates the feature vector between the traversed stroke and the stroke to be added in the current stroke set, and inputs the feature vector into a preset Chinese character splitting model, so that the Chinese character splitting model determines whether the currently traversed stroke is the last stroke of a Chinese character. When the traversal is completed, the last stroke of several Chinese characters in the sentence is used as each splitting point of the sentence, thereby accurately splitting the several Chinese characters. This avoids the situation where Chinese character splitting is difficult due to the different writing habits or writing scenes of the writer. Furthermore, the Chinese character splitting model does not involve complex image feature extraction algorithms, has high recognition efficiency, and can be applied to many low-performance devices.
[0082] To better illustrate the above solution, the Chinese character splitting model is described in detail below;
[0083] See also Figure 2, is a schematic diagram of a construction process of a Chinese character segmentation model provided by an embodiment of the present invention, including:
[0084] S5, collecting a number of training sentences containing a number of Chinese characters transmitted by the touch device;
[0085] In a preferred embodiment of the present invention, Figure 4 As shown, the several Chinese characters in each training sentence are written in different colors. Preferably, the number of Chinese characters contained in each training sentence is greater than 1.
[0086] S6. Traversing each training stroke in the training sentence, extracting the currently traversed training stroke during each traversal and adding it to a preset training set, calculating a feature vector between the training set and the next training stroke to be traversed, and assigning a corresponding label to the feature vector; wherein the label includes: a first label for indicating that all strokes in the training set can form a Chinese character, and a second label for indicating that all strokes in the training set cannot form a Chinese character;
[0087] In a preferred embodiment of the present invention, during each traversal, the currently traversed training stroke is extracted and added to a preset training set, a feature vector between the training set and the next training stroke to be traversed is calculated, and a corresponding label is assigned to the feature vector, including:
[0088] S61, traversing the training strokes in the order of input time of the training strokes, extracting the currently traversed training strokes, and adding them to the training set;
[0089] S62, obtaining the stroke information of the strokes in the training set and the stroke information of the next training stroke to be traversed;
[0090] S63, calculating a feature vector between the training set and the next training stroke to be traversed;
[0091] The eigenvector includes: a first eigenvalue, a second eigenvalue, a third eigenvalue, a fourth eigenvalue, and a fifth eigenvalue;
[0092] The first characteristic value is the difference between the maximum horizontal coordinate value of the strokes included in the training set and the minimum horizontal coordinate value of the next training stroke to be traversed;
[0093] The second eigenvalue is the height and width of the training set;
[0094] The third eigenvalue is the distance between the coordinates of the first screen sampling point of the currently traversed training stroke and the coordinates of the first screen sampling point of the next training stroke to be traversed;
[0095] The fourth eigenvalue is the distance between the coordinates of the last screen sampling point of the currently traversed training stroke and the coordinates of the last screen sampling point of the next training stroke to be traversed;
[0096] The fifth eigenvalue is the ratio of the height of the training set to the height of the training sentence.
[0097] It should be noted that the number of eigenvalues contained in the feature vector is usually 8 to 15. In addition to the five eigenvalues, the feature vector also contains other eigenvalues. The other eigenvalues can enable the feature vector to carry more stroke feature information, such as the writing order characteristics of Chinese characters, the writing order characteristics of strokes, and the position characteristics of adjacent strokes.
[0098] S64, assigning corresponding labels to the feature vectors, wherein the labels include: a first label for indicating that all strokes in the training set can form a Chinese character, and a second label for indicating that all strokes in the training set cannot form a Chinese character;
[0099] It should be noted that the first label and the second label are represented by true and false, or 1 and 0, respectively. Furthermore, when the feature vector is assigned the first label, the current training set is cleared. S7, the feature vector and the corresponding label corresponding to the currently traversed training stroke are used as a piece of training data; after the traversal is completed, a stroke training data set containing a plurality of training data is obtained;
[0100] In a preferred embodiment of the present invention, each time a stroke is traversed, a corresponding piece of training data can be obtained. Therefore, when the number of the training sentences does not exceed one thousand, sufficient training data can still be obtained.
[0101] S8. Using the stroke training data set, inputting it into a pre-built neural network model for training, and obtaining the Chinese character segmentation model when the training is completed.
[0102] Preferably, the Chinese character splitting model structure is a fully connected network structure including three hidden layers.
[0103] In a preferred embodiment of the present invention, when the pre-constructed neural network model is trained, the feature vectors and labels in the training data are used as input. Since the number of eigenvalues contained in the feature vector is 8 to 15, the dimension of the input feature vector of the model is usually in the numerical range of [8,15]. Preferably, this embodiment uses a 12-dimensional input feature vector so that the model can learn enough knowledge during training without causing the model to fail to converge during the training process. Furthermore, when constructing a stroke training data set, the feature vector between each stroke and the next stroke is calculated, which is equivalent to pre-positioning the feature extraction work of the model. Therefore, the pre-constructed neural network model only uses a fully connected network structure with three hidden layers to extract features from the input feature vector. Preferably, the nodes of the three hidden layers are 12, 6, and 3 respectively, and the dimension of the output layer is 1, that is, the output of the model is the probability of splitting whether all the strokes in the training set corresponding to the currently input training data constitute a Chinese character.
[0104] The Chinese character segmentation model provided by one embodiment of the present invention simplifies feature extraction. Its simple model structure reduces the number of hidden layers required for feature extraction and eliminates the need for large amounts of data when training the model. Consequently, the constructed network model is sufficiently small, resulting in higher computational efficiency and reduced training difficulty. The trained Chinese character segmentation model can be applied to many low-performance devices for Chinese character segmentation.
[0105] like Figure 3 FIG. 1 is a schematic diagram showing the structure of a Chinese character splitting device based on stroke information provided by another embodiment of the present invention, comprising:
[0106] A Chinese character acquisition module, used to acquire a sentence containing a plurality of Chinese characters transmitted by the touch device;
[0107] A stroke traversal module traverses each stroke in the sentence, extracting the currently traversed stroke and adding it to a preset stroke set during each traversal;
[0108] a Chinese character splitting module that calculates a feature vector between a current stroke set and a next stroke to be traversed, and transmits the feature vector to a preset Chinese character splitting model so that the Chinese character splitting model determines whether the currently traversed stroke is the last stroke of a Chinese character; if the currently traversed stroke is determined to be the last stroke of a Chinese character, all strokes in the current stroke set are considered as strokes of a single Chinese character, and the current stroke set is cleared;
[0109] The split point confirmation module uses the last stroke of several Chinese characters in the sentence as the split points of the sentence after traversing each stroke in the sentence.
[0110] Preferably, the Chinese character splitting device based on stroke information further includes: a model building module;
[0111] The model building module is used to collect several training sentences containing several Chinese characters transmitted by a touch device; traverse each training stroke in the training sentence, extract the currently traversed training stroke at each traversal and add it to a preset training set, calculate the feature vector between the training set and the next training stroke to be traversed, and assign a corresponding label to the feature vector; wherein the label includes: a first label for representing that all strokes in the training set can form a Chinese character, and a second label for representing that all strokes in the training set cannot form a Chinese character; the feature vector and the corresponding label corresponding to the currently traversed training stroke are used as a piece of training data; after the traversal is completed, a stroke training data set containing several training data is obtained; the stroke training data set is used to input into a pre-built neural network model for training, and when the training is completed, the Chinese character segmentation model is obtained.
[0112] In one embodiment of the present invention, the model construction module can be provided in the Chinese character segmentation device or in another device to construct a Chinese character segmentation model, and the constructed Chinese character segmentation model is input into the Chinese character segmentation device. It is understood that the Chinese character segmentation device can obtain the Chinese character segmentation model by, in addition to constructing the Chinese character segmentation model by providing the model construction module on its own device, also by importing a trained Chinese character segmentation model from another device.
[0113] An embodiment of the present invention provides a Chinese character splitting device based on stroke information, which can traverse each stroke of several Chinese characters obtained by a touch device, add the currently traversed stroke to a preset stroke set during each traversal, calculate the feature vector between the traversed stroke and the stroke to be added in the current stroke set, and input the feature vector into a preset Chinese character splitting model, so that the Chinese character splitting model can determine whether the currently traversed stroke is the last stroke of a Chinese character. When the traversal is completed, the last stroke of several Chinese characters in the sentence is used as each splitting point of the sentence, thereby accurately splitting the several Chinese characters. This avoids the situation where it is difficult to split Chinese characters due to the different writing habits or writing scenes of the writer. Furthermore, the Chinese character splitting model does not involve complex feature extraction algorithms, has high recognition efficiency, and can be applied to many low-performance devices.
[0114] Another embodiment of the present invention provides a device, which is a terminal device and can be a computing device such as a desktop computer, a notebook, a PDA, a cloud server, etc. The terminal device can include, but is not limited to, a processor and a memory.
[0115] The processor may be a central processing unit (CPU), other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. The general-purpose processor may be a microprocessor or any conventional processor, etc. The processor is the control center of the terminal device, connecting various parts of the entire terminal device using various interfaces and lines.
[0116] The memory can be used to store the computer program, and the processor realizes various functions of the terminal device by running or executing the computer program stored in the memory and calling the data stored in the memory. The memory can mainly include a program storage area and a data storage area, wherein the program storage area can store an operating system, at least one application required for a function, etc.; the data storage area can store data created based on the use of the mobile phone, etc. In addition, the memory can include a high-speed random access memory and can also include a non-volatile memory, such as a hard disk, a memory, a plug-in hard disk, a smart memory card (Smart Media Card, SMC), a secure digital (Secure Digital, SD) card, a flash card (Flash Card), at least one disk storage device, a flash memory device, or other volatile solid-state storage device.
[0117] Another embodiment of the present invention provides a storage medium, which is a computer-readable storage medium, and the computer program is stored in the computer-readable storage medium. When the computer program is executed by the processor, it can implement the steps of the above-mentioned various method embodiments. The computer program includes computer program code, and the computer program code can be in source code form, object code form, executable file or some intermediate form. The computer-readable medium may include: any entity or device that can carry the computer program code, a recording medium, a USB flash drive, a mobile hard disk, a magnetic disk, an optical disk, a computer memory, a read-only memory (ROM), a random access memory (RAM), an electrical carrier signal, a telecommunications signal, and a software distribution medium.
[0118] The above is a preferred embodiment of the present invention. It should be pointed out that for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the principles of the present invention. These improvements and modifications are also considered to be within the scope of protection of the present invention.
Claims
1. A Chinese character splitting method based on stroke information, characterized in that: include: Acquire a sentence containing a plurality of Chinese characters transmitted by the touch device; Traversing each stroke in the sentence, extracting the currently traversed stroke in each traversal and adding it to a preset stroke set; Obtaining stroke information of each stroke in the current stroke set and stroke information of a next stroke to be traversed; determining a feature vector between the current stroke set and the next stroke to be traversed based on the stroke information of each stroke in the current stroke set and the stroke information of the next stroke to be traversed, transmitting the feature vector to a preset Chinese character splitting model so that the Chinese character splitting model determines whether the currently traversed stroke is the last stroke of a Chinese character; if it is determined that the currently traversed stroke is the last stroke of a Chinese character, treating all strokes in the current stroke set as the strokes of a Chinese character, and clearing the current stroke set; After each stroke in the sentence is traversed, the last stroke of several Chinese characters in the sentence is used as each splitting point of the sentence.
2. A Chinese character splitting method based on stroke information as claimed in claim 1, characterized in that: The traversing each stroke in the sentence includes: Obtaining stroke information of each stroke in the sentence; wherein the stroke information is a set of coordinates of a plurality of screen sampling points generated by the touch device when inputting a stroke on the touch device, and an input time of each screen sampling point; Taking the input time of the first screen sampling point of each stroke as the input time of each stroke; Each stroke in the sentence is traversed in the order of input time of the strokes.
3. A Chinese character splitting method based on stroke information as claimed in claim 2, characterized in that: The eigenvector includes: a first eigenvalue, a second eigenvalue, a third eigenvalue, a fourth eigenvalue, and a fifth eigenvalue; The first characteristic value is the difference between the maximum horizontal coordinate value of the strokes included in the stroke set and the minimum horizontal coordinate value of the next stroke to be traversed; The second characteristic value is the height and width of the stroke set; The third characteristic value is the distance between the coordinates of the first screen sampling point of the currently traversed stroke and the coordinates of the first screen sampling point of the next stroke to be traversed; The fourth eigenvalue is the distance between the coordinates of the last screen sampling point of the currently traversed stroke and the coordinates of the last screen sampling point of the next stroke to be traversed; The fifth characteristic value is the ratio of the height of the stroke set to the height of the sentence.
4. A Chinese character splitting method based on stroke information as claimed in claim 3, characterized in that: The Chinese character splitting model determines whether the currently traversed stroke is the last stroke of a Chinese character, including: The Chinese character splitting model outputs a splitting probability for representing whether all the strokes in the current stroke set form a character according to the feature vector; When the split probability is greater than a preset split threshold, determining that the currently traversed stroke is the last stroke of a Chinese character; When the split probability is not greater than a preset split threshold, it is determined that the currently traversed stroke is not the last stroke of a Chinese character.
5. The Chinese character splitting method based on stroke information according to claim 1, wherein: The construction of the Chinese character splitting model includes: collecting a plurality of training sentences containing a plurality of Chinese characters transmitted by the touch device; Traversing each training stroke in the training sentence, extracting the currently traversed training stroke during each traversal and adding it to a preset training set, calculating a feature vector between the training set and the next training stroke to be traversed, and assigning a corresponding label to the feature vector; wherein the label includes: a first label for indicating that all strokes in the training set can form a Chinese character, and a second label for indicating that all strokes in the training set cannot form a Chinese character; The feature vector and the corresponding label corresponding to the currently traversed training stroke are used as a piece of training data; after the traversal is completed, a stroke training data set containing a plurality of training data is obtained; The stroke training data set is used and input into a pre-built neural network model for training. When the training is completed, the Chinese character segmentation model is obtained.
6. A Chinese character splitting method based on stroke information as claimed in claim 5, characterized in that: The Chinese character splitting model structure is a fully connected network structure including three hidden layers.
7. A Chinese character splitting device based on stroke information, characterized in that: include: A Chinese character acquisition module, used to acquire a sentence containing a plurality of Chinese characters transmitted by the touch device; A stroke traversal module, configured to traverse each stroke in the sentence, and extract the currently traversed stroke during each traversal and add it to a preset stroke set; A Chinese character splitting module is configured to obtain stroke information of each stroke in the current stroke set and stroke information of the next stroke to be traversed; determine a feature vector between the current stroke set and the next stroke to be traversed based on the stroke information of each stroke in the current stroke set and the stroke information of the next stroke to be traversed, and transmit the feature vector to a preset Chinese character splitting model so that the Chinese character splitting model determines whether the currently traversed stroke is the last stroke of a Chinese character; if it is determined that the currently traversed stroke is the last stroke of a Chinese character, treat all strokes in the current stroke set as the strokes of a Chinese character and clear the current stroke set; The split point confirmation module is used to use the last stroke of several Chinese characters in the sentence as the split points of the sentence after traversing each stroke in the sentence.
8. The Chinese character splitting device based on stroke information according to claim 7, characterized in that: Also includes: Model building module; The model building module is used to collect several training sentences containing several Chinese characters transmitted by a touch device; traverse each training stroke in the training sentence, extract the currently traversed training stroke at each traversal and add it to a preset training set, calculate the feature vector between the training set and the next training stroke to be traversed, and assign a corresponding label to the feature vector; wherein the label includes: a first label for representing that all strokes in the training set can form a Chinese character, and a second label for representing that all strokes in the training set cannot form a Chinese character; the feature vector and the corresponding label corresponding to the currently traversed training stroke are used as a piece of training data; after the traversal is completed, a stroke training data set containing several training data is obtained; the stroke training data set is used to input into a pre-built neural network model for training, and when the training is completed, the Chinese character segmentation model is obtained.
9. A device, characterized in that The device is a terminal device, including a processor, a memory, and a computer program stored in the memory and configured to be executed by the processor. When the processor executes the computer program, it implements a Chinese character splitting method based on stroke information as described in any one of claims 1 to 6.
10. A storage medium, characterized in that: The storage medium is a computer-readable storage medium, including a stored computer program, wherein when the computer program is running, the device where the computer-readable storage medium is located is controlled to execute the Chinese character splitting method based on stroke information as described in any one of claims 1 to 6.
Citation Information
Patent Citations
Electronic handwriting individual character disassembling apparatus and method
CN106203538A
Character handwriting recognition method and system
CN109858323A