Information generation method and electronic equipment

By detecting and processing chaotic statements, information that meets the target type is generated, the security risks of illegal content being displayed in out of order in scenarios such as Wenshengwen and others are solved, and the security of information generation is improved.

CN119227806APending Publication Date: 2024-12-31VIVO MOBILE COMM CO LTD
View PDF 4 Cites 0 Cited by

Patent Information

Application Number
CN202411387176.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-09-30
Publication Date
2024-12-31

AI Technical Summary

Technical Problem

In scenes such as Wenshengwen, Wensheng pictures, Wensheng videos, etc., there are illegal contents in the input text and the word order is disrupted. When displayed through specific typesetting, the illegal contents may be displayed, which poses a safety hazard.

Method used

Provide an information generation method and electronic device to receive reference text and output requirements input by the user, detect whether it is a chaotic statement, and generate information that meets the target type after the detection is passed, avoiding the construction of specific chaotic speech order through the layout format to cause illegal content Be generated and displayed.

Benefits of technology

It improves the security of information generation, eliminates the situation where users construct specific chaotic speech order through the layout format, resulting in the generation and display of illegal content, and enhances the ability to identify illegal content.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119227806A_ABST
    Figure CN119227806A_ABST
Patent Text Reader

Abstract

The invention discloses an information generation method and electronic equipment. Belongs to the technical field of computers. The method comprises the steps that first input of a user is received, the first input comprises first information, and the first information comprises a reference text and an output requirement; under the condition that the reference text is a disordered statement and the output requirement indicates that the content of the target type is generated, in response to the first input, performing security detection on the reference text to obtain a detection result; and under the condition that the detection result indicates that the reference text detection is passed, generating second information conforming to the target type based on the first information.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The embodiments of the present application relate to the field of computer technology, and specifically to an information generation method and an electronic device. Background Art

[0002] With the rapid development of artificial intelligence technology, natural language processing technology has made significant progress. At present, natural language processing technology has been widely used in many scenarios such as text generation, text generation, and text generation video.

[0003] In the prior art, in the scenarios such as the text generated by the text, the text generated by the picture, and the text generated by the video, if there is illegal content in the input text information and the word order of the illegal content is disrupted, when generating content such as artistic characters and acrostic poems, the illegal content with disrupted word order may be displayed in the correct word order through specific typesetting, causing the illegal content to be displayed, posing a security risk. Summary of the invention

[0004] The purpose of the embodiments of the present application is to provide an information generation method and an electronic device, which can improve the security of information generation.

[0005] In a first aspect, an embodiment of the present application provides an information generation method, the method comprising: receiving a first input from a user, the first input comprising first information, the first information comprising a reference text and an output requirement; when the reference text is a confusing sentence and the output requirement indicates generating content of a target type, in response to the first input, performing a security check on the reference text to obtain a check result; when the check result indicates that the reference text has passed the check, generating second information that conforms to the target type based on the first information.

[0006] In a second aspect, an embodiment of the present application provides an information generating device, which includes: a receiving unit, for receiving a first input from a user, the first input including first information, the first information including a reference text and an output requirement; a detection unit, for performing a security detection on the reference text in response to the first input to obtain a detection result when the reference text is a confusing sentence and the output requirement indicates the generation of content of a target type; and a generating unit, for generating second information that conforms to the target type based on the first information when the detection result indicates that the reference text has passed the detection.

[0007] In a third aspect, an embodiment of the present application provides an electronic device, which includes a processor and a memory, wherein the memory stores programs or instructions that can be run on the processor, and when the program or instructions are executed by the processor, the steps of the method described in the first aspect are implemented.

[0008] In a fourth aspect, an embodiment of the present application provides a readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the steps of the method described in the first aspect above are implemented.

[0009] In a fifth aspect, an embodiment of the present application provides a chip, comprising a processor and a communication interface, wherein the communication interface is coupled to the processor, and the processor is used to run a program or instruction to implement the method described in the first aspect.

[0010] In a sixth aspect, an embodiment of the present application provides a computer program product, which is stored in a storage medium and is executed by at least one processor to implement the method described in the first aspect.

[0011] In an embodiment of the present application, a first input from a user is first received, the first input includes first information, and the first information includes reference text and output requirements; when the reference text is a confusing sentence and the output requirement indicates that the target type of content is to be generated, in response to the first input, a security check is performed on the reference text to obtain a test result; when the test result indicates that the reference text has passed the test, second information that conforms to the target type is generated based on the first information. Because the first information is tested for confusing sentences and output requirements before the second information is generated based on the first information, it is possible to perform a security check on the confusing sentences when the reference text in the first information is a confusing sentence and the output requirement indicates that the target type of content is to be generated, and the second information is generated based on the first information when the security check passes, thereby preventing the user from generating and displaying illegal content by constructing a specific confusing word order through the typesetting format, thereby improving the security of information generation. BRIEF DESCRIPTION OF THE DRAWINGS

[0012] Figure 1 is a flow chart of the information generation method provided in an embodiment of the present application;

[0013] Figure 2A It is a schematic diagram of an application scenario of the information generation method provided in an embodiment of the present application;

[0014] Figure 2B It is a schematic diagram of an application scenario of the information generation method provided in an embodiment of the present application;

[0015] Figure 2C It is a schematic diagram of an application scenario of the information generation method provided in an embodiment of the present application;

[0016] Figure 3 It is a structural schematic diagram of an information generating device provided in an embodiment of the present application;

[0017] Figure 4is a schematic diagram of the structure of an electronic device provided in an embodiment of the present application;

[0018] Figure 5 It is a schematic diagram of the hardware structure of an electronic device suitable for implementing the embodiments of the present application. DETAILED DESCRIPTION

[0019] The following will be combined with the drawings in the embodiments of the present application to clearly describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, rather than all the embodiments. All other embodiments obtained by ordinary technicians in this field based on the embodiments in the present application belong to the scope of protection of this application.

[0020] The terms "first", "second", etc. in the specification and claims of the present application are used to distinguish similar objects, and are not used to describe a specific order or sequence. It should be understood that the data used in this way can be interchangeable under appropriate circumstances, so that the embodiments of the present application can be implemented in an order other than those illustrated or described here, and the objects distinguished by "first", "second", etc. are generally of one type, and the number of objects is not limited. For example, the first object can be one or more. In addition, "and / or" in the specification and claims represents at least one of the connected objects, and the character " / " generally indicates that the objects associated with each other are in an "or" relationship.

[0021] The information generation method and device provided in the embodiments of the present application are described in detail below through specific embodiments and their application scenarios in conjunction with the accompanying drawings.

[0022] Please refer to Figure 1 , which shows one of the flow charts of the information generation method provided in the embodiment of the present application. The information generation method provided in the embodiment of the present application can be applied to electronic devices. In practice, the above electronic devices can be electronic devices such as smart phones, tablet computers, laptop computers, etc.

[0023] The process of the information generation method provided in the embodiment of the present application includes the following steps:

[0024] Step 101: receiving a first input from a user, wherein the first input includes first information, and the first information includes a reference text and an output requirement.

[0025] In this embodiment, the first input may be a touch input, or a voice command, or a specific gesture input by the user, or other feasible inputs, which may be determined according to actual usage requirements, and are not limited in the embodiments of the present application. The specific gesture in the embodiments of the present application may be any one of a single-click gesture, a sliding gesture, a dragging gesture, a pressure recognition gesture, a long press gesture, an area change gesture, a double-press gesture, and a double-click gesture. The click input in the embodiments of the present application may be a single-click input, a double-click input, or any number of click inputs, etc., and may also be a long press input or a short press input.

[0026] In this embodiment, the first input may include first information. The first information may be information in text form. The first information may include reference text and output requirements. The reference text is a text that provides a reference for information output, and the output requirements may be used to indicate information of the output target type. In addition, the output requirements may also indicate the format, style, etc. of the output content, which are not specifically limited here.

[0027] As an example, the first information is "Using "Wishing King Qiu Lao a Happy Teacher's Day" as the title, write an acrostic poem, and it should be a seven-character regulated verse, and output two sentences per line", then the reference text is "Wishing King Qiu Lao a Happy Teacher's Day", and the output requirement is "Write an acrostic poem, and it should be a seven-character regulated verse, and output two sentences per line".

[0028] As another example, the first information is "Convert the following content into artistic words, with two words in each line: I wish Mr. Wang Qiu a happy and healthy life", then the reference text is "I wish Mr. Wang Qiu a happy and healthy life", and the output requirement is "Convert the following content into artistic words, with two words in each line".

[0029] In practice, the reference text and output requirements in the first information can be identified in a variety of ways. As an example, the text in the special symbols in the first information can be used as the reference text, and the content in the first information other than the reference text can be used as the output requirement. Special symbols can include, but are not limited to, book title marks, quotation marks, etc. As another example, a specific string in the first information can be identified by a regular expression, such as "with XX as the title", "XX as the first word", etc., and the content in the specific string can be used as the reference text, and the content in the first information other than the above-mentioned specific string can be used as the output requirement.

[0030] Step 102: When the reference text is a confusing sentence and the output requirement indicates generating content of a target type, in response to the first input, a security check is performed on the reference text to obtain a check result.

[0031] In this embodiment, the following steps may be specifically performed:

[0032] The first step is to detect the chaotic sentences of the reference text in the first information to determine whether the reference text is a chaotic sentence. The chaotic sentence can be a sentence with disordered word order, such as "Wish Zhong Wang Qiu Lao Kuai Shi Happy" in the above example.

[0033] In practice, a confusing sentence detection model for confusing sentence detection can be pre-trained, and the reference text in the first information can be input into the confusing sentence detection model to determine whether the reference text is a confusing sentence. The above-mentioned confusing sentence detection model can be pre-trained using a machine learning method. The samples used to train the confusing sentence detection model can be historical texts input when using the dialogue function of the large language model, and each sample can be annotated to indicate whether the large language model can understand the historical text. The annotation can be obtained based on the response of the large language model to the input of the above-mentioned historical text. If the large language model cannot respond to the historical text, or generates a specific text, such as "I can't understand what you mean", etc., an annotation for indicating a confusing sentence can be added to the historical text. Conversely, an annotation for indicating a non-confused sentence can be added to the historical text. Through the annotated samples, a supervised learning method can be used to train a basic model with a classification function to obtain a confusing sentence detection model. The above-mentioned basic model can use a lightweight model, such as a convolutional neural network.

[0034] The second step is to detect the information output scenario based on the output requirement in the first information, and determine the type of content generated by the output requirement based on the determined information output scenario. The information output scenario may include but is not limited to an artistic word generation scenario, an acrostic poem generation scenario, a dialogue scenario, etc. If the information output scenario is an artistic word generation scenario, it can be determined that the type of content generated by the output requirement is an artistic word. If the information output scenario is an acrostic poem generation scenario, it can be determined that the type of content generated by the output requirement is an acrostic poem. If the information output scenario is a dialogue scenario, it can be determined that the type of content generated by the output requirement is a regular dialogue content.

[0035] In practice, a scene detection model for detecting information output scenes can be pre-trained, and the output requirements in the first information are input into the scene detection model to obtain the information output scene, thereby determining the type of content generated by the output requirement indication based on the determined information output scene. The above scene detection model can be pre-trained using a machine learning method. As an example, the sample used to train the scene detection model can be a historical text input by a user into a large language model, and each sample can be annotated. The annotation of the sample can be manually pre-added or automatically added by string matching. For example, if a sample includes the string "artistic words", annotations for indicating artistic words can be added to the historical text. For another example, if a sample includes the string "hidden acrostic poem", annotations for indicating hidden acrostic poem can be added to the historical text. Through the annotated samples, a supervised learning method can be used to train a basic model with a classification function to obtain a scene detection model. The above basic model can use a lightweight model, such as a convolutional neural network.

[0036] It should be noted that the above-mentioned chaotic sentence detection model and the above-mentioned scene detection model can be used as two independent models or as two sub-models integrated into a semantic recognition model. The semantic recognition model can also integrate other sub-models to have more functions.

[0037] In the third step, when the reference text is a chaotic sentence and the output requirement indicates the generation of the target type of content, in response to the first input, a security check is performed on the chaotic sentence to obtain a test result. The target type may include but is not limited to at least one of the following: acrostic poems, artistic characters. The above-mentioned security check on the chaotic sentence may include but is not limited to at least one of the following: detecting illegal content after re-adjusting the word order of the chaotic sentence, performing sentiment analysis on the chaotic sentence, performing sensitive subject detection on the chaotic sentence, etc. After the chaotic sentence is security checked, the test result obtained can indicate whether the security check has passed.

[0038] In some optional implementations, the security detection of the chaotic statement may include the following sub-steps:

[0039] Sub-step 1021, based on the target type, rearrange the characters in the reference text to obtain a rearranged sentence.

[0040] Here, you can set multiple ways to rearrange the words in the chaotic sentence as needed. The following is an example:

[0041] As an example, the chaotic sentence can be divided into two text sequences, one of which stores words sorted as odd numbers, and the other stores words sorted as even numbers, and then the two text sequences are spliced ​​to obtain a rearranged sentence. For example, for the above example "Wish Mr. Wang a happy Mid-Autumn Festival", according to this rearrangement method, it can be divided into two text sequences, namely "Wish Mr. Wang a happy Mid-Autumn Festival". After splicing the two, the rearranged sentence "Wish Mr. Wang a happy Mid-Autumn Festival" is obtained.

[0042] As another example, the chaotic sentence can be divided into two text sequences according to the same number of characters, one of which stores the first half of the characters in the chaotic word order, and the other stores the second half of the characters in the chaotic word order. The two text sequences are then spliced ​​in order of characters to obtain a rearranged sentence. For example, for the chaotic sentence "You X is Y", according to this rearrangement method, it can be divided into two text sequences, namely "You X" and "Is Y". The two are spliced ​​in order according to the character order to obtain a rearranged sentence "You are XY". Among them, XY can be uncivilized words.

[0043] Sub-step 1022, performing violation detection on the rearrangement statement to obtain a first detection result.

[0044] Here, in the case where the reordered statement includes illegal content, a first detection result indicating that the security check failed can be generated. In the case where the reordered statement does not include illegal content, a first detection result indicating that the security check passed can be generated. Among them, illegal content may include but is not limited to insulting content, defamatory content, false content, private content, sensitive content, etc., which is not limited in the embodiment of the present application. The embodiment of the present application can detect illegal content on the reordered statement through various conventional illegal content detection means, which will not be repeated here.

[0045] Sub-step 1023, detecting the emotion type of the reference text to obtain a second detection result.

[0046] Here, the emotion type may include but is not limited to positive, negative, etc.

[0047] In some optional implementations, a sentiment word library may be obtained, which includes sentiment words of multiple target sentiment types. The target sentiment type may be set as needed, for example, it may be a type corresponding to negative sentiment. For each word in the sentiment word library, if the reference text includes each character in the word, the word is used as a target word; if the number of target words is greater than or equal to a threshold, it may be determined that the sentiment type of the reference text is the target sentiment class; if the number of target words is less than the threshold, it may be determined that the sentiment type of the reference text is not the target sentiment class. By detecting the sentiment type of the reference text through the sentiment word library, it is possible to accurately detect whether the sentiment type of the reference text is the target type.

[0048] In some optional implementations, a sentiment type detection model for detecting sentiment types of texts can be pre-trained, and the reference text can be input into the sentiment type detection model to obtain a second detection result. The sentiment type detection model can be pre-trained using a machine learning method. The samples used to train the sentiment type detection model can be historical texts input by users, and each sample can be accompanied by a label indicating whether it corresponds to a negative emotion, and the label of the sample can be manually added in advance. With the labeled samples, a supervised learning method can be used to train a basic model with a classification function to obtain a sentiment type detection model. The basic model can use a lightweight model, such as a convolutional neural network. It should be noted that the sentiment type detection model can be used as an independent model or as a sub-model, integrated into the semantic recognition model, which is not specifically limited here. Through the sentiment type detection model, the reference text can be conveniently and quickly detected for sentiment type, thereby improving the efficiency of sentiment type detection.

[0049] Sub-step 1024, performing sensitive subject detection on the reference text to obtain a third detection result.

[0050] Here, sensitive subjects may include but are not limited to the names of politicians, political parties, government agencies, etc. In practice, sensitive subjects can be detected by character matching.

[0051] In some optional implementations, a sensitive subject vocabulary may be first obtained, and the sensitive subject vocabulary includes a plurality of sensitive words. The sensitive subject vocabulary may be pre-established and stored. If the reference text includes each character of at least one word in the sensitive subject vocabulary, it is determined that the reference text includes a sensitive subject. As an example, for a word "ABC" in the sensitive subject vocabulary, if the confusing sentence includes "B", "C", and "A" in sequence, it can be determined that the confusing sentence contains a sensitive subject. By performing sensitive subject detection on the reference text through the sensitive subject vocabulary, the sensitive subject in the reference text can be accurately detected.

[0052] Sub-step 1025, determining the detection result of the safety detection based on the first detection result, the second detection result and the third detection result.

[0053] Here, in the case where the first detection result indicates that the reference text includes illegal content, or in the case where the second detection result indicates that the emotional type of the reference text is the target emotional type, or in the case where the third detection result indicates that the reference text includes a sensitive subject, a detection result indicating that the security detection fails can be obtained. Conversely, in the case where the first detection result indicates that the reference text includes illegal content, the second detection result indicates that the emotional type of the reference text is the target emotional type, and the third detection result indicates that the reference text includes a sensitive subject, a detection result indicating that the security detection passes can be obtained.

[0054] By re-adjusting the word order of chaotic sentences and then detecting illegal content, we can avoid the situation where users use typesetting formats to construct specific chaotic word orders to output illegal content in large language model usage scenarios such as acrostic poetry generation and artistic word generation, thereby improving the security of information generation. By detecting the emotional type and sensitive subjects of reference texts, we can further enhance the ability to identify illegal content and further improve the security of information generation content.

[0055] In some optional implementations, in the above sub-step 1025, when the second detection result indicates that the emotion type of the above reference text is the target emotion type, and the third detection result indicates that the above reference text contains a sensitive subject, the following steps may also be performed:

[0056] In the first step, based on the sensitive subjects in the reference text and the semantic recovery model, the reference text is semantically restored to obtain a semantic recovery sentence. The semantic recovery model may be a large language model with a semantic recovery function. The reference text and the sensitive subjects therein may be input into the semantic recovery model to obtain a semantic recovery sentence generated by the semantic recovery model.

[0057] As an example, the reference text is "Generate Art Words: You X is Y". If the sensitive subject "XY" has been identified in the above method, the following content "The reference text is "Generate Art Words: You X is Y", which includes the sensitive subject "XY". Please perform semantic restoration on the reference text according to the sensitive subject and generate a sentence with the correct word order" can be input into the semantic restoration model to obtain the semantic restoration sentence "Generate Art Words: You are XY" output by the semantic restoration model. Among them, XY can be an uncivilized term.

[0058] The second step is to detect whether the semantic recovery statement includes illegal content, and obtain a fourth detection result. The detection of illegal content can be found above, and will not be repeated here to avoid repetition.

[0059] The third step is to determine the test result of the security test based on the first test result and the fourth test result. Here, when the first test result indicates that the reference text includes illegal content, or when the fourth test result indicates that the semantic recovery statement includes illegal content, a test result indicating that the security test fails can be obtained. On the contrary, when the first test result indicates that the reference text does not include illegal content, and the fourth test result indicates that the semantic recovery statement does not include illegal content, a test result indicating that the security test passes can be obtained.

[0060] By performing semantic restoration of the reference text based on sensitive subjects and semantic restoration models in the reference text, and detecting illegal content in the semantic restoration sentences, the ability to identify illegal content can be further enhanced, further improving the security of information generation content.

[0061] Step 103: When the detection result indicates that the reference text has passed the detection, second information that meets the target type is generated based on the first information.

[0062] In this embodiment, when the detection result indicates that the security detection has passed, the second information that meets the target type can be generated based on the first information. For example, if the target type is an artistic word type, the second information is an artistic word. If the target type is an acrostic poem type, the second information is text information of the acrostic poem type.

[0063] In some optional implementations, when the reference text is a confusing sentence and the output requirement indicates that non-target type of content is to be output, or when the detection result indicates that the security detection has not passed, a prompt message may be returned. The prompt message may be used to prompt the user that the first information input by the user is non-compliant. Thus, it is convenient for the user to modify the first information while avoiding providing the user with non-compliant generated content.

[0064] In some optional implementations, the first information is information to be input into the large language model, and the output requirement indicates that the large language model generates information of the target type. When the detection result indicates that the reference text detection passes, the first information can be input into the large language model to obtain the second information that meets the target type output by the large language model.

[0065] Among them, Large Language Model (LLM) refers to a neural network model for natural language processing that contains ultra-large-scale parameters. Large language models have huge scale, multi-task learning capabilities, powerful computing resources and abundant training data. Large language models are widely used in the field of natural language processing and have the ability to perform well in various natural language processing tasks, such as text classification, sentiment analysis, summary generation, translation, etc. Large language models can be used in multiple application fields such as automatic writing, chatbots, virtual assistants, voice assistants, automatic translation, etc.

[0066] As an example, see Figure 2A . The first information is shown as label 201, which is "write an acrostic poem with the title "Wishing the King of Zhongqiu a Happy Teacher's Day", and it should be a seven-character regulated verse, and output two sentences per line", then the reference text is "Wishing the King of Zhongqiu a Happy Teacher's Day", and the output requirement is "write an acrostic poem, and it should be a seven-character regulated verse, and output two sentences per line". The above reference text is a chaotic sentence, and the above output requirement indicates the generation of an acrostic poem. When the test result after the reference text is security tested indicates that the reference text has passed the test, the first information can be input into the large language model to obtain the acrostic poem shown as label 202.

[0067] As yet another example, see Figure 2B . The first information is shown as label 203, which is "Convert the following content into artistic words, two words per line: I wish you a happy and joyful Wang Qiu Lao", then the reference text is "I wish you a happy and joyful Wang Qiu Lao", and the output requirement is "Convert the following content into artistic words, two words per line". The above reference text is a chaotic sentence, and the above output requirement indicates the generation of artistic words. In the case where the test result after the security test on the reference text indicates that the reference text has passed the test, the first information can be input into the large language model to obtain the artistic words shown as label 204.

[0068] As another example, Figure 2C The first information is shown as label 205, which is "Generate artistic words: eliminate the evil and change the evil", then the reference text is "eliminate the evil and change the evil", and the output requirement is "generate artistic words". The above reference text is a confusing sentence, and the above output requirement indicates to generate artistic words. In the case where the test result after the safety test of the reference text indicates that the reference text test fails, the prompt information shown as label 205 can be output.

[0069] By inputting the first information into the large language model when the detection result indicates that the reference text detection has passed, and obtaining the second information that conforms to the target type output by the large language model, it is possible to avoid the situation in which, in large language model usage scenarios such as acrostic poem generation scenarios and artistic character generation scenarios, the user constructs a specific chaotic word order by utilizing the typesetting format of the model output content, thereby inducing the large language model to output illegal content, thereby improving the security of content generated by the large language model.

[0070] In some optional implementations, when the reference text is a normal sentence, the first information can be directly input into the large language model to obtain the third information output by the large language model, thereby facilitating the user to use the function of the large language model normally.

[0071] The method provided by the above-mentioned embodiment of the present application first receives a first input from a user, wherein the first input includes first information, and the first information includes a reference text and an output requirement; when the reference text is a confusing sentence and the output requirement indicates that the target type of content is to be generated, in response to the first input, a security check is performed on the reference text to obtain a test result; when the test result indicates that the reference text has passed the test, second information that conforms to the target type is generated based on the first information. Because the first information is tested for confusing sentences and the output requirement is tested before the second information is generated based on the first information, it is possible to perform a security check on the confusing sentences when the reference text in the first information is a confusing sentence and the output requirement indicates that the target type of content is to be generated, and generate the second information based on the first information when the security check passes, thereby preventing the user from generating and displaying illegal content by constructing a specific confusing word order through the typesetting format, thereby improving the security of information generation.

[0072] It should be noted that the information generation method provided in the embodiment of the present application can be executed by an information generation device. In the embodiment of the present application, the information generation device provided in the embodiment of the present application is described by taking the information generation method executed by the information generation device as an example.

[0073] like Figure 3 As shown, the information generating device 300 of this embodiment includes: a receiving unit 301, used to receive a first input from a user, wherein the first input includes first information, and the first information includes a reference text and an output requirement; a detection unit 302, used to, in response to the first input, perform a security detection on the reference text to obtain a detection result when the reference text is a confusing sentence and the output requirement indicates the generation of a target type of content; and a generating unit 303, used to generate second information that conforms to the target type based on the first information when the detection result indicates that the reference text has passed the detection.

[0074] In some optional implementations, the detection unit 302 is further used to: rearrange the characters in the reference text based on the target type to obtain a rearranged sentence; perform violation detection on the rearranged sentence to obtain a first detection result; detect the emotional type of the reference text to obtain a second detection result; perform sensitive subject detection on the reference text to obtain a third detection result; and determine the detection result of the security detection based on the first detection result, the second detection result, and the third detection result. By re-adjusting the word order of the chaotic sentence and then performing the violation content detection, it is possible to avoid the situation in which the user outputs the violation content by constructing a specific chaotic word order using the typesetting format in the large language model usage scenarios such as the acrostic poem generation scenario and the artistic word generation scenario, thereby improving the security of information generation. By detecting the emotional type and sensitive subject of the reference text, the ability to identify the violation content can be further enhanced, and the security of the information generation content can be further improved.

[0075] In some optional implementations, the detection unit 302 is further used to: input the reference text into a pre-trained emotion type detection model to obtain a second detection result; or, obtain an emotion word library, wherein the emotion word library includes emotion words of multiple target emotion types; for each word in the emotion word library, if the reference text includes each character in the word, the word is used as a target word; if the number of target words is greater than or equal to a threshold, the emotion type of the reference text is determined to be the target emotion class; if the number of target words is less than the threshold, the emotion type of the reference text is determined not to be the target emotion class. By detecting the emotion type of the reference text through the emotion word library, it is possible to accurately detect whether the emotion type of the reference text is the target type. Through the emotion type detection model, the emotion type detection of the reference text can be conveniently and quickly performed, thereby improving the efficiency of emotion type detection.

[0076] In some optional implementations, the detection unit 302 is further used to: obtain a sensitive subject word library, wherein the sensitive subject word library includes multiple sensitive words; if the reference text includes each character in at least one word in the sensitive subject word library, it is determined that the reference text includes a sensitive subject. By performing sensitive subject detection on the reference text through the sensitive subject word library, the sensitive subject in the reference text can be accurately detected.

[0077] In some optional implementations, the detection unit 302 is further used to: when the second detection result indicates that the emotion type of the reference text is the target emotion type, and the third detection result indicates that the reference text contains a sensitive subject, based on the sensitive subject and the semantic recovery model in the reference text, perform semantic recovery on the reference text to obtain a semantic recovery sentence; detect whether the semantic recovery sentence includes illegal content to obtain a fourth detection result; and determine the detection result of the security detection based on the first detection result and the fourth detection result. By performing semantic recovery on the reference text based on the sensitive subject and the semantic recovery model in the reference text, and detecting illegal content on the semantic recovery sentence, the ability to identify illegal content can be further enhanced, and the security of information generation content can be further improved.

[0078] In some optional implementations, the first information is information to be input into the large language model, and the output requirement indicates that the large language model generates information of the target type; the generating unit 303 is also used to input the first information into the large language model to obtain the second information output by the large language model that meets the target type. By inputting the first information into the large language model when the detection result indicates that the reference text detection has passed, and obtaining the second information output by the large language model that meets the target type, it is possible to avoid the situation in which the user constructs a specific chaotic word order by using the typesetting format of the model output content in the large language model usage scenarios such as the acrostic poem generation scenario and the artistic character generation scenario, thereby inducing the large language model to output illegal content, thereby improving the security of the content generated by the large language model.

[0079] In some optional implementations, the device further includes: a returning unit, configured to return a prompt message when the reference text is a confusing sentence and the output requirement indicates that the content of a non-target type is to be output, or when the detection result indicates that the security detection has not passed, wherein the prompt message is used to prompt the user that the first information input is non-compliant. This facilitates the user to modify the first information while avoiding providing the user with non-compliant generated content.

[0080] The device provided by the above-mentioned embodiment of the present application first receives a first input from a user, wherein the first input includes a first information, and the first information includes a reference text and an output requirement; when the reference text is a confusing sentence and the output requirement indicates that the target type of content is to be generated, in response to the first input, a security check is performed on the reference text to obtain a test result; when the test result indicates that the reference text has passed the test, second information that conforms to the target type is generated based on the first information. Because the first information is tested for confusing sentences and the output requirement is tested before the second information is generated based on the first information, it is possible to perform a security check on the confusing sentences when the reference text in the first information is a confusing sentence and the output requirement indicates that the target type of content is to be generated, and generate the second information based on the first information when the security check passes, thereby preventing the user from generating and displaying illegal content by constructing a specific confusing word order through the typesetting format, thereby improving the security of information generation.

[0081] The information generating device in the embodiment of the present application can be an electronic device, or a component in the electronic device, such as an integrated circuit or a chip. The electronic device can be a terminal, or other devices other than a terminal. Exemplarily, the electronic device can be a mobile phone, a tablet computer, a laptop computer, a PDA, a vehicle-mounted electronic device, a mobile Internet device (Mobile Internet Device, MID), an augmented reality (Augmented Reality, AR) / virtual reality (Virtual Reality, VR) device, a robot, a wearable device, a super mobile personal computer (Ultra-Mobile Personal Computer, UMPC), a netbook or a personal digital assistant (Personal Digital Assistant, PDA), etc., and can also be a server, a network attached storage (Network Attached Storage, NAS), a personal computer (Personal Computer, PC), a television (Television, TV), a teller machine or a self-service machine, etc., and the embodiment of the present application is not specifically limited.

[0082] The information generating device in the embodiment of the present application may be a device having an operating system. The operating system may be an Android operating system, an iOS operating system, or other possible operating systems, which are not specifically limited in the embodiment of the present application.

[0083] The information generation device provided in the embodiment of the present application can achieve Figure 1 To avoid repetition, the various processes implemented in the method embodiment of FIG. 2 are not described again here.

[0084] Alternatively, if Figure 4 As shown, an embodiment of the present application also provides an electronic device 400, including a processor 401 and a memory 402, wherein the memory 402 stores programs or instructions that can be executed on the processor 401, and when the program or instructions are executed by the processor 401, the various steps of the above-mentioned information generation method embodiment are implemented, and the same technical effect can be achieved. To avoid repetition, they are not repeated here.

[0085] It should be noted that the electronic devices in the embodiments of the present application include the above-mentioned mobile electronic devices and non-mobile electronic devices.

[0086] Figure 5 A schematic diagram of the hardware structure of an electronic device to implement an embodiment of the present application.

[0087] The electronic device 500 includes but is not limited to: a radio frequency unit 501, a network module 502, an audio output unit 503, an input unit 504, a sensor 505, a display unit 506, a user input unit 507, an interface unit 508, a memory 509, and a processor 510.

[0088] Those skilled in the art will appreciate that the electronic device 500 may also include a power source (such as a battery) for supplying power to various components, and the power source may be logically connected to the processor 510 through a power management system, thereby implementing functions such as managing charging, discharging, and power consumption management through the power management system. Figure 5 The electronic device structure shown in the figure does not constitute a limitation on the electronic device. The electronic device may include more or fewer components than shown in the figure, or combine certain components, or arrange the components differently, which will not be described in detail here.

[0089] Among them, the user input unit 507 is used to receive a first input from a user, wherein the first input includes first information, and the first information includes a reference text and an output requirement; the processor 510 is used to, in response to the first input, perform a security check on the reference text to obtain a test result when the reference text is a confusing sentence and the output requirement indicates generating content of a target type; and generate second information that conforms to the target type based on the first information when the test result indicates that the reference text has passed the test.

[0090] Because the first information is checked for chaotic sentences and output requirements before the second information is generated based on the first information, it is possible to perform a security check on the chaotic sentences when the reference text in the first information is a chaotic sentence and the output requirement indicates generating content of the target type, and generate the second information based on the first information when the security check passes, thereby preventing the user from generating and displaying illegal content by constructing a specific chaotic word order through typesetting format, thereby improving the security of information generation.

[0091] In some optional implementations, the processor 510 is further used to rearrange the words in the reference text based on the target type to obtain a rearranged sentence; perform violation detection on the rearranged sentence to obtain a first detection result; detect the emotional type of the reference text to obtain a second detection result; perform sensitive subject detection on the reference text to obtain a third detection result; and determine the detection result of the security detection based on the first detection result, the second detection result, and the third detection result. By re-adjusting the word order of the chaotic sentence and performing illegal content detection, it is possible to avoid the situation in which the user outputs illegal content by constructing a specific chaotic word order using the typesetting format in large language model usage scenarios such as the acrostic poem generation scenario and the artistic word generation scenario, thereby improving the security of information generation. By detecting the emotional type and sensitive subject of the reference text, the ability to identify illegal content can be further enhanced, further improving the security of information generation content. Based on the target type, the words in the chaotic sentence are rearranged to obtain a rearranged sentence; detect whether the rearranged sentence includes illegal content; if the rearranged sentence includes illegal content, a detection result indicating that the security detection fails is generated. By performing sentiment analysis on chaotic sentences without including illegal content in the rearranged sentences, the ability to identify illegal content can be further enhanced, further improving the security of content generated by large language models.

[0092] In some optional implementations, the processor 510 is further used to input the reference text into a pre-trained emotion type detection model to obtain a second detection result; or, obtain an emotion word library, wherein the emotion word library includes multiple emotion words of the target emotion type; for each word in the emotion word library, if the reference text includes each character in the word, the word is used as a target word; if the number of the target words is greater than or equal to the threshold, the emotion type of the reference text is determined to be the target emotion class; if the number of the target words is less than the threshold, the emotion type of the reference text is determined not to be the target emotion class. By detecting the emotion type of the reference text through the emotion word library, it is possible to accurately detect whether the emotion type of the reference text is the target type. Through the emotion type detection model, the reference text can be conveniently and quickly detected for the emotion type, thereby improving the efficiency of the emotion type detection. In the case where the rearranged sentence does not include illegal content, the chaotic sentence is subjected to emotion analysis to determine whether the chaotic sentence corresponds to negative emotion; in the case where the chaotic sentence corresponds to negative emotion, a detection result indicating that the security detection fails is generated.

[0093] In some optional implementations, the processor 510 is further configured to obtain a sensitive subject word library, wherein the sensitive subject word library includes multiple sensitive words; if the reference text includes each character in at least one word in the sensitive subject word library, it is determined that the reference text includes a sensitive subject. By performing sensitive subject detection on the reference text through the sensitive subject word library, the sensitive subject in the reference text can be accurately detected.

[0094] In some optional implementations, the processor 510 is further used to perform semantic recovery on the reference text based on the sensitive subject and the semantic recovery model in the reference text to obtain a semantic recovery sentence when the second detection result indicates that the emotion type of the reference text is the target emotion type and the third detection result indicates that the reference text contains a sensitive subject; detect whether the semantic recovery sentence includes illegal content to obtain a fourth detection result; and determine the detection result of the security detection based on the first detection result and the fourth detection result. By performing semantic recovery on the reference text based on the sensitive subject and the semantic recovery model in the reference text and detecting illegal content on the semantic recovery sentence, the ability to identify illegal content can be further enhanced, and the security of the information generated content can be further improved.

[0095] In some optional implementations, the first information is information to be input into the large language model, and the output requirement indicates that the large language model generates information of the target type; the processor 510 is also used to input the first information into the large language model to obtain the second information output by the large language model that meets the target type. By inputting the first information into the large language model when the detection result indicates that the reference text detection has passed, and obtaining the second information output by the large language model that meets the target type, it is possible to avoid the situation in which the user constructs a specific chaotic word order by using the typesetting format of the model output content in the large language model usage scenarios such as the acrostic poem generation scenario and the artistic word generation scenario, thereby inducing the large language model to output illegal content, thereby improving the security of the content generated by the large language model. In the case where the chaotic sentence corresponds to non-negative emotions, based on the sensitive subject vocabulary, it is determined whether the chaotic sentence contains a sensitive subject; in the case where the chaotic sentence does not contain a sensitive subject, a detection result indicating that the security detection has passed is generated; in the case where the chaotic sentence contains a sensitive subject, a detection result indicating that the security detection has not passed is generated. By performing sentiment analysis on chaotic sentences without including illegal content in the rearranged sentences, the ability to identify illegal content can be further enhanced, further improving the security of content generated by large language models. By performing sensitive subject detection on chaotic sentences, the ability to identify illegal content can be further enhanced, further improving the security of content generated by large language models.

[0096] In some optional implementations, the processor 510 is further used to return a prompt message when the reference text is a confusing sentence and the output requirement indicates that the output is not the target type of content, or when the detection result indicates that the security detection has not passed, the prompt message is used to prompt that the first information input by the user is not compliant. In the case where the reference text is a confusing sentence and the output requirement indicates that the large language model outputs content that is not the target type, or when the detection result indicates that the security detection has not passed, a prompt message is returned, and the prompt message is used to prompt that the first information input by the user is not compliant. Thus, it is convenient for the user to modify the first information while avoiding providing the user with non-compliant generated content. It should be understood that in the embodiment of the present application, the input unit 504 may include a graphics processor (Graphics Processing Unit, GPU) 5041 and a microphone 5042, and the graphics processor 5041 processes the image data of a static picture or video obtained by an image capture device (such as a camera) in a video capture mode or an image capture mode. The display unit 506 may include a display panel 5061, and the display panel 5061 may be configured in the form of a liquid crystal display, an organic light emitting diode, etc. The user input unit 507 includes at least one of a touch panel 5071 and other input devices 5072. The touch panel 5071 is also called a touch screen. The touch panel 5071 may include two parts: a touch detection device and a touch controller. Other input devices 5072 may include, but are not limited to, a physical keyboard, a function key (such as a volume control key, a switch key, etc.), a trackball, a mouse, and a joystick, which will not be repeated here.

[0097] The memory 509 can be used to store software programs and various data. The memory 509 may mainly include a first storage area for storing programs or instructions and a second storage area for storing data, wherein the first storage area may store an operating system, an application program or instructions required for at least one function (such as a sound playback function, an image playback function, etc.), etc. In addition, the memory 509 may include a volatile memory or a non-volatile memory, or the memory 509 may include both volatile and non-volatile memories. Among them, the non-volatile memory may be a read-only memory (ROM), a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), an electrically erasable programmable read-only memory (EEPROM), or a flash memory. The volatile memory may be a random access memory (RAM), a static random access memory (SRAM), a dynamic random access memory (DRAM), a synchronous dynamic random access memory (SDRAM), a double data rate synchronous dynamic random access memory (DDRSDRAM), an enhanced synchronous dynamic random access memory (ESDRAM), a synchronous link dynamic random access memory (SLDRAM) and a direct memory bus random access memory (DRRAM). The memory 509 in the embodiment of the present application includes but is not limited to these and any other suitable types of memory.

[0098] The processor 510 may include one or more processing units; optionally, the processor 510 integrates an application processor and a modem processor, wherein the application processor mainly processes operations related to an operating system, a user interface, and application programs, and the modem processor mainly processes wireless communication signals, such as a baseband processor. It is understandable that the modem processor may not be integrated into the processor 510.

[0099] An embodiment of the present application also provides a readable storage medium, on which a program or instruction is stored. When the program or instruction is executed by a processor, the various processes of the above-mentioned information generation method embodiment are implemented and the same technical effect can be achieved. To avoid repetition, it will not be repeated here.

[0100] The processor is the processor in the electronic device described in the above embodiment. The readable storage medium includes a computer readable storage medium, such as a computer read-only memory ROM, a random access memory RAM, a magnetic disk or an optical disk.

[0101] An embodiment of the present application further provides a chip, which includes a processor and a communication interface, wherein the communication interface is coupled to the processor, and the processor is used to run programs or instructions to implement the various processes of the above-mentioned information generation method embodiment, and can achieve the same technical effect. To avoid repetition, it will not be repeated here.

[0102] It should be understood that the chip mentioned in the embodiments of the present application can also be called a system-level chip, a system chip, a chip system or a system-on-chip chip, etc.

[0103] An embodiment of the present application provides a computer program product, which is stored in a storage medium. The program product is executed by at least one processor to implement the various processes of the above-mentioned information generation method embodiment and can achieve the same technical effect. To avoid repetition, it will not be repeated here.

[0104] It should be noted that, in this article, the terms "comprise", "include" or any other variant thereof are intended to cover non-exclusive inclusion, so that the process, method, article or device including a series of elements includes not only those elements, but also includes other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise one..." do not exclude the presence of other identical elements in the process, method, article or device including the element. In addition, it should be pointed out that the scope of the methods and devices in the embodiments of the present application is not limited to performing functions in the order shown or discussed, and may also include performing functions in a substantially simultaneous manner or in reverse order according to the functions involved, for example, the described method may be performed in an order different from that described, and various steps may also be added, omitted, or combined. In addition, the features described with reference to certain examples may be combined in other examples.

[0105] Through the description of the above implementation methods, those skilled in the art can clearly understand that the above-mentioned embodiment methods can be implemented by means of software plus a necessary general hardware platform, and of course by hardware, but in many cases the former is a better implementation method. Based on such an understanding, the technical solution of the present application, or the part that contributes to the prior art, can be embodied in the form of a computer software product, which is stored in a storage medium (such as ROM / RAM, a disk, or an optical disk), and includes a number of instructions for a terminal (which can be a mobile phone, a computer, a server, or a network device, etc.) to execute the methods described in each embodiment of the present application.

[0106] The embodiments of the present application are described above in conjunction with the accompanying drawings, but the present application is not limited to the above-mentioned specific implementation methods. The above-mentioned specific implementation methods are merely illustrative and not restrictive. Under the guidance of the present application, ordinary technicians in this field can also make many forms without departing from the purpose of the present application and the scope of protection of the claims, all of which are within the protection of the present application.

Claims

1. A method for generating information, characterized in that: The method comprises: Receiving a first input from a user, wherein the first input includes first information, and the first information includes a reference text and an output requirement; In a case where the reference text is a confusing sentence and the output requirement indicates generating content of a target type, in response to the first input, performing a security check on the reference text to obtain a check result; In a case where the detection result indicates that the reference text has passed detection, second information that conforms to the target type is generated based on the first information.

2. The method according to claim 1, characterized in that The performing of security detection on the reference text to obtain a detection result includes: Based on the target type, rearrange the characters in the reference text to obtain a rearranged sentence; Performing violation detection on the rearrangement statement to obtain a first detection result; Detecting the emotion type of the reference text to obtain a second detection result; Performing sensitive subject detection on the reference text to obtain a third detection result; A detection result of the safety detection is determined based on the first detection result, the second detection result, and the third detection result.

3. The method according to claim 2, characterized in that The detecting the emotion type of the reference text to obtain a second detection result includes: Input the reference text into a pre-trained emotion type detection model to obtain a second detection result; or, Acquire a sentiment word library, wherein the sentiment word library includes sentiment words of a plurality of target sentiment types; For each word in the sentiment word library, if the reference text includes each character in the word, the word is used as the target word; If the number of the target words is greater than or equal to a threshold, determining that the sentiment type of the reference text is the target sentiment class; If the number of the target words is less than the threshold, it is determined that the sentiment type of the reference text is not the target sentiment type.

4. The method according to claim 2, characterized in that: The performing sensitive subject detection on the reference text to obtain a third detection result includes: Acquire a sensitive subject word library, wherein the sensitive subject word library includes a plurality of sensitive words; If the reference text includes each character in at least one word in the sensitive subject word library, it is determined that the reference text includes a sensitive subject.

5. The method according to claim 2, characterized in that: The determining the detection result of the safety detection based on the first detection result, the second detection result and the third detection result includes: When the second detection result indicates that the emotion type of the reference text is the target emotion type, and the third detection result indicates that the reference text contains a sensitive subject, based on the sensitive subject and the semantic recovery model in the reference text, semantically recover the reference text to obtain a semantically recovered sentence; Detecting whether the semantic recovery statement includes illegal content to obtain a fourth detection result; Based on the first detection result and the fourth detection result, a detection result of the safety detection is determined.

6. The method according to claim 1, characterized in that The first information is information to be input into the large language model, and the output requirement indicates that the large language model generates information of a target type; The generating second information conforming to the target type based on the first information includes: The first information is input into the large language model to obtain second information output by the large language model that meets the target type.

7. The method according to claim 1, characterized in that The method further comprises: When the reference text is a confusing sentence and the output requirement indicates outputting content that is not of the target type, or when the detection result indicates that the security detection has not passed, a prompt message is returned, wherein the prompt message is used to prompt that the first information input by the user is non-compliant.

8. An information generating device, characterized in that: The device comprises: A receiving unit, configured to receive a first input from a user, wherein the first input includes first information, and the first information includes a reference text and an output requirement; A detection unit, configured to, in response to the first input, perform a security detection on the reference text to obtain a detection result when the reference text is a confusing sentence and the output requirement indicates generating content of a target type; A generating unit is used to generate second information that conforms to the target type based on the first information when the detection result indicates that the reference text has passed the detection.

9. An electronic device, characterized in that: It comprises a processor and a memory, wherein the memory stores a program or instruction that can be run on the processor, and when the program or instruction is executed by the processor, the steps of the information generating method according to any one of claims 1 to 7 are implemented.

10. A readable storage medium, characterized in that: The readable storage medium stores a program or instruction, and when the program or instruction is executed by a processor, the steps of the information generating method according to any one of claims 1 to 7 are implemented.

Citation Information

Patent Citations

  • Illegal text recognition method and device based on feature de-interleaving

    CN110704611A

  • Text recognition method and system, computer system and medium

    CN113495949A

  • Content compliance judgment method based on thinking chain reasoning implicit generation

    CN116955539A

  • Illegal content search device and illegal content search method

    JP2018180910A