Model training method, classification and element extraction method, device, equipment and medium
By using the branching structure of a large language model and a method for dynamically generating prompt words, the problem of low efficiency in event element extraction in existing technologies is solved, achieving more efficient and accurate event element extraction.
Patent Information
- Application Number
- CN202411318433.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-20
- Publication Date
- 2025-12-16
- Estimated Expiration
- 2044-09-20
AI Technical Summary
Existing methods for extracting event elements rely on manually defined rules, resulting in low processing efficiency.
The branching structure of the large language model is adopted, including the first branch for event type classification, the second branch for element prompt word acquisition, and the third branch for event element extraction. The model is trained by acquiring type prompt words and element prompt words, and prompt words are dynamically generated to improve efficiency.
By utilizing the branching structure of a large language model and a method for dynamically generating prompt words, the accuracy and efficiency of event element extraction are improved, while reducing the reliance on large amounts of labeled data.
Smart Images

Figure CN119358544B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] Embodiments of the present disclosure relate to the field of artificial intelligence technology, and in particular, to a model training method, a classification and element extraction method, an apparatus, a device and a medium. BACKGROUND
[0002] Event element extraction is of great significance in the field of natural language processing, aiming to automatically identify and extract key elements of events such as time, location, characters, and actions from unstructured text. This task has broad application prospects in information retrieval, event prediction, and automatic news summary. By accurately extracting and classifying these event elements, the efficiency and accuracy of the platform system in processing events can be improved.
[0003] In related technologies, existing event element extraction methods are mainly based on rule extraction, which requires reliance on manually defined rules and patterns for event element extraction during implementation. However, the existing approach is inefficient. SUMMARY
[0004] The embodiments described herein provide a model training method, a classification and element extraction method, an apparatus, a device and a medium, which overcome the above problems.
[0005] In a first aspect, according to the content of the present disclosure, an event classification and element extraction model training method is provided, applied to a large language model, the large language model comprising: a first branch, a second branch and a third branch, the first branch being used for event type division of Chinese events, the second branch being used for obtaining element prompt words of different Chinese event types, and the third branch being used for event element extraction of the Chinese events;
[0006] The method comprises:
[0007] obtaining text description information of sample Chinese events, the text description information of the sample Chinese events including a plurality of event texts to be classified;
[0008] determining type prompt words corresponding to the sample Chinese events based on the text description information of the sample Chinese events;
[0009] inputting the type prompt words into the first branch of the large language model to obtain type division results of the sample Chinese events, the type division results including a plurality of Chinese event types, and the confidence of each Chinese event type being greater than a preset threshold;
[0010] inputting a plurality of Chinese event types into the second branch of the large language model to obtain element prompt words corresponding to the sample Chinese events;
[0011] input the element prompt word into the third branch of the large language model to obtain an element extraction result of the sample Chinese event;
[0012] The first branch is trained based on the type division result of the sample Chinese event, and the third branch is trained based on the element extraction result of the sample Chinese event, to obtain the event classification and element extraction model.
[0013] In a second aspect, an event classification and element extraction method is provided according to the present disclosure, comprising:
[0014] obtaining text description information of a current Chinese event;
[0015] determining a type prompt word corresponding to the current Chinese event based on the text description information of the current Chinese event;
[0016] inputting the type prompt word corresponding to the current Chinese event into an event classification and element extraction model to obtain a type division result and an element extraction result of the current Chinese event;
[0017] The event classification and element extraction model is an event classification and element extraction model trained and generated by the method of the first aspect.
[0018] In a third aspect, an event classification and element extraction model training device is provided according to the present disclosure, applied to a large language model, the large language model comprising: a first branch, a second branch and a third branch, the first branch being used for event type division of a Chinese event, the second branch being used for obtaining element prompt words of different Chinese event types, and the third branch being used for event element extraction of the Chinese event;
[0019] The device comprises:
[0020] a first obtaining module, configured to obtain text description information of a sample Chinese event, the text description information of the sample Chinese event comprising: a plurality of event texts to be classified;
[0021] a first determining module, configured to determine a type prompt word corresponding to the sample Chinese event based on the text description information of the sample Chinese event;
[0022] a second determining module, configured to input the type prompt word into the first branch of the large language model to obtain a type division result of the sample Chinese event, the type division result comprising: a plurality of Chinese event types, and a confidence degree of each Chinese event type being greater than a preset threshold;
[0023] a third determining module configured to input a plurality of the Chinese event types into the second branch of the large language model to obtain an element prompt word corresponding to the sample Chinese event;
[0024] a fourth determining module configured to input the element prompt word into the third branch of the large language model to obtain an element extraction result of the sample Chinese event;
[0025] a training module configured to train the first branch based on the type division result of the sample Chinese event, and train the third branch based on the element extraction result of the sample Chinese event, to obtain the event classification and element extraction model.
[0026] In a fourth aspect, an event classification and element extraction apparatus is provided according to the content of the present disclosure, and the apparatus comprises:
[0027] a second obtaining module configured to obtain text description information of a current Chinese event;
[0028] a fifth determining module configured to determine a type prompt word corresponding to the current Chinese event based on the text description information of the current Chinese event;
[0029] a sixth determining module configured to input the type prompt word corresponding to the current Chinese event into the event classification and element extraction model to obtain a type division result and an element extraction result of the current Chinese event;
[0030] The event classification and element extraction model is an event classification and element extraction model trained and generated by the method of the first aspect.
[0031] In a fifth aspect, a computer device is provided, which comprises a memory and a processor, the memory stores a computer program, and the processor implements the steps of the event classification and element extraction model training method in any one of the above embodiments or the steps of the event classification and element extraction method in any one of the above embodiments when executing the computer program.
[0032] In a sixth aspect, a computer readable storage medium is provided, which stores a computer program, and the computer program is executed by a processor to implement the steps of the event classification and element extraction model training method in any one of the above embodiments or the steps of the event classification and element extraction method in any one of the above embodiments.
[0033] The event classification and element extraction model training method provided by the embodiment of the application is applied to a large language model, and the large language model comprises a first branch, a second branch and a third branch. The first branch is used for classifying event types of Chinese events. The second branch is used for obtaining element prompt words of different Chinese event types. The third branch is used for event element extraction of Chinese events. The method comprises the following steps: obtaining text description information of a sample Chinese event. The text description information of the sample Chinese event comprises a plurality of event texts to be classified. Type prompt words corresponding to the sample Chinese event are determined based on the text description information of the sample Chinese event. The type prompt words are input into the first branch of the large language model, and a type classification result of the sample Chinese event is obtained. The type classification result comprises a plurality of Chinese event types, and the confidence of each Chinese event type is greater than a preset threshold. The plurality of Chinese event types are input into the second branch of the large language model, and element prompt words corresponding to the sample Chinese event are obtained. The element prompt words are input into the third branch of the large language model, and an element extraction result of the sample Chinese event is obtained. The first branch is trained based on the type classification result of the sample Chinese event, and the third branch is trained based on the element extraction result of the sample Chinese event, and an event classification and element extraction model is obtained. In this way, the event classification and element extraction are performed by using the large language model, and the Chinese event processing efficiency is effectively improved.
[0034] The above description is only a summary of the technical solutions of the embodiments of the application. In order to more clearly understand the technical means of the embodiments of the application, the embodiments of the application can be implemented according to the content of the description, and in order to make the above and other purposes, characteristics and advantages of the embodiments of the application more obvious and easy to understand, the specific embodiments of the application are described below. BRIEF DESCRIPTION OF DRAWINGS
[0035] In order to more clearly illustrate the technical solutions of the embodiments of the present disclosure, the drawings of the embodiments will be briefly described below. It should be noted that the drawings described below only relate to some embodiments of the present disclosure, but not limit the present disclosure, wherein:
[0036] Figure 1 FIG. 1 is a flowchart of an event classification and element extraction model training method provided by the present disclosure.
[0037] Figure 2 FIG. 2 is a flowchart of an event classification and element extraction method provided by the present disclosure.
[0038] Figure 3 FIG. 3 is a structural schematic diagram of an event classification and element extraction model training device provided by the present disclosure.
[0039] Figure 4 FIG. 4 is a structural schematic diagram of an event classification and element extraction device provided by the present disclosure.
[0040] Figure 5 is a structural schematic diagram of a computer device provided by the present disclosure.
[0041] It should be noted that the elements in the drawings are schematic and not drawn to scale. DETAILED DESCRIPTION
[0042] In order to make the purposes, technical solutions and advantages of the embodiments of the present disclosure clearer, the technical solutions of the embodiments of the present disclosure will be described clearly and completely below with reference to the drawings. Obviously, the described embodiments are part of the embodiments of the present disclosure, rather than all the embodiments. Based on the described embodiments of the present disclosure, all other embodiments obtained by a person of ordinary skill in the art without any inventive effort also belong to the scope of protection of the present disclosure.
[0043] Unless otherwise defined, all terms (including technical and scientific terms) used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this present subject matter belongs. It will be further understood that terms, such as those defined in commonly used dictionaries, should be interpreted as having a meaning that is consistent with their meaning in the context of the specification and relevant art and will not be interpreted in an idealized or overly formal sense unless expressly so defined herein. As used herein, the statement that two or more parts are "connected" or "coupled" together refer to an indirect or direct connection or coupling.
[0044] Reference herein to "an embodiment" means that a particular feature, structure, or characteristic described in connection with the embodiment can be included in at least one embodiment of the application. The appearances of the phrase "in an embodiment" in various places in the specification are not necessarily all referring to the same embodiment, nor are they necessarily mutually exclusive of one another. A person of ordinary skill in the art will readily recognize from the disclosure herein, given the total volume of this application that the embodiments described herein can be combined with one another in various ways.
[0045] The term "and / or", merely an associative relationship of the associated objects described herein, means that there can be three relationships, for example, A and / or B, can represent: there is A, there are A and B, and there is B. In addition, the character " / " in this paper generally represents that the front and rear associated objects are a "or" relationship. Terms such as "first" and "second" are only used to distinguish one component (or part of a component) from another component (or another part of a component).
[0046] In the description of the present application, unless otherwise specified, the meaning of "a plurality of" is two or more (including two), and similarly, "a plurality of groups" means two or more groups (including two groups).
[0047] In order for those skilled in the art to better understand the scheme of the present application, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings.
[0048] Figure 1 is a flowchart of an event classification and element extraction model training method provided by an embodiment of the present disclosure, which is applied to a large language model. The large language model includes a first branch, a second branch and a third branch. The first branch is used for event type division of Chinese events. The second branch is used for obtaining element prompt words of different Chinese event types. The third branch is used for event element extraction of Chinese events.
[0049] As shown in Figure 1 , the specific process of the event classification and element extraction model training method includes:
[0050] S110, obtaining text description information of a sample Chinese event.
[0051] Among them, the text description information of the sample Chinese event includes a plurality of event texts to be classified. Each event text to be classified corresponds to a sample Chinese event, i.e. a historical Chinese event.
[0052] It should be noted that the event types corresponding to different event texts to be classified can be the same event type, i.e. the correspondence between the event texts to be classified and the event types is many-to-one, such as at least two event texts to be classified corresponding to the same event type; or the event types corresponding to different event texts to be classified can be multiple event types, and the correspondence between the event texts to be classified and the event types is one-to-one, such as one event text to be classified corresponding to one event type and another event text to be classified corresponding to another event type.
[0053] S120, determining the type prompt word corresponding to the sample Chinese event based on the text description information of the sample Chinese event.
[0054] Among them, the type prompt word corresponding to the sample Chinese event can be determined based on the event type prompt word template constructed in advance.
[0055] In some embodiments, based on the text description information of the sample Chinese event, the type prompt word corresponding to the sample Chinese event is determined, including:
[0056] Obtaining an event type prompt word template; based on the event type prompt word template, performing type matching on a plurality of event texts to be classified corresponding to the sample Chinese event to obtain the type prompt word corresponding to the sample Chinese event.
[0057] The event type prompt word template is used to describe the mapping relationship between the event type and the type description text. The type description text corresponds to the type prompt word, that is, one type description text can correspond to one type prompt word. For example, text keyword extraction is performed on a type description text, and the extracted text keyword is determined as the type prompt word corresponding to the type description text.
[0058] The event type prompt word template can be a general event type classification prompt word template designed based on a plurality of general event types and their definition descriptions, and is used for prompt word acquisition of Chinese events. The event type prompt word template is as follows.
[0059]
[0060] Based on the event type prompt word template, type matching is performed on the plurality of event texts to be classified corresponding to the sample Chinese event, to obtain the type prompt word corresponding to the sample Chinese event. The type matching can include: performing event type recognition on the plurality of event texts to be classified corresponding to the sample Chinese event, to obtain the event type corresponding to each event text to be classified; and based on the event type corresponding to each event text to be classified and the event types included in the event type prompt word template, matching the type prompt word associated with the type description text corresponding to one event type included in the event type prompt word template that matches the event type corresponding to the event text to be classified, to determine the type prompt word corresponding to the one event type corresponding to the event text to be classified.
[0061] When performing event type recognition on the plurality of event texts to be classified corresponding to the sample Chinese event, the type recognition can be performed based on the type label previously assigned to each event text to be classified.
[0062] Therefore, by performing type matching on the plurality of event texts to be classified corresponding to the sample Chinese event through the event type prompt word template, the type prompt word corresponding to the sample Chinese event is effectively determined.
[0063] In S130, the type prompt word is input into the first branch of the large language model, to obtain a type division result of the sample Chinese event. The type division result includes a plurality of Chinese event types.
[0064] Each confidence degree of each Chinese event type is greater than a preset threshold;
[0065] The first branch is used for event type classification of the Chinese event. It can be understood that the type prompt word is input into the first branch of the large language model, and the first branch of the large language model classifies the event description based on the context information of the input prompt word and the built-in language understanding capability to obtain a plurality of candidate event types corresponding to the sample Chinese event and a confidence degree predicted by each candidate event type. A preset number of candidate event types with a confidence degree greater than a preset threshold are determined as the plurality of Chinese event types.
[0066] In S140, the plurality of Chinese event types are input into the second branch of the large language model to obtain the element prompt word corresponding to the sample Chinese event.
[0067] The element prompt word corresponding to the sample Chinese event can be an element key / representative word reflected by the event element in the sample Chinese event.
[0068] In some embodiments, inputting the plurality of Chinese event types into the second branch of the large language model to obtain the element prompt word corresponding to the sample Chinese event includes:
[0069] Obtaining a target similar event corresponding to each Chinese event type; and determining the element prompt word corresponding to the sample Chinese event based on the target similar event corresponding to each Chinese event type.
[0070] The target similar event is an event representative instance corresponding to the Chinese event type. That is, the event type of the target similar event and the event type of the event representative instance are the same Chinese event type.
[0071] Thus, by obtaining similar events for each Chinese event type, the event text data corresponding to the Chinese event type is expanded, which facilitates effective determination of the element prompt word corresponding to the sample Chinese event.
[0072] In some embodiments, obtaining the target similar event corresponding to each Chinese event type includes:
[0073] Based on the domain-related text data corresponding to each Chinese event type, an event instance library is constructed, which includes a plurality of candidate event texts; and based on a text similarity between each candidate event text and each to-be-classified event text corresponding to the sample Chinese event, the target similar event corresponding to each Chinese event type is determined.
[0074] Based on the domain-related text data corresponding to each Chinese event type, the event instance library can be constructed by collecting and labeling representative instances of each Chinese event type from the domain-related text data corresponding to each Chinese event type, uniformly representing the event type and the event element in JSON format, and constructing an event instance library.
[0075] The determining of the target similar event corresponding to each Chinese event type can include: converting each candidate event text and each to-be-classified event text corresponding to the sample Chinese event into embedded vector representations respectively by using a RoBERTa-base model, to obtain a plurality of candidate event vectors and a plurality of to-be-classified event vectors; calculating the similarity between each to-be-classified event vector and the plurality of candidate event vectors respectively by using a cosine similarity measurement method shown in formula (1) below, and selecting a candidate event text corresponding to a candidate event vector with the maximum similarity corresponding to each to-be-classified event vector as a target similar event corresponding to a Chinese event type corresponding to the to-be-classified event vector, to obtain the target similar event corresponding to each Chinese event type.
[0076]
[0077] In formula (1), E q represents a to-be-classified event vector, q represents a to-be-classified event text, E xi represents an i th candidate event vector, x i represents a candidate event text.
[0078] In some embodiments, based on the target similar event corresponding to each Chinese event type, the element prompt word corresponding to the sample Chinese event is determined, including:
[0079] An element extraction prompt word template is obtained, and element matching is performed on the event representative instance corresponding to each Chinese event type based on the element extraction prompt word template, to obtain the element prompt word corresponding to the sample Chinese event.
[0080] The element extraction prompt word template is used to describe the mapping relationship between the event type and the element description text. The element description text corresponds to the element prompt word. That is, one element description text can correspond to one element prompt word, for example, text keyword extraction is performed on an element description text, and the extracted text keyword is determined as the element prompt word corresponding to the element description text.
[0081] The element extraction prompt word template can be a general element prompt word template designed based on a plurality of general event elements and their definition descriptions, and is used to guide the model to perform event element extraction. The element extraction prompt word template is shown as follows.
[0082]
[0083] The element matching based on the element extraction prompt word template on each Chinese event type corresponding event representative instance, the element prompt word corresponding to the sample Chinese event can include: performing event element identification on the plurality of event texts to be classified corresponding to the sample Chinese event, obtaining the event element corresponding to each event text to be classified, matching the event element corresponding to each event text to be classified with the event element included in the event element prompt word template, determining the element prompt word associated with the element description text corresponding to one event element included in the event element prompt word template matched with the event element corresponding to the event text to be classified as the element prompt word of the event element corresponding to the event text to be classified.
[0084] When performing event element identification on the plurality of event texts to be classified corresponding to the sample Chinese event, the element label assigned to each event text to be classified in advance can be used for identification.
[0085] Therefore, by performing element matching on the plurality of event texts to be classified corresponding to the sample Chinese event through the event element prompt word template, the element prompt word corresponding to the sample Chinese event is effectively determined.
[0086] S150, input the element prompt word into the third branch of the large language model, and obtain the element extraction result of the sample Chinese event.
[0087] Among them, the element extraction result of the sample Chinese event includes: a plurality of Chinese event elements. The corresponding relationship between the Chinese event element and the Chinese event type can be many-to-one, that is, each Chinese event type can correspond to a plurality of Chinese event elements; the corresponding relationship between the Chinese event element and the Chinese event type can be one-to-one, that is, one Chinese event type can correspond to one Chinese event element.
[0088] S160, based on the type division result of the sample Chinese event, the first branch is trained, and based on the element extraction result of the sample Chinese event, the third branch is trained, to obtain an event classification and element extraction model.
[0089] Among them, a preset loss function can be used to calculate the loss value between the type division result of the sample Chinese event output by the first branch and the preset type division result, if the loss value is greater than a preset threshold, the parameters of the first branch are optimized until the loss value is less than or equal to the preset threshold, to obtain the trained first branch. And, using a preset loss function, the loss value between the element extraction result of the sample Chinese event output by the second branch and the preset element extraction result is calculated, if the loss value is greater than a preset threshold, the parameters of the second branch are optimized until the loss value is less than or equal to the preset threshold, to obtain the trained second branch.
[0090] The event type classification method based on the prompt word in the embodiment is different from the existing method using a pre-defined classifier. The context understanding and language generation capability of the large model are utilized to reduce the dependence on a large amount of labeled data. By searching the most similar instance based on semantic similarity and dynamically generating the prompt word, the utilization of the model on the context and the instance is enhanced, and the accuracy of the element extraction is improved.
[0091] The event classification and element extraction model training method provided in the embodiment is applied to a large language model. The large language model includes a first branch, a second branch, and a third branch. The first branch is used for event type division of a Chinese event. The second branch is used for obtaining element prompt words of different Chinese event types. The third branch is used for event element extraction of the Chinese event. The method includes: obtaining text description information of a sample Chinese event. The text description information of the sample Chinese event includes a plurality of event texts to be classified. Based on the text description information of the sample Chinese event, type prompt words corresponding to the sample Chinese event are determined. The type prompt words are input into the first branch of the large language model to obtain a type division result of the sample Chinese event. The type division result includes a plurality of Chinese event types. The confidence of each Chinese event type is greater than a preset threshold. The plurality of Chinese event types are input into the second branch of the large language model to obtain element prompt words corresponding to the sample Chinese event. The element prompt words are input into the third branch of the large language model to obtain an element extraction result of the sample Chinese event. The first branch is trained based on the type division result of the sample Chinese event. The third branch is trained based on the element extraction result of the sample Chinese event to obtain an event classification and element extraction model. In this way, the large language model is used for event classification and element extraction, which effectively improves the Chinese event processing efficiency.
[0092] Figure 2 is a flowchart of an event classification and element extraction method provided by the embodiment of the disclosure, as Figure 2 shown, the specific process of the event classification and element extraction method includes:
[0093] S210, obtaining text description information of a current Chinese event.
[0094] The text description information of the current Chinese event includes a plurality of event texts to be classified. Each event text to be classified corresponds to a current Chinese event, i.e., a Chinese event input by a user.
[0095] It should be noted that the event types corresponding to different to-be-classified event texts can be the same event type, that is, the correspondence between the to-be-classified event text and the event type is many-to-one, such as at least two to-be-classified event texts corresponding to the same event type; or the event types corresponding to different to-be-classified event texts can be multiple event types, and the correspondence between the to-be-classified event text and the event type is one-to-one, such as one to-be-classified event text corresponding to one event type and another to-be-classified event text corresponding to another event type.
[0096] S220, determining a type prompt word corresponding to the current Chinese event based on the text description information of the current Chinese event.
[0097] The type prompt word corresponding to the current Chinese event can be determined based on a pre-constructed event type prompt word template.
[0098] Based on the text description information of the current Chinese event, determining the type prompt word corresponding to the current Chinese event can include: obtaining an event type prompt word template; based on the event type prompt word template, performing type matching on a plurality of to-be-classified event texts corresponding to the current Chinese event to obtain the type prompt word corresponding to the current Chinese event.
[0099] S230, inputting the type prompt word corresponding to the current Chinese event into an event classification and element extraction model to obtain a type classification result and an element extraction result of the current Chinese event.
[0100] The event classification and element extraction model is an event classification and element extraction model generated by the method of the above embodiment.
[0101] The event classification and element extraction model includes a first branch, a second branch, and a third branch. The first branch can be used for event type classification of Chinese events, the second branch can be used for obtaining element prompt words of different Chinese event types, and the third branch can be used for event element extraction of Chinese events.
[0102] The type prompt word corresponding to the current Chinese event is input into the event classification and element extraction model, the Chinese event is classified by the first branch to obtain a type classification result of the current Chinese event, the type classification result of the current Chinese event includes a plurality of Chinese event types, the second branch extracts prompt words from the plurality of Chinese event types to obtain element prompt words corresponding to the current Chinese event, and the third branch extracts event elements from the element prompt words to obtain an element extraction result of the current Chinese event.
[0103] The type prompt word corresponding to the current Chinese event is input into the event classification and element extraction model to obtain an output result of a first branch and an output result of a third branch. The output result of the first branch and the output result of the third branch are processed to obtain a type classification result and an element extraction result of the current Chinese event.
[0104] For example, the text output by the model branch is segmented according to a specific delimiter; the line containing the "event type" keyword is searched in the segmented text, the event type information is extracted, and the redundant spaces or punctuation marks are removed; in the segmented text line, the line containing the event element keyword is searched, the element information in each line is extracted, and the redundant spaces or punctuation marks are removed, the extracted event element information is stored in a dictionary structure, the key is the element name, and the value is the corresponding element content, and finally a complete JSON object containing the event type and the event element is formed.
[0105] The embodiment is based on existing large model natural language processing and generation technology, realizes Chinese event element extraction of the large model, collects and labels various event type representative instances from field related text data to construct an event instance library, converts the instances into uniform embedding vector representation, and then dynamically constructs a prompt word guided large model to extract event elements based on semantic similarity retrieval of the most relevant instances, and finally analyzes and extracts the output result.
[0106] Figure 3 A structural schematic diagram of an event classification and element extraction model training device provided by the embodiment is applied to a large language model, and the large language model includes a first branch, a second branch and a third branch. The first branch is used for event type classification of a Chinese event, the second branch is used for obtaining element prompt words of different Chinese event types, and the third branch is used for event element extraction of the Chinese event.
[0107] The event classification and element extraction model training device can include a first acquisition module 310, a first determination module 320, a second determination module 330, a third determination module 340, a fourth determination module 350 and a training module 360. Among them:
[0108] The first acquisition module 310 is configured to acquire text description information of a sample Chinese event. The text description information of the sample Chinese event includes a plurality of event texts to be classified.
[0109] The first determination module 320 is configured to determine a type prompt word corresponding to the sample Chinese event based on the text description information of the sample Chinese event.
[0110] The second determining module 330 is configured to input the type prompt word into the first branch of the large language model to obtain a type division result of the sample Chinese event, the type division result including: a plurality of Chinese event types, and a confidence degree of each Chinese event type being greater than a preset threshold.
[0111] The third determining module 340 is configured to input the plurality of Chinese event types into the second branch of the large language model to obtain an element prompt word corresponding to the sample Chinese event.
[0112] The fourth determining module 350 is configured to input the element prompt word into the third branch of the large language model to obtain an element extraction result of the sample Chinese event.
[0113] The training module 360 is configured to train the first branch based on the type division result of the sample Chinese event, and train the third branch based on the element extraction result of the sample Chinese event to obtain an event classification and element extraction model.
[0114] In this embodiment, optionally, the first determining module 320 is specifically configured to:
[0115] obtain an event type prompt word template, the event type prompt word template being used to describe a mapping relationship between an event type and a type description text, the type description text corresponding to the type prompt word; and perform type matching on a plurality of event texts to be classified corresponding to the sample Chinese event based on the event type prompt word template to obtain the type prompt word corresponding to the sample Chinese event.
[0116] In this embodiment, optionally, the third determining module 340 includes an obtaining unit and a determining unit.
[0117] The obtaining unit is configured to obtain a target similar event corresponding to each Chinese event type, the target similar event being an event representative instance corresponding to the Chinese event type.
[0118] The determining unit is configured to determine the element prompt word corresponding to the sample Chinese event based on the target similar event corresponding to each Chinese event type.
[0119] In this embodiment, optionally, the obtaining unit is specifically configured to:
[0120] construct an event instance library based on the domain related text data corresponding to each Chinese event type, the event instance library including: a plurality of candidate event texts; and determine the target similar event corresponding to each Chinese event type based on a text similarity between each candidate event text and each event text to be classified corresponding to the sample Chinese event.
[0121] In this embodiment, optionally, the determining unit is specifically configured to:
[0122] The element extraction prompt word template is used to describe the mapping relationship between the event type and the element description text, and the element description text corresponds to the element prompt word. Based on the element extraction prompt word template, element matching is performed on each event representative instance corresponding to the Chinese event type, to obtain the element prompt word corresponding to the sample Chinese event.
[0123] The event classification and element extraction model training apparatus provided by the present disclosure can execute the method embodiments described above, and the specific implementation principles and technical effects can be referred to the method embodiments described above, which will not be described here again.
[0124] Figure 4 A structural schematic diagram of an event classification and element extraction apparatus provided by the present embodiment is shown in FIG. 4. The event classification and element extraction apparatus can include a second acquisition module 410, a fifth determination module 420, and a sixth determination module 430. Wherein:
[0125] The second acquisition module 410 is configured to acquire text description information of a current Chinese event.
[0126] The fifth determination module 420 is configured to determine a type prompt word corresponding to the current Chinese event based on the text description information of the current Chinese event.
[0127] The sixth determination module 430 is configured to input the type prompt word corresponding to the current Chinese event into an event classification and element extraction model, to obtain a type division result and an element extraction result of the current Chinese event.
[0128] The event classification and element extraction model is an event classification and element extraction model generated by the method of the above embodiment.
[0129] The event classification and element extraction apparatus provided by the present disclosure can execute the method embodiments described above, and the specific implementation principles and technical effects can be referred to the method embodiments described above, which will not be described here again.
[0130] The present embodiment also provides a computer device. For details, please refer to Figure 5 , Figure 5 A basic structural block diagram of the computer device of the present embodiment is shown in FIG. 5.
[0131] The computer device includes a memory 510 and a processor 520 which are communicatively connected through a system bus. It is to be noted that only the memory 510 and the processor 520 are shown in the figure, but it is to be understood that all the components shown are not required to be implemented, and more or less components can be alternatively implemented. Among them, the computer device herein is a device capable of automatically performing numerical calculation and / or information processing according to pre-set or stored instructions, which hardware includes but is not limited to microprocessor, application specific integrated circuit (ASIC), field-programmable gate array (FPGA), digital signal processor (DSP), embedded device, etc.
[0132] The computer device can be a desktop computer, a notebook computer, a palm computer, a cloud server and the like. The computer device can interact with the user through a keyboard, a mouse, a remote controller, a touchpad or a voice control device and the like.
[0133] The memory 510 includes at least one type of readable storage medium, including non-volatile memory or volatile memory, for example, flash memory, a hard disk, a multimedia card, a card-type memory (e.g., an SD or DX memory, etc.), random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM), electrically erasable programmable read-only memory (EEPROM), programmable read-only memory (PROM), a magnetic memory, a magnetic disk, an optical disk, etc. The RAM can include static RAM or dynamic RAM. In some embodiments, the memory 510 can be an internal storage unit of the computer device, for example, a hard disk or a memory of the computer device. In other embodiments, the memory 510 can also be an external storage device of the computer device, for example, a plug-in hard disk, a Smart Media Card (SMC), a Secure Digital (SD) card, or a flash card, etc. equipped on the computer device. Of course, the memory 510 can include both an internal storage unit and an external storage device of the computer device. In this embodiment, the memory 510 is generally used to store an operating system and various application software installed on the computer device, for example, program codes of the above-described method, etc. In addition, the memory 510 can also be used to temporarily store various data that has been output or will be output.
[0134] The processor 520 is generally used to perform the overall operation of the computer device. In this embodiment, the memory 510 is used to store program codes or instructions, which include computer operation instructions, and the processor 520 is used to execute the program codes or instructions stored in the memory 510 or process data, for example, run the program codes of the above-described method.
[0135] In this article, the bus can be an Industry Standard Architecture (ISA) bus, a Peripheral Component Interconnect (PCI) bus, or an Extended Industry Standard Architecture (EISA) bus, etc. The bus system can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, only one thick line is shown in the figure, but it does not mean that there is only one bus or only one type of bus.
[0136] Another embodiment of the present application also provides a computer readable medium, which can be a computer readable signal medium or a computer readable medium. The processor in the computer reads the computer readable program code stored in the computer readable medium, so that the processor can perform the function actions specified in each step or combination of steps in the above method; generate the device implementing the function actions specified in each block or combination of blocks in the block diagram.
[0137] The computer readable medium includes but is not limited to electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or apparatus, or any appropriate combination of the foregoing, for storing program code or instructions, which include computer operation instructions, and the processor for executing the program code or instructions of the above method stored in the memory.
[0138] The definition of the memory and the processor can refer to the description of the foregoing computer device embodiment, which will not be repeated here.
[0139] In several embodiments provided in the present application, it should be understood that the disclosed system, device and method can be implemented in other ways. For example, the device embodiment described above is only schematic, for example, the division of modules or units is only a logical function division, and actual implementation can have another division manner, for example, a plurality of units or components can be combined or integrated into another system, or some features can be ignored or not executed. In addition, the coupling or direct coupling or communication connection between the displayed or discussed each other can be through some interface, indirect coupling or communication connection between the units or devices, which can be electrical, mechanical or other forms.
[0140] The function units or modules in each embodiment of the present application can be integrated in one processing unit, or each unit can exist physically, or two or more units can be integrated in one unit. The integrated unit can be realized in the form of hardware or in the form of software function unit.
[0141] If the integrated unit is implemented in the form of a software function unit and sold or used as an independent product, it can be stored in a computer readable storage medium. Based on such understanding, the technical solutions of the present application essentially or say the part that contributes to the prior art or the whole or part of the technical solutions can be embodied in the form of a software product. The computer software product is stored in a storage medium and includes a number of instructions for causing a computer device (which can be a personal computer, a server, or a network device, etc.) or a processor to execute all or part of the steps of the methods in the various embodiments of the present application. The aforementioned storage medium includes: a U disk, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk, and various media that can store program codes.
[0142] In the claims, any reference signs placed between parentheses shall not be construed as limiting the claim. The word "comprising" does not exclude the presence of elements or steps not listed in a claim. The word "a" or "an" preceding an element does not exclude the presence of a plurality of such elements. The application can be implemented by means of both hardware and software, and any combination thereof. In the device claim enumerating several means, several of these means can be embodied by one and the same item of hardware. The mere fact that certain measures are recited in mutually different claims does not indicate that a combination of these measures cannot be used to advantage. The use of relative terms such as "first", "second" and "third", etc. does not connote any prioritization, but such terms are used to distinguish a certain feature from another feature with the same name. The steps of the methods described in the above embodiments should not be understood as necessarily limited in their sequence, except when this is explicitly specified.
[0143] The above embodiments are only used to illustrate the technical solutions of the present application, rather than limit them; even though the present application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that: it can still modify the technical solutions recorded in the foregoing embodiments, or make equivalent replacement for part of the technical features; and these modifications or replacements do not make the essence of the corresponding technical solutions deviate from the spirit and scope of the technical solutions of the embodiments of the present application.
Claims
1. An event classification and element extraction model training method, characterized in that, The application is applied to a large language model, and the large language model comprises a first branch, a second branch and a third branch, the first branch is used for event type classification of a Chinese event, the second branch is used for obtaining element prompt words of different Chinese event types, and the third branch is used for event element extraction of the Chinese event. The method comprises: obtaining text description information of a sample Chinese event, wherein the text description information of the sample Chinese event comprises a plurality of event texts to be classified; determining a type prompt word corresponding to the sample Chinese event based on the text description information of the sample Chinese event, wherein the determination of the type prompt word corresponding to the sample Chinese event based on the text description information of the sample Chinese event comprises: obtaining an event type prompt word template, the event type prompt word template is used to describe the mapping relationship between the event type and the type description text, the type description text corresponds to the type prompt word; performing type matching on the plurality of event texts to be classified corresponding to the sample Chinese event based on the event type prompt word template to obtain the type prompt word corresponding to the sample Chinese event; inputting the type prompt word into the first branch of the large language model to obtain a type classification result of the sample Chinese event, wherein the type classification result comprises a plurality of Chinese event types, and the confidence of each Chinese event type is greater than a preset threshold; inputting a plurality of Chinese event types into the second branch of the large language model to obtain an element prompt word corresponding to the sample Chinese event; inputting the element prompt word into the third branch of the large language model to obtain an element extraction result of the sample Chinese event; training the first branch based on the type classification result of the sample Chinese event, and training the third branch based on the element extraction result of the sample Chinese event to obtain the event classification and element extraction model.
2. The method of claim 1, wherein, The inputting of the plurality of Chinese event types into the second branch of the large language model to obtain the element prompt word corresponding to the sample Chinese event comprises: obtaining a target similar event corresponding to each Chinese event type, the target similar event being a representative instance of the Chinese event type; determining the element prompt word corresponding to the sample Chinese event based on the target similar event corresponding to each Chinese event type.
3. The method of claim 2, wherein, The obtaining of the target similar event corresponding to each Chinese event type comprises: constructing an event instance library based on the domain-related text data corresponding to each Chinese event type, wherein the event instance library comprises a plurality of candidate event texts; determining the target similar event corresponding to each Chinese event type based on the text similarity between each candidate event text and each event text to be classified corresponding to the sample Chinese event.
4. The method of claim 2, wherein, The determination of the element prompt word corresponding to the sample Chinese event based on the target similar event corresponding to each Chinese event type comprises: obtain an element extraction prompt word template, the element extraction prompt word template being used to describe a mapping relationship between an event type and an element description text, the element description text corresponding to the element prompt word; based on the element extraction prompt word template, perform element matching on each event representative instance corresponding to the Chinese event type to obtain the element prompt word corresponding to the sample Chinese event.
5. An event classification and element extraction method characterized by, comprising: obtain text description information of a current Chinese event; based on the text description information of the current Chinese event, determine a type prompt word corresponding to the current Chinese event; input the type prompt word corresponding to the current Chinese event into an event classification and element extraction model to obtain a type classification result and an element extraction result of the current Chinese event; wherein the event classification and element extraction model is an event classification and element extraction model trained and generated by the method of any one of claims 1-4.
6. An event classification and element extraction model training apparatus characterized by comprising: applied to a large language model, the large language model comprising: a first branch, a second branch and a third branch, the first branch being used for event type classification of a Chinese event, the second branch being used for obtaining element prompt words of different Chinese event types, and the third branch being used for event element extraction of the Chinese event; the device comprises: a first obtaining module for obtaining text description information of a sample Chinese event, the text description information of the sample Chinese event including a plurality of event texts to be classified; a first determining module for determining a type prompt word corresponding to the sample Chinese event based on the text description information of the sample Chinese event; the first determining module is specifically configured to: obtain an event type prompt word template, the event type prompt word template being used to describe a mapping relationship between an event type and a type description text, the type description text corresponding to the type prompt word; based on the event type prompt word template, perform type matching on the plurality of event texts to be classified corresponding to the sample Chinese event to obtain the type prompt word corresponding to the sample Chinese event; a second determining module for inputting the type prompt word into the first branch of the large language model to obtain a type classification result of the sample Chinese event, the type classification result including a plurality of Chinese event types, and the confidence of each Chinese event type being greater than a preset threshold; a third determining module for inputting a plurality of Chinese event types into the second branch of the large language model to obtain element prompt words corresponding to the sample Chinese event; a fourth determining module for inputting the element prompt words into the third branch of the large language model to obtain an element extraction result of the sample Chinese event; a training module for training the first branch based on the type classification result of the sample Chinese event, and training the third branch based on the element extraction result of the sample Chinese event to obtain the event classification and element extraction model.
7. An event classification and element extraction apparatus characterized by comprising: comprising: a second obtaining module for obtaining text description information of a current Chinese event; a fifth determining module configured to determine a type prompt word corresponding to the current Chinese event based on the text description information of the current Chinese event; a sixth determining module configured to input the type prompt word corresponding to the current Chinese event into an event classification and element extraction model to obtain a type classification result and an element extraction result of the current Chinese event. The event classification and element extraction model is an event classification and element extraction model trained by the method in any one of claims 1-4.
8. A computer device, comprising: The computer program is executed by the processor to implement the event classification and element extraction model training method in any one of claims 1-4, or the event classification and element extraction method in claim 5.
9. A computer readable storage medium having stored thereon a computer program, characterized in that, The computer program is executed by the processor to implement the event classification and element extraction model training method in any one of claims 1-4, or the event classification and element extraction method in claim 5.
Citation Information
Patent Citations
Medical event extraction method based on generative pre-training language model
CN117493504A