Text marking method, device, electronic device and storage medium
By establishing whitelists and blacklists in the text generated by the large model and adjusting the probability of candidate words, the problem of text markup affecting readability and semantic errors in the existing technology is solved, and high-quality text generation is achieved.
Patent Information
- Application Number
- CN202411303443.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-18
- Publication Date
- 2025-09-19
- Estimated Expiration
- 2044-09-18
AI Technical Summary
When existing technologies are used to mark large model-generated text, they can easily affect text readability and cause semantic errors, thus affecting user experience.
By determining the candidate word set and its probability for the characters to be generated, combining the preset reference word list and the generated text, establishing a whitelist and a blacklist, adjusting the probability of the candidate words, and selecting the final target word to ensure that the text is semantically consistent and readable.
Improves the quality and user experience of text markup, ensuring that the generated text complies with text semantics and enhances readability.
Smart Images

Figure CN119358507B_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the fields of artificial intelligence technologies such as deep learning, natural language processing, and large models, and specifically to a text tagging method, device, electronic device, and storage medium. Background Art
[0002] Currently, the method of marking the generative text of large models is mostly to generate and mark the text by using specific sentence patterns. However, this method may affect the readability of the text and is more likely to cause semantic errors, affecting the user experience. Summary of the Invention
[0003] The present disclosure aims to solve one of the technical problems in the related art at least to a certain extent.
[0004] The first embodiment of the present disclosure provides a text marking method, including:
[0005] Determine a candidate word set corresponding to a first character to be generated and a first probability corresponding to each candidate word in the candidate word set;
[0006] Determining a whitelist and a blacklist corresponding to the first character based on a preset reference vocabulary and the generated text;
[0007] Based on the matching results of each candidate word with the words in the blacklist and the whitelist, the first probability corresponding to the candidate word is updated to obtain a second probability corresponding to the candidate word;
[0008] Based on the second probability corresponding to each candidate word, a target word of the first character is determined from the candidate word set.
[0009] A second embodiment of the present disclosure provides a text marking device, comprising:
[0010] A first determination module is configured to determine a candidate word set corresponding to a first character to be generated and a first probability corresponding to each candidate word in the candidate word set;
[0011] A second determining module, configured to determine a whitelist and a blacklist corresponding to the first character based on a preset reference vocabulary and the generated text;
[0012] An updating module, configured to update the first probability corresponding to each candidate word based on the matching results between each candidate word and the words in the blacklist and the whitelist, to obtain a second probability corresponding to the candidate word;
[0013] The third determination module is configured to determine a target word of the first character from the candidate word set based on a second probability corresponding to each candidate word.
[0014] The third embodiment of the present disclosure proposes a computer device, including: a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the program, the text marking method proposed in the first embodiment of the present disclosure is implemented.
[0015] The fourth embodiment of the present disclosure proposes a computer-readable storage medium storing a computer program. When the computer program is executed by a processor, it implements the text marking method proposed in the first embodiment of the present disclosure.
[0016] The fifth embodiment of the present disclosure proposes a computer program product, including a computer program. When the computer program is executed by a processor, it implements the text marking method proposed in the first embodiment of the present disclosure.
[0017] The text marking method, device, electronic device, and storage medium provided by the present disclosure have the following beneficial effects:
[0018] In the embodiment of the present disclosure, the candidate word set corresponding to the first character to be generated and the first probability corresponding to each candidate word in the candidate word set are first determined, and then the whitelist and blacklist corresponding to the first character are determined based on the preset reference word list and the generated text. Then, based on the matching results of each candidate word with the words in the blacklist and whitelist, the first probability corresponding to the candidate word is updated to obtain the second probability corresponding to the candidate word. Finally, based on the second probability corresponding to each candidate word, the target word for the first character is determined from the candidate word set. Thus, by adjusting the co-occurrence probability of each candidate word corresponding to the character to be generated based on the blacklist and whitelist corresponding to the character to be generated, and determining the target word of the character to be generated from the candidate words based on the adjusted co-occurrence probability, it is ensured that the target word of the character to be generated is consistent with the text semantics on the basis of enhancing the readability of the text, thereby improving the quality and effect of text marking and enhancing the user experience.
[0019] It should be understood that the contents described in this section are not intended to identify the key or important features of the embodiments of the present disclosure, nor are they intended to limit the scope of the present disclosure. Other features of the present disclosure will become readily understood through the following description. BRIEF DESCRIPTION OF THE DRAWINGS
[0020] The accompanying drawings are provided to facilitate a better understanding of the present invention and do not constitute a limitation of the present disclosure.
[0021] Figure 1 A flowchart of a text marking method provided by an embodiment of the present disclosure;
[0022] Figure 2 A flowchart of a text marking method provided by an embodiment of the present disclosure;
[0023] Figure 3 A flowchart of a text marking method provided by an embodiment of the present disclosure;
[0024] Figure 4 A flowchart of a text marking method provided by an embodiment of the present disclosure;
[0025] Figure 5 A schematic diagram of the structure of a text marking device provided in an embodiment of the present disclosure;
[0026] Figure 6 A block diagram of an exemplary computer device suitable for implementing embodiments of the present disclosure is shown. DETAILED DESCRIPTION
[0027] The following description of exemplary embodiments of the present disclosure is made in conjunction with the accompanying drawings, including various details of the embodiments of the present disclosure to facilitate understanding. These details should be considered as merely exemplary. Therefore, those skilled in the art will recognize that various changes and modifications may be made to the embodiments described herein without departing from the scope and spirit of the present disclosure. Similarly, for the sake of clarity and conciseness, descriptions of well-known functions and structures are omitted in the following description.
[0028] The present disclosure relates to artificial intelligence technology fields such as deep learning, natural language processing, and large models.
[0029] Artificial Intelligence (AI) is a new technical science that studies and develops theories, methods, technologies and application systems for simulating, extending and expanding human intelligence.
[0030] Deep learning (DL) involves learning the inherent patterns and representational hierarchies of sample data. The information gained from this learning process is highly helpful in interpreting data such as text, images, and sounds. The ultimate goal of deep learning is to enable machines to have the same analytical and learning capabilities as humans, enabling them to recognize data such as text, images, and sounds.
[0031] Natural Language Processing (NLP) is an interdisciplinary subject in the fields of computer science, artificial intelligence, and linguistics. It mainly studies how to enable computers to understand, process, generate, and simulate human language, so as to achieve the ability to have natural conversations with humans.
[0032] The large model can also be called the Foundation Model. The model extracts knowledge from billions of corpora or images, learns, and then produces a large model with billions of parameters.
[0033] In the technical solutions disclosed herein, the collection, storage, use, processing, transmission, provision and disclosure of user personal information involved comply with the provisions of relevant laws and regulations and do not violate public order and good morals.
[0034] The text marking method, apparatus, electronic device, and storage medium according to embodiments of the present disclosure are described below with reference to the accompanying drawings.
[0035] Figure 1 A flowchart of a text marking method provided in an embodiment of the present disclosure.
[0036] like Figure 1 As shown, the text marking method may include the following steps:
[0037] Step 101 : Determine a candidate word set corresponding to a first character to be generated and a first probability corresponding to each candidate word in the candidate word set.
[0038] It should be noted that the first character to be generated may be a character to be generated by any large language model (LLM), and the present disclosure does not limit this.
[0039] It should be noted that different first characters may correspond to different candidate word sets, and this disclosure does not limit this.
[0040] The first probability may be the co-occurrence probability corresponding to the candidate word.
[0041] It should be noted that, for different candidate words, the first probabilities corresponding to the candidate words may be different, or may be the same, and this disclosure does not limit this.
[0042] In the present disclosure, before determining the set of candidate words corresponding to the first character to be generated and the first probability corresponding to each candidate word in the candidate word set, you can first obtain the text generated by the large model, and then determine the set of candidate words corresponding to the first character to be generated and the first probability corresponding to each candidate word based on the generated text, so as to improve the accuracy of determining the word corresponding to the first character. The present disclosure does not limit this.
[0043] Step 102 : Determine a whitelist and a blacklist corresponding to the first character based on a preset reference vocabulary and the generated text.
[0044] It should be noted that the reference vocabulary may be a reference vocabulary corresponding to the first character determined based on the text generated by the large model, and this disclosure does not limit this.
[0045] Among them, the whitelist is a list composed of words that can be determined to correspond to the first character. The words contained in it can be used to ensure that the text generated by the large model conforms to the large model text marking characteristics (or can also be called watermark characteristics). This disclosure does not limit this.
[0046] The blacklist is a list of words that cannot be determined to correspond to the first character. The words contained in the blacklist may affect the text tagging characteristics of the text generated by the large model, and this disclosure does not limit this.
[0047] It should be noted that the reference vocabulary and the generated text are different, and the whitelist and blacklist corresponding to the determined first character may be different, and this disclosure does not limit this.
[0048] It should be noted that after determining the whitelist corresponding to the first character, it is also possible to determine the synonym list corresponding to each word included in the whitelist, thereby providing alternative options for the words in the whitelist and increasing randomness in determining the word corresponding to the first character. This disclosure does not limit this.
[0049] In the present disclosure, after determining the set of candidate words corresponding to the first character to be generated, and the first probability corresponding to each candidate word in the candidate word set, in order to determine the word corresponding to the first character, you can first determine the whitelist and blacklist corresponding to the first character based on a preset reference vocabulary and the generated text, thereby providing a data basis for determining the accuracy of the word corresponding to the first character.
[0050] Step 103 : Based on the matching results of each candidate word with the words in the blacklist and the whitelist, the first probability corresponding to the candidate word is updated to obtain a second probability corresponding to the candidate word.
[0051] In the present disclosure, after determining the whitelist and blacklist corresponding to the first character, in order to avoid the blacklist and whitelist corresponding to the first character from being reversely deduced, when each candidate word is matched with the words in the blacklist and whitelist respectively, the first probability corresponding to each candidate word can be updated based on the matching results of each candidate word with the words in the blacklist and whitelist respectively, so as to obtain the second probability corresponding to each candidate word.
[0052] Optionally, when the first probability corresponding to each candidate word is updated based on the matching results of each candidate word with the words in the blacklist and the whitelist, when the first candidate word matches the blacklist, it is determined that the first candidate word cannot be determined as the word corresponding to the first character. At this time, the first probability of the first candidate word can be reduced by a first preset value. When the second candidate word matches the whitelist, it is determined that the second candidate word can be determined as the word corresponding to the first character. At this time, the first probability of the second candidate word can be increased by a second preset value, thereby improving the accuracy of determining the word corresponding to the first character. The present disclosure does not limit this.
[0053] It should be noted that the first preset value may be the same as the second preset value, or may be different from the second preset value, and this disclosure does not limit this.
[0054] Optionally, when the first probability corresponding to each candidate word is updated based on the matching results of each candidate word with the words in the blacklist and the whitelist, in order to improve the randomness in the text marking process, when the first candidate word matches the blacklist, the probability of the first candidate word can also be reduced by a first random number, and when the second candidate word matches the whitelist, the first probability of the second candidate word can also be increased by a second random number. Thus, on the basis of updating the first probability of each candidate word, the accuracy and randomness of determining the word corresponding to the first character are improved, and the blacklist and whitelist corresponding to the first character are effectively avoided from being reversely deduced. The present disclosure does not limit this.
[0055] It should be noted that the first random number may be the same as the second random number, or may be different from the second random number, and this disclosure does not limit this.
[0056] Step 104 : Determine a target word for the first character from the candidate word set based on the second probability corresponding to each candidate word.
[0057] The target word may be the final word corresponding to the first character.
[0058] In the present disclosure, after determining the second probability corresponding to each candidate word in the candidate word set, the target word for the first character can be determined from the candidate word set based on the second probability corresponding to each candidate word. For example, the candidate word that matches the whitelist and has the largest corresponding second probability can be directly determined as the target word for the first character, or when there is a synonym table for the word in the whitelist, a synonym can be randomly selected from the synonym table of the candidate word and determined as the target word for the first character, or when the candidate word does not match the whitelist and the blacklist, the target word for the first character can be determined from the candidate word set based on the second probability of the candidate word based on the generation mechanism preset by the large model, thereby improving the accuracy of the determined target word and making the determined target word conform to the text tagging characteristics of the large model. The present disclosure does not limit this.
[0059] In the embodiment of the present disclosure, the candidate word set corresponding to the first character to be generated and the first probability corresponding to each candidate word in the candidate word set are first determined, and then the whitelist and blacklist corresponding to the first character are determined based on the preset reference word list and the generated text. Then, based on the matching results of each candidate word with the words in the blacklist and whitelist, the first probability corresponding to the candidate word is updated to obtain the second probability corresponding to the candidate word. Finally, based on the second probability corresponding to each candidate word, the target word for the first character is determined from the candidate word set. Thus, by adjusting the co-occurrence probability of each candidate word corresponding to the character to be generated based on the blacklist and whitelist corresponding to the character to be generated, and determining the target word corresponding to the character to be generated from the candidate words based on the adjusted co-occurrence probability, it is ensured that the target word of the determined character to be generated conforms to the text semantics on the basis of enhancing the readability of the text, thereby improving the quality and effect of text marking and enhancing the user experience.
[0060] Figure 2 A flowchart of a text marking method provided by one embodiment of the present disclosure is provided.
[0061] like Figure 2 As shown, the text marking method may include the following steps:
[0062] Step 201 : Determine a candidate word set corresponding to a first character to be generated and a first probability corresponding to each candidate word in the candidate word set.
[0063] The specific implementation of step 201 can refer to the detailed description in other embodiments of the present disclosure and will not be described in detail here.
[0064] Step 202: Acquire a reference text set, wherein the reference text set includes a plurality of non-automatically generated reference texts.
[0065] In the present disclosure, the user's input (such as keywords, etc.) can be obtained first, and then the text semantics or text theme can be determined based on the user's input. Then, based on the text semantics or text theme, a reference text with the same text semantics or text theme can be determined. The reference text is manually generated, not automatically generated by a large model, and can be a pre-set text. For example, based on the user's input, the text semantics or text theme determined is to express love for fruit A, then the reference text can be "I love to eat fruit A", etc., and the present disclosure does not limit this. The present disclosure does not limit this.
[0066] In the present disclosure, after determining the candidate word set corresponding to the first character to be generated and the first probability corresponding to each candidate word in the candidate word set, in order to ensure that the target word of the determined first character does not affect the semantics and quality of the text generated by the large model, multiple reference texts that are not automatically generated by the large model can be obtained first, thereby providing conditions for improving the quality of the text generated by the large model.
[0067] Step 203 : performing statistics on the plurality of reference texts to determine a first reference word list having a co-occurrence probability greater than a first threshold value, and a second reference word list having a co-occurrence probability less than a second threshold value.
[0068] The first threshold may be a co-occurrence probability critical value used to determine whether the co-occurrence probability of words in the reference text is high. The first threshold may be preset, and the present disclosure does not limit this.
[0069] The second threshold may be a co-occurrence probability critical value used to determine whether the co-occurrence probability of words in the reference text is low. The second threshold may be preset, and the present disclosure does not limit this.
[0070] It should be noted that the second threshold may be equal to the first threshold, or may be smaller than the first threshold, and this disclosure does not limit this.
[0071] In the present disclosure, after obtaining a reference text set, statistics can be performed on multiple reference texts in the reference text set to determine a first reference vocabulary list with a co-occurrence probability greater than a first threshold, and a second reference vocabulary list with a co-occurrence probability less than a second threshold, thereby providing conditions for determining the blacklist and whitelist corresponding to the first character.
[0072] Step 204 : Determine a blacklist corresponding to the first character based on the first reference word set table and the generated text.
[0073] In the present disclosure, after obtaining the first reference word set, the blacklist corresponding to the first character can be determined from the first reference word set based on the text generated by the large model, thereby improving the accuracy of the determined blacklist by combining the above semantics corresponding to the first character.
[0074] Optionally, when determining the blacklist corresponding to the first character based on the first reference word set table and the generated text, each second character in the generated text can be first matched with the first reference word set, and then all third characters whose co-occurrence probability with the second character is greater than the first threshold are obtained. Since the co-occurrence probability of the third character and the second character is greater than the first threshold, it can be determined that the probability of the third character and the second character co-occurring in the non-large model automatically generated text is high. At this time, in order to accurately distinguish between the non-large model automatically generated text and the large model generated text, and avoid destroying the text marking effect of the large model generated text, all the obtained third characters can be determined as the blacklist corresponding to the first character. The present disclosure does not limit this.
[0075] Step 205 : Determine a whitelist corresponding to the first character according to the second reference word set table and the generated text.
[0076] In the present disclosure, after obtaining the second reference word set, a whitelist corresponding to the first character can be determined from the second reference word set according to the generated text, thereby improving the accuracy of the determined whitelist in combination with the context of the first character.
[0077] Optionally, when determining the whitelist corresponding to the first character based on the second reference word set table and the generated text, each second character in the generated text can be first matched with the second reference word set, and then all fourth characters whose co-occurrence probability with the second character is less than the first threshold are obtained. When the co-occurrence probability of the fourth character and the second character is less than the first threshold, it can be determined that the probability of the fourth character and the second character co-occurring in the non-large model automatically generated text is low. At this time, in order to ensure that the text generated by the large model conforms to the text marking characteristics of the large model, all the obtained fourth characters can be determined as the whitelist corresponding to the first character. The present disclosure does not limit this.
[0078] Step 206 : Based on the matching results of each candidate word with the words in the blacklist and the whitelist, the first probability corresponding to the candidate word is updated to obtain a second probability corresponding to the candidate word.
[0079] Step 207: Determine the target word of the first character from the candidate word set based on the second probability corresponding to each candidate word.
[0080] The specific implementation of steps 206 to 207 can refer to the detailed descriptions in other embodiments of the present disclosure and will not be described in detail here.
[0081] In the embodiment of the present disclosure, the candidate word set corresponding to the first character to be generated and the first probability corresponding to each candidate word in the candidate word set are first determined, then a reference text set is obtained, and multiple reference texts are statistically analyzed to determine a first reference word table whose co-occurrence probability is greater than a first threshold, and a second reference word table whose co-occurrence probability is less than a second threshold. Then, based on the first reference word set table and the generated text, the blacklist corresponding to the first character is determined, and based on the second reference word set table and the generated text, the whitelist corresponding to the first character is determined. Finally, based on the matching results of each candidate word with the words in the blacklist and the whitelist, the first probability corresponding to the candidate word is updated to obtain the second probability corresponding to the candidate word, and based on the second probability corresponding to each candidate word, the target word for the first character is determined from the candidate word set. Therefore, after obtaining the co-occurrence probability of each candidate word corresponding to the character to be generated, by statistically analyzing multiple reference texts, a reference word list with a higher co-occurrence probability and a reference word list with a lower co-occurrence probability are determined. Based on the generated text and the reference word list, a blacklist and a whitelist corresponding to the character to be generated are determined. Based on the blacklist and the whitelist, the co-occurrence probability of each candidate word is adjusted. Based on the adjusted co-occurrence probability, the target word of the first character is determined. This improves the reliability and effectiveness of the text tagging method while improving the accuracy of distinguishing between non-large model automatically generated text and large model generated text.
[0082] Figure 3 A flowchart of a text marking method provided by one embodiment of the present disclosure is provided.
[0083] like Figure 3 As shown, the text marking method may include the following steps:
[0084] Step 301 : Determine a candidate word set corresponding to a first character to be generated and a first probability corresponding to each candidate word in the candidate word set.
[0085] Step 302: Acquire a reference text set, wherein the reference text set includes a plurality of non-automatically generated reference texts.
[0086] The specific implementation of steps 301 to 302 can be referred to the detailed descriptions in other embodiments of the present disclosure, and will not be described in detail here.
[0087] Step 303: Count the multiple reference texts to determine a high-frequency word set.
[0088] In the present disclosure, after obtaining the reference text set, in order to ensure that the target word of the determined first character is not a high-frequency word in the reference text and to ensure that the target word conforms to the model text marking characteristics, at this time, statistics can be performed on multiple reference texts to determine the high-frequency word set corresponding to the first character.
[0089] Step 304 : Determine a whitelist and a blacklist corresponding to the first character based on a preset reference vocabulary and the generated text.
[0090] The specific implementation of step 304 can be referred to the detailed description in other embodiments of the present disclosure, and will not be described in detail here.
[0091] Step 305: Update the whitelist corresponding to the first character based on the high-frequency word set.
[0092] In the present disclosure, after determining the high-frequency word set corresponding to the first character, the whitelist corresponding to the first character can be updated based on the high-frequency word set to ensure that the target word of the determined first character meets the model text marking characteristics. This disclosure does not limit this.
[0093] Optionally, when updating the whitelist corresponding to the first character based on the high-frequency word set, the high-frequency words in the high-frequency word set can be matched with the whitelist first, and then the high-frequency words contained in the whitelist can be deleted, thereby realizing dynamic adjustment of the whitelist and ensuring that the target word of the first character conforms to the model text marking characteristics. This disclosure does not limit this.
[0094] It should be noted that when statistics are taken on multiple reference texts, a sensitive word set can also be determined, and the sensitive words in the sensitive word set can be matched with a whitelist, and the sensitive words included in the whitelist can be deleted to avoid the target word of the first character being a sensitive word. This disclosure does not limit this.
[0095] It should be noted that the whitelist corresponding to the first character can also be updated based on preset conditions. For example, the preset conditions can be word frequency, syntactic structure and other conditions, so as to ensure that the text generated by the large model does not violate the language rules and ensure the text marking effect. This disclosure does not limit this.
[0096] It should be noted that the present disclosure can also update the blacklist corresponding to the first character. When updating the blacklist, words in the generated text or words that do not meet the text marking target can be added to the blacklist, and the blacklist can be updated to effectively prevent the repeated generation or the appearance of words that do not meet the text marking target. The present disclosure does not limit this.
[0097] Step 306 : Based on the matching results of each candidate word with the words in the blacklist and the whitelist, the first probability corresponding to the candidate word is updated to obtain a second probability corresponding to the candidate word.
[0098] Step 307: Determine the target word of the first character from the candidate word set based on the second probability corresponding to each candidate word.
[0099] The specific implementation of steps 306 to 307 can be referred to the detailed descriptions in other embodiments of the present disclosure, and will not be described in detail here.
[0100] In the embodiment of the present disclosure, first, a candidate word set corresponding to the first character to be generated and a first probability corresponding to each candidate word in the candidate word set are determined, then a reference text set is obtained, and statistics are performed on multiple reference texts to determine a high-frequency word set, then based on a preset reference word list and the generated text, a whitelist and a blacklist corresponding to the first character are determined, and based on the high-frequency word set, the whitelist corresponding to the first character is updated, and finally, based on the matching results of each candidate word with the words in the blacklist and the whitelist, the first probability corresponding to the candidate word is updated to obtain a second probability corresponding to the candidate word, and based on the second probability corresponding to each candidate word, a target word for the first character is determined from the candidate word set. Thus, by performing statistics on the obtained multiple reference texts, a high-frequency word set corresponding to the character to be generated is determined, and based on the high-frequency word set, a whitelist corresponding to the character to be generated is updated, and finally, based on the whitelist and blacklist corresponding to the character to be generated, the co-occurrence probability of each candidate word corresponding to the character to be generated is adjusted, and based on the adjusted co-occurrence probability, the target word corresponding to the character to be generated is determined from the candidate words, thereby improving the text marking effect and enhancing the user experience on the basis of realizing the dynamic adjustment of the whitelist corresponding to the character to be generated.
[0101] Figure 4 A flowchart of a text marking method provided by one embodiment of the present disclosure is provided.
[0102] like Figure 4 As shown, the text marking method may include the following steps:
[0103] Step 401 : Determine a candidate word set corresponding to a first character to be generated and a first probability corresponding to each candidate word in the candidate word set.
[0104] Step 402 : Determine a whitelist and a blacklist corresponding to the first character based on a preset reference vocabulary and the generated text.
[0105] Step 403 : Based on the matching results of each candidate word with the words in the blacklist and the whitelist, the first probability corresponding to the candidate word is updated to obtain a second probability corresponding to the candidate word.
[0106] Step 404: Determine a target word for the first character from the candidate word set based on the second probability corresponding to each candidate word.
[0107] The specific implementation of steps 401 to 404 can refer to the detailed descriptions in other embodiments of the present disclosure and will not be described in detail here.
[0108] Step 405 : Determine a blacklist and a whitelist corresponding to the fifth character to be generated based on the target word of the first character, the generated text, and a preset reference word list.
[0109] The fifth character may be the next character to be generated adjacent to the first character.
[0110] In the present disclosure, after determining the target word corresponding to the first character, since the context corresponding to the fifth character to be generated is different from the context corresponding to the first character when determining the blacklist and whitelist corresponding to the fifth character to be generated, that is, the context corresponding to the fifth character includes the generated text and the target word of the first character, at this time, in order to improve the accuracy and reliability of the blacklist and whitelist corresponding to the determined fifth character, the blacklist and whitelist corresponding to the fifth character to be generated can be determined based on the target word of the first character, the generated text and the preset reference word list.
[0111] In the present disclosure, after determining the target word corresponding to the first character, the present disclosure first determines the blacklist and whitelist corresponding to the fifth character based on the target word of the first character, the generated text, and the preset reference word list, and finally determines the target word for the fifth character based on the blacklist and whitelist corresponding to the fifth character, and so on, until the large model determines the target word corresponding to the last character in the text. The text marking effect of the text generated by the large model can be evaluated based on the preset detection algorithm, and the strategy for determining the blacklist and whitelist corresponding to the character to be generated can be optimized according to the evaluation results, or the strategy for generating the blacklist and whitelist can be optimized based on user feedback, so as to ensure the imperceptibility and robustness of the text marking, and further improve the quality and effect of the model text marking. The present disclosure does not limit this.
[0112] It should be noted that after a text is generated by the text tagging method of the present disclosure, the model for generating the text can also be determined based on the co-occurrence probability of words contained in the text, and the present disclosure does not limit this.
[0113] In the embodiment of the present disclosure, the candidate word set corresponding to the first character to be generated and the first probability corresponding to each candidate word in the candidate word set are first determined, and then the whitelist and blacklist corresponding to the first character are determined based on the preset reference word list and the generated text, and based on the matching results of each candidate word with the words in the blacklist and whitelist respectively, the first probability corresponding to the candidate word is updated to obtain the second probability corresponding to the candidate word, and then based on the second probability corresponding to each candidate word, the target word for the first character is determined from the candidate word set, and finally, based on the target word for the first character, the generated text, and the preset reference word list, the blacklist and whitelist corresponding to the fifth character to be generated are determined. Thus, after determining the target word corresponding to the character to be generated, the blacklist and whitelist corresponding to the next character to be generated are determined based on the target word, the generated text, and the reference word list, thereby determining the target word corresponding to the character to be generated, until the large model outputs the complete generated text, thereby improving the quality and effect of text labeling.
[0114] In order to implement the above embodiments, the present disclosure also proposes a text marking device.
[0115] Figure 5 A schematic structural diagram of a text marking device provided in an embodiment of the present disclosure.
[0116] like Figure 5 As shown, the text marking device 500 includes: a first determination module 501 , a second determination module 502 , an updating module 503 , and a third determination module 504 .
[0117] A first determining module 501 is configured to determine a candidate word set corresponding to a first character to be generated and a first probability corresponding to each candidate word in the candidate word set;
[0118] A second determining module 502 is configured to determine a whitelist and a blacklist corresponding to the first character based on a preset reference vocabulary and the generated text;
[0119] An updating module 503 is configured to update the first probability corresponding to each candidate word based on the matching results between the candidate word and the words in the blacklist and the whitelist, thereby obtaining a second probability corresponding to the candidate word;
[0120] The third determining module 504 is configured to determine a target word of the first character from the candidate word set based on the second probability corresponding to each candidate word.
[0121] In a possible implementation of the present disclosure, the second determining module 502 is specifically configured to:
[0122] Acquire a reference text set, wherein the reference text set includes a plurality of non-automatically generated reference texts;
[0123] Performing statistics on the plurality of reference texts to determine a first reference word list having a co-occurrence probability greater than a first threshold value, and a second reference word list having a co-occurrence probability less than a second threshold value;
[0124] Determining a blacklist corresponding to the first character based on the first reference word set table and the generated text;
[0125] A whitelist corresponding to the first character is determined according to the second reference word set table and the generated text.
[0126] In a possible implementation of the present disclosure, the second determining module 502 is further configured to:
[0127] Matching each second character in the generated text with the first reference word set to obtain all third characters whose co-occurrence probability with the second character is greater than a first threshold;
[0128] Based on all the acquired third characters, a blacklist is determined.
[0129] In a possible implementation of the present disclosure, the second determining module 502 is further configured to:
[0130] Matching each second character in the generated text with the second reference word set to obtain all fourth characters whose co-occurrence probability with the second character is less than a first threshold;
[0131] Based on all fourth characters obtained, a whitelist is determined.
[0132] In a possible implementation of the present disclosure, the second determining module 502 is further configured to:
[0133] Identify the high-frequency word set;
[0134] The second determining module 502 is further configured to:
[0135] Based on the high-frequency word set, the whitelist corresponding to the first character is updated.
[0136] In a possible implementation of the present disclosure, the second determining module 502 is further configured to:
[0137] Match the high-frequency words in the high-frequency word set with the whitelist;
[0138] Delete high-frequency words from the whitelist.
[0139] In a possible implementation of the present disclosure, the updating module 503 is specifically configured to:
[0140] The first candidate word matches the blacklist, and the first probability of the first candidate word is reduced by a first preset value;
[0141] The second candidate word matches the whitelist, and the first probability of the second candidate word is increased by a second preset value.
[0142] In a possible implementation of the present disclosure, the updating module 503 is specifically configured to:
[0143] The first candidate word matches the blacklist, and the probability of the first candidate word is reduced by a first random number;
[0144] The second candidate word matches the whitelist, and the first probability of the second candidate word is increased by a second random number.
[0145] In a possible implementation of the present disclosure, the third determining module 504 is further configured to:
[0146] Based on the target word of the first character, the generated text, and a preset reference word list, a blacklist and a whitelist corresponding to the fifth character to be generated are determined.
[0147] The functions and specific implementation principles of the above modules in the embodiments of the present disclosure can be referred to the above method embodiments and will not be repeated here.
[0148] In the embodiment of the present disclosure, the candidate word set corresponding to the first character to be generated and the first probability corresponding to each candidate word in the candidate word set are first determined, and then the whitelist and blacklist corresponding to the first character are determined based on the preset reference word list and the generated text. Then, based on the matching results of each candidate word with the words in the blacklist and the whitelist, the first probability corresponding to the candidate word is updated to obtain the second probability corresponding to the candidate word. Finally, based on the second probability corresponding to each candidate word, the target word for the first character is determined from the candidate word set. Thus, by adjusting the probability of each candidate word corresponding to the character to be generated based on the blacklist and whitelist corresponding to the character to be generated, and determining the target word corresponding to the character to be generated from the candidate words based on the adjusted probability, it is ensured that the target word of the determined character to be generated conforms to the text semantics on the basis of enhancing the readability of the text, thereby improving the quality and effect of text marking and enhancing the user experience.
[0149] According to an embodiment of the present disclosure, the present disclosure also provides an electronic device, a readable storage medium, and a computer program product.
[0150] Figure 6A schematic block diagram of an example electronic device 600 that can be used to implement embodiments of the present disclosure is shown. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device can also represent various forms of mobile devices, such as personal digital assistants, cellular phones, smartphones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions are provided as examples only and are not intended to limit the implementation of the present disclosure described and / or claimed herein.
[0151] like Figure 6 As shown, the device 600 includes a computing unit 601, which can perform various appropriate actions and processes according to a computer program stored in a read-only memory (ROM) 602 or a computer program loaded from a storage unit 608 into a random access memory (RAM) 603. Various programs and data required for the operation of the device 600 can also be stored in the RAM 603. The computing unit 601, the ROM 602, and the RAM 603 are connected to each other via a bus 604. An input / output (I / O) interface 605 is also connected to the bus 604.
[0152] Various components in device 600 are connected to I / O interface 605, including an input unit 606, such as a keyboard, mouse, etc.; an output unit 607, such as various types of displays, speakers, etc.; a storage unit 608, such as a magnetic disk, optical disk, etc.; and a communication unit 609, such as a network card, modem, wireless communication transceiver, etc. The communication unit 609 allows device 600 to exchange information / data with other devices via a computer network such as the Internet and / or various telecommunication networks.
[0153] The computing unit 601 can be a variety of general-purpose and / or specialized processing components with processing and computing capabilities. Some examples of the computing unit 601 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various dedicated artificial intelligence (AI) computing chips, various computing units that run machine learning model algorithms, a digital signal processor (DSP), and any appropriate processor, controller, microcontroller, etc. The computing unit 601 performs the various methods and processes described above, such as the text tagging method. For example, in some embodiments, the text tagging method can be implemented as a computer software program that is tangibly contained in a machine-readable medium, such as the storage unit 608. In some embodiments, part or all of the computer program can be loaded and / or installed on the device 600 via the ROM 602 and / or the communication unit 609. When the computer program is loaded into the RAM 603 and executed by the computing unit 601, one or more steps of the text tagging method described above can be performed. Alternatively, in other embodiments, the computing unit 601 can be configured to perform the text tagging method by any other appropriate means (e.g., by means of firmware).
[0154] Various embodiments of the systems and techniques described herein can be implemented in digital electronic circuit systems, integrated circuit systems, field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), system-on-chip systems (SOCs), programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various embodiments can include being implemented in one or more computer programs that are executable and / or interpreted on a programmable system that includes at least one programmable processor, which can be a special purpose or general purpose programmable processor that can receive data and instructions from a storage system, at least one input device, and at least one output device, and transmit data and instructions to the storage system, the at least one input device, and the at least one output device.
[0155] The program code for implementing the methods of the present disclosure may be written in any combination of one or more programming languages. Such program code may be provided to a processor or controller of a general-purpose computer, a special-purpose computer, or other programmable text marking device, such that when the program code is executed by the processor or controller, the functions / operations specified in the flow charts and / or block diagrams are implemented. The program code may be executed entirely on the machine, partially on the machine, as a stand-alone software package, partially on the machine and partially on a remote machine, or entirely on a remote machine or server.
[0156] In the context of the present disclosure, a machine-readable medium can be a tangible medium that can contain or store a program for use by or in conjunction with an instruction execution system, device or equipment. A machine-readable medium can be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium can include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or equipment, or any suitable combination of the foregoing. A more specific example of a machine-readable storage medium can include an electrical connection based on one or more lines, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
[0157] To provide interaction with a user, the systems and techniques described herein can be implemented on a computer having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and pointing device (e.g., a mouse or trackball) through which the user can provide input to the computer. Other types of devices can also be used to provide interaction with the user; for example, the feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including acoustic input, voice input, or tactile input).
[0158] The systems and techniques described herein can be implemented in a computing system that includes back-end components (e.g., as a data server), or a computing system that includes middleware components (e.g., an application server), or a computing system that includes front-end components (e.g., a user computer with a graphical user interface or a web browser through which a user can interact with implementations of the systems and techniques described herein), or a computing system that includes any combination of such back-end components, middleware components, or front-end components. The components of the system can be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: a local area network (LAN), a wide area network (WAN), the Internet, and a blockchain network.
[0159] A computer system may include a client and a server. The client and server are generally remote from each other and typically interact via a communication network. This client-server relationship is established by computer programs running on the respective computers, establishing a client-server relationship. The server may be a cloud server, also known as a cloud computing server or cloud host, a host product within the cloud computing service ecosystem that addresses the management difficulties and limited scalability of traditional physical hosts and VPS services ("Virtual Private Servers" or simply "VPS"). The server may also be a server in a distributed system or a server integrated with blockchain.
[0160] It should be understood that the various forms of the processes shown above can be used to reorder, add, or delete steps. For example, the steps described in this disclosure can be performed in parallel, sequentially, or in a different order, as long as the desired results of the technical solutions disclosed in this disclosure can be achieved. This is not a limitation herein.
[0161] In addition, the terms "first" and "second" are used for descriptive purposes only and should not be understood as indicating or implying relative importance or implicitly indicating the number of the indicated technical features. Thus, a feature defined as "first" or "second" may explicitly or implicitly include at least one such feature. In the description of the present disclosure, the meaning of "plurality" is at least two, such as two, three, etc., unless otherwise clearly and specifically defined. In the description of the present disclosure, the words "if" and "if" used can be interpreted as "at the time of" or "when" or "in response to a determination" or "under the circumstances of".
[0162] The above specific embodiments do not constitute a limitation on the scope of protection of this disclosure. Those skilled in the art will appreciate that various modifications, combinations, sub-combinations, and substitutions may be made based on design requirements and other factors. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of this disclosure shall be included within the scope of protection of this disclosure.
Claims
1. A text marking method, comprising: Determine a candidate word set corresponding to a first character to be generated and a first probability corresponding to each candidate word in the candidate word set; Get multiple non-automatically generated reference texts; Performing statistics on the multiple reference texts to determine a first reference word list having a co-occurrence probability greater than a first threshold, and a second reference word list having a co-occurrence probability less than a second threshold; Determining a blacklist corresponding to the first character based on the first reference word set table and the generated text; Determining a whitelist corresponding to the first character according to the second reference word set table and the generated text; Based on the matching results of each candidate word with the words in the blacklist and the whitelist, respectively, updating the first probability corresponding to the candidate word to obtain a second probability corresponding to the candidate word, wherein the second probability corresponding to the candidate word matching the blacklist is less than the first probability, and the second probability corresponding to the candidate word matching the whitelist is greater than the first probability; Based on the second probability corresponding to each candidate word, a target word of the first character is determined from the candidate word set.
2. The method according to claim 1, wherein The step of determining a blacklist corresponding to the first character according to the first reference word set table and the generated text includes: Matching each second character in the generated text with the first reference word set to obtain all third characters whose co-occurrence probability with the second character is greater than the first threshold; The blacklist is determined based on all the acquired third characters.
3. The method according to claim 1, wherein The step of determining a whitelist corresponding to the first character according to the second reference word set table and the generated text includes: Matching each second character in the generated text with the second reference word set to obtain all fourth characters whose co-occurrence probability with the second character is less than the first threshold; The white list is determined based on all acquired fourth characters.
4. The method according to claim 1, wherein After performing statistics on the plurality of reference texts, the method further includes: Identify the high-frequency word set; After determining the whitelist and blacklist corresponding to the first character, the method further includes: Based on the high-frequency word set, a whitelist corresponding to the first character is updated.
5. The method according to claim 4, wherein: The updating of the whitelist corresponding to the first character based on the high-frequency word set includes: Matching the high-frequency words in the high-frequency word set with the whitelist; Delete the high-frequency words included in the whitelist.
6. The method of claim 1, wherein: The updating of the first probability corresponding to each candidate word based on the matching results of each candidate word with the words in the blacklist and the whitelist to obtain the second probability corresponding to the candidate word includes: The first candidate word matches the blacklist, and the first probability of the first candidate word is reduced by a first preset value; The second candidate word matches the whitelist, and the first probability of the second candidate word is increased by a second preset value.
7. The method of claim 1, wherein: The updating of the first probability corresponding to each candidate word based on the matching results of each candidate word with the words in the blacklist and the whitelist to obtain the second probability corresponding to the candidate word includes: A first candidate word matches the blacklist, and a probability of the first candidate word is reduced by a first random number; The second candidate word matches the whitelist, and the first probability of the second candidate word is increased by a second random number.
8. The method according to any one of claims 1 to 7, wherein: After determining the target word of the first character from the candidate word set, the method further includes: Based on the target word of the first character, the generated text, and a preset reference word list, a blacklist and a whitelist corresponding to the fifth character to be generated are determined.
9. A text marking device, wherein: The device comprises: A first determination module is configured to determine a candidate word set corresponding to a first character to be generated and a first probability corresponding to each candidate word in the candidate word set; a second determination module configured to obtain a plurality of non-automatically generated reference texts; perform statistics on the plurality of reference texts to determine a first reference word list having a co-occurrence probability greater than a first threshold, and a second reference word list having a co-occurrence probability less than a second threshold; determine a blacklist corresponding to the first character based on the first reference word list and the generated text; and determine a whitelist corresponding to the first character based on the second reference word list and the generated text; an updating module, configured to update a first probability corresponding to each candidate word based on a matching result between each candidate word and words in the blacklist and the whitelist, to obtain a second probability corresponding to the candidate word, wherein the second probability corresponding to the candidate word matching the blacklist is less than the first probability, and the second probability corresponding to the candidate word matching the whitelist is greater than the first probability; The third determination module is configured to determine a target word of the first character from the candidate word set based on a second probability corresponding to each candidate word.
10. The device according to claim 9, wherein The second determining module is further configured to: Matching each second character in the generated text with the first reference word set to obtain all third characters whose co-occurrence probability with the second character is greater than the first threshold; The blacklist is determined based on all the acquired third characters.
11. The device according to claim 9, wherein The second determining module is further configured to: Matching each second character in the generated text with the second reference word set to obtain all fourth characters whose co-occurrence probability with the second character is less than the first threshold; The white list is determined based on all acquired fourth characters.
12. The device of claim 9, wherein: The second determining module is further configured to: Identify the high-frequency word set; The second determining module is further configured to: Based on the high-frequency word set, a whitelist corresponding to the first character is updated.
13. The device of claim 12, wherein: The second determining module is further configured to: Matching the high-frequency words in the high-frequency word set with the whitelist; Delete the high-frequency words included in the whitelist.
14. The apparatus of claim 9, wherein: The update module is specifically used to: The first candidate word matches the blacklist, and the first probability of the first candidate word is reduced by a first preset value; The second candidate word matches the whitelist, and the first probability of the second candidate word is increased by a second preset value.
15. The apparatus of claim 9, wherein: The update module is specifically used to: A first candidate word matches the blacklist, and a probability of the first candidate word is reduced by a first random number; The second candidate word matches the whitelist, and the first probability of the second candidate word is increased by a second random number.
16. The device according to any one of claims 9 to 15, wherein: The third determining module is further configured to: Based on the target word of the first character, the generated text, and a preset reference word list, a blacklist and a whitelist corresponding to the fifth character to be generated are determined.
17. An electronic device, characterized in that: include: at least one processor; and, a memory communicatively coupled to the at least one processor; The memory stores instructions that may be executed by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to perform the method according to any one of claims 1 to 8.
18. A non-transitory computer-readable storage medium storing computer instructions, wherein: The computer instructions are used to cause the computer to execute the method according to any one of claims 1-8.
19. A computer program product comprising a computer program, which, when executed by a processor, implements the method according to any one of claims 1 to 8.
Citation Information
Patent Citations
Keyword extraction method and device, storage medium and computer equipment
CN110826328A
Text generation method and device, training method and device, electronic equipment and storage medium
CN117668171A