Text processing method and apparatus
Patent Information
- Application Number
- CN202211415557.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-11-11
- Publication Date
- 2026-09-25
- Estimated Expiration
- 2042-11-11
AI Technical Summary
[0003]然而,在理解用户的问题或提取知识的过程中,由于文本处理模型通常是基于特定领域的训练数据进行训练的,在用户提出的问题在该特定领域之外的其他领域中,可能导致对用户问题给出的回复准确性较差
[0049]上述方法通过利用文本处理模型,根据目标文本的文本顺序确定文本词语的关系标签,并根据文本词语和关系标签构建有向无环图,使得根据有向无环图就能确定目标文本的词语类型信息组,仅需要考虑目标文本的文本顺序,而不需要考虑目标文本的内容,使得即使是训练数据的特定领域以外的领域的目标文本也能够根据该文本处理模型处理,提高了文本处理模型的泛化效果,进而提升文本处理模型的输出结果的准确性,进而提升回复的准确性。
Smart Images

Figure CN115934904B_ABST
Abstract
Description
Technical Field
[0001] The embodiments in this specification relate to the field of computer technology, and in particular to text processing methods. Background Technology
[0002] In knowledge-based question-and-answer scenarios, it is usually necessary to understand the questions raised by users and extract knowledge from the data stored in the knowledge base based on the questions raised by users in order to answer the questions raised by users.
[0003] However, in the process of understanding user questions or extracting knowledge, text processing models are usually trained on training data based on a specific domain. If the user's question is in a domain other than that specific domain, the accuracy of the response to the user's question may be poor. Summary of the Invention
[0004] In view of the above, embodiments of this specification provide a text processing method. One or more embodiments of this specification also relate to a text processing apparatus, an answer determination method, an answer determination device, a computing device, a computer-readable storage medium, and a computer program, to address the technical deficiencies existing in the prior art.
[0005] According to a first aspect of the embodiments of this specification, a text processing method is provided, comprising:
[0006] Input the target text into the text processing model;
[0007] In the text processing model, the relational tags of text words in the target text are determined according to the text order of the target text. The relational tags include text relational tags of the text words and word relational tags of the text words and other text words.
[0008] Based on the text words and the relationship tags, construct a directed acyclic graph corresponding to the target text;
[0009] Based on the directed acyclic graph, the word type information group corresponding to the target text is determined.
[0010] According to a second aspect of the embodiments of this specification, a text processing apparatus is provided, comprising:
[0011] The input module is configured to input the target text into the text processing model;
[0012] The first determining module is configured to, in the text processing model, determine the relational tags of text words in the target text according to the text order of the target text, wherein the relational tags include text relational tags of the text words and word relational tags of the text words and other text words;
[0013] The construction module is configured to construct a directed acyclic graph corresponding to the target text based on the text words and the relation labels;
[0014] The second determining module is configured to determine the word type information group corresponding to the target text based on the directed acyclic graph.
[0015] According to a third aspect of the embodiments of this specification, a method for determining an answer is provided, comprising:
[0016] Receive question text input by the user through the interactive interface;
[0017] Input the question text into the text processing model;
[0018] In the text processing model, the relational tags of text words in the question text are determined according to the text order of the question text. The relational tags include text relational tags of the text words and word relational tags of the text words and other text words.
[0019] Based on the text words and the relation labels, construct a directed acyclic graph corresponding to the question text;
[0020] Based on the directed acyclic graph, determine the word type information group corresponding to the question text;
[0021] Input the question text and the word type information group into the answer determination model to obtain the target answer corresponding to the question text, which is output by the answer determination model.
[0022] The target answer is displayed to the user through the interactive interface.
[0023] According to a fourth aspect of the embodiments of this specification, an answer determining apparatus is provided, comprising:
[0024] The receiving module is configured to receive question text input by the user through the interactive interface;
[0025] The first input module is configured to input the question text into a text processing model;
[0026] The first determining module is configured to, in the text processing model, determine the relational tags of text words in the question text according to the text order of the question text, wherein the relational tags include text relational tags of the text words and word relational tags of the text words and other text words;
[0027] The construction module is configured to construct a directed acyclic graph corresponding to the question text based on the text words and the relation labels;
[0028] The second determining module is configured to determine the word type information group corresponding to the question text based on the directed acyclic graph.
[0029] The second input module is configured to input the question text and the word type information group into the answer determination model to obtain the target answer corresponding to the question text output by the answer determination model;
[0030] The display module is configured to present the target answer to the user through the interactive interface.
[0031] According to a fifth aspect of the embodiments of this specification, a text processing model training method is provided, applied to a cloud-based device, comprising:
[0032] Identify the text sample and the corresponding word type information group label;
[0033] Based on the text order of the text sample, the predicted relation labels of the text words in the text sample are determined, wherein the predicted relation labels include the predicted text relation labels of the text words and the predicted word relation labels of the text words and other text words;
[0034] Based on the text words and the predicted relation labels, construct the predicted directed acyclic graph corresponding to the text sample;
[0035] Based on the predicted directed acyclic graph, determine the predicted word type information group corresponding to the text sample;
[0036] A text processing model is trained based on the predicted word type information group and the word type information group label, and the text processing model is sent to the edge device.
[0037] According to a sixth aspect of the embodiments of this specification, a text processing model training apparatus is provided, applied to a cloud-based device, comprising:
[0038] The first determining module is configured to determine a text sample and the word type information group label corresponding to the text sample;
[0039] The second determining module is configured to determine the predicted relation labels of text words in the text sample based on the text order of the text sample, wherein the predicted relation labels include the predicted text relation labels of the text words and the predicted word relation labels of the text words and other text words;
[0040] The construction module is configured to construct a predicted directed acyclic graph corresponding to the text sample based on the text words and the predicted relation labels;
[0041] The third determining module is configured to determine the predicted word type information group corresponding to the text sample based on the predicted directed acyclic graph.
[0042] The training module is configured to train a text processing model based on the predicted word type information group and the word type information group label, and send the text processing model to the edge device.
[0043] According to a seventh aspect of the embodiments of this specification, a computing device is provided, comprising:
[0044] Memory and processor;
[0045] The memory is used to store computer-executable instructions, and the processor is used to execute the computer-executable instructions, which, when executed by the processor, implement the steps of the above-described text processing method or answer determination method.
[0046] According to an eighth aspect of the embodiments of this specification, a computer-readable storage medium is provided that stores computer-executable instructions, which, when executed by a processor, implement the steps of the above-described text processing method or answer determination method.
[0047] According to a ninth aspect of the embodiments of this specification, a computer program is provided, wherein when the computer program is executed in a computer, it causes the computer to perform the steps of the above-described text processing method or answer determination method.
[0048] This specification provides a text processing method in one embodiment, which involves inputting target text into a text processing model; in the text processing model, determining relational labels for text words in the target text based on the text order of the target text, wherein the relational labels include text relational labels among the text words and word relational labels between the text words and other text words; constructing a directed acyclic graph corresponding to the target text based on the text words and the relational labels; and determining word type information groups corresponding to the target text based on the directed acyclic graph.
[0049] The above method utilizes a text processing model to determine the relational labels of text words based on the text order of the target text, and constructs a directed acyclic graph (DAG) based on the text words and relational labels. This allows the determination of word type information groups in the target text based solely on the DAG, considering only the text order of the target text without needing to consider its content. This enables the text processing model to process target texts from domains outside the specific domain of the training data, improving the generalization effect of the text processing model and thus enhancing the accuracy of the output results and the accuracy of the response. Attached Figure Description
[0050] Figure 1 This is a schematic diagram of the test results of the current open information extraction model;
[0051] Figure 2 This is a schematic diagram illustrating an application scenario of a text processing method provided in one embodiment of this specification;
[0052] Figure 3 This is a flowchart illustrating a text processing method provided in one embodiment of this specification;
[0053] Figure 4 This is a schematic diagram of a text matrix in a text processing method provided in one embodiment of this specification;
[0054] Figure 5 This is a schematic diagram of a directed acyclic graph in a text processing method provided in one embodiment of this specification;
[0055] Figure 6 This is a schematic diagram illustrating the test results of a text processing model in a text processing method provided in one embodiment of this specification;
[0056] Figure 7 This is a flowchart illustrating the processing procedure of a text processing method provided in one embodiment of this specification.
[0057] Figure 8 This is a schematic diagram of the structure of a text processing device provided in one embodiment of this specification;
[0058] Figure 9 This is a flowchart illustrating an answer determination method provided in one embodiment of this specification;
[0059] Figure 10 This is a schematic diagram of the structure of an answer determining device provided in one embodiment of this specification;
[0060] Figure 11 This is a structural block diagram of a computing device provided in one embodiment of this specification. Detailed Implementation
[0061] Many specific details are set forth in the following description to provide a full understanding of this specification. However, this specification can be implemented in many other ways than those described herein, and those skilled in the art can make similar extensions without departing from the spirit of this specification. Therefore, this specification is not limited to the specific implementations disclosed below.
[0062] The terminology used in one or more embodiments of this specification is for the purpose of describing particular embodiments only and is not intended to be limiting of the one or more embodiments of this specification. The singular forms “a,” “described,” and “the” as used in one or more embodiments of this specification and the appended claims are also intended to include the plural forms unless the context clearly indicates otherwise. It should also be understood that the term “and / or” as used in one or more embodiments of this specification refers to and includes any or all possible combinations of one or more associated listed items.
[0063] It should be understood that although the terms first, second, etc., may be used to describe various information in one or more embodiments of this specification, such information should not be limited to these terms. These terms are only used to distinguish information of the same type from one another. For example, first may also be referred to as second without departing from the scope of one or more embodiments of this specification, and similarly, second may also be referred to as first. Depending on the context, the word "if" as used herein may be interpreted as "when," "when," or "in response to a determination."
[0064] First, the terms and concepts used in one or more embodiments of this specification will be explained.
[0065] Open Information Extraction (OpenIE): Directly uses word fragments from the original sentence as relational phrases between entities to extract triple class knowledge in an open manner.
[0066] Directed acyclic graph: refers to a directed graph without loops.
[0067] Unstructured format: Data is stored in a disorganized manner, making it difficult to extract it according to a single concept.
[0068] In practical applications, most data within enterprises exists in unstructured form, with documents making up the largest proportion, such as customer service manuals, product manuals, policy documents, and laws and regulations. How to fully utilize unstructured enterprise documents to enrich the knowledge of dialogue systems is a crucial aspect of enterprise information intelligence. In the knowledge extraction process, key triple-type open knowledge is extracted from the documents as one of the knowledge sources for generating responses.
[0069] Triple-class knowledge plays a crucial role in dialogue systems, helping dialogue models generate more knowledge-rich responses. Traditional point-closed information extraction requires assuming a predefined set of types and labeling large amounts of training data, which is time-consuming and labor-intensive, making it difficult to apply to extraction tasks with diverse needs across multiple domains. Open information extraction, on the other hand, directly uses word fragments from the original sentence as relational phrases between entities, rather than selecting relations from a fixed set of types, thus making it easier to scale. However, current open information extraction models neglect the generalization aspect of extraction. In practical applications, open information extraction models were tested on datasets from six different domains, such as... Figure 1 As shown, Figure 1 This diagram illustrates the test results of the current open information extraction model. Figure 1 This includes the model performance parameters of Model 1 and Model 2, currently used for information extraction, in the test domain, and the model performance parameters in other domains besides the training domain. The training domain can be understood as the domain of the model's training data, and other domains include domain A, domain B, ..., domain F. Test results show that when using test data from a different domain than the training data, a relative performance drop of up to 70% occurs. Therefore, an effective technical solution is urgently needed to address the above problem.
[0070] This specification provides a text processing method, and also relates to a text processing apparatus, an answer determination method, an answer determination apparatus, a computing device, and a computer-readable storage medium, which will be described in detail in the following embodiments.
[0071] See Figure 2 , Figure 2 The diagram illustrates an application scenario of a text processing method provided according to an embodiment of this specification.
[0072] Figure 2 The system includes a client 202, a server 204, and a knowledge database 206. The client 202 deploys a knowledge-based question-and-answer assistant, allowing users to ask questions. The client 202 can be a computer terminal, mobile terminal, or similar device. The knowledge database 206 stores knowledge data that assists the knowledge-based question-and-answer assistant in answering user questions. The server 204 deploys a text processing model, which can be used to extract knowledge from the knowledge data stored in the knowledge database 206, thereby obtaining the triplet knowledge corresponding to the user's question.
[0073] In practice, users can ask questions to the knowledge-based question-and-answer assistant through client 202. Client 202 sends the question to server 204. Server 204 can retrieve knowledge data from knowledge database 206 based on the question and input the retrieved knowledge data into a text processing model deployed on server 204 to obtain a triplet knowledge output by the text processing model. Server 204 can then generate an answer to the question based on the triplet knowledge and the question, and send the answer back to client 202 for display to the user through the knowledge-based question-and-answer assistant. Specifically, server 204 can input the triplet instruction and the question into its own deployed answer determination model to obtain the answer output by the answer determination model.
[0074] like Figure 2 As shown, a user can ask the knowledge-based question-and-answer assistant, "In what year was the park built?", via client 202. Client 202 sends the question to server 204. Server 204 can retrieve knowledge data from knowledge database 206 based on the question and input the retrieved knowledge data into a text processing model deployed on server 204. The text processing model outputs the triple knowledge set: "The park was built in the spring of the year before last" and "The park was built during the Spring Festival." Based on this triple knowledge set and the question, server 204 generates the answer to the question, "The park was built in the spring of the year before last and during the Spring Festival," and sends the answer, "The park was built in the spring of the year before last and during the Spring Festival," back to client 202, which then displays it to the user through the knowledge-based question-and-answer assistant. This implements the extraction of triple knowledge sets from knowledge data as one of the knowledge sources for generating the answer.
[0075] See Figure 3 , Figure 3 A flowchart of a text processing method according to an embodiment of this specification is shown, which specifically includes the following steps.
[0076] Step 302: Input the target text into the text processing model.
[0077] In this context, target text can be understood as the text that needs to be processed. Target text can be, for example, a question asked by a user or knowledge data retrieved from a knowledge database. A text processing model can be understood as a model used to process target text in order to extract information from it.
[0078] Specifically, text processing models can extract information from target text. For example, they can extract entity and relation information from the target text. Entities can be understood as text objects in the target text, and relations can be understood as the relationships between text objects. For example, in the target text "The park was built in the spring of the year before last and during the Spring Festival," the entities include the head entity "park" and the tail entity "last year." The relationship between the head and tail entities is "built in." The head entity, tail entity, and relation can form a triple. Therefore, the corresponding triple information for the target text is "park, built in, last year," which is the result of information extraction from the target text. Text processing models can also extract part-of-speech information such as subject, predicate, and object from the target text. In this scenario, the subject, predicate, and object can also form a triple, and the result of information extraction is the triple result.
[0079] For ease of understanding, let's take the target text "The park was built in the spring of the year before last and during the Spring Festival" as an example. However, in actual applications, in unstructured knowledge databases, the stored knowledge data may be a long sentence. For example, the target text may be "The park was built in the spring of the year before last and during the Spring Festival. The park is located in XX region...". In the knowledge extraction scenario, it is necessary to extract the triple knowledge related to the user's question from this long sentence.
[0080] It should be noted that the text processing method provided in the embodiments of this specification can be used as an open information extraction method. The extracted information can be subsequently used in question-and-answer scenarios, customer service scenarios, etc., and can assist the question-and-answer model in better understanding the questions raised by users. For example, when a user raises a question to a customer service assistant, this text processing method can be used to extract information from the user's question in order to better understand the user's question; or, in order to ensure the knowledgeability of the reply to the user, triple class knowledge related to the user's question can be extracted from the document data stored in the knowledge base, and the reply information can be determined based on the triple class knowledge. It is understood that the text processing method provided in the embodiments of this specification can be used in any scenario that requires information extraction, and this specification does not limit it.
[0081] In practical applications, to enable a text processing model to output the required information, the model can be trained. For example, given the existence of specific entity and relation information in the text, the text can be used as a training sample, and the entity and relation information of that text can be used as training labels to train the text processing model. The specific implementation method is as follows:
[0082] Identify the text sample and the corresponding word type information group label;
[0083] Based on the text order of the text sample, the predicted relation labels of the text words in the text sample are determined, wherein the predicted relation labels include the predicted text relation labels of the text words and the predicted word relation labels of the text words and other text words;
[0084] Based on the text words and the predicted relation labels, construct the predicted directed acyclic graph corresponding to the text sample;
[0085] Based on the predicted directed acyclic graph, determine the predicted word type information group corresponding to the text sample;
[0086] The text processing model is trained based on the predicted word type information group and the word type information group label.
[0087] Among them, the text sample is the training sample of the initial text processing model, and the word type information group label is the training label of the initial text processing model. The word type information group label can be understood as the triple information label.
[0088] Based on this, during the training of the text processing model, the predicted relation labels of text words in a text sample can be determined according to the text order of a single text. A directed acyclic graph (DAG) is constructed based on the text words and predicted relation labels. Based on the DAG, the predicted word type information group is determined. This predicted word type information group is the prediction result output during the training of the text processing model. The text processing model is then trained using this predicted word type information group and its labels.
[0089] Specifically, the step of training a text processing model based on the predicted word type information group and the word type information group label includes:
[0090] Calculate the model loss value based on the predicted word type information group and the word type information group label;
[0091] The text processing model is trained using the model loss value until a text processing model that meets the training stopping condition is obtained.
[0092] The training stopping condition can be understood as the number of training iterations reaching a preset threshold, or the model loss value being less than a preset threshold.
[0093] At this time, the text recognition model has not been fully trained, and there is still a certain gap between the output predicted word type information group and the word type information group label. Therefore, it is still necessary to use the word type information group and the word type information group label to jointly train the model and adjust the parameters of the model. The model loss value needs to be calculated according to the predicted text information and the sample text information. Specifically, the loss function can be used to calculate the model loss value. In practical applications, the loss function may be a cross-entropy loss function, a square loss function, a 0-1 loss function, etc. In this specification, there is no limitation on the selection of the loss function, and it is subject to actual application. Then, according to the loss function, the text processing model is further trained until a text processing model satisfying the training stop condition is obtained, and at this point, the training of the text processing model is completed.
[0094] In conclusion, training the text processing model to obtain the text processing model that meets the training stop condition provides a basis for the subsequent application of the text processing model to information extraction scenarios.
[0095] Step 304: in said text processing model, according to the text order of said target text, determining the relation label of the text words in said target text, wherein said relation label comprises the text relation label of a single text in said text words, and the word relation label between said text word and other text words.
[0096] Wherein, the text order of the target text can be understood as the order of individual texts in the target text, and an individual text can be understood as a character in the target text. For example, for the target text "the park was built in the spring of the year before last and during the Spring Festival", "the (transliteration of the first Chinese character 公)" is an individual text in the target text, and "park (transliteration of the second Chinese character 园)" is also an individual text in the target text. A text word in the target text can be understood as a word in the target text. For example, "park" is a text word in the target text, and "was built in" is a text word in the target text. It can be understood that the target text can be composed of one or more text words.
[0097] The relation tags of text words can be used to represent the relations between text words. The text relation tag of individual texts among text words can be understood as a tag used to represent the relation between individual texts constituting the text words. A text relation tag may be a tag for the start character and end character of a text word. For example, for the text word "公园 (gōng yuán, park)", its start character is "公 (gōng)" and the end character is "园 (yuán)", then the text relation tag can be used to represent the connection relation between the start character "公 (gōng)" and the end character "园 (yuán)". For another example, for the text word "建造于 (jiàn zào yú, was built in)", its start character is "建 (jiàn)" and the end character is "于 (yú)", then the text relation tag can be used to represent the connection relation between the start character "建 (jiàn)" and the end character "于 (yú)". The word relation tag between a text word and other text words can be understood as a tag used to represent the relation between one text word and another text word in the target text. For example, the word relation tag can be used to represent the relation between the text word "公园 (park)" and the text word "建造于 (was built in)".
[0098] Based on this, in a text processing model, the text processing model can be used to determine the relation tag between individual texts of text words in the target text and the relation tag between one text word and another text word according to the text order of individual texts in the target text.
[0099] For example, for the target text "公园建造于前年春天和春节期间 (The park was built in the spring of the year before last during the Spring Festival)", the text processing model can determine the text relation tag for the texts "公 (gōng)" and "园 (yuán)" in the target text, and determine the word relation tag for the texts "园 (yuán)" and "于 (yú)" in the target text according to the order of each character in the target text.
[0100] Specifically, the tags used when training the text processing model are word type information group tags, which can be understood as triple information that needs to be extracted determined according to actual requirements, for example, it may be "head entity, relation, tail entity", or it may also be "subject, predicate, object". Then, the content output during the application of the text processing model is a word type information group, and the word type information group is a triple corresponding to the word type.
[0101] Correspondingly, the word relation tags between said text words and other text words include:
[0102] The word relation tag between said text word and other text words associated with said text word, and the word relation tag between the first text word and the second text word included in said triple.
[0103] Among them, text words and their associated text words can be understood as text words determined according to the text order of the target text and the next text word of that text word. For example, for the target text "The park was built in the spring of the year before last and during the Spring Festival", the text words "park" and the next text word "built in" are determined according to the text order. Then the word relationship label can include the word relationship label of "park" and "built in". The triple is the triple of the target text predicted by the text processing model. The first text word contained in the triple can be understood as the first text word contained in the triple, and the second text word contained in the triple can be understood as the last text word contained in the triple. For example, for the triple "subject, predicate, object", the triple predicted by the text processing model is "park, built in, the spring of the year before last", where "park" is the first text word contained in the triple, and "the spring of the year before last" is the last text word contained in the triple. Correspondingly, if the triple is "predicate, object, subject", then the triple predicted by the text processing model is "built in, the spring of the year before last, park". In this case, "built in" is the first text word contained in the triple, and "park" is the last text word contained in the triple.
[0104] Furthermore, the word relationship tags for text words and other related text words can include word relationship tags between the last character of the text word and the first character of the next text word, and also between the last character of the text word and the last character of the next text word. For example, for the text word "park" and the next text word "built at," the word relationship tags can include the word relationship tag between "park" and "built," and also between "park" and "at." By setting these two types of tags, the repetition of a single text word can be avoided. For example, for the text words "born at" and "built at," which contain the repeated single text "at," and "at" is also the last character of both text words, if only one word relationship tag is set between the last characters, it will cause confusion between the two text words, making it impossible to accurately determine the order of the text words.
[0105] Furthermore, when determining the word relationship labels of a text word and other text words associated with it, the word relationship label also includes the word type label of the next text word. For example, for the text word "park" and the next text word "built at", word relationship labels can be determined for "park" and "at". At this time, the word type of the next text word "built at" can also be predicted to be "predicate".
[0106] In summary, by determining the text relation label of a single text among the text words, the text words included in the target text can be determined; by determining the word relation labels between text words and other text words, the text order of the text words in the target text can be determined, thereby improving the accuracy of subsequently determining triple information, avoiding errors in determining the association relationship between text words caused by overlapping text words, and preventing fuzzy extraction.
[0107] In practical applications, when determining the relation labels of text words in the target text according to the text order of the target text, the relation labels can be determined based on a text matrix. The specific implementation method is as follows:
[0108] Generating a text matrix according to the target text in accordance with the text order of the target text;
[0109] Determining the relation labels of text words in the target text according to the text matrix.
[0110] Specifically, a text matrix can be generated according to the target text in accordance with the text order of single texts in the target text, and the relation labels of text words can be predicted based on the text matrix.
[0111] During specific implementation, generating a text matrix according to the target text includes:
[0112] Generating a text matrix with a length corresponding to the text length of the target text according to the text length of the target text, wherein the text matrix comprises text matrix units corresponding to the target text;
[0113] Correspondingly, determining the relation labels of text words in the target text according to the text matrix comprises:
[0114] Predicting the text matrix units corresponding to the single texts to obtain the relation labels of the text words in the target text.
[0115] Wherein, the text length of the target text can be understood as the number of single texts contained in the target text, that is, the number of characters, and the length corresponding to the text length can be understood as a length equal to the text length. For example, for the target text "The park was built in the spring of the previous year and during the Spring Festival", which contains 14 single texts, a 14×14 text matrix can be constructed. A text matrix unit can be understood as a matrix unit corresponding to a text in the target text, for example, a matrix unit corresponding to the text "par" in the target text.
[0116] It can be understood that determining the text relation label for the start character "公" and the end character "园" of the text word "公园" means adding text relation labels to the text matrix units corresponding to the single text "公" and the single text "园" respectively. Correspondingly, when determining the word relation label for the end character "园" of the text word "公园" and the end character "于" of the next text word "建造于", it means adding word relation labels to the text matrix units corresponding to the single text "园" and the single text "于" respectively.
[0117] See Figure 4 , Figure 4 shows a schematic diagram of a text matrix in a text processing method provided according to an embodiment of the present specification, as shown in Figure 4 , the text matrix constructed according to the target text "公园建造于前年春天和春节期间" is shown in the figure, where the single text "公" corresponds to text matrix unit 1, and the single text "公" and the single text "园" correspond to text matrix unit 2.
[0118] Based on this, when predicting the text matrix units corresponding to single texts, it can be traversed as shown in Figure 3the text matrix in, predicting each text matrix unit. For example, for text matrix unit 2, which corresponds to a single text character "公" and a single text character "园", the relation label predicted for this text matrix unit 2 is the text relation label "I", which is used to represent the relation between the starting character and the ending character of a text word. Based on this text relation label "I", it can be determined that "公园" is a text word; and for the text matrix unit 6 corresponding to the single text characters "建" and "于", the predicted relation label is also the text relation label "I", and based on this text relation label, it can be determined that "建造于" is a text word. For text matrix unit 3, which corresponds to the single text characters "园" and "于", that is, the ending character of the text word "公园" and the ending character of the text word "建造于", the predicted word relation label of the text matrix unit 3 is "EE-X", where "X" is used to represent the word type of the text word "建造于" that comes later in the text order. For text matrix unit 4, which corresponds to the single text character "园" and the single text character "建", that is, the ending character of the text word "公园" and the starting character of the text word "建造于", the predicted word relation label of the text matrix unit 4 is "EB-X". For text matrix unit 5, which corresponds to the single text character "公" and the single text character "间", that is, the starting character of the text word "公园" and the ending character of the text word "春节期间", which is used to represent the boundary of the triple predicted by the text matrix, the predicted word relation label of the text matrix unit 5 is "BE-X", where "X" is used to represent the word type of the text word "春节期间" that comes later in the text order. By analogy, each text matrix unit in the text matrix can be predicted to obtain a text relation label or a word relation label.
[0119] In summary, by generating a text matrix according to the text length of the target text, and each text matrix unit corresponds to a single text character, it is possible to predict the relation label of text words based on the text matrix, thereby providing a basis for subsequent directed acyclic graph generation.
[0120] Step 306: constructing a directed acyclic graph corresponding to the target text according to the text words and the relation labels.
[0121] Specifically, after determining the relation labels of the text words, a directed acyclic graph corresponding to the target text can be constructed according to the text words and the relation labels.
[0122] During specific implementation, constructing a directed acyclic graph corresponding to the target text according to the text words and the relation labels comprises:
[0123] taking each single text character in the text words as a node, and taking the order of the single text characters in the target text as connecting edges, constructing an initial directed acyclic graph corresponding to the target text;
[0124] marking the connecting edges according to the relation labels to obtain node relation information associated with the connecting edges;
[0125] obtaining a directed acyclic graph corresponding to the target text according to the initial directed acyclic graph and the node relation information.
[0126] wherein, the node relation information associated with the connecting edge can be understood as relation information of nodes connected by the connecting edge, and the relation between two nodes connected by the connecting edge can be determined according to the node relation information.
[0127] continuing with the above example, for the target text "The park was built during the spring of the previous year and the Spring Festival", the text words corresponding to the target text are "park", "was built during", "spring of the previous year", "previous year", "during the Spring Festival" and "during". A single character "p" in "park" may be used as a node, "a" as a node, "r" as a node, ..., according to the order of single characters in the target text, there is a connecting edge between "p" and "a", a connecting edge between "a" and "r", a connecting edge between "r" and "k", ..., and so on, to construct the initial directed acyclic graph. The connecting edges are marked according to the relation labels determined by the text matrix, the text matrix determines the text relation label "I" between "p" and "a", then the connecting edge between "p" and "a" is marked with the text relation label "I", the text matrix determines the word relation label "EE-X" between "k" and "w" of "was", wherein "X" is used to represent the word type of the text word "was built during", then the connecting edge between "k" and "w" is marked with the word relation label "EE-X", and so on, until all the determined relation labels are marked on the connecting edges, and the directed acyclic graph corresponding to the target text can be obtained according to the node relation information obtained after marking and the initial directed acyclic graph.
[0128] it should be noted that the target text in the embodiments of the present description is not limited to Chinese text, and may also be text in other languages such as English text, Japanese text, etc. See Figure 5 , Figure 5 shows a schematic diagram of a directed acyclic graph in a text processing method provided according to an embodiment of the present description, and the text processing method provided by the embodiments of the present description is further illustrated by taking an English text as the target text.
[0129] Figure 5 in, the target text is "John is the premier and first minister of B**C**", the extracted triplet is "subject, predicate, object", and the directed acyclic graph corresponding to the triplet is as shown in Figure 5As shown, the subject is "John", the predicates are "premier", "of" and "first minister of", and the object is "B**C**".
[0130] In summary, constructing a directed acyclic graph (DAG) based on text words and relational labels can provide a basis for subsequently determining word type information groups. Furthermore, constructing a DAG based on text order can reduce the number of edges required to represent each word type information group to a linear level, which is beneficial for improving the generalization of the model.
[0131] Step 308: Determine the word type information group corresponding to the target text based on the directed acyclic graph.
[0132] Specifically, after determining the directed acyclic graph, the word type information group corresponding to the target text can be determined based on the directed acyclic graph.
[0133] The word type information group can be understood as the triple information extracted from the target text, such as "head entity, relation, tail entity", or "subject, predicate, object", etc. The word type information group can also include more types of information, such as "subject, predicate, object, adverbial", etc.
[0134] In specific implementation, based on the directed acyclic graph, the word type information group corresponding to the target text is determined, including:
[0135] Traverse the directed acyclic graph to determine at least one word type information group corresponding to the target text.
[0136] Specifically, the paths in the directed acyclic graph can be traversed to obtain a single path graph for each word type information group, and then at least one word type information group of the target text can be determined based on the single path graph of each word type information group.
[0137] Understandably, for a given target text, there may be at least one corresponding word type information group. For example, the target text "The park was built in the spring of the year before last and during the Spring Festival" has the corresponding word type information groups "subject, predicate, object" as "park, built in, the spring of the year before last" and "park, built during, the Spring Festival". As another example, for the target text "Xiao Ming, born in 1950, became president", the corresponding word type information groups "subject, predicate, object" are "Xiao Ming, born in, 1950" and "Xiao Ming, became, president".
[0138] In summary, by traversing the directed acyclic graph, it is possible to determine at least one group of word type information corresponding to the target text, thereby extracting the relational or type information of the target text.
[0139] In practical applications, the text processing method provided in the embodiments of this specification can be applied to question-and-answer scenarios between users and online customer service. The specific implementation method is as follows:
[0140] Receive target text input by the user through an interactive interface; wherein the target text is the target text edited by the user through the interactive interface; or
[0141] The target text is the target text converted from the audio data input by the user through the interactive interface.
[0142] The interactive interface can be understood as the interface displayed to the user by the user's interactive device. The interactive device can be a computer terminal, a mobile terminal, a robot, etc.
[0143] Based on this, users can edit the target text on the interactive interface, or they can input it by voice on the interactive interface. The interactive device can perform semantic recognition on the audio data input by the user and convert it into the target text.
[0144] Furthermore, after receiving the target text input by the user, information can be extracted from the knowledge data stored in a pre-defined knowledge base. This involves inputting the knowledge data corresponding to the target text into a text processing model, which then performs triplet knowledge extraction to obtain the corresponding word type information groups. This ensures the knowledge-based nature of the subsequent user responses.
[0145] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, data stored, data displayed, etc.) involved in this manual are all information and data authorized by the user or fully authorized by all parties. Furthermore, the collection, use and processing of related data must comply with the relevant laws, regulations and standards of the relevant countries and regions, and corresponding operation portals are provided for users to choose to authorize or refuse.
[0146] After determining the word type information group corresponding to the target text, the following steps are also included:
[0147] Input the target text and the word type information group into the answer determination model to obtain the target answer corresponding to the target text, which is output by the answer determination model.
[0148] The target answer is displayed to the user through the interactive interface.
[0149] The answer determination model can be understood as a model that outputs the answer corresponding to the input text. Any model that can determine the answer corresponding to the text can be used as the answer determination model in the embodiments of this specification, and this specification does not limit it.
[0150] Based on this, the target text and the word type information group corresponding to the target text can be input into the answer determination model to obtain the target answer corresponding to the target text output by the answer determination model, and the target answer can be displayed to the user through an interactive interface.
[0151] For example, when a user asks a question to online customer service, they can edit the question text "When will this order be shipped?" on the interactive interface displayed on their mobile phone. The server receives the question text and inputs it into a text processing model. Based on the text processing model, the server determines that the corresponding word type information group for the question text is "order, shipment". The server then inputs the question text and the word type information group into an answer determination model, which outputs the answer "shipment time is within 3 days from the date of order placement". This answer is then displayed to the user through the interactive interface.
[0152] The text processing model in the text processing method provided in the embodiments of this specification improves the model's generalization ability by considering only the text order of the target text when determining relation labels and constructing the directed acyclic graph. This reduces the number of connection edges required for each word type information group (i.e., triplet) to a linear level. The text processing model was tested on two datasets from different domains, and the test results are shown in Tables 1, 2, and 3. Figure 6 As shown, Figure 6 A schematic diagram illustrating the test results of a text processing model in a text processing method provided according to an embodiment of this specification is shown.
[0153] Table 1
[0154]
[0155] Table 2
[0156]
[0157] Table 3
[0158] Fitting speed 4 20 5x Extraction speed 136 409 3x
[0159] Model 1, Model 2, and Model 3 in Tables 1 and 2 are current information extraction models. The text processing model is a text processing model in a text processing method provided in the embodiments of this specification. The text processing model is tested with other information extraction models to obtain test results.
[0160] Therefore, it can be seen that the text processing model in the embodiments of this specification improves the extraction effect on both datasets from different domains, achieving higher performance metrics, and also improves extraction speed and fitting speed. Figure 6As shown, the performance parameters of the text processing model in the embodiments of this specification are improved in scenarios of complex triplet extraction, multiple triplet extraction, and low-resource triplet extraction. Specifically, complex triplet extraction includes extracting discontinuous, overlapping, and nested triplets; multiple triplet extraction includes extracting triplets from target text containing multiple triplets; and low-resource triplet extraction includes extracting triplets when training data is limited.
[0161] In summary, the above method utilizes a text processing model to determine the relational labels of text words based on the text order of the target text, and constructs a directed acyclic graph (DAG) based on the text words and relational labels. This allows the determination of word type information groups in the target text solely based on the DAG, considering only the text order and not the content. This enables the text processing model to process target texts from domains outside the specific domain of the training data, improving the generalization effect of the text processing model and thus enhancing the accuracy of its output and, consequently, the accuracy of the response.
[0162] The following is in conjunction with the appendix Figure 7 Taking the application of the text processing method provided in this specification in the question-and-answer scenario of an enterprise question-and-answer assistant as an example, the text processing method will be further explained. Figure 7 The present specification shows a flowchart of a text processing method according to an embodiment, which specifically includes the following steps.
[0163] Step 702: The client sends the user's question text to the server.
[0164] Step 704: The server retrieves the corresponding knowledge data from the knowledge database based on the question text.
[0165] Step 706: The server inputs the knowledge data into the text processing model.
[0166] Step 708: The server receives the triple knowledge output by the text processing model.
[0167] Step 710: The server generates the answer text based on the question text and triple knowledge.
[0168] Step 712: The server sends the answer text to the client.
[0169] Step 714: The client displays the answer text to the user.
[0170] In summary, the above method utilizes a text processing model to determine the relational labels of text words based on the text order of the target text, and constructs a directed acyclic graph (DAG) based on the text words and relational labels. This allows the determination of word type information groups in the target text solely based on the DAG, considering only the text order and not the content. This enables the text processing model to process target texts from domains outside the specific domain of the training data, improving the generalization effect of the text processing model and thus enhancing the accuracy of its output and response.
[0171] Corresponding to the above method embodiments, this specification also provides embodiments of a text processing device. Figure 8 A schematic diagram of the structure of a text processing apparatus according to one embodiment of this specification is shown. Figure 8 As shown, the device includes:
[0172] Input module 802 is configured to input target text into a text processing model;
[0173] The first determining module 804 is configured to determine the relational tags of text words in the target text according to the text order of the target text in the text processing model, wherein the relational tags include text relational tags of the text words and word relational tags of the text words and other text words;
[0174] The construction module 806 is configured to construct a directed acyclic graph corresponding to the target text based on the text words and the relation labels;
[0175] The second determining module 808 is configured to determine the word type information group corresponding to the target text based on the directed acyclic graph.
[0176] In an optional embodiment, the device further includes a training module configured to:
[0177] Identify the text sample and the corresponding word type information group label;
[0178] Input the text sample into the initial text processing model;
[0179] In the initial text processing model, the predicted relation labels of text words in the text sample are determined according to the text order of the text sample. The predicted relation labels include the predicted text relation labels of the text words and the predicted word relation labels of the text words and other text words.
[0180] Based on the text words and the predicted relation labels, construct the predicted directed acyclic graph corresponding to the text sample;
[0181] Based on the predicted directed acyclic graph, determine the predicted word type information group corresponding to the text sample;
[0182] The initial text processing model is trained using the predicted word type information group and the word type information group label until a text processing model that meets the training stopping condition is obtained.
[0183] In an optional embodiment, the training module is further configured to:
[0184] Calculate the model loss value based on the predicted word type information group and the word type information group label;
[0185] The initial text processing model is trained using the model loss value until a text processing model that meets the training stopping condition is obtained.
[0186] In an optional embodiment, the first determining module 804 is further configured to:
[0187] Generate a text matrix based on the text order of the target text;
[0188] Based on the text matrix, determine the relational labels of the text words in the target text.
[0189] In an optional embodiment, the first determining module 804 is further configured to:
[0190] Based on the text length of the target text, a text matrix of a length corresponding to the text length is generated, wherein the text matrix contains text matrix units corresponding to individual texts in the target text;
[0191] Predict the text matrix unit corresponding to the single text to obtain the relation labels of text words in the target text.
[0192] In an optional embodiment, the building module 806 is further configured to:
[0193] Using individual texts from the text words as nodes and the order of the individual texts in the target text as connecting edges, an initial directed acyclic graph corresponding to the target text is constructed;
[0194] Based on the relationship label, the connecting edge is marked to obtain the node relationship information associated with the connecting edge;
[0195] Based on the initial directed acyclic graph and the node relationship information, a directed acyclic graph corresponding to the target text is obtained.
[0196] In one optional embodiment, the word type information group is a triplet corresponding to the word type;
[0197] Accordingly, the word relationship tags between the text words and other text words include:
[0198] The word relationship tags of the text word and other text words associated with the text word, and the word relationship tags of the first text word and the second text word contained in the triplet.
[0199] In an optional embodiment, the second determining module 808 is further configured to:
[0200] Traverse the directed acyclic graph to determine at least one word type information group corresponding to the target text.
[0201] In an optional embodiment, the apparatus further includes a receiving module configured to:
[0202] Receive target text input by the user through an interactive interface; wherein the target text is the target text edited by the user through the interactive interface; or
[0203] The target text is the target text converted from the audio data input by the user through the interactive interface.
[0204] In an optional embodiment, the device further includes a display module configured to:
[0205] Input the target text and the word type information group into the answer determination model to obtain the target answer corresponding to the target text, which is output by the answer determination model.
[0206] The target answer is displayed to the user through the interactive interface.
[0207] In summary, the aforementioned device utilizes a text processing model to determine the relational labels of text words based on the text order of the target text, and constructs a directed acyclic graph (DAG) based on the text words and relational labels. This allows the determination of word type information groups in the target text solely based on the DAG, considering only the text order of the target text without needing to consider its content. This enables the processing of target text from domains outside the specific domain of the training data, improving the generalization effect of the text processing model and thus enhancing the accuracy of its output, ultimately improving the accuracy of the response.
[0208] The above is an illustrative scheme of a text processing device according to this embodiment. It should be noted that the technical solution of this text processing device and the technical solution of the above-described text processing method belong to the same concept. For details not described in detail in the technical solution of the text processing device, please refer to the description of the technical solution of the above-described text processing method.
[0209] See Figure 9 , Figure 9 A flowchart of an answer determination method according to an embodiment of this specification is shown, which specifically includes the following steps.
[0210] Step 902: Receive the question text entered by the user through the interactive interface.
[0211] Step 904: Input the problem text into the text processing model.
[0212] Step 906: In the text processing model, based on the text order of the question text, determine the relational tags of the text words in the question text, wherein the relational tags include the text relational tags of the text words and the word relational tags of the text words and other text words.
[0213] Step 908: Construct a directed acyclic graph corresponding to the question text based on the text words and the relation labels.
[0214] Step 910: Based on the directed acyclic graph, determine the word type information group corresponding to the question text.
[0215] Step 912: Input the question text and the word type information group into the answer determination model to obtain the target answer corresponding to the question text output by the answer determination model.
[0216] Step 914: Display the target answer to the user through the interactive interface.
[0217] It should be noted that the specific process of determining the answer is the same as that of the text processing method described above, and will not be repeated here.
[0218] In summary, the above method utilizes a text processing model to determine the relational labels of text words based on the text order of the target text, and constructs a directed acyclic graph (DAG) based on the text words and relational labels. This allows the determination of word type information groups in the target text solely based on the DAG, considering only the text order and not the content. This enables the text processing model to process target texts from domains outside the specific domain of the training data, improving the generalization effect of the text processing model and thus enhancing the accuracy of its output and, consequently, the accuracy of the response.
[0219] Corresponding to the above method embodiments, this specification also provides embodiments of an answer determining device. Figure 10 A schematic diagram of an answer-determining device according to one embodiment of this specification is shown. Figure 10 As shown, the device includes:
[0220] The receiving module 1002 is configured to receive the question text input by the user through the interactive interface;
[0221] The first input module 1004 is configured to input the question text into a text processing model;
[0222] The first determining module 1006 is configured to determine, in the text processing model, relational tags of text words in the question text according to the text order of the question text, wherein the relational tags include text relational tags of the text words and word relational tags of the text words and other text words;
[0223] The construction module 1008 is configured to construct a directed acyclic graph corresponding to the question text based on the text words and the relation labels;
[0224] The second determining module 1010 is configured to determine the word type information group corresponding to the question text based on the directed acyclic graph.
[0225] The second input module 1012 is configured to input the question text and the word type information group into the answer determination model to obtain the target answer corresponding to the question text output by the answer determination model;
[0226] The display module 1014 is configured to display the target answer to the user through the interactive interface.
[0227] In summary, the aforementioned device utilizes a text processing model to determine the relational labels of text words based on the text order of the target text, and constructs a directed acyclic graph (DAG) based on the text words and relational labels. This allows the determination of word type information groups in the target text solely based on the DAG, considering only the text order of the target text without needing to consider its content. This enables the processing of target text from domains outside the specific domain of the training data, improving the generalization effect of the text processing model and thus enhancing the accuracy of its output, ultimately improving the accuracy of the response.
[0228] The above is a schematic scheme of an answer determination device according to this embodiment. It should be noted that the technical solution of this answer determination device and the technical solution of the answer determination method described above belong to the same concept. For details not described in detail in the technical solution of the answer determination device, please refer to the description of the technical solution of the answer determination method described above.
[0229] Corresponding to the above method embodiments, this specification also provides a text processing model training method applied to cloud-side devices, including:
[0230] Identify the text sample and the corresponding word type information group label;
[0231] Based on the text order of the text sample, the predicted relation labels of the text words in the text sample are determined, wherein the predicted relation labels include the predicted text relation labels of the text words and the predicted word relation labels of the text words and other text words;
[0232] Based on the text words and the predicted relation labels, construct the predicted directed acyclic graph corresponding to the text sample;
[0233] Based on the predicted directed acyclic graph, determine the predicted word type information group corresponding to the text sample;
[0234] A text processing model is trained based on the predicted word type information group and the word type information group label, and the text processing model is sent to the edge device.
[0235] Corresponding to the above method embodiments, this specification also provides a text processing model training device, applied to cloud-side devices, including:
[0236] The first determining module is configured to determine a text sample and the word type information group label corresponding to the text sample;
[0237] The second determining module is configured to determine the predicted relation labels of text words in the text sample based on the text order of the text sample, wherein the predicted relation labels include the predicted text relation labels of the text words and the predicted word relation labels of the text words and other text words;
[0238] The construction module is configured to construct a predicted directed acyclic graph corresponding to the text sample based on the text words and the predicted relation labels;
[0239] The third determining module is configured to determine the predicted word type information group corresponding to the text sample based on the predicted directed acyclic graph.
[0240] The training module is configured to train a text processing model based on the predicted word type information group and the word type information group label, and send the text processing model to the edge device.
[0241] The above is an illustrative scheme of a text processing model training device according to this embodiment. It should be noted that the technical solution of the text processing model training device and the technical solution of the text processing model training method described above belong to the same concept. For details not described in detail in the technical solution of the text processing model training device, please refer to the description of the technical solution of the text processing model training method described above.
[0242] Figure 11 A structural block diagram of a computing device 1100 according to one embodiment of this specification is shown. The components of the computing device 1100 include, but are not limited to, a memory 1110 and a processor 1120. The processor 1120 is connected to the memory 1110 via a bus 1130, and a database 1150 is used to store data.
[0243] The computing device 1100 also includes an access device 1140, which enables the computing device 1100 to communicate via one or more networks 1160. Examples of these networks include Public Switched Telephone Network (PSTN), Local Area Network (LAN), Wide Area Network (WAN), Personal Area Network (PAN), or combinations of communication networks such as the Internet. The access device 1140 may include one or more of any type of wired or wireless network interface (e.g., a network interface card (NIC)), such as an IEEE 802.11 Wireless Local Area Network (WLAN) wireless interface, a Wi-MAX (Worldwide Interoperability for Microwave Access) interface, an Ethernet interface, a Universal Serial Bus (USB) interface, a cellular network interface, a Bluetooth interface, a Near Field Communication (NFC) interface, and so on.
[0244] In one embodiment of this specification, the aforementioned components of the computing device 1100 and Figure 11 Other components, not shown, can also be connected to each other, for example, via a bus. It should be understood that... Figure 11The block diagram of the computing device shown is for illustrative purposes only and is not intended to limit the scope of this specification. Those skilled in the art can add or replace other components as needed.
[0245] The computing device 1100 can be any type of stationary or mobile computing device, including mobile computers or mobile computing devices (e.g., tablet computers, personal digital assistants, laptop computers, notebook computers, netbooks, etc.), mobile phones (e.g., smartphones), wearable computing devices (e.g., smartwatches, smart glasses, etc.) or other types of mobile devices, or stationary computing devices such as desktop computers or personal computers (PCs). The computing device 1100 can also be a mobile or stationary server.
[0246] The processor 1120 is configured to execute the following computer-executable instructions, which, when executed by the processor, implement the steps of the above-described text processing method or answer determination method.
[0247] The above is an illustrative scheme of a computing device according to this embodiment. It should be noted that the technical solution of this computing device belongs to the same concept as the technical solution of the above-described text processing method or answer determination method. For details not described in detail in the technical solution of the computing device, please refer to the description of the technical solution of the above-described text processing method or answer determination method.
[0248] An embodiment of this specification also provides a computer-readable storage medium storing computer-executable instructions that, when executed by a processor, implement the steps of the above-described text processing method or answer determination method.
[0249] The above is an illustrative scheme of a computer-readable storage medium according to this embodiment. It should be noted that the technical solution of this storage medium belongs to the same concept as the technical solution of the above-described text processing method or answer determination method. For details not described in detail in the technical solution of the storage medium, please refer to the description of the technical solution of the above-described text processing method or answer determination method.
[0250] An embodiment of this specification also provides a computer program, wherein when the computer program is executed in a computer, it causes the computer to perform the steps of the above-described text processing method or answer determination method.
[0251] The above is an illustrative example of a computer program according to this embodiment. It should be noted that the technical solution of this computer program belongs to the same concept as the technical solutions of the aforementioned text processing method or answer determination method. Details not described in detail in the technical solution of the computer program can be found in the descriptions of the technical solutions of the aforementioned text processing method or answer determination method.
[0252] The foregoing has described specific embodiments of this specification. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps recited in the claims may be performed in a different order than that shown in the embodiments and may still achieve the desired result. Furthermore, the processes depicted in the drawings do not necessarily require the specific or sequential order shown to achieve the desired result. In some embodiments, multitasking and parallel processing are possible or may be advantageous.
[0253] The computer instructions include computer program code, which may be in the form of source code, object code, executable file, or some intermediate form. The computer-readable medium may include: any entity or device capable of carrying the computer program code, recording media, USB flash drive, portable hard drive, magnetic disk, optical disk, computer memory, read-only memory (ROM), random access memory (RAM), electrical carrier signals, telecommunication signals, and software distribution media, etc. It should be noted that the content included in the computer-readable medium may be appropriately added to or subtracted according to the requirements of legislation and patent practice in the jurisdiction. For example, in some jurisdictions, according to legislation and patent practice, computer-readable media may not include electrical carrier signals and telecommunication signals.
[0254] It should be noted that, for the sake of simplicity, the foregoing method embodiments are all described as a series of actions. However, those skilled in the art should understand that the embodiments in this specification are not limited to the described order of actions, because according to the embodiments in this specification, some steps can be performed in other orders or simultaneously. Furthermore, those skilled in the art should also understand that the embodiments described in this specification are all preferred embodiments, and the actions and modules involved are not necessarily essential to the embodiments in this specification.
[0255] In the above embodiments, the descriptions of each embodiment have different focuses. For parts not described in detail in a certain embodiment, please refer to the relevant descriptions of other embodiments.
[0256] The preferred embodiments disclosed above are merely illustrative of this specification. The optional embodiments do not exhaustively describe all details, nor do they limit the invention to the specific implementations described. Clearly, many modifications and variations can be made based on the embodiments described herein. These embodiments are selected and specifically described in this specification to better explain the principles and practical applications of the embodiments, thereby enabling those skilled in the art to better understand and utilize this specification. This specification is limited only by the claims and their full scope and equivalents.
Claims
1. A text processing method, comprising: Input the target text into the text processing model; In the text processing model, the relational tags of text words in the target text are determined according to the text order of the target text. The relational tags include the text relational tags of individual text words and the word relational tags of the text words and other text words. The step of determining the relational tags of text words in the target text according to the text order of the target text includes: generating a text matrix of a length corresponding to the text length of the target text according to the text order of the target text, wherein the text matrix contains matrix units corresponding to individual texts in the target text; and determining the relational tags of text words in the target text according to the text matrix. By using individual texts from the text words as nodes and the order of these individual texts in the target text as connecting edges, an initial directed acyclic graph (DAG) corresponding to the target text is constructed. The connecting edges are then labeled according to the relationship labels to obtain node relationship information associated with the connecting edges. Based on the initial DAG and the node relationship information, the DAG corresponding to the target text is obtained. Based on the directed acyclic graph, the word type information group corresponding to the target text is determined.
2. The method according to claim 1, wherein the training step of the text processing model includes: Identify the text sample and the corresponding word type information group label; Based on the text order of the text sample, the predicted relation labels of the text words in the text sample are determined, wherein the predicted relation labels include the predicted text relation labels of the text words and the predicted word relation labels of the text words and other text words; Based on the text words and the predicted relation labels, construct the predicted directed acyclic graph corresponding to the text sample; Based on the predicted directed acyclic graph, determine the predicted word type information group corresponding to the text sample; The text processing model is trained based on the predicted word type information group and the word type information group label.
3. The method according to claim 2, wherein training the text processing model based on the predicted word type information group and the word type information group label comprises: Calculate the model loss value based on the predicted word type information group and the word type information group label; The text processing model is trained using the model loss value until a text processing model that meets the training stopping condition is obtained.
4. The method according to claim 1, wherein determining the relational tags of text words in the target text based on the text matrix includes: Predict the text matrix unit corresponding to the single text to obtain the relation labels of text words in the target text.
5. The method according to claim 1, wherein the word type information group is a triplet corresponding to the word type; Accordingly, the word relationship tags between the text words and other text words include: The word relationship tags of the text word and other text words associated with the text word, and the word relationship tags of the first text word and the second text word contained in the triplet.
6. The method according to claim 1, wherein determining the word type information group corresponding to the target text based on the directed acyclic graph includes: Traverse the directed acyclic graph to determine at least one word type information group corresponding to the target text.
7. The method according to claim 1, further comprising, before inputting the target text into the text processing model: Receive target text input by the user through an interactive interface; wherein the target text is the target text edited by the user through the interactive interface; or The target text is the target text converted from the audio data input by the user through the interactive interface.
8. The method according to claim 7, further comprising, after determining the word type information group corresponding to the target text: Input the target text and the word type information group into the answer determination model to obtain the target answer corresponding to the target text, which is output by the answer determination model. The target answer is displayed to the user through the interactive interface.
9. A method for determining the answer, comprising: Receive question text input by the user through the interactive interface; Input the question text into the text processing model; In the text processing model, the relational tags of text words in the question text are determined according to the text order of the question text. The relational tags include text relational tags of the text words and word relational tags of the text words and other text words. The step of determining the relational tags of text words in the question text according to the text order of the question text includes: generating a text matrix of a length corresponding to the text length of the question text according to the text order of the question text, wherein the text matrix contains matrix units corresponding to individual texts in the question text; and determining the relational tags of text words in the question text according to the text matrix. Using individual texts from the text as nodes and the order of these individual texts within the question text as connecting edges, an initial directed acyclic graph (DAG) corresponding to the question text is constructed. The connecting edges are then labeled according to the relationship labels to obtain node relationship information associated with each connecting edge. Finally, based on the initial DAG and the node relationship information, the DAG corresponding to the question text is obtained. Based on the directed acyclic graph, determine the word type information group corresponding to the question text; Input the question text and the word type information group into the answer determination model to obtain the target answer corresponding to the question text, which is output by the answer determination model. The target answer is displayed to the user through the interactive interface.
10. A text processing model training method, applied to cloud-based devices, comprising: Identify the text sample and the corresponding word type information group label; Based on the text order of the text sample, the predicted relation labels of the text words in the text sample are determined, wherein the predicted relation labels include the predicted text relation labels of the text words and the predicted word relation labels of the text words and other text words; The step of determining the predicted relation labels of text words in the text sample based on the text order of the text sample includes: generating a text matrix of a length corresponding to the text length of the text sample according to the text order of the text sample, wherein the text matrix contains matrix units corresponding to individual texts in the text sample; and determining the predicted relation labels of text words in the text sample based on the text matrix. Using individual texts from the text words as nodes and the order of these individual texts in the text sample as connecting edges, an initial directed acyclic graph (DAG) corresponding to the text sample is constructed. Based on the predicted relation labels, the connecting edges are marked to obtain node relation information associated with the connecting edges. Based on the initial DAG and the node relation information, the DAG corresponding to the text sample is obtained. Based on the predicted directed acyclic graph, determine the predicted word type information group corresponding to the text sample; A text processing model is trained based on the predicted word type information group and the word type information group label, and the text processing model is sent to the edge device.
11. A computing device, comprising: Memory and processor; The memory is used to store computer-executable instructions, and the processor is used to execute the computer-executable instructions, which, when executed by the processor, implement the steps of the method according to any one of claims 1 to 8, 9, or 10.
12. A computer-readable storage medium storing computer-executable instructions that, when executed by a processor, implement the steps of the method according to any one of claims 1 to 8, 9, or 10.
13. A computer program product, characterized in that, Includes computer instructions that, when executed by a processor, implement the steps of the method according to any one of claims 1 to 8, 9, or 10.
Citation Information
Patent Citations
Intelligent service method of chat robot, server and storage medium
CN108829757A
Text processing method and device
CN111680508A
Entity relationship extraction method and device, electronic equipment and storage medium
CN112232074A
Establishment method of relationship extraction model and relationship extraction method
CN112364166A