Text processing method, device, electronic device and readable storage medium
By annotating and constructing the information of dialogue text segments line by line, it solves the problem of large models' weak ability to extract dialogue content elements in vertical fields, improves the training effect and data utilization of the model, and is suitable for dialogue content analysis in vertical fields.
Patent Information
- Application Number
- CN202411060017.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-05
- Publication Date
- 2024-10-11
- Estimated Expiration
- 2044-08-05
AI Technical Summary
Large models have weak ability to extract elements of dialogue content in vertical fields (such as customer service, banking and other industries), and the existing training data is significantly different from actual needs, resulting in poor extraction results.
By obtaining the target language recognition text, annotating the first element information and the second element information of each line of dialogue text line by line, determining the third element information based on the information of the dialogue text segment, and constructing training data for large models to improve model training. Effect.
It improves the ability to extract dialogue content elements from large models, enhances the utilization of training data and the training effect of the model, and is suitable for dialogue content analysis in vertical fields.
Smart Images

Figure CN118569215B_ABST
Abstract
Description
Technical Field
[0001] Embodiments of the present invention relate to the technical field of natural language processing, and in particular, to a text processing method, device, electronic device, and readable storage medium. Background Art
[0002] Instruction Tuning is a process of further training a large language model (LLM) through a specific dataset. The required dataset consists of a series of "instruction-output" pairs, where the instructions represent the tasks that the large model is expected to perform, and the outputs are the expected results of the large model following these instructions.
[0003] In the task scenario of extracting elements of conversation content with the help of a big model, the input text is the automatic speech recognition (ASR) text after real-time translation. It is necessary to build training data for fine-tuning the big model in order to train the big model's ability to extract elements for this task scenario.
[0004] At present, the training data of large models is usually converted using Natural Language Processing (NLP) task instructions on the Internet. However, the requirements for extracting elements from conversation content in vertical fields (such as customer service, banking, and other industries) are quite different, which makes the trained large models weak in extracting elements from conversation content. Summary of the invention
[0005] Embodiments of the present invention provide a text processing method, device, electronic device and readable storage medium to solve the problem in the prior art that large models have weak ability to extract elements of conversation content.
[0006] In a first aspect, an embodiment of the present invention provides a text processing method, the method comprising:
[0007] Acquire a target language recognition text, where the target language recognition text is a dialogue text of at least two dialogue characters;
[0008] Acquire first element information and second element information of each line of dialogue text, wherein the second element information of any line of the first dialogue text in the target language recognition text is associated with M lines of dialogue text, wherein the M lines of dialogue text include the first dialogue text and dialogue text in the target language recognition text at a dialogue time before the first dialogue text, and the element names in the first element information of the M lines of dialogue text are the same;
[0009] Determining third element information of the dialogue text segment according to first element information and second element information corresponding to the dialogue text segment, wherein the dialogue text segment includes at least a portion of the dialogue text in the target language recognition text;
[0010] Based on the dialogue text segment and the third element information, training data of a large model is determined, and the large model is used to extract elements from the language recognition text.
[0011] In a second aspect, an embodiment of the present invention provides a text processing device, the device comprising:
[0012] A first acquisition module is used to acquire a target language recognition text, wherein the target language recognition text is a dialogue text of at least two dialogue characters;
[0013] A second acquisition module is used to acquire first element information and second element information of each line of dialogue text, wherein the second element information of any line of the first dialogue text in the target language recognition text is associated with M lines of dialogue text, wherein the M lines of dialogue text include the first dialogue text and dialogue text in the target language recognition text at a dialogue time before the first dialogue text, and the element names in the first element information of the M lines of dialogue text are the same;
[0014] A first determining module, configured to determine third element information of a dialogue text segment according to first element information and second element information corresponding to the dialogue text segment, wherein the dialogue text segment includes at least a portion of the dialogue text in the target language recognition text;
[0015] The second determination module is used to determine the training data of the large model based on the dialogue text segment and the third element information, and the large model is used to extract elements from the language recognition text.
[0016] In a third aspect, an embodiment of the present invention provides an electronic device, comprising a processor, a memory, and a computer program stored in the memory and executable on the processor, wherein the computer program implements the steps of the above-mentioned text processing method when executed by the processor.
[0017] In a fourth aspect, an embodiment of the present invention provides a computer-readable storage medium, on which a computer program is stored, and when the computer program is executed by a processor, the steps of the above-mentioned text processing method are implemented.
[0018] In a fifth aspect, an embodiment of the present invention provides a computer program product, comprising computer instructions, which implement the steps of the above-mentioned text processing method when executed by at least one processor.
[0019] In an embodiment of the present invention, by acquiring a target language recognition text and annotating each line of dialogue text respectively through different strategies, first element information and second element information of each line of dialogue text are obtained, which can improve the annotation density of the target language recognition text, thereby improving the availability of the target language recognition text, and then determining the third element information of the dialogue text segment according to the first element information and the second element information corresponding to the dialogue text segment; determining the training data of the large model according to the dialogue text segment and the third element information, in this way, the limited target language recognition text can be used to construct rich training data for the large model, thereby improving the training effect of the large model, and further improving the ability of the large model to extract elements of the dialogue content. BRIEF DESCRIPTION OF THE DRAWINGS
[0020] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the accompanying drawings required for use in the description of the embodiments of the present invention will be briefly introduced below. Obviously, the accompanying drawings in the following description are only some embodiments of the present invention. For ordinary technicians in this field, other accompanying drawings can be obtained based on these accompanying drawings without paying creative labor.
[0021] Figure 1 is a flowchart of a text processing method provided by an embodiment of the present invention;
[0022] Figure 2 is a structural schematic diagram of a text processing device provided by an embodiment of the present invention;
[0023] Figure 3 It is a schematic diagram of the structure of an electronic device provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0024] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0025] It should be noted that the text processing method provided in the embodiment of the present invention may relate to the field of natural language processing technology, which mainly solves the problem that large models have weak element extraction capabilities in conversation content in vertical fields (such as customer service, banking and other industries).
[0026] The text processing method provided by the embodiment of the present invention is described in detail below.
[0027] See also Figure 1 , the figure shows a flow chart of the text processing method provided by an embodiment of the present invention. Figure 1As shown, the method may include the following steps:
[0028] Step 101, obtaining a target language recognition text, wherein the target language recognition text is a dialogue text of at least two dialogue characters.
[0029] The text processing method of the embodiment of the present disclosure can be executed by the text processing device of the embodiment of the present disclosure. The text processing device of the embodiment of the present disclosure can be configured in any electronic device to execute the text processing method of the embodiment of the present disclosure.
[0030] The target language recognition text is the text translated from the conversational speech. Automatic Speech Recognition (ASR) technology can be used to convert the conversational speech in vertical fields (such as customer service, banking and other industries) into text to obtain the target language recognition text.
[0031] In some embodiments, such as the customer service industry, when a customer service call is received, the conversation voice of the customer service call can be translated in real time to obtain the target language recognition text.
[0032] The target language recognition text may be a conversation text between two dialogue roles, such as a conversation text for a customer service call, which may include two dialogue roles, namely, the customer service and the customer, or a conversation text for a multi-person voice conference, which may include multiple dialogue roles.
[0033] Step 102, obtaining first element information and second element information of each line of dialogue text, wherein the second element information of any first line of dialogue text in the target language recognition text is associated with M lines of dialogue text, wherein the M lines of dialogue text include the first dialogue text and dialogue text in the target language recognition text at a dialogue time before the first dialogue text, and the element names in the first element information of the M lines of dialogue text are the same.
[0034] The first element information is element information of a single line of dialogue information, and the second element information is element information of M lines of dialogue text.
[0035] The second element information may be element information obtained by integrating the first element information of M lines of dialogue text according to dialogue logic, or the second element information may be obtained by extracting keywords from M lines of dialogue text using a deep learning model.
[0036] The user can annotate each line of dialogue text in the target language recognition text line by line, and integrate the first element information of the line of dialogue text and the M-1 line of dialogue text before the dialogue moment of the line of dialogue text, so as to obtain the first element information and the second element information of the line of dialogue text, and accordingly, the first element information and the second element information of each line of dialogue text annotated by the user can be obtained. Among them, the element name in the first element information of the M-1 line of dialogue text is the same as the element name in the first element information of the line of dialogue text.
[0037] In some embodiments, the target language recognition text can be annotated line by line, and each line of dialogue text can be annotated using different strategies, that is, each line of dialogue text can be annotated using two strategies, A and B, wherein strategy A is used to annotate the element information in the line of dialogue text to obtain the first element information, and strategy B is used to annotate the element information of M lines of dialogue text including the line of dialogue text, which can obtain the second element information of the line of dialogue text by integrating the first element information of the M lines of dialogue text. For example: the dialogue text segments of the i-th line, the i+1-th line to the i+6-th line in the target language recognition text are:
[0038] Customer Service: Well, do you have your card number?
[0039] Customer: Card number 6200.
[0040] Customer: 4*6000.
[0041] Customer: 8500 and then 365.
[0042] Customer Service: Yes, 365.
[0043] Customer Service: What is your name?
[0044] Customer: Zhang San.
[0045] When strategy A marks by row, the i-th row can be unmarked or marked as {"customer card number"}, the i+1th row is marked as {"customer card number":"6200"}, the i+2th row is marked as {"customer card number":"****6000"}, the i+3th row is marked as {"customer card number":"8500365"}, the i+4th row is marked as {"customer card number":"365"}, the i+5th row can be unmarked or marked as {"customer name"}, and the i+6th row is marked as {"customer name":"Zhang San"}.
[0046] When marking with strategy B, the i-th row is not marked, or it can be marked as {"customer card number"}, the i+1th row is marked as {"customer card number":"6200"}, the i+2th row is marked as {"customer card number":"6200****6000"}, the i+3th row is marked as {"customer card number":"6200****60008500365"}, the i+4th row is marked as {"customer card number":"6200****60008500365"}, the i+5th row is not marked, or it can be marked as {"customer name"}, and the i+6th row is marked as {"customer name":"Zhang San"}.
[0047] Correspondingly, the first element information of each line of dialogue text obtained by the A strategy annotation and the second element information of each line of dialogue text obtained by the B strategy annotation can be obtained.
[0048] It should be noted that M is not fixed, but varies with the content of the conversation. It can be determined based on the number of lines in which the element name in the first element information of the conversation text before the conversation moment of the conversation text is the same as the element name in the first element information of the conversation text line. For example, when the conversation text is the first line of conversation text, that is, the conversation text with the earliest conversation moment in the target language recognition text, or when the element name in the first element information of the conversation text before the conversation moment of the conversation text is different from the element name in the first element information of the conversation text line, then M is 1. When the number of lines in which the element name in the first element information of the conversation text before the conversation moment of the conversation text is the same as the element name in the first element information of the conversation text line is 1, then M is 2.
[0049] Step 103, determining third element information of the dialogue text segment according to first element information and second element information corresponding to the dialogue text segment, wherein the dialogue text segment includes at least part of the dialogue text in the target language recognition text.
[0050] The dialogue text segments can be randomly intercepted from the target language recognition text. The lengths of different dialogue text segments, that is, the number of lines of the dialogue text, can be different or the same, and are not specifically limited here.
[0051] Optionally, before step 103, the method further includes:
[0052] Obtaining window parameter information and sliding parameter information of the information co-occurrence window;
[0053] According to the window parameter information and the sliding parameter information, the information co-occurrence window is slid in the target language recognition text in the order of the text from the beginning to the end of the dialogue time to obtain the dialogue text segment;
[0054] The dialogue text segment is the dialogue text in the information co-occurrence window.
[0055] The window parameter information may include a window size, which is related to the length of the intercepted language text segment, and the sliding parameter information may include a sliding step length, which is related to the spacing between different language text segments.
[0056] The window parameter information and sliding parameter information of the preset information co-occurrence window can be obtained, and the window parameter information and sliding parameter information of the information co-occurrence window can also be determined according to the length of the target language recognition text. For example, the length of the target language recognition text can be directly proportional to the window parameter information and sliding parameter information of the information co-occurrence window.
[0057] In some embodiments, based on the information co-occurrence window with a window size of 5, the information co-occurrence window can be slid in the target language recognition text according to a sliding strategy of a sliding step of 2 and a text order from the beginning to the end of the dialogue time, and the dialogue text in the information co-occurrence window is obtained during the sliding process to obtain multiple dialogue text segments. For example, the dialogue text segments from the i-th line to the i+5th line can be obtained, which are: "Customer service: Well, do you have the card number? Customer: Card number 6200. Customer: 4 * 6000. Customer: 8500 and then 365. Customer service: Well, 365."
[0058] In some embodiments, the information co-occurrence window can also be slid in the target language recognition text based on the information co-occurrence window with a window size of 7 and a sliding step size of 2. For example, the dialogue text segment from the i-th line to the i+7-th line can be obtained, which is: "Customer service: Well, do you have your card number? Customer: Card number 6200. Customer: 4 * 6000. Customer: 8500 and then 365. Customer service: Well, 365. Customer service: What's your name. Customer: Zhang San."
[0059] In this way, by sliding the information co-occurrence window downward in the target language recognition text according to the sliding step size and the text order from the beginning to the end of the conversation moment, multiple conversation text segments can be obtained, thereby improving the availability of conversation data. This allows effective use of limited conversation data, obtaining rich training data for large models, and realizing fine-tuning of instructions for large models in vertical fields, so as to extract elements of conversation content in vertical fields.
[0060] The second element information of the latest dialogue text in the dialogue text segment can be directly determined as the third element information of the dialogue text segment. Optionally, the step 103 specifically includes:
[0061] Determining the number of elements corresponding to the dialogue text segment according to the first element information corresponding to the dialogue text segment;
[0062] Determine a target dialogue text in the dialogue text segment according to the number of elements and the first element information corresponding to the dialogue text segment, wherein the target dialogue text is: the latest dialogue text at the dialogue time among the dialogue texts corresponding to the target elements included in the dialogue text segment, and the target element is any element corresponding to the dialogue text segment;
[0063] The third element information of the dialogue text segment is determined according to the second element information of the target dialogue text.
[0064] When a dialogue text segment is obtained, in some embodiments, the element corresponding to the dialogue text segment can be determined based on the first element information of the dialogue text in the dialogue text segment. If the dialogue text segment corresponds to one element, the second element information of the latest dialogue text in the dialogue text segment at the dialogue time is determined as the third element information of the dialogue text segment.
[0065] For example, for the dialogue text segment from line i to line i+5, it is: "Customer service: Well, do you have your card number? Customer: Card number 6200. Customer: 4 * 6000. Customer: 8500 and then 365. Customer service: Well, 365.", its third element information comes from the second element information of the latest dialogue text at the moment of dialogue in the dialogue text segment, and the third element information can be obtained {"Customer card number": "6200****60008500365"}.
[0066] If there are multiple elements corresponding to the dialogue text segment, the target dialogue text corresponding to each element can be obtained, and the target dialogue text is: the dialogue text corresponding to the target element included in the dialogue text segment, which is the latest dialogue text at the dialogue time. The dialogue text corresponding to the target element included in the dialogue text segment can be determined according to the first element information corresponding to the dialogue text segment, and then the dialogue text corresponding to the target element at the dialogue time is selected from the dialogue text corresponding to the target element to obtain the target dialogue text corresponding to the target element.
[0067] For example, for the dialogue text segment from line i to line i+7, it is: "Customer service: Yes, do you have your card number? Customer: Card number 6200. Customer: 4 * 6000. Customer: 8500 and then 365. Customer service: Yes 365. Customer service: What's your name. Customer: Zhang San.", then the target dialogue text includes "Customer service: Yes 365" and "Customer: Zhang San". The second element information of each target dialogue text can be integrated to obtain the third element information of the dialogue text segment, and the third element information can be {"Customer card number": "6200****60008500365", "Customer name": "Zhang San"}.
[0068] Step 104, determining training data of a large model based on the dialogue text segment and the third element information, wherein the large model is used to extract elements from the language recognition text.
[0069] The conversation text segment can be used as the input instruction of the big model, and the third factor information can be used as the output label of the big model to construct the training sample of the big model, thereby obtaining the training data of the big model.
[0070] In this embodiment, the target language recognition text is obtained, and each line of dialogue text is annotated by different strategies to obtain the first element information and the second element information of each line of dialogue text. This can improve the annotation density of the target language recognition text, thereby improving the availability of the target language recognition text. Then, the third element information of the dialogue text segment is determined based on the first element information and the second element information corresponding to the dialogue text segment; the training data of the large model is determined based on the dialogue text segment and the third element information. In this way, the limited target language recognition text can be used to construct rich training data for the large model, thereby improving the training effect of the large model, and then improving the large model's ability to extract elements of the dialogue content.
[0071] Optionally, step 104 specifically includes:
[0072] Acquire first sample data, the first sample data comprising a first sample, the first sample being a sample in which the dialogue text segment is used as a large model input instruction and the third element information is used as a large model output label;
[0073] Based on the first sample data, training data for a large model is determined.
[0074] In some embodiments, the first sample data may be used as training data for the large model. Optionally, before step 104, the method further includes:
[0075] Acquire element extraction thought information of the dialogue text segment, wherein the element extraction thought information is used to indicate a determination process of the third element information;
[0076] The step 104 specifically includes:
[0077] According to the third element information, a target sample is selected from the first sample data, wherein the elements corresponding to the dialogue text segment as the input instruction of the large model in the target sample include preset elements;
[0078] Assembling the input instruction of the target sample as the large model with the sample prompt information, and assembling the output label of the target sample as the large model with the element extraction thinking information to obtain the second sample data, wherein the sample prompt information is used to prompt the large model to output the determination process of the third element information;
[0079] The training data of the large model is determined according to the first sample data and the second sample data.
[0080] That is, target samples can be selected from the first sample data according to the third element information of the dialogue text segment, and the number of selected target samples can be preset, such as randomly selecting 20% of the target samples from the first sample data.
[0081] The elements corresponding to the dialogue text segment in the target sample as the input instruction of the large model include preset elements. Among them, the preset elements can be set according to the actual scenario. For example, for the customer service industry, the preset elements can include elements such as card number and address that are difficult to express. Since the expression of the preset elements is relatively difficult, there are often expression errors, corrections, repetitions and other expression processes during the dialogue process. Therefore, by extracting the target sample from the first sample data, and adding the task type of extracting thinking information of the elements of the dialogue text segment corresponding to the preset elements to the target sample, the second sample data is obtained, and then the second sample data is also used as the training data of the large model, which can further improve the extraction ability of the large model and the interpretability of the large model.
[0082] The second sample data may be directly merged into the first sample data, or the second sample data may be merged with the third sample data to obtain the training data of the large model, wherein the third sample data is other sample data in the first sample data except the target sample.
[0083] In some embodiments, in order to obtain the element extraction thinking information of the dialogue text segment, it is necessary to determine the derivation process of the third element information of the dialogue text segment according to the first element information and the second element information corresponding to the dialogue text segment. That is, for a dialogue text segment with preset elements, it is necessary to combine the first element information and the second element information to determine the element extraction thinking information of the dialogue text segment, and add a task type of outputting the element extraction thinking information of the dialogue text segment in the target sample.
[0084] Optionally, the obtaining of element extraction thought information of the dialogue text segment includes:
[0085] When it is determined that the element corresponding to the second dialogue text is a preset element, and the first matching result indicates that the element name in the first element information of the second dialogue text is the same as the element name in the first element information of the third dialogue text, the validity of the first element information of the second dialogue text is determined according to the second matching result and the third matching result; the second matching result is the matching result of the element content in the first element information of the second dialogue text and the element content in the second element information of the third dialogue text, and the third matching result is the matching result of the first dialogue role information of the second dialogue text and the second dialogue role information of the third dialogue text; the second dialogue text is the text with the latest dialogue time in the dialogue text segment, and the third dialogue text is the text in the dialogue text segment that is adjacent to the second dialogue text and has a dialogue time before the second dialogue text;
[0086] determining the second element information of the second dialogue text according to the validity, the first element information of the second dialogue text and the second element information of the third dialogue text;
[0087] According to the second element information of the second dialogue text, the third element information of the dialogue text segment is determined to obtain the element extraction thinking information.
[0088] The above process is the derivation process of the third element information of the dialogue text segment. Based on this derivation process, the element extraction thinking information of the dialogue text segment can be obtained.
[0089] In the case where the second matching result indicates that the element content in the first element information of the second dialogue text matches the element content in the second element information of the third dialogue text, and the third matching result indicates that the first dialogue role information of the second dialogue text and the second dialogue role information of the third dialogue text are different, it is determined that the first element information of the second dialogue text is invalid, otherwise it can be determined that the first element information of the second dialogue text is valid. Wherein, the element content in the first element information of the second dialogue text matches the element content in the second element information of the third dialogue text, which can mean that the element content at the end of the second element information of the third dialogue text includes the element content in the first element information of the second dialogue text.
[0090] When the first element information of the second dialogue text is valid, the first element information of the second dialogue text and the second element information of the third dialogue text can be integrated to obtain the second element information of the second dialogue text. When the first element information of the second dialogue text is invalid, the second element information of the third dialogue text is the second element information of the second dialogue text.
[0091] In some embodiments, if the dialogue text segment corresponds to one element, the second element information of the second dialogue text can be determined as the third element information of the dialogue text segment. If the dialogue text segment corresponds to multiple elements, the second element information of other target dialogue texts can be integrated to determine the third element information of the dialogue text segment.
[0092] For example, for the dialogue text segment from the i-th line to the i+5-th line, it is: "Customer service: Well, do you have your card number? Customer: Card number 6200. Customer: 4 * 6000. Customer: 8500 and then 365. Customer service: Well, 365.", its element extraction thinking information is: "Step 1: Determine that the name of the extractable element is the customer card number, which is a preset element, and the element name in the first element information of the second dialogue text is the same as the element name in the first element information of the third dialogue text; Step 2: The element content in the first element information of the latest dialogue text involved in this element, that is, the second dialogue text, is 365, and the element content in the second element information of the third dialogue text is 6200****60008500365; Determine the validity of each dialogue information according to the dialogue role Because the element content "365" in the first element information of the second dialogue text comes from the customer service's dialogue statement, the third dialogue text is the customer's dialogue statement, and "365" is included in the element content "Customer Card Number: 6200****60008500365" in the second element information of the third dialogue text, the element contents of the two are matched. Therefore, it is determined that the first element information of the second dialogue text is invalid, and the second element information of the second dialogue text is still "Customer Card Number: 6200****60008500365"; Step 3: The number of elements corresponding to the dialogue text segment is 1, and the corresponding third element information that can be extracted is the second element information of the second dialogue text, which is "Customer Card Number: 6200****60008500365".
[0093] In this way, it is possible to extract elements of the dialogue text segment and determine the thought information.
[0094] The text processing device provided by the embodiment of the present invention is described below.
[0095] See also Figure 2 , the figure shows a schematic diagram of the structure of a text processing device provided by an embodiment of the present invention, such as Figure 2 As shown, the text processing device 200 includes:
[0096] A first acquisition module 201 is used to acquire a target language recognition text, where the target language recognition text is a dialogue text of at least two dialogue characters;
[0097] The second acquisition module 202 is used to acquire first element information and second element information of each line of dialogue text, wherein the second element information of any line of the first dialogue text in the target language recognition text is associated with M lines of dialogue text, wherein the M lines of dialogue text include the first dialogue text and dialogue text in the target language recognition text at a dialogue time before the first dialogue text, and the element names in the first element information of the M lines of dialogue text are the same;
[0098] A first determining module 203, configured to determine third element information of a dialogue text segment according to first element information and second element information corresponding to the dialogue text segment, wherein the dialogue text segment includes at least a portion of the dialogue text in the target language recognition text;
[0099] The second determination module 204 is used to determine the training data of the large model according to the dialogue text segment and the third element information, and the large model is used to extract elements from the language recognition text.
[0100] Optionally, the first determining module 203 is specifically configured to:
[0101] Determining the number of elements corresponding to the dialogue text segment according to the first element information corresponding to the dialogue text segment;
[0102] Determine a target dialogue text in the dialogue text segment according to the number of elements and the first element information corresponding to the dialogue text segment, wherein the target dialogue text is: the latest dialogue text at the dialogue time among the dialogue texts corresponding to the target elements included in the dialogue text segment, and the target element is any element corresponding to the dialogue text segment;
[0103] The third element information of the dialogue text segment is determined according to the second element information of the target dialogue text.
[0104] Optionally, the device further comprises:
[0105] A third acquisition module is used to acquire window parameter information and sliding parameter information of the information co-occurrence window;
[0106] A sliding module, configured to slide the information co-occurrence window in the target language recognition text according to the window parameter information and the sliding parameter information and in the text order from the beginning to the end of the dialogue time, so as to obtain the dialogue text segment;
[0107] The dialogue text segment is the dialogue text in the information co-occurrence window.
[0108] Optionally, the second determining module 204 includes:
[0109] A sample acquisition unit, configured to acquire first sample data, wherein the first sample data includes a first sample, wherein the first sample is a sample that uses the dialogue text segment as a large model input instruction and uses the third element information as a large model output label;
[0110] A data determination unit is used to determine the training data of the large model based on the first sample data.
[0111] Optionally, the device further comprises:
[0112] A fourth acquisition module, used to acquire element extraction thinking information of the dialogue text segment, wherein the element extraction thinking information is used to indicate the determination process of the third element information;
[0113] The data determination unit is specifically used for:
[0114] According to the third element information, a target sample is selected from the first sample data, wherein the elements corresponding to the dialogue text segment as the input instruction of the large model in the target sample include preset elements;
[0115] Assembling the input instruction of the target sample as the large model with the sample prompt information, and assembling the output label of the target sample as the large model with the element extraction thinking information to obtain the second sample data, wherein the sample prompt information is used to prompt the large model to output the determination process of the third element information;
[0116] The training data of the large model is determined according to the first sample data and the second sample data.
[0117] Optionally, the fourth acquisition module is specifically used to:
[0118] When it is determined that the element corresponding to the second dialogue text is a preset element, and the first matching result indicates that the element name in the first element information of the second dialogue text is the same as the element name in the first element information of the third dialogue text, the validity of the first element information of the second dialogue text is determined according to the second matching result and the third matching result; the second matching result is the matching result of the element content in the first element information of the second dialogue text and the element content in the second element information of the third dialogue text, and the third matching result is the matching result of the first dialogue role information of the second dialogue text and the second dialogue role information of the third dialogue text; the second dialogue text is the text with the latest dialogue time in the dialogue text segment, and the third dialogue text is the text in the dialogue text segment that is adjacent to the second dialogue text and has a dialogue time before the second dialogue text;
[0119] determining the second element information of the second dialogue text according to the validity, the first element information of the second dialogue text and the second element information of the third dialogue text;
[0120] According to the second element information of the second dialogue text, the third element information of the dialogue text segment is determined to obtain the element extraction thinking information.
[0121] The text processing device 200 can implement each process implemented in the above-mentioned text processing method embodiment and can achieve the same technical effect. To avoid repetition, it will not be described here.
[0122] The electronic device provided by the embodiment of the present invention is described below.
[0123] See also Figure 3 , the figure shows a schematic diagram of the structure of an electronic device provided by an embodiment of the present invention. Figure 3 As shown, the electronic device 300 includes: a processor 301 , a memory 302 , a user interface 303 and a bus interface 304 .
[0124] The processor 301 is used to read the program in the memory 302 and execute the following process:
[0125] Acquire a target language recognition text, where the target language recognition text is a dialogue text of at least two dialogue characters;
[0126] Acquire first element information and second element information of each line of dialogue text, wherein the second element information of any line of the first dialogue text in the target language recognition text is associated with M lines of dialogue text, wherein the M lines of dialogue text include the first dialogue text and dialogue text in the target language recognition text at a dialogue time before the first dialogue text, and the element names in the first element information of the M lines of dialogue text are the same;
[0127] Determining third element information of the dialogue text segment according to first element information and second element information corresponding to the dialogue text segment, wherein the dialogue text segment includes at least a portion of the dialogue text in the target language recognition text;
[0128] Based on the dialogue text segment and the third element information, training data of a large model is determined, and the large model is used to extract elements from the language recognition text.
[0129] exist Figure 3In the embodiment, the bus architecture may include any number of interconnected buses and bridges, specifically linking various circuits of one or more processors represented by processor 301 and memory represented by memory 302. The bus architecture may also link various other circuits such as peripherals, voltage regulators, and power management circuits, which are well known in the art and are therefore not further described herein. The bus interface 304 provides an interface. For different user devices, the user interface 303 may also be an interface that can connect external or internal devices, and the connected devices include but are not limited to keypads, displays, speakers, microphones, joysticks, etc.
[0130] The processor 301 is responsible for managing the bus architecture and general processing, and the memory 302 can store data used by the processor 301 when performing operations.
[0131] Optionally, the processor 301 is further configured to:
[0132] Determining the number of elements corresponding to the dialogue text segment according to the first element information corresponding to the dialogue text segment;
[0133] Determine a target dialogue text in the dialogue text segment according to the number of elements and the first element information corresponding to the dialogue text segment, wherein the target dialogue text is: the latest dialogue text at the dialogue time among the dialogue texts corresponding to the target elements included in the dialogue text segment, and the target element is any element corresponding to the dialogue text segment;
[0134] The third element information of the dialogue text segment is determined according to the second element information of the target dialogue text.
[0135] Optionally, the processor 301 is further configured to:
[0136] Obtaining window parameter information and sliding parameter information of the information co-occurrence window;
[0137] According to the window parameter information and the sliding parameter information, the information co-occurrence window is slid in the target language recognition text in the order of the text from the beginning to the end of the dialogue time to obtain the dialogue text segment;
[0138] The dialogue text segment is the dialogue text in the information co-occurrence window.
[0139] Optionally, the processor 301 is further configured to:
[0140] Acquire first sample data, the first sample data comprising a first sample, the first sample being a sample in which the dialogue text segment is used as a large model input instruction and the third element information is used as a large model output label;
[0141] Based on the first sample data, training data for a large model is determined.
[0142] Optionally, the processor 301 is further configured to:
[0143] Acquire element extraction thought information of the dialogue text segment, wherein the element extraction thought information is used to indicate a determination process of the third element information;
[0144] According to the third element information, a target sample is selected from the first sample data, wherein the elements corresponding to the dialogue text segment as the input instruction of the large model in the target sample include preset elements;
[0145] Assembling the input instruction of the target sample as the large model with the sample prompt information, and assembling the output label of the target sample as the large model with the element extraction thinking information to obtain the second sample data, wherein the sample prompt information is used to prompt the large model to output the determination process of the third element information;
[0146] The training data of the large model is determined according to the first sample data and the second sample data.
[0147] Optionally, the processor 301 is further configured to:
[0148] When it is determined that the element corresponding to the second dialogue text is a preset element, and the first matching result indicates that the element name in the first element information of the second dialogue text is the same as the element name in the first element information of the third dialogue text, the validity of the first element information of the second dialogue text is determined according to the second matching result and the third matching result; the second matching result is the matching result of the element content in the first element information of the second dialogue text and the element content in the second element information of the third dialogue text, and the third matching result is the matching result of the first dialogue role information of the second dialogue text and the second dialogue role information of the third dialogue text; the second dialogue text is the text with the latest dialogue time in the dialogue text segment, and the third dialogue text is the text in the dialogue text segment that is adjacent to the second dialogue text and has a dialogue time before the second dialogue text;
[0149] determining the second element information of the second dialogue text according to the validity, the first element information of the second dialogue text and the second element information of the third dialogue text;
[0150] According to the second element information of the second dialogue text, the third element information of the dialogue text segment is determined to obtain the element extraction thinking information.
[0151] Preferably, an embodiment of the present invention further provides an electronic device, comprising a processor 301, a memory 302, and a computer program stored in the memory 302 and executable on the processor 301. When the computer program is executed by the processor 301, each process of the above-mentioned text processing method embodiment is implemented, and the same technical effect can be achieved. To avoid repetition, it will not be described here.
[0152] The embodiment of the present invention further provides a computer-readable storage medium, on which a computer program is stored, and when the computer program is executed by a processor, each process of the above-mentioned text processing method embodiment is implemented, and the same technical effect can be achieved. To avoid repetition, it is not repeated here. The computer-readable storage medium is, for example, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk.
[0153] An embodiment of the present invention also provides a computer program product, including computer instructions. When the computer instructions are executed by at least one processor, the various processes of the above-mentioned text processing method embodiment are implemented and the same technical effect can be achieved. To avoid repetition, they are not repeated here.
[0154] Those skilled in the art will appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of the present invention.
[0155] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working processes of the systems, devices and units described above can refer to the corresponding processes in the aforementioned method embodiments and will not be repeated here.
[0156] In the embodiments provided in the present application, it should be understood that the disclosed systems and methods can be implemented in other ways. For example, the system embodiments described above are merely schematic. For example, the division of the units is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be an indirect coupling or communication connection through some interfaces, devices or units, which can be electrical, mechanical or other forms.
[0157] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the embodiments of the present invention.
[0158] In addition, each functional unit in each embodiment of the present invention may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit.
[0159] If the functions are implemented in the form of software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, or the part that contributes to the prior art, or the part of the technical solution, can be embodied in the form of a software product. The computer software product is stored in a storage medium, including several instructions for a computer device (which can be a personal computer, server, or network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present invention. The aforementioned storage medium includes: various media that can store program codes, such as USB flash drives, mobile hard disks, ROM, RAM, magnetic disks, or optical disks.
[0160] The above is only a specific embodiment of the present invention, but the protection scope of the present invention is not limited thereto. Any person skilled in the art can easily think of changes or substitutions within the technical scope disclosed by the present invention, which should be included in the protection scope of the present invention. Therefore, the protection scope of the present invention should be based on the protection scope of the claims.
Claims
1. A text processing method, characterized in that: The method comprises: Acquire a target language recognition text, where the target language recognition text is a dialogue text of at least two dialogue characters; Acquire first element information and second element information of each line of dialogue text, wherein the second element information of any line of the first dialogue text in the target language recognition text is associated with M lines of dialogue text, wherein the M lines of dialogue text include the first dialogue text and dialogue text in the target language recognition text at a dialogue time before the first dialogue text, and the element names in the first element information of the M lines of dialogue text are the same; Determining the number of elements corresponding to a dialogue text segment according to first element information corresponding to the dialogue text segment, wherein the dialogue text segment includes at least a portion of the dialogue text in the target language recognition text; Determine a target dialogue text in the dialogue text segment according to the number of elements and the first element information corresponding to the dialogue text segment, wherein the target dialogue text is: the latest dialogue text at the dialogue time among the dialogue texts corresponding to the target elements included in the dialogue text segment, and the target element is any element corresponding to the dialogue text segment; Determining third element information of the dialogue text segment according to the second element information of the target dialogue text; Based on the dialogue text segment and the third element information, training data of a large model is determined, and the large model is used to extract elements from the language recognition text.
2. The method according to claim 1, characterized in that Before determining the third element information of the dialogue text segment according to the first element information and the second element information corresponding to the dialogue text segment, the method further includes: Obtain window parameter information and sliding parameter information of the information co-occurrence window; According to the window parameter information and the sliding parameter information, the information co-occurrence window is slid in the target language recognition text in the order of the text from the beginning to the end of the dialogue time to obtain the dialogue text segment; The dialogue text segment is the dialogue text in the information co-occurrence window.
3. The method according to claim 1, characterized in that The step of determining the training data of the large model according to the dialogue text segment and the third element information includes: Acquire first sample data, the first sample data comprising a first sample, the first sample being a sample in which the dialogue text segment is used as a large model input instruction and the third element information is used as a large model output label; Based on the first sample data, training data for a large model is determined.
4. The method according to claim 3, characterized in that Before determining the training data of the large model based on the first sample data, the method further includes: Acquire element extraction thought information of the dialogue text segment, wherein the element extraction thought information is used to indicate a determination process of the third element information; The step of determining the training data of the large model based on the first sample data includes: According to the third element information, a target sample is selected from the first sample data, wherein the elements corresponding to the dialogue text segment as the input instruction of the large model in the target sample include preset elements; Assembling the input instruction of the target sample as the large model with the sample prompt information, and assembling the output label of the target sample as the large model with the element extraction thinking information to obtain the second sample data, wherein the sample prompt information is used to prompt the large model to output the determination process of the third element information; The training data of the large model is determined according to the first sample data and the second sample data.
5. The method according to claim 4, characterized in that The step of obtaining element extraction thought information of the dialogue text segment includes: When it is determined that the element corresponding to the second dialogue text is a preset element, and the first matching result indicates that the element name in the first element information of the second dialogue text is the same as the element name in the first element information of the third dialogue text, the validity of the first element information of the second dialogue text is determined according to the second matching result and the third matching result; the second matching result is the matching result of the element content in the first element information of the second dialogue text and the element content in the second element information of the third dialogue text, and the third matching result is the matching result of the first dialogue role information of the second dialogue text and the second dialogue role information of the third dialogue text; the second dialogue text is the text with the latest dialogue time in the dialogue text segment, and the third dialogue text is the text in the dialogue text segment that is adjacent to the second dialogue text and has a dialogue time before the second dialogue text; determining the second element information of the second dialogue text according to the validity, the first element information of the second dialogue text and the second element information of the third dialogue text; According to the second element information of the second dialogue text, the third element information of the dialogue text segment is determined to obtain the element extraction thinking information.
6. A text processing device, characterized in that: The device comprises: A first acquisition module is used to acquire a target language recognition text, wherein the target language recognition text is a dialogue text of at least two dialogue characters; A second acquisition module is used to acquire first element information and second element information of each line of dialogue text, wherein the second element information of any line of the first dialogue text in the target language recognition text is associated with M lines of dialogue text, wherein the M lines of dialogue text include the first dialogue text and dialogue text in the target language recognition text at a dialogue time before the first dialogue text, and the element names in the first element information of the M lines of dialogue text are the same; A first determination module is used to determine the number of elements corresponding to the dialogue text segment according to the first element information corresponding to the dialogue text segment; determine the target dialogue text in the dialogue text segment according to the number of elements and the first element information corresponding to the dialogue text segment, wherein the target dialogue text is: the latest dialogue text at the dialogue time among the dialogue texts corresponding to the target elements included in the dialogue text segment, wherein the target elements are any elements corresponding to the dialogue text segment; determine the third element information of the dialogue text segment according to the second element information of the target dialogue text, wherein the dialogue text segment includes at least part of the dialogue text in the target language recognition text; The second determination module is used to determine the training data of the large model based on the dialogue text segment and the third element information, and the large model is used to extract elements from the language recognition text.
7. An electronic device, characterized in that: The electronic device comprises: a processor, a memory, and a computer program stored in the memory and executable on the processor, wherein the computer program implements the steps of the text processing method as claimed in any one of claims 1 to 5 when executed by the processor.
8. A readable storage medium, characterized in that: The readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps of the text processing method according to any one of claims 1 to 5 are implemented.
9. A computer program product, characterized in that The method comprises computer instructions, which, when executed by at least one processor, implement the steps of the text processing method according to any one of claims 1 to 5.
