A multi-task extraction method and device based on an extraction model
By employing a multi-task extraction method based on an extraction model, and utilizing the shared parameter expression layer of multiple sub-task models, the problem of inaccurate word extraction in text is solved, achieving high-accuracy feature word extraction.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-06-16
- Publication Date
- 2026-03-31
AI Technical Summary
Existing technologies have low accuracy when extracting phrases from text, and are prone to problems such as inaccurate word extraction or inaccurate classification.
A multi-task extraction method based on an extraction model is adopted. By sharing the expression layer with parameters among multiple sub-task models, task feature words, including attribute words and opinion words, are extracted from the text step by step. Pointer networks and fully connected multi-classification output layers are used for feature identification and classification.
It improved the accuracy of word extraction, achieving better word extraction results and efficient feature information output.
Smart Images

Figure CN115481617B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of text recognition technology, and in particular to a multi-task extraction method and a multi-task extraction device based on an extraction model. Background Technology
[0002] Current text extraction techniques typically require multiple different models to process the text, roughly classify the entities within it, and extract the words to generate phrases. However, existing text extraction methods often suffer from low accuracy, leading to inaccurate word extraction or classification. Summary of the Invention
[0003] In view of the above problems, embodiments of this application are proposed to provide a multi-task extraction method and a multi-task extraction apparatus based on an extraction model to overcome or at least partially solve the above problems.
[0004] To address the aforementioned problems, this application discloses a multi-task extraction method based on an extraction model. The extraction model includes multiple sub-task models, and the expression layer of each sub-task model shares parameters. The method includes:
[0005] Obtain the text of the sample to be processed, and extract the first task feature words from the text;
[0006] The first task feature word is concatenated with the text and then input into the first sub-task model of the extraction model to obtain the second task feature word corresponding to the first task feature word;
[0007] The first and second task feature words are concatenated with the text and then input into the second sub-task model of the extraction model to obtain the third and fourth task feature words.
[0008] Optionally, the first task feature word is an attribute word, and the extraction of the first task feature word from the text includes:
[0009] The text is input into the third sub-task model of the extraction model to obtain the attribute word first character identifier and attribute word last character identifier for the text tag in the third sub-task model.
[0010] Attribute words are extracted from the text based on the first character of the attribute word and the last character of the attribute word.
[0011] Optionally, the second task feature word is the opinion word corresponding to the attribute word; the step of concatenating the first task feature word with the text and inputting it into the first sub-task model of the extraction model to obtain the second task feature word corresponding to the first task feature word includes:
[0012] The first task feature word is concatenated with the text and then input into the first sub-task model of the extraction model to obtain the first character identifier of the opinion word and the last character identifier of the opinion word for the text marked by the first task model.
[0013] Based on the first character identifier and the last character identifier of the opinion term, the opinion term corresponding to the attribute term is extracted from the text.
[0014] Optionally, the step of concatenating the first and second task feature words with the text and inputting the concatenation into the second sub-task model of the extraction model to obtain the third and fourth task feature words includes:
[0015] The attribute words and their corresponding opinion words are combined into a binary tuple and concatenated with the text. This tuple is then input into the second subtask model of the extraction model. By selecting the category with the highest confidence, the attribute category and opinion polarity are obtained as the third and fourth task feature words.
[0016] Optionally, the relationship between the attribute words and their corresponding viewpoint words, attribute categories, and viewpoint polarities is represented using an adjacency list.
[0017] Optionally, the output layer of the first subtask model is a pointer network output layer, and the output layer of the second subtask model is a fully connected multi-classification output layer.
[0018] Optionally, the method further includes:
[0019] Obtain the user's custom attribute categories and / or custom opinion polarities for the attribute words and their corresponding opinion word tags;
[0020] The extraction model is updated using the custom attribute category and / or custom viewpoint polarity.
[0021] Optionally, the extraction model is trained in the following manner:
[0022] Input the preset training samples into at least one of the sub-task models of the extraction model, and obtain the output information of the sub-task model;
[0023] Based on the output information of the sub-task model, the parameters of the output layer and the expression layer of the sub-task model are adjusted, and the parameters of the expression layer of the sub-task model are shared to the expression layers of all sub-task models of the extraction model until the extraction model is trained.
[0024] This application also discloses a multi-task extraction device based on an extraction model, wherein the extraction model includes multiple sub-task models, and the expression layer of each sub-task model shares parameters; the device includes:
[0025] The first extraction module is used to obtain the text of the sample to be processed and extract the first task feature words from the text;
[0026] The second extraction module is used to concatenate the first task feature word with the text and input it into the first sub-task model of the extraction model to obtain the second task feature word corresponding to the first task feature word.
[0027] The third extraction module is used to concatenate the first task feature words and the second task feature words with the text and input them into the second sub-task model of the extraction model to obtain the third task feature words and the fourth task feature words.
[0028] Optionally, the first task feature word is an attribute word, and the first extraction module includes:
[0029] The first tagging submodule is used to input the text into the third subtask model of the extraction model to obtain the attribute word beginning character identifier and attribute word ending character identifier of the third subtask model for the text tag.
[0030] The first extraction submodule is used to extract attribute words from the text based on the first character identifier and the last character identifier of the attribute words.
[0031] Optionally, the second extraction module includes:
[0032] The second tagging submodule is used to concatenate the first task feature words with the text and input them into the first subtask model of the extraction model to obtain the first character identifier of the opinion word and the last character identifier of the opinion word for the text tagging by the first task model.
[0033] The second extraction submodule is used to extract the opinion words corresponding to the attribute words from the text based on the first character identifier and the last character identifier of the opinion words.
[0034] Optionally, the third extraction module includes:
[0035] The third extraction submodule is used to combine attribute words and corresponding opinion words into binary pairs and concatenate them with the text, then input them into the second subtask model of the extraction model. By selecting the category with the highest confidence, the attribute category and opinion polarity are obtained as the third task feature words and the fourth task feature words.
[0036] Optionally, the relationship between the attribute words and their corresponding viewpoint words, attribute categories, and viewpoint polarities is represented using an adjacency list.
[0037] Optionally, the output layer of the first subtask model is a pointer network output layer, and the output layer of the second subtask model is a fully connected multi-classification output layer.
[0038] Optionally, the device further includes:
[0039] A custom module is used to obtain the user's custom attribute categories and / or custom opinion polarities for the attribute words and their corresponding opinion word tags;
[0040] An update module is used to update the extraction model using the custom attribute category and / or custom viewpoint polarity.
[0041] Optionally, the extraction model is trained in the following manner:
[0042] The output acquisition module is used to input preset training samples into at least one of the sub-task models of the extraction model and acquire the output information of the sub-task model.
[0043] The training module is used to adjust the parameters of the output layer and expression layer of the sub-task model according to the output information of the sub-task model, and share the parameters of the expression layer of the sub-task model to the expression layers of all sub-task models of the extraction model until the extraction model is trained.
[0044] This application also discloses an electronic device, including:
[0045] One or more processors; and
[0046] One or more machine-readable media having instructions stored thereon, which, when executed by the one or more processors, cause the electronic device to perform one or more methods as described in the embodiments of this application.
[0047] This application also discloses one or more machine-readable media storing instructions that, when executed by one or more processors, cause the processors to perform one or more methods as described in this application.
[0048] The embodiments of this application have the following advantages:
[0049] The multi-task extraction method based on an extraction model, as described in this application embodiment, includes an extraction model comprising multiple sub-task models, each with a shared expression layer parameter. The method comprises: obtaining text of a sample to be processed and extracting a first task feature word from the text; concatenating the first task feature word with the text and inputting the result into the first sub-task model of the extraction model to obtain a second task feature word corresponding to the first task feature word; and concatenating the first and second task feature words with the text and inputting the result into the second sub-task model of the extraction model to obtain a third and fourth task feature word. Therefore, during the extraction of task feature words, the shared parameter expression layer outputs feature information, achieving better word extraction results and higher accuracy. Attached Figure Description
[0050] Figure 1 This is a flowchart illustrating the steps of a multi-task extraction method based on an extraction model according to an embodiment of this application.
[0051] Figure 2 This is a flowchart illustrating the steps of another multi-task extraction method based on an extraction model according to an embodiment of this application.
[0052] Figure 3 This is a schematic diagram of an extraction model according to an embodiment of this application;
[0053] Figure 4 This is a flowchart illustrating the steps of a training method based on an extraction model according to an embodiment of this application.
[0054] Figure 5 This is a structural block diagram of a multi-task extraction device based on an extraction model according to an embodiment of this application. Detailed Implementation
[0055] To make the above-mentioned objectives, features and advantages of this application more apparent and understandable, the application will be further described in detail below with reference to the accompanying drawings and specific embodiments.
[0056] Reference Figure 1 The diagram illustrates a step flowchart of an embodiment of a multi-task extraction method based on an extraction model according to this application. The extraction model includes multiple sub-task models, and the expression layer of each sub-task model shares parameters.
[0057] In this embodiment, the extraction model can be used to extract words from text. The extraction model may include at least one sub-task model, thereby dividing the word extraction task into multiple different sub-tasks. Thus, each sub-task model can correspond to one sub-task to extract a task feature word. The task feature word may include words with specific meaning in the text, such as entity words, attribute words, opinion words, etc. The task feature word may also include classification information of words with specific meaning obtained from further analysis of meaningful words, such as attribute category, opinion polarity, entity classification, etc.
[0058] Specifically, the subtasks can be tasks with different functions or tasks with the same function. The subtask models can be models of the same type or models of different types. For example, the subtask models can be used to extract attribute words, extract opinion words, classify attribute words, and classify opinion words, respectively. The subtask models can also have two models simultaneously used for extracting attribute words, but the structures of the two models are different. The subtask models can also have two models with similar structures, but one is used for classifying attribute words and the other for classifying opinion words, etc.
[0059] In this embodiment, the expression layer of each sub-task model can share parameters. Specifically, the sub-task models in the extraction model can share an expression layer, and the sub-task models can jointly use the expression layer and share the model parameters of the expression layer. Thus, each sub-task model can output feature information based on the expression layer, and then use different output layers to output different results. During training, the sub-task models can jointly optimize the expression layer to improve the overall performance of the model. Therefore, in application, the sub-task models can also achieve better task feature word extraction results based on the shared expression layer.
[0060] The method includes:
[0061] Step 101: Obtain the text of the sample to be processed, and extract the first task feature words from the text;
[0062] In this embodiment, the sample to be processed can be a sample from which task feature words need to be extracted. The sample to be processed can be text, image, audio, video, etc. The sample to be processed can contain text information in different ways. For example, if the sample to be processed is text, the text can be obtained directly. If the sample to be processed is an image, the text can be obtained through text recognition. If the sample to be processed is audio, the text can be obtained through speech recognition. If the sample to be processed is video, the video can be separated into audio and several frames of images. The text of the sample to be processed can be obtained from the images through text recognition, and simultaneously from the audio through speech recognition.
[0063] In order to extract the task feature words required by the user from the sample to be processed, a first task feature word can be extracted from the text of the sample to be processed first, so that other feature words existing in the text of the sample to be processed can be further extracted based on the first task feature word.
[0064] In specific implementations, methods such as model extraction and manual extraction can be used to extract the first task feature words from the text; this application does not impose any restrictions on this.
[0065] Step 102: Concatenate the first task feature word with the text and input it into the first sub-task model of the extraction model to obtain the second task feature word corresponding to the first task feature word;
[0066] In this embodiment of the application, the extraction model may include a first sub-task model, which may extract a second task feature word that is associated with the first task feature word in the text based on the first task feature word.
[0067] Therefore, the first task feature word can be concatenated with the text and then input into the first sub-task model of the extraction model, so as to obtain the second task feature word corresponding to the first task feature word through the first sub-task model.
[0068] In a specific implementation, the first task feature word can be concatenated at the beginning of the text or model, and the beginning and end of the two can be distinguished by identifiers. For example, if the first task feature word is "steak" and the text of the sample to be processed is "steak is delicious", the first task feature word can be concatenated at the beginning of the text to be processed to obtain the input "[cls]steak[sep]steak is delicious[sep]", which is then input into the first subtask model to obtain the second task feature word "delicious" corresponding to the first task feature word.
[0069] Step 103: Concatenate the first task feature word and the second task feature word with the text and input them into the second sub-task model of the extraction model to obtain the third task feature word and the fourth task feature word.
[0070] In this embodiment of the application, the extraction model may include a second sub-task model, which can be used to further extract a third task feature word and a fourth task feature word that are related to the first task feature word and the second task feature word based on the first task feature word and the second task feature word.
[0071] Therefore, the first and second task feature words can be concatenated with the text and then input into the second sub-task model of the extraction model to obtain the third and fourth task feature words.
[0072] In a specific implementation, the first task feature word and the second task feature word can be concatenated at the beginning of the text or model, and the beginning and end of the two can be distinguished by identifiers. For example, if the first task feature word is "steak" and the second task feature word is "delicious", and the text is "steak is delicious", then the first task feature word and the second task feature word can be concatenated at the beginning of the text to obtain the input "[cls]steak[sep]delicious[sep]steak is delicious[sep]", and then input into the second sub-task model to obtain the third task feature word "taste" and the fourth task feature word "positive".
[0073] Therefore, this application can use an extraction model to extract task feature words from text. Furthermore, during the extraction of task feature words, the expression layers among the sub-task models can share parameters to achieve expression layer sharing. The expression layer is jointly optimized by multiple sub-task models during training, and the sub-task models extract task feature words based on this expression layer, resulting in better word extraction performance.
[0074] The multi-task extraction method based on an extraction model, as described in this application embodiment, includes multiple sub-task models. Each sub-task model shares parameters in its expression layer. The method comprises: obtaining the text of a sample to be processed and extracting a first task feature word from the text; concatenating the first task feature word with the text and inputting the result into the first sub-task model of the extraction model to obtain a second task feature word corresponding to the first task feature word; and concatenating the first and second task feature words with the text and inputting the result into the second sub-task model of the extraction model to obtain a third and a fourth task feature word. Therefore, during the extraction of task feature words, the expression layer with shared parameters can output feature information, achieving better word extraction results and higher accuracy.
[0075] Reference Figure 2 The diagram illustrates a flowchart of another embodiment of the multi-task extraction method based on an extraction model, wherein the extraction model includes multiple sub-task models, and the expression layer of each sub-task model shares parameters.
[0076] In this embodiment, the extraction model can be used to extract words from text. The extraction model may include at least one sub-task model, thereby dividing the word extraction task into multiple different sub-tasks. Thus, each sub-task model can correspond to one sub-task to extract a task feature word. The task feature word may include words with specific meaning in the text, and may also include classification information of words with specific meaning obtained from further analysis of the meaningful words.
[0077] In this embodiment, the expression layer of each sub-task model can share parameters. Specifically, the sub-task models in the extraction model can share an expression layer, and the sub-task models can jointly use the expression layer and share the model parameters of the expression layer. Thus, each sub-task model can output feature information based on the expression layer, and then use different output layers to output different results. During training, the sub-task models can jointly optimize the expression layer to improve the overall performance of the model. Therefore, in application, the sub-task models can also achieve better task feature word extraction results based on the shared expression layer.
[0078] The method includes:
[0079] Step 201: Obtain the text of the sample to be processed, and input the text into the third sub-task model of the extraction model to obtain the attribute word first character identifier and attribute word last character identifier of the third sub-task model for the text tag.
[0080] Specifically, the sample to be processed can be a sample from which task feature words need to be extracted. The sample to be processed can be text, image, audio, video, etc. The sample to be processed may contain text information in different ways.
[0081] The first task feature words can be aspect terms. These aspect terms can be the evaluation objects in the text, typically referring to specific things. Examples include sleeves, waist circumference, steak, price, and weather.
[0082] In this embodiment of the application, in order to extract the task feature words required by the user from the sample to be processed, at least one of the attribute words can be extracted from the text first, so that other task feature words that are related to the attribute words can be extracted based on the attribute words.
[0083] The extraction model may further include a third task sub-task model, which can be used to extract attribute words from the text. Thus, the text is input into the third task sub-task model to obtain the attribute words output by the third task sub-task model.
[0084] Specifically, the third task sub-task model may include an expression layer and an output layer connected to the expression layer. In the third task sub-task model, the expression layer, based on shared parameters, can output feature information based on the text. Subsequently, the output layer can mark the first and last characters of attribute words in the text according to the feature information, thereby obtaining attribute word first and attribute word last character identifiers for the marked text.
[0085] In one embodiment of this application, the output layer of the third task subtask model can be a pointer network output layer. The pointer network output layer can use 1 to mark the first and last characters of the attribute words in the text, and mark other positions as 0. Thus, the first character identifier and the last character identifier of the attribute words marked by the third task subtask model for the text can be obtained.
[0086] Step 202: Extract attribute words from the text based on the first character identifier and the last character identifier of the attribute words.
[0087] In this embodiment of the application, knowing the first character identifier and the last character identifier of the attribute word, the characters between the first character identifier and the last character identifier of the attribute word can be extracted from the text, thereby obtaining the attribute word.
[0088] For example, if the text is "steak is delicious", the first character of the attribute word points to "cow" and the last character of the attribute word points to "steak", then the attribute word "steak" can be obtained by extracting the characters between the first character of the attribute word and the last character of the attribute word in the text.
[0089] For example, if the text is "The notebook looks good", and the first character of the attribute word points to "pen" and the last character of the attribute word points to "notebook", then the attribute word "notebook" can be obtained by taking the characters between the first character of the attribute word and the last character of the attribute word in the text.
[0090] As an example of this application, Figure 3 This is a schematic diagram of one extraction model of this application. During the training process, the text can first be input as follows: Figure 3In the third subtask model shown in (a), after the text is processed by the expression layer with shared parameters, it is input to the output layer. The attribute word output layer uses a pointer network to mark the first and last characters of the attribute words, so that the third subtask model can output the attribute words "taste" and "express delivery".
[0091] Step 203: Concatenate the first task feature word with the text and input it into the first sub-task model of the extraction model to obtain the second task feature word corresponding to the first task feature word;
[0092] In this embodiment, based on the first task feature word, further task feature words that are associated with the first task feature word can be extracted from the text. Therefore, the first task feature word can be concatenated with the text and input into the first sub-task model of the extraction model to obtain the second task feature word corresponding to the first task feature word through the first sub-task model.
[0093] Therefore, the first task feature word can be concatenated with the text and then input into the first sub-task model of the extraction model, so as to obtain at least one second task feature word corresponding to the first task feature word through the first sub-task model.
[0094] Specifically, if the text in the sample to be processed has at least two first task feature words, then the first task feature words can be processed respectively to obtain at least one second task feature word corresponding to each first task feature word.
[0095] In one embodiment of this application, the second task feature word is the viewpoint word corresponding to the attribute word.
[0096] In this embodiment of the application, the second task feature word can be an opinion term. The opinion term can be a word that describes an opinion on the attribute word, carrying emotional or evaluative meaning, and can be correlated with the attribute word. For example, in the text "The steak is delicious," "steak" is the attribute word, and the corresponding opinion term is "delicious." As another example, in the text "The sleeves are short and tight," the attribute word is "sleeves," and the corresponding opinion terms are "short" and "tight."
[0097] The step of concatenating the first task feature word with the text and inputting it into the first sub-task model of the extraction model to obtain the second task feature word corresponding to the first task feature word includes:
[0098] S11, after concatenating the first task feature word with the text, input it into the first sub-task model of the extraction model to obtain the first character identifier of the opinion word and the last character identifier of the opinion word for the text marked by the first task model.
[0099] In this embodiment, the first task sub-task model may include an expression layer and an output layer connected to the expression layer. The expression layer in the first task sub-task model, based on shared parameters, can output text feature information obtained by concatenating the first task feature words and the text of the sample to be processed. Subsequently, the output layer can mark the first and last characters of opinion words in the text based on the feature information, thereby obtaining the first and last character identifiers of the opinion words for the marked text.
[0100] In one embodiment of this application, the output layer of the first task subtask model can be a pointer network output layer. The pointer network output layer can use 1 to mark the first and last characters of the opinion words in the text, and mark other positions as 0. Thus, the first character identifier and the last character identifier of the opinion words marked by the first task subtask model for the text can be obtained.
[0101] S12, based on the first character identifier and the last character identifier of the opinion word, extract the opinion word corresponding to the attribute word from the text.
[0102] In this embodiment of the application, knowing the first character identifier and the last character identifier of the opinion word, the characters between the first character identifier and the last character identifier of the opinion word can be extracted from the text, thereby obtaining the opinion word.
[0103] For example, if the text is "steak is delicious", the opinion word is "steak", the first character of the opinion word points to "true", and the last character of the attribute word points to "eat", then extracting the characters between the first character of the opinion word and the last character of the opinion word in the text can yield the opinion word "delicious".
[0104] As an example of this application, the third subtask model can output the attribute words "taste" and "delivery," and then concatenate the attribute word "taste" with the text, inputting the concatenated text as follows: Figure 3 In the first subtask model shown in (b), after the text is processed by the expression layer with shared parameters, it is input to the output layer. The opinion word output layer uses a pointer network to mark the first and last characters of the opinion words, so that the first subtask model can output the opinion words "very authentic" and "spicy enough".
[0105] Step 204: Concatenate the first task feature words and the second task feature words with the text and input them into the second sub-task model of the extraction model to obtain the third task feature words and the fourth task feature words.
[0106] In this embodiment, based on the first and second task feature words, further task feature words that are associated with the first and second task feature words can be extracted. Therefore, the first and second task feature words can be concatenated with the text and input into the second sub-task model of the extraction model to obtain the third and fourth task feature words.
[0107] Therefore, the first and second task feature words can be concatenated with the text and then input into the second sub-task model of the extraction model to obtain the third and fourth task feature words.
[0108] Specifically, if a first task feature word has at least two second task feature words, the combination of the first task feature word and any second task feature word can be processed to obtain the third task feature word and the fourth task feature word.
[0109] In one embodiment of this application, the step of concatenating the first task feature word and the second task feature word with the text and then inputting the concatenation into the second sub-task model of the extraction model to obtain the third task feature word and the fourth task feature word includes:
[0110] S21, the attribute words and corresponding opinion words are combined into a binary tuple and concatenated with the text and input into the second sub-task model of the extraction model. By selecting the category with the highest confidence, the attribute category and opinion polarity are obtained as the third task feature words and the fourth task feature words.
[0111] In this embodiment of the application, the third task feature word can be an attribute category. The fourth task feature word can be an opinion polarity.
[0112] Specifically, the attribute category can be the type corresponding to the attribute word. The attribute category can be related to the opinion word. For example, in the text "The steak is delicious," the opinion word corresponding to the attribute word "steak" is "delicious," so the attribute category for "steak" can be the "taste" category. In the text "The sleeves are short and tight," the opinion words corresponding to the attribute word "sleeves" are "short" and "tight," so the attribute category for the attribute word "sleeves" can be "size."
[0113] Opinion polarity can be used to distinguish whether the emotion expressed by an opinion word is positive or negative. For example, in the text "The steak is delicious," the opinion polarity of the opinion word "delicious" can be positive. In the text "The sleeves are short and tight," the opinion polarities of the opinion words "short" and "tight" can be negative.
[0114] In this embodiment, the second task sub-task model may include an expression layer, an attribute category output layer, and an opinion polarity output layer. The first task feature words and the second task feature words (i.e., attribute words and opinion words) can be combined into binary pairs. Then, the expression layer in the first task sub-task model, based on shared parameters, can output text feature information based on the binary pairs and the text concatenation of the sample to be processed. Subsequently, the feature information can be input into the attribute category output layer and the opinion polarity output layer, respectively, to obtain the attribute category output by the attribute category output layer and the opinion polarity output by the opinion polarity output layer.
[0115] Specifically, at least one attribute category and opinion polarity can be preset. The attribute category output layer of the second task sub-task model can output the confidence level of the attribute word belonging to each preset attribute category. Then, the attribute category with the highest confidence level can be selected as the third task feature word, i.e., the attribute category corresponding to the attribute word. The opinion polarity output layer of the second task sub-task model can output the confidence level of the second task feature word belonging to each preset opinion polarity. Then, the attribute category with the highest confidence level can be selected as the fourth task feature word, i.e., the opinion polarity corresponding to the opinion word.
[0116] As an example of this application, after the third subtask model outputs the attribute word "taste" and the first subtask model outputs the opinion words "authentic" and "spicy enough", for the opinion word "authentic", the attribute word "taste" and the opinion word "authentic" can be concatenated with the text, and the concatenated text is input as follows: Figure 3 In the second subtask model shown in (c), the text, after being processed by the shared parameter expression layer, is input to the attribute category output layer. The attribute category output layer outputs the attribute category "taste". Simultaneously, the concatenated text can also be input as... Figure 3 In the second subtask model shown in (d), the text is processed by the expression layer with shared parameters and then input into the opinion polarity output layer. The opinion polarity output layer outputs the opinion polarity "positive", which ultimately yields the four-gram phrase (taste, very authentic, taste, positive).
[0117] In one embodiment of this application, the relationship between the attribute words and their corresponding viewpoint words, attribute categories, and viewpoint polarities is represented by an adjacency list.
[0118] In this embodiment, since the same attribute word can correspond to multiple opinion words, the same attribute word can correspond to multiple quadruple phrases composed of the attribute word, the corresponding opinion word, the attribute category, and the opinion polarity. For example, in the text "sleeves are short and tight," the word "sleeves" can be associated with the words "short" and "tight." Thus, two phrases can be generated: (sleeves, short, size, negative) and (sleeves, tight, size, negative).
[0119] Therefore, after extracting the attribute words and their corresponding viewpoint words, attribute categories, and viewpoint polarities, an adjacency list can be used to represent and store the relationships between them, thereby saving the space occupied by storing quadruple words.
[0120] Specifically, an adjacency list can be represented in the following form: attribute words: {opinion words: (attribute category, opinion polarity),...,}.
[0121] For example, the phrases (sleeve, short, size, negative) and (sleeve, tight, size, negative) can be represented as follows: sleeve: {short: (size, negative), tight: (size, negative),}.
[0122] In one embodiment of this application, the method further includes:
[0123] S31, Obtain the user's custom attribute category and / or custom opinion polarity for the attribute words and their corresponding opinion word tags;
[0124] In this embodiment, the preset attribute types and opinion polarities may not meet user needs. In such cases, users can determine their own custom attribute categories and / or custom opinion polarities for the attribute words and their corresponding opinion word tags to meet their data statistics and other needs. Thus, the user's custom attribute categories and / or custom opinion polarities for the attribute words and their corresponding opinion word tags can be obtained.
[0125] S32, update the extraction model using the custom attribute category and / or custom viewpoint polarity.
[0126] In this embodiment of the application, the extraction model can be updated based on the user-defined custom attribute categories and / or custom viewpoint polarities, thereby obtaining an extraction model that meets the user's own needs.
[0127] Specifically, the extraction model is divided into multiple sub-task models. The third sub-task model can be used to extract opinion terms, the first sub-task model can be used to extract opinion terms, and the second sub-task model can be used to extract attribute categories and opinion polarities. Therefore, when users have custom attribute categories and / or custom opinion polarities, it is not necessary to update the third sub-task model for extracting attribute terms and the second sub-task model for extracting opinion terms; only the second sub-task model for extracting attribute categories and opinion polarities needs to be updated. Thus, users do not need to extract attribute terms and opinion terms themselves. Instead, given the opinion terms and attribute terms already marked by the extraction model, users can manually mark the attribute terms and opinion terms with attribute categories and / or opinion polarities. Then, based on the user-marked custom attribute categories and / or custom opinion polarities, the second sub-task model is updated, completing the extraction model update. This makes it easier for users to perform custom data statistics and makes user operations more convenient.
[0128] The multi-task extraction method based on an extraction model, as described in this application embodiment, includes multiple sub-task models. Each sub-task model shares parameters in its expression layer. The method comprises: inputting the text into a third sub-task model of the extraction model to obtain the first and last character identifiers of attribute words for the text markers; extracting attribute words from the text based on the first and last character identifiers; concatenating the first task feature word with the text and inputting it into the first sub-task model of the extraction model to obtain a second task feature word corresponding to the first task feature word; and concatenating the first and second task feature words with the text and inputting them into the second sub-task model of the extraction model to obtain a third and fourth task feature word. Therefore, in the process of extracting task feature words, the expression layer with shared parameters can output feature information, achieving better word extraction results and higher accuracy.
[0129] Reference Figure 4 The diagram shows a flowchart of the steps in an embodiment of a training method for extracting a model according to this application.
[0130] In this embodiment, the extraction model can be used to extract words from text. The extraction model may include at least one sub-task model, thereby dividing the word extraction task into multiple different sub-tasks. Thus, each sub-task model can correspond to one sub-task to extract a task feature word. The task feature word may include words with specific meaning in the text, such as entity words, attribute words, opinion words, etc. The task feature word may also include classification information of words with specific meaning obtained from further analysis of meaningful words, such as attribute category, opinion polarity, entity classification, etc.
[0131] In this embodiment, the expression layer of each sub-task model can share parameters. Specifically, the sub-task models in the extraction model can share an expression layer, and the sub-task models can jointly use the expression layer and share the model parameters of the expression layer. Thus, each sub-task model can output feature information based on the expression layer, and then use different output layers to output different results. During training, the sub-task models can jointly optimize the expression layer to improve the overall performance of the model. Therefore, in application, the sub-task models can also achieve better task feature word extraction results based on the shared expression layer.
[0132] The method includes:
[0133] Step 401: Input the preset training samples into at least one of the sub-task models of the extraction model, and obtain the output information of the sub-task model;
[0134] In this embodiment of the application, preset training samples can be input into at least one of the sub-task models of the extraction model, and the output information of the sub-task model can be obtained, so as to train the sub-task model based on the output information of the sub-task model.
[0135] Specifically, the sub-task models can be trained sequentially, allowing one sub-task model to be selected as the current sub-task model, and preset training samples can be input into the current sub-task model. The current sub-task model can then output results based on the input preset training samples, thus obtaining the output information of the current sub-task model.
[0136] Step 402: Based on the output information of the sub-task model, adjust the parameters of the output layer and expression layer of the sub-task model, and share the parameters of the expression layer of the sub-task model with the expression layers of all sub-task models of the extraction model until the extraction model is trained.
[0137] In this embodiment, to improve the accuracy of the extraction model, a joint optimization approach can be used to train the sub-task models within the extraction model. Specifically, each sub-model can have a shared parameter expression layer. During training, each sub-model can update its expression layer, sharing the parameters of its expression layer with the expression layers of all sub-task models in the extraction model until the extraction model is fully trained. This allows for joint optimization of the expression layers, ultimately improving the overall accuracy of the extraction model.
[0138] Specifically, standard output information can be preset, which can be the correct output information corresponding to the training samples. The loss function of the current sub-task model can be calculated based on the output information of the current sub-task model and the preset standard output information. Subsequently, the expression layer can be adjusted based on the loss function of the current sub-task model, and the parameters of the expression layer of this sub-task model can be shared with the expression layers of all sub-task models of the extracted model.
[0139] When the sub-task models in the extraction model meet preset conditions, the extraction model can be considered to have completed training. The preset conditions may include: the loss function of the sub-task model reaching a relatively optimal level; the loss function of the sub-task model reaching a relatively optimal level after a preset number of iterations; the loss function of the sub-task model being less than a preset threshold; or the loss function of the sub-task model essentially no longer changing, etc. This application does not impose any restrictions on these conditions.
[0140] In a specific implementation, the sub-task models can be trained sequentially, allowing one sub-task model to be selected as the current sub-task model, and preset training samples can be input into the current sub-task model. The current sub-task model can then output results based on the input preset training samples, thus obtaining the output information of the current sub-task model.
[0141] Subsequently, the loss function is calculated based on the output information of the current subtask model and the preset standard output information. Since the shared representation layer of the current subtask model has already been updated to be identical to the pre-trained shared representation layer during training, the aforementioned loss function can be directly applied to optimize the shared representation layer of the current subtask model. This optimized shared representation layer is then shared with other subtask models.
[0142] Where the current subtask model is the first trained model in the extraction model, the shared representation layer of the current subtask model can be optimized using only the output information of the current subtask model and the loss function calculated using the preset standard output information. Where the current subtask model is not the first trained model in the extraction model, the shared representation layer of the current subtask model has already been optimized based on the results of prior training. In this case, optimizing the shared representation layer using the loss function calculated using the output information of the current subtask model and the preset standard output information is equivalent to adjusting the model parameters of the shared representation layer of the current subtask model based on the output information of the current subtask model, the preset standard output information, and the model parameters of the adjusted shared representation layer of the previously trained subtask model.
[0143] In its implementation, the third subtask model may include a shared BERT (Bidirectional Encoder Representations from Transformers) expression layer and an attribute word pointer network output layer. The attribute word pointer network output layer may use 1 to mark the first and last characters of attribute words in the text, and 0 to mark other positions. The third subtask model takes the training text as input and extracts attribute words from the text based on the attribute word pointer network output layer. During training, the third subtask model may use a binary cross-entropy loss function.
[0144] The first subtask model may include a shared BERT expression layer and an opinion word pointer network output layer. The opinion word pointer network output layer may use 1 to mark the first and last characters of opinion words in the text, and 0 to mark other positions. The first subtask model can use the text obtained by concatenating the attribute words and the training text as input, and extract opinion words from the text through the opinion word pointer network output layer. During training, the first subtask model may use a binary cross-entropy loss function.
[0145] The second sub-task model can be a multi-class classification model, including a shared BERT expression layer and a fully connected multi-class classification output layer for attribute categories. This model can take attribute words, opinion words, and the text obtained by concatenating the training text as input, and output the attribute category corresponding to each attribute word through the fully connected multi-class classification output layer. The second sub-task model can also include a fully connected multi-class classification output layer for opinion polarity. This layer can also output the opinion polarity corresponding to each opinion word. During training, the second sub-task model can use a cross-entropy loss function.
[0146] In practical implementation, during the joint optimization of the shared representation layer, other layers outside the shared representation layer may not be optimized to avoid affecting the optimization effect of the shared representation layer. Optimization of other layers such as the output layer can be performed by pre-training the sub-task models separately before jointly optimizing the shared representation layer to improve the output performance of the output layer and other layers, depending on actual needs; alternatively, other layers outside the shared representation layer can be trained after joint optimization. Alternatively, if other layers outside the shared representation layer already have good performance, then optimization of these other layers is unnecessary.
[0147] In one embodiment of this application, the sub-task models in the extraction model can be arranged in a preset order, so that the sub-task models can have a fixed execution order during the extraction of phrases, thereby extracting phrases in an approximate pipeline processing manner.
[0148] Specifically, since the sub-task models can have a fixed execution order, they can be trained sequentially during training according to a preset order within the extracted model. Therefore, during model training, after the current sub-task model is trained, the next model executed after it can be used as the current sub-task model, and the steps of inputting preset training samples into the current sub-task model, obtaining its output information, and adjusting its parameters based on the output information and preset standard output information can be repeated until the extracted model training is complete.
[0149] In a specific implementation, when the sub-task models are arranged in a preset order, the sub-task model can use the output of the previous sub-task model as input. Thus, during the training process, standard training text can be used to train subsequent sub-task models according to actual needs, or the output of the previous sub-task model can be used as the input of the current sub-task model.
[0150] In this embodiment, the subtask models can be arranged in the order of third subtask model, first subtask model, and second subtask model.
[0151] The third subtask model can take the training text as input and extract attribute words from the text based on the output layer of the attribute word pointer network. The first subtask model can take the text obtained by concatenating the attribute words and the training text as input and extract opinion words from the text based on the output layer of the opinion word pointer network. The second subtask model can take the text obtained by concatenating the attribute words, opinion words, and the training text as input, and output the attribute category corresponding to the attribute word and the opinion polarity corresponding to the opinion word.
[0152] Specifically, during training, for the first subtask model, it can, as needed, concatenate the attribute words output by the third subtask model with the training text as input, or concatenate the attribute words from the standard output information with the training text as input. For the second subtask model, it can, as needed, concatenate the attribute words output by the third subtask model, the opinion words output by the first subtask model, and the training text as input, or concatenate the attribute words and opinion words from the standard output information with the training text as input.
[0153] In the embodiments of this application, phrase extraction generally requires first classifying attribute categories and opinion polarity, and then selecting a corresponding type of word extraction model to extract words and generate phrases based on the classification results of attribute categories. In this case, it is easy for the word extraction boundaries to be unclear. For example, "very short" is extracted as "short". At the same time, when it is necessary to add new attribute categories, it is necessary to prepare phrases containing attribute words, opinion words, and attribute categories for retraining.
[0154] This application extracts phrases in the order of the third sub-task model, the first sub-task model, and the second sub-task model. This allows for the extraction of attribute words and opinion words first, followed by attribute category classification and opinion polarity classification. Through joint optimization, the accuracy of phrase extraction is effectively improved. Furthermore, when adding new attribute categories, the third and first sub-task models can extract attribute words and opinion words first, followed by manual annotation of the attribute categories and opinion polarities corresponding to these words. This allows for the training of the second sub-task model or the opinion polarity classification model to update the attribute categories and opinion polarities. This reduces the difficulty of updating attribute categories and meets the needs of enriching attribute categories or allowing individual users to customize attribute categories.
[0155] As an example of this application, during training, the training text can first be input into the third subtask model. After being processed by the shared representation layer, the training text is input into the attribute word output layer. The attribute word output layer uses a pointer network to mark the first and last characters of the attribute words, so that the third subtask model can output attribute words. Subsequently, based on the output information of the third subtask model and the preset standard output information, the binary cross-entropy loss function of the third subtask model can be calculated, and the model parameters of the shared representation layer can be adjusted according to the binary cross-entropy loss function. The adjusted model parameters of the shared representation layer are then shared with the first subtask model and the second subtask model.
[0156] Subsequently, the first subtask model, which follows the third subtask model, can be trained. Attribute words are concatenated with the training text, and the concatenated text is input into the first subtask model. After processing by the shared representation layer, the concatenated text is input into the opinion word output layer. The opinion word output layer uses a pointer network to mark the first and last characters of the opinion words, allowing the first subtask model to output opinion words. Then, based on the output information of the first subtask model and preset standard output information, the binary cross-entropy loss function of the first subtask model can be calculated. The model parameters of the shared representation layer are adjusted according to the binary cross-entropy loss function, and the adjusted model parameters of the shared representation layer are shared with the third subtask model, the second subtask model, and the opinion polarity classification model.
[0157] Subsequently, the second subtask model, which follows the third subtask model, can be trained. The model parameters of the shared representation layer can be adjusted based on the output of the second subtask model. This involves concatenating attribute words and opinion words with the training text and inputting the concatenated text into the second subtask model. After processing by the shared representation layer, the concatenated text is input into the attribute category output layer and the opinion polarity output layer. The attribute category output layer outputs the attribute category, and the opinion polarity output layer outputs the opinion polarity. Then, based on the output information of the second subtask model and preset standard output information, the cross-entropy loss function of the second subtask model can be calculated. The model parameters of the shared representation layer are then adjusted according to the cross-entropy loss function, and the adjusted model parameters of the shared representation layer are shared with the third subtask model and the first subtask model.
[0158] Subsequently, if the sub-task model fails to meet the preset conditions, the above steps can be repeated to iteratively train the extraction model until the sub-task model fails to meet the preset conditions and the extraction model training is completed.
[0159] The extraction model training method of this application embodiment can divide the extraction model into multiple sub-tasks, and optimize the model parameters of the current sub-task model based on the model parameter adjustment results of the previously trained sub-task models. This can achieve joint optimization between sub-task models, enable a certain degree of model parameter sharing between sub-task models, and improve the accuracy of the extraction model.
[0160] It should be noted that, for the sake of simplicity, the method embodiments are all described as a series of actions. However, those skilled in the art should understand that the embodiments of this application are not limited to the described order of actions, because according to the embodiments of this application, some steps can be performed in other orders or simultaneously. Secondly, those skilled in the art should also understand that the embodiments described in the specification are all preferred embodiments, and the actions involved are not necessarily required by the embodiments of this application.
[0161] Reference Figure 5 This diagram illustrates a structural block diagram of an embodiment of a multi-task extraction device based on an extraction model according to this application. The extraction model includes multiple sub-task models, and the expression layer of each sub-task model shares parameters. The device may specifically include the following modules:
[0162] The first extraction module 501 is used to obtain the text of the sample to be processed and extract the first task feature words from the text.
[0163] The second extraction module 502 is used to concatenate the first task feature word with the text and input it into the first sub-task model of the extraction model to obtain the second task feature word corresponding to the first task feature word.
[0164] The third extraction module 503 is used to concatenate the first task feature words and the second task feature words with the text and input them into the second sub-task model of the extraction model to obtain the third task feature words and the fourth task feature words.
[0165] In one embodiment of this application, the first task feature word is an attribute word, and the first extraction module includes:
[0166] The first tagging submodule is used to input the text into the third subtask model of the extraction model to obtain the attribute word beginning character identifier and attribute word ending character identifier of the third subtask model for the text tag.
[0167] The first extraction submodule is used to extract attribute words from the text based on the first character identifier and the last character identifier of the attribute words.
[0168] In one embodiment of this application, the second extraction module includes:
[0169] The second tagging submodule is used to concatenate the first task feature words with the text and input them into the first subtask model of the extraction model to obtain the first character identifier of the opinion word and the last character identifier of the opinion word for the text tagging by the first task model.
[0170] The second extraction submodule is used to extract the opinion words corresponding to the attribute words from the text based on the first character identifier and the last character identifier of the opinion words.
[0171] In one embodiment of this application, the third extraction module includes:
[0172] The third extraction submodule is used to combine attribute words and corresponding opinion words into binary pairs and concatenate them with the text, then input them into the second subtask model of the extraction model. By selecting the category with the highest confidence, the attribute category and opinion polarity are obtained as the third task feature words and the fourth task feature words.
[0173] In one embodiment of this application, the relationship between the attribute words and their corresponding viewpoint words, attribute categories, and viewpoint polarities is represented by an adjacency list.
[0174] In one embodiment of this application, the output layer of the first subtask model is a pointer network output layer, and the output layer of the second subtask model is a fully connected multi-classification output layer.
[0175] In one embodiment of this application, the apparatus further includes:
[0176] A custom module is used to obtain the user's custom attribute categories and / or custom opinion polarities for the attribute words and their corresponding opinion word tags;
[0177] An update module is used to update the extraction model using the custom attribute category and / or custom viewpoint polarity.
[0178] In one embodiment of this application, the extraction model is trained in the following manner:
[0179] The output acquisition module is used to input preset training samples into at least one of the sub-task models of the extraction model and acquire the output information of the sub-task model.
[0180] The training module is used to adjust the parameters of the output layer and expression layer of the sub-task model according to the output information of the sub-task model, and share the parameters of the expression layer of the sub-task model to the expression layers of all sub-task models of the extraction model until the extraction model is trained.
[0181] As the device embodiment is basically similar to the method embodiment, the description is relatively simple, and relevant parts can be found in the description of the method embodiment.
[0182] This application also provides an electronic device, including:
[0183] One or more processors; and
[0184] One or more machine-readable media having instructions stored thereon, which, when executed by the one or more processors, cause the electronic device to perform the methods described in the embodiments of this application.
[0185] This application also provides one or more machine-readable media storing instructions that, when executed by one or more processors, cause the processors to perform the methods described in this application.
[0186] The various embodiments in this specification are described in a progressive manner, with each embodiment focusing on the differences from other embodiments. The same or similar parts between the various embodiments can be referred to each other.
[0187] Those skilled in the art will understand that embodiments of this application can be provided as methods, apparatus, or computer program products. Therefore, embodiments of this application can take the form of entirely hardware embodiments, entirely software embodiments, or embodiments combining software and hardware aspects. Furthermore, embodiments of this application can take the form of computer program products implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0188] This application describes embodiments with reference to flowchart illustrations and / or block diagrams of methods, terminal devices (systems), and computer program products according to embodiments of this application. It should be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing terminal device to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing terminal device, generate instructions for implementing the flowchart illustrations. Figure 1 One or more processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.
[0189] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing terminal device to operate in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means, which are implemented in a process Figure 1 One or more processes and / or boxes Figure 1 The function specified in one or more boxes.
[0190] These computer program instructions can also be loaded onto a computer or other programmable data processing terminal equipment, causing a series of operational steps to be performed on the computer or other programmable terminal equipment to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable terminal equipment for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 The steps of the function specified in one or more boxes.
[0191] Although preferred embodiments of the present application have been described, those skilled in the art, upon learning the basic inventive concept, can make other changes and modifications to these embodiments. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments as well as all changes and modifications falling within the scope of the embodiments of the present application.
[0192] Finally, it should be noted that in this document, relational terms such as "first" and "second" are used only to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or terminal device that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or terminal device. Without further limitations, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or terminal device that includes said element.
[0193] The above provides a detailed description of a multi-task extraction method and a multi-task extraction device based on an extraction model provided in this application. Specific examples have been used to illustrate the principles and implementation methods of this application. The descriptions of the above embodiments are only for the purpose of helping to understand the method and its core ideas. At the same time, for those skilled in the art, there will be changes in the specific implementation methods and application scope based on the ideas of this application. Therefore, the content of this specification should not be construed as a limitation of this application.
Claims
1. A multi-task extraction method based on an extraction model, characterized in that, The extraction model comprises a plurality of sub-task models, expression layers of each of the sub-task models share parameters, optimization of the expression layers is achieved based on joint optimization of the plurality of sub-task models, the sub-task models output feature information based on the expression layers, the sub-task models output task feature words related to the feature information based on output layers connected to the expression layers, the plurality of sub-task models are executed and trained in a preset order, and input of the sub-task models is output of a previous sub-task model; and the method comprises: obtaining a text of a sample to be processed, and extracting a first task feature word from the text; concatenating the first task feature word and the text, and inputting the first task feature word and the text into a first sub-task model of the extraction model to obtain a second task feature word corresponding to the first task feature word; concatenating the first task feature word, the second task feature word and the text, and inputting the first task feature word, the second task feature word and the text into a second sub-task model of the extraction model to obtain third task feature words and fourth task feature words; wherein the extraction model is trained in the following manner: inputting preset training samples into at least one of the sub-task models of the extraction model, and obtaining output information of the sub-task model; adjusting parameters of the output layer and the expression layer of the sub-task model according to the output information of the sub-task model, and sharing the parameters of the expression layer of the sub-task model to the expression layers of all the sub-task models of the extraction model until the extraction model is trained.
2. The method of claim 1, wherein, The first task feature word is an attribute word, and the first task feature word is extracted from the text in the following manner: inputting the text into a third sub-task model of the extraction model to obtain attribute word initial character marks and attribute word final character marks marked by the third sub-task model for the text; extracting an attribute word from the text according to the attribute word initial character marks and the attribute word final character marks.
3. The method of claim 2, wherein, The second task feature word is a viewpoint word corresponding to the attribute word, and the first task feature word and the text are inputted into the first sub-task model of the extraction model to obtain the second task feature word corresponding to the first task feature word in the following manner: concatenating the first task feature word and the text, and inputting the first task feature word and the text into the first sub-task model of the extraction model to obtain viewpoint word initial character marks and viewpoint word final character marks marked by the first sub-task model for the text; extracting a viewpoint word corresponding to the attribute word from the text according to the viewpoint word initial character marks and the viewpoint word final character marks.
4. The method of claim 3, wherein, The first task feature word and the second task feature word and the text are inputted into the second sub-task model of the extraction model to obtain the third task feature words and the fourth task feature words in the following manner: concatenating a two-tuple composed of the attribute word and the corresponding viewpoint word and the text, and inputting the two-tuple and the text into the second sub-task model of the extraction model to obtain attribute categories and viewpoint polarities as the third task feature words and the fourth task feature words by selecting a class with the highest confidence.
5. The method of claim 4, wherein, The attribute word, the corresponding viewpoint word, the attribute category and the viewpoint polarity use an adjacency list to represent relationships between each other.
6. The method according to any one of claims 1-5, characterized in that, The output layer of the first sub-task model is a pointer network output layer, and the output layer of the second sub-task model is a fully connected multi-classification output layer.
7. The method of claim 3, wherein, The method further includes: obtaining a custom attribute category and / or a custom opinion polarity marked by a user for the attribute word and the corresponding opinion word; updating the extraction model by using the custom attribute category and / or the custom opinion polarity.
8. An extractive model-based multi-task extraction apparatus, characterized by comprising: The extraction model includes a plurality of sub-task models, the expression layer of each sub-task model shares parameters, the optimization of the expression layer is realized based on joint optimization of the plurality of sub-task models, the sub-task model outputs feature information based on the expression layer, the sub-task model outputs task-specific words related to the feature information based on an output layer connected to the expression layer, the plurality of sub-task models are executed and trained in a predetermined order, and the input of the sub-task model is the output of the previous sub-task model; and the device includes: a first extraction module configured to obtain a text of a sample to be processed and extract first task-specific words from the text; a second extraction module configured to input the first task-specific words and the text into a first sub-task model of the extraction model after splicing the first task-specific words and the text, to obtain second task-specific words corresponding to the first task-specific words; a third extraction module configured to input the first task-specific words, the second task-specific words, and the text into a second sub-task model of the extraction model after splicing the first task-specific words, the second task-specific words, and the text, to obtain third task-specific words and fourth task-specific words; The extraction model is trained in the following manner: an output acquisition module configured to input a preset training sample into at least one sub-task model of the extraction model, and acquire output information of the sub-task model; a training module configured to adjust parameters of an output layer and an expression layer of the sub-task model according to the output information of the sub-task model, and share the parameters of the expression layer of the sub-task model to the expression layers of all sub-task models of the extraction model, until the extraction model is trained.
9. An electronic device, comprising: comprise: one or more processors; and one or more machine-readable media having instructions stored thereon that, when executed by the one or more processors, cause the electronic device to perform the method of any one of claims 1-7.
10. One or more machine-readable media having instructions stored thereon that, when executed by one or more processors, cause the processors to perform the method of any one of claims 1-7.