Text processing method and related device
By performing intent recognition and logical relationship analysis on the first text expressing comments and opinions, and using historical conversation text for enhanced processing, the problem of poor usability of text expressing comments and opinions is solved, and the content is enriched and the effectiveness is improved.
Patent Information
- Application Number
- CN202510031472.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-01-08
- Publication Date
- 2025-09-23
AI Technical Summary
Texts expressing comments and opinions have poor usability due to their strong independence and wide range of scenarios. There is a lack of annotated corpus for specific scenarios, making them difficult to use effectively.
By performing intent recognition on the first text, historical conversation texts that have a semantic logical relationship with the first text are found, and these conversation texts are used to enhance the first text to obtain a third text to improve usability.
Through enhanced processing, the content of the first text becomes richer, improving its effectiveness in natural language processing tasks.
Smart Images

Figure CN120688514A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to text processing technology, and in particular to a text processing method and related devices. Background Art
[0002] Natural language processing (NLP) technology is widely used in text analysis, language modeling, machine translation, sentiment analysis, and other areas. With the development of technology, research in NLP has gradually expanded to a wider range of fields. For example, intent recognition, as a basic classification task, is widely used in various conversational scenarios.
[0003] In various usage scenarios of natural language processing technology, texts expressing comments and opinions are relatively independent and cover a wide range of scenarios. In specific scenarios, there is little available text material, which makes the usability of texts expressing comments and opinions relatively poor. Summary of the Invention
[0004] The embodiments of the present application provide a text processing method, device, electronic device, computer-readable storage medium, and computer program product, which can effectively enhance a first text expressing comments and opinions and improve the usability of the first text.
[0005] The technical solution of the embodiment of the present application is implemented as follows:
[0006] This embodiment of the present application provides a text processing method, the method comprising:
[0007] Intent recognition is performed on a first text used to express comments and opinions to obtain a first intention of the first text; the first text is generated in a first time period; based on the first intention, a reference text matching the first text is determined from a second text used to express comments and opinions; the second text is generated for a conversation text in a second time period; the second time period is earlier than the first time period; based on the semantic logical relationship between the conversation text in the second time period and the second text, a first conversation text having a logical relationship with the reference text is determined; the first text is enhanced based on the first conversation text to obtain a third text.
[0008] The present invention provides a text processing device, including:
[0009] An intention recognition module is used to recognize the intention of a first text used to express comments and opinions to obtain a first intention of the first text; the first text is generated in a first time period; a first determination module is used to determine, based on the first intention, a reference text that matches the first text from a second text used to express comments and opinions; the second text is generated for a conversation text in a second time period; the second time period is earlier than the first time period; a second determination module is used to determine a first conversation text that has a logical relationship with the reference text based on the semantic logical relationship between the conversation text in the second time period and the second text; an enhancement module is used to enhance the first text based on the first conversation text to obtain a third text.
[0010] An embodiment of the present application provides an electronic device, comprising:
[0011] a memory for storing computer-executable instructions;
[0012] The processor is used to implement the text processing method provided in the embodiment of the present application when executing the computer-executable instructions stored in the memory.
[0013] An embodiment of the present application provides a computer-readable storage medium storing a computer program or computer-executable instructions for implementing the text processing method provided in the embodiment of the present application when executed by a processor.
[0014] An embodiment of the present application provides a computer program product, including a computer program or computer-executable instructions. When the computer program or computer-executable instructions are executed by a processor, the text processing method provided in the embodiment of the present application is implemented.
[0015] The embodiments of the present application have the following beneficial effects:
[0016] Through the above embodiment, when it is necessary to enhance the first text generated in the first time period, the first text can be subjected to intent recognition to determine a reference text that matches the first intent of the first text in the second text generated in the second time period. Then, by directly utilizing the semantic logical relationship between the conversation text in the second time period and the second text, a first conversation text that has a logical relationship with the reference text is obtained. Since the intentions of the first text and the reference text match, and the first conversation text has a logical relationship with the reference text, the first conversation text also has a logical relationship with the first text. That is to say, the first conversation text is some conversation text that is strongly related to the first text in a logical relationship. In this way, after the first text is enhanced based on the first conversation text, the content of the first text can be enriched, and a third text with effectively enhanced text content can be obtained, thereby improving the usability of the first text. BRIEF DESCRIPTION OF THE DRAWINGS
[0017] Figure 1 This is a structural diagram of the text processing system architecture provided by an embodiment of the present application;
[0018] Figure 2 is a structural diagram of an electronic device provided in an embodiment of the present application;
[0019] Figure 3A Schematic diagram of the text processing method provided in the embodiment of the present application;
[0020] Figure 3B It is a flowchart of the method for determining the reference text provided in the embodiment of the present application. DETAILED DESCRIPTION
[0021] In order to make the purpose, technical solutions and advantages of this application clearer, the application will be further described in detail below with reference to the accompanying drawings. The described embodiments should not be regarded as limiting this application. All other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of this application.
[0022] In the following description, reference is made to “some embodiments”, which describes a subset of all possible embodiments, but it will be understood that “some embodiments” may be the same subset or different subsets of all possible embodiments and may be combined with each other without conflict.
[0023] In the following description, the terms "first\second\third" involved are merely used to distinguish similar objects and do not represent a specific ordering of the objects. It can be understood that "first\second\third" can be interchanged with a specific order or sequence where permitted, so that the embodiments of the present application described herein can be implemented in an order other than that illustrated or described herein.
[0024] In the embodiments of the present application, the term "module" or "unit" refers to a computer program or a part of a computer program that has a predetermined function and works together with other related parts to achieve a predetermined goal, and can be implemented in whole or in part by using software, hardware (such as processing circuits or memories) or a combination thereof. Similarly, a processor (or multiple processors or memories) can be used to implement one or more modules or units. In addition, each module or unit can be part of an overall module or unit that includes the function of the module or unit.
[0025] Unless otherwise defined, all technical and scientific terms used in the embodiments of the present application have the same meanings as those commonly understood by those skilled in the art. The terms used in the embodiments of the present application are only for the purpose of describing the embodiments of the present application and are not intended to limit the present application.
[0026] The relevant data collection and processing in the embodiments of this application should be strictly in accordance with the requirements of relevant national laws and regulations when applied in examples, and the informed consent or separate consent of the personal information subject should be obtained. Subsequent data use and processing should be carried out within the scope of authorization of laws and regulations and the personal information subject.
[0027] Before further describing the embodiments of the present application in detail, the nouns and terms involved in the embodiments of the present application are explained. The nouns and terms involved in the embodiments of the present application are subject to the following interpretations.
[0028] Natural language processing (NLP) is a technical field within artificial intelligence that aims to enable computers to understand and process human language. Natural language processing can encompass multiple aspects, including text analysis, language modeling, machine translation, and sentiment analysis. This technology can be used to build intelligent customer service bots that accurately understand user questions and provide relevant responses. When responding, the bots strive to keep the text concise to provide accurate and concise answers. Overall, the application of natural language processing technology enables computers to more intelligently understand and process human language, providing more accurate and efficient services.
[0029] Theoretical research and model exploration in natural language processing (NLP) technology are gradually expanding into a wider range of fields that are increasingly aligned with human intelligence. The problems involved are also gradually expanding from tasks such as word segmentation, semantic classification and matching, and question-answering. Both text recognition and text generation are showing a trend of increasing difficulty. Intent recognition, as a fundamental classification task, is widely used in various conversational scenarios.
[0030] Taking intent classification as an example, in the actual application scenarios of information feedback, the channels for information feedback usually include customer service calls and initiating comments. When classifying the intent of the text involved in information feedback, it can generally be divided into three types: the first is the intent of a single sentence in the conversation in the customer service call channel, the second is the intent of the entire conversation in the customer service call channel, and the third is the intent of the text posted by the user to express comments.
[0031] The first two types are more researched and more scenario-focused, and can rely on historical data, context, and other information for auxiliary judgment. However, compared to the first two types, text expressing comments and opinions is more independent and covers a wider range of scenarios. There is less labeled material for specific scenarios, resulting in poor usability of text expressing comments and opinions. In view of this, in order to improve the usability of text expressing comments and opinions, the embodiments of this application intend to use the logical relationships within the language to convert the labeled material in the conversation text into the labeled material of the text expressing comments and opinions, thereby achieving a method of enhancing the processing of text expressing comments and opinions by borrowing external conversation resources.
[0032] The embodiments of the present application provide a text processing method, apparatus, electronic device, computer-readable storage medium, and computer program product, which can effectively enhance a first text expressing comments and improve the usability of the first data.
[0033] See also Figure 1 , Figure 1 This is a schematic diagram of the architecture of a text processing system 100 provided in an embodiment of the present application. To support a text processing application, a terminal 401 is connected to a server 200 via a network 300. The network 300 may be a wide area network or a local area network, or a combination of the two.
[0034] Taking the first text expressing comments as an example, the terminal 401 is used to receive and respond to the processing instruction for the first text, and send a processing request for the first text to the server 200.
[0035] The server 200 is used to receive and respond to a processing request for a first text, perform intent recognition on the first text used to express comments and opinions, and obtain a first intent of the first text; the first text is generated in a first time period; based on the first intent, a reference text matching the first text is determined from a second text used to express comments and opinions; the second text is generated for the conversation text in a second time period; the second time period is earlier than the first time period; based on the semantic logical relationship between the conversation text in the second time period and the second text, a first conversation text having a logical relationship with the reference text is determined; the first text is enhanced based on the first conversation text to obtain a third text.
[0036] In some embodiments, after the server 200 enhances the first text to obtain the third text, it can actively send the third text to the terminal 401 so that the user can view and use the third text through the terminal 401. Of course, the terminal 401 can also actively obtain the third text from the server 200.
[0037] In some embodiments, the text processing method provided in the embodiments of the present application can be implemented by various electronic devices. For example, it can be implemented by the terminal 401 alone, or by the server 200 alone, or by the terminal 401 and the server 200 in collaboration.
[0038] In some embodiments, the terminal 401 can be implemented as various types of terminals such as a laptop computer, a tablet computer, a desktop computer, a set-top box, a smart phone, a smart speaker, a smart watch, a smart TV, a car terminal, etc.
[0039] In some embodiments, the server 200 may be an independent physical server, or a server cluster or distributed system composed of multiple physical servers. It may also be a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, content delivery networks (CDNs), and big data and artificial intelligence platforms. The terminal and the server may be connected directly or indirectly via wired or wireless communication, which is not limited in the embodiments of the present application.
[0040] See also Figure 2 , Figure 2 is a structural diagram of an electronic device 400 provided in an embodiment of the present application, Figure 2 The electronic device 400 shown includes: at least one processor 410, a memory 450, at least one network interface 420 and a user interface 430. The various components in the electronic device 400 are coupled together via a bus system 440. It is understood that the bus system 440 is used to achieve connection and communication between these components. In addition to including a data bus, the bus system 440 also includes a power bus, a control bus and a status signal bus. However, for the sake of clarity, the bus system 440 is not shown in FIG. Figure 2 Various buses are labeled as bus system 440 .
[0041] The processor 410 can be an integrated circuit chip with signal processing capabilities, such as a general-purpose processor, a digital signal processor (DSP), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc., where the general-purpose processor can be a microprocessor or any conventional processor, etc.
[0042] The user interface 430 includes one or more output devices 431 that enable presentation of media content, including one or more speakers and / or one or more visual display screens. The user interface 430 also includes one or more input devices 432, including user interface components that facilitate user input, such as a keyboard, mouse, microphone, touch screen display, camera, other input buttons and controls.
[0043] The memory 450 may be removable, non-removable, or a combination thereof. Exemplary hardware devices include solid-state memory, hard drives, optical drives, etc. The memory 450 may optionally include one or more storage devices that are physically remote from the processor 410.
[0044] The memory 450 includes volatile memory or non-volatile memory, or may include both volatile and non-volatile memory. The non-volatile memory may be a read-only memory (ROM), and the volatile memory may be a random access memory (RAM). The memory 450 described in the embodiments of the present application is intended to include any suitable type of memory.
[0045] In some embodiments, the memory 450 can store data to support various operations, examples of which include programs, modules, and data structures, or a subset or superset thereof, as exemplified below.
[0046] Operating system 451, including system programs for processing various basic system services and performing hardware-related tasks, such as the framework layer, core library layer, and driver layer, which are used to implement various basic services and process hardware-based tasks;
[0047] A network communication module 452 is used to reach other electronic devices via one or more (wired or wireless) network interfaces 420. Exemplary network interfaces 420 include Bluetooth, Wi-Fi, and Universal Serial Bus (USB);
[0048] a presentation module 453 for enabling presentation of information via one or more output devices 431 (e.g., a display screen, a speaker, etc.) associated with the user interface 430 (e.g., a user interface for operating peripheral devices and displaying content and information);
[0049] The input processing module 454 is configured to detect one or more user inputs or interactions from one of the one or more input devices 432 and to translate the detected inputs or interactions.
[0050] In some embodiments, the text processing device provided in the embodiments of the present application can be implemented in software. Figure 2 A text processing device 455 stored in memory 450 is shown. This device can be software in the form of a program or plug-in, and includes the following software modules: an intent recognition module 4551, a first determination module 4552, a second determination module 4553, and an enhancement module 4554. These modules are logical and can be arbitrarily combined or further separated according to the functions they implement. The functions of each module will be described below.
[0051] In other embodiments, the text processing device provided in the embodiments of the present application can be implemented in hardware. As an example, the text processing device provided in the embodiments of the present application can be a processor in the form of a hardware decoding processor, which is programmed to execute the text processing method provided in the embodiments of the present application. For example, the processor in the form of a hardware decoding processor can adopt one or more application-specific integrated circuits (ASICs), digital signal processors (DSPs), programmable logic devices (PLDs), complex programmable logic devices (CPLDs), field-programmable gate arrays (FPGAs) or other electronic components.
[0052] The text processing method provided by the embodiments of the present application will be described below with reference to the accompanying drawings. As previously mentioned, the electronic device implementing the text processing method of the embodiments of the present application can be terminal 401, server 200, or a combination of the two. Therefore, the execution entity of each step will not be repeatedly described below.
[0053] The text processing method of the embodiment of the present application is described by taking the execution subject as the server 200 as an example. Figure 3A , Figure 3A This is a flowchart of the text processing method provided by the embodiment of the present application, which will be combined with Figure 3A The steps shown are explained.
[0054] In step 101 , intent recognition is performed on a first text used to express a comment to obtain a first intent of the first text.
[0055] The first text is a text expressing comments and opinions generated in the first time period.
[0056] In actual implementation, since various online platforms support a variety of user commenting methods, users can directly enter text to comment, use images to comment, or even comment via voice. Therefore, in the embodiments of the present application, the method for obtaining the first text may include: directly extracting the text in the comment area to obtain the first text; performing text recognition on image-based comments in the comment area to obtain the first text; and performing voice recognition and text conversion on voice-based comments in the comment area to obtain the first text.
[0057] Because the first texts of each user-entered comment and opinion contain relatively little text information, and the amount of data covered by each platform for the first text is relatively small, directly using the first text to perform various natural language processing tasks in the corresponding specific scenarios may result in poor processing results for the natural language processing tasks. Therefore, the embodiments of the present application can enhance the first text to obtain a third text, and use the enhanced third text to perform various natural language processing tasks, which can improve the processing results of the natural language processing tasks.
[0058] In actual implementation, the trained intent recognition model may be called to perform intent recognition on the first text to obtain the first intent of the first text.
[0059] Here, the first intent is used to represent the intent expressed by the comments on the first text, for example, it can be various intents such as emotional intent, opinion intent, feedback intent, demand intent, etc. expressed by the comments.
[0060] Continue to see Figure 3A , continue with the above step 101 for explanation.
[0061] In step 102 , based on the first intention, a reference text matching the first text is determined from the second text used to express the review opinion.
[0062] Here, the second text is generated in response to the conversation text during the second time period; the second time period is earlier than the first time period. The second time period can be considered a historical period of the first time period. The second text is text generated during the second time period to express comments and opinions, and there is a logical relationship between the second text and the conversation text during the second time period. The conversation text is the conversation text generated during the second time period when users directly provide feedback on their needs through customer service calls or other means.
[0063] In some embodiments, Figure 3B This is a flow chart of a method for determining a reference text provided in an embodiment of the present application. Figure 3B , Figure 3A The illustrated step 102 can be implemented by following steps 1021 to 1023 .
[0064] In step 1021 , for each second text among the plurality of second texts used to express comments, intent recognition is performed on the second text to obtain a second intent of the second text.
[0065] In step 1022 , the first intent and the second intent are matched to obtain an intent matching degree.
[0066] In step 1023 , the second text whose intention matching degree exceeds the first matching degree threshold is determined as a reference text that matches the first intention of the first text.
[0067] In an embodiment of the present application, the second text may be a historical text expressing comments and opinions obtained in a historical natural language task within the second time period.
[0068] In actual implementation, the trained intent recognition model can be used to perform intent recognition on each of the multiple second texts to obtain the second intent corresponding to each second text. The intent recognition model is an important component of natural language processing and can be used to identify the intent or purpose of input text.
[0069] In actual implementation, the first intent corresponding to the first text is matched with the second intent corresponding to each second text to obtain the intent matching degree. Here, the intent matching degree can be determined by any of the following methods: using predefined matching rules to match the name or description between the first intent and the second intent; calculating the vector similarity between the first intent and the second intent, such as cosine similarity or Euclidean distance, and using the vector similarity as the intent matching degree between the first intent and the second intent; using heuristic methods, such as the number of shared entities or keywords, to determine the intent matching degree.
[0070] In actual implementation, the second text whose intent matching degree exceeds the first matching degree threshold can be directly determined as the reference text matching the first intent of the first text. The first matching degree threshold can be set according to actual conditions and is not specifically limited here.
[0071] In some cases, there may be multiple second texts whose intent matching exceeds the first matching threshold. In this case, the second text with the highest intent matching may be used as a reference text that matches the first intent of the first text.
[0072] Continue reading Figure 3A , continue with the above step 102 for description.
[0073] In step 103, based on the semantic logical relationship between the conversation text of the second time period and the second text, a first conversation text having a logical relationship with the reference text is determined.
[0074] In an embodiment of the present application, the second text is a historical text expressing comments and opinions in a historical time period (i.e., the second time period). For the second text, a logical relationship between the second text and the conversation text in the second time period is pre-constructed, and the logical relationship is used to characterize the mapping relationship between each second text and the conversation text that has a semantic logical relationship with each second text. When processing the first text currently acquired, a reference text matching the first intention of the first text can be determined and stored in the second text, and the first text can be enhanced with the help of the first conversation text that has a logical relationship with the reference text. Here, the reference text is also a text expressing comments and opinions, and the reference text is determined from the second text involved in the constructed logical relationship.
[0075] Here, the conversation text can be understood as a conversation text between characters containing character information, such as a call text. A first conversation text having a logical relationship with the reference text is determined based on the logical relationship. Because the first text and the reference text match in intent and the first conversation text has a logical relationship with the reference text, the first conversation text also has a logical relationship with the first text. In other words, the first conversation text is a text that is strongly semantically related to the first text. Therefore, the first conversation text is used to perform text enhancement on the first text.
[0076] In some embodiments, before step 103 is executed, a logical relationship between the conversation text and the second text may be constructed through steps 105 to 107 .
[0077] In step 105 , for each second text within the second time period, a second conversation text matching the second intention of the second text is determined from the conversation texts within the second time period.
[0078] In the embodiment of the present application, the second time period may refer to a historical time period of the first time period, such as a historical month, a historical year, etc. A second text expressing comments and opinions appearing on various online platforms during the historical time period is obtained, and the conversation text during the historical time period is simultaneously obtained, and a logical relationship is established based on the second text and the conversation text.
[0079] In actual implementation, for each second text, the second text can be firstly identified to obtain the second intent of the second text, and based on the second intent, the second conversation text matching the second intent can be determined in the conversation texts within the second time period.
[0080] As an example, a trained intent recognition model can be called to perform intent recognition on the second text to determine the second intent of the second text, where the second intent represents the commentary intent of the second text; intent recognition is performed on each conversation text in the second time period to determine the conversation intent corresponding to each conversation text. Then, the second intent of the second text is intent-matched with the conversation intent of each conversation text to obtain the intent matching degree between the second text and each conversation text. Based on the preset intent matching condition, a second conversation text that matches the second intent of the second text can be determined in the conversation text. Here, the intent matching condition can be: the intent matching degree exceeds the preset matching degree. The number of second conversation texts determined by the intent matching condition may be multiple (at least two).
[0081] In step 106, semantic logical reasoning is performed on the second conversation text and the second text to obtain associated conversation texts in the second conversation text that have a logical relationship with the second text.
[0082] After determining the second conversation text that matches the second intention of the second text, since there are usually multiple second conversation texts, related conversation texts that have a logical relationship with the second text can be screened out from the second conversation texts through logical reasoning.
[0083] Here, logical relationships may include implication relationships, causal relationships, conditional relationships, parallel relationships, progressive relationships, explanation relationships, example relationships, etc.
[0084] As an example, let's explain the entailment relationship. One text implies the meaning of another text, that is, text B is a subset of text A or a more specific case. Taking one text as a premise and the other as a hypothesis, if hypothesis H can be inferred from premise P, then premise P is said to imply hypothesis H. The main goal of textual entailment recognition (RTE) is to judge whether the premise and hypothesis have an entailment relationship. Textual entailment recognition is formally a text classification problem. See Table 1, which shows a three-category problem. The labels of the logical relationships are entailment, conflict, and neutral.
[0085] Table 1
[0086]
[0087] The premise given in Table 1 is "a dog playing with a Frisbee in the snow," and three hypotheses are given at the same time. Among these three hypotheses, Example 1 describes "an animal playing with a plastic toy outdoors in the cold." Example 1 can be inferred from the premise and has an implication relationship with the premise; Example 2 describes the action of "a cat," which is obviously in a conflict relationship with the premise; and Example 3 describes information that contains content that is not in the premise, and is neither implied nor in conflict with the premise, and has a neutral relationship with the premise.
[0088] In actual implementation, the conversation text includes single-sentence conversation text and full-length conversation text. This is because the acquired conversation text is usually a whole, unsegmented character dialogue text. This format of conversation text often contains a mixture of dialogues with various conversational intentions. Therefore, in the embodiment of the present application, the conversation text can be split, and the dialogue output by each character once is regarded as a single-sentence conversation text to construct a single-sentence conversation text set; the conversation text can be split or spliced according to the conversation scene to obtain a full-length conversation text set corresponding to different conversation scenes.
[0089] As an example, suppose the conversation text is "A: Hi, hello! I'm Alice, nice to meet you. B: Hello, Alice! I'm Bob, nice to meet you too. What are you busy with recently? A: I'm preparing for a project recently and need to do some market research. How about you, Bob? B: Oh, I'm also busy with a project, and we are partners! What a coincidence! A: Really? That's great, we can exchange experiences and ideas with each other. What part are you responsible for in the project? B: I am mainly responsible for the technical part of the project, such as programming and system design. What about you? A: I am mainly responsible for market research and data analysis. I hope to help Contribute to the success of our project. B: Sounds very professional! We should have many opportunities to collaborate on this project. We should have a meeting to discuss the specific details of our cooperation. A: Good idea, Bob! We can arrange a meeting to discuss our ideas and plans in detail. Do you have any suggestions? B: I suggest that we meet next Wednesday afternoon in our company conference room. What do you think? A: Then let's meet next Wednesday afternoon. I will prepare the relevant materials in advance. I look forward to our meeting! B: I look forward to it too, Alice. We should have a very pleasant discussion. Goodbye! A: Goodbye, Bob! I look forward to working with you! "
[0090] By splitting the conversation text according to the role, a single sentence conversation text set including 14 single sentence conversation texts can be obtained. The single sentence conversation text set is "
[0091] A: Hi, I'm Alice, nice to meet you.
[0092] B: Hello, Alice! I'm Bob, nice to meet you too. What have you been busy with lately?
[0093] A: I'm currently preparing a project and need to do some market research. How about you, Bob?
[0094] B: Oh, I'm also working on a project. We're partners! What a coincidence!
[0095] A: Really? That's great! We can exchange experiences and ideas. What part of the project are you responsible for?
[0096] B: I'm mainly responsible for the technical part of the project, such as programming and system design. What about you?
[0097] A: I am mainly responsible for market research and data analysis. I hope to contribute to the success of our project.
[0098] B: That sounds very professional! We could have a lot of opportunities to collaborate on this project. We should set up a meeting to discuss the details.
[0099] A: That's a good idea, Bob! We can arrange a meeting to discuss our ideas and plans in detail. Do you have any suggestions?
[0100] B: I suggest we hold a meeting next Wednesday afternoon in our company conference room. What do you think?
[0101] A: Next Wednesday afternoon, then. I'll prepare the relevant materials in advance. I look forward to our meeting!
[0102] B: I look forward to it, Alice. We should have a very pleasant discussion. Goodbye!
[0103] A: Goodbye, Bob! Looking forward to working with you!
[0104] In actual implementation, according to the conversation scenario, the conversation text can be directly used as the whole conversation text; or the conversation scenario can be divided into more fine-grained categories to obtain multiple whole conversation texts. As an example, if the conversation text is divided into two scenarios of "greeting" and "project communication" according to the conversation scenario, a whole conversation text set including two whole conversation texts can be obtained, and the whole conversation text set includes: "A: Hi, hello! I'm Alice, nice to meet you. B: Hello, Alice! I'm Bob, nice to meet you too. What are you busy with recently? A: I'm preparing for a project recently and need to do some market research. What about you, Bob? B: Oh, I'm also busy with a project, and we are partners! What a coincidence!" and "A: Really? That's great, we can exchange experiences and ideas with each other. What part of the project are you responsible for? B: I'm mainly responsible for the technical part of the project, such as programming and system Design. What about you? A: I'm mainly responsible for market research and data analysis. I hope to contribute to the success of our project. B: Sounds very professional! Then we have many opportunities to cooperate on this project. We should have a meeting to discuss the specific details of our cooperation. A: Good idea, Bob! We can arrange a meeting to discuss our ideas and plans in detail. Do you have any suggestions? B: I suggest that we meet next Wednesday afternoon, in our company conference room. How about it? A: Then let's meet next Wednesday afternoon. I will prepare the relevant materials in advance. I look forward to our meeting! B: I look forward to it too, Alice. We should have a very pleasant discussion. Goodbye! A: Goodbye, Bob! Looking forward to working with you! "Two entire conversation texts.
[0105] Therefore, before performing logical reasoning on the second text and the second conversation text, the second conversation text may be split into single sentences to obtain multiple single-sentence conversation texts; and the second conversation text may be split into the whole text to obtain at least one whole text conversation text.
[0106] In some embodiments, step 106 may be implemented through steps 1061 to 1063 .
[0107] In step 1061, logical reasoning is performed on the second text and a plurality of single-sentence conversation texts to obtain associated single-sentence conversation texts that have a logical relationship with the second text.
[0108] In some embodiments, step 1061 can be implemented by: performing semantic matching on the second text and each single-sentence conversation text to obtain multiple first semantic matching degrees; screening out the first single-sentence conversation text with a first semantic matching degree exceeding a second matching degree threshold from the multiple single-sentence conversation texts; based on the first single-sentence conversation text, performing logical reasoning on the second single-sentence conversation text in the single-sentence conversation text to obtain a third single-sentence conversation text that has a first logical relationship with the first single-sentence conversation text; based on the first single-sentence conversation text and the third single-sentence conversation text, constructing an associated single-sentence conversation text with which the second text has a logical relationship.
[0109] In actual implementation, multiple first semantic matching degrees can be obtained by performing semantic recognition on the second text to obtain comment semantic features, performing semantic recognition on each single-sentence conversation text to obtain multiple single-sentence conversation semantic features, and performing semantic matching on the comment semantic features and each single-sentence conversation semantic feature to obtain multiple first semantic matching degrees.
[0110] As an example, the process of semantic matching the second text and each single-sentence conversation text can be achieved by any of the following methods: based on a word frequency method, extracting words or phrases appearing in the second text and each single-sentence conversation text, obtaining comment semantic features and single-sentence conversation semantic features, calculating the frequency of occurrence of the comment semantic features and single-sentence conversation semantic features in the original text, and comparing their similarities to obtain multiple first semantic matching degrees; or, based on a similarity method, respectively calculating the vector representation of the second text and each single-sentence conversation text, and then using cosine similarity, Euclidean distance and other methods to compare the similarity between the vector representations to obtain multiple first semantic matching degrees; or, based on a machine learning method, using classification, regression and other machine learning algorithms to train a model to predict the degree of matching between the second text and each single-sentence conversation text to obtain multiple first semantic matching degrees.
[0111] After determining the first semantic matching degree between the second text and each single-sentence conversation text, first single-sentence conversation texts whose first semantic matching degree exceeds a second matching degree threshold can be selected from the single-sentence conversation texts. Here, the second matching degree threshold is set based on actual conditions and is not specifically limited here.
[0112] The first single-sentence conversation text is a conversation text with similar semantics to the second text, and can be regarded as the single-sentence conversation text most relevant to the second text.
[0113] In actual implementation, the first single-sentence conversation text can be used as an anchor point to perform logical reasoning on the first single-sentence conversation text and the second single-sentence conversation text, and a third single-sentence conversation text that has a first logical relationship with the first single-sentence conversation text can be determined in the second single-sentence conversation text. Here, the second single-sentence conversation text can be a single-sentence conversation text other than the first single-sentence conversation text in the single-sentence conversation text.
[0114] Among them, the first logical relationship includes but is not limited to implication relationship, causal relationship, conditional relationship, parallel relationship, progressive relationship, explanation relationship, and example relationship.
[0115] Then, the first single-sentence conversation text and the third single-sentence conversation text are both used as associated single-sentence conversation texts having a logical relationship with the second text, and both the first single-sentence conversation text and the third single-sentence conversation text can be used to enhance the second text.
[0116] In other embodiments, step 1061 can also be implemented by the following methods: performing text splitting on the second text to obtain multiple sub-texts; for each sub-text, performing logical reasoning on the sub-text and multiple single-sentence conversation texts to obtain sub-associated single-sentence conversation texts that have a logical relationship with the sub-text; performing text fusion processing on the multiple sub-associated single-sentence conversation texts to obtain associated single-sentence conversation texts that have a logical relationship with the second text.
[0117] In some cases, the second text may be a longer text, including multiple sentences. In this case, if the second text is treated as a whole for semantic recognition and semantic matching, the accuracy of the first single-sentence conversation text determined will be relatively low. Therefore, in this case, the second text can be split according to punctuation marks to obtain multiple sub-texts, for example, N sub-texts, where N is a positive integer.
[0118] As an example, if the second text is "I borrowed 500 yuan from your platform, which is paid in installments. I have paid it back for one month. Can I borrow again?", then after splitting the second text, four sub-texts can be obtained: "I borrowed 500 yuan from your platform", "It is paid in installments", "I have paid it back for one month", and "Can I borrow again?"
[0119] For each of the N subtexts, logical reasoning is performed between the subtext and the single-sentence conversation text to determine a sub-associated single-sentence conversation text in which the subtexts have a logical relationship. The process of performing logical reasoning between the subtexts and the single-sentence conversation texts can be referenced above by directly performing logical reasoning between the second text and the single-sentence conversation text, and will not be further described here.
[0120] As an example, for each subtext, semantic recognition is performed on the subtext and the single-sentence conversation text to obtain sub-comment semantic features and single-sentence conversation semantic features; semantic matching is performed on the sub-comment semantic features and the single-sentence conversation semantic features to obtain a third semantic matching degree, and a first single-sentence conversation text to be fused is selected from the single-sentence conversation texts whose third semantic matching degree exceeds a second matching degree threshold; based on the first single-sentence conversation text to be fused, logical reasoning is performed on the second single-sentence conversation text, and a second single-sentence conversation text to be fused is determined in the second single-sentence conversation text to have a first logical relationship with the first single-sentence conversation text to be fused. The first single-sentence conversation text to be fused and the second single-sentence conversation text to be fused constitute a sub-associated single-sentence conversation text that has a logical relationship with the subtext.
[0121] After determining the sub-associated single-sentence conversational text corresponding to each sub-text through the above method, text fusion processing can be performed on the sub-associated single-sentence conversational texts corresponding to the multiple sub-texts to obtain associated single-sentence conversational texts that have a logical relationship with the second text. Text fusion processing refers to integrating the single-sentence conversational texts from different sub-associated single-sentence conversational texts to create a unified, structured dataset of associated single-sentence conversational texts, facilitating further analysis and processing. Text fusion processing can enrich and comprehensively enrich the textual information in the associated single-sentence conversational texts used to enhance the first text.
[0122] It should be noted that the sub-associated single-sentence conversation texts corresponding to each sub-text may contain the same single-sentence conversation text. In this case, only one of the repeated single-sentence conversation texts needs to be retained during text fusion.
[0123] In step 1062, logical reasoning is performed on the second text and the entire conversation text to obtain associated conversation text segments that have a logical relationship with the second text.
[0124] In some embodiments, step 1062 may be implemented through steps 10621A to 10624A.
[0125] In step 10621A, the entire conversation text is divided into segments to obtain M conversation text segments.
[0126] Wherein, M is a positive integer.
[0127] In practice, because the entire conversation text contains a wealth of conversational information, not all content in the entire text may be logically related to the second text. Therefore, to more accurately identify content within the entire conversation text that is logically related to the second text, the entire conversation text can be segmented. A segment can consist of a single sentence or multiple sentences, and the specific segmentation method can be set based on the granularity of the actual analysis requirements.
[0128] In step 10622A, a first conversation text segment that semantically matches the second text is determined among the M conversation text segments.
[0129] In some embodiments, step 10622A may be implemented as follows.
[0130] Perform semantic recognition on the second text and M conversation text fragments to obtain comment semantic features and M fragment semantic features; perform semantic matching on the comment semantic features and the M fragment semantic features to obtain M second semantic matching degrees; from the M conversation text fragments, determine the conversation text fragment whose second semantic matching degree exceeds the third matching degree threshold, and use the determined conversation text fragment as the first conversation text fragment that semantically matches the second text.
[0131] In actual implementation, the method of performing semantic recognition on the second text and M conversation text fragments can refer to the method of performing semantic recognition on the second text and a single sentence conversation text, such as: a word frequency-based method; a similarity-based method; a machine learning-based method, etc.
[0132] Perform semantic recognition on the second text to obtain the comment semantic features of the second text; perform semantic recognition on M conversation text segments respectively to obtain M segment semantic features. Then, perform semantic matching on the third comment semantic features with the M segment semantic features respectively to obtain M second semantic matching degrees. Based on the third matching degree threshold, screen out the first conversation text segment that semantically matches the second text from the M conversation text segments. Here, the third matching degree threshold may be the same as the above-mentioned second matching degree threshold, or may be different, and is set specifically according to the actual situation. The first conversation text segment is the conversation text segment that is most semantically similar to the second text among the M conversation text segments.
[0133] In step 10623A, based on the first conversation text segment, logical reasoning is performed on the second conversation text segment among the M conversation text segments to obtain a third conversation text segment that has a second logical relationship with the first conversation text segment.
[0134] Here, the second conversation text segment may be another conversation text segment among the M conversation text segments except the first conversation text segment.
[0135] In some embodiments, step 10623A may be implemented as follows.
[0136] Based on the positions of the M conversation text fragments in the entire conversation text, a fourth conversation text fragment adjacent to the first conversation text fragment is determined; based on the first conversation text fragment and the fourth conversation text fragment, logical reasoning is performed on the second conversation text fragment among the M conversation text fragments to obtain a third conversation text fragment that has a second logical relationship with the first conversation text fragment and the fourth conversation text fragment.
[0137] In the embodiment of the present application, since the entire conversation text is a complete and logically coherent dialogue information, the conversation content before and after the first conversation text segment usually has a chronological logical relationship with the first conversation text segment. Therefore, the fourth conversation text segment that has a chronological logical relationship with the first conversation text segment can be first determined in the entire conversation text, and then logical reasoning can be performed based on the first conversation text segment and the fourth conversation text segment.
[0138] As an example, logical reasoning is performed on the first and second conversation text segments to obtain a conversation text segment that has a second logical relationship with the first conversation text segment. Logical reasoning is performed on the fourth and second conversation text segments to obtain a conversation text segment that has a second logical relationship with the fourth conversation text segment. The conversation text segment that has a second logical relationship with the first conversation text segment and the conversation text segment that has a second logical relationship with the fourth conversation text segment constitute a third conversation text segment.
[0139] For example, suppose the entire conversation text "Agent: Sir, how can I help you? Customer: I'd like to borrow more money. Agent: Okay, did you borrow money from our platform before? Customer: Yes, I borrowed 500 yuan from your platform. Agent: Have you paid it back? Customer: It was in installments, I've paid it back a month ago, can I still borrow money now?" is split into six conversation text segments: "Agent: Sir, how can I help you?", "Customer: I'd like to borrow more money.", "Agent: Okay, did you borrow money from our platform before?", "Customer: Yes, I borrowed 500 yuan from your platform.", "Agent: Have you paid it back?", "Customer: It was in installments, I've paid it back a month ago, can I still borrow money now?". If the comment text is "I borrowed 500 yuan from your platform." After performing semantic recognition and semantic matching on the comment text and the six conversation text segments, the first conversation text segment that semantically matches the comment text is determined to be "Customer: Yes, I borrowed 500 yuan from your platform." Based on the position of the first conversation text segment within the entire conversation text, the conversation text segments adjacent to the first conversation text segment, "Agent: Okay, did you borrow money from our platform before?" and "Agent: Have you repaid it?" are selected as the fourth conversation text segment. Next, within the second conversation text segment of the six conversation text segments, excluding the first and fourth conversation text segments, logical reasoning is used to determine the conversation text segments that have a second logical relationship with "Customer: Yes, I borrowed 500 yuan from your platform," the conversation text segments that have a second logical relationship with "Agent: Okay, did you borrow money from our platform before?", and the conversation text segments that have a second logical relationship with "Agent: Have you repaid it?", resulting in the third conversation text segment.
[0140] In step 10624A, based on the first conversation text segment and the third conversation text segment, an associated conversation text segment having a logical relationship with the second text is constructed.
[0141] In some embodiments, step 10624A may be implemented by constructing an associated conversation text segment that has a logical relationship with the second text based on the first conversation text segment, the third conversation text segment, and the fourth conversation text segment.
[0142] As an example, the first conversation text segment, the third conversation text segment, and the fourth conversation text segment may be subjected to text fusion processing to construct associated conversation text segments.
[0143] In other embodiments, step 1062 may be implemented through steps 10621B to 10623B.
[0144] In step 10621B, the second text is split into N subtexts, and the entire conversation text is split into M conversation text segments.
[0145] Wherein, N and M are both positive integers.
[0146] In step 10622B, for each of the N subtexts, logical reasoning is performed on the subtext and the M conversation text segments to obtain a sub-associated conversation text segment that has a logical relationship with the subtext.
[0147] In step 10623B, segment fusion processing is performed on the sub-associated conversation text segments of the N sub-texts to obtain associated conversation text segments that have a logical relationship with the second text.
[0148] In actual implementation, the second text can be split into N subtexts according to punctuation marks, and the entire conversation text can be split into M conversation text segments according to the actual segmentation granularity requirements. For each subtext in the N subtexts, a first conversation text segment that matches the subtext intent is determined in the M conversation text segments. Based on the position of the first conversation text segment in the entire conversation text, a fourth conversation text segment adjacent to the first conversation text segment is determined. Subsequently, a third conversation text segment that has a second logical relationship with the first conversation text segment and the fourth conversation text segment is determined in the second conversation text segment, thereby obtaining a sub-associated conversation text segment that has a logical relationship with the subtext.
[0149] The sub-associated conversation text segments corresponding to the N sub-texts are subjected to segment fusion processing to obtain an associated conversation text segment having a logical relationship with the second text. The segment fusion processing may be combining the conversation text segments in each sub-associated conversation text segment.
[0150] The description will continue with the above step 1062.
[0151] In step 1063, an associated conversation text having a logical relationship with the second text is constructed based on the associated single-sentence conversation text and the associated conversation text fragment.
[0152] In actual implementation, associated single-sentence conversation texts and associated conversation text segments that have a logical relationship with the second text can both be used to enhance the second text. The associated conversation text constructed by the associated single-sentence conversation texts and associated conversation text segments includes: a first single-sentence conversation text that semantically matches the second text, a third single-sentence conversation text that has a first logical relationship with the first single-sentence conversation text, a first conversation text segment that semantically matches the second text, a fourth conversation text segment adjacent to the first conversation text segment, and a third conversation text segment that has a second logical relationship with the first conversation text segment and the fourth conversation text segment. The first logical relationship and the second logical relationship can both include, but are not limited to, an implication relationship, a causal relationship, a conditional relationship, a parallel relationship, a progressive relationship, an explanation relationship, and an example relationship.
[0153] Continue reading Figure 3B , continue with the above step 106 for explanation.
[0154] In step 107 , based on the logical relationship between the second text and the associated conversation text, a semantic logical relationship between the conversation text of the second time period and the second text is constructed.
[0155] Here, the conversation text includes the entire conversation text and the single-sentence conversation text. The associated conversation text corresponding to each second text is determined. The associated conversation text includes the associated single-sentence conversation text and the associated conversation text fragment. Based on the logical relationship between the second text and the associated conversation text, the logical relationship between each second text and the single-sentence conversation text and the entire conversation text included in the conversation text can be constructed.
[0156] In actual implementation, when the first text needs to be enhanced, the logical relationship between the second text and the conversation text can be directly obtained, and the intention of the first text and each second text involved in the logical relationship can be identified separately. A reference text that matches the first intention of the first text can be determined from multiple second texts. Then, the first conversation text that has a logical relationship with the reference text can be determined in the logical relationship between the second text and the conversation text, and the first text can be enhanced using the first conversation text.
[0157] In some embodiments, if a reference text that matches the intention of the first text is not determined in the second text, the method of determining the associated conversation text corresponding to each second text in the process of constructing the logical relationship between the second text and the conversation text can be referred to to determine the associated conversation text in the conversation text that has a logical relationship with the first text.
[0158] In some embodiments, the logical relationship between the above-mentioned conversation text and the second text can also be determined by a pre-constructed logical reasoning model. First, the pre-constructed logical reasoning model is trained, with conversation text samples with annotated data and comment text samples with annotated data as inputs to the logical reasoning model, and the logical relationship between each comment text sample and the conversation text sample as output, to train the logical mapping model. When the training end condition is met, a trained logical reasoning model is obtained. The annotated data of the conversation sample may include the intent label corresponding to the conversation text sample and the label of the logical correspondence with the comment text sample; the annotated data of the comment text sample includes the intent label corresponding to the comment text sample and the label of the logical correspondence with the conversation text sample.
[0159] Continue reading Figure 3A , continue with the above step 103 for explanation.
[0160] In step 104, the first text is enhanced based on the first conversation text to obtain a third text.
[0161] The first conversation text includes associated single-sentence conversation texts and associated conversation text fragments that have a logical relationship with the reference text. The associated single-sentence conversation texts include a first single-sentence conversation text and a third single-sentence conversation text that have a logical relationship with the reference text. The associated conversation text fragments include a first conversation text fragment, a third conversation text fragment, and a fourth conversation text fragment that have a logical relationship with the reference text.
[0162] In some embodiments, step 104 may be implemented in the following manner.
[0163] In the first conversation text, a first associated conversation text having a semantic similarity with the first text greater than a similarity threshold is determined; and based on the first associated conversation text, the first text is enhanced to obtain a third text.
[0164] Since the first conversation text includes relatively more conversation text content, when using the first conversation text to enhance the first text, some single-sentence conversation texts or conversation text fragments that have a greater semantic similarity with the first text can be selected from the first conversation text to enhance the first text to obtain the third text.
[0165] As an example, assuming that the first text is "I dare not borrow", the first associated conversation text determined in the first conversation text to have a semantic similarity with the first text greater than a similarity threshold includes the associated single-sentence conversation text "Who dares to borrow with such high interest rates?" and the associated conversation text fragment "A: You are too urgent in collecting debts and call me every day. I dare not borrow anymore. B: Because your loan has expired." Since the sentence vector of the first associated conversation text contains the sentence vector of the first text, the first associated conversation text can be directly used as enhanced data for the first text.
[0166] In some embodiments, a specified number of associated single-sentence conversation texts or associated conversation text segments may be optionally selected from the first conversation text to perform enhancement processing on the first text to obtain a third text.
[0167] In some embodiments, associated single-sentence conversation texts may be randomly selected from the first conversation text, and only the associated single-sentence conversation texts may be used to enhance the first text to obtain a third text; or, associated conversation text fragments may be randomly selected from the first conversation text, and only the associated conversation text fragments may be used to enhance the first text.
[0168] In an embodiment of the present application, the third text obtained after enhancing the first text can be used in various natural language processing tasks for texts expressing comments, such as intent classification tasks.
[0169] Through the above embodiment, when it is necessary to enhance the first text generated in the first time period, the first text can be subjected to intent recognition to determine a reference text that matches the first intent of the first text in the second text generated in the second time period. Then, by directly utilizing the semantic logical relationship between the conversation text and the second text, a first conversation text that has a logical relationship with the reference text is obtained. Since the intentions of the first text and the reference text match, and the first conversation text has a logical relationship with the reference text, the first conversation text also has a logical relationship with the first text. That is to say, the first conversation text is some conversation text that is strongly related to the first text in a logical relationship. In this way, after the first text is enhanced based on the first conversation text, the content of the first text can be enriched, and a third text with effectively enhanced text content can be obtained, thereby improving the usability of the first text.
[0170] In a specific embodiment, the text processing method may further include the following steps:
[0171] In step 201, historical conversation texts with role information are obtained.
[0172] Here, the historical conversation text refers to the above-mentioned conversation text.
[0173] The historical conversation texts are spliced together as a whole conversation text to construct a whole conversation text dataset; the historical conversation texts are split into single sentence texts to construct a single sentence conversation text dataset.
[0174] As an example, the entire conversation text can be: "For example: Customer: Hello. Agent: Hello, is this Mr. Zhao? Agent: Hello, Mr. Zhao, sorry to bother you. I'm the follow-up manager of ***. You were previously informed by ***'s staff that a pre-approved credit line of 38,000 yuan has been opened for you in your Alipay mini program ***. Sir, you should apply for it today. I see that you haven't applied for it for free yet. Are you busy and forgot, or can't find the location of ***? Customer: This is 200. Customer: Where is it in Alipay, right? Agent: Yes, you can search for *** in Alipay. Customer: OK, I see. Okay. Agent: Hey, sir, I'm here."
[0175] The single-sentence conversation text dataset may include several single-sentence conversation texts, such as:
[0176] Customer: Hello.
[0177] Agent: Hello, is this Mr. Zhao?
[0178] Agent: Hello, Mr. Zhao. Sorry to bother you. I am the follow-up manager of ***. You have been informed by the staff of *** before that a pre-credit line of 38,000 yuan has been opened for you in your *** mini program ***. Sir, you should apply for it today. I see that you have not applied for it for free yet. Are you busy and forgot, or did you not find the location of that ***?
[0179] Customer: This two hundred.
[0180] Customer: Where is it?
[0181] Agent: Yes, you can search for *** by typing ***.
[0182] Customer: OK, I understand. Okay.
[0183] Agent: Hey sir, I’m here.”
[0184] In step 202, the advertisement comment text in the network platform is obtained.
[0185] Obtain advertising comment text data (i.e., second text) from major online platforms. Advertising comment text data includes comment texts for different dimensions such as enterprises, products, seats, and strategies. For example: I don’t know how I added a member, but 40 yuan was deducted every month.
[0186] In step 203, intent recognition is performed on the historical conversation text and the advertisement comment text to obtain the conversation intent of the historical conversation text and the comment intent of the advertisement comment text.
[0187] Call the trained intent recognition model, input the historical conversation text, and obtain the conversation intent corresponding to the historical conversation text; input the advertising comment text into the intent recognition model to obtain the comment intent corresponding to each advertising comment text.
[0188] In step 204, logical reasoning is performed on the advertisement comment text and the historical conversation text that have matching intentions to obtain a logical relationship between the advertisement comment text and the historical conversation text.
[0189] For each advertising comment text, determine the historical conversation text (i.e., the second conversation text) whose conversation intention matches the comment intention, perform logical reasoning on the advertising comment text and the historical conversation text that matches its intention, and obtain the associated conversation text that has a logical relationship with the advertising comment text. Based on the advertising comment text and the associated conversation text, construct a logical relationship between the advertising comment text and the historical conversation text.
[0190] As an example, a trained logical mapping model may be called, and each advertisement comment text and historical conversation text may be input into the logical mapping model to obtain the logical relationship between the advertisement comment text and the associated conversation text.
[0191] The logical mapping model is trained in the following way: loading a pre-built initial logical mapping model, such as the RoBERTa language representation model (Robustly Optimized BERT Representations from Transformers); using comment samples and conversation samples with intent labels and logical relationship labels as input to the initial logical mapping model, and using the logical mapping relationship between the comment samples and conversation samples as output to train the initial logical mapping model and obtain a logical mapping model that meets the training effect.
[0192] In step 205 , based on the logical relationship, conversation text combination candidates for the advertisement comment to be enhanced are determined.
[0193] Here, the advertisement comment to be enhanced is the first text mentioned above. Intent recognition is performed on the advertisement comment to be enhanced to obtain the first intent of the advertisement comment to be enhanced. The advertisement comment text contained in the logical mapping relationship is used as the candidate advertisement comment text (i.e., the second text mentioned above). A reference advertisement comment text (i.e., the reference text mentioned above) that matches the first intent is determined in the candidate advertisement comment text. Based on the logical mapping relationship, an associated conversation text (i.e., the first conversation text mentioned above) that has a logical relationship with the reference advertisement comment text is determined, and the associated conversation text is used as a conversation text combination candidate for the advertisement comment to be enhanced. The conversation text combination candidate includes associated single-sentence conversation texts and associated conversation text fragments.
[0194] In step 206, the advertisement comment to be enhanced is enhanced using the conversation text combination candidate to obtain a third text.
[0195] Since the conversation text combination candidates include relatively more conversation text content, when using the conversation text combination candidates to enhance the advertising comments to be enhanced, some single-sentence conversation texts or conversation text fragments that have a greater semantic similarity with the advertising comments to be enhanced can be selected from the conversation text combination candidates to enhance the advertising comments to be enhanced and obtain a third text.
[0196] As an example, assuming that the advertisement comment to be enhanced is "I dare not borrow", among the conversation text combination candidates, the target associated conversation text whose semantic similarity with the advertisement comment to be enhanced is greater than the similarity threshold is determined to include the associated single-sentence conversation text "Who dares to borrow with such high interest rates?" and the associated conversation text fragment "A: You are too urgent to collect debts and call me every day. I dare not borrow anymore. B: Because your loan has expired." It can be seen that the sentence vector of the target associated conversation text contains the sentence vector of the first text. Therefore, the target associated conversation text can be directly used as the enhanced data of the advertisement comment to be enhanced.
[0197] The following continues to describe the exemplary structure of the text processing device 455 provided in the embodiment of the present application as a software module. In some embodiments, such as Figure 2 As shown, the software modules stored in the text processing device 455 of the memory 440 may include:
[0198] The intention recognition module 4551 is used to perform intention recognition on a first text used to express comments and opinions, and obtain a first intention of the first text; the first text is generated in a first time period.
[0199] The first determination module 4552 is used to determine a reference text that matches the first text from a second text used to express comments based on the first intention; the second text is generated for the conversation text in a second time period; and the second time period is earlier than the first time period.
[0200] The second determining module 4553 is configured to determine the first conversation text having a logical relationship with the reference text based on the semantic logical relationship between the conversation text in the second time period and the second text.
[0201] The enhancement module 4554 is configured to enhance the first text based on the first conversation text to obtain a third text.
[0202] In some embodiments, the first determination module 4552 is also used to perform intent recognition on each second text in a plurality of second texts used to express comments and opinions, to obtain the second intent of the second text; to match the first intention and the second intention, to obtain the intention matching degree; and to determine the second text whose intention matching degree exceeds the first matching degree threshold as a reference text that matches the first text.
[0203] In some embodiments, the text processing device 455 also includes a mapping relationship construction module, which is used to determine, for each second text in the second time period, a second conversation text that matches the second intention of the second text in the conversation text in the second time period; perform semantic logical reasoning on the second conversation text and the second text to obtain an associated conversation text in the second conversation text that has a logical relationship with the second text; and construct a semantic logical relationship between the conversation text in the second time period and the second text based on the logical relationship between the second text and the associated conversation text.
[0204] In some embodiments, the second conversation text includes multiple single-sentence conversation texts and an entire conversation text; the mapping relationship construction module is also used to perform logical reasoning on the second text and the multiple single-sentence conversation texts to obtain associated single-sentence conversation texts that have a logical relationship with the second text; perform logical reasoning on the second text and the entire conversation text to obtain associated conversation text fragments that have a logical relationship with the second text; and construct an associated conversation text that has a logical relationship with the second text based on the associated single-sentence conversation texts and the associated conversation text fragments.
[0205] In some embodiments, the mapping relationship construction module is also used to perform semantic matching on the second text and each single-sentence conversation text to obtain multiple first semantic matching degrees; based on the multiple first semantic matching degrees, determine the first single-sentence conversation text whose first semantic matching degree exceeds the second matching degree threshold from the multiple single-sentence conversation texts; based on the first single-sentence conversation text, perform logical reasoning on the second single-sentence conversation text in the single-sentence conversation text to obtain a third single-sentence conversation text that has a first logical relationship with the first single-sentence conversation text; based on the first single-sentence conversation text and the third single-sentence conversation text, construct an associated single-sentence conversation text that has a logical relationship with the second text.
[0206] In some embodiments, the mapping relationship construction module is also used to split the second text to obtain multiple sub-texts; for each sub-text, perform logical reasoning on the sub-text and multiple single-sentence conversation texts to obtain sub-associated single-sentence conversation texts that have a logical relationship with the sub-text; perform text fusion processing on multiple sub-associated single-sentence conversation texts to obtain associated single-sentence conversation texts that have a logical relationship with the second text.
[0207] In some embodiments, the mapping relationship construction module is also used to divide the entire conversation text into segments to obtain M conversation text segments, where M is a positive integer; among the M conversation text segments, determine a first conversation text segment that semantically matches the second text; based on the first conversation text segment, perform logical reasoning on the second conversation text segment among the M conversation text segments to obtain a third conversation text segment that has a second logical relationship with the first conversation text segment; based on the first conversation text segment and the third conversation text segment, construct an associated conversation text segment that has a logical relationship with the second text.
[0208] In some embodiments, the mapping relationship construction module is also used to perform semantic recognition on the second text and M conversation text fragments to obtain comment semantic features and M fragment semantic features; perform semantic matching on the comment semantic features and the M fragment semantic features to obtain M second semantic matching degrees; determine, from the M conversation text fragments, the conversation text fragment whose second semantic matching degree exceeds the third matching degree threshold, and use the determined conversation text fragment as the first conversation text fragment that semantically matches the third text.
[0209] In some embodiments, the mapping relationship construction module is also used to determine a fourth conversation text segment adjacent to the first conversation text segment based on the positions of the M conversation text segments in the entire conversation text; based on the first conversation text segment and the fourth conversation text segment, perform logical reasoning on the second conversation text segment to obtain a third conversation text segment that has a second logical relationship with the first conversation text segment and the fourth conversation text segment; based on the first conversation text segment, the third conversation text segment and the fourth conversation text segment, construct an associated conversation text segment that has a logical relationship with the second text.
[0210] In some embodiments, the mapping relationship construction module is also used to perform text splitting on the second text to obtain N sub-texts, and to perform text splitting on the entire conversation text to obtain M conversation text fragments, where N and M are both positive integers; for each sub-text in the N sub-texts, logical reasoning is performed on the sub-text and the M conversation text fragments to obtain a sub-associated conversation text fragment that has a logical relationship with the sub-text; and fragment fusion processing is performed on the sub-associated conversation text fragments of the N sub-texts to obtain an associated conversation text fragment that has a logical relationship with the second text.
[0211] In some embodiments, the enhancement module 4554 is further configured to determine, in the first conversation text, a first associated conversation text having a semantic similarity with the first text greater than a similarity threshold; and enhance the first text based on the first associated conversation text to obtain a third text.
[0212] An embodiment of the present application provides a computer program product, which includes a computer program or computer-executable instructions stored in a computer-readable storage medium. A processor of an electronic device reads the computer-executable instructions from the computer-readable storage medium and executes the computer-executable instructions, causing the electronic device to perform the text processing method described in the embodiment of the present application.
[0213] The embodiment of the present application provides a computer-readable storage medium in which computer-executable instructions or computer programs are stored. When the computer-executable instructions or computer programs are executed by a processor, the processor will execute the text processing method provided by the embodiment of the present application, for example, Figure 3A The text processing method shown.
[0214] In some embodiments, the computer-readable storage medium may be a memory such as RAM, ROM, flash memory, magnetic surface memory, optical disk, or CD-ROM; or may be various devices including one or any combination of the above memories.
[0215] In some embodiments, computer-executable instructions may be in the form of a program, software, software module, script, or code, written in any form of programming language (including compiled or interpreted languages, or declarative or procedural languages), and may be deployed in any form, including as a stand-alone program or as a module, component, subroutine, or other unit suitable for use in a computing environment.
[0216] As an example, computer-executable instructions may, but need not, correspond to a file in a file system, may be stored as part of a file that stores other programs or data, such as in one or more scripts in a HyperText Markup Language (HTML) document, in a single file dedicated to the program in question, or in multiple coordinating files (e.g., files storing one or more modules, subroutines, or code portions).
[0217] By way of example, computer-executable instructions may be deployed to be executed on one electronic device, or on multiple electronic devices located at one site, or on multiple electronic devices distributed across multiple sites and interconnected by a communication network.
[0218] To sum up, through the embodiments of the present application, when it is necessary to enhance the first text generated in the first time period, the first text can be subjected to intent recognition to determine a reference text that matches the first intent of the first text in the second text generated in the second time period. Then, by directly utilizing the semantic logical relationship between the conversation text in the second time period and the second text, a first conversation text that has a logical relationship with the reference text is obtained. Since the intentions of the first text and the reference text match, and the first conversation text has a logical relationship with the reference text, the first conversation text also has a logical relationship with the first text. That is to say, the first conversation text is some conversation text that is strongly related to the first text in a logical relationship. In this way, after the first text is enhanced based on the first conversation text, the content of the first text can be enriched, and a third text with effectively enhanced text content is obtained, thereby improving the usability of the first text.
[0219] The above description is merely an embodiment of the present application and is not intended to limit the scope of protection of the present application. Any modifications, equivalent replacements, and improvements made within the spirit and scope of the present application are included in the scope of protection of the present application.
Claims
1. A text processing method, characterized in that: The method comprises: Performing intent recognition on a first text used to express a comment to obtain a first intent of the first text; the first text is generated in a first time period; Determining, based on the first intention, a reference text matching the first text from a second text used to express a comment; the second text is generated for the conversation text in a second time period; the second time period is earlier than the first time period; Determining a first conversation text having a logical relationship with the reference text based on a semantic logical relationship between the conversation text in the second time period and the second text; The first text is enhanced based on the first conversation text to obtain a third text.
2. The method according to claim 1, characterized in that Before determining the first conversation text having a logical relationship with the reference text based on the semantic logical relationship between the conversation text in the second time period and the second text, the method further includes: For each second text within the second time period, determining, from the conversation texts within the second time period, a second conversation text that matches the second intention of the second text; Performing semantic logical reasoning on the second conversation text and the second text to obtain associated conversation texts in the second conversation text that have a logical relationship with the second text; Based on the logical relationship between the second text and the associated conversation text, a semantic logical relationship between the conversation text of the second time period and the second text is constructed.
3. The method according to claim 2, characterized in that The second conversation text includes a plurality of single-sentence conversation texts and a whole conversation text; The performing semantic logical reasoning on the second conversation text and the second text to obtain an associated conversation text in the second conversation text that has a logical relationship with the second text includes: Performing logical reasoning on the second text and the plurality of single-sentence conversation texts to obtain associated single-sentence conversation texts having a logical relationship with the second text; Performing logical reasoning on the second text and the entire conversation text to obtain associated conversation text segments that have a logical relationship with the second text; Based on the associated single-sentence conversation text and the associated conversation text fragment, an associated conversation text having a logical relationship with the second text is constructed.
4. The method according to claim 3, characterized in that The performing logical reasoning on the second text and the plurality of single-sentence conversation texts to obtain associated single-sentence conversation texts having a logical relationship with the second text includes: Performing semantic matching on the second text and each single-sentence conversation text to obtain a plurality of first semantic matching degrees; Based on the multiple first semantic matching degrees, determining a first single-sentence conversation text whose first semantic matching degree exceeds a second matching degree threshold from the multiple single-sentence conversation texts; Based on the first single-sentence conversation text, logical reasoning is performed on the second single-sentence conversation text in the single-sentence conversation text to obtain a third single-sentence conversation text that has a first logical relationship with the first single-sentence conversation text; based on the first single-sentence conversation text and the third single-sentence conversation text, an associated single-sentence conversation text that has a logical relationship with the second text is constructed.
5. The method according to claim 3, characterized in that The performing logical reasoning on the second text and the entire conversation text to obtain an associated conversation text segment having a logical relationship with the second text includes: Dividing the entire conversation text into segments to obtain M conversation text segments, where M is a positive integer; Determining, among the M conversation text segments, a first conversation text segment that semantically matches the second text; Based on the first conversation text segment, logical reasoning is performed on a second conversation text segment among the M conversation text segments to obtain a third conversation text segment that has a second logical relationship with the first conversation text segment; Based on the first conversation text segment and the third conversation text segment, an associated conversation text segment having a logical relationship with the second text is constructed.
6. The method according to claim 5, wherein The step of performing logical reasoning on a second conversation text segment among the M conversation text segments based on the first conversation text segment to obtain a third conversation text segment having a second logical relationship with the first conversation text segment includes: Determining a fourth conversation text segment adjacent to the first conversation text segment based on positions of the M conversation text segments in the entire conversation text; Based on the first conversation text segment and the fourth conversation text segment, logical reasoning is performed on the second conversation text segment to obtain a third conversation text segment having the second logical relationship with the first conversation text segment and the fourth conversation text segment; The step of constructing an associated conversation text segment having a logical relationship with the second text based on the first conversation text segment and the third conversation text segment includes: Based on the first conversation text segment, the third conversation text segment and the fourth conversation text segment, an associated conversation text segment having a logical relationship with the second text is constructed.
7. The method according to claim 1, characterized in that The step of enhancing the first text based on the first conversation text to obtain a third text includes: In the first conversation text, determining a first associated conversation text having a semantic similarity with the first text greater than a similarity threshold; Based on the first associated conversation text, the first text is enhanced to obtain a third text.
8. A text processing device, characterized in that: The device comprises: An intention recognition module is configured to perform intention recognition on a first text used to express a comment, and obtain a first intention of the first text; the first text is generated in a first time period; A first determination module is configured to determine, based on the first intention, a reference text that matches the first text from a second text used to express a comment; the second text is generated for the conversation text in a second time period; and the second time period is earlier than the first time period. a second determining module configured to determine a first conversation text having a logical relationship with the reference text based on a semantic logical relationship between the conversation text in the second time period and the second text; The enhancement module is configured to enhance the first text based on the first conversation text to obtain a third text.
9. An electronic device, characterized in that: The electronic device comprises: a memory for storing computer-executable instructions; A processor, configured to implement the method according to any one of claims 1 to 7 when executing the computer-executable instructions stored in the memory.
10. A computer-readable storage medium storing computer-executable instructions or a computer program, characterized in that: When the computer executable instructions or computer program are executed by a processor, the method according to any one of claims 1 to 7 is implemented.
11. A computer program product comprising computer executable instructions or a computer program, characterized in that When the computer executable instructions or computer program are executed by a processor, the method according to any one of claims 1 to 7 is implemented.