WO2025016455A1 - 文本处理方法、电子设备以及计算机可读存储介质 - Google Patents
文本处理方法、电子设备以及计算机可读存储介质 Download PDFInfo
- Publication number
- WO2025016455A1 WO2025016455A1 PCT/CN2024/106517 CN2024106517W WO2025016455A1 WO 2025016455 A1 WO2025016455 A1 WO 2025016455A1 CN 2024106517 W CN2024106517 W CN 2024106517W WO 2025016455 A1 WO2025016455 A1 WO 2025016455A1
- Authority
- WO
- WIPO (PCT)
- Prior art keywords
- text
- target
- dialogue
- preset
- matching result
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Pending
Links
Classifications
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/30—Information retrieval; Database structures therefor; File system structures therefor of unstructured textual data
- G06F16/35—Clustering; Classification
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/30—Information retrieval; Database structures therefor; File system structures therefor of unstructured textual data
- G06F16/33—Querying
- G06F16/332—Query formulation
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/30—Information retrieval; Database structures therefor; File system structures therefor of unstructured textual data
- G06F16/33—Querying
- G06F16/332—Query formulation
- G06F16/3329—Natural language query formulation
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F40/00—Handling natural language data
- G06F40/20—Natural language analysis
- G06F40/279—Recognition of textual entities
Definitions
- the present disclosure relates to the fields of large model technology, text recognition technology, content generation technology, and dialogue interaction technology, and in particular, to a text processing method, an electronic device, and a computer-readable storage medium.
- LLMs large-scale pre-trained models
- large-scale model-related products are gradually implemented and the coverage of large-scale model generation capabilities is gradually enhanced, more security risks have arisen in the process of using large models.
- large models for text interaction there will be security risks in the process of text interaction due to risky content in the text.
- the embodiments of the present disclosure provide a text processing method, an electronic device, and a computer-readable storage medium to at least solve the technical problem of security risks in the process of text interaction in the related art.
- a text processing method including: acquiring a first text; identifying the first text to determine whether the first text is a target text, wherein the target text is used to characterize a text with security risks; if the first text is not the target text, generating a second text based on the first text, wherein the second text is used to characterize a reply text corresponding to the first text; and outputting the second text.
- a text processing method including: obtaining a first dialogue text input by the target object during a dialogue between the target object and a virtual object; identifying the first dialogue text to determine whether the first dialogue text is a target text, wherein the target text is used to characterize text with security risks; if the first dialogue text is not the target text, generating a second dialogue text based on the first dialogue text; and outputting the second dialogue text.
- a text processing method including: in response to a text input instruction acting on an operation interface, displaying a first text on the operation interface; when the first text is not a target text, displaying a second text on the operation interface, wherein the second text is a text generated based on the first text when it is identified that the first text is not the target text, and the target text is used to characterize text that presents a security risk.
- a text processing method comprising: obtaining a first text by calling a first interface, wherein the first interface includes a first parameter, and the parameter value of the first parameter is the first text; recognizing the first text to determine whether the first text is a target text, wherein the target text is used to characterize a text with security risks; if the first text is not the target text, generating a second text based on the first text; outputting the second text by calling a second interface, wherein the second interface includes a second parameter, and the parameter value of the second parameter is For the second text.
- an electronic device including: a memory storing an executable program; and a processor for running the program, wherein the program executes any one of the methods in the above embodiments when running.
- a computer-readable storage medium includes a stored executable program, wherein when the executable program is running, the device where the computer-readable storage medium is located is controlled to execute any one of the methods in the above embodiments.
- a first text is obtained; the first text is recognized to determine whether the first text is a target text, wherein the target text is used to characterize a text with security risks; if the first text is not the target text, a second text is generated based on the first text, wherein the second text is used to characterize a reply text corresponding to the first text; and the second text is output, thereby achieving the purpose of improving the security of text interaction. It is easy to notice that, in the process of text interaction, it can be determined whether the first text has a security risk by recognizing the first text.
- the second text can be generated based on the first text, so as to reduce the security risk in the text interaction process, thereby improving the security in the text interaction process, and further solving the technical problem of security risks in the text interaction process in the related art.
- FIG1 is a schematic diagram of a hardware environment of a virtual reality device according to a text processing method according to an embodiment of the present disclosure
- FIG2 is a flow chart of a text processing method according to Embodiment 1 of the present disclosure.
- FIG3 is a flowchart of a text processing process according to an embodiment of the present disclosure.
- FIG4 is a flow chart of a text processing method according to Embodiment 2 of the present disclosure.
- FIG5 is a flow chart of a text processing method according to Embodiment 3 of the present disclosure.
- FIG6 is a flowchart of a text processing method according to Embodiment 4 of the present disclosure.
- FIG7 is a schematic diagram of a text processing device according to Embodiment 5 of the present disclosure.
- FIG8 is a schematic diagram of a text processing device according to Embodiment 6 of the present disclosure.
- FIG9 is a schematic diagram of a text processing device according to Embodiment 7 of the present disclosure.
- FIG10 is a schematic diagram of a text processing device according to Embodiment 8 of the present disclosure.
- FIG. 11 is a structural block diagram of a computer terminal according to an embodiment of the present disclosure.
- the technical solution provided by the present disclosure is mainly implemented by large-scale model technology.
- the large model here refers to a deep learning model with large-scale model parameters, which can usually contain hundreds of millions, tens of billions, hundreds of billions, trillions or even more than 10 trillion model parameters.
- the large model can also be called the foundation model/foundation model.
- the large model is pre-trained with large-scale unlabeled corpus to produce a pre-trained model with more than 100 million parameters.
- This model can adapt to a wide range of downstream tasks and has good generalization ability, such as large-scale language model LLM, multi-modal pre-training model, etc.
- the pre-trained model can be fine-tuned through a small number of samples so that the large model can be applied to different tasks.
- the large model can be widely used in natural language processing (NLP), computer vision and other fields, and can be specifically applied to computer vision tasks such as visual question answering (VQA), image caption (IC), image generation, etc. It can also be widely used in natural language processing tasks such as text-based sentiment classification, text summary generation, and machine translation. Therefore, the main application scenarios of the large model include but are not limited to digital assistants, intelligent robots, search, online education, office software, e-commerce, intelligent design, etc.
- text recognition through a text recognition model in a dialogue interaction scenario is used as an example for explanation.
- a text processing method is provided. It should be noted that the steps shown in the flowchart of the accompanying drawings can be executed in a computer system such as a set of computer executable instructions, and although a logical order is shown in the flowchart, in some cases, the steps shown or described can be executed in an order different from that shown here.
- the embodiment of the present disclosure provides The above-mentioned text processing can be applied to the application scenario shown in Figure 1, but is not limited thereto.
- the large model is deployed in the server 10, and the server 10 can be connected to one or more client devices 20 through a local area network connection, a wide area network connection, an Internet connection, or other types of data networks.
- the client devices 20 here may include but are not limited to: smart phones, tablet computers, laptops, PDAs, personal computers, smart home devices, vehicle-mounted devices, etc.
- the large model is deployed in the server, and the client device 20 interacts with the user through the operation interface to implement the call of the large model, thereby implementing the method provided by the embodiment of the present disclosure.
- the system composed of the client device and the server can perform the following steps: the client device can receive the first text input by the user, and send the first text to the server through the network, the server can identify the first text, determine whether the first text is the target text, and generate a second text based on the first text if the first text is not the target text, thereby returning the second text to the client device through the network, and then the client device can output the second text for the user to view.
- the embodiment of the present disclosure can be performed in the client device when the operating resources of the client device can meet the deployment and operation conditions of the large model.
- Figure 2 is a flow chart of a text processing method according to Embodiment 1 of the present disclosure. The method may include the following steps:
- Step S202 obtaining a first text.
- the first text mentioned above may be a conversation text input by a user in the conversational interaction scenario.
- the first text mentioned above may be a sentence, a keyword, etc. input by a user in the content generation scenario to describe the generated text.
- the first text mentioned above may be a search term input by a user in the data search scenario.
- the above-mentioned first text can be an input text in the user interaction interface. Combined with the interaction interface shown in Figure 1, the first text can be input into the text input box, and the client 20 can transmit the first text in the text input box to the server 10 through the network.
- Step S204 recognize the first text to determine whether the first text is the target text.
- the target text is used to represent the text with security risks.
- the first text can be identified by keyword matching to determine whether there are words, phrases or paragraphs with security risks in the first text. If there are words, phrases or paragraphs with security risks in the first text, the first text is determined to be the target text; the first text can be identified, and if the number of words, phrases or paragraphs with security risks in the first text is greater than a preset security risk threshold, the first text is determined to be the target text. It should be noted that the specific method of determining whether the first text is the target text based on the recognition result of the first text can be set according to the actual situation, and no limitation is made here.
- the large model may be used to recognize the first text to determine whether the first text is the target text.
- the first text is first identified by keyword matching to determine the text that is most likely not to have security risks, and then the text that is most likely not to have security risks is identified using a large model to obtain text that does not have security risks.
- Step S206 if the first text is not the target text, generate a second text based on the first text.
- the second text is used to represent the reply text corresponding to the first text.
- the first text when the first text is not the target text, it means that there is no security risk in the first text, that is, the first text complies with laws and regulations.
- the second text can be generated based on the first text, thereby reducing the security risk in the text interaction process and providing a good text interaction scenario.
- a large model can be used to generate a second text based on the first text, and the second text can be used as a reply text to the first text;
- a data search model can be used to search for search results corresponding to the first text, and a second text for replying to the first text can be generated based on the search results;
- a content generation model can be used to generate a second text based on the first text, and the second text can be used as a result of content generation.
- the first text when the first text is the target text, the first text can be intercepted and the second text is not generated directly, or a preset text can be directly replied, wherein the preset text is used to indicate a rejection of the reply text.
- the specific content of the preset text can be "reject reply text". This is only an example for explanation, and the specific interception and reply method can be flexibly set according to the scenario requirements.
- Step S208 output the second text.
- the second text mentioned above may be an output dialogue text or a search result text in the interactive interface.
- the second text after the second text is generated based on the first text, the second text can be directly output for the user to view.
- the second text in order to avoid the security risk of the generated second text, after the second text is generated based on the first text, the second text can be identified to determine whether the second text is the target text. If the second text is not the target text, the second text is output; if the second text is the target text, the output of the second text is prohibited.
- the second text can be regenerated based on the first text, and if the regenerated second text is not the target text, the regenerated second text is output.
- the above-mentioned second text can be an output text in the user interaction interface.
- the server 10 can identify the first text and determine whether the first text is the target text. If the first text is not the target text, the second text is generated based on the first text, and the second text is transmitted to the client 20 through the network.
- the client 20 can display the second text through the text output box in the user interaction interface.
- the dialogue text entered by the user in the dialogue interface can be obtained, and the dialogue text can be identified to determine whether the dialogue text has security risks.
- a dialogue reply text can be generated based on the dialogue text and displayed on the dialogue interface.
- a virtual object may be included in the dialog box, that is, during the dialogue between the target object and the virtual object, the first dialogue text may be identified to determine whether the first dialogue text is a text with security risks. If the first dialogue text is not a text with security risks, a second dialogue text may be generated based on the first dialogue text and output.
- the virtual object may not be included in the dialog box.
- the dialogue interaction scenario can be applied to a variety of scenarios, such as finance, enterprise, medical care, transportation, etc., which are not limited here.
- the description text entered by the user in the interactive interface can be obtained, the description text can be identified, and it can be determined whether the description text poses a security risk. If the description text does not pose a security risk, content reply text can be generated based on the description text and displayed on the interactive interface.
- the search text entered by the user in the search interface can be obtained, the search text can be identified, and it can be determined whether the search text poses a security risk. If the search text does not pose a security risk, a search can be performed based on the search text to obtain search results, and the search results can be displayed on the search interface.
- the first text can be obtained first, the first text can be identified, and it can be determined whether the first text is a target text with security risks. If the first text is not the target text, a second text can be generated based on the first text, wherein the second text is used to characterize the reply text corresponding to the first text, and the second text is output, thereby achieving the purpose of improving the security of text interaction. It is easy to notice that in the process of text interaction, by identifying the first text, it can be determined whether the first text has a security risk.
- a second text can be generated based on the first text to reduce the security risk in the text interaction process, thereby improving the security in the text interaction process, and further solving the technical problem of security risks in the text interaction process in the related technology.
- the first text is recognized and whether the first text is a target text is determined, including at least one of the following: matching the first text with multiple texts in a preset database to obtain a first matching result; matching the keywords contained in the first text with multiple preset keywords to obtain a second matching result; using a text recognition model to perform category recognition on the first text to obtain a text recognition result, wherein the text recognition result is used to characterize whether the category to which the first text belongs is the category of the target text; based on the first matching result, the second matching result and/or the text recognition result, determining whether the first text is the target text.
- the above-mentioned preset database may be a Frequently Asked Questions database (FAQ for short).
- FAQ Frequently Asked Questions database
- the above-mentioned preset database may also be a self-set database that gathers answers to various risk questions.
- the preset database can be updated according to the hot words, and the Configure and take effect the hot words in the preset database to ensure the security of conversation replies.
- the above-mentioned preset database can be constructed for risk question texts with security risks based on internal R&D testing, actual online feedback, and legal regulations.
- various risk question texts are given audited risk-free response texts.
- the first text can be matched with multiple texts in a preset database to obtain a first matching result, wherein the first matching result is used to indicate whether there is a text in the multiple texts whose similarity with the first text is greater than a first preset value, or the first matching result is set to indicate whether there is a text in the multiple texts that is identical to the first text. If the first matching result is used to indicate that there is a text in the multiple texts whose similarity with the first text is greater than a first preset value or there is a text that is identical to the first text, then the first text is determined to be the target text.
- the preset keywords mentioned above may be pre-set keywords with security risks, relatively sensitive keywords, or inappropriate words set according to different scene requirements.
- the keywords contained in the first text can be matched with multiple preset keywords to obtain a second matching result, wherein the second matching result is used to indicate whether there is text among the multiple preset keywords whose similarity to the keywords contained in the first text is greater than a second preset value, or the second matching result is set to indicate whether there is text among the multiple preset keywords that is identical to the keywords contained in the first text. If the second matching result is used to indicate that there is text among the multiple texts whose similarity to the keywords contained in the first text is greater than the second preset value or there is text that is identical to the keywords, the first text is determined to be the target text.
- the target text category mentioned above may be a text pre-classified according to the properties of the target text.
- the target text category may be more finely differentiated according to the properties of the target text, or the target text may be classified into different categories according to different types of security risks to which the target text belongs.
- the above-mentioned text recognition model may be a risk identification model, wherein the risk identification model predicts multi-label categories based on position encoding technology (RoFormer).
- the text recognition model can be used to identify the category of the first text.
- the text recognition model can be used to identify the probability that the first text belongs to different fine-grained risk categories, wherein different fine-grained risk categories can have their own specified adjustable thresholds. If the probability that the first text belongs to different fine-grained risk categories exceeds the threshold, it means that the category of the first text belongs to a risky category, that is, the text recognition result is used to indicate that the category to which the first text belongs is the category to which the target text belongs.
- the probability that the first text belongs to different fine-grained risk categories is less than the threshold, it means that the category of the first text does not belong to a risky category, that is, the text recognition result is used to indicate that the category to which the first text belongs is not the category to which the target text belongs.
- whether the first text is the target text can be determined based on any one of the first matching result, the second matching result, and the text recognition result. Whether the first text is the target text can also be determined based on any two results. Whether the first text is the target text can also be determined based on all the results.
- corresponding weights may be set for the first matching result, the second matching result, and the text recognition result to ultimately determine whether the first text is the target text.
- the configuration mode can be set according to user needs.
- a first text is matched with multiple texts to obtain a first matching result, including at least one of the following: text matching the first text with multiple texts to obtain a first sub-matching result; regular expression matching the first text with multiple texts to obtain a second sub-matching result; matching the first text with multiple texts using a text matching model to obtain a third sub-matching result; summarizing the first sub-matching result, the second sub-matching result and/or the third sub-matching result to obtain a first matching result.
- the first text may be literally matched with multiple texts to obtain a first sub-matching result.
- the first sub-matching result may be used to indicate the degree of overlap between the texts literally. The higher the degree of overlap, the greater the probability that the first text is the target text.
- the first text may be matched with multiple texts using regular expressions to obtain a second sub-matching result, wherein regular expression matching is a method for describing character strings, and a pattern of a character string may be defined by a combination of specific symbols and characters, and then the pattern may be used to match other character strings. The more characters a character string matches, the greater the probability that the first text is the target text.
- a text matching model may be used to perform similarity matching between the first text and multiple texts. If the similarity between the first text and any text in the multiple texts is greater, the probability that the first text is the target text is greater.
- the first matching result may be determined based on any one of the first sub-matching result, the second sub-matching result and the third sub-matching result, or based on any two results, or based on all results.
- corresponding weights may be set for the first sub-matching result, the second sub-matching result, and the third sub-matching result to finally determine the first matching result. It should be noted that the specific weight setting method may be set according to user needs.
- generating a second text based on a first text includes: generating an initial reply text based on the first text using a large-scale pre-trained model, recognizing the initial reply text, and determining whether the initial reply text is a target text; if the initial reply text is not the target text, determining that the initial reply text is the second text; if the initial reply text is the target text, determining that the preset text is the second text.
- the large-scale pre-trained model mentioned above can be referred to as a large model.
- the large model can have strong command understanding ability and world knowledge reserve, so it can generate high-quality reply text, including further writing capabilities such as writing code, writing tables, and multiple languages, and has the characteristics of interactive dialogue to respond to user needs.
- the above-mentioned preset text may be a pre-set text without security risks.
- the above-mentioned preset text may also be a pre-set text without security risks corresponding to the initial reply text.
- a large-scale pre-trained model can be used to generate an initial response based on the first text.
- the initial reply text can be identified to determine whether the initial reply text is the target text. If the initial reply text is not the target text, it means that the initial text is a second text that does not have security risks. If the initial reply text is the target text, the preset text can be determined as the second text to ensure security during the text interaction process.
- the method of identifying whether the initial reply text is the target text may be the same as the method of identifying whether the first text is the target text, which will not be described in detail here.
- the model parameters of the large-scale pre-training model are adjusted using pre-constructed training texts
- the pre-constructed training texts include: a target text and a generated text corresponding to the target text.
- the above-mentioned target text may be a text with security risks
- the generated text corresponding to the above-mentioned target text may be a reply text without security risks
- the above-mentioned pre-constructed training text can be an artificially constructed target text and a generated text corresponding to the target text; the above-mentioned pre-constructed training text can also be a target text constructed using a large-scale pre-training model and a generated text corresponding to the target text; there is no specific limitation here, and the method of pre-constructing the training text can be determined according to actual needs.
- a small amount of target text can be obtained first, and a large-scale pre-trained model can be used to automatically compose more target texts with similar expressions based on the small amount of target text, so as to achieve the purpose of expanding the target text.
- the large-scale pre-trained model can be used to automatically construct a generated text of the target text.
- an indication that the large-scale pre-trained model cannot produce text with security risks can be added to allow the large-scale pre-trained model to produce response text without security risks as much as possible, that is, the generated text corresponding to the target text, so that the training text can be constructed in advance.
- the pre-constructed training text can be proofread so that the generated text corresponding to the target text in the training text does not pose a security risk, and the model parameters of the large-scale pre-trained model can be fine-tuned based on the proofread training text, so that the large-scale pre-trained model can also generate a response text that does not pose a security risk based on the target text without giving additional instructions.
- the above training text may be harmless training text.
- a harmless training sample fine-tuning model is constructed to improve the security capabilities of large model dialogues. Harmless training samples can be used as supervisory signals to train model parameters in the instruction fine-tuning stage, so that the model directly learns to avoid harmful outputs for risky inputs in training samples by drawing on the harmless response content of training samples.
- a method of self-instruction and context distillation automatic construction + manual verification is adopted, that is, a small number of user risk inputs and harmless response samples are first manually constructed, and then more risky inputs with similar expressions are automatically written through the large model that has been fine-tuned by instructions from the previous version iteration, which are used as expanded training samples.
- the method when the first text is the target text, the method further includes one of the following: obtaining a third text corresponding to the first text from a preset database, and outputting the third text, wherein the third text is used to represent a reply text corresponding to the first text, and the preset database stores preset reply texts corresponding to different target texts; outputting the preset text, wherein the preset text is used to represent the reply text corresponding to the first text.
- the above-mentioned preset database may store target texts and preset reply texts corresponding to the target texts, wherein the preset reply texts may be standard replies to the preset target texts, and the preset reply texts do not contain texts with security risks.
- the reply text corresponding to the first text can be obtained from the preset database, that is, the third text mentioned above, and the third text is output, wherein the third text does not contain text with security risks.
- the above-mentioned preset text can be a pre-set text that does not pose a security risk, for example, a rejection reply text.
- the specific content of the preset text is not limited here and can be set according to actual needs.
- a preset text may be directly output to avoid security risks during the text interaction process.
- obtaining a third text corresponding to a first text from a preset database includes: determining a risk level corresponding to the first text; and obtaining the third text from the preset database when the risk level is greater than the preset level.
- the risk level corresponding to the first text can be determined. If the security risk corresponding to the risk level is relatively small, a second text corresponding to the first text can be directly generated. If the risk level is greater than a preset level, it means that the security risk corresponding to the risk level is relatively large. In this case, a third text can be obtained from a preset database to reduce the security risk in text interaction.
- the method when the first text is the target text, the method further includes: obtaining the risk level corresponding to the first text, or the current number of interceptions, wherein the current number of interceptions is used to indicate the number of times the first text is the target text during the text interaction process; when the risk level is greater than a preset level, or the current number of interceptions is greater than a preset number, stopping the text interaction process.
- the above preset times and preset levels can be set according to actual scene requirements.
- the risk level or the current interception number corresponding to the first text can be obtained. If the risk level is greater than the preset level, or the current interception number is greater than the preset number, it means that the security risk of the text interaction process is relatively large. In order to avoid security problems, the text interaction process can be terminated. The process of text interaction may be manifested as no response after the first text is input again, or a text "interaction terminated" may be replied. There is no specific limitation here and it can be set according to actual conditions.
- the method after generating the second text based on the first text, the method also includes: identifying the second text to determine whether the second text is the target text; if the second text is the target text, obtaining the current number of interceptions; if the current number of interceptions is greater than the preset number, stopping the text interaction process.
- the risk level corresponding to the second text, or the current number of interceptions can be obtained. If the risk level is greater than the preset level, or the current number of interceptions is greater than the preset number, it means that the security risk of the text interaction process is relatively large. In order to avoid security issues, the text interaction process can be terminated, which can be manifested as no response to the first text this time, or a text of "interaction terminated" can be replied. No specific limitation is made here, and it can be set according to actual conditions.
- FIG3 is a flowchart of a text processing process according to an embodiment of the present disclosure. As shown in FIG3 , the method includes:
- Step S300 the user inputs a first text
- Step S301 determining whether the first text hits the target text, if so, executing step S302, if not, executing step S304;
- Step S302 obtaining a third text corresponding to the first text from a preset database, and outputting the third text. If the risk level corresponding to the first text is greater than the preset level, executing step S303;
- the above-mentioned risk level can be used to represent the size of the security risk of the first text.
- it can be expressed as the number of keywords with security risks existing in the first text and/or the risk level of the keywords. This is only an example.
- the size of the security risk of the first text can also be determined based on other characteristics of the keywords with security risks existing in the first text.
- the security risk of the first text is greater, it means that the risk level corresponding to the first text is greater; if the security risk of the first text is smaller, it means that the risk level corresponding to the first text is smaller.
- Step S303 terminating the conversation
- Step S304 determining the risk level corresponding to the first text, and judging whether the risk level of the first text is greater than a preset level, if the risk level is greater than the preset level, executing step S305, if the risk level is less than the preset level, executing step S306;
- Step S305 output the preset text and obtain the current interception number of the conversation. If the current interception number is greater than the preset number, execute step S303;
- Step S306 generating a second text corresponding to the first text using a large-scale pre-trained model, and outputting the second text;
- Step S307 using the large-scale pre-trained model to perform a streaming reply on the first text, if the streaming reply is recognized as the target text, executing step S308, if the streaming reply is not recognized as the target text, executing step S309;
- Step S308 Output the preset text and obtain the current interception times of the conversation. If the current interception times is greater than After a preset number of times, execute step S303;
- Step S309 This round of interaction is normal and the reply ends.
- the disclosure can enhance the training of large models with harmless samples, online risk identification modules, online answer intervention modules, and other methods.
- certain intervention mechanisms are added to both user input and model output, and it has certain semantic generalization, which greatly improves the conversation security of large model services.
- the real-time and generalization of conversation security intervention are improved as much as possible to ensure that no major conversation security risk issues occur in the service process of the large model.
- user information including but not limited to user device information, user personal information, etc.
- data including but not limited to data used for analysis, stored data, displayed data, etc.
- user information including but not limited to user device information, user personal information, etc.
- data including but not limited to data used for analysis, stored data, displayed data, etc.
- the method according to the above embodiment can be implemented by means of software plus a necessary general hardware platform, and of course, it can also be implemented by hardware.
- the technical solution of the present disclosure, or the part that contributes to the prior art can be embodied in the form of a 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 device (which can be a mobile phone, a computer, a server, or a network device, etc.) to execute the methods of each embodiment of the present disclosure.
- a storage medium such as ROM/RAM, a disk, or an optical disk
- a terminal device which can be a mobile phone, a computer, a server, or a network device, etc.
- a text processing method is also provided. It should be noted that the steps shown in the flowchart of the accompanying drawings can be executed in a computer system such as a set of computer executable instructions, and although a logical order is shown in the flowchart, in some cases, the steps shown or described can be executed in an order different from that shown here.
- FIG4 is a flow chart of a text processing method according to Embodiment 2 of the present disclosure. As shown in FIG4 , the method includes the following steps:
- Step S402 during the dialogue between the target object and the virtual object, a first dialogue text input by the target object is obtained.
- the target object mentioned above may be a user.
- the virtual object mentioned above may be a model.
- the first dialogue text mentioned above may be a dialogue text input by the target object into the interactive interface, wherein the interactive interface
- the surface can be an interface for the target object to interact with the virtual object.
- Step S404 recognize the first dialogue text to determine whether the first dialogue text is the target text.
- the target text is used to represent the text with security risks.
- the first dialogue text may be identified to determine whether the first dialogue text is the target text. If the first dialogue text is the target text, it indicates that the first dialogue text has a security risk.
- Step S406 if the first dialogue text is not the target text, generate a second dialogue text based on the first dialogue text.
- Step S408 output the second dialogue text.
- first dialogue text when the first dialogue text is not the target text, it indicates that the security of the dialogue process is relatively high, and a second dialogue text can be generated based on the first dialogue text, and the second dialogue text can be output in the interactive interface so that the user can view it.
- the first dialogue text input by the target object is obtained; the first dialogue text is identified to determine whether the first dialogue text is the target text, wherein the target text is used to characterize the text with security risks; when the first dialogue text is not the target text, a second dialogue text is generated based on the first dialogue text; and the second dialogue text is output, thereby achieving the purpose of improving the security of dialogue text interaction. It is easy to notice that during the text interaction process, by identifying the first dialogue text, it can be determined whether the first dialogue text has a security risk.
- the second dialogue text can be generated based on the first dialogue text, so as to reduce the security risk in the text interaction process, thereby improving the security in the text interaction process, and further solving the technical problem of security risks in the text interaction process in the related art.
- the method when the first dialogue text is the target text, the method further includes: obtaining the risk level corresponding to the first dialogue text, or the current number of interceptions, wherein the current number of interceptions is used to characterize the number of times the first dialogue text is identified as the target text during the dialogue between the target object and the virtual object; when the risk level is greater than the preset level, or the current number of interceptions is greater than the preset number, stopping the dialogue process between the target object and the virtual object.
- the risk level corresponding to the first dialogue text, or the current number of interceptions can be obtained. If the risk level is greater than the preset level, or the current number of interceptions is greater than the preset number, it means that the security risk of the dialogue process is relatively large. In order to avoid security issues, the dialogue process between the target object and the virtual object can be terminated, which can be manifested as no response after the first dialogue text is input again, and the text of "dialogue terminated" can be replied. There is no specific limitation here, and it can be set according to actual conditions.
- the method further includes: identifying the second dialogue text to determine whether the second dialogue text is the target text; if the second dialogue text is the target text, obtaining the current interception number; if the current interception number is greater than the preset number, Stop the conversation process between the target object and the virtual object.
- the risk level corresponding to the second dialogue text, or the current number of interceptions can be obtained. If the risk level is greater than the preset level, or the current number of interceptions is greater than the preset number, it means that the security risk of the dialogue process is relatively large. In order to avoid security issues, the dialogue process between the target object and the virtual object can be terminated, which can be manifested as no response to the first dialogue text this time, and a text of "dialogue terminated" can be replied. There is no specific limitation here, and it can be set according to actual conditions.
- a text processing method is also provided. It should be noted that the steps shown in the flowchart of the accompanying drawings can be executed in a computer system such as a set of computer executable instructions, and although a logical order is shown in the flowchart, in some cases, the steps shown or described can be executed in an order different from that shown here.
- FIG5 is a flow chart of a text processing method according to Embodiment 3 of the present disclosure. As shown in FIG5 , the method includes the following steps:
- Step S502 In response to a text input instruction on the operation interface, a first text is displayed on the operation interface.
- the above-mentioned operation interface may be an interface for users to perform touch operations.
- the above-mentioned text input instruction may be an instruction generated by a user inputting a first text on an operation interface.
- the first text in response to a text input instruction applied to the operation interface, may be displayed in a text input box on the operation interface for the user to input text.
- Step S504 when the first text is not the target text, display the second text on the operation interface.
- the second text is a text generated based on the first text when it is identified that the first text is not the target text, and the target text is used to represent the text with security risks.
- the second text when the first text is not the target text, the second text may be displayed in a text display box on the operation interface.
- the first text is displayed on the operation interface; when the first text is not the target text, the second text is displayed on the operation interface, wherein the second text is a text generated based on the first text when it is identified that the first text is not the target text, and the target text is used to characterize the text with security risks, thereby achieving the purpose of improving the security of text interaction. It is easy to notice that in the process of text interaction, it can be determined whether the first text has a security risk by identifying the first text.
- the second text can be generated based on the first text to reduce the security risk in the text interaction process, thereby improving the security in the text interaction process, and further solving the technical problem of security risks in the text interaction process in the related technology.
- a text processing method is also provided. It should be noted that the steps shown in the flowchart of the accompanying drawings can be executed in a computer system such as a set of computer executable instructions, and although a logical order is shown in the flowchart, in some cases, the steps shown or described can be executed in an order different from that shown here.
- FIG6 is a flow chart of a text processing method according to Embodiment 4 of the present disclosure. As shown in FIG6 , the method includes the following steps:
- Step S602 Acquire the first text by calling the first interface.
- the first interface includes a first parameter, and a parameter value of the first parameter is a first text.
- the above-mentioned first interface can be an interface for data interaction between the server and the client.
- the client can pass the first text into the interface function as the first parameter of the interface function to achieve the purpose of uploading the first text to the cloud server.
- Step S604 recognize the first text to determine whether the first text is the target text.
- the target text is used to represent the text with security risks.
- Step S606 if the first text is not the target text, generate a second text based on the first text.
- Step S608 output the second text by calling the second interface.
- the second interface includes a second parameter, and the parameter value of the second parameter is a second text.
- the above-mentioned second interface can be an interface for data exchange between the cloud server and the client.
- the cloud server can pass the second text into the interface function as the second parameter of the interface function to achieve the purpose of sending the second text to the client.
- the first text is obtained by calling the first interface, wherein the first interface includes a first parameter, and the parameter value of the first parameter is the first text; the first text is identified to determine whether the first text is a target text, wherein the target text is used to characterize a text with security risks; when the first text is not the target text, a second text is generated based on the first text; and the second text is output by calling the second interface, wherein the second interface includes a second parameter, and the parameter value of the second parameter is the second text, thereby achieving the purpose of improving the security of text interaction. It is easy to notice that in the process of text interaction, by identifying the first text, it can be determined whether the first text has a security risk.
- the second text can be generated based on the first text, so as to reduce the security risk in the text interaction process, thereby improving the security in the text interaction process, and further solving the technical problem of security risks in the text interaction process in the related technology.
- FIG7 is a schematic diagram of a text processing device according to Embodiment 5 of the present disclosure.
- the device 700 includes: an acquisition module 702 , a recognition module 704 , a generation module 706 , and an output module 708 .
- the acquisition module is configured to acquire a first text
- the recognition module is configured to recognize the first text and determine whether the first text is a target text, wherein the target text is used to characterize a text with security risks
- the generation module is configured to generate a second text based on the first text when the first text is not the target text, wherein the second text is used to characterize a reply text corresponding to the first text
- the output module is configured to output the second text.
- the acquisition module 702, the identification module 704, the generation module 706, and the output module 708 correspond to steps S202 to S208 in Example 1, and the four modules and the corresponding steps implement the same examples and application scenarios, but are not limited to the contents disclosed in the above-mentioned Example 1.
- the above-mentioned modules or units may be hardware components or software components stored in a memory (e.g., memory 104) and processed by one or more processors (e.g., processors 102a, 102b, ..., 102n), and the above-mentioned modules may also be part of the device and may be run in the computer terminal 10 provided in Example 1.
- the recognition module is configured to match the first text with multiple texts in a preset database to obtain a first matching result; the recognition module is configured to match the keywords contained in the first text with multiple preset keywords to obtain a second matching result; the recognition module is configured to use a text recognition model to perform category recognition on the first text to obtain a text recognition result, wherein the text recognition result is used to characterize whether the category to which the first text belongs is the category of the target text; the recognition module is configured to determine whether the first text is the target text based on the first matching result, the second matching result and/or the text recognition result.
- the recognition module is configured to perform text matching on the first text with multiple texts to obtain a first sub-matching result; the recognition module is configured to perform regular expression matching on the first text with multiple texts to obtain a second sub-matching result; the recognition module is configured to use a text matching model to match the first text with multiple texts to obtain a third sub-matching result; the recognition module is configured to summarize the first sub-matching result, the second sub-matching result and/or the third sub-matching result to obtain a first matching result.
- the generation module is configured to generate an initial reply text based on the first text using a large-scale pre-trained model; the generation module is configured to recognize the initial reply text and determine whether the initial reply text is a target text; the generation module is configured to determine that the initial reply text is a second text when the initial reply text is not the target text; the generation module is configured to determine that the preset text is the second text when the initial reply text is the target text.
- the generation module is set to a model parameter of a large-scale pre-training model which is adjusted using a pre-constructed training text, and the pre-constructed training text includes: a target text and a generated text corresponding to the target text.
- the generation module is configured as follows: in the above embodiment of the present disclosure, the output module is configured to obtain a third text corresponding to the first text from a preset database and output the third text, wherein the third text is used to represent the reply text corresponding to the first text, and the preset database stores preset reply texts corresponding to different target texts; the output module is configured to The preset text is set to output, wherein the preset text is used to represent the reply text corresponding to the first text.
- the device further includes: a determination module.
- the determination module is configured to determine the risk level corresponding to the first text; and the acquisition module is configured to acquire the third text from a preset database when the risk level is greater than a preset level.
- FIG. 8 is a schematic diagram of a text processing device according to embodiment 6 of the present disclosure.
- the device 800 includes: an acquisition module 802, an identification module 804, a generation module 806, and an output module 808.
- the acquisition module is configured to acquire a first dialogue text input by the target object during a dialogue between the target object and the virtual object;
- the recognition module is configured to recognize the first dialogue text and determine whether the first dialogue text is a target text, wherein the target text is used to characterize text with security risks;
- the generation module is configured to generate a second dialogue text based on the first dialogue text when the first dialogue text is not the target text; and the output module is configured to output the second dialogue text.
- the acquisition module 802, the identification module 804, the generation module 806, and the output module 808 correspond to steps S402 to S408 in Example 2, and the four modules and the corresponding steps implement the same examples and application scenarios, but are not limited to the contents disclosed in the above-mentioned Example 1.
- the above-mentioned modules or units may be hardware components or software components stored in a memory (e.g., memory 104) and processed by one or more processors (e.g., processors 102a, 102b, ..., 102n), and the above-mentioned modules may also be part of the device and may be run in the computer terminal 10 provided in Example 1.
- the device further includes: a stop module.
- the acquisition module is configured to obtain the risk level corresponding to the first dialogue text, or the current number of interceptions, wherein the current number of interceptions is used to characterize the number of times the first dialogue text is identified as the target text during the dialogue between the target object and the virtual object;
- the stop module is configured to stop the dialogue process between the target object and the virtual object when the risk level is greater than the preset level, or the current number of interceptions is greater than the preset number.
- the recognition module is configured to recognize the second dialogue text and determine whether the second dialogue text is the target text;
- the acquisition module is configured to acquire the current number of interceptions when the second dialogue text is the target text;
- the stop module is configured to stop the dialogue process between the target object and the virtual object when the current number of interceptions is greater than a preset number.
- Figure 9 is a schematic diagram of a text processing device according to embodiment 7 of the present disclosure. As shown in Figure 9, the device 900 includes: a first display module 902 and a second display module 904.
- the first display module is configured to respond to a text input instruction acting on the operation interface and display a first text on the operation interface;
- the second display module is configured to display a second text on the operation interface when the first text is not a target text, wherein the second text is a text generated based on the first text when it is identified that the first text is not the target text, and the target text is used to characterize text that poses a security risk.
- first display module 902 and the second display module 904 correspond to step S502 to step S502 in embodiment 3; the examples and application scenarios implemented by the two modules and the corresponding steps are the same, but are not limited to the contents disclosed in the above embodiment 1.
- the above modules or units can be hardware components or software components stored in a memory (e.g., memory 104) and processed by one or more processors (e.g., processors 102a, 102b, ..., 102n), and the above modules can also be part of the device and can be run in the computer terminal 10 provided in embodiment 1.
- FIG. 10 is a schematic diagram of a text processing device according to embodiment 8 of the present disclosure.
- the device 1000 includes: an acquisition module 1002, a recognition module 1004, a generation module 1006, and an output module 1008.
- the acquisition module is configured to acquire the first text by calling the first interface, wherein the first interface includes a first parameter, and the parameter value of the first parameter is the first text;
- the recognition module is configured to recognize the first text and determine whether the first text is a target text, wherein the target text is used to characterize the text with security risks;
- the generation module is configured to generate a second text based on the first text when the first text is not the target text;
- the output module is configured to output the second text by calling the second interface, wherein the second interface includes a second parameter, and the parameter value of the second parameter is the second text.
- the acquisition module 1002, identification module 1004, generation module 1006, and output module 1008 described above correspond to steps S602 to S608 in Embodiment 4; the four modules and the corresponding steps implement the same examples and application scenarios, but are not limited to the contents disclosed in Embodiment 1 described above.
- the modules or units described above may be hardware components or software components stored in a memory (e.g., memory 104) and processed by one or more processors (e.g., processors 102a, 102b, ..., 102n), and the modules described above may also be run as part of a device in the computer terminal 10 provided in Embodiment 1.
- the embodiment of the present disclosure may provide a computer terminal, which may be any computer terminal device in a computer terminal group.
- the computer terminal may also be replaced by a terminal device such as a mobile terminal.
- the computer terminal may be located in at least one network device among a plurality of network devices of the computer network.
- the above-mentioned computer terminal can execute the program code of the following steps in the text processing method: obtaining a first text; identifying the first text to determine whether the first text is a target text, wherein the target text is used to characterize a text with security risks; if the first text is not the target text, generating a second text based on the first text, wherein the second text is used to characterize a reply text corresponding to the first text; and outputting the second text.
- Figure 11 is a block diagram of a computer terminal according to an embodiment of the present disclosure.
- the computer terminal A may include: one or more (only one is shown in the figure) processors 102, a memory 104, a storage controller, and a peripheral interface, wherein the peripheral interface is connected to a radio frequency module, an audio module, and a display.
- the memory can be used to store software programs and modules, such as program instructions/modules corresponding to the text processing method and device in the embodiment of the present disclosure.
- the processor executes various functional applications and data processing by running the software programs and modules stored in the memory, that is, realizing the above-mentioned text processing method.
- the memory may include a high-speed random access memory, and may also include a non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory.
- the memory may further include a memory remotely arranged relative to the processor, and these remote memories can be connected to the terminal A via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.
- the processor can call the information and application stored in the memory through the transmission device to perform the following steps: obtain a first text; identify the first text to determine whether the first text is a target text, wherein the target text is used to represent a text with security risks; if the first text is not the target text, generate a second text based on the first text, wherein the second text is used to represent a reply text corresponding to the first text; and output the second text.
- the processor may also execute program codes of the following steps: matching the first text with multiple texts in a preset database to obtain a first matching result; matching the keywords contained in the first text with multiple preset keywords to obtain a second matching result; performing category recognition on the first text using a text recognition model to obtain a text recognition result, wherein the text recognition result is used to characterize whether the category to which the first text belongs is the category of the target text; determining whether the first text is the target text based on the first matching result, the second matching result and/or the text recognition result.
- the processor may also execute the following steps of program code: text matching the first text with multiple texts to obtain a first sub-matching result; regular expression matching the first text with multiple texts to obtain a second sub-matching result; matching the first text with multiple texts using a text matching model to obtain a third sub-matching result; summarizing the first sub-matching result, the second sub-matching result and/or the third sub-matching result to obtain The first matching result.
- the processor may also execute the program code of the following steps: using a large-scale pre-trained model to generate an initial reply text based on the first text, identifying the initial reply text, and determining whether the initial reply text is a target text; if the initial reply text is not the target text, determining that the initial reply text is a second text; if the initial reply text is the target text, determining that the preset text is the second text.
- the processor may also execute program code of the following steps: model parameters of the large-scale pre-training model are adjusted using pre-constructed training texts, and the pre-constructed training texts include: target texts and generated texts corresponding to the target texts.
- the processor may also execute the program code of the following steps: obtaining a third text corresponding to the first text from a preset database, and outputting the third text, wherein the third text is used to represent the reply text corresponding to the first text, and the preset database stores preset reply texts corresponding to different target texts; outputting the preset text, wherein the preset text is used to represent the reply text corresponding to the first text.
- the processor may also execute program code of the following steps: determining a risk level corresponding to the first text; and obtaining a third text from a preset database when the risk level is greater than a preset level.
- the processor can call the information and application stored in the memory through the transmission device to perform the following steps: during the conversation between the target object and the virtual object, obtain the first dialogue text input by the target object; identify the first dialogue text to determine whether the first dialogue text is the target text, wherein the target text is used to characterize the text with security risks; if the first dialogue text is not the target text, generate a second dialogue text based on the first dialogue text; and output the second dialogue text.
- the processor may also execute the program code of the following steps: obtaining the risk level corresponding to the first dialogue text, or the current number of interceptions, wherein the current number of interceptions is used to characterize the number of times the first dialogue text is identified as the target text during the dialogue between the target object and the virtual object; when the risk level is greater than a preset level, or the current number of interceptions is greater than a preset number, stopping the dialogue process between the target object and the virtual object.
- the processor may also execute the program code of the following steps: identifying the second dialogue text to determine whether the second dialogue text is the target text; if the second dialogue text is the target text, obtaining the current number of interceptions; if the current number of interceptions is greater than a preset number, stopping the dialogue process between the target object and the virtual object.
- the processor can call the information and application stored in the memory through the transmission device to perform the following steps: in response to the text input instruction acting on the operation interface, display the first text on the operation interface; when the first text is not the target text, display the second text on the operation interface, wherein the second text is a text generated based on the first text when it is identified that the first text is not the target text, and the target text is used to characterize the text with security risks.
- the processor can call the information and application program stored in the memory through the transmission device to perform the following steps: obtain the first text by calling the first interface, wherein the first interface includes a first parameter, a parameter value of the first parameter
- the invention relates to a first text; identifying the first text to determine whether the first text is a target text, wherein the target text is used to characterize a text with a security risk; generating a second text based on the first text when the first text is not the target text; and outputting the second text by calling a second interface, wherein the second interface includes a second parameter, and a parameter value of the second parameter is the second text.
- a first text is obtained; the first text is recognized to determine whether the first text is a target text, wherein the target text is used to characterize a text with security risks; if the first text is not the target text, a second text is generated based on the first text, wherein the second text is used to characterize a reply text corresponding to the first text; and the second text is output, thereby achieving the purpose of improving the security of text interaction. It is easy to notice that, in the process of text interaction, by recognizing the first text, it can be determined whether the first text has a security risk.
- the second text can be generated based on the first text, so as to reduce the security risk in the text interaction process, thereby improving the security in the text interaction process, and further solving the technical problem of security risks in the text interaction process in the related art.
- the structure shown in FIG. 11 is for illustration only, and the computer terminal may also be a smart phone (such as an Android phone, an iOS phone, etc.), a tablet computer, a PDA, a mobile Internet device (MID), a PAD, and other terminal devices.
- FIG. 11 does not limit the structure of the above-mentioned electronic device.
- the computer terminal A may also include more or fewer components (such as a network interface, a display device, etc.) than those shown in FIG. 11, or have a configuration different from that shown in FIG. 11.
- a person of ordinary skill in the art may understand that all or part of the steps in the various methods of the above embodiments may be completed by instructing the hardware related to the terminal device through a program, and the program may be stored in a computer-readable storage medium, and the storage medium may include: a flash drive, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk, etc.
- the embodiment of the present disclosure further provides a storage medium.
- the storage medium can be used to store the program code executed by the text processing method provided in the first embodiment.
- the above storage medium may be located in any computer terminal in a computer terminal group in a computer network, or in any mobile terminal in a mobile terminal group.
- the storage medium is configured to store program code for executing the following steps: obtaining a first text; identifying the first text to determine whether the first text is a target text, wherein the target text is used to characterize a text that presents a security risk; if the first text is not the target text, generating a second text based on the first text, wherein the second text is used to characterize a reply text corresponding to the first text; and outputting the second text.
- the storage medium is further configured to store program codes for executing the following steps: matching the first text with a plurality of texts in a preset database to obtain a first matching result; matching the keywords contained in the first text with a plurality of preset keywords to obtain a second matching result; and performing category recognition on the first text using a text recognition model to obtain a text recognition result, wherein the text recognition result is used to characterize the category to which the first text belongs. Whether it is the category of the target text; based on the first matching result, the second matching result and/or the text recognition result, determining whether the first text is the target text.
- the storage medium is also configured to store program codes for executing the following steps: text matching the first text with multiple texts to obtain a first sub-matching result; regular expression matching the first text with multiple texts to obtain a second sub-matching result; matching the first text with multiple texts using a text matching model to obtain a third sub-matching result; and summarizing the first sub-matching result, the second sub-matching result and/or the third sub-matching result to obtain a first matching result.
- the storage medium is also configured to store program code for executing the following steps: using a large-scale pre-trained model to generate an initial reply text based on the first text, identifying the initial reply text, and determining whether the initial reply text is a target text; if the initial reply text is not the target text, determining that the initial reply text is a second text; if the initial reply text is the target text, determining that the preset text is the second text.
- the storage medium is also configured to store program codes for executing the following steps: the model parameters of the large-scale pre-training model are adjusted using pre-constructed training texts, and the pre-constructed training texts include: target texts and generated texts corresponding to the target texts.
- the storage medium is also configured to store program codes for executing the following steps: obtaining a third text corresponding to the first text from a preset database, and outputting the third text, wherein the third text is used to represent a reply text corresponding to the first text, and the preset database stores preset reply texts corresponding to different target texts; outputting the preset text, wherein the preset text is used to represent the reply text corresponding to the first text.
- the storage medium is further configured to store program codes for executing the following steps: determining a risk level corresponding to the first text; and obtaining a third text from a preset database when the risk level is greater than a preset level.
- the storage medium is configured to store program code for executing the following steps: obtaining a first dialogue text input by the target object during a conversation between the target object and the virtual object; identifying the first dialogue text to determine whether the first dialogue text is a target text, wherein the target text is used to characterize text that presents security risks; if the first dialogue text is not the target text, generating a second dialogue text based on the first dialogue text; and outputting the second dialogue text.
- the storage medium is also configured to store program codes for executing the following steps: obtaining a risk level corresponding to the first dialogue text, or a current number of interceptions, wherein the current number of interceptions is used to characterize the number of times the first dialogue text is identified as the target text during a dialogue between the target object and the virtual object; when the risk level is greater than a preset level, or the current number of interceptions is greater than a preset number, stopping the dialogue process between the target object and the virtual object.
- the storage medium is further configured to store program codes for executing the following steps: identifying the second dialogue text to determine whether the second dialogue text is the target text; if the second dialogue text is the target text, obtaining the current interception number; if the current interception number is greater than a preset number, stopping the target object The process of dialogue with virtual objects.
- the storage medium is configured to store program code for executing the following steps: in response to a text input instruction acting on an operation interface, displaying a first text on the operation interface; when the first text is not a target text, displaying a second text on the operation interface, wherein the second text is a text generated based on the first text when it is identified that the first text is not the target text, and the target text is used to characterize text that presents a security risk.
- the storage medium is configured to store program code for executing the following steps: obtaining a first text by calling a first interface, wherein the first interface includes a first parameter, and a parameter value of the first parameter is the first text; identifying the first text to determine whether the first text is a target text, wherein the target text is used to characterize a text that presents a security risk; if the first text is not the target text, generating a second text based on the first text; and outputting the second text by calling a second interface, wherein the second interface includes a second parameter, and a parameter value of the second parameter is the second text.
- a first text is obtained; the first text is recognized to determine whether the first text is a target text, wherein the target text is used to characterize a text with security risks; if the first text is not the target text, a second text is generated based on the first text, wherein the second text is used to characterize a reply text corresponding to the first text; and the second text is output, thereby achieving the purpose of improving the security of text interaction. It is easy to notice that, in the process of text interaction, by recognizing the first text, it can be determined whether the first text has a security risk.
- the second text can be generated based on the first text, so as to reduce the security risk in the text interaction process, thereby improving the security in the text interaction process, and further solving the technical problem of security risks in the text interaction process in the related art.
- the disclosed technical content can be implemented in other ways.
- the device embodiments described above are only schematic.
- the division of the units is only a logical function division.
- multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed.
- Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of units or modules, which can be electrical or other forms.
- the units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
- each functional unit in each embodiment of the present disclosure may be integrated into one processing unit, or Each unit may exist physically separately, or two or more units may be integrated into one unit.
- the above integrated unit may be implemented in the form of hardware or in the form of software functional units.
- the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium.
- the computer software product is stored in a storage medium, including several instructions for a computer device (which can be a personal computer, server or network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present disclosure.
- the aforementioned storage medium includes: U disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), mobile hard disk, magnetic disk or optical disk and other media that can store program codes.
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Computational Linguistics (AREA)
- Mathematical Physics (AREA)
- Data Mining & Analysis (AREA)
- Databases & Information Systems (AREA)
- Artificial Intelligence (AREA)
- Audiology, Speech & Language Pathology (AREA)
- General Health & Medical Sciences (AREA)
- Health & Medical Sciences (AREA)
- Human Computer Interaction (AREA)
- Machine Translation (AREA)
Abstract
一种文本处理方法、电子设备以及计算机可读存储介质,涉及大模型技术、文本识别技术、内容生成技术、对话交互技术领域。方法包括:获取第一文本;对第一文本进行识别,确定第一文本是否为目标文本,其中,目标文本用于表征存在安全风险的文本;在第一文本不是目标文本的情况下,基于第一文本生成第二文本,其中,第二文本用于表征第一文本对应的回复文本;输出第二文本。
Description
本公开涉及大模型技术、文本识别技术、内容生成技术、对话交互技术领域,具体而言,涉及一种文本处理方法、电子设备以及计算机可读存储介质。
目前,大规模预训练模型(Large Scale Pre trained Model,简称为LLM),也即大模型,具有根据用户指令生成正确且多样化回复的能力,在内容生成场景下呈现了重要的价值。但是随着大模型相关产品逐渐落地且大模型生成能力的覆盖面逐渐增强,使用大模型的过程中滋生了较多的安全风险,在利用大模型进行文本交互时,会由于文本内容存在风险内容导致文本交互的过程中存在安全风险。
针对上述的问题,目前尚未提出有效的解决方案。
发明内容
本公开实施例提供了一种文本处理方法、电子设备以及计算机可读存储介质,以至少解决相关技术中文本交互的过程中存在安全风险的技术问题。
根据本公开实施例的一个方面,提供了一种文本处理方法,包括:获取第一文本;对第一文本进行识别,确定第一文本是否为目标文本,其中,目标文本用于表征存在安全风险的文本;在第一文本不是目标文本的情况下,基于第一文本生成第二文本,其中,第二文本用于表征第一文本对应的回复文本;输出第二文本。
根据本公开实施例的一个方面,提供了一种文本处理方法,包括:在目标对象与虚拟对象进行对话的过程中,获取目标对象输入的第一对话文本;对第一对话文本进行识别,确定第一对话文本是否为目标文本,其中,目标文本用于表征存在安全风险的文本;在第一对话文本不是目标文本的情况下,基于第一对话文本生成第二对话文本;输出第二对话文本。
根据本公开实施例的一个方面,提供了一种文本处理方法,包括:响应作用于操作界面上的文本输入指令,在操作界面上显示第一文本;在第一文本不是目标文本的情况下,在操作界面上显示第二文本,其中,第二文本是在识别出第一文本不是目标文本的情况下,基于第一文本生成的文本,目标文本用于表征存在安全风险的文本。
根据本公开实施例的一个方面,提供了一种文本处理方法,包括:通过调用第一接口获取第一文本,其中,第一接口包括第一参数,第一参数的参数值为第一文本;对第一文本进行识别,确定第一文本是否为目标文本,其中,目标文本用于表征存在安全风险的文本;在第一文本不是目标文本的情况下,基于第一文本生成第二文本;通过调用第二接口输出第二文本,其中,第二接口包括第二参数,第二参数的参数值
为第二文本。
根据本公开实施例的一个方面,提供了一种电子设备,包括:存储器,存储有可执行程序;处理器,用于运行程序,其中,程序运行时执行上述实施例中任意一项的方法。
根据本公开实施例的一个方面,提供了一种计算机可读存储介质,计算机可读存储介质包括存储的可执行程序,其中,在可执行程序运行时控制计算机可读存储介质所在设备执行上述实施例中任意一项的方法。
在本公开实施例中,获取第一文本;对第一文本进行识别,确定第一文本是否为目标文本,其中,目标文本用于表征存在安全风险的文本;在第一文本不是目标文本的情况下,基于第一文本生成第二文本,其中,第二文本用于表征第一文本对应的回复文本;输出第二文本,实现了提高文本交互的安全性的目的,容易注意到的是,在文本交互的过程中,通过对第一文本识别可以确定第一文本是否存在安全风险,在第一文本不存在安全风险的情况下,可以基于第一文本生成第二文本,以便降低文本交互过程中的安全风险,从而提高了文本交互过程中的安全性,进而解决了相关技术中文本交互的过程中存在安全风险的技术问题。
容易注意到的是,上面的通用描述和后面的详细描述仅仅是为了对本公开进行举例和解释,并不构成对本公开的限定。
此处所说明的附图用来提供对本公开的进一步理解,构成本公开的一部分,本公开的示意性实施例及其说明用于解释本公开,并不构成对本公开的不当限定。在附图中:
图1是根据本公开实施例的一种文本处理方法的虚拟现实设备的硬件环境的示意图;
图2是根据本公开实施例1的文本处理方法的流程图;
图3是根据本公开实施例的一种文本处理过程的流程图;
图4是根据本公开实施例2的一种文本处理方法的流程图;
图5是根据本公开实施例3的一种文本处理方法的流程图;
图6是根据本公开实施例4的一种文本处理方法的流程图;
图7是根据本公开实施例5的一种文本处理装置的示意图;
图8是根据本公开实施例6的一种文本处理装置的示意图;
图9是根据本公开实施例7的一种文本处理装置的示意图;
图10是根据本公开实施例8的一种文本处理装置的示意图;
图11是根据本公开实施例的一种计算机终端的结构框图。
为了使本技术领域的人员更好地理解本公开方案,下面将结合本公开实施例中的附图,对本公开实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例仅仅是本公开一部分的实施例,而不是全部的实施例。基于本公开中的实施例,本领域普通技术人员在没有做出创造性劳动前提下所获得的所有其他实施例,都应当属于本公开保护的范围。
需要说明的是,本公开的说明书和权利要求书及上述附图中的术语“第一”、“第二”等是用于区别类似的对象,而不必用于描述特定的顺序或先后次序。应该理解这样使用的数据在适当情况下可以互换,以便这里描述的本公开的实施例能够以除了在这里图示或描述的那些以外的顺序实施。此外,术语“包括”和“具有”以及他们的任何变形,意图在于覆盖不排他的包含,例如,包含了一系列步骤或单元的过程、方法、系统、产品或设备不必限于清楚地列出的那些步骤或单元,而是可包括没有清楚地列出的或对于这些过程、方法、产品或设备固有的其它步骤或单元。
本公开提供的技术方案主要采用大模型技术实现,此处的大模型是指具有大规模模型参数的深度学习模型,通常可以包含上亿、上百亿、上千亿、上万亿甚至十万亿以上的模型参数。大模型又可以称为基石模型/基础模型(Foundation Model),通过大规模无标注的语料进行大模型的预训练,产出亿级以上参数的预训练模型,这种模型能适应广泛的下游任务,模型具有较好的泛化能力,例如大规模语言模型LLM、多模态预训练模型(multi-modal pre-training model)等。
需要说明的是,大模型在实际应用时,可以通过少量样本对预训练模型进行微调,使得大模型可以应用于不同的任务中。例如,大模型可以广泛应用于自然语言处理(Natural Language Processing,简称NLP)、计算机视觉等领域,具体可以应用于如视觉问答(Visual Question Answering,简称VQA)、图像描述(Image Caption,简称IC)、图像生成等计算机视觉领域任务,也可以广泛应用于基于文本的情感分类、文本摘要生成、机器翻译等自然语言处理领域任务。因此,大模型主要的应用场景包括但不限于数字助理、智能机器人、搜索、在线教育、办公软件、电子商务、智能设计等。在本公开实施例中,以对话交互场景下通过文本识别模型进行文本识别为例进行解释说明。
实施例1
根据本公开实施例,提供了一种文本处理方法,需要说明的是,在附图的流程图示出的步骤可以在诸如一组计算机可执行指令的计算机系统中执行,并且,虽然在流程图中示出了逻辑顺序,但是在某些情况下,可以以不同于此处的顺序执行所示出或描述的步骤。
考虑到大模型的模型参数量庞大,且移动终端的运算资源有限,本公开实施例提
供的上述文本处理可以应用于如图1所示的应用场景,但不仅限于此。在如图1所示的应用场景中,大模型部署在服务器10中,服务器10可以通过局域网连接、广域网连接、因特网连接,或者其他类型的数据网络,连接一个或多个客户端设备20,此处的客户端设备20可以包括但不限于:智能手机、平板电脑、笔记本电脑、掌上电脑、个人计算机、智能家居设备、车载设备等。大模型部署在服务器中,客户端设备20通过操作界面与用户进行交互,实现对大模型的调用,进而实现本公开实施例所提供的方法。
在本公开实施例中,客户端设备和服务器构成的系统可以执行如下步骤:客户端设备可以接收到用户输入的第一文本,并通过网络将第一文本发送给服务器,服务器可以对第一文本进行识别,确定第一文本是否为目标文本,并在第一文本不是目标文本的情况下,基于第一文本生成第二文本,从而通过网络将第二文本返回给客户端设备,进而,客户端设备可以输出第二文本给用户查看。需要说明的是,在客户端设备的运行资源能够满足大模型的部署和运行条件的情况下,本公开实施例可以在客户端设备中进行。
在上述运行环境下,本公开提供了如图2所示的文本处理方法。图2是根据本公开实施例1的文本处理方法的流程图。该方法可以包括如下步骤:
步骤S202,获取第一文本。
在对话式交互场景中,上述的第一文本可以为对话式交互场景中,由用户输入的对话文本。
在内容生成场景中,上述的第一文本可以为内容生成场景中,由用户输入的用于对生成文本进行描述的语句、关键词等。
在数据搜索场景中,上述的第一文本可以为数据搜索场景中,由用户输入的搜索词。
上述的第一文本可以为用户交互界面中的输入文本,结合图1中显示的交互界面进行说明,可以将第一文本输入至文本输入框中,客户端20可以将文本输入框中的文本第一文本通过网络传输给服务器10。
步骤S204,对第一文本进行识别,确定第一文本是否为目标文本。
其中,目标文本用于表征存在安全风险的文本。
在一种可选的实施例中,可以通过关键词匹配对第一文本进行识别,判断第一文本中是否存在具有安全风险的字、词或段落,若第一文本中存在具有安全风险的字、词或段落,确定第一文本为目标文本;可以对第一文本进行识别,若第一文本中存在具有安全风险的字、词或段落的数量大于预先设置的安全风险阈值,确定第一文本为目标文本。需要说明的,根据第一文本的识别结果确定第一文本是否为目标文本的具体方式可以根据实际情况进行设置,此处不做任何限定。
在另一种可选的实施例中,可以利用大模型对第一文本进行识别,确定第一文本是否为目标文本。
需要说明的是,为了提高第一文本的识别准确度,可以通过多种识别方式分别进行识别,并对识别结果进行汇总,例如,先利用关键词匹配对第一文本进行识别,确定大概率不存在安全风险的文本,然后利用大模型对大概率不存在安全风险的文本进行识别,得到不存在安全风险的文本。
步骤S206,在第一文本不是目标文本的情况下,基于第一文本生成第二文本。
其中,第二文本用于表征第一文本对应的回复文本。
在一种可选的实施例中,在第一文本不是目标文本的情况下,说明第一文本中不存在安全风险,也即第一文本符合法律法规,此时,可以根据第一文本生成第二文本,从而降低了文本交互过程中的安全风险,提供一个良好的文本交互场景。
在另一种可选的实施例中,在第一文本不是目标文本的情况下,在对话式交互场景中,可以利用大模型根据第一文本生成第二文本,并将第二文本作为对第一文本的回复文本;在数据搜索场景中,可以利用数据搜索模型搜索到与第一文本对应的搜索结果,并根据搜索结果生成用于回复第一文本的第二文本;在内容生成场景中,可以利用内容生成模型基于第一文本生成第二文本,并将第二文本作为内容生成的结果。
在又一种可选的实施例中,在第一文本是目标文本的情况下,可以对第一文本进行拦截,直接不生成第二文本,或者,可以直接回复预设文本,其中,预设文本用于表示拒绝回复文本,例如,预设文本的具体内容可以为“拒绝回复文本”,此处仅作实例说明,具体的拦截回复方式可以根据场景需求灵活设置。
步骤S208,输出第二文本。
上述的第二文本可以为交互界面中的输出对话文本或者搜索结果文本。
在一种可选的实施例中,在基于第一文本生成第二文本之后,可以直接将第二文本输出,供用户查看。在另一种可选的实施例中,为了避免生成的第二文本存在安全风险,在基于第一文本生成第二文本之后,可以对第二文本进行识别,确定第二文本是否为目标文本,在第二文本不是目标文本的情况下,输出第二文本;在第二文本为目标文本的情况下,禁止输出第二文本,进一步地,可以基于第一文本重新生成第二文本,在重新生成第二文本不是目标文本的情况下,输出重新生成的第二文本。
上述的第二文本可以为用户交互界面中的输出文本,结合图1中显示的交互界面进行说明,服务器10可以对第一文本进行识别,确定第一文本是否为目标文本,在第一文本不是目标文本的情况下,基于第一文本生成第二文本,并通过网络将第二文本传输至客户端20,客户端20可以通过用户交互界面中的文本输出框显示第二文本。
在对话交互场景中,可以获取用户在对话界面中输入的对话文本,可以对该对话文本进行识别,确定该对话文本是否存在安全风险,在该对话文本不存在安全风险的
情况下,可以根据该对话文本生成对话回复文本,并在对话界面上显示该对话回复文本。
在对话交互场景中,可以在对话框中包含有虚拟对象,即,在目标对象与虚拟对象进行对话的过程中,可以对第一对话文本进行识别,确定第一对话文本是否为存在安全风险的文本,若第一对话文本不是存在安全风险的文本,可以根据第一对话文本生成第二对话文本,并输出第二对话文本,可选的,在对话交互场景中,还可以在对话框中不包含有虚拟对象。对话交互场景可以应用于多种场景,例如金融、企业、医疗、交通等,此处不做限定。
在内容生成场景中,可以获取用户在交互界面中输入的描述文本,可以对该描述文本进行识别,确定该描述文本是否存在安全风险,在该描述文本不存在安全风险的情况下,可以根据该描述文本生成内容回复文本,并在交互界面上显示该内容回复文本。
在数据搜索场景中,可以获取用户在搜索界面中输入的搜索文本,可以对该搜索文本进行识别,确定该搜索文本是否存在安全风险,在该搜索文本不存在安全风险的情况下,可以根据该搜索文本进行搜索,得到搜索结果,并在搜索界面上显示该搜索结果。
通过上述步骤,可以先获取第一文本,对第一文本进行识别,确定第一文本是否为存在安全风险的目标文本,在第一文本不是目标文本的情况下,基于第一文本生第二文本,其中,第二文本用于表征第一文本对应的回复文本,并输出第二文本,实现了提高文本交互的安全性的目的,容易注意到的是,在文本交互的过程中,通过对第一文本识别可以确定第一文本是否存在安全风险,在第一文本不存在安全风险的情况下,可以基于第一文本生成第二文本,以便降低文本交互过程中的安全风险,从而提高了文本交互过程中的安全性,进而解决了相关技术中文本交互的过程中存在安全风险的技术问题。
本公开上述实施例中,对第一文本进行识别,确定第一文本是否为目标文本,包括如下至少之一:将第一文本与预设数据库中的多个文本进行匹配,得到第一匹配结果;将第一文本包含的关键词与多个预设关键词进行匹配,得到第二匹配结果;利用文本识别模型对第一文本进行类别识别,得到文本识别结果,其中,文本识别结果用于表征第一文本所属的类别是否为目标文本的类别;基于第一匹配结果、第二匹配结果和/或文本识别结果,确定第一文本是否为目标文本。
上述的预设数据库可以为常见问题解答库(Frequently Asked Questions database,简称为FAQ)。上述的预设数据库还可以为自行设置的聚集各类风险问题的答案的数据库。
在一种可选的实施例中,可以根据热词对预设数据库进行更新,并且可以立即对
预设数据库中的热词进行配置并生效,保证对话回复的安全。
在一种可选的实施例中,可以根据研发内部测试、线上的实际反馈以及法律规定对于具有安全风险的风险问题文本构建上述的预设数据库,在预设数据库中各种风险问题文本都给出了经过审核的无风险回复文本。
在另一种可选的实施例中,可以将第一文本与预设数据库中的多个文本进行匹配,得到第一匹配结果,其中,第一匹配结果用于表示多个文本中是否存在与第一文本相似度大于第一预设值的文本,或者第一匹配结果被设置为表示多个文本中是否存在与第一文本相同的文本,若第一匹配结果用于表示多个文本中存在与第一文本相似度大于第一预设值的文本或者存在与第一文本相同的文本,则确定第一文本为目标文本。
上述的预设关键词可以为预先设置的具有安全风险的关键词、比较敏感的关键词。上述的预设关键词还可以根据不同的场景需求设置的不适宜出现的词语。
在一种可选的实施例中,可以将第一文本中包含的关键词与多个预设关键词进行匹配,得到第二匹配结果,其中,第二匹配结果用于表示多个预设关键词中是否存在第一文本中包含的关键词相似度大于第二预设值的文本,或者第二匹配结果被设置为表示多个预设关键词中是否存在与第一文本中包含的关键词相同的文本,若第二匹配结果用于表示多个文本中存在与第一文本中包含的关键词相似度大于第二预设值的文本或者存在与关键词相同的文本,则确定第一文本为目标文本。
上述的目标文本的类别可以为预先根据目标文本的属性进行分类得到的文本。可选的,可以根据目标文本的属性对目标文本的类别进行更细粒度的区分,也可以根据目标文本所属的不同类型的安全风险将目标文本分到不同的类别中。
上述的文本识别模型可以为风险识别模型,其中,风险识别模型根据位置编码技术(RoFormer)对多标签类别进行预测。
在一种可选的实施例中,可以利用文本识别模型对第一文本进行类别识别,可选的,可以利用文本识别模型识别第一文本属于不同细粒度风险类别的概率,其中,不同细粒度风险类别可以具有各自规定的可以调节的阈值,第一文本属于不同细粒度风险类别的概率超过阈值,则说明第一文本的类别属于具有风险的类别,也即,文本识别结果用于表示第一文本所属的类别为目标文本所处的类别。若第一文本属于不同细粒度风险类别的概率小于阈值,则说明第一文本的类别不属于具有风险的类别,也即,文本识别结果用于表示第一文本所属的类别不是目标文本所处的类别。
在一种可选的实施例中,可以根据第一匹配结果、第二匹配结果、文本识别结果中的任意一个结果确定第一文本是否为目标文本,还可以根据任意两个结果确定第一文本是否为目标文本,还可以根据全部结果确定第一文本是否为目标文本。
在另一种可选的实施例中,可以对第一匹配结果、第二匹配结果和文本识别结果设置对应的权重以最终确定第一文本是否为目标文本。需要说明的是,具体的权重设
置方式可以根据用户的需求自行设置。
本公开上述实施例中,将第一文本与多个文本进行匹配,得到第一匹配结果,包括如下至少之一:将第一文本与多个文本进行文本匹配,得到第一子匹配结果;将第一文本与多个文本进行正则表达式匹配,得到第二子匹配结果;利用文本匹配模型将第一文本与多个文本进行匹配,得到第三子匹配结果;对第一子匹配结果、第二子匹配结果和/或第三子匹配结果进行汇总,得到第一匹配结果。
在一种可选的实施例中,可以将第一文本与多个文本进行字面上的文本匹配,得到第一子匹配结果,第一子匹配结果可以用于表示在字面上文本之间的重叠度,若重叠度越高,则说明第一文本为目标文本的概率越大。
在另一种可选的实施例中,可以将第一文本与多个文本进行正则表达式匹配,得到第二子匹配结果,其中,正则表达式匹配是一种用来描述字符串的方式,可以通过特定的符号和字符的组合来定义一个字符串的模式,然后利用该模式去匹配其他字符串,若字符串匹配的字符越多,则说明第一文本为目标文本的概率越大。
在另一种可选的实施例中,可以利用文本匹配模型将第一文本与多个文本进行相似度匹配,若第一文本与多个文本中任意文本的相似度较大,则说明第一文本为目标文本的概率越大。
在另一种可选的实施例中,可以根据第一子匹配结果、第二子匹配结果和第三子匹配结果中的任意一个结果确定第一匹配结果,还可以根据任意两个结果确定第一匹配结果,还可以根据全部结果确定第一匹配结果。
在另一种可选的实施例中,可以对第一子匹配结果、第二子匹配结果和第三子匹配结果设置对应的权重以最终确定第一匹配结果。需要说明的是,具体的权重设置方式可以根据用户的需求自行设置。
通过字面匹配、正则表达式匹配和基于语义相似度匹配的综合方式,检测用户输入是否命中了预设数据库,如果命中则直接反馈标准答案,不再经过文本识别模型。
本公开上述实施例中,基于第一文本生成第二文本,包括:利用大规模预训练模型基于第一文本,生成初始回复文本,对初始回复文本进行识别,确定初始回复文本是否为目标文本;在初始回复文本不是目标文本的情况下,确定初始回复文本是第二文本;在初始回复文本是目标文本的情况下,确定预设文本是第二文本。
上述的大规模预训练模型可以简称为大模型。其中,大模型可以具有很强的指令理解能力和世界知识储备,因此能够生成高质量的回复文本,包括写代码、写表格、多语言等更进一步的写作能力,并且具有对话交互式响应用户需求的特性。
上述的预设文本可以为预先设置的无安全风险的文本。上述的预设文本还可以是预先设置的初始回复文本对应的无安全风险的文本。
在一种可选的实施例中,可以利用大规模预训练模型基于第一文本,生成初始回
复文本,为了保证该初始回复文本的安全性,可以对初始回复文本进行识别,判断该初始回复文本是否为目标文本,若该初始回复文本不是目标文本,则说明该初始文本为不具有安全风险的第二文本,若该初始回复文本为目标文本,则可以将预设文本确定为第二文本,以保证文本交互过程中的安全性。
在另一种可选的实施例中,识别初始回复文本是否为目标文本的方式可以与识别第一文本是否为目标文本的方式相同,此处不做赘述。
本公开上述实施例中,大规模预训练模型的模型参数是利用预先构造的训练文本进行调整得到的,预先构造的训练文本包括:目标文本和目标文本对应的生成文本。
上述的目标文本可以为具有安全风险的文本,上述目标文本对应的生成文本可以是不具有安全风险的回复文本。
上述的预先构造的训练文本可以为人工构造的目标文本和目标文本对应的生成文本;上述的预先构造的训练文本也可以为利用大规模预训练模型构造的目标文本和目标文本对应的生成文本;此处不做具体限定,可以根据实际的需求确定预先构造训练文本的方式。
在一种可选的实施例中,可以先获取少量的目标文本,利用大规模预训练模型根据少量的目标文本自动撰写更多的具有相近表述方式的目标文本,从而达到扩充目标文本的目的,可以利用大规模预训练模型自动构造目标文本的生成文本,可选的,可以对大规模预训练模型增加不能产出具有安全风险的文本的指示,让大规模预训练模型尽量产出不具有安全风险的回复文本,也即目标文本对应的生成文本,从而可以预先构造出训练文本。
进一步的,可以对预先构造出的训练文本进行校对,使得训练文本中目标文本对应的生成文本不具有安全风险,可以根据校对后的训练文本对大规模预训练模型的模型参数进行微调,从而使得在不给出额外指示的情况下,大规模预训练模型也可以根据目标文本生成不具有安全风险的回复文本。
上述的训练文本可以为无害训练文本。
在一种可选的实施例中,构造无害训练样本微调模型,可以大模型对话的安全能力进行提升,可以将无害训练样本作为监督信号,在指令微调阶段训练模型参数,这样模型直接学会了对于训练样本中的风险输入,借鉴训练样本的无害回复内容,规避有害的输出。在构造训练样本时,采用了自我指示(self-instruct)和上下文蒸馏(context distillation)自动构造+人工校验的方法,即先人工构造少量的用户风险输入和无害回复样本,进而通过先前版本迭代的经过指令微调的大模型,自动撰写更多具有相近表述方式的更多风险输入,用作扩充的训练样本。
进一步的,为这些训练样本构造回复时,可以给大规模预训练模型增加不能产出有害内容的指示,让模型尽量产出无害内容。可以对构造的风险输入+产出的无害内容
进行校对,校对后得到上千条可以用于训练的无害样本,进而在指令微调阶段连同其他能力训练样本训练大规模预训练模型,使大规模预训练模型在不给出额外的指示下也可以倾向产出无害内容。经过第三方人工评测打标,训练后的模型自身对于各类风险类问题的总体安全回复率较高。
本公开上述实施例中,在第一文本是目标文本的情况下,该方法还包括如下之一:从预设数据库中获取第一文本对应的第三文本,并输出第三文本,其中,第三文本用于表征第一文本对应的回复文本,预设数据库中存储有不同目标文本对应的预设回复文本;输出预设文本,其中,预设文本用于表征第一文本对应的回复文本。
上述的预设数据库中可以存储有目标文本和目标文本对应的预设回复文本,其中,预设回复文本可以为预先设置的目标文本的标准回复,该预设回复文本中不包含具有安全风险的文本。
在一种可选的实施例中,在第一文本是目标文本的情况下,确定该第一文本是否命中预设数据库中预先存储的文本,若该第一文本命中预设数据库中预先存储的文本,则可以从预设数据库中获取第一文本对应的回复文本,即上述的第三文本,并输出第三文本,其中,第三文本中不包含具有安全风险的文本。
上述的预设文本可以为预先设置的不具有安全风险的文本,例如,拒绝回复文本,此处对预设文本的具体内容不做限定,可以根据实际需求进行设置。
在另一种可选的实施例中,在第一文本是目标文本的情况下,可以直接输出预设文本,以避免文本交互过程中出现安全风险。
本公开上述实施例中,从预设数据库中获取第一文本对应的第三文本,包括:确定第一文本对应的风险等级;在风险等级大于预设等级的情况下,从预设数据库中获取第三文本。
在一种可选的实施例中,可以确定第一文本对应的风险等级,若该风险等级对应的安全风险较小,则可以直接生成第一文本对应的第二文本,若该风险等级大于预设等级,则说明该风险等级对应的安全风险较大,则可以从预设数据库中获取第三文本,以便减少文本交互中的安全风险。
本公开上述实施例中,在第一文本是目标文本的情况下,该方法还包括:获取第一文本对应的风险等级,或当前拦截次数,其中,当前拦截次数用于表示文本交互过程中第一文本是目标文本的次数;在风险等级大于预设等级,或当前拦截次数大于预设次数的情况下,停止文本交互的过程。
上述的预设次数和预设等级可以根据实际的场景需求自行设置。
在一种可选的实施例中,在第一文本是目标文本的情况下,可以获取第一文本对应的风险等级,或当前拦截次数,若风险等级大于预设等级,或当前拦截次数大于预设次数,则说明该文本交互过程的安全风险较大,为了避免出现安全问题,可以终止
文本交互的过程,可以表现为再次输入第一文本后,无任何响应,还可以回复“已终止交互”的文本,此处不做具体限定,可以根据实际情况进行设置。
本公开上述实施例中,在基于第一文本生成第二文本之后,该方法还包括:对第二文本进行识别,确定第二文本是否为目标文本;在第二文本是目标文本的情况下,获取当前拦截次数;在当前拦截次数大于预设次数的情况下,停止文本交互过程。
在一种可选的实施例中,在第二文本是目标文本的情况下,可以获取第二文本对应的风险等级,或当前拦截次数,若风险等级大于预设等级,或当前拦截次数大于预设次数,则说明该文本交互过程的安全风险较大,为了避免出现安全问题,可以终止文本交互的过程,可以表现为对本次的第一文本无任何响应,还可以回复“已终止交互”的文本,此处不做具体限定,可以根据实际情况进行设置。
图3是根据本公开实施例的一种文本处理过程的流程图,如图3所示,该方法包括:
步骤S300,用户输入第一文本;
步骤S301,判断第一文本是否命中目标文本,若命中,则执行步骤S302,若未命中,则执行步骤S304;
步骤S302,从预设数据库中获取第一文本对应的第三文本,并输出第三文本,若第一文本对应的风险等级大于预设等级,则执行步骤S303;
上述的风险等级可以为用于表示第一文本的安全风险的大小,可选的,可以表示为第一文本中存在的具有安全风险的关键词的数量和/关键词的风险程度确定,此处仅作实例说明,还可以根据第一文本中存在的具有安全风险的关键词的其他特性确定第一文本的安全风险的大小。
可选的,若第一文本的安全风险越大,则说明第一文本对应的风险等级越大,若第一文本的安全风险越小,则说明第一文本对应的风险等级越小。
步骤S303,终止对话;
步骤S304,确定第一文本对应的风险等级,判断第一文本的风险等级是否大于预设等级,若风险等级大于预设等级,执行步骤S305,若风险等级小于预设等级,执行步骤S306;
步骤S305,输出预设文本,并获取该对话的当前拦截次数,若当前拦截次数大于预设次数,执行步骤S303;
步骤S306,利用大规模预训练模型生成第一文本对应的第二文本,并输出第二文本;
步骤S307,利用大规模预训练模型对第一文本进行流式回复,若识别流式回复为目标文本,执行步骤S308,若未识别流式回复不是目标文本,则执行步骤S309;
步骤S308,输出预设文本,并获取该对话的当前拦截次数,若当前拦截次数大于
预设次数,执行步骤S303;
步骤S309,本轮交互正常,回复结束。
本公开可以通过无害样本增强训练大模型、线上风险识别模块、线上答案干预模块等多种方式,在大模型训练中和模型服务时,对于用户输入和模型输出都加入了一定的干预机制,并且具有一定的语义泛化性,大大提升了大模型服务的对话安全性。在构造训练样本和搭建服务安全模块时,尽可能提升了对话安全干预的实时性和泛化性,保证大模型在服务过程中不出现重大对话安全风险问题。
需要说明的是,本公开所涉及的用户信息(包括但不限于用户设备信息、用户个人信息等)和数据(包括但不限于用于分析的数据、存储的数据、展示的数据等),均为经用户授权或者经过各方充分授权的信息和数据,并且相关数据的收集、使用和处理需要遵守相关国家和地区的相关法律法规和标准,并提供有相应的操作入口,供用户选择授权或者拒绝。
需要说明的是,对于前述的各方法实施例,为了简单描述,故将其都表述为一系列的动作组合,但是本领域技术人员应该知悉,本公开并不受所描述的动作顺序的限制,因为依据本公开,某些步骤可以采用其他顺序或者同时进行。其次,本领域技术人员也应该知悉,说明书中所描述的实施例均属于优选实施例,所涉及的动作和模块并不一定是本公开所必须的。
通过以上的实施方式的描述,本领域的技术人员可以清楚地了解到根据上述实施例的方法可借助软件加必需的通用硬件平台的方式来实现,当然也可以通过硬件。基于这样的理解,本公开的技术方案本质上或者说对现有技术做出贡献的部分可以以软件产品的形式体现出来,该计算机软件产品存储在一个存储介质(如ROM/RAM、磁碟、光盘)中,包括若干指令用以使得一台终端设备(可以是手机,计算机,服务器,或者网络设备等)执行本公开各个实施例的方法。
实施例2
根据本公开实施例,还提供了一种文本处理方法,需要说明的是,在附图的流程图示出的步骤可以在诸如一组计算机可执行指令的计算机系统中执行,并且,虽然在流程图中示出了逻辑顺序,但是在某些情况下,可以以不同于此处的顺序执行所示出或描述的步骤。
图4是根据本公开实施例2的一种文本处理方法的流程图,如图4所示,该方法包括如下步骤:
步骤S402,在目标对象与虚拟对象进行对话的过程中,获取目标对象输入的第一对话文本。
上述的目标对象可以为用户。上述的虚拟对象可以为模型。
上述的第一对话文本可以是目标对象输入至交互界面的对话文本,其中,交互界
面可以为目标对象与虚拟对象进行交互的界面。
步骤S404,对第一对话文本进行识别,确定第一对话文本是否为目标文本。
其中,目标文本用于表征存在安全风险的文本。
在一种可选的实施例中,可以对第一对话文本进行识别,确定第一对话文本是否为目标文本,若第一对话文本为目标文本,则说明第一对话文本存在安全风险。
步骤S406,在第一对话文本不是目标文本的情况下,基于第一对话文本生成第二对话文本。
步骤S408,输出第二对话文本。
在一种可选的实施例中,在第一对话文本不是目标文本的情况下,说明此次对话过程中安全性较高,可以根据第一对话文本生成第二对话文本,并在交互界面中输出第二对话文本以便用户可以查看到。
通过上述步骤,在目标对象与虚拟对象进行对话的过程中,获取目标对象输入的第一对话文本;对第一对话文本进行识别,确定第一对话文本是否为目标文本,其中,目标文本用于表征存在安全风险的文本;在第一对话文本不是目标文本的情况下,基于第一对话文本生成第二对话文本;输出第二对话文本,实现了提高对话文本交互的安全性的目的,容易注意到的是,在文本交互的过程中,通过对第一对话文本识别可以确定第一对话文本是否存在安全风险,在第一对话文本不存在安全风险的情况下,可以基于第一对话文本生成第二对话文本,以便降低文本交互过程中的安全风险,从而提高了文本交互过程中的安全性,进而解决了相关技术中文本交互的过程中存在安全风险的技术问题。
本公开上述实施例中,在第一对话文本是目标文本的情况下,该方法还包括:获取第一对话文本对应的风险等级,或当前拦截次数,其中,当前拦截次数用于表征在目标对象与虚拟对象进行对话的过程中,识别出第一对话文本是目标文本的次数;在风险等级大于预设等级,或当前拦截次数大于预设次数的情况下,停止目标对象与虚拟对象的对话过程。
在一种可选的实施例中,在第一对话文本是目标文本的情况下,可以获取第一对话文本对应的风险等级,或当前拦截次数,若风险等级大于预设等级,或当前拦截次数大于预设次数,则说明该对话过程的安全风险较大,为了避免出现安全问题,可以终止目标对象与虚拟对象的对话过程,可以表现为再次输入第一对话文本后,无任何响应,还可以回复“已终止对话”的文本,此处不做具体限定,可以根据实际情况进行设置。
本公开上述实施例中,在基于第一对话文本生成第二对话文本之后,该方法还包括:对第二对话文本进行识别,确定第二对话文本是否为目标文本;在第二对话文本是目标文本的情况下,获取当前拦截次数;在当前拦截次数大于预设次数的情况下,
停止目标对象与虚拟对象的对话过程。
在一种可选的实施例中,在第二对话文本是目标文本的情况下,可以获取第二对话文本对应的风险等级,或当前拦截次数,若风险等级大于预设等级,或当前拦截次数大于预设次数,则说明该对话过程的安全风险较大,为了避免出现安全问题,可以终止目标对象与虚拟对象的对话过程,可以表现为对本次的第一对话文本无任何响应,还可以回复“已终止对话”的文本,此处不做具体限定,可以根据实际情况进行设置。
需要说明的是,本公开上述实施例中涉及到的优选实施方案与实施例1提供的方案以及应用场景、实施过程相同,但不仅限于实施例1所提供的方案。
实施例3
根据本公开实施例,还提供了一种文本处理方法,需要说明的是,在附图的流程图示出的步骤可以在诸如一组计算机可执行指令的计算机系统中执行,并且,虽然在流程图中示出了逻辑顺序,但是在某些情况下,可以以不同于此处的顺序执行所示出或描述的步骤。
图5是根据本公开实施例3的一种文本处理方法的流程图,如图5所示,该方法包括如下步骤:
步骤S502,响应作用于操作界面上的文本输入指令,在操作界面上显示第一文本。
上述的操作界面可以为用户进行触控操作的界面。
上述的文本输入指令可以为用户在操作界面上输入第一文本生成的指令。
在一种可选的实施例中,响应作用于操作界面上的文本输入指令,可以在操作界面上用户用于输入文本的文本输入框中显示第一文本。
步骤S504,在第一文本不是目标文本的情况下,在操作界面上显示第二文本。
其中,第二文本是在识别出第一文本不是目标文本的情况下,基于第一文本生成的文本,目标文本用于表征存在安全风险的文本。
在另一种可选的实施例中,在第一文本不是目标文本的情况下,可以在操作界面上的文本显示框中显示第二文本。
通过上述步骤,响应作用于操作界面上的文本输入指令,在操作界面上显示第一文本;在第一文本不是目标文本的情况下,在操作界面上显示第二文本,其中,第二文本是在识别出第一文本不是目标文本的情况下,基于第一文本生成的文本,目标文本用于表征存在安全风险的文本,实现了提高文本交互的安全性的目的,容易注意到的是,在文本交互的过程中,通过对第一文本识别可以确定第一文本是否存在安全风险,在第一文本不存在安全风险的情况下,可以基于第一文本生成第二文本,以便降低文本交互过程中的安全风险,从而提高了文本交互过程中的安全性,进而解决了相关技术中文本交互的过程中存在安全风险的技术问题。
需要说明的是,本公开上述实施例中涉及到的优选实施方案与实施例1提供的方
案以及应用场景、实施过程相同,但不仅限于实施例1所提供的方案。
实施例4
根据本公开实施例,还提供了一种文本处理方法,需要说明的是,在附图的流程图示出的步骤可以在诸如一组计算机可执行指令的计算机系统中执行,并且,虽然在流程图中示出了逻辑顺序,但是在某些情况下,可以以不同于此处的顺序执行所示出或描述的步骤。
图6是根据本公开实施例4的一种文本处理方法的流程图,如图6所示,该方法包括如下步骤:
步骤S602,通过调用第一接口获取第一文本。
其中,第一接口包括第一参数,第一参数的参数值为第一文本。
上述的第一接口可以是服务器和客户端之间进行数据交互的接口,客户端可以将第一文本传入接口函数,作为接口函数的第一参数,实现将第一文本上传至云服务器的目的。
步骤S604,对第一文本进行识别,确定第一文本是否为目标文本。
其中,目标文本用于表征存在安全风险的文本。
步骤S606,在第一文本不是目标文本的情况下,基于第一文本生成第二文本。
步骤S608,通过调用第二接口输出第二文本。
其中,第二接口包括第二参数,第二参数的参数值为第二文本。
上述的第二接口可以为云服务器和客户端之间进行数据交换的接口,云服务器可以将第二文本传入接口函数,作为接口函数的第二参数,实现将第二文本下发至客户端的目的。
通过上述步骤,通过调用第一接口获取第一文本,其中,第一接口包括第一参数,第一参数的参数值为第一文本;对第一文本进行识别,确定第一文本是否为目标文本,其中,目标文本用于表征存在安全风险的文本;在第一文本不是目标文本的情况下,基于第一文本生成第二文本;通过调用第二接口输出第二文本,其中,第二接口包括第二参数,第二参数的参数值为第二文本,实现了提高文本交互的安全性的目的,容易注意到的是,在文本交互的过程中,通过对第一文本识别可以确定第一文本是否存在安全风险,在第一文本不存在安全风险的情况下,可以基于第一文本生成第二文本,以便降低文本交互过程中的安全风险,从而提高了文本交互过程中的安全性,进而解决了相关技术中文本交互的过程中存在安全风险的技术问题。
需要说明的是,本公开上述实施例中涉及到的优选实施方案与实施例1提供的方案以及应用场景、实施过程相同,但不仅限于实施例1所提供的方案。
实施例5
根据本公开实施例,还提供了一种用于实施上述文本处理方法的文本处理装置,
图7是根据本公开实施例5的一种文本处理装置的示意图,如图7所示,该装置700包括:获取模块702、识别模块704、生成模块706、输出模块708。
其中,获取模块被设置为获取第一文本;识别模块被设置为对第一文本进行识别,确定第一文本是否为目标文本,其中,目标文本用于表征存在安全风险的文本;生成模块被设置为在第一文本不是目标文本的情况下,基于第一文本生成第二文本,其中,第二文本用于表征第一文本对应的回复文本;输出模块被设置为输出第二文本。
此处需要说明的是,上述获取模块702、识别模块704、生成模块706、输出模块708对应于实施例1中的步骤S202至步骤S208,四个模块与对应的步骤所实现的实例和应用场景相同,但不限于上述实施例一所公开的内容。需要说明的是,上述模块或单元可以是存储在存储器(例如,存储器104)中并由一个或多个处理器(例如,处理器102a,102b,……,102n)处理的硬件组件或软件组件,上述模块也可以作为装置的一部分可以运行在实施例一提供的计算机终端10中。
本公开上述实施例中,识别模块被设置为将第一文本与预设数据库中的多个文本进行匹配,得到第一匹配结果;识别模块被设置为将第一文本包含的关键词与多个预设关键词进行匹配,得到第二匹配结果;识别模块被设置为利用文本识别模型对第一文本进行类别识别,得到文本识别结果,其中,文本识别结果用于表征第一文本所属的类别是否为目标文本的类别;识别模块被设置为基于第一匹配结果、第二匹配结果和/或文本识别结果,确定第一文本是否为目标文本。
本公开上述实施例中,识别模块被设置为将第一文本与多个文本进行文本匹配,得到第一子匹配结果;识别模块被设置为将第一文本与多个文本进行正则表达式匹配,得到第二子匹配结果;识别模块被设置为利用文本匹配模型将第一文本与多个文本进行匹配,得到第三子匹配结果;识别模块被设置为对第一子匹配结果、第二子匹配结果和/或第三子匹配结果进行汇总,得到第一匹配结果。
本公开上述实施例中,生成模块被设置为利用大规模预训练模型基于第一文本,生成初始回复文本;生成模块被设置为对初始回复文本进行识别,确定初始回复文本是否为目标文本;生成模块被设置为在初始回复文本不是目标文本的情况下,确定初始回复文本是第二文本;生成模块被设置为在初始回复文本是目标文本的情况下,确定预设文本是第二文本。
本公开上述实施例中,生成模块被设置为大规模预训练模型的模型参数是利用预先构造的训练文本进行调整得到的,预先构造的训练文本包括:目标文本和目标文本对应的生成文本。
生成模块被设置为本公开上述实施例中,输出模块被设置为从预设数据库中获取第一文本对应的第三文本,并输出第三文本,其中,第三文本用于表征第一文本对应的回复文本,预设数据库中存储有不同目标文本对应的预设回复文本;输出模块被设
置为输出预设文本,其中,预设文本用于表征第一文本对应的回复文本。
本公开上述实施例中,该装置还包括:确定模块。
其中,确定模块被设置为确定第一文本对应的风险等级;获取模块被设置为在风险等级大于预设等级的情况下,从预设数据库中获取第三文本。
需要说明的是,本公开上述实施例中涉及到的优选实施方案与实施例1提供的方案以及应用场景、实施过程相同,但不仅限于实施例1所提供的方案。
实施例6
根据本公开实施例,还提供了一种用于实施上述文本处理方法的文本处理装置,图8是根据本公开实施例6的一种文本处理装置的示意图,如图8所示,该装置800包括:获取模块802、识别模块804、生成模块806、输出模块808。
其中,获取模块被设置为在目标对象与虚拟对象进行对话的过程中,获取目标对象输入的第一对话文本;识别模块被设置为对第一对话文本进行识别,确定第一对话文本是否为目标文本,其中,目标文本用于表征存在安全风险的文本;生成模块被设置为在第一对话文本不是目标文本的情况下,基于第一对话文本生成第二对话文本;输出模块被设置为输出第二对话文本。
此处需要说明的是,上述获取模块802、识别模块804、生成模块806、输出模块808对应于实施例2中的步骤S402至步骤S408,四个模块与对应的步骤所实现的实例和应用场景相同,但不限于上述实施例一所公开的内容。需要说明的是,上述模块或单元可以是存储在存储器(例如,存储器104)中并由一个或多个处理器(例如,处理器102a,102b,……,102n)处理的硬件组件或软件组件,上述模块也可以作为装置的一部分可以运行在实施例一提供的计算机终端10中。
本公开上述实施例中,该装置还包括:停止模块。
其中,获取模块被设置为获取第一对话文本对应的风险等级,或当前拦截次数,其中,当前拦截次数用于表征在目标对象与虚拟对象进行对话的过程中,识别出第一对话文本是目标文本的次数;停止模块被设置为在风险等级大于预设等级,或当前拦截次数大于预设次数的情况下,停止目标对象与虚拟对象的对话过程。
本公开上述实施例中,识别模块被设置为对第二对话文本进行识别,确定第二对话文本是否为目标文本;获取模块被设置为在第二对话文本是目标文本的情况下,获取当前拦截次数;停止模块被设置为在当前拦截次数大于预设次数的情况下,停止目标对象与虚拟对象的对话过程。
需要说明的是,本公开上述实施例中涉及到的优选实施方案与实施例1提供的方案以及应用场景、实施过程相同,但不仅限于实施例1所提供的方案。
实施例7
根据本公开实施例,还提供了一种用于实施上述文本处理方法的文本处理装置,图9是根据本公开实施例7的一种文本处理装置的示意图,如图9所示,该装置900包括:第一显示模块902、第二显示模块904。
其中,第一显示模块被设置为响应作用于操作界面上的文本输入指令,在操作界面上显示第一文本;第二显示模块被设置为在第一文本不是目标文本的情况下,在操作界面上显示第二文本,其中,第二文本是在识别出第一文本不是目标文本的情况下,基于第一文本生成的文本,目标文本用于表征存在安全风险的文本。
此处需要说明的是,上述的第一显示模块902、第二显示模块904对应于实施例3中的步骤S502至步骤S502,;两个模块与对应的步骤所实现的实例和应用场景相同,但不限于上述实施例一所公开的内容。需要说明的是,上述模块或单元可以是存储在存储器(例如,存储器104)中并由一个或多个处理器(例如,处理器102a,102b,……,102n)处理的硬件组件或软件组件,上述模块也可以作为装置的一部分可以运行在实施例一提供的计算机终端10中。
需要说明的是,本公开上述实施例中涉及到的优选实施方案与实施例1提供的方案以及应用场景、实施过程相同,但不仅限于实施例1所提供的方案。
实施例8
根据本公开实施例,还提供了一种用于实施上述文本处理方法的文本处理装置,图10是根据本公开实施例8的一种文本处理装置的示意图,如图10所示,该装置1000包括:获取模块1002、识别模块1004、生成模块1006、输出模块1008。
其中,获取模块被设置为通过调用第一接口获取第一文本,其中,第一接口包括第一参数,第一参数的参数值为第一文本;识别模块被设置为对第一文本进行识别,确定第一文本是否为目标文本,其中,目标文本用于表征存在安全风险的文本;生成模块被设置为在第一文本不是目标文本的情况下,基于第一文本生成第二文本;输出模块被设置为通过调用第二接口输出第二文本,其中,第二接口包括第二参数,第二参数的参数值为第二文本。
此处需要说明的是,上述的获取模块1002、识别模块1004、生成模块1006、输出模块1008对应于实施例4中的步骤S602至步骤S608;四个模块与对应的步骤所实现的实例和应用场景相同,但不限于上述实施例一所公开的内容。需要说明的是,上述模块或单元可以是存储在存储器(例如,存储器104)中并由一个或多个处理器(例如,处理器102a,102b,……,102n)处理的硬件组件或软件组件,上述模块也可以作为装置的一部分可以运行在实施例一提供的计算机终端10中。
需要说明的是,本公开上述实施例中涉及到的优选实施方案与实施例1提供的方案以及应用场景、实施过程相同,但不仅限于实施例1所提供的方案。
实施例9
本公开的实施例可以提供一种计算机终端,该计算机终端可以是计算机终端群中的任意一个计算机终端设备。可选地,在本实施例中,上述计算机终端也可以替换为移动终端等终端设备。
可选地,在本实施例中,上述计算机终端可以位于计算机网络的多个网络设备中的至少一个网络设备。
在本实施例中,上述计算机终端可以执行文本处理方法中以下步骤的程序代码:获取第一文本;对第一文本进行识别,确定第一文本是否为目标文本,其中,目标文本用于表征存在安全风险的文本;在第一文本不是目标文本的情况下,基于第一文本生成第二文本,其中,第二文本用于表征第一文本对应的回复文本;输出第二文本。
可选地,图11是根据本公开实施例的一种计算机终端的结构框图。如图11所示,该计算机终端A可以包括:一个或多个(图中仅示出一个)处理器102、存储器104、存储控制器、以及外设接口,其中,外设接口与射频模块、音频模块和显示器连接。
其中,存储器可用于存储软件程序以及模块,如本公开实施例中的文本处理方法和装置对应的程序指令/模块,处理器通过运行存储在存储器内的软件程序以及模块,从而执行各种功能应用以及数据处理,即实现上述的文本处理方法。存储器可包括高速随机存储器,还可以包括非易失性存储器,如一个或者多个磁性存储装置、闪存、或者其他非易失性固态存储器。在一些实例中,存储器可进一步包括相对于处理器远程设置的存储器,这些远程存储器可以通过网络连接至终端A。上述网络的实例包括但不限于互联网、企业内部网、局域网、移动通信网及其组合。
处理器可以通过传输装置调用存储器存储的信息及应用程序,以执行下述步骤:获取第一文本;对第一文本进行识别,确定第一文本是否为目标文本,其中,目标文本用于表征存在安全风险的文本;在第一文本不是目标文本的情况下,基于第一文本生成第二文本,其中,第二文本用于表征第一文本对应的回复文本;输出第二文本。
可选的,上述处理器还可以执行如下步骤的程序代码:将第一文本与预设数据库中的多个文本进行匹配,得到第一匹配结果;将第一文本包含的关键词与多个预设关键词进行匹配,得到第二匹配结果;利用文本识别模型对第一文本进行类别识别,得到文本识别结果,其中,文本识别结果用于表征第一文本所属的类别是否为目标文本的类别;基于第一匹配结果、第二匹配结果和/或文本识别结果,确定第一文本是否为目标文本。
可选的,上述处理器还可以执行如下步骤的程序代码:将第一文本与多个文本进行文本匹配,得到第一子匹配结果;将第一文本与多个文本进行正则表达式匹配,得到第二子匹配结果;利用文本匹配模型将第一文本与多个文本进行匹配,得到第三子匹配结果;对第一子匹配结果、第二子匹配结果和/或第三子匹配结果进行汇总,得到
第一匹配结果。
可选的,上述处理器还可以执行如下步骤的程序代码:利用大规模预训练模型基于第一文本,生成初始回复文本,对初始回复文本进行识别,确定初始回复文本是否为目标文本;在初始回复文本不是目标文本的情况下,确定初始回复文本是第二文本;在初始回复文本是目标文本的情况下,确定预设文本是第二文本。
可选的,上述处理器还可以执行如下步骤的程序代码:大规模预训练模型的模型参数是利用预先构造的训练文本进行调整得到的,预先构造的训练文本包括:目标文本和目标文本对应的生成文本。
可选的,上述处理器还可以执行如下步骤的程序代码:从预设数据库中获取第一文本对应的第三文本,并输出第三文本,其中,第三文本用于表征第一文本对应的回复文本,预设数据库中存储有不同目标文本对应的预设回复文本;输出预设文本,其中,预设文本用于表征第一文本对应的回复文本。
可选的,上述处理器还可以执行如下步骤的程序代码:确定第一文本对应的风险等级;在风险等级大于预设等级的情况下,从预设数据库中获取第三文本。
处理器可以通过传输装置调用存储器存储的信息及应用程序,以执行下述步骤:在目标对象与虚拟对象进行对话的过程中,获取目标对象输入的第一对话文本;对第一对话文本进行识别,确定第一对话文本是否为目标文本,其中,目标文本用于表征存在安全风险的文本;在第一对话文本不是目标文本的情况下,基于第一对话文本生成第二对话文本;输出第二对话文本。
可选的,上述处理器还可以执行如下步骤的程序代码:获取第一对话文本对应的风险等级,或当前拦截次数,其中,当前拦截次数用于表征在目标对象与虚拟对象进行对话的过程中,识别出第一对话文本是目标文本的次数;在风险等级大于预设等级,或当前拦截次数大于预设次数的情况下,停止目标对象与虚拟对象的对话过程。
可选的,上述处理器还可以执行如下步骤的程序代码:对第二对话文本进行识别,确定第二对话文本是否为目标文本;在第二对话文本是目标文本的情况下,获取当前拦截次数;在当前拦截次数大于预设次数的情况下,停止目标对象与虚拟对象的对话过程。
处理器可以通过传输装置调用存储器存储的信息及应用程序,以执行下述步骤:响应作用于操作界面上的文本输入指令,在操作界面上显示第一文本;在第一文本不是目标文本的情况下,在操作界面上显示第二文本,其中,第二文本是在识别出第一文本不是目标文本的情况下,基于第一文本生成的文本,目标文本用于表征存在安全风险的文本。
处理器可以通过传输装置调用存储器存储的信息及应用程序,以执行下述步骤:通过调用第一接口获取第一文本,其中,第一接口包括第一参数,第一参数的参数值
为第一文本;对第一文本进行识别,确定第一文本是否为目标文本,其中,目标文本用于表征存在安全风险的文本;在第一文本不是目标文本的情况下,基于第一文本生成第二文本;通过调用第二接口输出第二文本,其中,第二接口包括第二参数,第二参数的参数值为第二文本。
采用本公开实施例,获取第一文本;对第一文本进行识别,确定第一文本是否为目标文本,其中,目标文本用于表征存在安全风险的文本;在第一文本不是目标文本的情况下,基于第一文本生成第二文本,其中,第二文本用于表征第一文本对应的回复文本;输出第二文本,实现了提高文本交互的安全性的目的,容易注意到的是,在文本交互的过程中,通过对第一文本识别可以确定第一文本是否存在安全风险,在第一文本不存在安全风险的情况下,可以基于第一文本生成第二文本,以便降低文本交互过程中的安全风险,从而提高了文本交互过程中的安全性,进而解决了相关技术中文本交互的过程中存在安全风险的技术问题。
本领域普通技术人员可以理解,图11所示的结构仅为示意,计算机终端也可以是智能手机(如Android手机、iOS手机等)、平板电脑、掌上电脑以及移动互联网设备(Mobile Internet Devices,MID)、PAD等终端设备。图11其并不对上述电子装置的结构造成限定。例如,计算机终端A还可包括比图11中所示更多或者更少的组件(如网络接口、显示装置等),或者具有与图11所示不同的配置。
本领域普通技术人员可以理解上述实施例的各种方法中的全部或部分步骤是可以通过程序来指令终端设备相关的硬件来完成,该程序可以存储于一计算机可读存储介质中,存储介质可以包括:闪存盘、只读存储器(Read-Only Memory,ROM)、随机存取器(Random Access Memory,RAM)、磁盘或光盘等。
实施例10
本公开的实施例还提供了一种存储介质。可选地,在本实施例中,上述存储介质可以用于保存上述实施例一所提供的文本处理方法所执行的程序代码。
可选地,在本实施例中,上述存储介质可以位于计算机网络中计算机终端群中的任意一个计算机终端中,或者位于移动终端群中的任意一个移动终端中。
可选地,在本实施例中,存储介质被设置为存储用于执行以下步骤的程序代码:获取第一文本;对第一文本进行识别,确定第一文本是否为目标文本,其中,目标文本用于表征存在安全风险的文本;在第一文本不是目标文本的情况下,基于第一文本生成第二文本,其中,第二文本用于表征第一文本对应的回复文本;输出第二文本。
可选地,上述存储介质还被设置为存储用于执行以下步骤的程序代码:将第一文本与预设数据库中的多个文本进行匹配,得到第一匹配结果;将第一文本包含的关键词与多个预设关键词进行匹配,得到第二匹配结果;利用文本识别模型对第一文本进行类别识别,得到文本识别结果,其中,文本识别结果用于表征第一文本所属的类别
是否为目标文本的类别;基于第一匹配结果、第二匹配结果和/或文本识别结果,确定第一文本是否为目标文本。
可选地,上述存储介质还被设置为存储用于执行以下步骤的程序代码:将第一文本与多个文本进行文本匹配,得到第一子匹配结果;将第一文本与多个文本进行正则表达式匹配,得到第二子匹配结果;利用文本匹配模型将第一文本与多个文本进行匹配,得到第三子匹配结果;对第一子匹配结果、第二子匹配结果和/或第三子匹配结果进行汇总,得到第一匹配结果。
可选地,上述存储介质还被设置为存储用于执行以下步骤的程序代码:利用大规模预训练模型基于第一文本,生成初始回复文本,对初始回复文本进行识别,确定初始回复文本是否为目标文本;在初始回复文本不是目标文本的情况下,确定初始回复文本是第二文本;在初始回复文本是目标文本的情况下,确定预设文本是第二文本。
可选地,上述存储介质还被设置为存储用于执行以下步骤的程序代码:大规模预训练模型的模型参数是利用预先构造的训练文本进行调整得到的,预先构造的训练文本包括:目标文本和目标文本对应的生成文本。
可选地,上述存储介质还被设置为存储用于执行以下步骤的程序代码:从预设数据库中获取第一文本对应的第三文本,并输出第三文本,其中,第三文本用于表征第一文本对应的回复文本,预设数据库中存储有不同目标文本对应的预设回复文本;输出预设文本,其中,预设文本用于表征第一文本对应的回复文本。
可选地,上述存储介质还被设置为存储用于执行以下步骤的程序代码:确定第一文本对应的风险等级;在风险等级大于预设等级的情况下,从预设数据库中获取第三文本。
可选地,在本实施例中,存储介质被设置为存储用于执行以下步骤的程序代码:在目标对象与虚拟对象进行对话的过程中,获取目标对象输入的第一对话文本;对第一对话文本进行识别,确定第一对话文本是否为目标文本,其中,目标文本用于表征存在安全风险的文本;在第一对话文本不是目标文本的情况下,基于第一对话文本生成第二对话文本;输出第二对话文本。
可选地,上述存储介质还被设置为存储用于执行以下步骤的程序代码:获取第一对话文本对应的风险等级,或当前拦截次数,其中,当前拦截次数用于表征在目标对象与虚拟对象进行对话的过程中,识别出第一对话文本是目标文本的次数;在风险等级大于预设等级,或当前拦截次数大于预设次数的情况下,停止目标对象与虚拟对象的对话过程。
可选地,上述存储介质还被设置为存储用于执行以下步骤的程序代码:对第二对话文本进行识别,确定第二对话文本是否为目标文本;在第二对话文本是目标文本的情况下,获取当前拦截次数;在当前拦截次数大于预设次数的情况下,停止目标对象
与虚拟对象的对话过程。
可选地,在本实施例中,存储介质被设置为存储用于执行以下步骤的程序代码:响应作用于操作界面上的文本输入指令,在操作界面上显示第一文本;在第一文本不是目标文本的情况下,在操作界面上显示第二文本,其中,第二文本是在识别出第一文本不是目标文本的情况下,基于第一文本生成的文本,目标文本用于表征存在安全风险的文本。
可选地,在本实施例中,存储介质被设置为存储用于执行以下步骤的程序代码:通过调用第一接口获取第一文本,其中,第一接口包括第一参数,第一参数的参数值为第一文本;对第一文本进行识别,确定第一文本是否为目标文本,其中,目标文本用于表征存在安全风险的文本;在第一文本不是目标文本的情况下,基于第一文本生成第二文本;通过调用第二接口输出第二文本,其中,第二接口包括第二参数,第二参数的参数值为第二文本。
采用本公开实施例,获取第一文本;对第一文本进行识别,确定第一文本是否为目标文本,其中,目标文本用于表征存在安全风险的文本;在第一文本不是目标文本的情况下,基于第一文本生成第二文本,其中,第二文本用于表征第一文本对应的回复文本;输出第二文本,实现了提高文本交互的安全性的目的,容易注意到的是,在文本交互的过程中,通过对第一文本识别可以确定第一文本是否存在安全风险,在第一文本不存在安全风险的情况下,可以基于第一文本生成第二文本,以便降低文本交互过程中的安全风险,从而提高了文本交互过程中的安全性,进而解决了相关技术中文本交互的过程中存在安全风险的技术问题。
上述本公开实施例序号仅仅为了描述,不代表实施例的优劣。
在本公开的上述实施例中,对各个实施例的描述都各有侧重,某个实施例中没有详述的部分,可以参见其他实施例的相关描述。
在本公开所提供的几个实施例中,应该理解到,所揭露的技术内容,可通过其它的方式实现。其中,以上所描述的装置实施例仅仅是示意性的,例如所述单元的划分,仅仅为一种逻辑功能划分,实际实现时可以有另外的划分方式,例如多个单元或组件可以结合或者可以集成到另一个系统,或一些特征可以忽略,或不执行。另一点,所显示或讨论的相互之间的耦合或直接耦合或通信连接可以是通过一些接口,单元或模块的间接耦合或通信连接,可以是电性或其它的形式。
所述作为分离部件说明的单元可以是或者也可以不是物理上分开的,作为单元显示的部件可以是或者也可以不是物理单元,即可以位于一个地方,或者也可以分布到多个网络单元上。可以根据实际的需要选择其中的部分或者全部单元来实现本实施例方案的目的。
另外,在本公开各个实施例中的各功能单元可以集成在一个处理单元中,也可以
是各个单元单独物理存在,也可以两个或两个以上单元集成在一个单元中。上述集成的单元既可以采用硬件的形式实现,也可以采用软件功能单元的形式实现。
所述集成的单元如果以软件功能单元的形式实现并作为独立的产品销售或使用时,可以存储在一个计算机可读取存储介质中。基于这样的理解,本公开的技术方案本质上或者说对现有技术做出贡献的部分或者该技术方案的全部或部分可以以软件产品的形式体现出来,该计算机软件产品存储在一个存储介质中,包括若干指令用以使得一台计算机设备(可为个人计算机、服务器或者网络设备等)执行本公开各个实施例所述方法的全部或部分步骤。而前述的存储介质包括:U盘、只读存储器(ROM,Read-Only Memory)、随机存取存储器(RAM,Random Access Memory)、移动硬盘、磁碟或者光盘等各种可以存储程序代码的介质。
以上所述仅是本公开的优选实施方式,应当指出,对于本技术领域的普通技术人员来说,在不脱离本公开原理的前提下,还可以做出若干改进和润饰,这些改进和润饰也应视为本公开的保护范围。
Claims (14)
- 一种文本处理方法,包括:获取第一文本;对所述第一文本进行识别,确定所述第一文本是否为目标文本,其中,所述目标文本用于表征存在安全风险的文本;在所述第一文本不是所述目标文本的情况下,基于所述第一文本生成第二文本,其中,所述第二文本用于表征所述第一文本对应的回复文本;输出所述第二文本。
- 根据权利要求1所述的方法,其中,对所述第一文本进行识别,确定所述第一文本是否为目标文本,包括如下至少之一:将所述第一文本与预设数据库中的多个文本进行匹配,得到第一匹配结果;将所述第一文本包含的关键词与多个预设关键词进行匹配,得到第二匹配结果;利用文本识别模型对所述第一文本进行类别识别,得到文本识别结果,其中,所述文本识别结果用于表征所述第一文本所属的类别是否为所述目标文本所属的类别;基于所述第一匹配结果、所述第二匹配结果和/或所述文本识别结果,确定所述第一文本是否为目标文本。
- 根据权利要求2所述的方法,其中,将所述第一文本与多个文本进行匹配,得到第一匹配结果,包括如下至少之一:将所述第一文本与所述多个文本进行文本匹配,得到第一子匹配结果;将所述第一文本与所述多个文本进行正则表达式匹配,得到第二子匹配结果;利用文本匹配模型将所述第一文本与所述多个文本进行匹配,得到第三子匹配结果;对所述第一子匹配结果、所述第二子匹配结果和/或第三子匹配结果进行汇总,得到所述第一匹配结果。
- 根据权利要求1所述的方法,其中,基于所述第一文本生成第二文本,包括:利用大规模预训练模型基于所述第一文本,生成初始回复文本,对所述初始回复文本进行识别,确定所述初始回复文本是否为所述目标文本;在所述初始回复文本不是所述目标文本的情况下,确定所述初始回复文本是所述第二文本;在所述初始回复文本是所述目标文本的情况下,确定预设文本是所述第二文本。
- 根据权利要求4所述的方法,其中,所述大规模预训练模型的模型参数是利用预先构造的训练文本进行调整得到的,所述预先构造的训练文本包括:所述目标文本和所述目标文本对应的生成文本。
- 根据权利要求1所述的方法,其中,在所述第一文本是所述目标文本的情况下,所述方法还包括如下之一:从预设数据库中获取所述第一文本对应的第三文本,并输出所述第三文本,其中,所述第三文本用于表征所述第一文本对应的回复文本,所述预设数据库中存储有不同所述目标文本对应的预设回复文本;输出预设文本,其中,所述预设文本用于表征所述第一文本对应的回复文本。
- 根据权利要求6所述的方法,其中,从预设数据库中获取所述第一文本对应的第三文本,包括:确定所述第一文本对应的风险等级;在所述风险等级大于预设等级的情况下,从所述预设数据库中获取所述第三文本。
- 一种文本处理方法,其中,包括:在目标对象与虚拟对象进行对话的过程中,获取所述目标对象输入的第一对话文本;对所述第一对话文本进行识别,确定所述第一对话文本是否为目标文本,其中,所述目标文本用于表征存在安全风险的文本;在所述第一对话文本不是所述目标文本的情况下,基于所述第一对话文本生成第二对话文本;输出所述第二对话文本。
- 根据权利要求8所述的方法,其中,在所述第一对话文本是所述目标文本的情况下,所述方法还包括:获取所述第一对话文本对应的风险等级,或当前拦截次数,其中,所述当前拦截次数用于表征在所述目标对象与所述虚拟对象进行对话的过程中,识别出所述第一对话文本是所述目标文本的次数;在所述风险等级大于预设等级,或所述当前拦截次数大于预设次数的情况下,停止所述目标对象与所述虚拟对象的对话过程。
- 根据权利要求8所述的方法,其中,在基于所述第一对话文本生成第二对话文本之后,所述方法还包括:对所述第二对话文本进行识别,确定所述第二对话文本是否为所述目标文本;在所述第二对话文本是所述目标文本的情况下,获取当前拦截次数;在所述当前拦截次数大于预设次数的情况下,停止所述目标对象与所述虚拟 对象的对话过程。
- 一种文本处理方法,其中,包括:响应作用于操作界面上的文本输入指令,在所述操作界面上显示第一文本;在所述第一文本不是目标文本的情况下,在所述操作界面上显示第二文本,其中,所述第二文本是在识别出所述第一文本不是目标文本的情况下,基于所述第一文本生成的文本,所述目标文本用于表征存在安全风险的文本。
- 一种文本处理方法,其中,包括:通过调用第一接口获取第一文本,其中,所述第一接口包括第一参数,所述第一参数的参数值为所述第一文本;对所述第一文本进行识别,确定所述第一文本是否为目标文本,其中,所述目标文本用于表征存在安全风险的文本;在所述第一文本不是所述目标文本的情况下,基于所述第一文本生成第二文本;通过调用第二接口输出所述第二文本,其中,所述第二接口包括第二参数,所述第二参数的参数值为所述第二文本。
- 一种电子设备,其中,包括:存储器,存储有可执行程序;处理器,用于运行所述程序,其中,所述程序运行时执行权利要求1至12中任意一项所述的方法。
- 一种计算机可读存储介质,其中,所述计算机可读存储介质包括存储的可执行程序,其中,在所述可执行程序运行时控制所述计算机可读存储介质所在设备执行权利要求1至12中任意一项所述的方法。
Applications Claiming Priority (2)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN202310899581.6A CN117056503A (zh) | 2023-07-20 | 2023-07-20 | 文本处理方法、电子设备以及计算机可读存储介质 |
| CN202310899581.6 | 2023-07-20 |
Publications (1)
| Publication Number | Publication Date |
|---|---|
| WO2025016455A1 true WO2025016455A1 (zh) | 2025-01-23 |
Family
ID=88659871
Family Applications (1)
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| PCT/CN2024/106517 Pending WO2025016455A1 (zh) | 2023-07-20 | 2024-07-19 | 文本处理方法、电子设备以及计算机可读存储介质 |
Country Status (2)
| Country | Link |
|---|---|
| CN (1) | CN117056503A (zh) |
| WO (1) | WO2025016455A1 (zh) |
Families Citing this family (2)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN117056503A (zh) * | 2023-07-20 | 2023-11-14 | 杭州阿里巴巴飞天信息技术有限公司 | 文本处理方法、电子设备以及计算机可读存储介质 |
| CN121598392A (zh) * | 2026-01-27 | 2026-03-03 | 北京信安世纪科技股份有限公司 | 文本处理方法、装置、电子设备及存储介质 |
Citations (7)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN107610740A (zh) * | 2017-07-27 | 2018-01-19 | 康美健康云服务有限公司 | 用于医疗的语义分析方法、电子设备、存储介质以及系统 |
| CN110968663A (zh) * | 2018-09-30 | 2020-04-07 | 北京国双科技有限公司 | 一种问答系统的答案展示方法及装置 |
| CN114860910A (zh) * | 2022-05-12 | 2022-08-05 | 阿里巴巴(中国)有限公司 | 智能对话方法及系统 |
| US20220318512A1 (en) * | 2021-03-30 | 2022-10-06 | Samsung Electronics Co., Ltd. | Electronic device and control method thereof |
| CN115964496A (zh) * | 2023-02-13 | 2023-04-14 | 中国工商银行股份有限公司 | 交流平台的敏感文本智能检测方法和装置 |
| CN116089582A (zh) * | 2023-01-05 | 2023-05-09 | 长城汽车股份有限公司 | 一种智能问答方法、装置、系统、设备及车辆 |
| CN117056503A (zh) * | 2023-07-20 | 2023-11-14 | 杭州阿里巴巴飞天信息技术有限公司 | 文本处理方法、电子设备以及计算机可读存储介质 |
Family Cites Families (5)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN108228704B (zh) * | 2017-11-03 | 2021-07-13 | 创新先进技术有限公司 | 识别风险内容的方法及装置、设备 |
| CN111222316B (zh) * | 2020-01-03 | 2023-08-29 | 北京小米移动软件有限公司 | 文本检测方法、装置及存储介质 |
| CN111738011A (zh) * | 2020-05-09 | 2020-10-02 | 完美世界(北京)软件科技发展有限公司 | 违规文本的识别方法及装置、存储介质、电子装置 |
| CN113808616A (zh) * | 2021-09-16 | 2021-12-17 | 平安银行股份有限公司 | 语音合规检测方法、装置、设备及存储介质 |
| CN116414951B (zh) * | 2021-12-29 | 2025-10-21 | 腾讯科技(深圳)有限公司 | 智能对话方法、模型训练方法、装置、存储介质及设备 |
-
2023
- 2023-07-20 CN CN202310899581.6A patent/CN117056503A/zh active Pending
-
2024
- 2024-07-19 WO PCT/CN2024/106517 patent/WO2025016455A1/zh active Pending
Patent Citations (7)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN107610740A (zh) * | 2017-07-27 | 2018-01-19 | 康美健康云服务有限公司 | 用于医疗的语义分析方法、电子设备、存储介质以及系统 |
| CN110968663A (zh) * | 2018-09-30 | 2020-04-07 | 北京国双科技有限公司 | 一种问答系统的答案展示方法及装置 |
| US20220318512A1 (en) * | 2021-03-30 | 2022-10-06 | Samsung Electronics Co., Ltd. | Electronic device and control method thereof |
| CN114860910A (zh) * | 2022-05-12 | 2022-08-05 | 阿里巴巴(中国)有限公司 | 智能对话方法及系统 |
| CN116089582A (zh) * | 2023-01-05 | 2023-05-09 | 长城汽车股份有限公司 | 一种智能问答方法、装置、系统、设备及车辆 |
| CN115964496A (zh) * | 2023-02-13 | 2023-04-14 | 中国工商银行股份有限公司 | 交流平台的敏感文本智能检测方法和装置 |
| CN117056503A (zh) * | 2023-07-20 | 2023-11-14 | 杭州阿里巴巴飞天信息技术有限公司 | 文本处理方法、电子设备以及计算机可读存储介质 |
Also Published As
| Publication number | Publication date |
|---|---|
| CN117056503A (zh) | 2023-11-14 |
Similar Documents
| Publication | Publication Date | Title |
|---|---|---|
| US12375432B2 (en) | Chat management system | |
| US11514250B2 (en) | Computer-based interlocutor understanding using classifying conversation segments | |
| US12578922B2 (en) | Natural language processing platform for automated event analysis, translation, and transcription verification | |
| US11038821B1 (en) | Chatbot artificial intelligence | |
| CN114120978B (zh) | 情绪识别模型训练、语音交互方法、装置、设备及介质 | |
| US11206227B2 (en) | Customer care training using chatbots | |
| WO2020062006A1 (en) | Intent and context-aware dialogue based virtual assistance | |
| WO2022095380A1 (zh) | 基于ai的虚拟交互模型生成方法、装置、计算机设备及存储介质 | |
| CN112732911A (zh) | 基于语义识别的话术推荐方法、装置、设备及存储介质 | |
| WO2025016455A1 (zh) | 文本处理方法、电子设备以及计算机可读存储介质 | |
| US10950223B2 (en) | System and method for analyzing partial utterances | |
| US11294752B2 (en) | Virtual agent corrections via log analysis | |
| CN110110062A (zh) | 机器智能问答方法、装置与电子设备 | |
| US10685655B2 (en) | Leveraging natural language processing | |
| US20240303439A1 (en) | Intent discovery using natural language inference | |
| CN116383027B (zh) | 人机交互的数据处理方法及服务器 | |
| US20190050909A1 (en) | Server and method for configuring a chatbot | |
| CN118886519A (zh) | 模型训练方法、数据处理方法、电子设备及存储介质 | |
| CN118860216A (zh) | 对话处理方法、电子设备及计算机可读存储介质 | |
| Raju et al. | Advancing AI-Driven Customer Service with NLP: A Novel Bert-Based Model for Automated Responses | |
| CN117933204A (zh) | 舆情处理方法、装置、设备、介质和程序产品 | |
| CN116303951A (zh) | 对话处理方法、装置、电子设备和存储介质 | |
| CN112148864B (zh) | 语音交互方法、装置、计算机设备和存储介质 | |
| CN115269830A (zh) | 异常文本检测模型训练方法、异常文本检测方法及装置 | |
| CN115203381A (zh) | 营销话术推荐系统、方法、装置及设备 |
Legal Events
| Date | Code | Title | Description |
|---|---|---|---|
| 121 | Ep: the epo has been informed by wipo that ep was designated in this application |
Ref document number: 24842441 Country of ref document: EP Kind code of ref document: A1 |
|
| NENP | Non-entry into the national phase |
Ref country code: DE |