Text processing method, device and equipment

By matching the cultural background and social value information of user problems and generating reply text using pre-trained text generation models, the problem of existing models failing to consider cultural background and social values ​​is solved, achieving better user experience and cross-cultural applicability.

CN119557394APending Publication Date: 2025-03-04CHINA TELECOM ARTIFICIAL INTELLIGENCE TECHNOLOGY (BEIJING) CO LTD
View PDF 6 Cites 0 Cited by

Patent Information

Application Number
CN202411496056.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-10-24
Publication Date
2025-03-04

AI Technical Summary

Technical Problem

The existing text generation model fails to fully consider different cultural backgrounds and social values ​​when dealing with user problems, and may generate sensitive or inappropriate text content, affecting the user experience.

Method used

By receiving the problem description text of the user equipment, matching the corresponding cultural background and social value information, obtaining relevant interception information from the preset information database, and generating reply text using a pre-trained text generation model. Check whether the reply text meets this information and returns it to the user device if it does not.

Benefits of technology

It effectively avoids the generation of sensitive or inappropriate text content, improves the user experience, and improves the applicability of the model in cross-cultural context and social values ​​application scenarios.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119557394A_ABST
    Figure CN119557394A_ABST
Patent Text Reader

Abstract

The invention provides a text processing method, device and equipment, and belongs to the technical field of artificial intelligence, and the method comprises the steps: receiving a question description text from user equipment; the question description text is matched with first information in a pre-established information base, the first information successfully matched with the question description text is determined as second information, and the first information comprises different cultural backgrounds and social value views; the information base comprises different cultural backgrounds and social values and associated preset interception information; generating a question reply text according to the question description text through a pre-trained text generation model; obtaining preset interception information associated with the second information from an information base, and detecting whether the question reply text represents the obtained preset interception information or not; and under the condition that the question reply text does not represent the acquired preset interception information, returning the question reply text to the user equipment.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of artificial intelligence technology, and in particular to a text processing method, device and equipment. Background Art

[0002] The big model can process large amounts of data based on deep learning technology and learn complex patterns and relationships from it. It is widely used in scenarios such as intelligent question answering. The text generation model trained based on the big model can automatically generate question response text based on the question description text sent by the user's device, thereby achieving quick answers to user questions.

[0003] However, current text generation models often fail to fully consider the differences in cultural backgrounds and social values, and may generate sensitive or inappropriate text content, thus affecting user experience. Summary of the invention

[0004] In view of the above problems, the embodiments of the present application provide a text processing method, apparatus and device to overcome the above problems or at least partially solve the above problems.

[0005] In a first aspect of an embodiment of the present application, a text processing method is provided, the method comprising: Receiving a text description of the problem from a user device; Matching the problem description text with each first information in a pre-established information database, and determining the first information successfully matching the problem description text as the second information, wherein each first information includes: different cultural backgrounds and social values, and the information database includes: the different cultural backgrounds and social values ​​and the associated preset interception information; Generate a question response text according to the question description text by using a pre-trained text generation model; Acquire preset interception information associated with the second information from the information database, and detect whether the question reply text represents the acquired preset interception information; In the case that the question reply text does not characterize the acquired preset interception information, the question reply text is returned to the user equipment.

[0006] As a possible implementation, the step of generating a question reply text according to the question description text by using a pre-trained text generation model includes: Identify the professional field associated with the problem description text; Based on the professional field associated with the problem description text, determine the target text generation model associated with the problem description text from pre-trained text generation models associated with different professional fields, each of the text generation models having the ability to generate text based on professional terms in the associated professional field; The question description text is input into the target text generation model to obtain the question answer text.

[0007] As a possible implementation, a text generation model associated with a single professional field is trained by the following steps: Acquire various data from a preset data source associated with the single professional field; Standardizing the professional terms in each acquired data, wherein the standardization includes: unifying the expression of professional terms and unifying the definition of professional terms; Label the professional terms in each data after standardization; The large model associated with the single professional field is trained using the annotated data to obtain a text generation model associated with the single professional field.

[0008] As a possible implementation, the step of generating a question reply text according to the question description text by using a pre-trained text generation model includes: Randomly select a target text generation model from the pre-trained text generation models corresponding to different text styles; The question description text is input into the target text generation model to obtain the question answer text.

[0009] As a possible implementation, randomly selecting a target text generation model from pre-trained text generation models corresponding to different text styles includes: For the professional field associated with the question description text, obtaining historical user preference information of historical question reply texts of different text styles associated with the professional field; Determining the selection probabilities of the text generation models corresponding to the different text styles according to the acquired historical user preference information; Based on the determined selection probability, a target text generation model is randomly selected from the text generation models corresponding to the different text styles.

[0010] As a possible implementation manner, returning the question reply text to the user device includes: Determining grammatical rules associated with the question response text; Based on the grammatical rules associated with the question reply text, identifying and correcting grammatical errors in the question reply text; The corrected question reply text is returned to the user device.

[0011] As a possible implementation manner, returning the question reply text to the user device includes: Based on a pre-established knowledge graph, identifying and correcting text content in the question response text that does not conform to common sense and logical rules, the knowledge graph contains information on objects, events, and relationships between people that are used to represent common sense and logical rules; The corrected question reply text is returned to the user device.

[0012] As a possible implementation, the step of generating a question reply text according to the question description text by using a pre-trained text generation model includes: Input the problem description text into a pre-trained Transformer model to obtain a semantic representation; Input the problem description text into the pre-trained BERT model to obtain context information; The semantic representation and the context information are input into the text generation model to obtain the question response text.

[0013] According to a second aspect of the embodiments of the present application, a text processing device is provided, the device comprising: A text receiving module, used for receiving a problem description text from a user device; An information matching module is used to match the problem description text with each first information in a pre-established information database, and determine the first information successfully matched with the problem description text as the second information, wherein each first information includes: different cultural backgrounds and social values, and the information database includes: the different cultural backgrounds and social values ​​and the associated preset interception information; A text generation module, used to generate a question response text according to the question description text by using a pre-trained text generation model; An information detection module, used to obtain preset interception information associated with the second information from the information database, and detect whether the question reply text represents the obtained preset interception information; The text transmission module is used to return the question reply text to the user equipment when the question reply text does not represent the acquired preset interception information.

[0014] According to a third aspect of an embodiment of the present application, an electronic device is provided, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the program, the steps of the text processing method described in the first aspect are implemented.

[0015] According to a fourth aspect of an embodiment of the present application, a computer-readable storage medium is provided, on which a computer program / instruction is stored. When the computer program / instruction is executed by a processor, the steps of the text processing method described in the first aspect are implemented.

[0016] The embodiment of the present application includes the following advantages: the problem description text is matched with each first information in a pre-established information library to determine the cultural background and social values ​​matched by the problem description text. The question reply text is then detected using the preset interception information associated with the matched cultural background and social values, and the question reply text is returned to the user device if the question reply text does not characterize the acquired preset interception information. Thus, different cultural backgrounds and social value contents are introduced into the text processing process based on the information library to fully consider the differences in different cultural backgrounds and social values, and by setting detection for the question reply text against the relevant preset interception information, sensitive or inappropriate text content is avoided from being returned to the user device, thereby improving the user experience. BRIEF DESCRIPTION OF THE DRAWINGS

[0017] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings required for use in the description of the embodiments of the present application will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative labor.

[0018] Figure 1 is an implementation flow chart of a text processing method in an embodiment of the present application; Figure 2 is a schematic diagram of an implementation process of a text processing method in an embodiment of the present application; Figure 3 is a structural schematic diagram of a text processing device in an embodiment of the present application; Figure 4 It is a schematic diagram of an electronic device in an embodiment of the present application. DETAILED DESCRIPTION

[0019] In the following, in combination with the accompanying drawings, a text processing method, device and equipment provided by the embodiments of the present application are described in detail through some embodiments and their application scenarios.

[0020] First, refer to Figure 1 FIG. 1 is a flowchart of an implementation of a text processing method provided in an embodiment of the present application. The method may include the following steps: Step S11: receiving a problem description text from a user device.

[0021] In a specific implementation, an interface for inputting text is provided for the user device. For example, a relevant web page can be created in advance for the user device to access, and then the question description text input by the user device is received through the web page, such as receiving the relevant question description text for inquiring about the function and structure of a certain model.

[0022] Step S12: Match the problem description text with each first information in a pre-established information database, and determine the first information that successfully matches the problem description text as the second information, wherein each first information includes: different cultural backgrounds and social values, and the information database includes: the different cultural backgrounds and social values ​​and their associated preset interception information.

[0023] In the specific implementation, an information database is pre-established and maintained, and the information database is used to store different cultural backgrounds and social values ​​and their associated preset interception information. The preset interception information contains preset text content or related sensitive topics that do not conform to the relevant cultural background or social values.

[0024] After receiving the problem description text, the problem description text can be matched with each first information in a pre-established information database based on keyword search, user device location detection, and text language detection.

[0025] For example, you can search whether there are keywords related to specific cultural backgrounds and social values ​​in the problem description text, such as searching whether there are keywords related to specific religions in the problem description text, to determine the cultural background and social values ​​(i.e., the second information) that match the problem description text.

[0026] For another example, it may be detected whether the user device is located in a location area associated with a specific cultural background and social values, so as to determine the cultural background and social values ​​matched by the question description text.

[0027] For another example, it may be detected whether the problem description text uses language related to a specific cultural background and social values ​​to determine the cultural background and social values ​​that the problem description text matches.

[0028] Step S13: Generate question response text according to the question description text using a pre-trained text generation model.

[0029] In a specific implementation, the text generation model can be obtained by pre-training a large model such as a Generative Pre-trained Transformer (GPT) model.

[0030] After the question description text is input into the text generation model, the text generation model will automatically generate a corresponding question reply text according to the question description text.

[0031] For example, after inputting a question description text for inquiring about the function and structure of a certain model into the text generation model, the text generation model will automatically generate a response text for answering the relevant questions about the function and structure of this type of model based on the question description text.

[0032] Step S14: obtaining preset interception information associated with the second information from the information database, and detecting whether the question reply text represents the obtained preset interception information.

[0033] During specific implementation, code can be written in advance to create a content detector and a sensitive topic detector. The content detector is used to detect whether there is preset text content in the question response text that does not conform to the relevant cultural background or social values ​​based on keyword search and other methods; the sensitive topic detector is used to detect whether the question response text involves sensitive topics of relevant cultural background or social values ​​based on topic analysis and other methods.

[0034] Then, when it is detected that the question reply text contains the preset text content or involves the sensitive topic, it is determined that the question reply text represents the preset interception information obtained; when it is detected that the question reply text does not contain the preset text content and does not involve the sensitive topic, it is determined that the question reply text does not represent the preset interception information obtained.

[0035] It can be understood that this application introduces different cultural backgrounds and social values ​​into the text processing process based on the information database, so as to fully consider the differences in different cultural backgrounds and social values, and set up detection of relevant preset interception information for question reply texts to enhance the sensitivity of the cultural background and social values ​​of the text content generated by the model during the text processing process, thereby avoiding returning sensitive or inappropriate text content to the user device, thereby improving the user experience and enhancing the applicability of the text content generated by the model in application scenarios with cross-cultural backgrounds and cross-social values ​​(such as multi-language and multi-regional application scenarios).

[0036] Step S15: When the question reply text does not represent the acquired preset interception information, the question reply text is returned to the user device.

[0037] In a specific implementation, when the question reply text does not represent the acquired preset interception information, it means that the text content of the question reply text conforms to the relevant cultural background and social values ​​and does not involve relevant sensitive topics. Therefore, the question reply text can be directly returned to the user device.

[0038] In the case where the question reply text represents the acquired preset interception information, it means that the text content of the question reply text does not conform to the relevant cultural background or social values, or the question reply text involves relevant sensitive topics.

[0039] At this time, the representation information of the preset interception information can be first deleted from the question reply text, for example, the sentences or paragraphs involving the relevant sensitive topics can be first deleted from the question reply text, and then the question reply text after the representation information of the preset interception information is deleted is returned to the user device; alternatively, a reply text can be generated to represent a refusal to answer the relevant question, and the reply text can be returned to the user device.

[0040] Using the technical solution of the embodiment of the present application, the question description text is matched with each first information in a pre-established information library to determine the cultural background and social values ​​matched by the question description text. Then, the preset interception information associated with the matched cultural background and social values ​​is used to detect the question reply text, and if the question reply text does not characterize the acquired preset interception information, the question reply text is returned to the user device. Thus, different cultural backgrounds and social value contents are introduced into the text processing process based on the information library to fully consider the differences in different cultural backgrounds and social values, and by setting the detection of the question reply text for the relevant preset interception information, sensitive or inappropriate text content is avoided from being returned to the user device, thereby improving the user experience.

[0041] As a possible implementation, the step of generating a question reply text according to the question description text by using a pre-trained text generation model includes: Identify the professional field associated with the problem description text; Based on the professional field associated with the problem description text, determine the target text generation model associated with the problem description text from pre-trained text generation models associated with different professional fields, each of the text generation models having the ability to generate text based on professional terms in the associated professional field; The question description text is input into the target text generation model to obtain the question answer text.

[0042] In specific implementation, the professional field associated with the problem description text may be identified by detecting whether there are keywords related to the professional field (such as law, medicine, or communication, etc.) in the problem description text.

[0043] Alternatively, the user device may be asked about the professional field associated with the question description text, and then the professional field associated with the question description text may be identified based on the reply content of the user device.

[0044] For example, the professional fields associated with each pre-trained text generation model can be displayed to the user device in advance, and the user (i.e., the user device) can be prompted to select the relevant professional field based on the question he or she wants to ask; after the user selects a professional field, the user is prompted to enter a question description text, thereby determining the professional field associated with the question description text.

[0045] For another example, after the user inputs a question description text, the professional field associated with the question description text can be automatically identified first; if the automatic identification of the professional field fails, the user is prompted to enter the professional field associated with the question description text, and then the professional field associated with the question description text is identified based on the user's reply content.

[0046] After identifying the professional field associated with the question description text, the text generation model associated with the professional field (i.e., the target text generation model) can be used to generate a question response text for the question description text based on the professional terminology of the professional field. This can improve the professionalism and technicality of the question response text and make the question response text generated by the model more in line with the professional style of the associated professional field.

[0047] Optionally, a text generation model associated with a single professional field is trained by the following steps: Step S21: Acquire various data from a preset data source associated with the single professional field.

[0048] In specific implementations, considering that the model may generate information that appears reasonable but is in fact inaccurate or untrue, this application restricts the source of data used for model training based on preset data sources.

[0049] For example, official databases, academic research, and industry reports can be used as the preset data source to ensure that the source of the data used for model training has a certain degree of authority and credibility, thereby ensuring the accuracy and authenticity of the content generated by the model.

[0050] Optionally, after acquiring the various data, the various data may be cleaned and preprocessed first, such as removing erroneous data and duplicate data in the various data, checking data consistency, and processing invalid data and missing values, etc., to improve data quality.

[0051] Step S22: standardizing the professional terms in each acquired data, wherein the standardization includes: unifying the expression of professional terms and unifying the definition of professional terms.

[0052] In specific implementation, a professional terminology library may be established in advance for the single professional field, and the professional terminology library is used to store the expressions and definitions of professional terms.

[0053] Then, based on the expressions and definitions of professional terms in the professional terminology library, the professional terms in the various data are standardized to reduce ambiguity, thereby ensuring the accuracy of the information of the professional terms used in model training.

[0054] Step S23: marking the professional terms in each data after the standardization process.

[0055] In specific implementation, the professional terms in the various data may be automatically identified and labeled based on the professional term library.

[0056] Optionally, professionals in the single professional field may also check the automatically labeled data to avoid incorrect or missed labeling of professional terms, thereby ensuring the accuracy and completeness of the information of the professional terms used in model training.

[0057] Step S24: Use the annotated data to train the large model associated with the single professional field to obtain a text generation model associated with the single professional field.

[0058] In specific implementation, the labeled data is used to train the large model (such as the GPT model) associated with the single professional field. When the model reaches the training end condition, such as when the model training times reaches the set number of iterations, or when the model accuracy reaches the set accuracy requirement, the model training ends. Then, the model obtained at the end of the model training is used as the text generation model associated with the single professional field.

[0059] In this embodiment, a text generation model for a specific professional field is trained using data from a specific professional field, thereby avoiding interference between data from different professional fields and between training models, so that the text generated by the trained text generation model can be more in line with the professional style of the relevant professional field.

[0060] As a possible implementation, the step of generating a question reply text according to the question description text by using a pre-trained text generation model includes: Randomly select a target text generation model from the pre-trained text generation models corresponding to different text styles; The question description text is input into the target text generation model to obtain the question answer text.

[0061] In the specific implementation, text generation models corresponding to different text styles are pre-trained. For example, the text generation model associated with a single professional field obtained by the above training can be used as the model to be adjusted. By setting reward functions for different text styles (i.e., the characteristics of the expression in the text, such as language style, tone, emotion, etc.), the parameters of the model to be adjusted are adjusted respectively, thereby obtaining multiple text generation models. It can be understood that the multiple text generation models use different text styles to generate text.

[0062] Then, a text generation model is randomly selected from the multiple text generation models (i.e., the text generation models corresponding to different text styles) as the target text generation model, and the question description text is input into the target text generation model to obtain a question response text that conforms to the text style corresponding to the target text generation model.

[0063] In this implementation, the present application introduces text generation models corresponding to different text styles and randomly selects a model to generate question response text, which can improve the innovation and diversity of question response text, thereby helping to enhance user experience.

[0064] Optionally, randomly selecting a target text generation model from pre-trained text generation models corresponding to different text styles includes: Step S31: for the professional field associated with the question description text, obtain historical user preference information of historical question reply texts of different text styles associated with the professional field.

[0065] In specific implementation, it is possible to detect whether there are keywords related to professional fields (such as law, medicine, or communications, etc.) in the question description text, or to inquire the user device about the professional field associated with the question description text to identify the professional field associated with the question description text.

[0066] After the professional field associated with the question description text is identified, historical user preference information of each historical question reply text associated with the professional field is obtained.

[0067] For example, the historical user scores of each historical question reply text may be obtained, and the historical user scores are used to quantify the historical user's preference for the relevant historical question reply text. Then, the historical user scores of each historical question reply text are summarized according to the text style, and the sum of the historical user scores corresponding to the historical question reply texts with different text styles is obtained, and the sum of the historical user scores is used as the historical user preference information.

[0068] Step S32: determining the selection probability of the text generation models corresponding to the different text styles according to the acquired historical user preference information.

[0069] In specific implementation, a text generation model corresponding to a text style with a higher degree of historical user preference (for example, a larger total number of historical user scores) is given a greater probability of being selected, so as to increase the probability of being selected as the target text generation model.

[0070] For the text generation model corresponding to the text style with a lower historical user preference (for example, the smaller the total historical user score), a smaller selection probability is determined to reduce the probability of it being selected as the target text generation model.

[0071] Step S33: Based on the determined selection probability, a target text generation model is randomly selected from the text generation models corresponding to the different text styles.

[0072] In a specific implementation, based on the determined selection probabilities, weighted random selection is performed on the text generation models corresponding to the different text styles.

[0073] For example, based on the selection probabilities of the text generation models corresponding to the different text styles, the set interval is divided into a plurality of subintervals to obtain subintervals associated with the text generation models corresponding to the different text styles, wherein the size of the subinterval is positively correlated with the size of the selection probability. Then, a random number is generated within the set interval, and the text generation model associated with the subinterval to which the random number belongs is determined as the target text generation model.

[0074] In this embodiment, the target text generation model is randomly selected by combining historical user preference information. Therefore, while ensuring the innovation and diversity of the question response text, more question response texts associated with text styles that are more in line with user preferences in relevant professional fields can be presented to users, which is conducive to further improving the user experience.

[0075] As a possible implementation manner, returning the question reply text to the user device includes: Determining grammatical rules associated with the question response text; Based on the grammatical rules associated with the question reply text, identifying and correcting grammatical errors in the question reply text; The corrected question reply text is returned to the user device.

[0076] In a specific implementation, the language type (such as natural language type or programming language type, etc.) used by the question reply text is identified, and then, based on the language type used by the question reply text, the grammatical rules associated with the question reply text are obtained from a pre-established grammatical rule library associated with each of the different language types.

[0077] Then, based on the grammatical rules associated with the question reply text, grammatical errors in the question reply text are identified and corrected to ensure that the question reply text returned to the user device has a high degree of grammatical standardization.

[0078] For example, based on the grammatical rules, code can be pre-written to establish a grammar checker and a grammar corrector, wherein the grammar checker is used to detect whether there are grammatical errors in the question reply text based on keyword matching and other methods, and to identify the type and location of the existing grammatical errors; the grammar corrector is used to query the repair means for the relevant grammatical error types in a preset repair processing library based on the inspection results of the grammar checker, and to correct the grammatical errors in the question reply text based on the repair means, and finally return the corrected question reply text to the user device.

[0079] As a possible implementation manner, returning the question reply text to the user device includes: Based on a pre-established knowledge graph, identifying and correcting text content in the question response text that does not conform to common sense and logical rules, the knowledge graph contains information on objects, events, and relationships between people that are used to represent common sense and logical rules; The corrected question reply text is returned to the user device.

[0080] In the specific implementation, a knowledge graph is pre-established to store information about the relationships between objects, events, and people that represent common sense and logical rules (such as causal inference, time sequence, event sequence, and causal connectives, etc.).

[0081] Subsequently, with reference to the information stored in the knowledge graph, the text content in the question reply text that does not conform to common sense and logical rules is identified and corrected, thereby avoiding common sense errors or logical errors (such as logical jumps or contradictions) in the question reply text returned to the user device, thereby ensuring the rationality and logical coherence of the text content.

[0082] As a possible implementation, the step of generating a question reply text according to the question description text by using a pre-trained text generation model includes: Input the problem description text into a pre-trained Transformer model to obtain a semantic representation; Input the problem description text into the pre-trained BERT model to obtain context information; The semantic representation and the context information are input into the text generation model to obtain the question response text.

[0083] In this implementation, with the help of the semantic representation conversion capability of the Transformer model and the context extraction capability of the BERT model, the text generation model's ability to understand the semantics and context of the question description text can be enhanced, avoiding problems such as incoherence or mismatch with expectations in the generated text content due to the difficulty of the text generation model to accurately understand the semantics and context of the input text, thereby improving the accuracy of the question response text generated by the model.

[0084] For example, refer to Figure 2 The schematic diagram of the implementation process of the text processing method shown in FIG. 1 includes the following steps: 1. Improve the accuracy and authenticity of the information introduced into the model.

[0085] In this step, we first select official databases, academic research, and industry reports as preset data sources to collect data from different professional fields to ensure that the source of the data has a certain degree of authority and credibility.

[0086] Then, the collected data is processed, including: checking the consistency of the data, handling erroneous data, duplicate data, invalid data and missing values, and standardizing professional terms in different professional fields (such as unifying the expression and definition of professional terms) to reduce ambiguity.

[0087] The professional terms in the processed data are then labeled, and the usage scenarios, related relationships and semantic meanings of the relevant professional terms in specific contexts can be annotated.

[0088] Finally, the labeled data is used as training data to be applied to the training of related models, such as the training of text generation models, as well as the training of the above-mentioned Transformer model and the above-mentioned BERT model.

[0089] It should be noted that considering that large models rely on large-scale data training, but the source and authenticity of these data have not been strictly reviewed, the text content generated by the model may be inaccurate or even wrong, and such situations are more likely to occur when it comes to professional fields.

[0090] This application screens credible data sources (such as official databases, academic and literature, industry reports, etc.), cleans and standardizes the data collected from the credible data sources, and then uses the processed data to train the model, which is beneficial to improve the accuracy and reliability of the text content generated by the model and greatly reduces the risk of information errors.

[0091] 2. Improve the professionalism and technicality of text content.

[0092] In this step, multiple large models are trained separately using data from different professional fields to obtain text generation models associated with different professional fields. This can avoid interference between data from different professional fields and between training models, so that the text generated by the trained text generation model can be more in line with the professional style of the relevant professional field, thereby improving the professionalism and technicality of the text generated by the model.

[0093] 3. Improve the semantic understanding and context grasping capabilities of large models.

[0094] In this step, the pre-trained Transformer model and BERT model are used to obtain semantic representation and contextual information for the question description text, so that the semantic representation and contextual information can be subsequently input into the text generation model (i.e., the pre-trained large model) to generate question response text. This can improve the semantic understanding and context grasping capabilities of the large model, thereby improving the content accuracy of the text generated by the model.

[0095] 4. Promote the innovation and diversity of text content.

[0096] In this step, a target text generation model is randomly selected from the pre-trained text generation models corresponding to different text styles, and the semantic representation and context information obtained above are input into the target text generation model to generate question response text, which can improve the content diversity and competitiveness of the question response text.

[0097] Optionally, the target text generation model may be selected in combination with historical user preference information to better meet the needs of different users or scenarios.

[0098] 5. Improve the rationality and logic of text content.

[0099] In this step, a knowledge graph is constructed to store information about objects, events, and relationships between people that characterize common sense and logical rules (such as causal inference rules, time sequence, event sequence, and causal connectives, etc.). Then, based on the knowledge graph, the text content in the question reply text that does not conform to common sense and logical rules is identified and corrected to improve the rationality and logic of the text content.

[0100] Optionally, the knowledge graph can also be used as training data for application in model training, so that the large model can learn common sense and have the ability of logical reasoning, which can help the model generate text content that is more in line with common sense and actual logic when describing events, explaining phenomena or inferring conclusions.

[0101] 6. Improve the grammatical standardization of text content.

[0102] In this step, grammatical errors in the question response text (such as the question response text corrected based on common sense and logical rules) are identified and corrected by integrating a grammar checker or a grammar corrector, thereby ensuring the grammatical standardization of the question response text.

[0103] 7. Strengthen cultural and social sensitivity in text processing.

[0104] In this step, different cultural backgrounds and social values ​​are introduced into the text processing process based on the information database to fully consider the differences in different cultural backgrounds and social values. By setting detection for relevant preset interception information for the question response text (such as the question response text corrected based on grammatical rules), the sensitivity of the text processing process to the cultural background and social values ​​of the text content generated by the model can be enhanced, thereby avoiding returning sensitive or inappropriate text content to the user device. This can improve the applicability of the text content generated by the model in application scenarios with cross-cultural backgrounds and cross-social values.

[0105] Based on the above embodiments, the text processing method provided by the present application can make the generated text content more natural and fluent by utilizing a large model to learn and understand complex language knowledge. This naturalness makes the generated text closer to the level of human writing, reducing the stiffness in the translation or generation process; and data from trusted data sources such as official databases, academic research, and industry reports are introduced into model training, so that the text generation model can incorporate rich and accurate professional knowledge when generating text content, thereby making the generated text content more profound and informative.

[0106] In addition, by using data from different professional fields to train multiple large models separately, interference between data and training models from different professional fields can be avoided, so that the text generated by the trained text generation model can be more in line with the professional style of the relevant professional field; using the pre-trained Transformer model and BERT model to obtain semantic representation and context information for the question description text can improve the semantic understanding and context grasping ability of the text generation model, thereby improving the accuracy of the text content generated by the model; by introducing text generation models corresponding to different text styles, the diversity and competitiveness of the text content can be improved; by introducing the knowledge graph, the text content in the question response text that does not conform to common sense and logical rules can be identified and corrected. It can improve the rationality and logic of text content, and based on the knowledge graph, enable the large model to learn common sense and have the ability of logical reasoning, which can help the model generate text content that is more in line with common sense and actual logic when describing events, explaining phenomena or inferring conclusions; by integrating a grammar checker or grammar corrector to identify and correct grammatical errors in question reply texts, it can ensure that the question reply texts meet the grammatical norms of professional fields; based on the information database, different cultural backgrounds and social values ​​are introduced into the text processing process, and by setting detection of relevant preset interception information for question reply texts, it can avoid returning sensitive or inappropriate text content to user devices, thereby improving the applicability of the text content generated by the model in application scenarios with cross-cultural backgrounds and cross-social values.

[0107] It should be noted that in actual application, training data can be flexibly selected based on actual user needs. For example, training data can be flexibly selected from data in the above-mentioned knowledge graph, professional field data carrying professional terminology, data in different text styles, data that conforms to cultural background and social values, and data in the above-mentioned information database, so as to perform personalized training on the large model, so that it can generate text content that is more in line with user preferences and specific scenario requirements, thereby improving user experience.

[0108] For the method embodiments, for the sake of simplicity, they are all described as a series of action combinations, but those skilled in the art should be aware that the embodiments of the present application are not limited by the order of the actions described, because according to the embodiments of the present application, some steps can be performed in other orders or simultaneously. Secondly, those skilled in the art should also be aware that the embodiments described in the specification are all preferred embodiments, and the actions involved are not necessarily required by the embodiments of the present application.

[0109] Second, Figure 3 : is a structural schematic diagram of a text processing device according to an embodiment of the present application, the device comprising: A text receiving module 310 is used to receive a problem description text from a user device; An information matching module 320 is used to match the problem description text with each first information in a pre-established information database, and determine the first information successfully matched with the problem description text as the second information, wherein each first information includes: different cultural backgrounds and social values, and the information database includes: the different cultural backgrounds and social values ​​and the associated preset interception information; A text generation module 330 is used to generate a question response text according to the question description text by using a pre-trained text generation model; An information detection module 340 is used to obtain preset interception information associated with the second information from the information database, and detect whether the question reply text represents the obtained preset interception information; The text transmission module 350 is configured to return the question reply text to the user device if the question reply text does not represent the acquired preset interception information.

[0110] Using the technical solution of the embodiment of the present application, the question description text is matched with each first information in a pre-established information library to determine the cultural background and social values ​​matched by the question description text. Then, the preset interception information associated with the matched cultural background and social values ​​is used to detect the question reply text, and if the question reply text does not characterize the acquired preset interception information, the question reply text is returned to the user device. Thus, different cultural backgrounds and social value contents are introduced into the text processing process based on the information library to fully consider the differences in different cultural backgrounds and social values, and by setting the detection of the question reply text for the relevant preset interception information, sensitive or inappropriate text content is avoided from being returned to the user device, thereby improving the user experience.

[0111] Optionally, the text generation module 330 includes: A first generation module is used to identify the professional field associated with the problem description text; A second generation module is used to determine a target text generation model associated with the problem description text from pre-trained text generation models associated with different professional fields based on the professional field associated with the problem description text, each of the text generation models having the ability to generate text based on professional terms in the associated professional field; The third generation module is used to input the question description text into the target text generation model to obtain the question response text.

[0112] Optionally, the device further comprises: A first training module is used to obtain various data from a preset data source associated with a single professional field; The second training module is used to standardize the professional terms in each acquired data, wherein the standardization includes: unifying the expression of professional terms and unifying the definition of professional terms; The third training module is used to label the professional terms in each data after standardization; The fourth training module is used to use the labeled data to train the large model associated with the single professional field to obtain a text generation model associated with the single professional field.

[0113] Optionally, the text generation module 330 includes: A fourth generation module is used to randomly select a target text generation model from pre-trained text generation models corresponding to different text styles; The fifth generation module is used to input the question description text into the target text generation model to obtain the question response text.

[0114] Optionally, the fourth generating module includes: A first generating submodule is used to obtain historical user preference information of historical question reply texts of different text styles associated with the professional field associated with the question description text; The second generation submodule is used to determine the selection probability of each text generation model corresponding to the different text styles according to the acquired historical user preference information; The third generation submodule is used to randomly select a target text generation model from the text generation models corresponding to the different text styles based on the determined selection probability.

[0115] Optionally, the text transmission module 350 includes: A first grammar checking module, used to determine the grammar rules associated with the question reply text; A second grammar checking module, used to identify and correct grammatical errors in the question reply text based on grammar rules associated with the question reply text; The third grammar checking module is used to return the corrected question reply text to the user device.

[0116] Optionally, the text transmission module 350 includes: A first common sense logic checking module is used to identify and correct text content in the question reply text that does not conform to common sense and logical rules based on a pre-established knowledge graph, wherein the knowledge graph contains information on objects, events, and relationships between people that are used to characterize common sense and logical rules; The second common sense logic checking module is used to return the corrected question reply text to the user device.

[0117] Optionally, the text generation module 330 includes: A sixth generation module is used to input the problem description text into a pre-trained Transformer model to obtain a semantic representation; A seventh generation module is used to input the problem description text into a pre-trained BERT model to obtain context information; An eighth generation module is used to input the semantic representation and the context information into the text generation model to obtain the question response text.

[0118] It should be noted that the device embodiment is similar to the method embodiment, so the description is relatively simple, and the relevant parts can be referred to the method embodiment.

[0119] The present application also provides an electronic device, referring to Figure 4 , Figure 4 Schematic diagram of an electronic device proposed in an embodiment of the present application. Figure 4 As shown, the electronic device 100 includes: a memory 110 and a processor 120. The memory 110 and the processor 120 are connected via a bus communication. A computer program is stored in the memory 110. The computer program can be run on the processor 120 to implement the steps in the text processing method disclosed in the embodiment of the present application.

[0120] The embodiment of the present application also provides a computer-readable storage medium on which a computer program / instruction is stored. When the computer program / instruction is executed by a processor, the text processing method disclosed in the embodiment of the present application is implemented.

[0121] The embodiment of the present application also provides a computer program product, including a computer program / instruction, which, when executed by a processor, implements the text processing method disclosed in the embodiment of the present application.

[0122] The various embodiments in this specification are described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same or similar parts between the various embodiments can be referenced to each other.

[0123] Those skilled in the art will appreciate that the embodiments of the present application can be provided as methods, devices or computer program products. Therefore, the present application can adopt the form of a complete hardware embodiment, a complete software embodiment, or an embodiment in combination with software and hardware. Moreover, the present application can adopt the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.

[0124] The embodiments of the present application are described with reference to the flowcharts and / or block diagrams of the methods, systems, devices, storage media, and program products according to the embodiments of the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing terminal device to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing terminal device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.

[0125] These computer program instructions may also be stored in a computer readable memory capable of directing a computer or other programmable data processing terminal device to operate in a specific manner, so that the instructions stored in the computer readable memory produce a manufactured product including an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.

[0126] These computer program instructions can also be loaded onto a computer or other programmable data processing terminal device so that a series of operating steps are executed on the computer or other programmable terminal device to produce a computer-implemented process, thereby providing instructions for implementing the process in the computer or other programmable terminal device. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.

[0127] Although the preferred embodiments of the present application have been described, those skilled in the art may make additional changes and modifications to these embodiments once they have learned the basic creative concept. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments and all changes and modifications that fall within the scope of the embodiments of the present application.

[0128] Finally, it should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or terminal device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or terminal device. In the absence of further restrictions, the elements defined by the sentence "including one..." do not exclude the existence of other identical elements in the process, method, article or terminal device including the elements.

[0129] The above is a detailed introduction to a text processing method, device and equipment provided by the present application. Specific examples are used in this article to illustrate the principles and implementation methods of the present application. The description of the above embodiments is only used to help understand the method of the present application and its core idea. At the same time, for general technical personnel in this field, according to the idea of ​​the present application, there will be changes in the specific implementation method and application scope. In summary, the content of this specification should not be understood as a limitation on the present application.

Claims

1. A text processing method, characterized in that: The method comprises: Receiving a text description of the problem from a user device; Matching the problem description text with each first information in a pre-established information database, and determining the first information successfully matching the problem description text as the second information, wherein each first information includes: different cultural backgrounds and social values, and the information database includes: the different cultural backgrounds and social values ​​and the associated preset interception information; Generate a question response text according to the question description text by using a pre-trained text generation model; Acquire preset interception information associated with the second information from the information database, and detect whether the question reply text represents the acquired preset interception information; In the case that the question reply text does not characterize the acquired preset interception information, the question reply text is returned to the user equipment.

2. The method according to claim 1, characterized in that The step of generating a question reply text according to the question description text by using a pre-trained text generation model includes: Identify the professional field associated with the problem description text; Based on the professional field associated with the problem description text, determine the target text generation model associated with the problem description text from pre-trained text generation models associated with different professional fields, each of the text generation models having the ability to generate text based on professional terms in the associated professional field; The question description text is input into the target text generation model to obtain the question answer text.

3. The method according to claim 2, characterized in that The text generation model associated with a single professional field is trained through the following steps: Acquire various data from a preset data source associated with the single professional field; Standardizing the professional terms in each acquired data, wherein the standardization includes: unifying the expression of professional terms and unifying the definition of professional terms; Label the professional terms in each data after standardization; The large model associated with the single professional field is trained using the annotated data to obtain a text generation model associated with the single professional field.

4. The method according to claim 1, characterized in that The step of generating a question reply text according to the question description text by using a pre-trained text generation model includes: Randomly select a target text generation model from the pre-trained text generation models corresponding to different text styles; The question description text is input into the target text generation model to obtain the question answer text.

5. The method according to claim 4, characterized in that The method of randomly selecting a target text generation model from pre-trained text generation models corresponding to different text styles includes: For the professional field associated with the question description text, obtaining historical user preference information of historical question reply texts of different text styles associated with the professional field; Determining the selection probabilities of the text generation models corresponding to the different text styles according to the acquired historical user preference information; Based on the determined selection probability, a target text generation model is randomly selected from the text generation models corresponding to the different text styles.

6. The method according to claim 1, characterized in that The step of returning the question reply text to the user device comprises: Determining grammatical rules associated with the question response text; Based on the grammatical rules associated with the question reply text, identifying and correcting grammatical errors in the question reply text; The corrected question reply text is returned to the user device.

7. The method according to claim 1, characterized in that The step of returning the question reply text to the user device comprises: Based on a pre-established knowledge graph, identifying and correcting text content in the question response text that does not conform to common sense and logical rules, the knowledge graph contains information on objects, events, and relationships between people that are used to represent common sense and logical rules; The corrected question reply text is returned to the user device.

8. The method according to any one of claims 1 to 7, characterized in that: The step of generating a question reply text according to the question description text by using a pre-trained text generation model includes: Input the problem description text into a pre-trained Transformer model to obtain a semantic representation; Input the problem description text into the pre-trained BERT model to obtain context information; The semantic representation and the context information are input into the text generation model to obtain the question response text.

9. A text processing device, characterized in that: The device comprises: A text receiving module, used for receiving a problem description text from a user device; An information matching module is used to match the problem description text with each first information in a pre-established information database, and determine the first information successfully matched with the problem description text as the second information, wherein each first information includes: different cultural backgrounds and social values, and the information database includes: the different cultural backgrounds and social values ​​and the associated preset interception information; A text generation module, used to generate a question response text according to the question description text by using a pre-trained text generation model; An information detection module, used to obtain preset interception information associated with the second information from the information database, and detect whether the question reply text represents the obtained preset interception information; The text transmission module is used to return the question reply text to the user equipment when the question reply text does not represent the acquired preset interception information.

10. An electronic device comprising a memory, a processor and a computer program stored in the memory, characterized in that: The processor executes the computer program to implement the text processing method according to any one of claims 1 to 8.

Citation Information

Patent Citations

  • Knowledge graph guidance-based fact correction method, system and equipment and medium

    CN115934954A

  • User-oriented intelligent customer service method and device, equipment and medium

    CN116521843A

  • Dialogue generation method and device, medium and computing equipment

    CN116541504A

  • Response text generation method and device, communication equipment and storage medium

    CN116644170A

  • Sensitive word filtering method and device, equipment and storage medium

    CN117312540A