Target dialogue text processing method and device, equipment and storage medium
By identifying and analyzing the attributes of reference words in the dialogue text, target descriptive words are generated, which solves the problem of specific users being unable to respond to a large number of user inquiries in a timely manner, thus improving response efficiency.
Patent Information
- Application Number
- CN202111481104.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-12-06
- Publication Date
- 2025-12-16
- Estimated Expiration
- 2041-12-06
AI Technical Summary
When faced with a large number of user inquiries, some users are unable to process these inquiries in a timely manner, resulting in low response efficiency.
By acquiring the target dialogue text, identifying multiple reference words, determining their attributes, and generating target descriptive words based on these reference words and attributes, the system can accurately reflect the state of the first object and thus automatically respond to the user.
It improved the efficiency of responding to user inquiries and reduced the workload for specific users.
Smart Images

Figure CN114328859B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of computer, and particularly relates to a target dialogue text processing method and device, equipment and a storage medium. BACKGROUND
[0002] With the development of computer technology, a user can have a dialogue with a specific user through a network to consult relevant problems. For example, a patient can have a dialogue with a doctor through a network to consult his / her physical condition, or a customer can have a dialogue with a customer service through a network to consult a fault of a purchased product.
[0003] In the related art, the specific user manually replies according to the content sent by the user to answer the user's question. For example, in the scenario of processing patient consultation, each question sent by the patient needs to be processed by the doctor; in the scenario of processing product consultation, each question sent by the customer also needs to be processed by the customer service.
[0004] However, when facing a large number of user consultations at the same time, the specific user cannot process the user's consultation in time, resulting in low efficiency of replying to the user's consultation. SUMMARY
[0005] Embodiments of the present application provide a target dialogue text processing method, device, equipment and storage medium, which can improve the efficiency of replying to the user's consultation. The technical solution is as follows:
[0006] In one aspect, a target dialogue text processing method is provided, and the method comprises:
[0007] obtaining a target dialogue text, the target dialogue text being a text of a dialogue between a first object and a second object;
[0008] identifying the target dialogue text to obtain a plurality of reference words in the target dialogue text, the plurality of reference words comprising a feeling word of the first object and a description word of the second object for the first object, the feeling word being used to indicate a state of the first object;
[0009] determining an attribute of the plurality of reference words based on the plurality of reference words, a sentence in the target dialogue text and a sentence adjacent to the sentence in the target dialogue text, the sentence being a sentence where the reference word is located, the attribute being used to indicate authenticity of the reference word;
[0010] determining a target description word of the first object based on the plurality of reference words and the attribute of the plurality of reference words, the target description word being used to reply to the first object.
[0011] In one aspect, provided is a device for processing target dialogue text, the device comprising:
[0012] a target dialogue text obtaining module configured to obtain target dialogue text, the target dialogue text being text of a dialogue between a first object and a second object;
[0013] a recognition module configured to recognize the target dialogue text to obtain a plurality of reference words in the target dialogue text, the plurality of reference words comprising a feeling word of the first object and a description word of the second object for the first object, the feeling word being used to indicate a state of the first object;
[0014] an attribute determining module configured to determine attributes of the plurality of reference words based on the plurality of reference words, a sentence in the target dialogue text, and a sentence adjacent to the sentence in the target dialogue text, the sentence being a sentence in which the reference words are located, the attributes being used to indicate authenticity of the reference words;
[0015] a description word determining module configured to determine a target description word of the first object based on the plurality of reference words and the attributes of the plurality of reference words, the target description word being used to reply to the first object.
[0016] In one possible implementation, the recognition module is configured to, for any sentence in the target dialogue text, encode characters in the sentence based on an attention mechanism to obtain an encoding sequence corresponding to the sentence; and determine reference words in the sentence based on the sentence and a plurality of encodings in the encoding sequence.
[0017] In one possible implementation, the recognition module is configured to input the encoding sequence into a sequence labeling model, and output, by the sequence labeling model, a label sequence corresponding to the sentence based on positions of the plurality of encodings in the encoding sequence, a label in the label sequence being used to indicate whether a corresponding character in the sentence belongs to a reference word; and determine the reference words in the sentence based on the label sequence and the sentence.
[0018] In one possible implementation, the recognition module is configured to obtain initial reference words from the sentence based on a plurality of labels in the label sequence; and normalize the initial reference words by using a synonym table to obtain the reference words in the sentence, the synonym table recording a plurality of initial reference words corresponding to the reference words respectively.
[0019] In a possible implementation, the attribute determining module is configured to determine, for a first reference word in the plurality of reference words, an attribute of the first reference word based on the first reference word, a first sentence in which the first reference word is located, a second sentence preceding the first sentence in the target dialogue text, and a third sentence succeeding the first sentence in the target dialogue text.
[0020] In a possible implementation, the attribute determining module is configured to encode the first reference word, the first sentence, the second sentence, and the third sentence based on an attention mechanism to obtain a word feature corresponding to the first reference word; and determine the attribute of the first reference word based on the word feature.
[0021] In a possible implementation, the attribute determining module is configured to respectively embed and encode the first reference word, the first sentence, the second sentence, and the third sentence to obtain a first word encoding corresponding to the first reference word, a first encoding corresponding to the first sentence, a second encoding corresponding to the second sentence, and a third encoding corresponding to the third sentence; obtain a plurality of first attention weights between the first word encoding, the first encoding, the second encoding, and the third encoding; and fuse the first word encoding, the first encoding, the second encoding, and the third encoding based on the plurality of first attention weights to obtain the word feature corresponding to the first reference word.
[0022] In a possible implementation, the attribute determining module is configured to respectively embed and encode identity information of the first reference word, position information of a plurality of characters in the first reference word in the first reference word, the first reference word, and the plurality of characters in the first reference word to obtain a plurality of initial encodings of the first reference word; and fuse the plurality of initial encodings of the first reference word to obtain the first word encoding.
[0023] In a possible implementation, the attribute determining module is configured to fully connect the word feature to obtain an attribute value of the first reference word; in a case where the attribute value of the first reference word is less than or equal to an attribute threshold value, determine the attribute of the first reference word as negative, where negative indicates that the corresponding reference word is false; and in a case where the attribute value of the first reference word is greater than the attribute threshold value, determine the attribute of the first reference word as positive, where positive indicates that the corresponding reference word is true.
[0024] In a possible implementation, the description word determination module is configured to encode the plurality of reference words and attributes of the plurality of reference words based on an attention mechanism to obtain first object features of the first object; input the first object features of the first object into a first classifier, and output a predicted description word of the first object by the first classifier; input the first object features of the first object into a second classifier, and output a classification process identifier corresponding to the first object by the second classifier; and in a case where the classification process identifier indicates that the classification is ended, determine the predicted description word of the first object as a target description word of the first object.
[0025] In a possible implementation, the description word determination module is further configured to input the first object features of the first object into a third classifier, and output a predicted feeling word of the first object by the third classifier; in a case where the classification process identifier indicates that the classification is continued, determine an attribute of the predicted feeling word; encode the plurality of reference words, the attributes of the plurality of reference words, the predicted feeling word, and the attribute of the predicted feeling word based on an attention mechanism to obtain second object features of the first object; and determine a target description word of the first object based on the second object features.
[0026] In a possible implementation, the description word determination module is further configured to, in a case where the classification process identifier indicates that the classification is continued, generate an inquiry sentence based on the predicted feeling word, and send the inquiry sentence to the first object, where the inquiry sentence is used to inquire about the attribute of the predicted feeling word of the first object; obtain a reply sentence of the first object in response to the inquiry sentence; and determine the attribute of the predicted feeling word based on the reply sentence.
[0027] In a possible implementation, the description word determination module is further configured to respectively embed and encode position information of each character in a corresponding reference word in the plurality of reference words, the plurality of reference words, each character in the plurality of reference words, and attributes of the plurality of reference words to obtain reference word encodings of the plurality of reference words; obtain a plurality of second attention weights between the reference word encodings of the plurality of reference words; and fuse the reference word encodings of the plurality of reference words based on the plurality of second attention weights to obtain the first object features of the first object.
[0028] In an aspect, a computer device is provided, which includes one or more processors and one or more memories, and at least one computer program is stored in the one or more memories and loaded and executed by the one or more processors to implement the processing method of the target dialogue text.
[0029] In an aspect, a computer readable storage medium is provided, and the computer readable storage medium stores at least one computer program, the computer program is loaded and executed by a processor to implement the processing method of the target dialogue text.
[0030] In an aspect, a computer program product or computer program is provided, and the computer program product or computer program includes program code stored in a computer readable storage medium, the program code is read by a processor of a computer device from the computer readable storage medium, and the processor executes the program code to enable the computer device to execute the processing method of the target dialogue text.
[0031] By the technical solutions provided in the embodiments of the present application, the dialogue text between the first object and the second object can be obtained, and a plurality of reference words can be obtained from the dialogue text, the plurality of reference words being capable of reflecting the state of the first object. According to the reference words, the sentence to which the reference words belong, and the adjacent sentence of the sentence, the attribute of the reference words is determined, and the attribute is used to reflect the authenticity of the reference words. When the target description words are generated based on the reference words and the attribute of the reference words, the attribute related information of the reference words is often included in the context, so that the attribute of the reference words determined in this way is relatively accurate, and the target description words can accurately describe the state of the first object. When the first object is replied based on the target description words, the workload of the second object can be reduced, and the efficiency of the reply can be improved. BRIEF DESCRIPTION OF DRAWINGS
[0032] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings needed in the embodiment description will be briefly introduced. Obviously, the drawings in the following description are only some embodiments of the present application, and other drawings can be obtained by those skilled in the art without creative labor.
[0033] Figure 1 is a schematic diagram of an implementation environment of a target dialogue text processing method provided by an embodiment of the present application;
[0034] Figure 2 is a flowchart of a target dialogue text processing method provided by an embodiment of the present application;
[0035] Figure 3 is a flowchart of a target dialogue text processing method provided by an embodiment of the present application;
[0036] Figure 4 is a schematic diagram of a first representation model and a sequence labeling model provided by an embodiment of the present application;
[0037] Figure 5is a schematic diagram of a second representation model and a positive and negative classifier provided by an embodiment of the present application;
[0038] Figure 6 is a schematic diagram of a third representation model and three classifiers provided by an embodiment of the present application;
[0039] Figure 7 is a schematic diagram of a system structure provided by an embodiment of the present application;
[0040] Figure 8 is a schematic diagram of a target dialogue text processing device structure provided by an embodiment of the present application;
[0041] Figure 9 is a schematic diagram of a terminal structure provided by an embodiment of the present application;
[0042] Figure 10 is a schematic diagram of a server structure provided by an embodiment of the present application. DETAILED DESCRIPTION
[0043] In order to make the purpose, technical solutions and advantages of the present application clearer, the embodiments of the present application will be further described in detail below with reference to the drawings.
[0044] In the present application, the terms "first", "second", and the like are used to distinguish the same or similar items with substantially the same function and action, and it should be understood that there is no logical or time sequence dependency between "first", "second", and "nth", and the number and execution order are not limited.
[0045] In the present application, the term "at least one" means one or more, and the term "multiple" means two or more, for example, multiple face images means two or more face images.
[0046] Artificial intelligence (AI) is the use of digital computers or digital computer controlled machines to simulate, extend and expand human intelligence, perceive the environment, acquire knowledge and use knowledge to obtain the best results. In other words, artificial intelligence is a comprehensive technology of computer science, which tries to understand the essence of intelligence and produce a new intelligent machine that can react in a similar way to human intelligence. Artificial intelligence is to study the design principles and implementation methods of various intelligent machines, so that machines have the functions of perception, reasoning and decision making.
[0047] Artificial intelligence technology is a comprehensive discipline, involving a wide range of fields, both hardware and software level technology. Artificial intelligence basic technology generally includes technologies such as sensors, special artificial intelligence chips, cloud computing, distributed storage, big data processing technology, operation / interaction system, mechatronics, etc. Artificial intelligence software technology mainly includes computer vision technology, speech processing technology, natural language processing technology, and machine learning / deep learning, etc. several major directions.
[0048] Machine learning (ML) is a multi-disciplinary subject that involves probability theory, statistics, approximation theory, convex analysis, algorithm complexity theory, and other disciplines. It is a specialized study of how computers simulate or implement human learning behavior to acquire new knowledge or skills, and reorganize existing knowledge sub-models to continuously improve their performance. Machine learning is the core of artificial intelligence and the fundamental approach to enabling computers to have intelligence, and its applications span all areas of artificial intelligence. Machine learning and deep learning generally include artificial neural networks, belief networks, reinforcement learning, transfer learning, inductive learning, and teaching learning.
[0049] Among them, the medical cloud in cloud technology refers to the use of "cloud computing" to create a medical health service cloud platform based on cloud computing, mobile technology, multimedia, 4G communication, big data, and Internet of Things, combined with medical technology, to realize the sharing of medical resources and the expansion of medical scope. Because of the combination of cloud computing technology, the medical cloud improves the efficiency of medical institutions and facilitates residents to seek medical treatment. Like the hospital's appointment registration, electronic medical records, medical insurance, etc. are all products of the combination of cloud computing and the medical field. The medical cloud also has the advantages of data security, information sharing, dynamic expansion, and global layout. For example, the image recognition model provided by the embodiments of the present application is deployed on the medical health service cloud platform.
[0050] Semantic features: features used to represent the semantics expressed by the text. Different texts can correspond to the same semantic features, for example, the text "today's weather" and the text "today's weather" can correspond to the same semantic feature. The computer device can map the characters in the text to a character vector, and combine and operate the character vector according to the relationship between the characters to obtain the semantic features of the text. For example, the computer device can use Bidirectional Encoder Representations from Transformers (BERT).
[0051] Normalization processing: mapping a number series with different value ranges to the (0, 1) interval for easy data processing. In some cases, the normalized value can be directly implemented as a probability.
[0052] Embedded Coding: Embedded coding means a corresponding relationship in mathematics, that is, mapping data on X space to Y space through a function F, where the function F is a single function, and the mapping result is structure preservation. The single function means that the mapped data is uniquely corresponding to the pre-mapped data, and the structure preservation means that the size relationship of the pre-mapped data is the same as that of the post-mapped data. For example, there are data X1 and X2 before mapping, and Y1 corresponding to X1 and Y2 corresponding to X2 are obtained after mapping. If the data X1 > X2 before mapping, then the data Y1 > Y2 after mapping correspondingly. For words, it means mapping words to another space, which is convenient for subsequent machine learning and processing.
[0053] Attention weight: can represent the importance of certain data in the training or prediction process. The importance represents the size of the influence of the input data on the output data. The data with high importance has a higher value of the corresponding attention weight, and the data with low importance has a lower value of the corresponding attention weight. In different scenarios, the importance of data is not the same, and the process of training attention weight of the model is also the process of determining the importance of data.
[0054] It can be understood that in the specific embodiments of the present application, data related to target dialogue text is involved, and when the above embodiments of the present application are applied to specific products or technologies, user permission or consent is required, and the collection, use and processing of related data need to comply with relevant laws, regulations and standards of countries and regions.
[0055] Figure 1 is a schematic diagram of an implementation environment of a processing method of a target dialogue text provided by an embodiment of the present application, referring to Figure 1 The implementation environment can include a first terminal 110, a second terminal 120 and a server 140.
[0056] The first terminal 110 is connected to the server 140 through a wireless network or a wired network. Optionally, the first terminal 110 is a smart phone, a tablet computer, a notebook computer, a desktop computer, a vehicle-mounted terminal, etc., but is not limited thereto. The first terminal 110 is installed and runs an application program supporting network dialogue. In some embodiments, the first terminal 110 is a terminal used by a patient or a customer.
[0057] The second terminal 120 is connected to the server 140 through a wireless network or a wired network. Optionally, the second terminal 120 is a smart phone, a tablet computer, a notebook computer, a desktop computer, a vehicle-mounted terminal, etc., but is not limited thereto. The second terminal 120 is installed and runs an application program supporting network dialogue. In some embodiments, the second terminal 120 is a terminal used by a doctor or a customer service.
[0058] The server 140 is a stand-alone physical server, or a server cluster or distributed system composed of multiple physical servers, or a cloud server providing basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, content delivery networks (CDNs), and big data and artificial intelligence platforms.
[0059] Those skilled in the art can know that the number of terminals described above can be more or less. For example, the first terminal and the second terminal described above are only one, or the first terminal and the second terminal described above are tens or hundreds, or more, at this time, the implementation environment described above also includes other terminals. The number of terminals and the type of equipment are not limited in the embodiments of the application.
[0060] After introducing the implementation environment provided by the embodiments of the application, the application scenarios of the embodiments of the application will be introduced in combination with the implementation environment described above. In the following description, the first terminal is the first terminal 110 in the implementation environment described above, the second terminal is the second terminal 120 in the implementation environment described above, and the server is the server 140 in the implementation environment described above.
[0061] The target dialogue text processing method provided by the embodiments of the application can be applied in various online consultation scenarios. For example, the embodiments of the application can be applied in the scenario of patients consulting doctors online, and can also be applied in the scenario of customers consulting customer service about commodity faults online.
[0062] In the scenario of patients consulting doctors online, the patient uses the first terminal to consult, the doctor uses the second terminal to reply to the consultation, and the server provides intermediate services for communication between the first terminal and the second terminal. In some embodiments, the patient starts a target application program installed on the first terminal, which is an application program providing disease consultation function, and the server provides a background server for the target application program. The patient selects the doctor who wants to consult through the target application program. In some embodiments, the target application program provides functions of department selection and doctor selection, and the user can select the corresponding department and the doctor in the selected department through the target application program.
[0063] The patient can consult the doctor through the target application program, and the terminal used by the doctor is the second terminal. During the consultation, the patient sends a consultation statement to the second terminal through the target application program running on the first terminal, which is also called the patient's chief complaint. The doctor can view the consultation statement sent by the patient through the second terminal, and reply to the consultation statement through the second terminal.
[0064] Since the doctor can face consultations of multiple patients at the same time, the doctor can not reply to each patient in time, in this case, after adopting the technical solution provided by the embodiment of the application, the server can collect the target dialogue text of the dialogue between the patient and the doctor. The server identifies the target dialogue text to obtain a plurality of reference words in the target dialogue text, the plurality of reference words including a feeling word in a statement sent by the patient to the doctor, and also including a description word in a statement sent by the doctor to the patient, which can also be referred to as a diagnosis word, used to define the state of the first object. For example, the patient sends a consultation statement "I feel chest pain for the past two days" to the doctor through the first terminal, and "chest pain" in the consultation statement is a feeling word, used to represent the state of the patient. The doctor sends a reply statement "your condition may be pericarditis" to the patient through the second terminal, and "pericarditis" in the reply statement is a description word, used to define the state of the patient. Of course, in the scenario of the patient consulting the doctor, the feeling word can also be referred to as a symptom, and the description word can also be referred to as a disease.
[0065] After identifying the plurality of reference words in the target dialogue text, the server can determine the attribute of the plurality of reference words based on the plurality of reference words, the statements to which the plurality of reference words in the target text respectively belong, and the statements adjacent to the statements in the target text, the attribute being used to indicate the authenticity of the reference words. For example, for a group of dialogues, the patient sends a consultation statement "I feel stomach pain" to the doctor through the first terminal and carries a picture of the pain site, and the doctor replies "according to the picture, this is the position of the intestine, not the stomach", so the authenticity of "stomach pain" determined from the consultation statement "I feel stomach pain" is false. For another group of dialogues, the patient sends a consultation statement "I feel eye pain" to the doctor through the first terminal, and the doctor replies "how long does the pain last", so the authenticity of "eye pain" determined from the consultation statement "I feel eye pain" is true. As can be seen, the authenticity of the reference word can be inferred according to the context of the statement in which the reference word is located, therefore, the server can determine the attribute of the reference word based on the statement in which the reference word is located and the statements adjacent to the statement. The server can ultimately determine the target description word according to the plurality of reference words and the attributes of the plurality of reference words, the target description word being used to reply to the patient, in this case, the server can generate the target description word to reply to the patient based on the dialogue between the patient and the doctor in the case that the doctor is relatively busy, thereby reducing the work intensity of the doctor and improving the efficiency of the reply.
[0066] It should be noted that in the above description, the server obtains the target dialogue text, and generates the target description word by processing the target dialogue text. In other possible implementation manners, the first terminal or the second terminal can also obtain the target dialogue text, and generate the target description word by processing the target dialogue text, which is not limited in the embodiments of the application.
[0067] In addition, in the scenario of the customer online consulting the product fault, the consultation statement sent by the customer to the customer service is also a statement describing the product fault, and the description word in the consultation statement is also a word used to describe the product state. The reply statement sent by the customer service to the customer is a statement for qualifying the product fault, and accordingly, the description word is also the name of the fault. The scenario of the customer online consulting the product fault and the scenario of the patient online consulting the doctor belong to the same inventive concept in the process of the target dialogue text, and the implementation process is described above, which is not described herein again.
[0068] In addition, the processing method of the target dialogue text provided by the embodiments of the application can be applied to other online consultation scenarios in addition to the scenario of the patient online consulting the doctor and the scenario of the customer online consulting the product fault, which is not limited in the embodiments of the application.
[0069] After introducing the implementation environment and the application scenario of the embodiments of the application, the flowchart of the processing method of the target dialogue text provided by the embodiments of the application is described below, which is described with reference to Figure 2 Taking the execution by the server as an example, the method comprises the following steps.
[0070] 201. The server obtains the target dialogue text, which is the text of the dialogue between the first object and the second object.
[0071] The target dialogue text comprises the statement sent by the first object to the second object and the statement sent by the second object to the first object. In the scenario of the patient consulting the doctor, the first object is the patient, and the second object is the doctor, and accordingly, the target dialogue text is the dialogue text between the patient and the doctor.
[0072] 202. The server identifies the target dialogue text to obtain a plurality of reference words in the target dialogue text, wherein the plurality of reference words comprise the feeling word of the first object and the description word of the second object for the first object, and the feeling word is used to represent the state of the first object.
[0073] In some embodiments, the reference word is also an entity, and the process of identifying the target dialogue text is also the process of performing entity identification on the target dialogue text, and accordingly, the feeling word of the first object and the description word for the first object are both entities.
[0074] 203、The server determines attributes of the plurality of reference words based on the plurality of reference words, a sentence in the target dialogue text, and sentences adjacent to the sentence in the target dialogue text, the sentence being a sentence in which the reference word is located, the attributes being used to indicate authenticity of the reference words.
[0075] The authenticity of the reference words is used to represent whether the reference words can truly describe the state of the first object. After the attributes of the plurality of reference words are determined, the accuracy of subsequently determining the target description word can be improved.
[0076] 204、The server determines a target description word of the first object based on the plurality of reference words and the attributes of the plurality of reference words, the target description word being used to reply to the first object.
[0077] The target description word is determined by the server according to the target dialogue text, and the target description word can be used for automatic reply when the second object cannot timely reply to the first user, thereby reducing the workload of the second object and improving the reply efficiency.
[0078] Through the technical solutions provided in the embodiments of the present application, the dialogue text between the first object and the second object can be obtained, and a plurality of reference words can be obtained from the dialogue text, the plurality of reference words being capable of reflecting the state of the first object. Attributes of the reference words are determined according to the reference words, sentences to which the reference words belong, and sentences adjacent to the sentences, the attributes being used to reflect authenticity of the reference words. When the target description word is generated based on the reference words and the attributes of the reference words, information related to the attributes of the reference words is often included in the context, so that the attributes of the reference words determined in this way are relatively accurate, and the target description word can accurately describe the state of the first object. When the first object is replied based on the target description word, the workload of the second object can be reduced, and the reply efficiency can be improved in the face of a large number of consultations.
[0079] Figure 3 is a flowchart of a target dialogue text processing method provided by an embodiment of the present application, referring to Figure 3 , the method comprises:
[0080] 301、The server obtains a target dialogue text, the target dialogue text being a text for dialogue between a first object and a second object.
[0081] The target dialogue text is a sentence set, including a sentence sent by a first object to a second object, and also including a sentence sent by the second object to the first object. In some embodiments, the target dialogue text is marked with the object sending the sentence. In the scenario of a patient consulting a doctor, the first object is the patient, and the second object is the doctor. The patient sends a consultation sentence to the doctor to describe his / her own state. The doctor diagnoses the patient according to the consultation sentence sent by the patient, and sends a diagnosis result to the patient. Of course, there can be multiple rounds of dialogue between the patient and the doctor. The consultation sentence sent by the patient to the doctor can have missing information or incorrect information. The doctor can send a reply sentence to the patient to guide the patient to provide more information, thereby improving the accuracy of the diagnosis. In this case, the patient and the doctor send multiple sentences to each other, and the target dialogue text is a set of multiple sentences. Of course, the sentences in the target dialogue text are arranged in chronological order, which facilitates subsequent modeling of the relationship between the sentences.
[0082] In a possible implementation, the server obtains multiple sentences sent by a first terminal and a second terminal to each other, the multiple sentences being the target dialogue text. The first terminal is a terminal used by a first object, and the second terminal is a terminal used by a second object. Of course, in this manner, the server obtains the multiple sentences sent by the first object and the second object to each other with the consent of the first object and the second object.
[0083] In this implementation, the server can directly obtain the target dialogue text from the first terminal and the second terminal, and the efficiency of text acquisition is high.
[0084] For example, the first terminal runs a consultation end of a target application program, the second terminal runs a reply end of the target application program, the target application program is an application program providing an online dialogue function, and the server provides a background service for the target application program. The first object starts the consultation end of the target application program on the first terminal, and selects a second object to be consulted on the consultation end. The first object sends a consultation sentence to the selected second object through the consultation end of the target application program. The consultation sentence is forwarded to the second terminal by the server, that is, sent to the reply end of the target application program. The second object can view the consultation sentence sent by the first object through the reply end. Of course, the second object can also send a reply sentence to the first object through the reply end. The reply sentence is also forwarded by the server. In this case, the server can obtain the sentences sent by the first terminal to the second terminal, and also obtain the sentences sent by the second terminal to the first terminal. The multiple sentences are arranged in chronological order according to the sending time, and the target dialogue text is formed.
[0085] In the scenario where the patient consults the doctor, the target application is an online consultation application. The patient can select a doctor on the consultation terminal to which the patient wants to consult. For example, the patient selects a department on the consultation terminal to which the patient wants to consult, and further selects a doctor under the department. After the selection, the patient can send a consultation statement to the reply terminal used by the doctor through the consultation terminal. The consultation statement is used to describe the patient's feelings, which can be physical feelings or spiritual feelings. The doctor can view the consultation statement sent by the patient through the reply terminal and reply according to the consultation statement. The server obtains the consultation statement sent by the patient to the doctor and the reply statement sent by the doctor to the patient. The consultation statement and the reply statement are the target dialogue text.
[0086] In a possible implementation, the server obtains target dialogue audio, performs speech recognition on the target dialogue audio, and obtains the target dialogue text. The target dialogue audio is audio of a dialogue between a first object and a second object.
[0087] In this implementation, the technical solution provided by the embodiments of the present application can be applied to a voice communication scenario. That is, in the case where the first object and the second object perform voice communication, the technical solution provided by the embodiments of the present application can also be used to determine the description word.
[0088] For example, the server obtains target dialogue audio from a first terminal and a second terminal. The target dialogue audio is audio of a voice communication between a first object and a second object. The first terminal is a terminal used by the first object, and the second terminal is a terminal used by the second object. The server inputs the target dialogue audio into a speech recognition model, and converts the target dialogue audio into the target dialogue text through the speech recognition model. In some embodiments, when the server converts the target dialogue audio through the speech recognition model, the server can further perform voiceprint recognition on the target dialogue audio to obtain identity information corresponding to the target dialogue audio. The identity information is used to indicate a part of the target dialogue audio that belongs to the first object and a part of the target dialogue audio that belongs to the second object. The server determines audio corresponding to the first object and the second object in the target dialogue audio based on the identity information corresponding to the target dialogue audio and the target dialogue audio. The server labels the object corresponding to the statement in the target dialogue text according to the result of the voiceprint recognition, so as to distinguish the statement corresponding to the first object and the statement corresponding to the second object.
[0089] In the scenario that the patient consults the doctor, the target application is an online consultation type application, and the patient can select a doctor to be consulted on the consultation end, for example, the patient selects a department to be consulted on the consultation end, and further selects a doctor under the department. After the selection is completed, the first terminal establishes a connection with the reply end on the second terminal through the consultation end, and the patient can communicate with the doctor through the consultation end. The server obtains the audio of the patient and the doctor during the communication, which is the target dialogue audio. The server performs time-frequency conversion on the target dialogue audio to convert the target dialogue audio into frequency domain information. The server inputs the frequency domain information into the speech recognition model to extract the frequency domain features of the frequency domain information through the speech recognition model. The server maps based on the frequency domain features through the speech recognition model to obtain the target dialogue text. In addition, in order to distinguish the statements corresponding to the patient and the statements corresponding to the doctor in the target dialogue text, the server can label the audios from the first terminal and the second terminal when obtaining the target dialogue audio, and distinguish the statements corresponding to the patient and the statements corresponding to the doctor in the target dialogue text based on the labeling. Alternatively, since the patient and the doctor have different voiceprint characteristics, the server can perform voiceprint recognition on the target dialogue audio to obtain identity information corresponding to the target dialogue audio, and the identity information is used to indicate whether the target dialogue audio is the audio corresponding to the patient or the audio corresponding to the doctor. The server can label the recognized target dialogue text based on the identity information and the target dialogue audio to obtain the statements corresponding to the patient and the statements corresponding to the doctor in the target dialogue text.
[0090] 302、The server identifies the target dialogue text to obtain a plurality of reference words in the target dialogue text, the plurality of reference words including a feeling word of the first object and a description word of the second object for the first object, and the feeling word is used to represent the state of the first object.
[0091] Among them, the process of identifying the target dialogue text by the server is also the process of entity recognition of the target dialogue text by the server, and correspondingly, the plurality of reference words identified are all entities. In the scenario that the patient consults the doctor online, the feeling word in the plurality of reference words is a symptom entity, and the description word in the plurality of reference words is a disease entity.
[0092] In a possible implementation, for any statement in the target dialogue text, the server encodes the characters in the statement based on an attention mechanism to obtain an encoding sequence corresponding to the statement. The server determines the reference word in the statement based on the statement and a plurality of encodings in the encoding sequence.
[0093] In order to more clearly illustrate the above implementation, the following will be divided into two parts to illustrate the above implementation.
[0094] The first part encodes the characters in the sentence based on an attention mechanism to obtain an encoding sequence corresponding to the sentence.
[0095] In a possible implementation, the server respectively performs embedding encoding on the plurality of characters in the sentence to obtain a plurality of character encodings respectively corresponding to the plurality of characters in the sentence. The server inputs the plurality of character encodings into the first representation model to obtain attention weights between the plurality of characters in the sentence through the first representation model. The server fuses the plurality of character encodings based on the attention weights between the plurality of character encodings through the first representation model to obtain a plurality of encodings respectively corresponding to the plurality of characters, and the plurality of encodings constitute an encoding sequence corresponding to the sentence.
[0096] In this implementation, the server can first perform embedding encoding on the plurality of characters to obtain a plurality of character encodings, and then input the plurality of character encodings into the first representation model to obtain attention weights between the plurality of character encodings through the first representation model, so as to model the context relationship between the plurality of character encodings, and the obtained plurality of encodings can more accurately reflect the meaning of the corresponding characters, thereby improving the accuracy of subsequent determination of the reference word.
[0097] For example, referring to Figure 4 , the server respectively performs embedding encoding on the plurality of characters {Tok 1-Tok N} in the sentence to obtain a plurality of character encodings {E1-E n} respectively corresponding to the plurality of characters. The character and the character encoding are in a one-to-one relationship, that is, the character Tok 1 corresponds to the character encoding E1, the character Tok N corresponds to the character encoding E N N is a positive integer, indicating the number of characters in the sentence. The server inputs the N character encodings {E1-E n} into the first representation model 401, which is a language representation model, such as a Bert model. The server obtains a query matrix, a key matrix, and a value matrix of the plurality of character encodings through the first representation model. The server determines the attention weights between the plurality of character encodings based on the query matrix and the key matrix of the plurality of character encodings through the first representation model. The server fuses the value matrix of the plurality of character encodings based on the attention weights between the plurality of character encodings to obtain a plurality of encodings {T1-T N} respectively corresponding to the plurality of characters, and the plurality of encodings constitute an encoding sequence corresponding to the sentence. In some embodiments, in the process of determining the attention weights by the server through the first representation model, such as determining the attention weight of a first character in the plurality of characters to a second character, the server multiplies the query matrix of the first character and the key matrix of the second character through the first representation model to obtain the attention weight of the first character to the second character.
[0098] The second part, the server determines the reference words in the sentence based on the sentence and the plurality of encodings in the encoding sequence.
[0099] In one possible implementation, the server inputs the encoding sequence into a sequence labeling model, and outputs a label sequence corresponding to the sentence based on positions of the plurality of encodings in the encoding sequence through the sequence labeling model, where a label in the label sequence is used to indicate whether a corresponding character in the sentence belongs to a reference word. The server determines the reference words in the sentence based on the label sequence and the sentence.
[0100] In this implementation, the server can input the encoding sequence into a sequence labeling model, and output a corresponding label sequence through the sequence labeling model, that is, output a label sequence through the sequence labeling model, and determine whether a corresponding character belongs to a reference word through a label in the label sequence, and thus determine the reference words in the sentence.
[0101] In some embodiments, the sequence labeling model is a CRF (Conditional Random Field) model, or an RNN (Recurrent Neural Network) model, or an LSTM (Long Short-Term Memory) model, or various transformations of the above three models. Of course, as technology develops, the sequence labeling model can also be other models with sequence labeling capability, and the present application does not limit this.
[0102] The above implementation includes the step of determining a label sequence by the server through a sequence labeling model and the step of determining reference words in a sentence based on the label sequence and the sentence by the server, which will be described below.
[0103] A. The server inputs the encoding sequence into a sequence labeling model, and outputs a label sequence corresponding to the sentence based on positions of the plurality of encodings in the encoding sequence through the sequence labeling model.
[0104] In a possible implementation, the server inputs the coding sequence into a sequence labeling model, and for the i-th coding in the coding sequence, the server predicts, based on the i-th coding, the i-1-th coding and the i+1-th coding by the sequence labeling model, a probability that the i-th coding corresponds to a plurality of candidate labels, where the plurality of candidate labels include a label that does not belong to the reference word, a start character of the reference word and an intermediate character of the reference word, and i is a positive integer. The server determines a candidate label corresponding to the maximum probability of the i-th coding as the label of the i-th coding. The server performs the above steps on each coding in the coding sequence to obtain a plurality of labels corresponding to each coding in the coding sequence respectively, and the plurality of labels constitute the label sequence. In some embodiments, the label is used not only to indicate whether the corresponding character belongs to the reference word, but also to indicate, in the case that the label belongs to the reference word, whether the corresponding character is the start character or the intermediate character of the reference word. For example, refer to Figure 4 The server inputs the coding sequence {T1-T N} into a sequence labeling model (CRF) to output the label sequence.
[0105] The server determines the reference word in the sentence based on the label sequence and the sentence.
[0106] In a possible implementation, the server extracts a plurality of characters belonging to the reference word from the sentence according to the labels in the label sequence, and splices the plurality of characters to obtain the reference word in the sentence.
[0107] In a possible implementation, the server obtains an initial reference word from the sentence based on the plurality of labels in the label sequence. The server normalizes the initial reference word to obtain the reference word in the sentence by using a synonym table, where the synonym table records a plurality of initial reference words corresponding to a plurality of reference words respectively.
[0108] The synonym table is configured by a technician according to actual conditions, and is used to normalize the identified initial reference word, and the reference word obtained after normalization is a standard reference word. For example, the server can identify two initial reference words with the same meaning but different expressions from different sentences. After normalization of the two initial reference words by the synonym table, one standard reference word can be used to replace the two initial reference words with different expressions, thereby improving the accuracy of subsequent determination of the attribute of the reference word.
[0109] It should be noted that the number of reference words in the sentence can be one or more, and the embodiments of the present application do not limit the number of reference words.
[0110] The step 302 will be described below in combination with the above implementation and Figure 4 .
[0111] Referring to Figure 4 In the scenario of the patient consulting the doctor online, the sentence is "young people have chest pain symptoms", the server respectively encodes the multiple characters {Tok 1-Tok N} in the sentence to obtain multiple character encodings {E1-E n} corresponding to the multiple characters respectively, wherein the character "year" in the sentence corresponds to the token Tok 1 in Figure 4 , the character "light" corresponds to the token Tok 2 in Figure 4 , and so on. The server inputs the N character encodings {E1-E n} into the first representation model 401, which is a BERT model. The server obtains a query matrix, a key matrix and a value matrix of the multiple character encodings through the first representation model 401. The server determines the attention weights between the multiple character encodings based on the query matrix and the key matrix of the multiple character encodings through the first representation model 401. The server fuses the value matrix of the multiple character encodings based on the attention weights between the multiple character encodings to obtain multiple encodings {T1-T N} corresponding to the multiple characters respectively, which constitute an encoding sequence corresponding to the sentence. The server inputs the encoding sequence into the sequence labeling model 402 and outputs a label sequence (O O O O O B I O O) through the sequence labeling model 402, wherein O represents that the corresponding character does not belong to the reference word, B represents that the corresponding character is the start character of the reference word, and I represents that the corresponding character is the middle character of the reference word. The server determines two characters "chest" and "pain" belonging to the reference word from the sentence "young people have chest pain symptoms" based on the label sequence (O O O O B I O O) and the sentence "young people have chest pain symptoms", and combines the two characters "chest" and "pain" to obtain the reference word "chest pain". Wherein, Figure 4 the symbol [CLS] in
[0112] In some embodiments, the sequence labeling model is capable of labeling the types of the reference words in addition to labeling the reference words from the sentence. In the embodiments of the present application, it is to label whether the reference words are feeling words or description words. In this case, the number of candidate labels corresponding to the sequence labeling model will also increase, that is, the labeling range of the sequence labeling model will be larger, and the label determined by the sequence labeling model can not only indicate whether the corresponding character belongs to the reference word and which part of the reference word it belongs to, but also indicate the type of the corresponding character belonging to the reference word. For example, the plurality of candidate labels corresponding to the sequence labeling model include: not belonging to the reference word, the start character of the feeling word, the end character of the feeling word, the start character of the description word, and the end character of the description word. In the scenario of patients online consulting doctors, the feeling word is a symptom entity, and the description word is a disease entity. Then, the start character of the feeling word can be represented by B-SYMP, the intermediate character of the feeling word is represented by I-SYMP, SYMP is the abbreviation of Symptom in English; the start character of the feeling word is represented by B-DISE, and the intermediate character of the feeling word is represented by I-DISE, DISE is the abbreviation of Disease in English.
[0113] In a possible implementation, for any sentence in the target dialogue text, the server matches the sentence with the reference word template to obtain a plurality of reference words from the sentence.
[0114] In some embodiments, the reference words belong to a reference word dictionary, and the reference word dictionary is used to record a plurality of standardized reference words. The reference word dictionary has different contents according to different application scenarios. In the scenario of patients online consulting doctors, the reference words in the reference word dictionary are all related to symptoms and diseases. In the scenario of customers online consulting customer service, the reference words in the reference word dictionary are all related to fault description and fault. In other words, since the plurality of reference words are all entities, the reference word template is an entity template.
[0115] For example, for any sentence in the target text, the server performs word segmentation on the sentence to divide the sentence into a plurality of words. The server performs template matching on the plurality of words with the reference word template, and determines any word as a reference word of the sentence when the similarity between the word and the reference word template meets a target condition. For example, the server performs word segmentation on the sentence to divide the sentence into a plurality of words. The server extracts features of the plurality of words to obtain semantic features of the plurality of words. For any word in the plurality of words, the server obtains the similarity between the semantic features of the word and the semantic features of the reference word template. In the case where the similarity is greater than or equal to a similarity threshold, the server determines the word as a reference word.
[0116] 303、The server determines the attribute of the plurality of reference words based on the plurality of reference words, the sentence in the target dialogue text, and the sentence adjacent to the sentence in the target dialogue text, the sentence being the sentence where the reference word is located, the attribute being used to indicate the authenticity of the reference word.
[0117] The attribute of the reference word includes negative, positive, and unknown, wherein the positive indicates that the reference word is true, the negative indicates that the authenticity of the reference word is false, and the position indicates that the authenticity of the reference word is unknown. In the scenario that the patient consults the doctor online, the reference word is used to indicate the symptom or disease, and the attribute of the reference word is used to indicate whether the patient has the symptom or disease indicated by the reference word. In the case that the attribute of the reference word is positive, it indicates that the patient has the symptom or disease indicated by the reference word. In the case that the attribute of the reference word is negative, it indicates that the patient does not have the symptom or disease indicated by the reference word.
[0118] In a possible implementation, for a first reference word in the plurality of reference words, the server determines the attribute of the first reference word based on the first reference word, the first sentence, the second sentence, and the third sentence, the first sentence being the sentence where the first reference word is located, the second sentence being the previous sentence of the first sentence in the target dialogue text, and the third sentence being the next sentence of the first sentence in the target dialogue text.
[0119] In this implementation, when determining the attribute of the first reference word, the first sentence where the first reference word is located and the second sentence and the third sentence adjacent to the first sentence are combined, so that the attribute of the first reference word determined also integrates the information provided by the first sentence, the second sentence, and the third sentence, and the attribute of the first reference word determined is more accurate.
[0120] For example, the server encodes the first reference word, the first sentence, the second sentence, and the third sentence based on the attention mechanism to obtain the vocabulary feature corresponding to the first reference word. The server determines the attribute of the first reference word based on the vocabulary feature. The vocabulary feature is obtained by encoding the first reference word, the first sentence, the second sentence, and the third sentence based on the attention mechanism. Since the information that helps to determine the authenticity of the first reference word often appears in the context sentences of the sentence where the first reference word is located, the vocabulary feature obtained by combining the first reference word, the first sentence, the second sentence, and the third sentence also integrates the context information of the first reference word, and the attribute determined based on the vocabulary feature is more accurate.
[0121] In the above example, the two steps of determining the vocabulary feature corresponding to the first reference word by the server and determining the attribute of the first reference word by the server are included. In order to make the description clearer, the two steps will be described in two parts as follows.
[0122] In the first part, the server encodes the first reference word, the first sentence, the second sentence and the third sentence based on an attention mechanism to obtain the vocabulary feature corresponding to the first reference word.
[0123] In a possible implementation, the server respectively embeds encodes the first reference word, the first sentence, the second sentence and the third sentence to obtain the first word encoding corresponding to the first reference word, the first encoding corresponding to the first sentence, the second encoding corresponding to the second sentence and the third encoding corresponding to the third sentence. The server obtains a plurality of first attention weights between the first word encoding, the first encoding, the second encoding and the third encoding. The server fuses the first word encoding, the first encoding, the second encoding and the third encoding based on the plurality of first attention weights to obtain the vocabulary feature corresponding to the first reference word.
[0124] In order to make the above implementation clearer, the above implementation will be described in three steps as follows.
[0125] A, the server respectively embeds encodes the first reference word, the first sentence, the second sentence and the third sentence to obtain the first word encoding corresponding to the first reference word, the first encoding corresponding to the first sentence, the second encoding corresponding to the second sentence and the third encoding corresponding to the third sentence.
[0126] In a possible implementation, the server respectively performs embedding encoding on identity information corresponding to the first reference word, position information of the plurality of characters in the first reference word in the first reference word, the first reference word, and the plurality of characters in the first reference word, to obtain a plurality of initial encodings of the first reference word. The server fuses the plurality of initial encodings of the first reference word to obtain the first word encoding. The identity information corresponding to the first reference word is used to indicate a sender of the first reference word, that is, whether the first reference word is sent by the first object or the second object. In the scenario of online consultation of a doctor by a patient, the identity information is used to indicate whether the first reference word is sent by the patient or the doctor. The position information of the plurality of characters in the first reference word in the first reference word refers to an arrangement order of the plurality of characters in the first reference word. The plurality of initial encodings of the first reference word include an initial encoding corresponding to the identity information corresponding to the first reference word, an initial encoding corresponding to the position information of the plurality of characters in the first reference word in the first reference word, an initial encoding corresponding to the first reference word, and an initial encoding corresponding to the plurality of characters in the first reference word. In some embodiments, the process of embedding encoding the identity information corresponding to the first reference word is also referred to as identity embedding; the process of embedding encoding the position information of the plurality of characters in the first reference word in the first reference word is also referred to as position embedding; the process of embedding encoding the first reference word is also referred to as segment embedding; and the process of embedding encoding the plurality of characters in the first reference word is also referred to as word embedding.
[0127] The server respectively performs embedding encoding on identity information corresponding to the first sentence, position information of the plurality of characters in the first sentence in the first sentence, the first sentence, and the plurality of characters in the first sentence, to obtain a plurality of initial encodings of the first sentence. The server fuses the plurality of initial encodings of the first sentence to obtain the first encoding. The identity information corresponding to the first sentence is used to indicate a sender of the first sentence, that is, whether the first sentence is sent by the first object or the second object. The position information of the plurality of characters in the first sentence in the first sentence refers to an arrangement order of the plurality of characters in the first sentence. The plurality of initial encodings of the first sentence include an initial encoding corresponding to the identity information corresponding to the first sentence, an initial encoding corresponding to the position information of the plurality of characters in the first sentence in the first sentence, an initial encoding corresponding to the first sentence, and an initial encoding corresponding to the plurality of characters in the first sentence.
[0128] The server respectively encodes the identity information corresponding to the second statement, the position information of the plurality of characters in the second statement in the second statement, the second statement, and the plurality of characters in the second statement to obtain a plurality of initial encodings of the second statement. The server fuses the plurality of initial encodings of the second statement to obtain the second encoding. The identity information corresponding to the second statement is used to indicate the sender of the second statement, that is, whether the second statement is sent by the first object or the second object. The position information of the plurality of characters in the second statement in the second statement refers to the arrangement order of the plurality of characters in the second statement. The plurality of initial encodings of the second statement includes the initial encoding corresponding to the identity information corresponding to the second statement, the initial encoding corresponding to the position information of the plurality of characters in the second statement in the second statement, the initial encoding corresponding to the second statement, and the initial encoding corresponding to the plurality of characters in the second statement.
[0129] The server respectively encodes the identity information corresponding to the third statement, the position information of the plurality of characters in the third statement in the third statement, the third statement, and the plurality of characters in the third statement to obtain a plurality of initial encodings of the third statement. The server fuses the plurality of initial encodings of the third statement to obtain the third encoding. The identity information corresponding to the third statement is used to indicate the sender of the third statement, that is, whether the third statement is sent by the first object or the second object. The position information of the plurality of characters in the third statement in the third statement refers to the arrangement order of the plurality of characters in the third statement. The plurality of initial encodings of the third statement includes the initial encoding corresponding to the identity information corresponding to the third statement, the initial encoding corresponding to the position information of the plurality of characters in the third statement in the third statement, the initial encoding corresponding to the third statement, and the initial encoding corresponding to the plurality of characters in the third statement.
[0130] B. The server obtains a plurality of first attention weights between the first word encoding, the first encoding, the second encoding, and the third encoding.
[0131] In a possible implementation, the server inputs the first word encoding, the first encoding, the second encoding, and the third encoding into a second representation model, and obtains the plurality of first attention weights between the first word encoding, the first encoding, the second encoding, and the third encoding through the second representation model. The second representation model is a language representation model, such as a Bert model.
[0132] For example, the server obtains, through the second representation model, query matrices, key matrices and value matrices of the first word encoding, the first encoding, the second encoding and the third encoding respectively. The server determines, through the second representation model, first attention weights between the character encodings based on the query matrices and the key matrices of the first word encoding, the first encoding, the second encoding and the third encoding. In some embodiments, in the process of determining the attention weights by the server through the second representation model, such as determining the attention weight of the first word encoding to the first encoding, the server multiplies the query matrix of the first word encoding with the key matrix of the first encoding through the second representation model to obtain the first attention weight of the first word encoding to the first encoding.
[0133] C. The server fuses the first word encoding, the first encoding, the second encoding and the third encoding based on the plurality of first attention weights to obtain a vocabulary feature corresponding to the first reference word.
[0134] In a possible implementation, the server fuses the value matrices of the first word encoding, the first encoding, the second encoding and the third encoding based on the first attention weights between the character encodings to obtain the vocabulary feature corresponding to the first reference word. In some embodiments, the fusion here refers to weighted summation, and the weight is the first attention weight.
[0135] The second part, the server determines the attribute of the first reference word based on the vocabulary feature.
[0136] In a possible implementation, the server fully connects the vocabulary feature to obtain an attribute value of the first reference word. In the case where the attribute value of the first reference word is less than or equal to an attribute threshold, the server determines the attribute of the first reference word as negative, and the negative indicates that the corresponding reference word is false. In the case where the attribute value of the first reference word is greater than the attribute threshold, the server determines the attribute of the first reference word as positive, and the positive indicates that the corresponding reference word is true.
[0137] The attribute threshold is set by a technician according to actual conditions, and embodiments of the present application do not limit this.
[0138] For example, the server inputs the vocabulary feature into an attribute classifier, which is also referred to as a positive-negative classifier. The server fully connects the vocabulary feature through a full connection matrix of the attribute classifier to map the vocabulary feature to an attribute value of the first reference word. In the case where the attribute value of the first reference word is less than or equal to an attribute threshold, the server determines the attribute of the first reference word as negative, and the negative indicates that the corresponding reference word is false. In the case where the attribute value of the first reference word is greater than the attribute threshold, the server determines the attribute of the first reference word as positive, and the positive indicates that the corresponding reference word is true.
[0139] The above step 303 will be further described below in combination with Figure 5 and the possible implementation manners of the above step 303.
[0140] Referring to Figure 5 For example, in the scenario of the patient consulting the doctor online, for the first reference word, the server respectively performs embedding coding on the first reference word e, the first sentence s1, the second sentence s2 and the third sentence s3 to obtain the first word encoding corresponding to the first reference word, the first encoding corresponding to the first sentence, the second encoding corresponding to the second sentence and the third encoding corresponding to the third sentence. The embedding coding herein includes identity embedding, position embedding, segment embedding and word embedding. Taking the first reference word as an example, the identity embedding refers to embedding coding on the identity information; the position embedding refers to embedding coding on the position information of the plurality of characters in the first reference word in the first reference word; the segment embedding refers to embedding coding on the first reference word; and the word embedding refers to the process of embedding coding on the plurality of characters in the first reference word, which is also referred to as word embedding.
[0141] In Figure 5 , [CLS] is a start symbol; [SEP] is a separator symbol used to separate the first reference word e, the first sentence s1, the second sentence s2 and the third sentence s3; Tok e_1 represents the first character in the first reference word, Tok s1_1 represents the first character in the first sentence, Tok s2_1 represents the first character in the second sentence, and Tok s3_1 represents the first character in the third sentence; E 医生 represents that the corresponding reference word / sentence is sent by the doctor, E 医生 is the identity code corresponding to the doctor, E 患者 represents that the corresponding reference word / sentence is sent by the patient, E 患者 is the identity code corresponding to the patient; E1 represents the position code of the first character in the first reference word, E m+1 represents the position code of the first character in the first sentence, E n+1 represents the position code of the first character in the second sentence, E l+1 represents the position code of the first character in the third sentence; E A represents the segment code of the first reference word, E B represents the segment code of the first sentence, E C represents the segment code of the second sentence, E DEtk_e_1 represents the character encoding of the first character in the first reference word, tk_s1_1 represents the character encoding of the first character in the first sentence, tk_s2_1 represents the character encoding of the first character in the second sentence, and tk_s3_1 represents the character encoding of the first character in the third sentence.
[0142] The first word encoding of the first reference word includes the identity encoding, the position encoding, the segment encoding, and the word encoding of the first reference word; the first encoding of the first sentence includes the identity encoding, the position encoding, the segment encoding, and the word encoding of the first sentence; the second encoding of the second sentence includes the identity encoding, the position encoding, the segment encoding, and the word encoding of the second sentence; and the third encoding of the third sentence includes the identity encoding, the position encoding, the segment encoding, and the word encoding of the third sentence.
[0143] The second representation model 501 is a Bert model. The server inputs the first word encoding, the first encoding, the second encoding, and the third encoding into the second representation model 501, and obtains a plurality of first attention weights between the first word encoding, the first encoding, the second encoding, and the third encoding through the second representation model 501. The server fuses the word encoding, the first encoding, the second encoding, and the third encoding based on the plurality of first attention weights through the second representation model, and obtains a word feature C of the first reference word. The server inputs the word feature C into a positive and negative classifier 502, and outputs an attribute of the first reference word from the positive and negative classifier 502. The attribute includes negative, positive, and unknown.
[0144] In the scenario of online consultation of a doctor by a patient, because the description of a reference word and the answer to the question about the reference word often appear in the previous sentence or the next sentence of the sentence where the reference word is located, the key information for judging the positive and negative of the reference word is usually contained in the previous and next sentences. Therefore, in the embodiment of the present application, the reference word, the sentence where the reference word is located, and the previous and next sentences of the sentence where the reference word is located are input into the model, so that the model automatically captures useful information. The model includes the second representation model and the positive and negative classifier. In the process of online consultation of a doctor by a patient, there is a significant difference between the speeches of the patient and the doctor, and the doctor usually makes a judgment on the positive and negative. In the embedding encoding process, the identity embedding is added to represent whether a sentence is spoken by the patient or the doctor, so that the identity information in the dialogue is fully utilized, and the judgment of the model on the positive and negative of the reference word is more accurate. For example, referring to the following dialogue:
[0145] “Patient: Sometimes the heartbeat will suddenly be fast, then it will be down, not obvious, but can be felt, and has appeared 2 to 3 times in the past day, and has not appeared much in the past, just a little faster.
[0146] Doctor: Hello, according to the description, it is considered to be premature beat, which is a kind of arrhythmia.
[0147] Patient: What needs to be noted or other treatment?
[0148] In the above dialogue, the first reference word is "premature beat", and through the technical solution provided by the embodiments of the present application, it can be determined that the attribute of the first reference word "premature beat" is positive.
[0149] 304、The server determines the target description word of the first object based on the plurality of reference words and the attributes of the plurality of reference words.
[0150] In a possible implementation, the server encodes the plurality of reference words and the attributes of the plurality of reference words based on an attention mechanism to obtain first object features of the first object. The server inputs the first object features of the first object into a first classifier, and outputs a predicted description word of the first object through the first classifier. The server inputs the first object features of the first object into a second classifier, and outputs a classification process identifier corresponding to the first object through the second classifier. In the case where the classification process identifier indicates that the classification is ended, the server determines the predicted description word of the first object as the target description word of the first object.
[0151] In order to make the above-mentioned embodiments more clearly, the following will be divided into four parts to explain the above-mentioned embodiments.
[0152] The first part, the server encodes the plurality of reference words and the attributes of the plurality of reference words based on an attention mechanism to obtain first object features of the first object.
[0153] In a possible implementation, the server respectively embeds and encodes the position information of each character in the plurality of reference words in the corresponding reference word, the plurality of reference words, each character in the plurality of reference words, and the attributes of the plurality of reference words to obtain reference word encodings of the plurality of reference words. The server obtains a plurality of second attention weights between the reference word encodings of the plurality of reference words. The server fuses the reference word encodings of the plurality of reference words based on the plurality of second attention weights to obtain the first object features of the first object.
[0154] For example, the server respectively performs embedding encoding on the position information of each character in the corresponding reference word in the plurality of reference words, the plurality of reference words, each character in the plurality of reference words, and the attributes of the plurality of reference words, to obtain a plurality of initial encodings of each reference word. The server fuses the plurality of initial encodings of each reference word to obtain a reference word encoding of each reference word. The server inputs the plurality of reference word encodings of the plurality of reference words into a third representation model, and obtains attention weights between the plurality of reference word encodings through the third representation model, where the third representation model is a pre-trained language representation model, such as a pre-trained Bert model. In the scenario of patients online consulting doctors, the pre-selected language representation model is also a language representation model pre-trained based on medical corpus. The server fuses the plurality of reference word encodings based on the attention weights between the plurality of reference word encodings through the third representation model, to obtain the first object feature of the first object.
[0155] For example, referring to Figure 6 Taking the plurality of reference words "irritability" and "insomnia" as an example, through the above step 303, it is determined that the reference word "irritability" is positive, and the reference word "insomnia" is negative. The server concatenates "irritability" and "insomnia" into a reference word group "irritability, insomnia" as a processing target, and in Figure 6 , [CLS] is a start symbol, Tol 1 represents the first character "irritability" in the reference word group "irritability, insomnia", and Tol 2 represents the second character "irritability" in the reference word group "irritability, insomnia". The server performs embedding encoding on the reference word group "irritability, insomnia", including embedding encoding on the attributes of the reference word group, embedding encoding on the positions of the characters in the reference word group, embedding encoding on the reference word group, and embedding encoding on the plurality of characters in the reference word group.
[0156] In the embedding encoding on the attributes of the reference word group, for the two characters "irritability" and "irritability", since the attribute of the reference word "irritability" to which they belong is positive, the attributes of the two characters are also encoded as positive, Figure 6 E 阳 represents the attribute encoding. For the two characters "irritability" and "irritability", since the attribute of the reference word "irritability" to which they belong is positive, the attributes of the two characters are also encoded as positive, Figure 6 E 其他 represents the attribute encoding. For the two characters "irritability" and "irritability", since the attribute of the reference word "irritability" to which they belong is positive, the attributes of the two characters are also encoded as positive, Figure 6 E 阴 represents the attribute encoding. In the embedding encoding on the positions of the characters in the reference word group, Figure 6E0 represents the position encoding of the first character, E1 represents the position encoding of the second character, and so on. In the embedding encoding of the two reference words in the reference phrase, the positions corresponding to each character are the same, and Figure 6 E0 represents the position encoding of the first character, E1 represents the position encoding of the second character, and so on. In the embedding encoding of the two reference words in the reference phrase, the positions corresponding to each character are the same, and A E0 represents the position encoding of the first character, E1 represents the position encoding of the second character, and so on. In the embedding encoding of the two reference words in the reference phrase, the positions corresponding to each character are the same, and [CLS] E0 represents the position encoding of the first character, E1 represents the position encoding of the second character, and so on. In the embedding encoding of the two reference words in the reference phrase, the positions corresponding to each character are the same, and 暴 E0 represents the position encoding of the first character, E1 represents the position encoding of the second character, and so on. In the embedding encoding of the two reference words in the reference phrase, the positions corresponding to each character are the same, and 躁 E0 represents the position encoding of the first character, E1 represents the position encoding of the second character, and so on. In the embedding encoding of the two reference words in the reference phrase, the positions corresponding to each character are the same, and Figure 6 E0 represents the position encoding of the first character, E1 represents the position encoding of the second character, and so on. In the embedding encoding of the two reference words in the reference phrase, the positions corresponding to each character are the same, and O1 E0 represents the position encoding of the first character, E1 represents the position encoding of the second character, and so on. In the embedding encoding of the two reference words in the reference phrase, the positions corresponding to each character are the same, and O2 E0 represents the position encoding of the first character, E1 represents the position encoding of the second character, and so on. In the embedding encoding of the two reference words in the reference phrase, the positions corresponding to each character are the same, and
[0157] The server inputs the multiple reference word encodings of the multiple reference words into the third representation model 601, and obtains the attention weights between the multiple reference word encodings through the third representation model 601. The server fuses the multiple reference word encodings based on the attention weights between the multiple reference word encodings through the third representation model 601, and obtains the first object feature C of the first object.
[0158] The second part, the server inputs the first object feature of the first object into the first classifier, and outputs the predicted description word of the first object through the first classifier.
[0159] The first classifier is trained based on the object features and the labeled sample description words of the sample objects, and has the ability to determine the predicted description word based on the object features.
[0160] In a possible implementation, referring to Figure 6 The server inputs the first object feature of the first object into the first classifier 602, and performs full connection on the first object feature through the full connection matrix of the first classifier 602. The first object feature is mapped into multiple probability values, and each probability value corresponds to a description word. The server determines the description word corresponding to the highest probability value in the multiple probability values as the predicted description word of the first object.
[0161] The third part, the server inputs the first object feature of the first object into a second classifier, and outputs a classification process identifier corresponding to the first object through the second classifier.
[0162] The second classifier is trained based on object features of sample objects and annotated classification process identifiers, and has the ability to determine a classification process identifier based on an object feature. The classification process identifier includes end classification and continue classification.
[0163] In a possible implementation, referring to Figure 6 The server inputs the first object feature of the first object into a second classifier 603, and performs full connection on the first object feature through a full connection matrix of the second classifier 603, maps the first object feature into two probability values, one of which corresponds to end classification, and the other corresponds to continue classification. The server determines the classification process identifier corresponding to the highest probability value in the two probability values as the classification process identifier of the first object.
[0164] The fourth part, in the case that the classification process identifier indicates end classification, the server determines the predicted description word of the first object as the target description word of the first object.
[0165] In the above description process, the classification process identifier output by the second classifier indicates end classification is taken as an example for description, and in other possible implementations, the server can also perform the following steps.
[0166] In a possible implementation, the server inputs the first object feature of the first object into a third classifier, and outputs a predicted feeling word of the first object through the third classifier. In the case that the classification process identifier indicates continue classification, the server determines the attribute of the predicted feeling word. The server encodes the plurality of reference words, the attributes of the plurality of reference words, the predicted feeling word and the attribute of the predicted feeling word based on an attention mechanism, to obtain a second object feature of the first object. The server determines the target description word of the first object based on the second object feature.
[0167] In order to more clearly illustrate the above implementations, the following will be divided into four parts to illustrate the above implementations.
[0168] The first part, the server inputs the first object feature of the first object into a third classifier, and outputs a predicted feeling word of the first object through the third classifier.
[0169] The third classifier is trained based on object features of sample objects and annotated sample feeling words, and has the ability to determine a predicted feeling word based on an object feature.
[0170] In a possible implementation, referring toFigure 7 The server inputs the first object feature of the first object into a third classifier 604, and performs full connection on the first object feature through a full connection matrix of the third classifier 604, maps the first object feature into a plurality of probability values, and each probability value corresponds to a feeling word. The server determines the feeling word corresponding to the highest probability value in the plurality of probability values as the predicted feeling word of the first object.
[0171] In a case where the classification process identifies an indication to continue classification, the server determines the attribute of the predicted feeling word.
[0172] In a possible implementation, in a case where the classification process identifies an indication to continue classification, the server generates an inquiry sentence based on the predicted feeling word, and sends the inquiry sentence to the first object, the inquiry sentence being used to inquire the attribute of the predicted feeling word of the first object. The server acquires a reply sentence of the first object to the inquiry sentence. The server determines the attribute of the predicted feeling word based on the reply sentence.
[0173] For example, in a case where the classification process identifies an indication to continue classification, if the predicted feeling word is “inferiority”, the server can generate an inquiry sentence “Do you feel inferior?” based on the predicted feeling word “inferiority”, and send the inquiry sentence “Do you feel inferior?” to the first terminal used by the first object. The first object can input a reply sentence based on the inquiry sentence, for example, the reply sentence is “I do not feel inferior”, and the server can determine that the attribute of the predicted feeling word is negative based on the reply sentence “I do not feel inferior”; if the reply sentence is “I feel inferior”, the server can determine that the attribute of the predicted feeling word is positive based on the reply sentence “I feel inferior”. Alternatively, the server can send the inquiry sentence “Do you feel inferior?” to the first terminal in the form of a tab card, the tab card including two options of “yes” and “no”, and the server can quickly determine the attribute of the predicted feeling word according to the option selected by the first object.
[0174] In a case where the classification process identifies an indication to continue classification, the server determines the attribute of the predicted feeling word.
[0175] In a possible implementation, the server concatenates the plurality of reference words and the predicted feeling word as a reference word group. The server performs embedding coding on the reference word group, including performing embedding coding on attributes of the reference word group, performing embedding coding on positions of characters in the reference word group, performing embedding coding on the reference word group, and performing embedding coding on a plurality of characters in the reference word group, to obtain a plurality of reference word encodings corresponding to the reference word group. The server inputs the plurality of reference word encodings into the third representation model, and obtains attention weights between the plurality of reference word encodings through the third representation model. The server fuses the plurality of reference word encodings based on the attention weights between the plurality of reference word encodings through the third representation model, to obtain a second object feature of the first object.
[0176] That is to say, the embodiments of the present application may have multiple iteration processes when determining the target description word, and the continuation and termination of the iteration process are determined based on the classification process identifier output by the second classifier. In the case where the classification process identifier output by the second classifier indicates to stop classification, the server determines the predicted description word output by the first classifier as the target description word; in the case where the classification process identifier output by the second classifier indicates to continue classification, the server generates an inquiry sentence based on the predicted feeling word output by the third classifier, and inquires the first object about the authenticity of the predicted feeling word based on the inquiry sentence. The server can subsequently add the predicted feeling word and the attributes of the predicted feeling word to another iteration process until the classification process identifier output by the second classifier indicates to stop classification.
[0177] The fourth part, the server determines the target description word of the first object based on the second object feature.
[0178] The method in which the server determines the target description word of the first object based on the second object feature belongs to the same inventive concept as the method in which the server determines the target description word of the first object based on the first object feature, and the implementation process is described above and will not be repeated here.
[0179] In addition, the first classifier, the second classifier, and the third classifier mentioned in the above step 304 are three independent classifiers, and when training the first classifier, the second classifier, and the third classifier, the three classifiers are trained alternately, and the model parameters of the three classifiers are updated by gradient descent.
[0180] 305、The server replies to the first object based on the target description word.
[0181] In a possible implementation, after the server determines the target descriptive word of the first object, the server can generate a reply sentence based on the target descriptive word and send the reply sentence to the first object. The reply sentence is an automatically generated reply sentence, which can be used to automatically reply to the first object when the second object cannot timely process. Alternatively, the reply sentence is displayed on the second terminal used by the second object, and the second object can select whether to send the reply sentence to the first object. When the second object determines that the reply sentence meets the second object's idea, the second object can send the reply sentence to the first object through the second terminal, without inputting text again, thereby reducing the workload of the second object.
[0182] For example, in the scenario of online consultation of a doctor by a patient, the target descriptive word determined by the server is a diagnosis word of the first object. The server can generate a reply sentence based on the target descriptive word, and the reply sentence is used to diagnose the symptoms described by the patient. For example, the target descriptive word is "bipolar disorder", and the server can generate a reply sentence "according to the symptoms described by you, you may have bipolar disorder" based on the target descriptive word "bipolar disorder". When the doctor is busy and cannot reply to the patient in time, the server can send the reply sentence directly to the patient, or the server can send the reply sentence to the second terminal, and the second terminal displays the reply sentence. In some embodiments, the reply sentence is displayed with a reply control. When the doctor determines to reply to the patient by using the reply sentence, the doctor can click the reply control. In response to the click operation on the reply control displayed beside the reply sentence, the second terminal sends the reply sentence to the first terminal used by the patient, thereby achieving fast reply to the patient.
[0183] Referring to Figure 8 The technical solution provided by the embodiments of the present application can also be integrated into an online intelligent inquiry system. The online intelligent inquiry system is used in the scenario of online consultation of a doctor by a patient, and the system includes an entity recognition unit 701, a positive and negative recognition unit 702, and a reply unit 703. The entity recognition unit 701 is used to perform the step 302 described above. The positive and negative recognition unit 702 is used to perform the step 303 described above. The reply unit is used to perform the steps 304 and 305 described above. In the scenario of online consultation of a doctor by a patient, the reply unit 703 is also referred to as an online inquiry strategy unit.
[0184] The online intelligent inquiry system provided by the embodiments of the present application can alleviate the problem of insufficient medical resources at the grassroots level, reduce the labor intensity of doctors and reduce medical costs. The entity recognition unit and the positive and negative recognition unit for the target dialogue text can automatically structure useful information such as symptoms and diseases from the target dialogue text, and obtain the positive and negative of the symptoms and diseases, which is helpful for the use of the inquiry strategy unit. The inquiry strategy unit regards the inquiry strategy problem as a text classification problem, uses the pre-training language representation model Bert to alleviate the data sparsity problem, and uses a multi-task learning strategy to separate the output spaces of diseases and symptoms, reduce the search space, and alleviate the model bias towards symptoms caused by the imbalance between symptom and disease data and the output space.
[0185] All the optional technical solutions described above can be combined to form optional embodiments of the present application, which will not be described again.
[0186] Through the technical solutions provided by the embodiments of the present application, the dialogue text between the first object and the second object can be obtained, and a plurality of reference words can be obtained from the dialogue text. The plurality of reference words can reflect the state of the first object. According to the reference word, the sentence to which the reference word belongs, and the adjacent sentence of the sentence, the attribute of the reference word is determined, and the attribute is used to reflect the authenticity of the reference word. When generating the target description word based on the reference word and the attribute of the reference word, the attribute related information of the reference word is often included in the context, so that the attribute of the reference word determined in this way is more accurate, and the target description word can more accurately describe the state of the first object. When replying to the first object based on the target description word, the workload of the second object can be reduced, and the efficiency of the reply can be improved.
[0187] Figure 8 is a structural schematic diagram of a processing device for a target dialogue text provided by the embodiments of the present application, referring to Figure 9 The device comprises a target dialogue text acquisition module 801, an identification module 802, an attribute determination module 803, and a description word determination module 804.
[0188] The target dialogue text acquisition module 801 is configured to acquire a target dialogue text, the target dialogue text being a text for dialogue between a first object and a second object.
[0189] The identification module 802 is configured to identify the target dialogue text to obtain a plurality of reference words in the target dialogue text, the plurality of reference words comprising a feeling word of the first object and a description word of the first object by the second object, the feeling word being used to indicate the state of the first object.
[0190] The attribute determination module 803 is configured to determine an attribute of the plurality of reference words based on the plurality of reference words, a sentence in the target dialogue text, and sentences adjacent to the sentence in the target dialogue text, the sentence being a sentence in which the reference word is located, the attribute being used to indicate authenticity of the reference word.
[0191] The description word determination module 804 is configured to determine a target description word of the first object based on the plurality of reference words and the attributes of the plurality of reference words, the target description word being used to reply to the first object.
[0192] In a possible implementation, the identification module 802 is configured to, for any sentence in the target dialogue text, encode characters in the sentence based on an attention mechanism to obtain an encoding sequence corresponding to the sentence. The reference word in the sentence is determined based on the sentence and a plurality of encodings in the encoding sequence.
[0193] In a possible implementation, the identification module 802 is configured to input the encoding sequence into a sequence labeling model, and output, by the sequence labeling model, a label sequence corresponding to the sentence based on positions of the plurality of encodings in the encoding sequence, a label in the label sequence being used to indicate whether a corresponding character in the sentence belongs to a reference word. The reference word in the sentence is determined based on the label sequence and the sentence.
[0194] In a possible implementation, the identification module 802 is configured to obtain an initial reference word from the sentence based on a plurality of labels in the label sequence. The initial reference word is normalized by using a synonym table to obtain the reference word in the sentence, the synonym table recording a plurality of initial reference words corresponding to a plurality of reference words respectively.
[0195] In a possible implementation, the attribute determination module 803 is configured to, for a first reference word in the plurality of reference words, determine an attribute of the first reference word based on the first reference word, a first sentence, a second sentence, and a third sentence, the first sentence being a sentence in which the first reference word is located, the second sentence being a previous sentence of the first sentence in the target dialogue text, and the third sentence being a next sentence of the first sentence in the target dialogue text.
[0196] In a possible implementation, the attribute determination module 803 is configured to encode the first reference word, the first sentence, the second sentence, and the third sentence based on an attention mechanism to obtain a lexical feature corresponding to the first reference word. The attribute of the first reference word is determined based on the lexical feature.
[0197] In a possible implementation, the attribute determining module 803 is configured to perform embedding coding on the first reference word, the first sentence, the second sentence, and the third sentence respectively to obtain a first word encoding corresponding to the first reference word, a first encoding corresponding to the first sentence, a second encoding corresponding to the second sentence, and a third encoding corresponding to the third sentence. A plurality of first attention weights between the first word encoding, the first encoding, the second encoding, and the third encoding are obtained. The first word encoding, the first encoding, the second encoding, and the third encoding are fused based on the plurality of first attention weights to obtain a vocabulary feature corresponding to the first reference word.
[0198] In a possible implementation, the attribute determining module 803 is configured to perform embedding coding on the identity information of the first reference word, position information of the plurality of characters in the first reference word in the first reference word, the first reference word, and the plurality of characters in the first reference word respectively to obtain a plurality of initial encodings of the first reference word. The plurality of initial encodings of the first reference word are fused to obtain the first word encoding.
[0199] In a possible implementation, the attribute determining module 803 is configured to perform full connection on the vocabulary feature to obtain an attribute value of the first reference word. In a case where the attribute value of the first reference word is less than or equal to an attribute threshold value, the attribute of the first reference word is determined to be negative, and the negative indicates that the corresponding reference word is false. In a case where the attribute value of the first reference word is greater than the attribute threshold value, the attribute of the first reference word is determined to be positive, and the positive indicates that the corresponding reference word is true.
[0200] In a possible implementation, the description word determining module 804 is configured to encode the plurality of reference words and the attributes of the plurality of reference words based on an attention mechanism to obtain a first object feature of the first object. The first object feature of the first object is input into a first classifier, and a predicted description word of the first object is output by the first classifier. The first object feature of the first object is input into a second classifier, and a classification process identifier corresponding to the first object is output by the second classifier. In a case where the classification process identifier indicates that the classification is ended, the predicted description word of the first object is determined to be a target description word of the first object.
[0201] In a possible implementation, the description word determination module 804 is further configured to input the first object feature of the first object into a third classifier, and output a predicted affective word of the first object by the third classifier. In a case where the classification process identifier indicates to continue the classification, the attribute of the predicted affective word is determined. The plurality of reference words, the attributes of the plurality of reference words, the predicted affective word, and the attribute of the predicted affective word are encoded based on an attention mechanism to obtain a second object feature of the first object. The target description word of the first object is determined based on the second object feature.
[0202] In a possible implementation, the description word determination module 804 is further configured to, in a case where the classification process identifier indicates to continue the classification, generate an inquiry sentence based on the predicted affective word, and send the inquiry sentence to the first object, where the inquiry sentence is used to inquire the attribute of the predicted affective word of the first object. A reply sentence of the first object to the inquiry sentence is obtained. The attribute of the predicted affective word is determined based on the reply sentence.
[0203] In a possible implementation, the description word determination module 804 is further configured to respectively embed and encode the position information of each character in the corresponding reference word in the plurality of reference words, the plurality of reference words, each character in the plurality of reference words, and the attributes of the plurality of reference words to obtain reference word encodings of the plurality of reference words. A plurality of second attention weights between the reference word encodings of the plurality of reference words are obtained. The reference word encodings of the plurality of reference words are fused based on the plurality of second attention weights to obtain the first object feature of the first object.
[0204] It should be noted that the processing apparatus for target dialogue text provided in the above embodiments is only used as an example for dividing the above functional modules when processing the target dialogue, and in actual applications, the above functions can be completed by different functional modules according to needs, that is, the internal structure of the computer device is divided into different functional modules to complete all or part of the functions described above. In addition, the processing apparatus for target dialogue text and the processing method for target dialogue text provided in the above embodiments belong to the same concept, and the specific implementation process is described in the method embodiments, which will not be repeated here.
[0205] By the technical solutions provided in the embodiments of the present application, the dialogue text between the first object and the second object can be acquired, and a plurality of reference words can be acquired from the dialogue text, the plurality of reference words being capable of reflecting the state of the first object. According to the reference word, the sentence to which the reference word belongs, and the sentence adjacent to the sentence, the attribute of the reference word is determined, the attribute being used to reflect the authenticity of the reference word. When the target description word is generated based on the reference word and the attribute of the reference word, since the information related to the attribute of the reference word is often included in the context, the attribute of the reference word determined in this way is relatively accurate, so that the target description word can accurately describe the state of the first object. When the first object is replied based on the target description word, in the face of a large number of consultations, the workload of the second object can be reduced, and the reply efficiency can be improved.
[0206] The embodiments of the present application provide a computer device for executing the above method, which can be implemented as a terminal or a server. The structure of the terminal will be introduced first as follows:
[0207] Figure 9 FIG. 9 is a structural schematic diagram of a terminal provided by the embodiments of the present application. The terminal 900 can be a smart phone, a tablet computer, a notebook computer, a desktop computer, or a vehicle-mounted terminal, etc. The terminal 900 can also be referred to as a user equipment, a portable terminal, a laptop terminal, a desktop terminal, or other names.
[0208] Generally, the terminal 900 includes one or more processors 901 and one or more memories 902.
[0209] The processor 901 can include one or more processing cores, such as a 4-core processor, an 8-core processor, and the like. The processor 901 can be implemented in at least one of a hardware form of a DSP (Digital Signal Processing), an FPGA (Field-Programmable Gate Array), a PLA (Programmable Logic Array), and the like. The processor 901 can also include a main processor and a co-processor, the main processor being a processor for processing data in an awake state, also referred to as a CPU (Central Processing Unit), and the co-processor being a low-power consumption processor for processing data in a standby state. In some embodiments, the processor 901 can be integrated with a GPU (Graphics Processing Unit) that is responsible for rendering and drawing of content to be displayed by the display screen. In some embodiments, the processor 901 can further include an AI (Artificial Intelligence) processor for processing computing operations related to machine learning.
[0210] The memory 902 can include one or more computer-readable storage media that can be non-transitory. The memory 902 can also include a high-speed random access memory, and a nonvolatile memory such as one or more disk storage devices, flash storage devices. In some embodiments, the non-transitory computer-readable storage medium in the memory 902 is used to store at least one computer program for being executed by the processor 901 to implement the target dialogue text processing method provided by the method embodiments in the present application.
[0211] In some embodiments, the terminal 900 can also optionally include a peripheral device interface 903 and at least one peripheral device. The processor 901, the memory 902, and the peripheral device interface 903 can be connected through a bus or a signal line. Each peripheral device can be connected to the peripheral device interface 903 through a bus, a signal line, or a circuit board. Specifically, the peripheral device includes at least one of a radio frequency circuit 904, a display screen 905, a camera component 906, an audio circuit 907, a positioning component 908, and a power supply 909.
[0212] The peripheral interface 903 can be used to connect at least one I / O (Input / Output) related peripheral device to the processor 901 and the memory 902. In some embodiments, the processor 901, the memory 902 and the peripheral interface 903 are integrated on the same chip or circuit board; in some other embodiments, any one or two of the processor 901, the memory 902 and the peripheral interface 903 can be implemented on a separate chip or circuit board, for which the present embodiments are not limited.
[0213] The radio frequency circuit 904 is used to receive and send RF (Radio Frequency) signals, also known as electromagnetic signals. The radio frequency circuit 904 communicates with communication networks and other communication devices through electromagnetic signals. The radio frequency circuit 904 converts electrical signals into electromagnetic signals for transmission, or converts received electromagnetic signals into electrical signals. Optionally, the radio frequency circuit 904 includes an antenna system, an RF transceiver, one or more amplifiers, a tuner, an oscillator, a digital signal processor, a codec chipset, a subscriber identity module card, and the like.
[0214] The display screen 905 is used to display a UI (User Interface). The UI can include graphics, text, icons, video, and any combination thereof. When the display screen 905 is a touch display screen, the display screen 905 also has the ability to collect touch signals on or above the surface of the display screen 905. The touch signals can be input as control signals to the processor 901 for processing. At this time, the display screen 905 can also be used to provide virtual buttons and / or virtual keyboards, also known as soft buttons and / or soft keyboards.
[0215] The camera assembly 906 is used to collect images or videos. Optionally, the camera assembly 906 includes a front-facing camera and a rear-facing camera. Typically, the front-facing camera is disposed on the front panel of the terminal, and the rear-facing camera is disposed on the back of the terminal.
[0216] The audio circuit 907 can include a microphone and a speaker. The microphone is used to collect sound waves of the user and the environment, and convert the sound waves into electrical signals input to the processor 901 for processing, or input to the radio frequency circuit 904 to realize voice communication.
[0217] The positioning component 908 is used to locate the current geographical position of the terminal 900 to realize navigation or LBS (Location Based Service).
[0218] The power supply 909 is used to supply power to various components in the terminal 900. The power supply 909 can be alternating current, direct current, disposable batteries or rechargeable batteries.
[0219] In some embodiments, the terminal 900 further comprises one or more sensors 910. The one or more sensors 910 include, but are not limited to, an acceleration sensor 911, a gyroscope sensor 912, a pressure sensor 913, a fingerprint sensor 914, an optical sensor 915, and a proximity sensor 916.
[0220] The acceleration sensor 911 can detect the acceleration magnitude in three coordinate axes of a coordinate system established by the terminal 900.
[0221] The gyroscope sensor 912 can detect the body direction and rotation angle of the terminal 900. The gyroscope sensor 912 can cooperate with the acceleration sensor 911 to collect the 3D motion of the user to the terminal 900.
[0222] The pressure sensor 913 can be arranged at the side frame of the terminal 900 and / or the lower layer of the display screen 905. When the pressure sensor 913 is arranged at the side frame of the terminal 900, the holding signal of the user to the terminal 900 can be detected, and the left-hand or right-hand recognition or shortcut operation can be performed by the processor 901 according to the holding signal collected by the pressure sensor 913. When the pressure sensor 913 is arranged at the lower layer of the display screen 905, the controllable control on the UI interface can be controlled by the processor 901 according to the pressure operation of the user to the display screen 905.
[0223] The fingerprint sensor 914 is used to collect the fingerprint of the user. The identity of the user can be recognized by the processor 901 according to the fingerprint collected by the fingerprint sensor 914, or the identity of the user can be recognized by the fingerprint sensor 914 according to the collected fingerprint.
[0224] The optical sensor 915 is used to collect the ambient light intensity. In an embodiment, the processor 901 can control the display brightness of the display screen 905 according to the ambient light intensity collected by the optical sensor 915.
[0225] The proximity sensor 916 is used to collect the distance between the user and the front of the terminal 900.
[0226] Those skilled in the art can understand that the structure shown in the above embodiments does not constitute a limitation on the terminal 900, and the terminal 900 can include more or less components than the structure shown in the above embodiments, or combine certain components, or adopt a different component arrangement. Figure 10
[0227] The above computer device can also be implemented as a server, and the structure of the server will be introduced as follows:
[0228] is a structural schematic diagram of a server provided by an embodiment of the present application. The server 1000 can have great differences due to different configurations or performances, and can include one or more processors (Central Processing Units, CPUs) 1001 and one or more memories 1002. The one or more memories 1002 store at least one computer program, which is loaded and executed by the one or more processors 1001 to implement the method provided by each of the above methods. Of course, the server 1000 can also have a wired or wireless network interface, a keyboard, an input and output interface, and other components for realizing the functions of the device, and the details are not described here.
[0229] In an example embodiment, a computer-readable storage medium, such as a memory including a computer program, is also provided. The computer program can be executed by a processor to complete the target dialogue text processing method in the above embodiments. For example, the computer-readable storage medium can be a Read-Only Memory (ROM), a Random Access Memory (RAM), a Compact Disc Read-Only Memory (CD-ROM), a magnetic tape, a floppy disk, and an optical data storage device, etc.
[0230] In an example embodiment, a computer program product or computer program is also provided. The computer program product or computer program includes program code stored in a computer-readable storage medium. The processor of a computer device reads the program code from the computer-readable storage medium, and executes the program code to make the computer device execute the target dialogue text processing method.
[0231] In some embodiments, the computer program related to the embodiments of the present application can be deployed on a computer device for execution, or on multiple computer devices located in one place, or on multiple computer devices distributed in multiple places and interconnected through a communication network. The multiple computer devices distributed in multiple places and interconnected through a communication network can constitute a blockchain system.
[0232] Those of ordinary skill in the art can understand that all or part of the steps of the above embodiments can be completed by hardware, or by a program instructing relevant hardware, which can be stored in a computer-readable storage medium. The storage medium mentioned above can be a Read-Only Memory, a magnetic disk or an optical disk, etc.
[0233] The above merely is the optional embodiment of the present application, and does not use to limit the present application, any modification, equivalent replacement, improvement and so on, which are made in the spirit and principle of the present application, should be included in the protection scope of the present application.
Claims
1. A method for processing target dialogue text, characterized by, The method comprises: obtaining target dialogue text, the target dialogue text being text of dialogue between a first object and a second object; identifying the target dialogue text to obtain a plurality of reference words in the target dialogue text, the plurality of reference words comprising a feeling word of the first object and a description word of the second object for the first object, the feeling word being used to indicate a state of the first object; determining attributes of the plurality of reference words based on the plurality of reference words, a sentence in the target dialogue text, and a sentence adjacent to the sentence in the target dialogue text, the sentence being a sentence in which the reference word is located, the attributes being used to indicate authenticity of the reference word; determining a target description word of the first object based on the plurality of reference words and the attributes of the plurality of reference words, the target description word being used to reply to the first object.
2. The method of claim 1, wherein, The identifying the target dialogue text to obtain a plurality of reference words in the target dialogue text comprises: for any sentence in the target dialogue text, encoding characters in the sentence based on an attention mechanism to obtain an encoding sequence corresponding to the sentence; determining a reference word in the sentence based on a plurality of encodings in the sentence and the encoding sequence.
3. The method of claim 2, wherein, The determining a reference word in the sentence based on a plurality of encodings in the sentence and the encoding sequence comprises: inputting the encoding sequence into a sequence labeling model, and outputting a label sequence corresponding to the sentence based on positions of the plurality of encodings in the encoding sequence by the sequence labeling model, a label in the label sequence being used to indicate whether a corresponding character in the sentence belongs to a reference word; determining the reference word in the sentence based on the label sequence and the sentence.
4. The method of claim 3, wherein, The determining the reference word in the sentence based on the label sequence and the sentence comprises: obtaining an initial reference word from the sentence based on a plurality of labels in the label sequence; normalizing the initial reference word using a synonym table to obtain a reference word in the sentence, the synonym table recording a plurality of initial reference words corresponding to a reference word respectively.
5. The method of claim 1, wherein, The determining attributes of the plurality of reference words based on the plurality of reference words, a sentence in the target dialogue text, and a sentence adjacent to the sentence in the target dialogue text comprises: for a first reference word in the plurality of reference words, determining the attributes of the first reference word based on the first reference word, a first sentence, a second sentence, and a third sentence, the first sentence being a sentence in which the first reference word is located, the second sentence being a previous sentence of the first sentence in the target dialogue text, and the third sentence being a next sentence of the first sentence in the target dialogue text.
6. The method of claim 5, wherein, The determining the attributes of the first reference word based on the first reference word, the first sentence, the second sentence, and the third sentence comprises: encoding the first reference word, the first sentence, the second sentence, and the third sentence based on an attention mechanism to obtain a vocabulary feature corresponding to the first reference word; determining the attributes of the first reference word based on the vocabulary feature.
7. The method of claim 6, wherein, The encoding of the first reference word, the first sentence, the second sentence and the third sentence based on the attention mechanism comprises: respectively embedding and encoding the first reference word, the first sentence, the second sentence and the third sentence to obtain the first word encoding corresponding to the first reference word, the first encoding corresponding to the first sentence, the second encoding corresponding to the second sentence and the third encoding corresponding to the third sentence; obtaining a plurality of first attention weights between the first word encoding, the first encoding, the second encoding and the third encoding; based on the plurality of first attention weights, the first word encoding, the first encoding, the second encoding and the third encoding are fused to obtain the vocabulary feature corresponding to the first reference word.
8. The method of claim 7, wherein, The method for obtaining the first word encoding comprises: respectively embedding and encoding the identity information corresponding to the first reference word, the position information of the plurality of characters in the first reference word in the first reference word, the first reference word and the plurality of characters in the first reference word to obtain a plurality of initial encodings of the first reference word; the plurality of initial encodings of the first reference word are fused to obtain the first word encoding.
9. The method of claim 6, wherein, The method for determining the attribute of the first reference word based on the vocabulary feature comprises: fully connecting the vocabulary feature to obtain the attribute value of the first reference word; in the case that the attribute value of the first reference word is less than or equal to the attribute threshold value, the attribute of the first reference word is determined to be negative, and negative indicates that the corresponding reference word is false; in the case that the attribute value of the first reference word is greater than the attribute threshold value, the attribute of the first reference word is determined to be positive, and positive indicates that the corresponding reference word is true.
10. The method of claim 1, wherein, The method for determining the target description word of the first object based on the plurality of reference words and the attributes of the plurality of reference words comprises: encoding the plurality of reference words and the attributes of the plurality of reference words based on an attention mechanism to obtain the first object feature of the first object; inputting the first object feature of the first object into a first classifier, and outputting the predicted description word of the first object through the first classifier; inputting the first object feature of the first object into a second classifier, and outputting the classification process identifier corresponding to the first object through the second classifier; in the case that the classification process identifier indicates the end of classification, the predicted description word of the first object is determined as the target description word of the first object.
11. The method of claim 10, wherein, The method further comprises: inputting the first object feature of the first object into a third classifier, and outputting the predicted feeling word of the first object through the third classifier; in the case that the classification process identifier indicates the continuation of classification, the attribute of the predicted feeling word is determined; encoding the plurality of reference words, the attributes of the plurality of reference words, the predicted feeling word and the attribute of the predicted feeling word based on an attention mechanism to obtain the second object feature of the first object; determining the target description word of the first object based on the second object feature.
12. The method of claim 11, wherein, The determining the attribute of the predicted affective word in the case where the classification process identifies a situation indicating to continue classification comprises: In the case where the classification process identifies a situation indicating to continue classification, an inquiry sentence is generated based on the predicted affective word, and the inquiry sentence is sent to the first object, the inquiry sentence being used to inquire the first object about the attribute of the predicted affective word; A reply sentence of the first object to the inquiry sentence is obtained; The attribute of the predicted affective word is determined based on the reply sentence.
13. The method of claim 10, wherein, The encoding the multiple reference words and the attributes of the multiple reference words based on the attention mechanism to obtain the first object feature of the first object comprises: The position information of each character in a corresponding reference word in the multiple reference words, the multiple reference words, each character in the multiple reference words, and the attributes of the multiple reference words are embedded and encoded respectively to obtain reference word encoding of the multiple reference words; Multiple second attention weights between the reference word encoding of the multiple reference words are obtained; The reference word encoding of the multiple reference words is fused based on the multiple second attention weights to obtain the first object feature of the first object.
14. An apparatus for processing target dialogue text, characterized by comprising: The apparatus comprises: A target dialogue text acquisition module configured to acquire target dialogue text, the target dialogue text being text for dialogue between a first object and a second object; An identification module configured to identify the target dialogue text to obtain multiple reference words in the target dialogue text, the multiple reference words comprising an affective word of the first object and a description word of the second object for the first object, the affective word being used to indicate a state of the first object; An attribute determination module configured to determine attributes of the multiple reference words based on the multiple reference words, a sentence in the target dialogue text, and a sentence adjacent to the sentence in the target dialogue text, the sentence being a sentence in which the reference word is located, the attribute being used to indicate authenticity of the reference word; A description word determination module configured to determine a target description word of the first object based on the multiple reference words and the attributes of the multiple reference words, the target description word being used to reply to the first object.
15. A computer device, comprising: The computer device comprises one or more processors and one or more memories, and the one or more memories store at least one computer program, which is loaded and executed by the one or more processors to implement the processing method of the target dialogue text according to any one of claims 1 to 13.
16. A computer-readable storage medium, characterized in that, The computer readable storage medium stores at least one computer program, which is loaded and executed by the processor to implement the processing method of the target dialogue text according to any one of claims 1 to 13.
17. A computer program product comprising a computer program, characterized in that, The computer program is executed by the processor to implement the processing method of the target dialogue text according to any one of claims 1 to 13.
Citation Information
Patent Citations
Word expansion method and device, equipment and medium
CN110162770A
Information pushing method and device based on human-computer interaction and computer equipment
CN110909137A