Text recognition model training method and device, equipment and storage medium

By constructing a set of related words and adjusting the parameters of the text recognition model, the problem of fictitious information caused by insufficient construction of thought chain data in the text recognition model was solved, thereby improving the accuracy and efficiency of entity recognition.

CN120951995APending Publication Date: 2025-11-14GUANGZHOU KUGOU COMP TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202511038669.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-07-28
Publication Date
2025-11-14

AI Technical Summary

Technical Problem

In existing technologies, introducing thought chain-like prompts into text recognition models can easily lead to fabricated information in the model, affecting the accuracy of the recognition results.

Method used

By constructing a set of related words, relevant words in the sample text are obtained, the parameters of the text recognition model are adjusted, and the GRPO reinforcement learning method is adopted to reduce the word segmentation steps and improve the accuracy and efficiency of entity recognition.

Benefits of technology

This avoids fabricating information in the model, improves the accuracy and efficiency of entity recognition, ensures that the recognition results are based on facts, and reduces the word segmentation steps.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120951995A_ABST
    Figure CN120951995A_ABST
Patent Text Reader

Abstract

The invention discloses a text recognition model training method and device, equipment and a storage medium, and relates to the technical field of computers. The method comprises the steps that a training data set is acquired, the training data set comprises at least one training sample, and each training sample comprises a sample text and a sample recognition result corresponding to the sample text; according to the sample text, a related word set corresponding to the sample text is obtained, the related word set comprises at least one sample vocabulary, and each sample vocabulary comprises at least one continuous character in the sample text; obtaining at least two prediction output results corresponding to the sample text through a text recognition model according to the related word set; and adjusting parameters of the text recognition model according to the sample recognition result and the at least two prediction output results to obtain a trained text recognition model. According to the method and the device, the problem of model imaginary is avoided, the entity recognition result extracted by the text recognition model is reasonable and has factual basis, and the accuracy of entity recognition is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of computer technology, and in particular to a method, apparatus, device and storage medium for training a text recognition model. Background Technology

[0002] The music player offers a text search function, allowing users to enter relevant text such as song title, artist name, and album name to search.

[0003] In related technologies, after a user inputs text into a music player, a text recognition model identifies the word types of the entity words contained in the input text. Typically, a prompt text is generated based on the input text. The input text and the prompt text are concatenated and then input into the text recognition model. A thought chain is introduced into the text recognition model to guide the model to think and reason step by step before generating the final answer, so as to obtain all the entity words in the input text and the word types of each entity word.

[0004] However, the above method stimulates the text recognition model's ability by including thought chain prompts in the model input, which can easily lead to model fabrication and affect the accuracy of the recognition results. Summary of the Invention

[0005] This application provides a method, apparatus, device, and storage medium for training a text recognition model. The technical solution provided by this application is as follows:

[0006] According to one aspect of the embodiments of this application, a method for training a text recognition model is provided, the method comprising:

[0007] Obtain a training dataset, which includes at least one training sample. Each training sample includes sample text and a sample recognition result corresponding to the sample text. The sample recognition result corresponding to the sample text includes at least one sample entity word and a sample word type corresponding to the at least one sample entity word.

[0008] Based on the sample text, a set of related words corresponding to the sample text is obtained. The set of related words includes at least one sample word, and each sample word includes at least one consecutive character in the sample text.

[0009] The text recognition model obtains at least two prediction outputs corresponding to the sample text based on the set of related words. The prediction outputs include the prediction recognition result corresponding to the sample text and the prediction analysis text corresponding to the prediction recognition result.

[0010] Based on the sample recognition results and the at least two prediction output results, the parameters of the text recognition model are adjusted to obtain the trained text recognition model.

[0011] According to one aspect of the embodiments of this application, a training apparatus for a text recognition model is provided, the apparatus comprising:

[0012] The data acquisition module is used to acquire a training dataset, which includes at least one training sample. Each training sample includes sample text and a sample recognition result corresponding to the sample text. The sample recognition result corresponding to the sample text includes at least one sample entity word and a sample word type corresponding to the at least one sample entity word.

[0013] The set acquisition module is used to obtain a set of related words corresponding to the sample text based on the sample text. The set of related words includes at least one sample word, and each sample word includes at least one consecutive character in the sample text.

[0014] The result output module is used to obtain at least two prediction output results corresponding to the sample text based on the relevant word set through the text recognition model. The prediction output results include the prediction recognition result corresponding to the sample text and the prediction analysis text corresponding to the prediction recognition result.

[0015] The model training module is used to adjust the parameters of the text recognition model based on the sample recognition results and the at least two prediction output results to obtain the trained text recognition model.

[0016] According to one aspect of the embodiments of this application, a computer device is provided, the computer device including a processor and a memory, the memory storing a computer program, the computer program being loaded and executed by the processor to implement the above-described text recognition model training method.

[0017] According to one aspect of the embodiments of this application, a computer-readable storage medium is provided, wherein a computer program is stored in the computer-readable storage medium, the computer program being loaded and executed by a processor to implement the above-described text recognition model training method.

[0018] According to one aspect of the embodiments of this application, a computer program product is provided, the computer program product including a computer program, the computer program being loaded and executed by a processor to implement the above-described text recognition model training method.

[0019] The technical solution provided in this application can bring the following beneficial effects:

[0020] By constructing a relevant word set based on sample text and appropriately supplementing the sample text with external knowledge, the text recognition model can use a long thought chain approach to further analyze vocabulary based on the relevant word set when performing entity recognition on the sample text. Compared to related technologies that directly extract entity words from the text for thought chain analysis, the technical solution provided in this application pre-provides the text recognition model with each sample word present in the sample text. This allows the text recognition model to analyze the probability that each sample word is an entity word based on the provided multiple word scenarios and contextual information. This avoids the text recognition model generating fictitious information unbased on facts and logic when performing entity recognition due to insufficient data construction of the long thought chain, thus avoiding the problem of model fictitiousness. The entity recognition results extracted by the text recognition model are reasonable and based on facts, improving the accuracy of entity recognition. Furthermore, the above method reduces the word segmentation steps of the text recognition model, which helps to improve the entity recognition efficiency of the text recognition model. Attached Figure Description

[0021] Figure 1 This is a schematic diagram of a computer system provided in one embodiment of this application;

[0022] Figure 2 This is a flowchart of a training method for a text recognition model provided in one embodiment of this application;

[0023] Figure 3 This is a schematic diagram of the related word set corresponding to the sample vocabulary provided in one embodiment of this application;

[0024] Figure 4 This is a schematic diagram of the training process of a text recognition model provided in one embodiment of this application;

[0025] Figure 5 This is a flowchart of a text recognition method provided in one embodiment of this application;

[0026] Figure 6 This is a block diagram of a training apparatus for a text recognition model provided in one embodiment of this application;

[0027] Figure 7 This is a structural block diagram of a computer device provided in one embodiment of this application. Detailed Implementation

[0028] To make the objectives, technical solutions, and advantages of this application clearer, the embodiments of this application will be described in further detail below with reference to the accompanying drawings.

[0029] Please refer to Figure 1The diagram illustrates a computer system provided in one embodiment of this application. The computer system may include a model training device 10 and a model usage device 20.

[0030] The model training device 10 can be an electronic device such as a mobile phone, tablet computer, laptop computer, desktop computer, smart TV, multimedia playback device, vehicle terminal, server, intelligent robot, or other electronic devices with strong computing power. The model training device 10 is used to train the text recognition model.

[0031] In this embodiment, the text recognition model is a machine learning model trained using a text recognition model training method. It is used to generate at least two output results corresponding to the output text based on the set of related words corresponding to the input text. The model training device 10 can train the text recognition model using machine learning to enable it to perform entity recognition on the input text. Specific model training methods can be found in the following embodiments.

[0032] In this embodiment, the input data of the text recognition model is a set of related words corresponding to the input text, which is extracted from the input text. The output data consists of at least two output results corresponding to the output text, and each output result includes the entity recognition result corresponding to the input text and the analysis text corresponding to the entity recognition result.

[0033] The trained text recognition model can be deployed on the model-using device 20. The model-using device 20 can be an electronic device such as a mobile phone, tablet, laptop, desktop computer, smart TV, multimedia playback device, in-vehicle terminal, server, intelligent robot, or other electronic devices with strong computing power. When entity recognition of the input text is required, the model-using device 20 can achieve the above function through the trained text recognition model.

[0034] The model training device 10 and the model usage device 20 can be two separate devices or the same device. If the model training device 10 and the model usage device 20 are the same device, then the model training device 10 can be deployed in the model usage device 20.

[0035] In this embodiment of the application, the entity performing each step can be a computer device, which can be, for example, a computer device... Figure 1 The model training device 10 can also be the model usage device 20. The server can be a standalone physical server, a server cluster or distributed system consisting of multiple physical servers, or a cloud server providing cloud computing services.

[0036] Please refer to Figure 2 This document illustrates a flowchart of a training method for a text recognition model provided in one embodiment of this application. The execution entity for each step of this method can be a computer device. The method may include at least one of the following steps 210 to 240:

[0037] Step 210: Obtain the training dataset. The training dataset includes at least one training sample. Each training sample includes sample text and the corresponding sample recognition result. The corresponding sample recognition result includes at least one sample entity word and the sample word type corresponding to each of the at least one sample entity word.

[0038] Optionally, the sample text can be manually constructed text or historical input text extracted from historical search data. Optionally, the sample recognition result corresponding to the sample text can be an entity recognition result manually determined based on each entity word in the knowledge base and the word type corresponding to each entity word; the sample recognition result corresponding to the sample text can also be an entity recognition result obtained by manually correcting the recognition result obtained through a large model.

[0039] Sample entity vocabulary is a vocabulary extracted from sample text to represent the entity recognition meaning and entity recognition target of the sample text. Each sample entity vocabulary includes at least one character from the sample text, and there are no duplicate characters in the sample text between different sample entity vocabulary.

[0040] When the sample text contains one or more characters that have no practical meaning, such as symbols, special characters, control characters, extended characters, or meaningless words, the meaningless characters can be removed when extracting at least one sample entity word. In this case, the total number of characters in at least one sample entity word will be less than the total number of characters in the sample text. Meaningless words can include words like "all," "everything," "of," "this," and "that," which lack practical meaning. For example, if the sample text includes characters 1, 2, 3, and 4, and character 3 is a meaningless character, then sample entity word 1 can include the sample entity word composed of characters 1 and 2, and sample entity word 2 can include the sample entity word composed of character 3.

[0041] In the case where the sample text contains one or more characters that have no practical meaning, when extracting at least one sample entity word from the sample text, no characters in the sample text need to be removed, and the total number of characters contained in the at least one sample entity word is equal to the number of characters in the sample text. For example, if the sample text includes character 1, character 2, character 3, and character 4, then sample entity word 1 can include the sample entity word composed of character 1 and character 2, and sample entity word 2 can include the sample entity word composed of character 3 and character 4.

[0042] Step 220, according to the sample text, obtain the relevant word set corresponding to the sample text, and the relevant word set includes at least one sample word, and each sample word includes at least one continuous character in the sample text.

[0043] Based on each character in the sample text, multiple words can be formed, and each word includes at least one continuous character in the sample text. By obtaining the entity words existing in the candidate word bank from the multiple words, at least one sample word can be obtained, and according to the at least one sample word, the relevant word set corresponding to the sample text can be obtained. There may be one or more repeated characters between different sample words, or there may be no repeated characters.

[0044] If there is no word formed by one or more continuous characters in the sample text in the candidate word bank, then this word cannot be recognized as a sample word. For example, if the sample text is "The girl by the bridge 1926 Helen", the words "by the bridge" and "the girl" can be extracted from the sample text. Since "by the bridge" exists in the candidate word bank, "by the bridge" belongs to the sample word and can be added to the relevant word set. Since "the girl" does not exist in the candidate word bank, "the girl" does not belong to the sample word, and the relevant word set does not include "the girl".

[0045] The candidate word bank is a pre-given set of entity words, and the candidate word bank includes at least one word, the word type corresponding to each at least one word, and the weight of the word type corresponding to each at least one word.

[0046] The words included in the candidate word library and the word types corresponding to each word are related to the application field of the text recognition model. For example, if the text recognition model is applied to the field of song recognition, the words included in the candidate word library and the word types corresponding to each word are related to songs. The candidate word library includes words of at least one of the following word types: the names of song participants, song names, album names, IP (Intellectual Property) names, modifying words, meaningless words, etc. Among them, the names of song participants include, but are not limited to, singer names, lyricist names, composer names, arranger names, mixer names, etc. In some examples, the names of song participants may include Chinese names and foreign names of song participants. Foreign languages include, but are not limited to, English, Japanese, French and other languages. Song names include, but are not limited to, the full names of songs, translated names of songs, abbreviated names of songs and other song names in different representations. For the translated names of songs, the language type of the translated names is not limited in this application. Album names include, but are not limited to, the full names of albums, translated names of albums, abbreviated names of albums and other album names in different representations. For the translated names of albums, the language type of the translated names is not limited in this application. IP names refer to the names of well-known IPs identified in big data. IPs include, but are not limited to, literary works, film and television works, variety shows, game works, etc. For entity words not identified as well-known IPs in big data, the type of the entity word cannot be determined as an IP name. Modifying words are entity words used to modify the main entity word. In the field of song recognition, the main entity word is the song name, so the modifying words are entity words used to modify the song name. Modifying words can be words such as male version, female version, concert version, etc. Meaningless words can be words such as all, every, of, this, etc. that have no actual meaning. Usually, meaningless words are words that can be deleted. However, if a meaningless word is a word indicating an audio type, it can be retained. For example, meaningless words can be words indicating audio types such as TV dramas, movies, variety shows, audiobooks, etc.

[0047] For another example, if the text recognition model is applied to the field of video recognition, the preset word types are word types related to videos, including but not limited to the names of video participants, the names of video production personnel, video names, IP names, modifying words, meaningless words, etc.

[0048] Each word can correspond to one word type or multiple word types. For example, in the field of song recognition, the word "Qi Li Xiang" can belong to the lyric name or the album name. At least one word type corresponding to each word is configured with a weight. The weight corresponding to the word type of each word is used to measure the probability that the word belongs to the word type. Usually, in the case where a word corresponds to multiple word types, the weights configured for the multiple word types are different.

[0049] In some embodiments, the text recognition model is applied to the field of song recognition, and the sample vocabulary is configured with at least one vocabulary type and a weight corresponding to each vocabulary type. The weight corresponding to the vocabulary type is used to indicate the number of times the song was played for the sample vocabulary.

[0050] The weight corresponding to each word type of the sample vocabulary is directly obtained from the candidate word library, meaning it is pre-determined based on the number of times the sample vocabulary is played in songs. For example, when the word type of the sample vocabulary is a song title, the weight of the sample vocabulary as a song title is the number of times the sample vocabulary is played in songs. When the word type of the sample vocabulary is an artist's name, the weight of the sample vocabulary as an artist's name is the total number of times all songs by that artist are played divided by a first preset value. This first preset value is based on the average number of songs played by each artist according to big data statistics. For example, if the first preset value is 20, then the weight of the sample vocabulary as an artist's name is the total number of times all songs by that artist are played / 20. When the word type of the sample vocabulary is an album title, the weight of the sample vocabulary as an album title is the total number of times all songs in that album are played divided by a second preset value. This second preset value is based on the average number of songs included in each album according to big data statistics. For example, if the second preset value is 10, then the weight of the sample vocabulary as an album title is the total number of times all songs in that album are played / 10. When the sample word type is an IP name, the weight of the sample word as an IP name is the total number of times all songs within that IP are played divided by a third set value. The third set value is based on the average number of songs included in each IP according to big data statistics. For example, the third set value can be 30, then the weight of the sample word as an IP name is the total number of times all songs within that IP are played / 30.

[0051] For example, the set of related words corresponding to the sample words can be referenced. Figure 3 As shown, the sample text is "Bridge Girl 1926 Helen". The related word set includes the sample words "Helen", "Bridge Girl", "Girl", "26", "19", "Sea", "Mother", "Bridge", "92", "Bridge", "Lun", "1926", and "Side". Among them, "Helen" and "Side" are configured with one word type, while the other sample words are configured with two word types. Each word type is configured with a corresponding weight.

[0052] Step 230: Based on the relevant word set, the text recognition model obtains at least two prediction outputs corresponding to the sample text. The prediction outputs include the prediction recognition result corresponding to the sample text and the prediction analysis text corresponding to the prediction recognition result.

[0053] A prompt text generator produces prompt text based on a set of relevant words. This prompt text instructs the text recognition model to generate at least two predicted outputs corresponding to the sample text, following specified formatting requirements. The prompt text is then input into the text recognition model to generate at least two predicted outputs corresponding to the sample text.

[0054] The format requirement for the prompt text is that at least two predicted output results should be output sequentially in descending order of the probability of the predicted output results. When outputting each predicted output result, the predicted recognition result corresponding to the sample text should be output first, and then the predicted analysis text corresponding to the predicted recognition result should be output. In this way, the output data of the text recognition model can be represented as: predicted recognition result 1, predicted analysis text 1, predicted recognition result 2, predicted analysis text 2, ..., predicted recognition result n, predicted analysis text n, where n is an integer greater than 1.

[0055] In some embodiments, the prediction and identification results include at least one predicted entity word and at least one predicted word type corresponding to each predicted entity word.

[0056] There are no duplicate characters in the sample text among different predicted entity terms. The total number of characters in at least one predicted entity term may be less than or equal to the number of characters in the sample text. The predicted term type corresponding to each predicted entity term is the term type that best expresses the actual meaning of the predicted entity term, determined from at least one term type corresponding to that predicted entity term.

[0057] The predictive analysis text corresponding to the predicted recognition result is the process analysis text of the text recognition model obtaining the predicted recognition result. Different predicted recognition results correspond to different predictive analysis texts.

[0058] Step 240: Adjust the parameters of the text recognition model based on the sample recognition results and at least two prediction outputs to obtain the trained text recognition model.

[0059] For example, the parameters of the text recognition model can be adjusted using the GRPO (Group Relative Policy Optimization) reinforcement learning method to obtain the trained text recognition model. The specific reinforcement learning method can be referred to in the following embodiments, which will not be described here.

[0060] The technical solution provided in this application constructs a relevant word set based on sample text, appropriately supplementing the sample text with external knowledge. This allows the text recognition model to perform further lexical analysis based on the relevant word set using a long thought chain approach when recognizing entities in the sample text. Compared to related technologies that directly extract entity words from the text for thought chain analysis, the technical solution provided in this application pre-provides the text recognition model with various sample words present in the sample text. This allows the text recognition model to analyze the probability that each sample word is an entity word based on multiple provided word scenarios and contextual information. This avoids the text recognition model generating fictitious information unbased on facts and logic during entity recognition due to insufficient data construction of long thought chains, thus avoiding the problem of model fictitiousness. The entity recognition results extracted by the text recognition model are reasonable and factually based, improving the accuracy of entity recognition. Furthermore, the above method reduces the word segmentation steps of the text recognition model, contributing to improved entity recognition efficiency.

[0061] In some embodiments, step 230 includes at least one of sub-steps 231 to 233.

[0062] Sub-step 231: Based on at least one sample word, the text recognition model obtains the target word type corresponding to each of the at least one sample word. The target word type is the word type corresponding to the maximum value among the weights of each of the at least one word type.

[0063] Each sample word corresponds to at least one sample word. The word type corresponding to the maximum value among the weights of each of the at least one sample word is determined as the target word type of the sample word. For example, Figure 3 The sample word "Bridge Girl" has a weight of 8725 when it is a song title and a weight of 3037 when it is an album title. Therefore, the song title can be used as the target word type for "Bridge Girl".

[0064] Sub-step 232: Based on the target word type corresponding to at least one sample word, obtain the weight corresponding to at least one sample word.

[0065] The weight corresponding to the sample word refers to the weight of the target word type corresponding to the sample word. For example, the weight corresponding to "Girl by the Bridge" is the weight of the target word type (song name) corresponding to "Girl by the Bridge", that is, the weight corresponding to "Girl by the Bridge" is 8725.

[0066] Sub-step 233: Based on the weights corresponding to at least one sample word, obtain at least two prediction outputs for the sample text.

[0067] By determining the weights corresponding to at least one sample word, the probability of each sample word being an entity word can be measured based on the weights. Thus, by analyzing each sample word in a long thought chain manner through the text recognition model, entity words in the sample text can be identified more accurately, thereby improving the accuracy of the recognition results.

[0068] In some embodiments, duplicate characters exist in the first sample vocabulary and the second sample vocabulary, and the number of characters in the first sample vocabulary is greater than the number of characters in the second sample vocabulary. If the weight corresponding to the first sample vocabulary is greater than the weight corresponding to the second sample vocabulary, the first sample vocabulary is determined as the predicted entity vocabulary in the prediction and recognition result. If the weight corresponding to the first sample vocabulary is less than the weight corresponding to the second sample vocabulary, the second sample vocabulary is determined as the predicted entity vocabulary in the prediction and recognition result. If the weight corresponding to the first sample vocabulary is equal to the weight corresponding to the second sample vocabulary, the predicted entity vocabulary in the prediction and recognition result is determined from the first and second sample vocabulary based on general knowledge. The predicted vocabulary type corresponding to the predicted entity vocabulary is obtained based on the target vocabulary type corresponding to the predicted entity vocabulary.

[0069] The first and second sample words contain repeated characters. This could mean that the first sample word includes all characters from the second sample word. For example, you can refer to... Figure 3 As shown, the first sample word can be "girl by the bridge", and the second sample word can be any one of "by the bridge", "girl", "mother", "bridge", or "side". Alternatively, the first sample word may contain characters that are not present in the second sample word, and the second sample word may contain characters that are not present in the first sample word. For example, the first sample word can be "92", and the second sample word can be any one of "26" or "19".

[0070] For at least one sample word in the set of related words, obtain the first sample word and the second sample word that have duplicate characters among any two of them. If the weight corresponding to the first sample word is greater than the weight corresponding to the second sample word, the second sample word in the set of related words can be covered by the first sample word, and the second sample word in the set of related words is filtered out. If the weight corresponding to the first sample word is less than the weight corresponding to the second sample word, the first sample word in the set of related words can be covered by the second sample word, and the first sample word in the set of related words is filtered out. If the weight corresponding to the first sample word is equal to the weight corresponding to the second sample word, according to the recognition degrees of the target word types corresponding to the first sample word and the second sample word under general knowledge, the sample word corresponding to the target word type with a higher recognition degree is used to cover the other sample word, and the set of related words is filtered. For example, if the recognition degree of the target word type corresponding to the first sample word under general knowledge is greater than the recognition degree of the target word type corresponding to the second sample word, the second sample word is covered by the first sample word, and the second sample word in the set of related words is filtered out. If the recognition degree of the target word type corresponding to the second sample word under general knowledge is greater than the recognition degree of the target word type corresponding to the first sample word, the first sample word is covered by the second sample word, and the first sample word in the set of related words is filtered out.

[0071] After the above-mentioned vocabulary filtering process for the set of related words, there are no duplicate characters among the obtained sample words. At least one sample word in the filtered set of related words is determined as at least one predicted entity word, and the target word types corresponding to at least one sample word in the filtered set of related words are determined as the predicted word types corresponding to at least one predicted entity word respectively.

[0072] Exemplarily, it can be referred to Figure 3 As shown, if the first sample word is "girl" and the second sample word is "lady", the weight corresponding to "girl" is 2865, which is greater than the weight 150 corresponding to "lady", so "lady" is covered by "girl", and the sample word "lady" in the set of related words is filtered out. And since the weight corresponding to "girl by the bridge" is 8725, which is greater than the weight 2865 corresponding to "girl", "girl" is covered by "girl by the bridge", and the sample word "girl" in the set of related words is filtered out.

[0073] By using the above method to extract the predicted entity words in the set of related words, retaining the maximum value of the weights corresponding to each character in each sample word in the respective sample words, the weights of the obtained predicted entity words can fully represent the entity meanings in the sample text, effectively ensuring the accuracy of entity recognition.

[0074] In some embodiments, if the target word type corresponding to the first sample word does not meet the reasonable rules, the second sample word is determined as the predicted entity word in the prediction and recognition result. If the target word type corresponding to the second sample word does not meet the reasonable rules, the first sample word is determined as the predicted entity word in the prediction and recognition result.

[0075] Reasonable rules refer to rules that conform to general knowledge. For example, if the first sample word is "1926" and the second sample word is "26", the target word type corresponding to "26" is an IP name. However, "26" as an IP name does not conform to reasonable rules under general knowledge, and there is no well-known IP for "26". It is possible that an error occurred when extracting the relevant word set. Therefore, it is necessary to correct the sample words that do not meet reasonable rules, filter out the sample word "26" in the relevant word set, and retain the sample word "1926".

[0076] For example, if the first sample word is "19" and the second sample word is "92", the target word type corresponding to "19" is an IP name, and the target word type corresponding to "92" is a singer name. However, "19" as an IP name does not conform to the reasonable rules under general knowledge, as there is no well-known IP with the name "19". Similarly, "92" as a singer name does not conform to the reasonable rules under general knowledge, as there is no singer name with the name "92". This may be due to an error in the extraction of the relevant word set. Therefore, it is necessary to correct the sample words that do not meet the reasonable rules by filtering out the sample words "19" and "92" from the relevant word set. Since the sample word "1926" contains repeated characters in both "19" and "92", and the target word type corresponding to "1926" is an album name, which meets the reasonable rules, the sample word "1926" can be retained from the relevant word set.

[0077] By filtering out sample words that do not meet reasonable rules using the above method, the target word type corresponding to the obtained predicted entity words is a word type that conforms to general knowledge. This provides a fallback measure for the aforementioned related word set extraction step, avoiding the impact of errors in the extraction of related word sets on the accuracy of entity recognition, and ensuring the accuracy of the recognition results.

[0078] In some embodiments, the target word type corresponding to the predicted entity word is determined as the predicted word type corresponding to the predicted entity word in the prediction recognition result.

[0079] In some embodiments, if the weight corresponding to the predicted entity word is greater than a first threshold, the target word type corresponding to the predicted entity word is determined as the predicted word type corresponding to the predicted entity word in the prediction recognition result; if the weight corresponding to the predicted entity word is less than the first threshold, the predicted word type corresponding to the predicted entity word in the prediction recognition result is determined based on general knowledge.

[0080] If the weight corresponding to the predicted entity word is greater than the first threshold, the weight corresponding to the predicted entity word can be considered as correct data. Therefore, the target word type corresponding to the predicted entity word can be determined as the predicted word type corresponding to the predicted entity word in the prediction and recognition results.

[0081] If the weight corresponding to a predicted entity word is less than the first threshold, the weight of the predicted entity word can be considered erroneous data. Therefore, it is necessary to determine the predicted word type corresponding to the predicted entity word in the prediction result based on general knowledge. In general knowledge, the word type identified by the predicted entity word is usually defined as the predicted word type corresponding to the predicted entity word.

[0082] If the weight of the predicted entity word is less than the first threshold, the target word type corresponding to the predicted entity word can be determined as the predicted word type corresponding to the predicted entity word in the prediction recognition result. Then, the parameters of the text recognition model can be adjusted according to the difference between the prediction output result and the sample recognition result to correct the type determination of the text recognition model.

[0083] This application does not limit the specific value of the first threshold. For example, the first threshold can be 100. If the weight of the predicted entity word is greater than 100, the target word type corresponding to the predicted entity word is determined as the predicted word type corresponding to the predicted entity word in the prediction recognition result. If the weight of the predicted entity word is less than 100, the predicted word type corresponding to the predicted entity word in the prediction recognition result is determined according to general knowledge.

[0084] By using general knowledge to determine the predicted word type corresponding to the predicted entity words with lower weights, the method avoids situations where the target word type is not the actual word type of the predicted entity word due to low weights, thus avoiding prolonged training time for the text recognition model. This method can improve the accuracy probability of predicting word type, reduce unnecessary training steps in the text recognition model, shorten the training time of the text recognition model, and improve the training efficiency of the text recognition model.

[0085] For example, a predicted output of a text recognition model could be the following text:

[0086] Okay, now I need to process the user-input text "Bridge Girl 1926 Helen" and perform entity parsing according to the given process. First, I need to carefully examine the words in the candidate vocabulary, as well as the weight and type of each word.

[0087] First, the user input text is "Bridge Girl 1926 Helen". I need to break down this text to see if there are any possible entity combinations. The candidate word "Bridge Girl" exists, categorized as "song" and "album", with weights of 8725 and 3037 respectively. Therefore, "Bridge Girl" is more likely to be a "song". Next is "1926". The candidate word "1926" exists as an "album" with a weight of 16, or as a "person" with a weight of 7. However, there might be a problem here, because "1926" seems more like a year, perhaps an album or song year identifier, but the candidate word lists the types as "album" and "person". This might be incorrect and requires further analysis.

[0088] Next is "Helen". The type in the candidate word list is person, with a weight of 40836. This should be fine, because Helen could be a person's name, such as a singer or creator.

[0089] Next, I need to examine the possibilities after splitting. For example, "The Girl by the Bridge" could be treated as a song, and "1926" as an album or person, but "1926" as an album only has a weight of 16, which might not be reasonable. Or, "19" and "26" could be separated, but in the candidate word list, "19" could be an IP address with a weight of 586, or a person with a weight of 500, while "26" could be an IP address with a weight of 1088, or an album with a weight of 131. However, splitting them like this might not be as reasonable as treating "1926" as a whole.

[0090] Additionally, the user might have entered the song "The Girl by the Bridge," which belongs to a specific album or year. For example, "1926" could be an album name or the album containing the song. However, in the candidate word list, "1926" has a lower weight as an album but a higher weight as a person, which might be incorrect. It's possible that the "1926" in the candidate word list is incorrect, or the user might be searching for an album or song with "1926" in its name.

[0091] Considering "Helen" as a person, she could be a singer, so the user might be searching for the song "The Girl by the Bridge" sung by Helen, within the album "1926". Alternatively, "1926" could be the album title, and "The Girl by the Bridge" the song title, but it needs to be confirmed whether this matches a common combination.

[0092] The secondary verification process requires consideration of the reasonableness of user searches. On music platforms, users might search for a song title plus the album title, or a song title plus the artist's name. For example, "The Girl by the Bridge," sung by "Helen," might belong to the album "1926." Or, "1926" could be an album, and "The Girl by the Bridge" could be a song within it. In such cases, the combination is reasonable.

[0093] Additionally, the weight of "1926" as an album in the candidate term library is only 16, which may be incorrect data, or the user may be searching for a specific album, such as "1926 album" or an album with that name. However, common sense suggests that "1926" is more likely a year, such as the release year of a song, which would require a filter type, but the candidate term library doesn't provide any filter type data. However, according to the type definition, a filter is a qualifying modifier, such as version information, so if "1926" is a year, it might belong to the filter type.

[0094] Consider other splitting methods, such as "bridgeside" and "girl," but in the candidate word library, "bridgeside" has a weight of 20 as a song, while "girl" has a weight of 2865 as a person, or a weight of 1326 as a song. However, combining them may not be as reasonable as "bridgeside girl" as a whole, because "bridgeside girl" itself exists in the candidate word library and has a high weight.

[0095] Furthermore, the "1926" in the user input might be a modifier, such as indicating a year, so it might belong to the filter type. However, the candidate dictionary does not provide data of the filter type, so according to rule 3.1, if there is an error in the candidate dictionary, the type can be adjusted. For example, "1926" can be considered a filter type, indicating a year, rather than an album or person.

[0096] Therefore, the final parsing result may be: "Girl by the Bridge" as the song type, "1926" as the filter type representing the year, and "Helen" as the person type.

[0097] This combination aligns with the user's likely search intent: to find the song "The Girl by the Bridge" sung by Helen Keller from an album released in 1926. Alternatively, the user might be searching for the song "The Girl by the Bridge" from the album "1926" sung by Helen Keller. In the latter case, the combination is reasonable.

[0098] In some embodiments, step 240 includes at least one of sub-steps 241 to 244.

[0099] Sub-step 241: Based on at least two prediction outputs, obtain the format scores corresponding to at least two prediction outputs respectively. The format scores corresponding to the prediction outputs are used to indicate whether the text format of the prediction outputs meets the format requirements.

[0100] For example, the format requirement could be to first output the prediction recognition result corresponding to the sample text when outputting each prediction output result, and then output the prediction analysis text corresponding to the prediction recognition result.

[0101] In some embodiments, for each of at least two predicted outputs, if the text format of the predicted output conforms to the format requirements, the format score corresponding to the predicted output is determined as a first value. If the text format of the predicted output does not conform to the format requirements, the format score corresponding to the predicted output is determined as a second value.

[0102] The first and second numerical values ​​are different, and this application does not limit the specific values ​​of the first and second numerical values. For example, the first numerical value can be 1, and the second numerical value can be 0. Then, if the text format of the predicted output result meets the format requirements, the format score corresponding to the predicted output result is determined to be 1; if the text format of the predicted output result does not meet the format requirements, the format score corresponding to the predicted output result is determined to be 0. For instance, if the predicted output result outputs the predicted recognition result first, and then outputs the predicted analysis text, then the format score corresponding to the predicted output result is determined to be 1; if the predicted output result outputs the predicted analysis text first, and then outputs the predicted recognition result, then the format score corresponding to the predicted output result is determined to be 0; or, if the predicted output result only outputs the predicted recognition result, then the format score corresponding to the predicted output result is determined to be 0.

[0103] By considering the format requirements of the predicted output and assigning format scores to the predicted output, the output data of the text recognition model becomes more standardized and logical, thereby improving the accuracy of the output results of the text recognition model.

[0104] Sub-step 242: Based on the sample identification result and the prediction identification result in at least two prediction output results, obtain the accurate scores corresponding to the at least two prediction output results respectively.

[0105] In some embodiments, for each of the at least two predicted outputs, the precision corresponding to the predicted identification result is obtained based on the sample identification result and the predicted identification result. The recall corresponding to the predicted identification result is obtained based on the sample identification result and the predicted identification result. The harmonic average of the precision and recall corresponding to the predicted identification result is then performed to obtain the accurate score corresponding to the predicted output result.

[0106] The precision corresponding to the predicted recognition result refers to the proportion of samples that are actually positive among all the samples predicted as positive by the model. The precision corresponding to the predicted recognition result can be expressed as P = TP / (TP + FP), where TP represents the correctly predicted positive class and FP represents the incorrectly predicted positive class. The recall corresponding to the predicted recognition result refers to the proportion of samples that are correctly predicted as positive among all the samples that are actually positive. The recall corresponding to the predicted recognition result can be expressed as R = TP / (TP + FN), where FN represents the incorrectly predicted negative class.

[0107] The accuracy score corresponding to the predicted output result can also be referred to as the F1 score corresponding to the predicted output result. Then, the accuracy score corresponding to the predicted output result can be expressed as F1 = 2 × P × R / (P + R).

[0108] Exemplarily, the sample text is "Jay Chou's Sunny Day dj". The sample text includes the sample entity word "Jay Chou", and the corresponding sample word type is a person's name, the sample entity word "Sunny Day", and the corresponding sample word type is a song name, and the sample entity word "dj", and the corresponding sample word type is a modifying word. Then, if the predicted recognition result only includes "Jay Chou - person's name", the precision corresponding to the predicted recognition result is 1, the recall corresponding to the predicted recognition result is 1 / 3, and the accuracy score corresponding to the predicted output result is 1 / 2.

[0109] If the predicted recognition result includes "Jay Chou - person's name", "Sunny - song name", "Sunny Day - song name", "dj - modifying word", then the precision corresponding to the predicted recognition result is 3 / 4, the recall corresponding to the predicted recognition result is 1, and the accuracy score corresponding to the predicted output result is 6 / 7.

[0110] In some embodiments, after obtaining the precision corresponding to the predicted recognition result and the recall corresponding to the predicted recognition result, the precision corresponding to the predicted recognition result and the recall corresponding to the predicted recognition result are weighted and summed to obtain the accuracy score corresponding to the predicted output result. Exemplarily, both the precision corresponding to the predicted recognition result and the recall corresponding to the predicted recognition result are 1 / 2. Then, in the case where the predicted recognition result only includes "Jay Chou - person's name", the accuracy score corresponding to the predicted output result is 2 / 3. In the case where the predicted recognition result includes "Jay Chou - person's name", "Sunny - song name", "Sunny Day - song name", "dj - modifying word", the accuracy score corresponding to the predicted output result is 7 / 8.

[0111] By considering both the precision corresponding to the predicted recognition result and the recall corresponding to the predicted recognition result, the representation of the accuracy score corresponding to the predicted output result is made more comprehensive and accurate, avoiding the one-sidedness of a single indicator and affecting the subsequent training effect of the text recognition model.

[0112] Sub-step 243: Based on the format scores and accurate scores corresponding to the at least two prediction outputs, obtain the reward scores corresponding to the at least two prediction outputs.

[0113] The reward score corresponding to the predicted output is used to comprehensively represent the accuracy of the text recognition model in recognizing the sample text.

[0114] For example, for each of at least two predicted outputs, the format score and the accuracy score corresponding to the predicted output can be weighted and summed to obtain the reward score corresponding to the predicted output. This application does not limit the weights of the format score and the accuracy score corresponding to the predicted output. For example, if the weights of both the format score and the accuracy score are 1 / 2, then the reward score corresponding to the predicted output = (the format score and the accuracy score) / 2.

[0115] Sub-step 244: Adjust the parameters of the text recognition model based on the reward scores corresponding to at least two predicted outputs to obtain the trained text recognition model.

[0116] By combining the format score and the accuracy score of the predicted output, the reward score is calculated. This allows the reward score to consider both the format accuracy and the accuracy of the predicted recognition result, making the representation of the reward score more comprehensive and accurate. This avoids the one-sidedness of a single indicator, which could affect the subsequent training effect of the text recognition model.

[0117] In some embodiments, sub-step 244 includes at least one of sub-steps 2441 to 2444.

[0118] Sub-step 2441: Calculate the average of the reward scores corresponding to at least two prediction outputs.

[0119] The average of the reward scores corresponding to at least two prediction outputs is the intra-group reward baseline value for the same sample text. Prediction outputs that are below the average value need to be suppressed, while prediction outputs that are above the average value need to be encouraged, so as to maximize the reward value of each prediction output.

[0120] Sub-step 2442: Based on the average value, obtain at least one first prediction output and at least one second prediction output from at least two prediction outputs, wherein the reward score corresponding to the first prediction output is greater than the average value, and the reward score corresponding to the second prediction output is less than the average value.

[0121] Sub-step 2443: Based on the average value and the reward scores corresponding to at least two prediction outputs, obtain the relative advantage scores corresponding to at least two prediction outputs.

[0122] For the first prediction output, the average value is subtracted from the reward score corresponding to the first prediction output to obtain the relative advantage score corresponding to the first prediction output. For the second prediction output, the average value is subtracted from the reward score corresponding to the second prediction output to obtain the relative advantage score corresponding to the second prediction output.

[0123] Sub-step 2444 aims to reduce the relative advantage score corresponding to at least one second prediction output result and increase the relative advantage score corresponding to at least one first prediction output result by adjusting the parameters of the text recognition model to obtain the trained text recognition model.

[0124] By adjusting the parameters of the text recognition model with the objective of reducing the relative advantage score corresponding to at least one of the second predicted outputs, the training difficulty is reduced. This avoids directly increasing the relative advantage score corresponding to the second predicted output, which would lead to excessive training difficulty. Instead, the model's entity recognition performance is gradually adjusted based on the advantage score, thus reducing the training difficulty. Simultaneously, by adjusting the parameters of the text recognition model with the objective of increasing the relative advantage score corresponding to at least one of the first predicted outputs, the accuracy of entity recognition is improved.

[0125] Figure 4 The diagram illustrates the training process of a text recognition model. Based on the sample text, a set of related words is obtained. The text recognition model then performs entity recognition on the sample text according to the weights corresponding to the target word types of each sample word in the related word set, yielding multiple prediction outputs. Reward scores are calculated for each of the multiple prediction outputs. Based on these reward scores, a loss is calculated, and the parameters of the text recognition model are adjusted based on the loss to obtain the trained text recognition model.

[0126] Please refer to Figure 5 The diagram illustrates a flowchart of a text recognition method provided in one embodiment of this application. The execution entity for each step of the method can be a computer device. The method may include at least one of the following steps 510 to 530:

[0127] Step 510: Obtain the input text.

[0128] Step 520: Based on the input text, obtain the related word set corresponding to the input text. The related word set includes at least one related word, and each related word includes at least one consecutive character in the input text.

[0129] Step 530: Based on the relevant word set, the text recognition model obtains at least two output results corresponding to the input text. The output results include the entity recognition result corresponding to the input text and the analysis text corresponding to the entity recognition result. The entity recognition result corresponding to the input text includes at least one entity word and the word type corresponding to at least one entity word.

[0130] In some embodiments, each related word is configured with at least one word type and a weight corresponding to each word type. The weight corresponding to each word type is used to indicate the number of times a song is played for the sample word. A text recognition model obtains the target word type corresponding to each of the at least one related word, where the target word type is the word type corresponding to the maximum value among the weights of the at least one word type. The weights corresponding to each of the at least one related word are obtained based on their respective target word types. If the weight corresponding to the first related word is greater than the weight corresponding to the second related word, the first related word is identified as an entity word in the entity recognition result. If the weight corresponding to the first related word is less than the weight corresponding to the second related word, the second related word is identified as an entity word in the entity recognition result. If the weight corresponding to the first related word is equal to the weight corresponding to the second related word, the entity word in the entity recognition result is determined from the first and second related words based on general knowledge. The first and second related words contain duplicate characters, and the number of characters in the first related word is greater than the number of characters in the second related word.

[0131] In some embodiments, if the target word type corresponding to the first related word does not meet the reasonable rules, the second related word is determined as the entity word in the entity recognition result. If the target word type corresponding to the second related word does not meet the reasonable rules, the first related word is determined as the entity word in the entity recognition result.

[0132] By pre-providing the text recognition model with various relevant words present in the input text, the model can analyze the probability that each word is an entity based on multiple provided lexical scenarios and contextual information. This avoids the problem of the text recognition model generating fictitious information unbased on facts and logic during entity recognition due to insufficient data construction with long thought chains, thus preventing the model from fabricating information. This ensures that the entity recognition results extracted by the text recognition model are reasonable and factually based, improving the accuracy of entity recognition. Furthermore, this method reduces the word segmentation steps of the text recognition model, contributing to improved entity recognition efficiency.

[0133] The text recognition model training method and the text recognition method based on the text recognition model provided in this application are corresponding model training and usage processes. For details not described in detail on one side, please refer to the description on the other side.

[0134] The following are embodiments of the apparatus described in this application, which can be used to execute the embodiments of the method described in this application. For details not disclosed in the apparatus embodiments of this application, please refer to the embodiments of the method described in this application.

[0135] Please refer to Figure 6 This diagram illustrates a block diagram of a training apparatus for a text recognition model according to an embodiment of this application. The apparatus has the function of implementing the training method for the aforementioned text recognition model; this function can be implemented in hardware or by hardware executing corresponding software. The apparatus can be the computer device described above, or it can be installed within a computer device. Figure 6 As shown, the device 600 may include: a data acquisition module 610, a set acquisition module 620, a result output module 630, and a model training module 640.

[0136] The data acquisition module 610 is used to acquire a training dataset, which includes at least one training sample. Each training sample includes sample text and a sample recognition result corresponding to the sample text. The sample recognition result corresponding to the sample text includes at least one sample entity word and a sample word type corresponding to the at least one sample entity word.

[0137] The set acquisition module 620 is used to obtain a set of related words corresponding to the sample text based on the sample text. The set of related words includes at least one sample word, and each sample word includes at least one consecutive character in the sample text.

[0138] The result output module 630 is used to obtain at least two prediction output results corresponding to the sample text based on the relevant word set through the text recognition model. The prediction output results include the prediction recognition result corresponding to the sample text and the prediction analysis text corresponding to the prediction recognition result.

[0139] The model training module 640 is used to adjust the parameters of the text recognition model based on the sample recognition results and the at least two prediction output results to obtain the trained text recognition model.

[0140] In some embodiments, the sample vocabulary is configured with at least one vocabulary type and a weight corresponding to each of the at least one vocabulary type, wherein the weight corresponding to each vocabulary type is used to indicate the number of times the song is played for the sample vocabulary; the set acquisition module 620 is used to:

[0141] The text recognition model obtains the target word type corresponding to the at least one sample word based on the at least one sample word, and the target word type is the word type corresponding to the maximum value among the weights corresponding to the at least one word type.

[0142] Based on the target word type corresponding to the at least one sample word, obtain the weight corresponding to each of the at least one sample word;

[0143] Based on the weights corresponding to the at least one sample word, at least two prediction outputs are obtained for the sample text.

[0144] In some embodiments, there are duplicate characters in the first sample vocabulary and the second sample vocabulary, and the number of characters in the first sample vocabulary is greater than the number of characters in the second sample vocabulary; the set acquisition module 620 is used to:

[0145] If the weight corresponding to the first sample word is greater than the weight corresponding to the second sample word, the first sample word is determined as the predicted entity word in the prediction recognition result.

[0146] If the weight of the first sample word is less than the weight of the second sample word, the second sample word is determined as the predicted entity word in the prediction recognition result.

[0147] When the weight corresponding to the first sample word is equal to the weight corresponding to the second sample word, the predicted entity word in the prediction recognition result is determined from the first sample word and the second sample word according to general knowledge.

[0148] Based on the target word type corresponding to the predicted entity word, the predicted word type corresponding to the predicted entity word in the prediction recognition result is obtained.

[0149] In some embodiments, the collection acquisition module 620 is configured to:

[0150] If the target word type corresponding to the first sample word does not meet the reasonable rules, the second sample word will be determined as the predicted entity word in the prediction recognition result.

[0151] If the target word type corresponding to the second sample word does not meet the reasonable rules, the first sample word is determined as the predicted entity word in the prediction recognition result.

[0152] In some embodiments, the collection acquisition module 620 is configured to:

[0153] The target word type corresponding to the predicted entity word is determined as the predicted word type corresponding to the predicted entity word in the prediction recognition result;

[0154] or,

[0155] If the weight corresponding to the predicted entity word is greater than the first threshold, the target word type corresponding to the predicted entity word is determined as the predicted word type corresponding to the predicted entity word in the prediction recognition result; if the weight corresponding to the predicted entity word is less than the first threshold, the predicted word type corresponding to the predicted entity word in the prediction recognition result is determined according to general knowledge.

[0156] In some embodiments, the prediction and recognition result includes at least one predicted entity word and the predicted word type corresponding to each of the at least one predicted entity word; the model training module 640 is used for:

[0157] Based on the at least two predicted outputs, a format score is obtained corresponding to each of the at least two predicted outputs. The format score corresponding to the predicted output is used to indicate whether the text format of the predicted output conforms to the format requirements.

[0158] Based on the sample identification result and the prediction identification result in the at least two prediction output results, the accuracy score corresponding to each of the at least two prediction output results is obtained;

[0159] Based on the format scores and the accuracy scores corresponding to the at least two prediction outputs, respectively, the reward scores corresponding to the at least two prediction outputs are obtained.

[0160] Based on the reward scores corresponding to the at least two predicted outputs, the parameters of the text recognition model are adjusted to obtain the trained text recognition model.

[0161] In some embodiments, the model training module 640 is configured to:

[0162] For each of the at least two predicted outputs, if the text format of the predicted output conforms to the format requirements, the format score corresponding to the predicted output is determined as the first value.

[0163] If the text format of the predicted output does not meet the format requirements, the format score corresponding to the predicted output will be determined as the second value.

[0164] In some embodiments, the model training module 640 is configured to:

[0165] For each of the at least two predicted output results, the accuracy corresponding to the predicted identification result is obtained based on the sample identification result and the predicted identification result;

[0166] Based on the sample identification result and the predicted identification result, the recall rate corresponding to the predicted identification result is obtained;

[0167] The precision and recall corresponding to the predicted recognition result are harmonic averaged to obtain the accuracy score corresponding to the predicted output result.

[0168] In some embodiments, the model training module 640 is configured to:

[0169] Calculate the average of the reward scores corresponding to the at least two prediction outputs;

[0170] Based on the average value, at least one first prediction output result and at least one second prediction output result are obtained from the at least two prediction output results, wherein the reward score corresponding to the first prediction output result is greater than the average value, and the reward score corresponding to the second prediction output result is less than the average value;

[0171] Based on the average value and the reward scores corresponding to the at least two predicted outputs, the relative advantage scores corresponding to the at least two predicted outputs are obtained respectively.

[0172] With the goal of reducing the relative advantage score corresponding to the at least one second prediction output result and increasing the relative advantage score corresponding to the at least one first prediction output result, the parameters of the text recognition model are adjusted to obtain the trained text recognition model.

[0173] It should be noted that the apparatus provided in the above embodiments is only illustrated by the division of the above functional modules when implementing its functions. In actual applications, the above functions can be assigned to different functional modules as needed, that is, the content structure of the device can be divided into different functional modules to complete all or part of the functions described above. In addition, the apparatus and method embodiments provided in the above embodiments belong to the same concept, and the specific implementation process can be found in the method embodiments, which will not be repeated here.

[0174] Please refer to Figure 7 This diagram illustrates a structural block diagram of a computer device 700 provided in one embodiment of this application. The computer device 700 can be any electronic device capable of data computation, processing, and storage. The computer device 700 can be used to implement the training method for the text recognition model provided in the above embodiments.

[0175] Typically, computer device 700 includes a processor 701 and a memory 702.

[0176] Processor 701 may include one or more processing cores, such as a quad-core processor, an octa-core processor, etc. Processor 701 may be implemented using at least one hardware form selected from DSP (Digital Signal Processing), FPGA (Field Programmable Gate Array), and PLA (Programmable Logic Array). Processor 701 may also include a main processor and a coprocessor. The main processor, also known as a CPU (Central Processing Unit), is used to process data in the wake-up state; the coprocessor is a low-power processor used to process data in the standby state. In some embodiments, processor 701 may integrate a GPU (Graphics Processing Unit), which is responsible for rendering and drawing the content to be displayed on the screen. In some embodiments, processor 701 may also include an AI (Artificial Intelligence) processor, which is used to handle computational operations related to machine learning.

[0177] The memory 702 may include one or more computer-readable storage media, which may be non-transitory. The memory 702 may also include high-speed random access memory and non-volatile memory, such as one or more disk storage devices or flash memory devices. In some embodiments, the non-transitory computer-readable storage media in the memory 702 are used to store a computer program configured to be executed by one or more processors to implement the above-described text recognition model training method.

[0178] Those skilled in the art will understand that Figure 7 The structure shown does not constitute a limitation on the computer device 700, and may include more or fewer components than shown, or combine certain components, or use different component arrangements.

[0179] In an illustrative embodiment, a computer-readable storage medium is also provided, wherein a computer program is stored in the storage medium, and the computer program, when executed by the processor of a computer device, implements the above-described text recognition model training method. Optionally, the above-described computer-readable storage medium may be ROM (Read-Only Memory), RAM (Random Access Memory), CD-ROM (Compact Disc Read-Only Memory), magnetic tape, floppy disk, and optical data storage device, etc.

[0180] In an exemplary embodiment, a computer program product is also provided, comprising a computer program stored in a computer-readable storage medium. A processor of a computer device reads the computer program from the computer-readable storage medium and executes the computer program, causing the computer device to perform the training method for the text recognition model described above.

[0181] It should be noted that this application may display prompt interfaces, pop-ups, or output voice prompts before and during the collection of user data. These prompt interfaces, pop-ups, or voice prompts are used to inform users that their data is being collected. This ensures that the application only begins the steps for collecting user data after receiving confirmation from the user regarding the prompt interface or pop-up; otherwise (i.e., without receiving confirmation from the user), the steps for collecting user data end, meaning no user data is collected. In other words, all user data collected by this application is processed strictly in accordance with the requirements of relevant national laws and regulations. The informed consent or separate consent of the data subject is obtained only with the user's consent and authorization. Subsequent data use and processing are conducted within the scope of laws, regulations, and the data subject's authorization, and the collection, use, and processing of relevant user data must comply with the relevant laws, regulations, and standards of the relevant countries and regions.

[0182] It should be understood that "multiple" as used herein refers to two or more. "And / or" describes the relationship between related objects, indicating that three relationships can exist. For example, A and / or B can represent: A alone, A and B simultaneously, or B alone. The character " / " generally indicates that the preceding and following related objects are in an "or" relationship. Furthermore, the step numbers described herein are merely illustrative of one possible execution order. In some other embodiments, the steps may not be executed in numerical order, such as two steps with different numbers being executed simultaneously, or two steps with different numbers being executed in the reverse order of the illustration. This application does not limit this.

[0183] The above description is merely an exemplary embodiment of this application and is not intended to limit this application. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of this application should be included within the protection scope of this application.

Claims

1. A method for training a text recognition model, characterized in that, The method includes: Obtain a training dataset, which includes at least one training sample. Each training sample includes sample text and a sample recognition result corresponding to the sample text. The sample recognition result corresponding to the sample text includes at least one sample entity word and a sample word type corresponding to the at least one sample entity word. Based on the sample text, a set of related words corresponding to the sample text is obtained. The set of related words includes at least one sample word, and each sample word includes at least one consecutive character in the sample text. The text recognition model obtains at least two prediction outputs corresponding to the sample text based on the set of related words. The prediction outputs include the prediction recognition result corresponding to the sample text and the prediction analysis text corresponding to the prediction recognition result. Based on the sample recognition results and the at least two prediction output results, the parameters of the text recognition model are adjusted to obtain the trained text recognition model.

2. The method according to claim 1, characterized in that, The sample vocabulary is configured with at least one vocabulary type and a weight corresponding to each of the at least one vocabulary type. The weight corresponding to each vocabulary type is used to indicate the number of times the song is played for the sample vocabulary. The step of obtaining at least two predicted outputs corresponding to the sample text through the text recognition model based on the set of related words includes: The text recognition model obtains the target word type corresponding to the at least one sample word based on the at least one sample word, and the target word type is the word type corresponding to the maximum value among the weights corresponding to the at least one word type. Based on the target word type corresponding to the at least one sample word, obtain the weight corresponding to each of the at least one sample word; Based on the weights corresponding to the at least one sample word, at least two prediction outputs are obtained for the sample text.

3. The method according to claim 2, characterized in that, There are duplicate characters in the first sample vocabulary and the second sample vocabulary, and the number of characters in the first sample vocabulary is greater than the number of characters in the second sample vocabulary; The step of obtaining at least two prediction outputs corresponding to the sample text based on the weights corresponding to the at least one sample word includes: If the weight corresponding to the first sample word is greater than the weight corresponding to the second sample word, the first sample word is determined as the predicted entity word in the prediction recognition result. If the weight of the first sample word is less than the weight of the second sample word, the second sample word is determined as the predicted entity word in the prediction recognition result. When the weight corresponding to the first sample word is equal to the weight corresponding to the second sample word, the predicted entity word in the prediction recognition result is determined from the first sample word and the second sample word according to general knowledge. Based on the target word type corresponding to the predicted entity word, the predicted word type corresponding to the predicted entity word in the prediction recognition result is obtained.

4. The method according to claim 3, characterized in that, The method further includes: If the target word type corresponding to the first sample word does not meet the reasonable rules, the second sample word will be determined as the predicted entity word in the prediction recognition result. If the target word type corresponding to the second sample word does not meet the reasonable rules, the first sample word is determined as the predicted entity word in the prediction recognition result.

5. The method according to claim 3 or 4, characterized in that, The step of obtaining the predicted word type corresponding to the predicted entity word in the prediction recognition result based on the target word type corresponding to the predicted entity word includes: The target word type corresponding to the predicted entity word is determined as the predicted word type corresponding to the predicted entity word in the prediction recognition result; or, If the weight corresponding to the predicted entity word is greater than the first threshold, the target word type corresponding to the predicted entity word is determined as the predicted word type corresponding to the predicted entity word in the prediction recognition result; if the weight corresponding to the predicted entity word is less than the first threshold, the predicted word type corresponding to the predicted entity word in the prediction recognition result is determined according to general knowledge.

6. The method according to any one of claims 1 to 5, characterized in that, The prediction and recognition result includes at least one predicted entity word and the predicted word type corresponding to the at least one predicted entity word; The step of adjusting the parameters of the text recognition model based on the sample recognition results and the at least two prediction output results to obtain the trained text recognition model includes: Based on the at least two predicted outputs, a format score is obtained corresponding to each of the at least two predicted outputs. The format score corresponding to the predicted output is used to indicate whether the text format of the predicted output conforms to the format requirements. Based on the sample identification result and the prediction identification result in the at least two prediction output results, the accurate scores corresponding to the at least two prediction output results are obtained respectively; Based on the format scores and the accuracy scores corresponding to the at least two prediction outputs, respectively, the reward scores corresponding to the at least two prediction outputs are obtained. Based on the reward scores corresponding to the at least two predicted outputs, the parameters of the text recognition model are adjusted to obtain the trained text recognition model.

7. The method according to claim 6, characterized in that, The step of obtaining the format scores corresponding to the at least two prediction outputs based on the at least two prediction outputs includes: For each of the at least two predicted outputs, if the text format of the predicted output conforms to the format requirements, the format score corresponding to the predicted output is determined as the first value. If the text format of the predicted output does not meet the format requirements, the format score corresponding to the predicted output will be determined as the second value.

8. The method according to claim 6 or 7, characterized in that, The step of obtaining the accurate scores corresponding to the at least two prediction outputs based on the sample identification result and the prediction identification result from the at least two prediction outputs includes: For each of the at least two predicted output results, the accuracy corresponding to the predicted identification result is obtained based on the sample identification result and the predicted identification result; Based on the sample identification result and the predicted identification result, the recall rate corresponding to the predicted identification result is obtained; The precision and recall corresponding to the predicted recognition result are harmonic averaged to obtain the accuracy score corresponding to the predicted output result.

9. The method according to any one of claims 6 to 8, characterized in that, The step of adjusting the parameters of the text recognition model based on the reward scores corresponding to the at least two predicted outputs to obtain the trained text recognition model includes: Calculate the average of the reward scores corresponding to the at least two prediction outputs; Based on the average value, at least one first prediction output result and at least one second prediction output result are obtained from the at least two prediction output results, wherein the reward score corresponding to the first prediction output result is greater than the average value, and the reward score corresponding to the second prediction output result is less than the average value; Based on the average value and the reward scores corresponding to the at least two predicted outputs, the relative advantage scores corresponding to the at least two predicted outputs are obtained respectively. With the goal of reducing the relative advantage score corresponding to the at least one second prediction output result and increasing the relative advantage score corresponding to the at least one first prediction output result, the parameters of the text recognition model are adjusted to obtain the trained text recognition model.

10. A training device for a text recognition model, characterized in that, The device includes: The data acquisition module is used to acquire a training dataset, which includes at least one training sample. Each training sample includes sample text and a sample recognition result corresponding to the sample text. The sample recognition result corresponding to the sample text includes at least one sample entity word and a sample word type corresponding to the at least one sample entity word. The set acquisition module is used to obtain a set of related words corresponding to the sample text based on the sample text. The set of related words includes at least one sample word, and each sample word includes at least one consecutive character in the sample text. The result output module is used to obtain at least two prediction output results corresponding to the sample text based on the relevant word set through the text recognition model. The prediction output results include the prediction recognition result corresponding to the sample text and the prediction analysis text corresponding to the prediction recognition result. The model training module is used to adjust the parameters of the text recognition model based on the sample recognition results and the at least two prediction output results to obtain the trained text recognition model.

11. A computer device, characterized in that, The computer device includes a processor and a memory, the memory storing a computer program that is loaded and executed by the processor to implement the training method of the text recognition model as described in any one of claims 1 to 9.

12. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program, which is loaded and executed by a processor to implement the training method of the text recognition model as described in any one of claims 1 to 9.

13. A computer program product, characterized in that, The computer program product includes a computer program that is loaded and executed by a processor to implement the training method of the text recognition model as described in any one of claims 1 to 9.