Text marking method and device, electronic equipment and storage medium

By using technical means such as candidate word sets, whitelists, and blacklists in the text tags generated by the large model, the problem of text tags affecting readability and causing semantic errors in the existing technology is solved, and higher quality and user satisfaction are achieved. Experience the text markup effect.

CN119358507AActive Publication Date: 2025-01-24BEIJING BAIDU NETCOM SCI & TECH CO LTD
View PDF 5 Cites 0 Cited by

Patent Information

Application Number
CN202411303443.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-09-18
Publication Date
2025-01-24
Estimated Expiration
2044-09-18

AI Technical Summary

Technical Problem

When the prior art marks the generated text generated by the large model, it can easily affect the readability of the text and may lead to semantic errors and affect the user experience.

Method used

By determining the candidate collection and probability to be generated, based on the preset reference words and the generated text, determine the white list and blacklist, and update the probability of the candidate words based on these lists, so as to select the target word.

Benefits of technology

The quality and effect of the text mark are improved, the readability of the text is enhanced, and the generated text meets semantic requirements, which enhances the user experience.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119358507A_ABST
    Figure CN119358507A_ABST
Patent Text Reader

Abstract

The invention provides a text marking method and device, electronic equipment and a storage medium, and relates to the technical field of artificial intelligence such as deep learning, natural language processing and large models. According to the specific scheme, firstly, a candidate word set corresponding to a to-be-generated first character and a first probability corresponding to each candidate word in the candidate word set are determined, and then a white list and a black list corresponding to the first character are determined based on a preset reference word list and a generated text, the method comprises the following steps of: selecting a candidate word from a candidate word set, updating a first probability corresponding to the candidate word to obtain a second probability corresponding to the candidate word on the basis of matching results of each candidate word and words in a black list and a white list, and finally determining a target word of a first character from the candidate word set on the basis of the second probability corresponding to each candidate word.
Need to check novelty before this filing date? Find Prior Art

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 way to mark 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 some 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 word list 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 the second probability corresponding to the candidate word;

[0008] Based on the second probability corresponding to each of the candidate words, a target word of the first character is determined from the candidate word set.

[0009] A second aspect of the present disclosure provides a text marking device, including:

[0010] A first determination module, used 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 determination module, configured to determine a whitelist and a blacklist corresponding to the first character based on a preset reference word list 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, so as to obtain a second probability corresponding to the candidate word;

[0013] The third determination module is used to determine the target word of the first character from the candidate word set based on the second probability corresponding to each of the candidate words.

[0014] The third aspect 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, wherein when the processor executes the program, the text marking method proposed in the first aspect embodiment of the present disclosure is implemented.

[0015] The fourth aspect embodiment of the present disclosure proposes a computer-readable storage medium storing a computer program. When the computer program is executed by a processor, the text marking method proposed in the first aspect embodiment of the present disclosure is implemented.

[0016] The fifth aspect embodiment of the present disclosure proposes a computer program product, including a computer program, which, when executed by a processor, implements the text marking method proposed in the first aspect 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 disclosed embodiment, 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 then 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, respectively, to obtain the second probability corresponding to the candidate word, and finally the target word of the first character is determined from the candidate word set based on the second probability corresponding to each candidate word. Thus, by adjusting the co-occurrence probability of each candidate word corresponding to the character to be generated based on the black and white lists 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, on the basis of enhancing the readability of the text, it is ensured that the determined target word of the character to be generated conforms to the text semantics, improves the quality and effect of text marking, and enhances the user experience.

[0019] It should be understood that the content described in this section is not intended to identify the key or important features of the embodiments of the present disclosure, nor is it intended to limit the scope of the present disclosure. Other features of the present disclosure will become easily understood through the following description. BRIEF DESCRIPTION OF THE DRAWINGS

[0020] The accompanying drawings are used to better understand the present solution 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 is a description of exemplary embodiments of the present disclosure in conjunction with the accompanying drawings, including various details of the embodiments of the present disclosure to facilitate understanding, which should be considered as merely exemplary. Therefore, it should be recognized by those of ordinary skill in the art 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) is the process of learning the inherent laws and representation levels of sample data. The information obtained in the learning process is very helpful for interpreting data such as text, images, and sounds. The ultimate goal of deep learning is to enable machines to have analytical learning capabilities like humans and 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 through billions of corpora or images, learns and then produces a large model with billions of parameters.

[0033] In the technical solution of the present disclosure, the collection, storage, use, processing, transmission, provision and disclosure of user personal information involved are in compliance with the provisions of relevant laws and regulations and do not violate public order and good morals.

[0034] The text marking method, device, electronic device and storage medium of the 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 , determining 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 (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 the present 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, the text generated by the large model can be first obtained, and then the set of candidate words corresponding to the first character to be generated and the first probability corresponding to each candidate word can be determined based on the generated text, thereby improving 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 word list 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 the present 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 the list 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), and the present disclosure does not limit this.

[0046] The blacklist is a list of words that cannot be determined as corresponding 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 the present disclosure does not limit this.

[0047] It should be noted that the reference word list and the generated text are different, and the whitelist and blacklist corresponding to the determined first character may be different, and the present disclosure does not limit this.

[0048] It should be noted that after determining the whitelist corresponding to the first character, you can also 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. The present 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 the 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 is not limited to 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 the present 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 the present disclosure does not limit this.

[0056] Step 104: determine a target word of 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 list for the words in the whitelist, a synonym can be randomly selected from the synonym list 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 disclosed embodiment, 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 then 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, and the second probability corresponding to the candidate word is obtained, and finally the target word of the first character is determined from the candidate word set based on the second probability corresponding to each candidate word. Thus, by adjusting the co-occurrence probability of each candidate word corresponding to the character to be generated based on the blacklist and the 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, on the basis of enhancing the readability of the text, it is ensured that the determined target word of the character to be generated conforms to the text semantics, improves the quality and effect of text marking, and enhances the user experience.

[0060] Figure 2 A flowchart of a text marking method provided by an embodiment of the present disclosure.

[0061] like Figure 2 As shown, the text marking method may include the following steps:

[0062] Step 201 , determining 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 form 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 first obtained, 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, which is a text that is manually generated and 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 the 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 , statistics are performed on the multiple reference texts to determine a first reference word list whose co-occurrence probability is greater than a first threshold value, and a second reference word list whose co-occurrence probability is less than a second threshold value.

[0068] Among them, the first threshold value may be a co-occurrence probability critical value used to determine whether the co-occurrence probability of words in the reference text is high, which may be preset and is not limited in the present disclosure.

[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, which may be preset and is not limited in the present disclosure.

[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 the present disclosure does not limit this.

[0071] In the present disclosure, after obtaining a reference text set, multiple reference texts in the reference text set can be statistically analyzed to determine a first reference vocabulary list whose co-occurrence probability is greater than a first threshold, and a second reference vocabulary list whose co-occurrence probability is less than a second threshold, thereby providing conditions for determining a blacklist and a whitelist corresponding to the first character.

[0072] Step 204: Determine a blacklist corresponding to the first character according to the first reference word set table and the generated text.

[0073] In the present disclosure, after obtaining the first reference word set, a blacklist corresponding to the first character can be determined from the first reference word set according to the text generated by the large model, thereby improving the accuracy of the determined blacklist in combination with the contextual 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 between the third character and the second character is greater than the first threshold, it can be determined that the third character and the second character have a high probability of co-occurring in the non-large model automatically generated text. 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 : determining 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 the 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 forms of step 206 to step 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 disclosed embodiment, 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 are first determined, then a reference text set is obtained, and multiple reference texts are statistically analyzed to determine a first reference word list whose co-occurrence probability is greater than a first threshold, and a second reference word list whose co-occurrence probability is less than a second threshold. Then, a blacklist corresponding to the first character is determined based on the first reference word set and the generated text, and a whitelist corresponding to the first character is determined based on the second reference word set and the generated text. 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, a 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 effect of the text tagging method while improving the accuracy of distinguishing between non-large model automatically generated texts and large model generated texts.

[0082] Figure 3 A flowchart of a text marking method provided by an embodiment of the present disclosure.

[0083] like Figure 3 As shown, the text marking method may include the following steps:

[0084] Step 301 , determining 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 forms of step 301 to step 302 can refer to the detailed descriptions in other embodiments of the present disclosure, and will not be described in detail here.

[0087] Step 303: Count 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 : determining a whitelist and a blacklist corresponding to the first character based on a preset reference word list and the generated text.

[0090] The specific implementation form of step 304 can refer to the detailed description in other embodiments of the present disclosure, and will not be described in detail here.

[0091] Step 305: based on the high-frequency word set, update the whitelist corresponding to the first character.

[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 determined target word of the first character meets the model text marking characteristics, and the present 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 included in the whitelist can be deleted, thereby achieving dynamic adjustment of the whitelist and ensuring that the target word of the first character conforms to the model text marking characteristics. The present disclosure does not limit this.

[0094] It should be noted that when statistics are taken for 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, thereby avoiding the target word of the first character being a sensitive word. The present 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. The present 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 updated, thereby effectively preventing 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 the second probability corresponding to the candidate word.

[0098] Step 307: Determine a 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 forms of step 306 to step 307 can refer to the detailed descriptions in other embodiments of the present disclosure, and will not be described in detail here.

[0100] In the disclosed embodiment, 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 the reference text set is obtained, and multiple reference texts are counted to determine the high-frequency word set, then the whitelist and blacklist corresponding to the first character are determined based on the preset reference word list and the generated text, and the whitelist corresponding to the first character is updated based on the high-frequency word set, 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 the second probability corresponding to the candidate word, and based on the second probability corresponding to each candidate word, the target word of the first character is determined from the candidate word set. Thus, by counting the multiple reference texts obtained, the high-frequency word set corresponding to the character to be generated is determined, and based on the high-frequency word set, the 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 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 an embodiment of the present disclosure.

[0102] like Figure 4 As shown, the text marking method may include the following steps:

[0103] Step 401 , determining 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 word list 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 the second probability corresponding to the candidate word.

[0106] Step 404: determine a target word of the first character from the candidate word set based on the second probability corresponding to each candidate word.

[0107] The specific implementation forms 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 , based on the target word of the first character, the generated text, and the preset reference word list, determine the blacklist and whitelist corresponding to the fifth character to be generated.

[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 for 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. Then, based on the preset detection algorithm, the text marking effect of the text generated by the large model can be evaluated, and based on the evaluation result, the strategy for determining the blacklist and whitelist corresponding to the character to be generated can be optimized, or the generation strategy of 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 model text marking quality and effect. 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, a model for generating the text may 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 disclosed embodiment, 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 the whitelist and blacklist corresponding to the first character are determined based on the preset reference word list and the generated text, and the first probability corresponding to the candidate word is updated based on the matching results of each candidate word with the words in the blacklist and the whitelist, respectively, to obtain the second probability corresponding to the candidate word, and then the target word of the first character is determined from the candidate word set based on the second probability corresponding to each candidate word, and finally the blacklist and whitelist corresponding to the fifth character to be generated are determined based on the target word of the first character, the generated text, and the preset reference word list. 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 a complete generated text, thereby improving the quality and effect of text marking.

[0114] In order to implement the above embodiment, the present disclosure also proposes a text marking device.

[0115] Figure 5 A schematic diagram of the structure 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 determination module 501 is used 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 determination module 502, for determining a whitelist and a blacklist corresponding to the first character based on a preset reference word list and the generated text;

[0119] An updating module 503, 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;

[0120] The third determination 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] Determine a blacklist corresponding to the first character according to 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] Match each second character in the generated text with the first reference word set, and obtain all third characters whose co-occurrence probability with the second character is greater than a first threshold;

[0128] Based on all the third characters obtained, a blacklist is determined.

[0129] In a possible implementation of the present disclosure, the second determining module 502 is further configured to:

[0130] Match each second character in the generated text with the second reference word set, and 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 white list 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 the high-frequency words included in 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 the 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 disclosed embodiment, 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 then 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, respectively, to obtain the second probability corresponding to the candidate word, and finally the target word of the first character is determined from the candidate word set based on the second probability corresponding to each candidate word. Thus, by adjusting the probability of each candidate word corresponding to the character to be generated based on the blacklist and the 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 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.

[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 an embodiment 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 processing, cellular phones, smart phones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely examples and are not intended to limit the implementation of the present disclosure described and / or required 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. In the RAM 603, various programs and data required for the operation of the device 600 can also be stored. 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] A number of components in the device 600 are connected to the I / O interface 605, including: an input unit 606, such as a keyboard, a mouse, etc.; an output unit 607, such as various types of displays, speakers, etc.; a storage unit 608, such as a disk, an optical disk, etc.; and a communication unit 609, such as a network card, a modem, a wireless communication transceiver, etc. The communication unit 609 allows the device 600 to exchange information / data with other devices through a computer network such as the Internet and / or various telecommunication networks.

[0153] The computing unit 601 may be a variety of general and / or special 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 running machine learning model algorithms, digital signal processors (DSPs), and any appropriate processors, controllers, microcontrollers, 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 may be implemented as a computer software program, which is tangibly contained in a machine-readable medium, such as a storage unit 608. In some embodiments, part or all of the computer program may be loaded and / or installed on the device 600 via ROM 602 and / or communication unit 609. When the computer program is loaded into RAM 603 and executed by the computing unit 601, one or more steps of the text tagging method described above may be performed. Alternatively, in other embodiments, the computing unit 601 may be configured to perform the text tagging method in any other appropriate manner (e.g., by means of firmware).

[0154] Various implementations of the systems and techniques described above 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), systems on chips (SOCs), load programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various implementations can include: being implemented in one or more computer programs that can be executed and / or interpreted on a programmable system including 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 method of the present disclosure may be written in any combination of one or more programming languages. These program codes may be provided to a processor or controller of a general-purpose computer, a special-purpose computer, or other programmable text marking device, so that the program code, when executed by the processor or controller, causes the functions / operations specified in the flow chart and / or block diagram to be implemented. The program code may be executed entirely on the machine, partially on the machine, partially on the machine and partially on a remote machine as a stand-alone software package, or entirely on a remote machine or server.

[0156] In the context of the present disclosure, a machine-readable medium may be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, device, or equipment. A machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium may 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 may 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 backend 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 frontend 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 backend components, middleware components, or frontend 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 the server are generally remote from each other and usually interact through a communication network. The relationship between the client and the server is generated by computer programs running on the corresponding computers and having a client-server relationship with each other. The server may be a cloud server, also known as a cloud computing server or cloud host, which is a host product in the cloud computing service system to solve the defects of difficult management and weak business scalability in traditional physical hosts and VPS services ("Virtual Private Server", or "VPS" for short). The server may also be a server of a distributed system, or a server combined with a blockchain.

[0160] It should be understood that the various forms of processes shown above can be used to reorder, add or delete steps. For example, the steps recorded in this disclosure can be executed in parallel, sequentially or in different orders, as long as the desired results of the technical solutions disclosed in this disclosure can be achieved, and this document does not limit this.

[0161] In addition, the terms "first" and "second" are used for descriptive purposes only and cannot be understood as indicating or implying relative importance or implicitly indicating the number of technical features indicated. Thus, the features defined as "first" and "second" may explicitly or implicitly include at least one of the features. In the description of the present disclosure, the meaning of "multiple" 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 determination" or "under the circumstances of".

[0162] The above specific implementations do not constitute a limitation on the protection scope of the present disclosure. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions can be made according to design requirements and other factors. Any modification, equivalent substitution and improvement made within the spirit and principle of the present disclosure shall be included in the protection scope of the present 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; Determining a whitelist and a blacklist corresponding to the first character based on a preset reference word list and the generated text; 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; Based on the second probability corresponding to each of the candidate words, a target word of the first character is determined from the candidate word set.

2. The method of claim 1, wherein: The determining, based on a preset reference word list and the generated text, a whitelist and a blacklist corresponding to the first character includes: Acquire a reference text set, wherein the reference text set includes a plurality of 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 value, and a second reference word list having a co-occurrence probability less than a second threshold value; Determine a blacklist corresponding to the first character according to the first reference word set table and the generated text; A whitelist corresponding to the first character is determined according to the second reference word set table and the generated text.

3. The method of claim 2, 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, and acquiring 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.

4. The method of claim 2, 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, and acquiring 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 the fourth characters obtained.

5. The method of claim 2, wherein: After counting the multiple reference texts, the method further includes: Identify the high frequency word set; After determining the whitelist and the 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.

6. The method of claim 5, 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 white list; The high-frequency words included in the whitelist are deleted.

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: 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.

8. 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 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.

9. The method according to any one of claims 1 to 8, 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 the preset reference word list, a blacklist and a whitelist corresponding to the fifth character to be generated are determined.

10. A text marking device, wherein: The device comprises: A first determination module, used 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 determine a whitelist and a blacklist corresponding to the first character based on a preset reference word list and the generated text; 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, so as to obtain a second probability corresponding to the candidate word; The third determination module is used to determine the target word of the first character from the candidate word set based on the second probability corresponding to each of the candidate words.

11. The device of claim 10, wherein: The second determining module is specifically used to: Acquire a reference text set, wherein the reference text set includes a plurality of 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 value, and a second reference word list having a co-occurrence probability less than a second threshold value; Determine a blacklist corresponding to the first character according to the first reference word set table and the generated text; A whitelist corresponding to the first character is determined according to the second reference word set table and the generated text.

12. The device of claim 11, wherein: The second determining module is further used for: Matching each second character in the generated text with the first reference word set, and acquiring 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.

13. The device of claim 11, wherein: The second determining module is further used for: Matching each second character in the generated text with the second reference word set, and acquiring 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 the fourth characters obtained.

14. The device of claim 11, wherein: The second determining module is further used for: Identify the high frequency word set; The second determining module is further used for: Based on the high-frequency word set, a whitelist corresponding to the first character is updated.

15. The device of claim 14, wherein: The second determining module is further used for: Matching the high-frequency words in the high-frequency word set with the white list; The high-frequency words included in the whitelist are deleted.

16. The device of claim 10, wherein: The update module is specifically used for: 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.

17. The device of claim 10, wherein: The update module is specifically used for: The first candidate word matches the blacklist, and the 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.

18. The device according to any one of claims 10 to 17, wherein: The third determining module is further used for: Based on the target word of the first character, the generated text, and the preset reference word list, a blacklist and a whitelist corresponding to the fifth character to be generated are determined.

19. 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 so that the at least one processor can execute the method according to any one of claims 1 to 9.

20. 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-9.

21. 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 9.

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

  • Text data set processing method, system and equipment and storage medium

    CN118313345A

  • Managing a whitelist of internet domains

    US20190036930A1

  • Text processing method

    US20230101401A1