A method for constructing a graph and related equipment
The two-step extraction method automates causal event graph construction, addressing high costs and inefficiencies in manual methods by enhancing extraction and construction efficiency for both simple and complex causal texts.
Patent Information
- Application Number
- CN202111481742.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-12-06
- Publication Date
- 2025-01-03
- Estimated Expiration
- 2041-12-06
AI Technical Summary
The construction of causal event graphs is costly due to manual extraction methods, and existing automated methods struggle with complex causal texts, leading to poor extraction and construction efficiency.
A two-step extraction method using a pre-trained machine learning model to automatically construct causal event graphs by extracting cause events and determining result events, suitable for both simple and complex causal texts.
This method reduces construction costs and improves extraction and construction efficiency of causal event graphs by effectively handling various types of causal texts, including simple and complex scenarios.
Smart Images

Figure CN114254121B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of natural language processing, and in particular to a graph construction method and related equipment. Background Art
[0002] A causal event graph is a knowledge graph with "event" as its core; moreover, the causal event graph is used to describe the causal relationship between different events, so that the causal event graph can simulate the knowledge modeling, reasoning and analytical decision-making capabilities of the human brain.
[0003] However, the causal event graph is usually constructed manually by experts, which makes the construction cost of the causal event graph relatively high. Summary of the invention
[0004] The main purpose of the embodiments of the present application is to provide a graph construction method and related equipment, which can reduce the construction cost of a causal event graph.
[0005] An embodiment of the present application provides a graph construction method, which includes: obtaining a text to be used; wherein the text to be used includes at least one group of causal events; extracting at least one cause event to be used from the text to be used; determining a result event corresponding to each cause event to be used based on each cause event to be used and the text to be used; and determining a causal event graph based on the at least one cause event to be used and the result event corresponding to the at least one cause event to be used.
[0006] The present application also provides a graph construction device, including:
[0007] A text acquisition unit, used to acquire a text to be used; wherein the text to be used includes at least one set of causal events;
[0008] A reason extraction unit, used for extracting at least one to-be-used reason event from the to-be-used text;
[0009] A result extraction unit, used for determining the result event corresponding to each of the cause events to be used according to each of the cause events to be used and the text to be used;
[0010] The graph construction unit is used to determine a causal event graph according to the at least one cause event to be used and the result event corresponding to the at least one cause event to be used.
[0011] The embodiment of the present application further provides a device, the device comprising: a processor, a memory, and a system bus;
[0012] The processor and the memory are connected via the system bus;
[0013] The memory is used to store one or more programs, and the one or more programs include instructions, which, when executed by the processor, enable the processor to execute any possible implementation of the graph construction method provided in the embodiments of the present application.
[0014] An embodiment of the present application also provides a computer-readable storage medium, in which instructions are stored. When the instructions are executed on a terminal device, the terminal device executes any possible implementation of the graph construction method provided in the embodiment of the present application.
[0015] The embodiment of the present application also provides a computer program product. When the computer program product is run on a terminal device, the terminal device executes any possible implementation of the graph construction method provided in the embodiment of the present application.
[0016] Based on the above technical solution, this application has the following beneficial effects:
[0017] In the technical solution provided by the present application, after obtaining a text to be used including at least one group of causal events, first extract at least one cause event to be used from the text to be used; then determine the result event corresponding to each cause event to be used based on each cause event to be used and the text to be used; finally, determine a causal event map based on at least one cause event to be used and the result event corresponding to the at least one cause event to be used, so that the causal event map is used to record the causal relationship existing in the text to be used, thereby achieving the purpose of automatically constructing a causal event map, thereby reducing the construction cost of the causal event map.
[0018] In addition, because the graph construction method provided in the embodiment of the present application performs causal event extraction in a two-step extraction manner, the graph construction method can not only perform causal event extraction processing on simple causal texts (that is, text data including a single cause and a single effect), but also perform causal event extraction processing on complex causal texts (for example, text data including a single sound and multiple effects, multiple sounds and multiple effects, or multiple sounds and a single effect, etc.), which is beneficial to improving the extraction effect of causal events, and thus is beneficial to improving the construction effect of the causal event graph. BRIEF DESCRIPTION OF THE DRAWINGS
[0019] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.
[0020] Figure 1 A schematic diagram of text data provided in an embodiment of the present application;
[0021] Figure 2 A flowchart of a method for constructing a graph provided in an embodiment of the present application;
[0022] Figure 3 A schematic diagram of a cause event extraction model provided in an embodiment of the present application;
[0023] Figure 4 A schematic diagram of k-th cause location description data provided in an embodiment of the present application;
[0024] Figure 5 A schematic diagram of an event element extraction model provided in an embodiment of the present application;
[0025] Figure 6 A schematic diagram of a causal graph construction process provided in an embodiment of the present application;
[0026] Figure 7 A schematic diagram of a noise event provided in an embodiment of the present application;
[0027] Figure 8 A schematic diagram of a semantic representation model provided in an embodiment of the present application;
[0028] Fig. 9 A schematic diagram of a triple sample provided in an embodiment of the present application;
[0029] Fig.10 A schematic diagram of event attribute description information of text data provided in an embodiment of the present application;
[0030] Fig.11 A schematic diagram of generating reference information of a third text feature provided in an embodiment of the present application;
[0031] Fig.12 A schematic diagram of a second determination model provided in an embodiment of the present application;
[0032] Fig.13 A schematic diagram of the structure of a graph construction device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0033] The inventor found in the study of causal event maps that a large number of causal events can be first extracted from a large amount of text data (for example, news text data in the economic field, etc.); then relevant personnel manually construct a causal event map with reference to these causal events, so that the causal event map is used to record these causal events. It can be seen that causal events can be manually extracted by relevant personnel, but the extraction cost of manual extraction is relatively high, resulting in a relatively high construction cost of the causal event map.
[0034] The inventors also found that in order to overcome the defects of manual extraction, the causal events can be automatically extracted and processed with the help of a pre-trained machine learning model. Among them, the above-mentioned "pre-trained machine learning model" is more suitable for simple causal texts (for example, Figure 1 ; however, because the above-mentioned "pre-trained machine learning model" cannot extract accurate and comprehensive causal events from complex causal texts (for example, text data including single-phonetic and multiple-fruits, text data including polyphonic and multiple-fruits, or text data including polyphonic and single-fruit, etc.), the above-mentioned "pre-trained machine learning model" has poor causal event extraction effect for complex causal texts, which leads to poor construction effect of the causal event graph.
[0035] It should be noted that for Figure 1 For example, "text 1" is a text data including a single cause and a single result; "text 2" is a text data including a single sound and multiple results; "text 3" is a text data including a polyphonic single result. In addition, "a country" is used to represent a country; "a company" is used to represent a company.
[0036] Based on the above findings, in order to solve the technical problems shown in the background technology part, an embodiment of the present application provides a graph construction method, which includes: after obtaining a text to be used including at least one group of causal events, first extracting at least one cause event to be used from the text to be used; then determining the result event corresponding to each cause event to be used based on each cause event to be used and the text to be used; finally, determining a causal event graph based on at least one cause event to be used and at least one result event corresponding to the cause event to be used, so that the causal event graph is used to record the causal relationship existing in the text to be used, thereby achieving the purpose of automatically constructing a causal event graph, thereby reducing the construction cost of the causal event graph.
[0037] In addition, because the graph construction method provided in the embodiment of the present application performs causal event extraction in a two-step extraction manner, the graph construction method can not only perform causal event extraction processing on simple causal texts (that is, text data including a single cause and a single effect), but also perform causal event extraction processing on complex causal texts (for example, text data including a single sound and multiple effects, multiple sounds and multiple effects, or multiple sounds and a single effect, etc.), which is beneficial to improving the extraction effect of causal events, and thus is beneficial to improving the construction effect of the causal event graph.
[0038] In addition, the embodiments of the present application do not limit the execution subject of the graph construction method. For example, the graph construction method provided in the embodiments of the present application can be applied to data processing devices such as terminal devices or servers. Among them, the terminal device can be a smart phone, a computer, a personal digital assistant (PDA) or a tablet computer. The server can be an independent server, a cluster server or a cloud server.
[0039] In order to make the purpose, technical solution and advantages of the embodiments of the present application clearer, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.
[0040] Method Example 1
[0041] See also Figure 2 , which is a flow chart of a graph construction method provided in an embodiment of the present application.
[0042] The method for constructing a graph provided in the embodiment of the present application includes S1-S4:
[0043] S1: Get the text to be used.
[0044] The text to be used refers to text data carrying a causal relationship; and the text to be used includes at least one set of causal events (ie, cause event + result event).
[0045] In addition, the embodiment of the present application does not limit the number of the above-mentioned "texts to be used". For example, when a new causal relationship map is constructed using a large amount of text data, the number of the above-mentioned "texts to be used" is relatively large. For another example, when an existing causal relationship map is updated using one or more text data, the number of the above-mentioned "texts to be used" is relatively small (for example, the number of the above-mentioned "texts to be used" is 1, etc.).
[0046] In addition, the present embodiment does not limit the process of obtaining the text to be used. For example, the following method may be used: Method Example 2 The method is implemented by any of the embodiments shown for obtaining the text to be used.
[0047] S2: Extract at least one to-be-used reason event from the to-be-used text.
[0048] The reason event to be used refers to the reason event carried by the text to be used. For example, when the above “text to be used” is Figure 1 When the text 1 is shown, the reason event to be used may be "assisting a certain enterprise".
[0049] In addition, the embodiment of the present application does not limit the number of the above-mentioned "reason events to be used", and the number of the "reason events to be used" can be determined according to the number of reason events carried by the text to be used. Figure 1 When the text 3 is shown, the number of the “reason events to be used” may be 2.
[0050] In addition, the embodiment of the present application does not limit the implementation method of S2. For example, any existing or future cause event extraction method can be used for implementation. Method Example 3 Any possible implementation of S2 shown is implemented.
[0051] S3: Determine the result event corresponding to each cause event to be used according to each cause event to be used and the text to be used.
[0052] Among them, "the result event corresponding to the jth cause event to be used" is used to represent the consequence caused by the jth cause event to be used carried by the text to be used. j is a positive integer, j≤J, J is a positive integer, and J represents the number of cause events to be used in the above "at least one cause event to be used".
[0053] In addition, the above-mentioned "result event corresponding to the jth cause event to be used" is determined based on the jth cause event to be used and the text to be used; and the "result event corresponding to the jth cause event to be used" can also be represented by characters extracted from the text to be used.
[0054] In addition, the present application embodiment does not limit the implementation of S3. For example, it can adopt the following Method Example 4 Any possible implementation of S3 shown is implemented.
[0055] Based on the relevant content of S3 above, it can be known that after obtaining the jth cause event to be used, the result event corresponding to the jth cause event to be used can be extracted from the text to be used according to the jth cause event to be used, so that the result event can represent the consequence caused by the jth cause event to be used, so that the result event and the jth cause event to be used can subsequently form a group of causal events and participate in the construction process of the causal event map.
[0056] S4: Determine a causal event graph according to at least one cause event to be used and a result event corresponding to the at least one cause event to be used.
[0057] In an embodiment of the present application, after obtaining J cause events to be used and the result events corresponding to the J cause events to be used, the j-th cause event to be used and the result event corresponding to the j-th cause event to be used can be combined to obtain the j-th group of causal events; j is a positive integer, j≤J; and then the first group of causal events to the J-th group of causal events are used to construct a new causal event map (or, update an existing causal event map), so that the constructed causal event map can record the J-th group of causal events.
[0058] In addition, in order to improve the construction effect of the causal event map, the embodiment of the present application can adopt the following Method Implementation Example 4, method embodiment 5, and method embodiment 7 Any possible implementation of S4 shown is implemented.
[0059] Based on the relevant contents of S1 to S4 above, it can be known that for the graph construction method provided in the embodiment of the present application, after obtaining the text to be used including at least one group of causal events, first extract at least one cause event to be used from the text to be used; then determine the result event corresponding to each cause event to be used based on each cause event to be used and the text to be used; finally, determine the causal event graph based on at least one cause event to be used and at least one result event corresponding to the cause event to be used, so that the causal event graph is used to record the causal relationship existing in the text to be used, so that the purpose of automatically constructing the causal event graph can be achieved, thereby reducing the construction cost of the causal event graph.
[0060] In addition, because the graph construction method provided in the embodiment of the present application performs causal event extraction in a two-step extraction manner, the graph construction method can not only perform causal event extraction processing on simple causal texts (that is, text data including a single cause and a single effect), but also perform causal event extraction processing on complex causal texts (for example, text data including a single sound and multiple effects, multiple sounds and multiple effects, or multiple sounds and a single effect, etc.), which is beneficial to improving the extraction effect of causal events, and thus is beneficial to improving the construction effect of the causal event graph.
[0061] Method Example 2
[0062] In fact, in order to prevent text data without causal relationship from interfering with the construction process of the causal event graph, the embodiment of the present application also provides a possible implementation method for obtaining the above-mentioned "text to be used" (that is, S1), which may specifically include steps 11 and 12:
[0063] Step 11: After obtaining the text to be processed, the text to be processed is processed to perform causal relationship recognition processing to obtain a relationship recognition result to be used.
[0064] The above-mentioned “text to be processed” is used to represent a text data under the target field (for example, news text, etc.); and the embodiment of the present application does not limit the number of the “text to be processed”.
[0065] The above-mentioned “target field” refers to the application field of the graph construction method provided in the embodiment of the present application; and the embodiment of the present application does not limit the “target field”, for example, it can be: the field of economic news, or the field of entertainment news, etc.
[0066] The above-mentioned “relationship identification result to be used” is used to indicate whether there is a causal relationship in the text to be processed.
[0067] In addition, the embodiments of the present application do not limit the determination process of the above-mentioned "relationship identification results to be used". For example, it can specifically be: inputting the text to be processed into a pre-built causal relationship identification model to obtain the relationship identification results to be used output by the causal relationship identification model.
[0068] The above-mentioned “causality identification model” is used to perform causality identification processing on the input data of the causality identification model; and the embodiment of the present application does not limit the “causality identification model”, for example, the “causality identification model” can be a machine learning model.
[0069] The above-mentioned "causal relationship identification model" can be constructed in advance based on the first sample text and the label information of the first sample text. Among them, the above-mentioned "label information of the first sample text" is used to indicate whether there is actually a causal relationship in the first sample text; and the embodiment of the present application does not limit the method of obtaining the "label information of the first sample text", for example, it can be implemented by manual annotation. It should be noted that the embodiment of the present application does not limit the construction process of the above-mentioned "causal relationship identification model", and can be implemented by any existing or future model construction method.
[0070] Based on the relevant content of step 11 above, it can be known that for the graph construction process under the target domain, after obtaining a large amount of text data (for example, news text) under the target domain, it is possible to identify whether there is a causal relationship in these text data, so that the text data with causal relationships can be used to construct a causal relationship graph under the target domain.
[0071] Step 12: If the result of the to-be-used relationship recognition indicates that there is a causal relationship in the to-be-processed text, the to-be-processed text is determined as the to-be-used text.
[0072] In an embodiment of the present application, after obtaining the result of the relationship identification to be used, if the result of the relationship identification to be used indicates that there is a causal relationship in the text to be processed, the text to be processed can be determined as the text to be used so that the text to be processed can participate in the graph construction process; if the result of the relationship identification to be used indicates that there is no causal relationship in the text to be processed, the text to be processed can be directly discarded, which can effectively avoid those text data that do not have a causal relationship from participating in the graph construction process, thereby effectively overcoming the interference of those text data that do not have a causal relationship to the graph construction process, and thus helping to improve the construction efficiency of the causal relationship graph.
[0073] Based on the relevant contents of the above steps 11 to 12, it can be known that for the graph construction process under the target domain, after obtaining a large amount of text data under the target domain, those text data that do not have a causal relationship can be filtered out from these text data; and then the text data that have a causal relationship can be used to construct a causal relationship graph under the target domain. This can effectively overcome the interference of those text data that do not have a causal relationship on the graph construction process, thereby helping to improve the construction efficiency of the causal relationship graph.
[0074] Method Example 3
[0075] In addition, in order to improve the extraction effect of cause events, the embodiment of the present application also provides a possible implementation method of S2 above, which may specifically include: inputting the text to be used into a pre-built cause event extraction model to obtain at least one cause event to be used output by the cause event extraction model.
[0076] The above-mentioned "cause event extraction model" is used to perform cause event extraction processing on the input data of the cause event extraction model; and the embodiment of the present application does not limit the "cause event extraction model", for example, it can be a machine learning model.
[0077] In addition, the embodiment of the present application does not limit the model structure of the above-mentioned "cause event extraction model". For example, the "cause event extraction model" may include a first encoding layer and a first decoding layer; and the input data of the first decoding layer includes the output data of the first encoding layer (such as Figure 3 shown).
[0078] The above-mentioned “first coding layer” is used to encode the input data of the first coding layer; and the embodiment of the present application does not limit the “first coding layer”, for example, it can be implemented by any existing or future coding network (for example, a language model (Bidirectional Encoder Representation from Transformers, BERT)).
[0079] In addition, the embodiment of the present application does not limit the above-mentioned "input data of the first coding layer". For example, Figure 3 For the cause event extraction model shown in the figure, the "input data of the first encoding layer" in the cause event extraction model can be the original inherent input of BERT. Figure 3 In the above example, the “input data of the first coding layer” can be the sum of the word embeddings of a text data, the segmentation embeddings of the text data, and the position embeddings of the text data. Figure 3 For example, Figure 3 The BERT shown may include a 12-layer transformer network structure.
[0080] The above-mentioned "first decoding layer" is used to perform decoding processing on the input data of the first decoding layer; and the embodiment of the present application does not limit the implementation method of the "first decoding layer", for example, it may include a first interactive network, a first pointer network and a cause determination network; and the input data of the first pointer network includes the output data of the first interactive network, and the input data of the cause determination network includes the output data of the first pointer network.
[0081] In order to facilitate understanding of the working principle of the above-mentioned "first decoding layer", the following is explained by taking the determination process of the above-mentioned "at least one cause event to be used" as an example.
[0082] As an example, the process of determining "at least one cause event to be used" by using the above-mentioned "first decoding layer" may specifically include steps 21 to 24:
[0083] Step 21: Determine a first coding feature according to the text to be used and the first coding layer.
[0084] The above-mentioned "first coding feature" is used to represent the text information carried by the text to be used.
[0085] In addition, the present application embodiment does not limit the implementation method of step 21. For example, when the above “cause event extraction model” adopts Figure 3 When the model shown is implemented, the "cause event extraction model" may also include a feature extraction layer, and step 21 may specifically include steps 211-212:
[0086] Step 211: input the text to be used into the feature extraction layer to obtain the features to be encoded output by the feature extraction layer.
[0087] The above-mentioned “feature extraction layer” is used to perform feature extraction processing on the input data of the feature extraction layer; and the embodiment of the present application does not limit the implementation method of the “feature extraction layer”, for example, it can be implemented using the input end of BERT.
[0088] The above-mentioned “features to be encoded” are used to represent the text information carried by the text to be used; and the embodiment of the present application does not limit the “features to be encoded”. For example, the “features to be encoded” can be the sum of the word embedding vectors (wordembeddings) of the text to be used, the sentence segmentation vectors (segmentationembeddings) of the text to be used, and the position description vectors (positionembeddings) of the text to be used.
[0089] Step 212: input the feature to be encoded into the first encoding layer to obtain the first encoding feature output by the first encoding layer.
[0090] It should be noted that for the relevant content of the "first coding layer", please refer to the above.
[0091] Based on the above steps 211 to 212, it can be seen that Figure 3 For the cause event extraction model shown, after the text to be used is input into the cause event extraction model, the feature extraction layer in the cause event extraction model can first perform feature extraction on the text to be used to obtain the feature to be encoded; then the first encoding layer can perform encoding processing on the feature to be encoded to obtain and output the first encoding feature, so that the first encoding feature can represent the text information carried by the text to be used.
[0092] Step 22: Input the first coding feature into the first interaction network to obtain a first interaction result output by the first interaction network.
[0093] The above-mentioned “first interaction network” is used to perform semantic interaction processing on at least one candidate causal event type and input data of the first interaction network.
[0094] The above-mentioned “candidate causal event type” refers to the causal event type that the text data may belong to under the target domain. For example, when the above-mentioned “target domain” is the economic news domain, the “candidate causal event type” may be assistance, mergers and acquisitions, exchanges, etc.
[0095] In addition, the embodiment of the present application does not limit the determination process of the above-mentioned "at least one candidate causal event type", for example, it can be preset by relevant personnel. For another example, in order to improve flexibility, the determination process of the above-mentioned "at least one candidate causal event type" can specifically include steps 31 to 33:
[0096] Step 31: Perform field classification processing on the text to be used to obtain the field of the text to be used.
[0097] The above-mentioned "domain classification processing" is used to determine the text domain to which a text data belongs; and the embodiments of the present application do not limit the implementation method of the "domain classification processing", for example, it can be implemented with the help of a pre-built domain classification model. Among them, the "domain classification model" is a machine learning model with domain classification processing function.
[0098] It should be noted that the above-mentioned "domain classification model" can be constructed in advance based on the second sample text and the label information of the second sample text. Among them, the "label information of the second sample text" is used to indicate the text field to which the second sample text actually belongs; and the embodiment of the present application does not limit the method for obtaining the "label information of the second sample text", for example, it can be implemented by manual annotation. In addition, the embodiment of the present application does not limit the construction process of the above-mentioned "domain classification model", for example, it can be implemented by any existing or future model construction method.
[0099] The above-mentioned “text field to be used” is used to indicate the text field to which the text to be used belongs; and the present application embodiment does not limit the “text field to be used”. For example, when the text to be used is Figure 1 In the case of the text 1 shown, the "text field to be used" may be the field of economic news.
[0100] Step 32: Find the causal event type set corresponding to the field to be used from the preset mapping relationship. The preset mapping relationship includes the corresponding relationship between the field to be used and the causal event type set corresponding to the field to be used.
[0101] The above-mentioned "preset mapping relationship" is used to record the set of causal event types corresponding to at least one candidate text field; and the embodiment of the present application does not limit the "preset mapping relationship", for example, it may include: the correspondence between the first candidate text field and the first set of causal event types, the correspondence between the second candidate text field and the second set of causal event types, ..., and the correspondence between the Bth candidate text field and the Bth set of causal event types. Wherein, B is a positive integer, and B represents the number of candidate text fields in the above-mentioned "at least one candidate text field".
[0102] It can be seen that after obtaining the field to be used (for example, the field of economic news), the field to be used can be matched with B candidate text fields in the preset mapping relationship to obtain a text field matching result, so that when it is determined that the text field matching result indicates that the bth candidate text field successfully matches the field to be used, the bth causal event type set corresponding to the bth candidate text field is determined as the causal event type set corresponding to the field to be used. Wherein, b is a positive integer, b∈{1, 2, 3, ..., B}.
[0103] It should be noted that the above-mentioned “causal event type set” includes at least one causal event type.
[0104] Step 33: Determine at least one candidate causal event type according to the causal event type set corresponding to the domain to be used.
[0105] It should be noted that the embodiment of the present application does not limit the implementation method of step 33. For example, it may specifically include: determining all causal event types (or part of the causal event types) in the above-mentioned "set of causal event types corresponding to the field to be used" as candidate causal event types.
[0106] Based on the relevant contents of steps 31 to 33 above, it can be known that in some cases, the "at least one candidate causal event type" involved in the first interactive network can be determined according to the text field to which the text to be used belongs (for example, the field of economic news), so that the first interactive network can use the "at least one candidate causal event type" and the encoding features of the text to be used (that is, the first encoding features) to perform interactive processing at the semantic level.
[0107] The “first interaction result” mentioned above refers to the result of semantic interaction processing on the first coding feature, so that the “first interaction result” is used to represent the association between at least one candidate causal event type and the text to be used.
[0108] In addition, the embodiments of the present application do not limit the above-mentioned "first interaction result". For example, when the number of the above-mentioned "candidate causal event types" is K, the "first interaction result" may include the first interaction features corresponding to the K candidate causal event types. Among them, the "first interaction feature corresponding to the kth candidate causal event type" is used to indicate the correlation between the kth candidate causal event type and the text to be used. k is a positive integer, k≤K, and K is a positive integer.
[0109] In addition, the embodiments of the present application do not limit the determination process of the above-mentioned "first interaction feature corresponding to the kth candidate causal event type". For example, it may specifically include: performing semantic interaction processing on the representation feature of the kth candidate causal event type and the first coding feature to obtain the "first interaction feature corresponding to the kth candidate causal event type".
[0110] It should be noted that the embodiments of the present application are not limited to the above-mentioned “semantic interaction processing”. For example, it can be implemented using formula (1).
[0111]
[0112] In the formula, represents the above “first interaction feature corresponding to the k-th candidate causal event type”; Represents the characterization features of the k-th candidate causal event type; represents the first coding feature; Represents the inner product.
[0113] It should be noted that the above-mentioned “characteristic features of the kth candidate causal event type” are used to represent the kth candidate causal event type; and the embodiment of the present application does not limit the method of obtaining the “characteristic features of the kth candidate causal event type”, for example, it can be implemented using the word2vec algorithm.
[0114] Based on the relevant content of the above step 22, it can be known that for the causal event extraction model, after obtaining the first coding feature (that is, the coding feature of the text to be used), the first interaction network in the causal event extraction model can perform semantic-level interaction processing on at least one candidate causal event type and the first coding feature to obtain a first interaction result, so that the first interaction result can represent the feature representation of the text to be used under different candidate causal event types, so that the first interaction result can represent whether there are words associated with these candidate causal event types (such as, semantically similar or even identical) in the text to be used, so that the causal event can be extracted from the text to be used based on the first interaction result.
[0115] Step 23: Input the first interaction result into the first pointer network to obtain the cause location description data output by the first pointer network.
[0116] The above-mentioned "first pointer network" is used to perform cause event location processing on input data of the first pointer network.
[0117] In addition, the embodiment of the present application does not limit the working principle of the "first pointer network". For example, when the above-mentioned "first interaction result" includes the first interaction features corresponding to K candidate causal event types, the working principle of the "first pointer network" may specifically include steps 231-232:
[0118] Step 231: Perform full connection processing on the first interaction feature corresponding to the kth candidate causal event type to obtain a first full connection result (as shown in formula (2)). Where k is a positive integer, k≤K.
[0119]
[0120] In the formula, Represents the first full connection result; Represents the first interaction feature corresponding to the kth candidate causal event type; Fullyconnected() indicates full connection processing.
[0121] Step 232: Determine the kth cause location description data according to the first full connection result; wherein k is a positive integer, k≤K.
[0122] The above-mentioned “k-th cause position description data” is used to indicate the position of the cause event related to the k-th candidate causal event type carried by the text to be used.
[0123] In addition, the embodiments of the present application do not limit the above-mentioned "k-th cause position description data". For example, it may include the k-th starting position description data and the k-th ending position description data. Among them, the "k-th starting position description data" is used to indicate the starting point of the position of the cause event related to the k-th candidate causal event type carried by the text to be used. The "k-th ending position description data" is used to indicate the end point of the position of the cause event related to the k-th candidate causal event type carried by the text to be used.
[0124] In addition, the embodiment of the present application does not limit the determination process of the above-mentioned "kth cause position description data". For example, when the above-mentioned "kth cause position description data" includes the kth starting position description data and the kth ending position description data, the "kth cause position description data" can be determined with the help of formulas (3)-(4).
[0125]
[0126]
[0127] In the formula, Indicates the kth starting position description data; Indicates the kth end position description data; as well as They are all network parameters in the first pointer network, and these network parameters can be updated and determined in the construction process of the above-mentioned "cause event extraction model".
[0128] Based on the relevant content of step 23 above, it can be known that for the above-mentioned "first pointer network", it can determine the starting position and the ending position of the cause event related to the kth candidate causal event type carried by the text to be used (such as Figure 3 As shown). Wherein, k is a positive integer, k≤K, and K is a positive integer. It should be noted that the above-mentioned "fully connected layer" is used to implement the above-mentioned formula (2); the above-mentioned "head pointer network" is used to implement the above-mentioned formula (3); and the above-mentioned "tail pointer network" is used to implement the above-mentioned formula (4).
[0129] Step 24: Determine at least one cause event to be used according to the cause location description data and the cause determination network.
[0130] The above-mentioned "cause determination network" is used to perform cause event analysis processing on the input data of the cause determination network.
[0131] In fact, for multiple causal events appearing in a text data, these causal events may belong to any of the following two situations; and the two situations are specifically: ① Different causal events can be related to different candidate causal event types (for example, one causal event is related to assistance, one causal event is related to mergers and acquisitions, etc.). ② Some causal events may all be related to the same candidate causal event type (for example, two causal events are both related to assistance, one causal event is related to mergers and acquisitions, etc.).
[0132] For the first case mentioned above, since the cause events under different candidate causal event types are represented by different cause position description data, the cause determination network can independently parse the cause events under different candidate causal event types, so that the cause determination network can accurately extract these cause events from the text data. However, for the second case mentioned above, since multiple cause events under the same candidate causal event type are all represented by the same cause position description data, in order to accurately parse multiple cause events under the same candidate causal event type, the cause determination network can be implemented using the shortest path position parsing criterion.
[0133] To facilitate understanding, the following explanation is given with examples.
[0134] As an example, when the number of the above-mentioned “cause location description data” is K, and the kth cause location description data includes the kth starting location description data and the kth ending location description data, step 24 may specifically include steps 241 to 243:
[0135] Step 241: If the k-th cause location description data meets the preset no-cause condition, the k-th cause location description data is discarded, where k is a positive integer, k≤K.
[0136] The above-mentioned "preset no-reason condition" can be preset, for example, it can specifically include: there is no preset starting position marker (for example, Figure 3 The "1" shown) makes the "kth starting position description data" indicate that the starting position of the reason does not exist in the text to be used.
[0137] It can be seen that after obtaining the kth cause position description data, if the preset starting position marker does not appear in the kth cause position description data, it can be determined that the "kth starting position description data" indicates that the text to be used does not carry the cause event related to the kth candidate causal event type, so it can be determined that the text to be used is irrelevant to the kth candidate causal event type, so the kth cause position description data can be directly discarded. Wherein, k is a positive integer, k≤K.
[0138] Step 242: If the kth reason position description data satisfies the preset single reason condition, a to-be-used reason event is extracted from the to-be-used text according to the kth starting position description data and the kth ending position description data, where k is a positive integer, k≤K.
[0139] The above-mentioned "preset single reason condition" can be set in advance, for example, it may specifically include: the preset starting position marker appears only once in the kth starting position description data, so that the "kth starting position description data" indicates that there is a reason starting position in the text to be used.
[0140] It can be seen that after obtaining the kth cause position description data, if only one preset starting position marker appears in the kth cause position description data, it can be determined that the "kth starting position description data" indicates that the text to be used only carries one cause event related to the kth candidate causal event type, so a cause starting position and a cause ending position can be determined according to the kth starting position description data and the kth ending position description data respectively; then, according to the cause starting position and the cause ending position, a cause event to be used is extracted from the text to be used, so that the extracted cause event to be used is related to the kth candidate causal event type. Wherein, k is a positive integer, k≤K.
[0141] Step 243: If the kth reason position description data satisfies the preset multiple reason condition, multiple to-be-used reason events are extracted from the to-be-used text according to the kth starting position description data and the kth ending position description data, where k is a positive integer, k≤K.
[0142] The above-mentioned "preset multiple cause conditions" can be preset, for example, it can specifically include: the preset starting position marker appears at least twice in the k-th starting position description data (such as Figure 4 As shown), so that the "kth starting position description data" indicates that there are at least two reason starting positions in the text to be used.
[0143] In addition, the embodiment of the present application does not limit the implementation of step 243. For example, it may specifically include steps 2431 to 2433:
[0144] Step 2431: Determine at least two cause starting positions according to the kth starting position description data, where k is a positive integer, k≤K.
[0145] In the embodiment of the present application, after obtaining the kth starting position description data, if it is determined that there are multiple preset starting position markers in the kth starting position description data, the positions of the preset starting position markers in the kth starting position description data can be respectively determined as the starting positions of the respective causes. Figure 4 As shown, when the above-mentioned "preset starting position marker" is 1, the 6th character position (that is, the character position with 5 as the character number) and the 10th character position (that is, the character position with 9 as the character number) in the text to be used can be respectively determined as the cause starting positions.
[0146] Step 2432: Determine the cause end position corresponding to each cause start position according to the description data of the cause start position and the kth end position, where k is a positive integer, k≤K.
[0147] The "nth cause starting position" is used to indicate the starting point of the position of the nth cause event carried by the above "kth cause position description data". Where n is a positive integer, n≤N, N is a positive integer, and N indicates the number of cause starting positions indicated by the above "kth starting position description data".
[0148] The “cause end position corresponding to the nth cause start position” is used to indicate the end point of the position of the nth cause event indicated by the above “kth cause position description data”.
[0149] In addition, the above-mentioned "the end position of the cause corresponding to the starting position of the nth cause" is determined based on the description data of the starting position of the nth cause and the kth end position; and the embodiment of the present application does not limit the determination process of the "end position of the cause corresponding to the starting position of the nth cause". For ease of understanding, it is explained below with examples.
[0150] As an example, when the above “kth starting position description data” indicates that there are N reason starting positions in the to-be-used text, the above “reason end position corresponding to the nth reason starting position” determination process may specifically include steps 24321-24322:
[0151] Step 24321: Determine at least one candidate end position according to the description data of the nth cause start position and the kth end position, so that each candidate end position is later than the nth cause start position, where n is a positive integer, n≤N, N is a positive integer, and 2≤N.
[0152] In the embodiment of the present application, after obtaining the kth end position description data, the positions of the preset end position markers in the kth end position description data can be first determined as the end mark positions; then, the end mark positions located after the nth reason start position can be selected from the end mark positions and determined as candidate end positions. Figure 4 As shown, when the above "preset end position marker" is 1, and the above "nth reason starting position" is Figure 4 When the "first starting position" is shown, the 9th character position and the 13th character position in the text to be used can be determined as candidate end positions respectively.
[0153] Step 24322: Filter out a target end position from at least one candidate end position, and determine it as the cause end position corresponding to the nth cause start position, where n is a positive integer, n≤N, and N is a positive integer, 2≤N.
[0154] The above-mentioned “target end position” is used to indicate the candidate end position that matches the start position of the nth cause.
[0155] In addition, the above-mentioned "target end position" satisfies the following condition: the distance between the "target end position" and the starting position of the nth cause is not greater than the distance between any other candidate end position other than the target end position in the above-mentioned "at least one candidate end position" and the starting position of the nth cause. For ease of understanding, the following is an example.
[0156] As an example, when the above “nth reason starting position” is Figure 4 As shown in the "first starting position", since the distance between the first ending position and the first starting position is smaller than the distance between the first ending position and the second starting position, the first ending position can be determined as the cause ending position corresponding to the nth cause starting position.
[0157] Based on the relevant contents of the above step 2432, it can be known that after obtaining the nth cause starting position represented by the above “kth starting position description data”, the cause ending position corresponding to the nth cause starting position can be determined according to the nth cause starting position and the kth ending position description data, so that the connection path between the “cause ending position corresponding to the nth cause starting position” and the nth cause starting position satisfies the shortest path criterion, which is conducive to improving the accuracy of determining the location of the cause event. Wherein, n is a positive integer, n≤N, N is a positive integer, 2≤N.
[0158] Step 2433: extract each to-be-used reason event from the to-be-used text according to each reason start position and the reason end position corresponding to each reason start position. Wherein, k is a positive integer, k≤K.
[0159] In the embodiment of the present application, after obtaining the nth reason starting position represented by the above “kth starting position description data” and the reason ending position corresponding to the nth reason starting position, the text to be used can be subjected to character extraction processing according to the nth reason starting position and the reason ending position corresponding to the nth reason starting position to obtain a reason event to be used. Wherein, n is a positive integer, n≤N, N is a positive integer, 2≤N.
[0160] Based on the relevant contents of the above step 243, it can be known that after determining that the k-th cause position description data meets the preset multiple cause conditions, multiple cause events to be used can be extracted from the to-be-used text according to the k-th cause position description data and the shortest path criterion, so that each of the extracted cause events to be used is related to the k-th candidate causal event type, so that the analysis and processing of multiple cause events under the same candidate causal event type can be realized. Wherein, k is a positive integer, k≤K.
[0161] Based on the relevant content of the above step 24, it can be known that for the cause determination network in the cause event extraction model, it can parse and process the cause location description data corresponding to each candidate causal event type according to a variety of rules, and obtain the cause event under at least one candidate causal event type carried in the text to be used, which is conducive to improving the extraction effect of cause events.
[0162] Based on the above-mentioned "Cause Event Extraction Model", it can be known that the cause event extraction model is implemented with the help of BERT+ pointer network, so that the cause event extraction model can extract multiple cause events carried by a text data, which is conducive to the extraction and processing of multiple groups of causal events.
[0163] In addition, the above-mentioned "cause event extraction model" can be constructed in advance based on the third sample text and the label information of the third sample text. Among them, the "label information of the third sample text" is used to represent the cause event actually existing in the third sample text; and the embodiment of the present application does not limit the method of obtaining the "label information of the third sample text", for example, it can be implemented by manual annotation. It should be noted that the embodiment of the present application does not limit the construction process of the above-mentioned "cause event extraction model", and any existing or future model construction method can be used for implementation.
[0164] Based on the relevant content of S2 above, it can be known that after obtaining the text to be used, the cause event extraction model can perform cause event extraction processing on the text to be used, obtain and output at least one cause event to be used, so that these cause events to be used can represent the cause events carried by the text to be used. Among them, the cause event extraction model has a good multi-cause event extraction function, so that at least one cause event to be used extracted based on the cause event extraction model can more accurately and comprehensively represent the cause events carried by the text to be used, which is conducive to improving the extraction effect of cause events, thereby helping to improve the construction effect of the causal relationship map.
[0165] Method Example 4
[0166] In addition, in order to improve the extraction effect of the result event, the embodiment of the present application also provides a possible implementation method of S3 above. For ease of understanding, the following is an explanation of the determination process of "the result event corresponding to the jth cause event to be used" above. Wherein, j is a positive integer, j≤J, and J is a positive integer.
[0167] As an example, the process of determining the “result event corresponding to the jth cause event to be used” may specifically include steps 41 and 42:
[0168] Step 41: Determine a first text feature according to the jth to-be-used reason event and the to-be-used text.
[0169] The above-mentioned “first text feature” is used to represent the text information carried by the text to be used and the text information carried by the jth reason event to be used.
[0170] In addition, the embodiment of the present application does not limit the determination process of the above-mentioned "first text feature". For example, it can be implemented using the text features shown in formulas (5)-(6).
[0171]
[0172]
[0173] In the formula, represents the first text feature; The word embedding vector representing the jth reason event to be used; The word embedding vector representing the text to be used; A position description vector representing the text to be used; Represents the characterization vector of the text position identification data of the jth reason event to be used, so that It is used to indicate the position of the jth cause event to be used in the text to be used; E [CLS]Represents the word embedding vector of [CLS]; E [SEP] It should be noted that the embodiment of the present application is not limited to the above The determination process of, for example, can be implemented with the help of word2vec. In addition, for the relevant content of [CLS] and [SEP], please refer to the BERT algorithm.
[0174] The above-mentioned “text position identification data of the jth cause event to be used” is used to describe the position of the jth cause event to be used in the text to be used; and the embodiment of the present application does not limit the “text position identification data of the jth cause event to be used”, for example, it can be similar to Figure 5 The text location shown identifies the data.
[0175] Based on the first text feature shown in the above formulas (5)-(6), it can be seen that the first text feature can not only represent the text information carried by the text to be used, but also represent the text information carried by the j-th cause event to be used, as well as the position of the j-th cause event to be used in the text to be used. This is helpful in assisting in improving the result event extraction capability of the "event element extraction model" below, so that the "event element extraction model" can more easily extract the result event corresponding to the j-th cause event to be used from the text to be used.
[0176] Step 42: Input the first text feature into a pre-built event element extraction model to obtain an event element extraction result output by the event element extraction model.
[0177] The above “event element extraction result” is used to represent the event element (e.g., result event, event role, etc.) corresponding to the jth cause event to be used. It should be noted that the above “event role” refers to each role involved in a causal event; and the “event role” can include subjects and objects (e.g. Figure 1 shown).
[0178] In addition, the above-mentioned "event element extraction result" may include at least one of the result event corresponding to the jth cause event to be used and the event role corresponding to the jth cause event to be used. Among them, "event role corresponding to the jth cause event to be used" is used to represent the various roles involved in the jth cause event to be used (and the result event corresponding to the jth cause event to be used).
[0179] The above-mentioned "event element extraction model" is used to perform event element extraction processing (for example, result event extraction processing, event role extraction processing, etc.) on the input data of the event element extraction model; and the embodiments of the present application do not limit the "event element extraction model", for example, it can be a machine learning model.
[0180] In addition, the embodiment of the present application does not limit the model structure of the above-mentioned "event element extraction model". For example, the "event element extraction model" may include a second encoding layer and a second decoding layer; and the input data of the second decoding layer includes the output data of the second encoding layer (such as Figure 5 shown).
[0181] The above-mentioned "second encoding layer" is used to encode the input data of the second encoding layer; and the embodiment of the present application does not limit the "second encoding layer", for example, it can be implemented by any existing or future encoding network (for example, BERT).
[0182] The above-mentioned "second decoding layer" is used to perform decoding processing on the input data of the second decoding layer; and the embodiment of the present application does not limit the implementation method of the "second decoding layer". For ease of understanding, the following description is combined with two situations.
[0183] Case 1: When the above-mentioned "event element extraction model" is used to perform result event extraction processing on the input data of the event element extraction model, the second decoding layer in the "event element extraction model" may include a second pointer network and a result determination network; and the input data of the second pointer network includes the output data of the second encoding layer, and the input data of the result determination network includes the output data of the second pointer network.
[0184] In order to facilitate understanding of the working principle of the above-mentioned "second decoding layer", the following is explained by taking the determination process of the above-mentioned "result event corresponding to the j-th cause event to be used" as an example.
[0185] As an example, the process of determining the “result event corresponding to the jth cause event to be used” by using the above “second decoding layer” may specifically include steps 51 to 53:
[0186] Step 51: input the first text feature into the second encoding layer to obtain the second encoding feature output by the second encoding layer.
[0187] In an embodiment of the present application, for an event element extraction model with a result event extraction function, after a first text feature is input into the event element extraction model, a second encoding layer in the event element extraction model performs encoding processing on the first text feature to obtain and output a second encoded feature, so that the second encoded feature is used to represent the text information carried by the text to be used and the relevant information of the jth cause event to be used.
[0188] Step 52: Input the second coding feature into the second pointer network to obtain the result position description data output by the second pointer network.
[0189] The above-mentioned "result position description data" is used to indicate the position of the consequence caused by the j-th cause event to be used in the text to be used; and the embodiment of the present application does not limit the "result position description data", for example, it may include result starting point position description data and result end point position description data. Among them, the "result starting point position description data" is used to indicate the starting point of the position of the consequence caused by the j-th cause event to be used in the text to be used. The "result end point position description data" is used to indicate the end point of the position of the consequence caused by the j-th cause event to be used in the text to be used.
[0190] The above-mentioned "second pointer network" is used to perform result event location processing on the input data of the second pointer network.
[0191] In addition, the embodiment of the present application does not limit the implementation method of the "second pointer network". For example, it can be implemented by any implementation method of the "first pointer network" above. It can be seen that the above "second pointer network" can be implemented by formulas (7)-(9).
[0192]
[0193]
[0194]
[0195] In the formula, Indicates the above-mentioned "result starting point location description data"; Indicates the above-mentioned "result end point location description data"; represents the second coding feature; as well as They are all network parameters in the second pointer network, and these network parameters can be updated and determined in the construction process of the above-mentioned "event element extraction model".
[0196] Based on the relevant content of the above step 52, it can be known that for the above "second pointer network", it can use a fully connected layer, a head pointer network and a tail pointer network to determine the starting point and end point of the position of the consequence caused by the jth cause event to be used in the text to be used. It should be noted that the above "fully connected layer" is used to implement the above formula (7); the above "head pointer network" is used to implement the above formula (8); and the above "tail pointer network" is used to implement the above formula (9).
[0197] Step 53: Determine the result event corresponding to the jth cause event to be used according to the result location description data and the result determination network.
[0198] The above-mentioned "result determination network" is used to perform result event analysis processing on the input data of the result determination network.
[0199] It should be noted that the implementation of step 53 is similar to the implementation of step 24 above.
[0200] Based on the event element extraction model shown in steps 51 to 53 above, it can be known that in some cases, the event element extraction model can use a BERT and a pointer network to realize the result event extraction function, so that the event element extraction model has a better result event extraction capability, so that the result event corresponding to the j-th cause event to be used extracted by the event element extraction model can more accurately and completely represent the consequences caused by the j-th cause event to be used, which is conducive to improving the extraction effect of the result event, thereby helping to improve the construction effect of the causal relationship map.
[0201] Case 2: In order to further improve the element diversity of the causal relationship graph, the above-mentioned "event element extraction model" may also have an event role extraction function. Based on this, the embodiment of the present application also provides another possible implementation of the above-mentioned "event element extraction model", in which the second decoding layer in the "event element extraction model" includes not only the second pointer network and the result determination network, but also the third pointer network and the event role determination network.
[0202] In order to facilitate understanding of the working principle of the above-mentioned "second decoding layer", the following is explained by taking the determination process of the above-mentioned "event role corresponding to the j-th cause event to be used" as an example.
[0203] As an example, the process of determining the “event role corresponding to the jth cause event to be used” may specifically include steps 54 and 55:
[0204] Step 54: Input the second coding feature into the third pointer network to obtain the event role recognition result output by the third pointer network.
[0205] For the relevant content of the above-mentioned "second coding feature", please refer to step 51 above.
[0206] The above “event role identification result” is used to indicate the position of each role involved in the jth cause event to be used in the text to be used; and in order to better distinguish different roles, different marking symbols can be used in the “event role identification result” to mark the position of different roles. For example, when the text to be used is Figure 1 As shown in the text 1, when the jth cause event to be used is "a certain country, helping a certain enterprise", the "event role recognition result" can be [1 1 0 00 2 2 0 0 0 0 0 0 0]. Among them, "1" is used to mark the subject; "2" is used to mark the object.
[0207] The above-mentioned "third pointer network" performs event role identification processing on the input data of the second pointer network; and the embodiment of the present application does not limit the working principle of the "third pointer network", for example, it can be implemented using formula (7) and formula (10).
[0208]
[0209] In the formula, represents the above-mentioned “event role identification result”; W role , and b role They are all network parameters in the third pointer network, and these network parameters can be updated and determined in the construction process of the above-mentioned "event element extraction model".
[0210] Based on the relevant content of the above step 54, it can be known that for the above-mentioned "third pointer network", it can use the fully connected layer and the softmax function to identify the various roles involved in the j-th cause event to be used from the text to be used, and obtain the event role recognition result, so that the event role recognition result can indicate the position of the various roles involved in the j-th cause event to be used in the text to be used.
[0211] Step 55: Determine the event role corresponding to the jth cause event to be used according to the event role identification result and the event role determination network.
[0212] In an embodiment of the present application, for the event element extraction model, after obtaining the event role recognition result, the event role determination network in the event element extraction model can be used, and according to the event role recognition result, the event role corresponding to the jth cause event to be used is obtained from the various roles involved in the jth cause event to be used in the text to be used.
[0213] Based on the relevant contents of steps 54 to 55 above, it can be known that in some cases, the event element extraction model can use a BERT and two pointer networks to realize the result event extraction function and the event role extraction function, so that the event element extraction model has better result event extraction ability and event role extraction ability, so that it can subsequently construct a causal relationship map of causal events and their event roles in a text data, which is conducive to improving the construction effect of the causal relationship map.
[0214] Based on the relevant content of the above-mentioned "event element extraction model", it can be known that because the event element extraction model is implemented with the help of BERT+ at least one pointer network, the event element extraction model can extract the event element corresponding to the j-th cause event to be used carried by a text data, which is conducive to improving the extraction effect of event information.
[0215] In addition, the above-mentioned "event element extraction model" can be constructed in advance based on the fourth sample text, the cause event in the fourth sample text and the label information of the fourth sample text. Among them, the "label information of the fourth sample text" is used to indicate the result event (and event role) actually corresponding to the cause event in the fourth sample text; and the embodiment of the present application does not limit the method of obtaining the "label information of the fourth sample text", for example, it can be implemented by manual annotation.
[0216] It should be noted that the embodiments of the present application are not limited to the construction process of the above-mentioned "event element extraction model", and can be implemented by any existing or future model construction method.
[0217] In addition, in order to further improve the extraction effect of causal events, the above-mentioned "event element extraction model" and the above-mentioned "cause event extraction model" can be jointly constructed (for example, the model structure of the "event element extraction model" and the model structure of the "cause event extraction model" can be referred to first to generate a joint model; and then with the help of the training process of the joint model, the construction process of the "event element extraction model" and the "cause event extraction model" can be realized); and the joint construction process is implemented according to the fifth sample text and the label information of the fifth sample text. Among them, the "label information of the fifth sample text" is used to represent at least one group of causal events actually existing in the fifth sample text and the event roles of the at least one group of causal events.
[0218] Based on the relevant content of S3 above, it can be known that after obtaining the jth cause event to be used in the text to be used, the event element extraction model can refer to the text to be used, the jth cause event to be used, and the text position identification data of the jth cause event to be used, determine and output the result event and event element corresponding to the jth cause event to be used, so that the jth cause event to be used, the result event and event element corresponding to the jth cause event to be used can be referenced later to construct a causal relationship map, which is conducive to improving the construction effect of the causal relationship map.
[0219] In addition, for the graph construction method provided in the embodiment of the present application, after obtaining the result event and event role corresponding to at least one cause event to be used, the above S4 may specifically include: determining the causal event graph based on at least one cause event to be used, the result event corresponding to the at least one cause event to be used, and the event role corresponding to the at least one cause event to be used.
[0220] It can be seen that after obtaining J cause events to be used, the result events corresponding to the J cause events to be used, and the event roles, the j-th cause event to be used, the result event corresponding to the j-th cause event to be used, and the event role corresponding to the j-th cause event to be used can be combined to obtain the j-th causal event quadruple; j is a positive integer, j≤J; and then the first causal event quadruple to the J-th causal event quadruple are used to construct a new causal event graph (or update an existing causal event graph) so that the constructed causal event graph can record the J causal event quadruple.
[0221] It should be noted that the above-mentioned "causal event quadruple" can be expressed as (cause event, result event, subject, object).
[0222] Based on the relevant contents of S3 to S4 above, it can be known that for some cases, after obtaining the text to be used, you can first use the above "causal event extraction model" and the above "event element extraction model" to extract at least one causal event quadruple from the text to be used; then use these causal event quadruple to construct a new causal event graph (or update an existing causal event graph), so that the constructed causal event graph can record the J causal event quadruple, which is conducive to improving the comprehensiveness of the information of the causal event graph, thereby helping to improve the construction effect of the causal relationship graph.
[0223] Method Example 5
[0224] In addition, in order to improve the information expression effect of the causal event graph, the causal event graph can express information in the form of causal event aggregation. Based on this, the embodiment of the present application also provides another possible implementation of the above S4, which can specifically include S41-S43:
[0225] S41: Determine a plurality of cause events to be clustered according to at least one cause event to be used and at least one reference cause event.
[0226] The above-mentioned "at least one reference cause event" refers to the cause event that needs to be referenced when constructing a causal event map; and the embodiment of the present application does not limit the acquisition process of the "at least one reference cause event". For ease of understanding, the following is an explanation in combination with two situations.
[0227] Case 1: When a new causal event graph is constructed using the text to be used, the above "at least one reference cause event" may include at least one cause event in Y reference texts. It should be noted that the acquisition process of "at least one cause event in the yth reference text" is the same as the acquisition process of "at least one cause event to be used" above; and the acquisition process of "the yth reference text" is the same as the acquisition process of "the text to be used" above. Where y is a positive integer, y≤Y, and Y is a positive integer.
[0228] Case 2: when an existing causal event map is updated using the text to be used, the above-mentioned "at least one reference cause event" may include all or part of the cause events recorded in the "existing causal event map".
[0229] The above-mentioned “cause events to be clustered” are used to indicate cause events that need to be clustered.
[0230] In addition, the embodiment of the present application does not limit the implementation of S41. For example, it may specifically include: determining each cause event to be used as a cause event to be clustered, and determining each reference cause event as a cause event to be clustered.
[0231] S42: Clustering the multiple cause events to be clustered according to their semantic features to obtain at least one cause event cluster.
[0232] The semantic feature of the rth cause event to be clustered is used to represent the semantic information of the rth cause event to be clustered.
[0233] In addition, the present application embodiment does not limit the acquisition method of the above-mentioned "semantic features of the rth cause event to be clustered", for example, it can be implemented by any existing or future semantic feature extraction method. For another example, in order to improve the extraction effect of semantic features, it can be implemented by the following method: Method Example 6 The method is implemented by any possible implementation method of determining the above-mentioned "semantic features of the rth cause event to be clustered" as shown.
[0234] The above-mentioned "cause event cluster" is used to record a certain type of cause event. It can be seen that for the above-mentioned "at least one cause event cluster", each cause event cluster includes at least one cause event to be clustered.
[0235] In addition, the embodiments of the present application do not limit the determination process of the above-mentioned "at least one cause event cluster". For example, any existing or future clustering method (for example, k-means, x-means, and density-based clustering method, etc.) can be used for implementation.
[0236] In addition, in order to improve the clustering effect of cause events, the embodiment of the present application further provides a possible implementation method for determining the above-mentioned "at least one cause event cluster", which may specifically include S421-S422:
[0237] S421: Perform a first clustering process on a plurality of cause events to be clustered to obtain at least one event cluster to be processed.
[0238] The above-mentioned “first clustering process” is used to perform a rough aggregation process on the above-mentioned “multiple cause events to be clustered” (for example, performing aggregation process on cause events with similar literal expressions, etc.); and the embodiment of the present application does not limit the implementation method of the “first clustering process”, for example, it may specifically include S42101-S42110:
[0239] S42101: Initialize i.
[0240] The embodiment of the present application does not limit the implementation method of S42101. For example, it may specifically be: setting the preset initial value 1 to i (that is, i=1).
[0241] S42102: Initialize a set of events to be extracted based on multiple cause events to be clustered.
[0242] The embodiments of the present application do not limit the implementation method of S42102. For example, it may specifically be: performing group processing on the above-mentioned "multiple cause events to be clustered" to obtain a set of events to be extracted, so that the set of events to be extracted includes all cause events to be clustered.
[0243] S42103: Determine a target cause event and at least one candidate cause event according to the set of events to be extracted.
[0244] The above-mentioned “target cause event” is used to represent the first member in the “i-th event cluster to be processed” below.
[0245] The above-mentioned "at least one candidate cause event" refers to a cause event that may be added to the following "i-th event cluster to be processed", so that the "at least one candidate cause event" is used to represent an optional member of the following "i-th event cluster to be processed".
[0246] In addition, the embodiments of the present application do not limit the implementation methods of S42103. For example, it may specifically include: first randomly extracting a cause event to be clustered from the set of events to be extracted, and determining it as the target cause event; then determining each other cause event to be clustered in the set of events to be extracted except the target cause event as each candidate cause event.
[0247] S42104: Determine the i-th event cluster to be processed according to the target cause event.
[0248] In an embodiment of the present application, after the target cause event is acquired, the i-th event cluster to be processed is initialized according to the target cause event, so that the i-th event cluster to be processed includes the target cause event, thereby making the target cause event the first member of the i-th event cluster to be processed.
[0249] S42105: Determine whether there is a cause event to be aggregated in at least one candidate cause event based on the distance between the hash value of each candidate cause event and the hash value of the target cause event; if so, execute S42106-S42107; if not, execute S42108.
[0250] The hash value of the g-th candidate cause event is used to represent the character information carried by the g-th candidate cause event. g is a positive integer, g≤G, G is a positive integer, and G represents the number of candidate cause events.
[0251] In addition, the embodiments of the present application do not limit the above-mentioned determination process of the "hash value of the g-th candidate cause event". For example, it may specifically include: first performing word segmentation processing on the g-th candidate cause event to obtain the word segmentation result of the g-th candidate cause event; then using a preset hash value algorithm to perform hash value calculation processing on the word segmentation result of the g-th candidate cause event to obtain the hash value of the g-th candidate cause event.
[0252] It should be noted that the embodiments of the present application do not limit the implementation method of the above-mentioned "word segmentation processing", for example, it can be implemented with the help of a language technology platform (Language Technology Plantform, LTP). In addition, the embodiments of the present application do not limit the above-mentioned "preset hash value algorithm", for example, it can be any existing or future hash value calculation method (for example, simhash algorithm, etc.).
[0253] The above-mentioned “hash value of the target cause event” is used to represent the character information carried by the target cause event; and the determination process of the “hash value of the target cause event” is similar to the determination process of the above-mentioned “hash value of the g-th candidate cause event”.
[0254] The above-mentioned "distance between the hash value of the g-th candidate cause event and the hash value of the target cause event" is used to represent the semantic similarity between the g-th candidate cause event and the target cause event; and the embodiment of the present application does not limit the determination process of the "distance between the hash value of the g-th candidate cause event and the hash value of the target cause event", for example, it can be implemented with the aid of any distance calculation method (for example, Hamming distance, Euclidean distance, cosine distance, etc.).
[0255] The above-mentioned “cause event to be aggregated” is used to indicate the cause event that needs to be added to the “i-th event cluster to be processed” below; and the distance between the hash value of the “cause event to be aggregated” and the hash value of the target cause event meets the preset distance condition.
[0256] The above-mentioned "preset distance condition" can be set in advance. For example, if the above-mentioned "distance between the hash value of the g-th candidate cause event and the hash value of the target cause event" is determined with the help of the Hamming distance, then the "preset distance condition" can specifically be: the distance between the hash value of the cause event to be aggregated and the hash value of the target cause event is not higher than the first distance threshold (for example, ≤3).
[0257] It can be seen that for the g-th candidate cause event, after obtaining the above-mentioned "distance between the hash value of the g-th candidate cause event and the hash value of the target cause event", if it is determined that the "distance between the hash value of the g-th candidate cause event and the hash value of the target cause event" meets the preset distance condition (for example, Hamming distance ≤ 3), it can be determined that the semantic information of the g-th candidate cause event is relatively similar to the semantic information of the target cause event, so the g-th candidate cause event can be determined as the cause event to be aggregated; if it is determined that the "distance between the hash value of the g-th candidate cause event and the hash value of the target cause event" does not meet the preset distance condition (for example, Hamming distance > 3), it can be determined that the semantic information of the g-th candidate cause event is far different from the semantic information of the target cause event, so the g-th candidate cause event can be discarded. Wherein, g is a positive integer, g≤G, G is a positive integer, and G represents the number of candidate cause events.
[0258] Based on the above-mentioned S42105 related content, it can be known that after obtaining the target cause event and at least one candidate cause event, the semantic similarity between the target cause event and each candidate cause event can be referred to to determine whether there are cause events to be aggregated among these candidate cause events; if so, these cause events to be aggregated can be added to the i-th event cluster to be processed; if not, the update process of the set of events to be extracted can be directly executed.
[0259] S42106: Add the cause event to be aggregated to the i-th event cluster to be processed.
[0260] In an embodiment of the present application, if it is determined that there is at least one cause event to be aggregated among the above-mentioned "at least one candidate cause event", these candidate cause events are all added to the i-th event cluster to be processed, so that these candidate cause events become members of the i-th event cluster to be processed, so that the i-th event cluster to be processed can better represent a certain cause semantics (for example, assistance, etc.).
[0261] S42107: Delete the target cause event and at least one cause event to be aggregated from the set of events to be extracted, and continue to execute S42109.
[0262] In an embodiment of the present application, after obtaining the target cause event and at least one cause event to be aggregated, the target cause event and all cause events to be aggregated can be directly deleted from the set of events to be extracted, so that the set of events to be extracted no longer includes the target cause event and all cause events to be aggregated, so that the set of events to be extracted no longer includes the cause events involved in the above-mentioned "i-th event cluster to be processed", so that the set of events to be extracted can be used to generate the next event cluster to be processed.
[0263] S42108: Delete the target cause event from the set of events to be extracted, and continue to execute S42109.
[0264] S42109: Determine whether the first stop condition is met, if so, execute S422; if not, execute S42110.
[0265] The above-mentioned "first stop condition" can be preset; and the embodiment of the present application does not limit the "first stop condition", for example, it can be specifically: the set of events to be extracted is an empty set (that is, all cause events to be clustered have been divided into a certain event cluster to be processed).
[0266] It can be seen that after the update of the set of events to be extracted is completed, it can be determined whether the updated set of events to be extracted is an empty set. If it is an empty set, it is determined that all the cause events to be clustered have been divided into a certain event cluster to be processed, so that it can be determined that the coarse aggregation process for these cause events to be clustered has been completed, so the first clustering process can be ended and the second clustering process shown below can be started; if it is not an empty set, it is determined that there are still some cause events to be clustered that have not been divided into any event cluster to be processed, so the next event cluster to be processed can be generated based on the updated set of events to be extracted.
[0267] S42110: Update i and return to execute S42103.
[0268] The embodiment of the present application does not limit the implementation method of S42110. For example, it may specifically include: updating i using formula (11), and continuing to execute S42103 and its subsequent steps.
[0269] i′=i+1 (11)
[0270] Where i′ represents the updated i.
[0271] It can be seen that when it is determined that the first stop condition has not been met, it can be determined that there are still some cause events to be clustered that have not been divided into any event cluster to be processed. Therefore, formula (11) can be used to update i so that the updated i represents the cluster identifier of the next event cluster to be processed, so that the updated set of events to be extracted can be referred to later to continue executing S42103 and its subsequent steps to generate the next event cluster to be processed.
[0272] Based on the relevant content of S421 above, it can be known that after obtaining multiple cause events to be clustered, a first clustering processing can be performed on these cause events to be clustered to obtain at least one event cluster to be processed, so that each event cluster to be processed includes semantically similar cause events (for example, "providing assistance to a certain enterprise", "providing assistance to a certain enterprise", "providing assistance to a certain enterprise", etc.). This is conducive to reducing the complexity of subsequent semantic aggregation processing, thereby helping to improve the clustering effect of cause events.
[0273] S422: According to the semantic features of at least one event cluster to be processed and a plurality of cause events to be clustered, perform a second clustering process on the plurality of cause events to be clustered to obtain at least one cause event cluster.
[0274] The above-mentioned "second clustering processing" is used to perform semantic clustering processing on the above-mentioned "multiple cause events to be clustered" (for example, clustering processing on cause events with similar semantics such as "a certain enterprise is supported" and "promoting a certain enterprise", etc.).
[0275] In addition, the embodiment of the present application does not limit the implementation method of the above-mentioned "second clustering process", for example, it can be implemented by any existing or future clustering method (for example, Louvain algorithm, etc.). Among them, the Louvain algorithm is a community discovery algorithm based on modularity, which performs well in efficiency and effect, and can discover hierarchical community structures, and its optimization goal is to maximize the modularity of the entire community network.
[0276] In order to facilitate understanding of the above-mentioned “second clustering process”, an example is provided below for explanation.
[0277] As an example, when the above-mentioned "second clustering process" is implemented using the Louvain algorithm, S422 may specifically include S4221-S4227:
[0278] S4221: Determine at least one target event cluster from at least one event cluster to be processed, so that each target event cluster satisfies a preset retention condition.
[0279] The above-mentioned "preset retention condition" can be preset. For example, the above-mentioned "preset retention condition" can be specifically: the number of events is higher than the preset threshold value (for example, 3). It can be seen that for the hth event cluster to be processed, if the number of cause events in the hth event cluster to be processed is higher than the preset threshold value, it can be determined that the hth event cluster to be processed meets the preset retention condition; if the number of cause events in the hth event cluster to be processed is not higher than the preset threshold value (that is, ≤ the preset threshold value), it can be determined that the hth event cluster to be processed does not meet the preset retention condition. Wherein, h is a positive integer, h≤H, H is a positive integer, and H represents the number of event clusters to be processed.
[0280] The above-mentioned "target event cluster" refers to a pending event cluster that meets the preset retention condition; and the embodiment of the present application does not limit the determination process of the "target event cluster", for example, it may specifically include: if the hth pending event cluster meets the preset retention condition, then the hth pending event cluster is determined as the target event cluster; if the hth pending event cluster does not meet the preset retention condition, then the hth pending event cluster is dissolved, so that all cause events in the hth pending event cluster are restored to a single cause event node, so that the community initialization processing can be performed based on these target event clusters and these cause event nodes. Wherein, h is a positive integer, h≤H, H is a positive integer, and H represents the number of pending event clusters.
[0281] S4222: Determine at least one cluster community and at least one node community according to at least one target event cluster and a plurality of cause events to be clustered, wherein the cluster community includes at least two cause events to be clustered, and the node community includes one cause event to be clustered.
[0282] As an example, when the number of the above-mentioned “target event clusters” is V, S4222 may specifically include S42221-S42223:
[0283] S42221: Using the vth target event cluster, determine the vth cluster community, so that the vth cluster community includes all cause events in the vth target event cluster, where v is a positive integer, v≤V, and V is a positive integer.
[0284] S42222: Determine at least one cause event node according to V target event clusters and multiple cause events to be clustered.
[0285] The above-mentioned “cause event node” is used to represent the cause event to be clustered that does not belong to any target event cluster.
[0286] In addition, the embodiments of the present application do not limit the implementation method of S42222. For example, it can be specifically: deleting all cause events in V target event clusters from the above "multiple cause events to be clustered" to obtain at least one cause event node, so that these cause event nodes can represent those cause events to be clustered that do not belong to any target event cluster.
[0287] S42223: Determine each cause event node as a node community.
[0288] Based on the relevant content of S4222 above, it can be known that after obtaining at least one target event cluster, these target event clusters and the above "multiple causal events to be clustered" can be used to determine at least one cluster community and at least one node community, so that each cluster community includes at least two causal events to be clustered, and each node community includes only one causal event to be clustered.
[0289] S4223: Initialize at least one community representation node according to the semantic features of the multiple cause events to be clustered, at least one cluster community, and at least one node community.
[0290] The above-mentioned “community representation node” is used to represent a community; and the embodiment of the present application does not limit the determination process of the “community representation node”, for example, it may specifically include step 1-step 2:
[0291] Step 1: If the target community includes at least two cause events to be clustered, the average value of the semantic features of all cause events to be clustered in the target community is determined as a community representation node, so that the community representation node can represent the target community in community merging processing.
[0292] Step 2: If the target community includes a cause event to be clustered, the semantic features of the cause event to be clustered are determined as a community representation node, so that the community representation node can participate in the community merging process on behalf of the target community.
[0293] It should be noted that the above-mentioned “target community” is used to represent any community. For example, the “target community” may be a cluster community or a node community.
[0294] Based on the relevant content of S4223 above, it can be known that after obtaining at least one cluster community and at least one node community, the community representation nodes corresponding to each community can be determined based on the above "semantic features of multiple cause events to be clustered" so that the community representation nodes corresponding to each community can represent the target community in participating in the community merging process.
[0295] S4224: Determine at least one community to be processed according to at least one community representation node.
[0296] As an example, S4224 can be implemented in a manner that maximizes modularity benefits. Based on this, it can be seen that S4224 can be specifically: traversing all community representation nodes, traversing all neighbor nodes of each community representation node, and measuring the modularity benefits before and after the node is added to the community where its neighbor nodes are located, so as to add the community representation node to the community where the neighbor node with the maximum benefit is located; and repeating the above process until the community affiliation of each community representation node no longer changes.
[0297] It should be noted that the above-mentioned "modularity" can be implemented using the modularity calculation formula involved in the existing Louvain algorithm (as shown in formula (12)).
[0298]
[0299] In the formula, α represents the number of edges; A xz represents the edge weight between the xth community representation node and the zth community representation node; k x represents the sum of the edge weights pointing to the xth community representation node; k z represents the sum of the edge weights pointing to the zth community representation node; δ(C x ,C z ) is a function, and when the xth community representation node and the zth community representation node belong to the same community, δ(C x ,C z )=1, when the xth community representation node and the zth community representation node do not belong to the same community, δ(C x ,C z)=0.
[0300] It should also be noted that the distance between two community representation nodes can be determined with the help of cosine distance.
[0301] S4225: Determine whether the second stop condition is met, if so, execute S4227; if not, execute S4226.
[0302] The above-mentioned "second stop condition" may be preset, for example, it may specifically include: the Louvain algorithm is stable (that is, the clustering result reaches stability). It should be noted that the above-mentioned "second stop condition" may be the stop condition of the Louvain algorithm.
[0303] S4226: Update at least one community representation node according to at least one community to be processed, and return to execute S4224.
[0304] In the embodiment of the present application, after determining that the second stop condition has not been met, a community representation node can be abstracted from each community to be processed to obtain at least one updated community representation node, so that S4224 and subsequent steps can be continued based on the "at least one updated community representation node" to implement the next round of clustering process.
[0305] S4227: Determine at least one cause event cluster according to at least one community to be processed.
[0306] In an embodiment of the present application, after determining that the second stop condition has been reached, each community to be processed can be determined as a respective causal event cluster, so that a causal event graph can be subsequently constructed based on these causal event clusters, so as to reduce the number of nodes in the causal event graph while ensuring that the causal event graph expresses relatively rich information. This is beneficial to effectively reduce the node redundancy of the causal event graph, thereby facilitating improving the expression effect of the causal event graph.
[0307] It should be noted that the clustering process shown in S4221 to S4227 above is similar to the existing Louvain algorithm, so the relevant technical concepts involved in S4221 to S4227 above (for example, modularity, modularity benefit, etc.) can refer to the Louvain algorithm.
[0308] Based on the above contents of S421 to S422, it can be known that for a large number of cause events to be clustered, clustering can be performed by means of coarse aggregation and semantic aggregation (e.g. Figure 6As shown), at least one causal event cluster is obtained, so that a causal event graph can be constructed based on these causal event clusters in the future, so as to reduce the number of nodes in the causal event graph while ensuring that the causal event graph has rich information. This is beneficial to effectively reduce the node redundancy of the causal event graph, thereby helping to improve the expression effect of the causal event graph.
[0309] S43: Determine a causal event graph based on at least one cause event cluster and result events corresponding to a plurality of cause events to be clustered.
[0310] The embodiments of the present application do not limit the implementation method of S43. For example, it can be specifically as follows: first, based on at least one cause event cluster, determine each cause type node (for example, assistance type, merger and acquisition type, etc.) in the causal event map, so that each cause type node includes at least one cause event to be clustered; then add the result event (and event role) corresponding to each cause event to be clustered to the causal event map, so that the causal event map can record a large number of causal relationships (or causal event quadruplets).
[0311] In addition, since there may be noise data in the above-mentioned “cause event cluster”, in order to improve the expression effect of the causal event graph, the embodiment of the present application also provides a possible implementation of S43, which may specifically include S431-S432:
[0312] S431: performing noise removal processing on each cause event cluster to obtain each denoised event cluster.
[0313] The f-th denoised event cluster refers to the f-th cause event cluster subjected to noise elimination processing, so that the f-th denoised event cluster is used to represent the f-th cause event cluster that does not include noise data. f is a positive integer, f≤F, F is a positive integer, and F represents the number of cause event clusters.
[0314] In addition, the embodiment of the present application does not limit the determination process of the above-mentioned "fth denoising event cluster", for example, it may specifically include S4311-S4315:
[0315] S4311: Determine, based on the semantic features of all the cause events to be clustered in the f-th cause event cluster, the in-cluster position representation data of each cause event to be clustered in the f-th cause event cluster.
[0316] Among them, "the in-cluster position representation data of the u-th cause event to be clustered in the f-th cause event cluster" is used to represent the distance between the u-th cause event to be clustered in the f-th cause event cluster and the cluster center of the f-th cause event cluster. u is a positive integer, u≤U f ; U f is a positive integer; Uf Represents the number of cause events to be clustered in the fth cause event cluster.
[0317] In addition, the embodiments of the present application do not limit the determination process of the above-mentioned "in-cluster position representation data of the u-th causal event to be clustered in the f-th causal event cluster". For example, it can be specifically as follows: first calculate the distance between the semantic features of the u-th causal event to be clustered and the semantic features of other causal events to be clustered in the f-th causal event cluster except the u-th causal event to be clustered (for example, cosine distance, etc.); then determine the sum (or average) of these distances as the "in-cluster position representation data of the u-th causal event to be clustered in the f-th causal event cluster".
[0318] It should be noted that if the above-mentioned "in-cluster position representation data of the u-th causal event to be clustered in the f-th causal event cluster" is determined with the help of cosine distance, then the larger the "in-cluster position representation data of the u-th causal event to be clustered in the f-th causal event cluster", the closer the u-th causal event to be clustered is to the cluster center of the f-th causal event cluster.
[0319] S4312: According to the intra-cluster position representation data of each cause event to be clustered in the f-th cause event cluster, at least one core event is selected from the f-th cause event cluster, so that the intra-cluster position representation data of each core event satisfies a preset core condition.
[0320] The above-mentioned "preset core condition" can be preset. For example, when the above-mentioned "cluster position characterization data" is determined by means of cosine distance, and the cluster position characterization data of all the cause events to be clustered in the f-th cause event cluster are sorted from large to small, the "preset core condition" can be specifically: the ranking is not higher than the preset ranking threshold (for example, 3).
[0321] The above-mentioned “core event” refers to the cause event to be clustered that meets the preset core condition in the f-th cause event cluster.
[0322] In addition, the embodiments of the present application do not limit the implementation method of S4312. For example, it can be specifically as follows: first, sort the intra-cluster position representation data of all causal events to be clustered in the f-th causal event cluster from large to small to obtain a sorting result; then, each causal event to be clustered whose ranking in the sorting result is not higher than a preset ranking threshold is determined as a core event, so that these core events can effectively represent the cluster center of the f-th causal event cluster.
[0323] Based on the relevant content of S4312 above, it can be known that after obtaining the fth cause event cluster, at least one core event can be screened from the fth cause event cluster according to the intra-cluster position representation data of each cause event to be clustered in the fth cause event cluster, so that the intra-cluster position representation data of each core event meets the preset core condition, so that these core events are relatively close to the cluster center of the fth cause event cluster, so that these core events can effectively represent the cluster center of the fth cause event cluster.
[0324] S4313: Determine the central feature of the f-th cause event cluster based on at least one core event.
[0325] In an embodiment of the present application, after obtaining at least one core event in the f-th cause event cluster, the average value of the semantic features of these core events can be determined as the central feature of the f-th cause event cluster, so that the central feature can represent the cluster center of the f-th cause event cluster, so that noise data screening and processing can be performed subsequently based on the central feature.
[0326] S4314: Based on the distance (for example, cosine distance) between the semantic features of each causal event to be clustered in the f-th causal event cluster and the central feature of the f-th causal event cluster, at least one noise event is screened out from the f-th causal event cluster so that the distance between the semantic features of each noise event and the central feature of the f-th causal event cluster satisfies the preset noise condition.
[0327] The above-mentioned "preset noise condition" can be preset, for example, it can specifically include: the cosine distance between the semantic feature of the noise event and the central feature of the f-th cause event cluster is not higher than the second distance threshold (for example, 0.7).
[0328] It can be seen that for the uth cause event to be clustered in the fth cause event cluster, if the cosine distance between the semantic feature of the uth cause event to be clustered and the central feature of the fth cause event cluster is not higher than the second distance threshold, the uth cause event to be clustered can be considered to meet the preset noise condition; if the cosine distance between the semantic feature of the uth cause event to be clustered and the central feature of the fth cause event cluster is higher than the second distance threshold, it can be determined that the uth cause event to be clustered does not meet the preset noise condition. Wherein, u is a positive integer, u≤U f ; U f is a positive integer; U f Represents the number of cause events to be clustered in the fth cause event cluster.
[0329] The above-mentioned “noise event” is used to represent the noise data in the f-th cause event cluster; and the distance between the semantic feature of the “noise event” and the central feature of the f-th cause event cluster meets the preset noise condition.
[0330] In addition, the embodiment of the present application does not limit the determination process of the above-mentioned "noise event". For example, it may specifically include: if it is determined that the distance between the semantic features of the uth cause event to be clustered in the fth cause event cluster and the central features of the fth cause event cluster meets the preset noise condition, then the uth cause event to be clustered can be determined as a noise event; if it is determined that the distance between the semantic features of the uth cause event to be clustered and the central features of the fth cause event cluster does not meet the preset noise condition, then it can be determined that the uth cause event to be clustered does not belong to noise data. Wherein, u is a positive integer, u≤U f ; U f is a positive integer; U f Represents the number of cause events to be clustered in the fth cause event cluster.
[0331] Based on the relevant content of S4314 above, it can be known that after obtaining the central feature of the f-th cause event cluster, the noise events in the f-th cause event cluster can be determined according to the distance (for example, cosine distance) between the semantic features of each cause event to be clustered in the f-th cause event cluster and the central feature of the f-th cause event cluster, so that the distances of each noise event are distributed in the edge area of the f-th cause event cluster (for example, Figure 7 shown).
[0332] S4315: Delete at least one noise event from the f-th cause event cluster to obtain the f-th denoised event cluster.
[0333] In an embodiment of the present application, after obtaining at least one noise event in the f-th cause event cluster, these noise events can be deleted from the f-th cause event cluster to obtain the f-th denoised event cluster, so as to ensure that the semantic similarity between all cause events to be clustered in the f-th denoised event cluster is relatively large, and to ensure that the inter-cluster distance between the f-th denoised event cluster and other denoised event clusters is relatively large.
[0334] Based on the relevant contents of S4311 to S4315 above, it can be known that after obtaining the f-th cause event cluster, we can first refer to the semantic distribution of each cause event to be clustered in the f-th cause event cluster to determine the noise events in the f-th cause event cluster; then delete these noise events from the f-th cause event cluster to obtain the f-th denoised event cluster, so that the f-th denoised event cluster can better represent the semantic commonalities between all cause events to be clustered in the f-th denoised event cluster.
[0335] Based on the relevant content of S431 above, it can be known that after obtaining the fth cause event cluster, the fth cause event cluster can be subjected to noise extraction processing to obtain the fth denoised event cluster, so that the fth denoised event cluster only includes those cause events to be clustered that are relatively close to the cluster center of the fth cause event cluster, and does not include those cause events to be clustered that are far from the cluster center of the fth cause event cluster, so that the fth denoised event cluster can better represent the semantic commonality between all cause events to be clustered in the fth denoised event cluster. Wherein, f is a positive integer, f≤F, F is a positive integer, and F represents the number of cause event clusters.
[0336] S432: Determine a causal event graph according to at least one denoised event cluster and result events corresponding to the cause events to be clustered in the at least one denoised event cluster.
[0337] In an embodiment of the present application, after obtaining at least one denoised event cluster, a causal event graph can be determined based on these denoised event clusters and the result events (and event roles) corresponding to the cause events to be clustered in these denoised event clusters, so that the causal event graph has a better expression effect.
[0338] Based on the relevant contents of S431 to S432 above, it can be known that after obtaining at least one causal event cluster, these causal event clusters can be first subjected to noise removal processing to obtain some denoised event clusters; and then, based on these denoised event clusters, a causal event map is determined so that the causal event map has a better expression effect, which is conducive to improving the construction effect of the causal event map.
[0339] Based on the relevant contents of S41 to S43 above, it can be known that after obtaining at least one cause event to be used and the result event corresponding to the at least one cause event to be used, these cause events to be used can be clustered to obtain clustering results; then, according to the cause event to be used and the result events corresponding to these cause events to be used, a causal event map is constructed so that the causal event map can have a better expression effect, which is conducive to improving the construction effect of the causal event map.
[0340] Method Example 6
[0341] In addition, in order to improve the semantic extraction effect for a causal event, the embodiment of the present application also provides a possible implementation method for determining the above "semantic features of the rth causal event to be clustered", which may specifically include: determining the semantic features of the rth causal event to be clustered based on the rth causal event to be clustered and a pre-built semantic representation model.
[0342] The above-mentioned “semantic representation model” is used to perform semantic representation processing on the input data of the semantic representation model; and the embodiments of the present application do not limit the “semantic representation model”, for example, the “semantic representation model” can be a machine learning model.
[0343] In order to facilitate understanding of the working principle of the above-mentioned "semantic representation model", the following is an example of the process of determining the "semantic features of the rth cause event to be clustered" to illustrate.
[0344] As an example, the process of determining “the semantic features of the rth cause event to be clustered” by using the semantic representation model may specifically include steps 61 to 64:
[0345] Step 61: Perform word segmentation processing on the rth cause event to be clustered to obtain word block tag data of the rth cause event to be clustered.
[0346] The above-mentioned “chunk tag data of the rth cause event to be clustered” is used to describe the position of each word in the rth cause event to be clustered in the rth cause event to be clustered; and the embodiment of the present application does not limit the “chunk tag data of the rth cause event to be clustered”, for example, it can be used Figure 8 The "chunk marking" shown is implemented.
[0347] Step 62: Determine a second text feature according to the rth cause event to be clustered and the word block tag data of the rth cause event to be clustered.
[0348] The above-mentioned “second text feature” is used to represent the character information carried by the r-th cause event to be clustered and the word segmentation position information in the r-th cause event to be clustered.
[0349] In addition, the embodiments of the present application do not limit the determination process of the above-mentioned "second text feature". For example, it may specifically include: determining the second text feature by adding the word embedding vector of the rth cause event to be clustered, the position description vector of the rth cause event to be clustered, and the representation vector of the word block tag data of the rth cause event to be clustered.
[0350] It should be noted that the above-mentioned “representation vector of the chunk mark data of the r-th cause event to be clustered” is used to represent the chunk mark data of the r-th cause event to be clustered; and the embodiment of the present application does not limit the “representation vector of the chunk mark data of the r-th cause event to be clustered”. For example, the chunk mark data of the r-th cause event to be clustered can be directly determined as the “representation vector of the chunk mark data of the r-th cause event to be clustered”. For another example, word2vec can be used to vectorize the chunk mark data of the r-th cause event to be clustered to obtain the “representation vector of the chunk mark data of the r-th cause event to be clustered”.
[0351] Step 63: Input the second text feature into the semantic representation model to obtain semantic representation data output by the semantic representation model.
[0352] The embodiment of the present application does not limit the model structure of the above-mentioned "semantic representation model", for example, it may include: a third encoding layer and a semantic representation layer; and the input data of the semantic representation layer includes the output data of the third encoding layer (such as Figure 8 shown).
[0353] The above-mentioned "third encoding layer" is used to encode the input data of the third encoding layer; and the embodiment of the present application does not limit the implementation method of the "third encoding layer". For example, when the above-mentioned "semantic representation model" is implemented using the transformer's domain network sentence-BERT+BILSTM, the "third encoding layer" can be implemented using sentence-BERT.
[0354] It should be noted that the above “sentence-bert+BILSTM” can perform deep semantic vectorization representation for one (or two) text data. In addition, the above “sentence-bert” includes the 6-layer structure of the encoder end in the transformer architecture.
[0355] The above-mentioned "semantic representation layer" is used to perform semantic representation processing on the input data of the semantic representation layer; and the embodiments of the present application do not limit the implementation method of the "semantic representation layer". For example, when the above-mentioned "semantic representation model" is implemented using the transformer's domain network sentence-BERT+BILSTM, the "semantic representation layer" can be implemented using a bidirectional long short-term memory network (Bi-directional Long Short-Term Memory, BILSTM).
[0356] In addition, the embodiments of the present application do not limit the construction process of the above-mentioned "semantic representation model". For example, it can be implemented by using any existing or future model construction method (for example, pre-training + model fine-tuning, etc.). For another example, the construction process of the above-mentioned "semantic representation model" can specifically include steps 71 to 73:
[0357] Step 71: Obtain triplet samples.
[0358] The above “triplet sample” can be expressed as (anchor data, positive example, negative example). For example, the “triplet sample” can be Fig. 9 The text data triples shown in FIG. 1 , where “anchor data”, “positive examples” and “negative examples” are all text data.
[0359] In addition, the implementation of this application is not limited to the above-mentioned "triplet samples", for example, they can be obtained by crawling on the Internet.
[0360] Step 72: Using the model to be trained, determine the semantic representation of each text data in the triple sample.
[0361] The above-mentioned “model to be trained” is used to perform semantic representation processing on the input data of the model to be trained; and the model structure of the “model to be trained” is consistent with the model structure of the above-mentioned semantic representation model.
[0362] Step 73: Determine whether the third stop condition is met, if so, execute step 75; if not, execute step 74.
[0363] The above-mentioned "third stop condition" can be preset, for example, it can be specifically: the model to be trained reaches convergence (that is, the rate of change of the prediction loss of the model to be trained is lower than the preset rate of change threshold).
[0364] Step 74: Update the model to be trained according to the semantic representation of each text data in the triple sample and the preset loss function, and continue to execute step 72.
[0365] The above-mentioned “preset loss function” is used to calculate the prediction loss of the model to be trained; and the embodiment of the present application does not limit the “preset loss function”. For example, it can be implemented using any existing or future model loss function (for example, the Triplet loss function shown in formula (13)).
[0366] L model =max(d(TF2,TF1)-d(TF3,TF1)+margin,0) (13)
[0367] Where, L modelRepresents the prediction loss of the model to be trained; TF1 represents the semantic representation of the anchor data in the triplet sample; TF2 represents the semantic representation of the positive example in the triplet sample; TF3 represents the semantic representation of the negative example in the triplet sample; margin represents a configurable parameter in the Triplet loss function.
[0368] In addition, the above-mentioned "model to be trained" is trained using an unsupervised training method; and the training goal of the "model to be trained" is: for a triple sample, the distance between the semantic representation of the positive example in the triple sample and the semantic representation of the anchor data in the triple sample is relatively close; and the distance between the semantic representation of the negative example in the triple sample and the semantic representation of the anchor data in the triple sample is relatively far.
[0369] In addition, the embodiments of the present application do not limit the updating process of the model to be trained. For example, any existing or future model updating method can be used for implementation.
[0370] Step 75: Determine a semantic representation model based on the model to be trained.
[0371] In the embodiment of the present application, after determining that the third stop condition is met, it can be determined that the model to be trained has reached convergence, so the model to be trained can be directly determined as a semantic representation model so that the semantic representation model has better semantic representation performance.
[0372] Based on the relevant contents of steps 71 to 75 above, it can be known that in some cases, a semantic representation model can be constructed with the help of triple samples and unsupervised training methods so that the semantic representation model has better semantic representation performance, so that the semantic representation model can be used to perform semantic representation processing on a text data in the future.
[0373] The “semantic representation data” in step 63 is used to represent the semantic information carried by the above-mentioned “second text feature”.
[0374] Based on the relevant content of the above step 63, it can be known that after obtaining the second text feature, the second text feature can be input into the semantic representation model so that the semantic representation model can perform semantic representation data on the second text feature, obtain and output the semantic representation data, so that the semantic representation data can represent the semantic information carried by the second text feature.
[0375] Step 64: Determine the semantic features of the rth cause event to be clustered based on the semantic representation data.
[0376] The embodiment of the present application does not limit the implementation of step 64. For example, it may specifically include: determining the semantic representation data as the semantic features of the rth cause event to be clustered. For another example, step 64 may specifically include: performing maximum pooling processing on the semantic representation data to obtain the semantic features of the rth cause event to be clustered.
[0377] Based on the relevant contents of steps 61 to 64 above, it can be known that after obtaining the rth causal event to be clustered, the semantic features of the rth causal event to be clustered can be determined based on the rth causal event to be clustered and the word block marking data of the rth causal event to be clustered, so that the "semantic features of the rth causal event to be clustered" can more accurately represent the semantic information carried by the rth causal event to be clustered, which is conducive to improving the construction effect of the causal event map.
[0378] Method Example 7
[0379] In addition, in order to further improve the information diversity of the causal event graph, the embodiment of the present application also provides another possible implementation method for constructing the causal event graph, which may specifically include steps 81 and 82:
[0380] Step 81: Determine event attribute description information to be used according to the text to be used.
[0381] The above-mentioned "event attribute description information to be used" is used to represent the event attributes of the causal event in the text to be used. Among them, the event attributes may include at least one of event type, trigger word, subject, object, occurrence time, end time, duration, and location.
[0382] In addition, the embodiment of the present application does not limit the above-mentioned "event attribute description information to be used", for example, it may include Fig.10 The "Event Attribute Description Information" shown.
[0383] In addition, the embodiment of the present application does not limit the determination process of the above-mentioned “event attribute description information to be used”. For example, when the above-mentioned “event attribute description information to be used” includes the event type to be used, the event trigger word to be used, and the event parameter information to be used, the determination process of the “event attribute description information to be used” may include steps 811-812:
[0384] Step 811: Determine the event trigger word to be used and the event type to be used according to the text to be used.
[0385] The above-mentioned “trigger words of the event to be used” refer to the trigger words content of the causal event in the text to be used.
[0386] The above-mentioned “event type to be used” refers to the event type to which the causal event in the text to be used belongs.
[0387] In addition, the embodiment of the present application does not limit the implementation method of step 811. For example, it may specifically include: inputting the text to be used into a pre-constructed first determination model to obtain the event trigger word to be used and the event type to be used output by the first determination model.
[0388] The above-mentioned "first determination model" is used to extract trigger words and event types for the input data of the first determination model; and the embodiment of the present application does not limit the "first determination model", for example, it can be a machine learning model.
[0389] In addition, the embodiments of the present application do not limit the model structure of the above-mentioned "first determination model". For example, the "first determination model" may include a fourth encoding layer and a fourth decoding layer; and the input data of the fourth decoding layer includes the output data of the fourth encoding layer.
[0390] The above-mentioned "fourth coding layer" is used to encode the input data of the fourth coding layer; and the embodiment of the present application does not limit the "fourth coding layer", for example, it can be implemented by any existing or future coding network (for example, BERT). It should be noted that the above-mentioned "fourth coding layer" is similar to the above-mentioned "first coding layer".
[0391] In addition, the embodiments of the present application do not limit the above-mentioned "input data of the fourth coding layer". For example, when the fourth coding layer is implemented using BERT, the input data of the fourth coding layer can be the original inherent input of BERT. That is, the "input data of the fourth coding layer" can be the sum of a word embedding vector (word embeddings) of a text data, a sentence segmentation vector (segmentation embeddings) of the text data, and a position description vector (position embeddings) of the text data.
[0392] The above-mentioned "fourth decoding layer" is used to perform decoding processing on the input data of the fourth decoding layer; and the embodiment of the present application does not limit the implementation method of the "fourth decoding layer", for example, it may include a second interactive network, a fourth pointer network and a first determination network; and the input data of the fourth pointer network includes the output data of the second interactive network, and the input data of the first determination network includes the output data of the fourth pointer network.
[0393] In order to facilitate understanding of the working principle of the above-mentioned "fourth decoding layer", the following is explained by taking the determination process of the above-mentioned "event trigger words to be used and event types to be used" as an example.
[0394] As an example, the process of determining the "event trigger word to be used and the event type to be used" by using the above-mentioned "fourth decoding layer" may specifically include steps 8111 to 8114:
[0395] Step 8111: Determine the third coding feature based on the text to be used and the fourth coding layer.
[0396] The above-mentioned "third coding feature" is used to represent the text information carried by the text to be used; and the embodiment of the present application does not limit the determination process of the "third coding feature". For example, it can be implemented using any implementation method of step 21 above. It only needs to replace the "first coding feature" in any implementation method of step 21 above with the "third coding feature", the "first coding layer" with the "fourth coding layer", and the "cause event extraction model" with the "first determination model".
[0397] Step 8112: Input the third coding feature into the second interaction network to obtain a second interaction result output by the second interaction network.
[0398] The above-mentioned “second interaction result” refers to the result of semantic interaction processing on the third coding feature, so that the “second interaction result” is used to represent the association between at least one candidate causal event type and the trigger word in the text to be used.
[0399] In addition, the embodiments of the present application do not limit the above-mentioned "second interaction result". For example, when the number of the above-mentioned "candidate causal event types" is K, the "second interaction result" may include the second interaction features corresponding to the K candidate causal event types. Among them, the "second interaction feature corresponding to the kth candidate causal event type" is used to indicate the correlation between the kth candidate causal event type and the trigger word in the text to be used. k is a positive integer, k≤K, and K is a positive integer.
[0400] In addition, the embodiments of the present application do not limit the determination process of the above-mentioned "second interaction feature corresponding to the kth candidate causal event type". For example, it may specifically include: performing semantic interaction processing on the representation feature of the kth candidate causal event type and the third coding feature to obtain the "second interaction feature corresponding to the kth candidate causal event type".
[0401] In addition, the embodiment of the present application does not limit the implementation method of step 8112. For example, it can be implemented using any implementation method of step 22 above. It only needs to replace the "first coding feature" in any implementation method of step 22 above with the "third coding feature", the "first interaction network" with the "second interaction network", the "first interaction result" with the "second interaction result", and the "first interaction feature" with the "second interaction feature".
[0402] Step 8113: Input the second interaction result into the fourth pointer network to obtain the first recognition result output by the fourth pointer network.
[0403] The above-mentioned "first recognition result" is used to represent the location description information of the trigger word related to at least one candidate causal event type carried by the text to be used; and the "first recognition result" may include K trigger word recognition results and the event type identifiers corresponding to the K trigger word recognition results.
[0404] The “kth trigger word recognition result” is used to represent the location description information of the trigger word related to the kth candidate causal event type carried by the text to be used. Wherein, k is a positive integer, k≤K, and K is a positive integer.
[0405] The “event type identifier corresponding to the k-th trigger word recognition result” is used to uniquely identify the k-th candidate causal event type.
[0406] The above-mentioned "fourth pointer network" is used to perform trigger word location processing on the input data of the fourth pointer network.
[0407] In addition, the embodiment of the present application does not limit the working principle of the "fourth pointer network". For example, when the above-mentioned "second interaction result" includes the second interaction features corresponding to K candidate causal event types, the working principle of the "fourth pointer network" (that is, step 8113) may specifically include steps 81131-81132:
[0408] Step 81131: Perform full connection processing on the second interaction feature corresponding to the k-th candidate causal event type to obtain a second full connection result, where k is a positive integer, k≤K.
[0409] It should be noted that step 81131 can be implemented using any implementation of step 231 above, by simply replacing the "first interaction feature" in any implementation of step 231 above with the "second interaction feature" and the "first full connection result" with the "second full connection result".
[0410] Step 81132: According to the second full connection result, determine the kth trigger word recognition result and the event type identifier corresponding to the kth trigger word recognition result, where k is a positive integer, k≤K.
[0411] The embodiment of the present application does not limit the implementation method of step 81132. For example, it can be implemented with the help of formulas (14)-(15).
[0412]
[0413]
[0414] In the formula, Indicates the k-th trigger word recognition result; Represents the second full connection result; Indicates the event type identifier corresponding to the k-th trigger word recognition result; W represents the type identifier of the k-th candidate causal event type; Trigger , and b Trigger They are all network parameters in the fourth pointer network, and these network parameters can be updated and determined in the construction process of the above-mentioned "first determination model".
[0415] Based on the relevant content of the above step 8113, it can be known that for the fourth pointer network, it can use a fully connected layer and a softmax function to determine the position description information of the trigger word related to the kth candidate causal event type carried by the text to be used. Wherein, k is a positive integer, k≤K, and K is a positive integer.
[0416] Step 8114: Determine the event trigger word to be used and the event type to be used according to the first recognition result and the first determination network.
[0417] As an example, when the above-mentioned “first recognition result” includes K trigger word recognition results and event type identifiers corresponding to the K trigger word recognition results, step 8114 may specifically include steps 81141 to 81144:
[0418] Step 81141: According to the k-th trigger word recognition result, determine whether there is a trigger word related to the k-th candidate causal event type in the text to be used; if so, execute steps 81142-81143; if not, execute step 81144. Wherein, k is a positive integer, k≤K.
[0419] In an embodiment of the present application, after obtaining the kth trigger word recognition result, if there is a trigger word position marker (for example, "1") in the kth trigger word recognition result, it can be determined that there is a trigger word related to the kth candidate causal event type in the text to be used, so based on the kth trigger word recognition result and the event type identifier corresponding to the kth trigger word recognition result, the event trigger word to be used related to the kth candidate causal event type and the corresponding event type to be used can be determined; however, if there is no trigger word position marker in the kth trigger word recognition result, it can be determined that there is no trigger word related to the kth candidate causal event type in the text to be used, so the kth trigger word recognition result and the event type identifier corresponding to the kth trigger word recognition result can be directly discarded. Wherein, k is a positive integer, k≤K.
[0420] Step 81142: Determine the trigger word position according to the k-th trigger word recognition result; and extract the event trigger word to be used from the text to be used according to the trigger word position, where k is a positive integer, k≤K.
[0421] In an embodiment of the present application, if the kth trigger word recognition result indicates that there is a trigger word related to the kth candidate causal event type in the text to be used, the trigger word position marker in the kth trigger word recognition result can be referred to to determine the trigger word position, so that the trigger word related to the kth candidate causal event type can be extracted from the text to be used according to the trigger word position and determined as the event trigger word to be used.
[0422] Step 81143: Determine the event type to be used according to the event type identifier corresponding to the k-th trigger word recognition result, where k is a positive integer, k≤K.
[0423] In an embodiment of the present application, if the kth trigger word recognition result indicates that there is a trigger word related to the kth candidate causal event type in the text to be used, then the event type identifier corresponding to the kth trigger word recognition result can be referred to to determine the event type to which the trigger word related to the kth candidate causal event type belongs, as the event type to be used corresponding to the event trigger word to be used extracted from the text to be used.
[0424] Step 81144: discard the k-th trigger word recognition result and the event type identifier corresponding to the k-th trigger word recognition result, where k is a positive integer, k≤K.
[0425] In an embodiment of the present application, if the kth trigger word recognition result indicates that there is no trigger word related to the kth candidate causal event type in the text to be used, the kth trigger word recognition result and the event type identifier corresponding to the kth trigger word recognition result can be directly discarded.
[0426] Based on the relevant content of the above step 8114, it can be known that for the above "first determination model", after obtaining the first recognition result, the first determination network in the first determination model can refer to the first recognition result to extract trigger words from the text to be used, and obtain the event trigger words to be used and the event type to be used corresponding to the event trigger words to be used.
[0427] It should be noted that the above-mentioned "first determination model" can be constructed in advance based on the sixth sample text and the label information of the sixth sample text. Among them, the "label information of the sixth sample text" is used to represent the actual trigger word and the actual event type of the causal event in the sixth sample text; and the embodiment of the present application does not limit the method of obtaining the "label information of the sixth sample text", for example, it can be implemented by manual annotation. In addition, the embodiment of the present application does not limit the construction process of the above-mentioned "causal event extraction model", and can be implemented using any existing or future model construction method.
[0428] Based on the relevant content of the above step 811, it can be known that after obtaining the text to be used, the trigger words and event types can be analyzed and processed for the text to be used to obtain each event trigger word to be used and the event type to be used corresponding to each event trigger word to be used, so that other attribute information (for example, subject, object, occurrence time, end time, duration, location, etc.) can be extracted from the text to be used based on these two items of attribute information.
[0429] Step 812: Determine the event parameter information to be used according to the event trigger word to be used, the event type to be used and the text to be used.
[0430] The above-mentioned "event parameter information to be used" refers to the parameter information of the causal event in the text to be used; and the embodiment of the present application does not limit the "parameter information", for example, it may include at least one other attribute information besides the trigger word and event type (for example, at least one of the subject, object, occurrence time, end time, duration, and location).
[0431] In addition, the embodiment of the present application does not limit the implementation method of determining the above-mentioned "event parameter information to be used", for example, it may specifically include steps 8121-8122:
[0432] Step 8121: Determine the third text feature according to the event trigger word to be used, the event type to be used, and the text to be used.
[0433] The above-mentioned “third text feature” is used to represent the character information carried by the text to be used, the character information carried by the event trigger word to be used, and the character information carried by the event type to be used.
[0434] In addition, the embodiment of the present application does not limit the determination process of the above-mentioned "third text feature". For example, it can be implemented using formulas (16)-(17).
[0435]
[0436]
[0437] In the formula, input parameter represents a third text feature; The word embedding vector representing the event trigger word to be used; The word embedding vector representing the event type to be used; The word embedding vector representing the text to be used; A position description vector representing the text to be used; The characterization vector representing the text position identification data of the event trigger word to be used, so that It is used to indicate the position of the event trigger word to be used in the text to be used; E [CLS] Represents the word embedding vector of [CLS]; E [SEP] It should be noted that the embodiment of the present application is not limited to the above The determination process can be implemented, for example, by means of word2vec. For another example, the text position identification data of the event trigger word to be used can be directly determined as In addition, for the relevant content of [CLS] and [SEP], please refer to the BERT algorithm.
[0438] The above-mentioned “text position identification data of the event trigger word to be used” is used to describe the position of the event trigger word to be used in the text to be used; and the embodiment of the present application does not limit the “text position identification data of the event trigger word to be used”, for example, it can be similar to Fig.11 The trigger word tags shown.
[0439] Based on the third text feature shown in the above formulas (16)-(17), it can be seen that the third text feature can not only represent the character information carried by the text to be used, the character information carried by the event trigger word to be used, and the character information carried by the event type to be used, but also can represent the position of the event trigger word to be used in the text to be used. This is helpful in assisting in improving the parameter information extraction capability of the "second determination model" below, so that the "second determination model" can more easily extract at least one parameter information from the text to be used.
[0440] Step 8122: Input the third text feature into the pre-constructed second determination model to obtain the event parameter information to be used output by the second determination model.
[0441] The above-mentioned "second determination model" is used to perform parameter information extraction processing on the input data of the second determination model; and the embodiment of the present application does not limit the "second determination model", for example, it can be implemented using any machine learning model.
[0442] In addition, the embodiment of the present application does not limit the model structure of the above-mentioned "second determination model", for example, it can be a fifth encoding layer and a fifth decoding layer; and the input data of the fifth decoding layer includes the output data of the fifth encoding layer (such as Fig.11 shown).
[0443] The above-mentioned "fifth coding layer" is used to encode the input data of the fifth coding layer; and the embodiment of the present application does not limit the "fifth coding layer", for example, it can be implemented by any existing or future coding network (for example, BERT).
[0444] The above-mentioned "fifth decoding layer" is used to perform decoding processing on the input data of the fifth decoding layer; and the embodiment of the present application does not limit the implementation method of the "fifth decoding layer", for example, the "fifth decoding layer" may include a fifth pointer network and a second determination network; and the input data of the second determination network includes the output data of the fifth pointer network.
[0445] The above-mentioned "fifth pointer network" is used to perform parameter identification processing on the input data of the fifth pointer network; and the working principle of the "fifth pointer network" is similar to the working principle of the above-mentioned "second pointer network".
[0446] The above-mentioned "second determination network" is used to perform parameter information parsing processing on the input data of the second determination network; and the embodiment of the present application does not limit the working principle of the "second determination network". For example, when the above-mentioned "fifth pointer network" outputs the second recognition result, the working principle of the "second determination network" may specifically include steps 91-92:
[0447] Step 91: According to the second recognition result, determine whether there is description information of the lth candidate parameter in the text to be processed; if yes, execute steps 92-93; if no, execute step 94. Wherein, l is a positive integer, l≤L, L is a positive integer, and L represents the number of candidate parameters.
[0448] The above-mentioned "second recognition result" refers to the output data of the fifth pointer network, so that the "second recognition result" is used to indicate the position of at least one parameter information in the text to be used; and the embodiment of the present application does not limit the "second recognition result", for example, it can use different parameter position markers to mark the positions of different parameter information.
[0449] The above-mentioned "lth candidate parameter" refers to a parameter that a text data may carry; and the embodiment of the present application does not limit L candidate parameters. For example, the "L candidate parameters" may include subject, object, occurrence time, end time, duration, and location.
[0450] The above-mentioned “description information of the lth candidate parameter” refers to the parameter value of the lth candidate parameter.
[0451] In an embodiment of the present application, after obtaining the second recognition result, if it is determined that a target parameter position marker for marking the lth candidate parameter exists in the second recognition result, it can be determined that descriptive information of the lth candidate parameter exists in the text to be processed, so the second recognition result can be referred to and the descriptive information of the lth candidate parameter can be extracted from the text to be processed; however, if it is determined that there is no target parameter position marker for marking the lth candidate parameter in the second recognition result, the descriptive information of the lth candidate parameter cannot be extracted from the text to be processed.
[0452] Step 92: Determine the position of the parameter to be used according to the second recognition result; and extract the description information of the lth candidate parameter from the text to be processed according to the position of the parameter to be used.
[0453] The above-mentioned “parameter position to be used” is used to indicate the position of the description information of the lth candidate parameter in the text to be used.
[0454] It can be seen that if the second recognition result indicates that there is descriptive information of the lth candidate parameter in the text to be processed, the position of the parameter to be used can be determined first based on the second recognition result, so that the position of the parameter to be used can indicate the position of the descriptive information of the lth candidate parameter in the text to be used; and then the descriptive information of the lth candidate parameter is extracted from the text to be processed according to the position of the parameter to be used.
[0455] Step 93: Determine the event parameter information to be used according to the description information of the lth candidate parameter.
[0456] In the present application, after obtaining description information of L candidate parameters, the description information of these candidate parameters can be collectively processed to obtain event parameter information to be used, so that the event parameter information to be used can better represent the causal event attributes carried by the text to be used.
[0457] Step 94: Determine the preset information as the description information of the lth candidate parameter.
[0458] The above-mentioned "preset information" can be preset. For example, the "preset information" can be blank or a preset character (for example, none).
[0459] Based on the relevant contents of steps 91 to 94 above, it can be known that the above-mentioned "second determination network" can perform parameter information analysis and processing on the output data of the fifth pointer network, obtain and output the event parameter information to be used, so that the event parameter information to be used can better represent the causal event attributes carried by the text to be used.
[0460] It should be noted that the above-mentioned "second determination model" can be constructed in advance based on the seventh sample text and the label information of the seventh sample text. Among them, the "label information of the seventh sample text" is used to represent the actual trigger word and the actual event type of the causal event in the seventh sample text; and the embodiment of the present application does not limit the method of obtaining the "label information of the seventh sample text", for example, it can be implemented by manual annotation. In addition, the embodiment of the present application does not limit the construction process of the above-mentioned "causal event extraction model", and can be implemented using any existing or future model construction method.
[0461] It should also be noted that in order to further improve the effect of attribute extraction, the above "first determination model" and the above "second determination model" can be jointly constructed (for example, the model structure of the "first determination model" and the model structure of the "second determination model" can be referred to first to generate a joint model; and then with the help of the training process of the joint model, the construction process of the "first determination model" and the "second determination model" can be realized); and the joint construction process is implemented based on the eighth sample text and the label information of the eighth sample text. Among them, the "label information of the eighth sample text" is used to represent the actual attribute description information of the causal event in the eighth sample text.
[0462] Based on the relevant content of the above step 81, it can be known that after obtaining the text to be used, not only can causal events and event roles of causal events be extracted from the text to be used, but also attribute information of causal events can be extracted from the text to be used, so that causal events, event roles of causal events, and attribute information of causal events can be extracted based on reference to construct a causal event map.
[0463] Step 82: Determine a causal event graph according to at least one cause event to be used, a result event corresponding to the at least one cause event to be used, and attribute description information of the event to be used.
[0464] It should be noted that the implementation of step 82 is similar to the implementation of S4 above.
[0465] Based on the relevant contents of steps 81 to 82 above, it can be known that after obtaining the text to be used, the causal events, the event roles of the causal events, and the attribute information of the causal events can be extracted from the text to be used first; then, referring to these causal events, the event roles of these causal events, and the attribute information of these causal events, a causal event map is constructed so that the causal event map records richer causal relationship description information, thereby making the causal event map have a better expression effect, which is conducive to improving the construction effect of the causal event map.
[0466] Method Example 8
[0467] In addition, in order to further improve the model building effect, a large amount of sample text data (for example, a large amount of first sample text, a large amount of second sample text, ..., or a large amount of eighth sample text) required for model building can be obtained by means of data augmentation. For ease of understanding, the following is implemented in the manner of obtaining a large amount of target sample text.
[0468] As an example, the process of acquiring a large amount of target sample text includes steps 101 to 103:
[0469] Step 101: crawl at least one news text from the Internet.
[0470] It should be noted that the “news text” involved in step 101 meets the text content requirements of the above-mentioned “target sample text” (for example, carrying causal events, etc.).
[0471] Step 102: Generate at least one first generated text using a preset translation tool and at least one news text.
[0472] The above-mentioned “preset translation tool” can be preset. For example, the “preset translation tool” can be a Chinese-English translation tool.
[0473] The embodiment of the present application does not limit the implementation method of step 102. For example, when the above-mentioned "preset translation tool" is a Chinese-English translation tool, step 102 may specifically include: for each news text, the preset translation tool can be used to translate the news text into English text first; and then the preset translation tool can be used to translate the English text into Chinese to obtain a first generated text.
[0474] Step 103: Generate at least one second generated text using the pre-trained language model and at least one news text.
[0475] The embodiment of the present application does not limit the implementation method of step 103. For example, it may specifically include: for a news text, vocabulary masking processing may be first performed on the news text to obtain a masked text, so that the masked text still meets the text content requirements of the above-mentioned "target sample text"; and then the pre-trained language model is used to predict the masked text to obtain a second generated text.
[0476] As an example, when the above-mentioned "news text" is "Starting from XXX month of XXX year, the first enterprise has significantly increased its support measures for a certain enterprise, and has taken a certain enterprise as a preferential treatment target", and the above-mentioned "target sample text" is the "sixth sample text" mentioned above, the "news text" can be masked to obtain the masked text "Starting from XXX month of XXX year, [MASK] [MASK][MASK][MASK] has significantly increased its support measures for a certain enterprise, and has taken a certain enterprise as a preferential treatment target"; then the pre-trained language model is used to predict the masked text to obtain a second generated text "Starting from XXX month of XXX year, the second enterprise has significantly increased its support measures for a certain enterprise, and has taken a certain enterprise as a preferential treatment target". It should be noted that "the first enterprise" refers to the name of one enterprise; "the second enterprise" refers to the name of another enterprise.
[0477] Step 104: performing collective processing on at least one news text, at least one first generated text, and at least one second generated text to obtain a large number of target sample texts.
[0478] In an embodiment of the present application, after obtaining at least one first generated text and at least one second generated text, these first generated texts and these second generated texts can be used to perform data expansion processing on these news texts to obtain a large number of target sample texts, which is beneficial to increase the data volume of the target sample texts and thus help improve the model building effect.
[0479] Based on the graph construction method provided in the above method embodiment, the embodiment of the present application also provides a graph construction device, which is explained and illustrated below in conjunction with the accompanying drawings.
[0480] Device Embodiment
[0481] The device embodiment introduces the atlas construction device, and related content can be found in the above method embodiment.
[0482] See also Fig.13 , which is a structural schematic diagram of a graph construction device provided in an embodiment of the present application.
[0483] The graph construction device 1300 provided in the embodiment of the present application includes:
[0484] The text acquisition unit 1301 is used to acquire the text to be used; wherein the text to be used includes at least one set of causal events;
[0485] A reason extraction unit 1302, configured to extract at least one reason event to be used from the text to be used;
[0486] A result extraction unit 1303 is used to determine the result event corresponding to each of the cause events to be used according to each of the cause events to be used and the text to be used;
[0487] The graph construction unit 1304 is used to determine a causal event graph according to the at least one cause event to be used and the result event corresponding to the at least one cause event to be used.
[0488] In a possible implementation, the cause extraction unit 1302 is specifically used to: input the text to be used into a pre-constructed cause event extraction model to obtain the at least one cause event to be used output by the cause event extraction model; wherein the cause event extraction model includes a first encoding layer and a first decoding layer; the input data of the first decoding layer includes the output data of the first encoding layer.
[0489] In a possible implementation manner, the first decoding layer includes a first interaction network, a first pointer network, and a cause determination network;
[0490] The process of determining the at least one cause event to be used includes: determining a first coding feature based on the text to be used and the first coding layer; inputting the first coding feature into the first interactive network to obtain a first interactive result output by the first interactive network; inputting the first interactive result into the first pointer network to obtain cause location description data output by the first pointer network; and determining the at least one cause event to be used based on the cause location description data and the cause determination network.
[0491] In a possible implementation, the first interaction result includes first interaction features corresponding to K candidate causal event types, and the process of determining the first interaction feature corresponding to the kth candidate causal event type includes: performing semantic interaction processing on the representation feature of the kth candidate causal event type and the first coding feature to obtain the first interaction feature corresponding to the kth candidate causal event type; wherein k is a positive integer, k≤K, and K is a positive integer.
[0492] In a possible implementation, the map construction device 1300 further includes:
[0493] A type determination unit is used to perform field classification processing on the text to be used to obtain the text field to be used; search for a causal event type set corresponding to the field to be used from a preset mapping relationship; wherein the preset mapping relationship includes a correspondence between the field to be used and the causal event type set corresponding to the field to be used; and determine K candidate causal event types according to the causal event type set corresponding to the field to be used.
[0494] In a possible implementation, the first interaction result includes first interaction features corresponding to K candidate causal event types; the number of cause location description data is K, and the process of determining the kth cause location description data includes: performing full connection processing on the first interaction features corresponding to the kth candidate causal event type to obtain a first full connection result; determining the kth cause location description data based on the first full connection result; wherein k is a positive integer, k≤K, and K is a positive integer.
[0495] In a possible implementation manner, the number of the cause position description data is K, and the kth cause position description data includes the kth starting position description data and the kth ending position description data; wherein k is a positive integer, k≤K, and K is a positive integer;
[0496] The process of determining at least one cause event to be used includes: if the k-th cause position description data meets the preset single cause condition, then according to the k-th starting position description data and the k-th ending position description data, extract one cause event to be used from the text to be used; if the k-th cause position description data meets the preset multiple cause condition, then according to the k-th starting position description data, determine at least two cause starting positions; according to each cause starting position and the k-th ending position description data, determine the cause ending position corresponding to each cause starting position; according to each cause starting position and the k-th ending position description data, extract each cause event to be used from the text to be used; wherein k is a positive integer, k≤K.
[0497] In a possible implementation manner, the number of the cause starting positions is N; wherein N is a positive integer, 2≤N;
[0498] The process of determining the cause end position corresponding to the nth cause starting position includes: determining at least one candidate end position based on the nth cause starting position and the kth end position description data; wherein the candidate end position is later than the nth cause starting position; screening out a target end position from the at least one candidate end position, and determining it as the cause end position corresponding to the nth cause starting position; wherein the distance between the target end position and the nth cause starting position is not higher than the distance between any other candidate end position among the at least one candidate end position except the target end position and the nth cause starting position; n is a positive integer, n≤N.
[0499] In a possible implementation manner, the number of the cause events to be used is J; wherein J is a positive integer;
[0500] The result extraction unit 1303 is specifically used to: determine a first text feature based on the j-th cause event to be used and the text to be used; input the first text feature into a pre-constructed event element extraction model to obtain an event element extraction result output by the event element extraction model; wherein the event element extraction result includes the result event corresponding to the j-th cause event to be used; the event element extraction model includes a second encoding layer and a second decoding layer; the input data of the second decoding layer includes the output data of the second encoding layer; wherein j is a positive integer, j≤J.
[0501] In a possible implementation manner, the second decoding layer includes a second pointer network and a result determination network;
[0502] The process of determining the result event corresponding to the j-th cause event to be used includes: inputting the first text feature into the second coding layer to obtain the second coding feature output by the second coding layer; inputting the second coding feature into the second pointer network to obtain the result position description data output by the second pointer network; and determining the result event corresponding to the j-th cause event to be used according to the result position description data and the result determination network.
[0503] In a possible implementation manner, the event element extraction result further includes the event role corresponding to the jth cause event to be used;
[0504] The second decoding layer also includes a third pointer network and an event role determination network;
[0505] The process of determining the event role corresponding to the j-th cause event to be used includes: inputting the second coding feature into the third pointer network to obtain the event role recognition result output by the third pointer network; determining the event role corresponding to the j-th cause event to be used according to the event role recognition result and the event role determination network;
[0506] The graph construction unit 1304 is specifically configured to determine a causal event graph according to the at least one cause event to be used, the result event corresponding to the at least one cause event to be used, and the event role corresponding to the at least one cause event to be used.
[0507] In a possible implementation, the graph construction unit 1304 includes:
[0508] A first determining subunit, configured to determine a plurality of cause events to be clustered according to the at least one cause event to be used and the at least one reference cause event;
[0509] a cause clustering subunit, configured to perform clustering processing on the plurality of cause events to be clustered according to semantic features of the plurality of cause events to be clustered, so as to obtain at least one cause event cluster;
[0510] The second determining subunit is used to determine a causal event graph according to the at least one cause event cluster and the result events corresponding to the multiple cause events to be clustered.
[0511] In a possible implementation manner, the number of cause events to be clustered is R; wherein R is a positive integer;
[0512] The graph construction device 1300 further includes:
[0513] A semantic representation unit, used to determine the semantic features of the rth cause event to be clustered based on the rth cause event to be clustered and a pre-constructed semantic representation model; wherein the semantic representation model includes a third coding layer and a semantic representation layer; the input data of the semantic representation layer includes the output data of the third coding layer; r is a positive integer, r≤R.
[0514] In a possible implementation, the semantic representation unit includes:
[0515] A word segmentation subunit is used to perform word segmentation processing on the rth cause event to be clustered to obtain word block tag data of the rth cause event to be clustered;
[0516] a third determining subunit, configured to determine a second text feature according to the rth cause event to be clustered and the word block marking data of the rth cause event to be clustered;
[0517] A semantic representation subunit, used for inputting the second text feature into the semantic representation model to obtain semantic representation data output by the semantic representation model;
[0518] The fourth determining subunit is used to determine the semantic features of the rth cause event to be clustered according to the semantic representation data.
[0519] In a possible implementation, the fourth determination subunit is specifically configured to: perform maximum pooling processing on the semantic representation data to obtain the semantic features of the rth cause event to be clustered.
[0520] In a possible implementation manner, the cause clustering subunit includes:
[0521] A coarse aggregation subunit, configured to perform a first clustering process on the plurality of cause events to be clustered, to obtain at least one event cluster to be processed;
[0522] The semantic aggregation subunit is used to perform a second clustering process on the multiple cause events to be clustered according to the semantic features of the at least one event cluster to be processed and the multiple cause events to be clustered, so as to obtain the at least one cause event cluster.
[0523] In a possible implementation, the coarse aggregation subunit is specifically used to: initialize i; initialize a set of events to be extracted based on the multiple cause events to be clustered; determine a target cause event and at least one candidate cause event based on the set of events to be extracted; determine the i-th event cluster to be processed based on the target cause event; determine whether there is a cause event to be aggregated in the at least one candidate cause event based on the distance between the hash value of each candidate cause event and the hash value of the target cause event; wherein the distance between the hash value of the cause event to be aggregated and the hash value of the target cause event both meet a preset distance condition; if it is determined that there is at least one cause event to be aggregated in the at least one candidate cause event, add the at least one cause event to be aggregated to the i-th event cluster to be processed; delete the target cause event and the at least one cause event to be aggregated from the set of events to be extracted, update i, and continue to execute the step of determining the target cause event and at least one candidate cause event based on the set of events to be extracted until the first stop condition is reached.
[0524] In a possible implementation, the semantic aggregation subunit is specifically used to: determine at least one target event cluster from the at least one event cluster to be processed; wherein each of the target event clusters satisfies a preset retention condition; determine at least one cluster community and at least one node community based on the at least one target event cluster and the multiple cause events to be clustered; wherein the cluster community includes at least two cause events to be clustered; and the node community includes one cause event to be clustered; determine at least one community representation node based on the semantic features of the multiple cause events to be clustered, the at least one cluster community, and the at least one node community; determine at least one community to be processed based on the at least one community representation node; update the at least one community representation node based on the at least one community to be processed, and continue to perform the step of determining at least one community to be processed based on the at least one community representation node until the at least one cause event cluster is determined based on the at least one community to be processed when the second stop condition is reached.
[0525] In a possible implementation manner, the second determining subunit includes:
[0526] A denoising processing subunit, used for performing noise elimination processing on each of the cause event clusters to obtain each of the denoised event clusters;
[0527] The fifth determining subunit is used to determine a causal event graph according to at least one denoised event cluster and result events corresponding to the cause events to be clustered in the at least one denoised event cluster.
[0528] In a possible implementation manner, the number of the cause event clusters is F; the f-th cause event cluster includes H cause events to be clustered; wherein f is a positive integer, f≤F, and F is a positive integer;
[0529] The denoising processing subunit is specifically used to: determine the in-cluster position representation data of each cause event to be clustered in the f-th cause event cluster according to the semantic features of all cause events to be clustered in the f-th cause event cluster; select at least one core event from the f-th cause event cluster according to the in-cluster position representation data of each cause event to be clustered in the f-th cause event cluster; wherein the in-cluster position representation data of each core event all meet the preset core condition; determine the central feature of the f-th cause event cluster according to the at least one core event; select at least one noise event from the f-th cause event cluster according to the distance between the semantic features of each cause event to be clustered in the f-th cause event cluster and the central feature; wherein the distance between the semantic features of each noise event and the central feature all meet the preset noise condition;
[0530] The at least one noise event is deleted from the f-th cause event cluster to obtain the f-th denoised event cluster.
[0531] In a possible implementation, the map construction device 1300 further includes:
[0532] An attribute extraction unit, used to determine the event attribute description information to be used according to the text to be used;
[0533] The graph construction unit 1304 is specifically used to determine a causal event graph according to the at least one cause event to be used, the result event corresponding to the at least one cause event to be used, and the attribute description information of the event to be used.
[0534] In a possible implementation manner, the event attribute description information to be used includes the event type to be used, the event trigger word to be used, and the event parameter information to be used;
[0535] The attribute extraction unit comprises:
[0536] A first extraction subunit, used to determine the event trigger word to be used and the event type to be used according to the text to be used;
[0537] The second extraction subunit is used to determine the event parameter information to be used according to the event trigger word to be used, the event type to be used and the text to be used.
[0538] In a possible implementation, the first extraction subunit is specifically used to: input the text to be used into a pre-constructed first determination model to obtain the event trigger word to be used and the event type to be used output by the first determination model; wherein the first determination model includes a fourth encoding layer and a fourth decoding layer; the input data of the fourth decoding layer includes the output data of the fourth encoding layer.
[0539] In a possible implementation, the fourth decoding layer includes a second interaction network, a fourth pointer network and a first determination network;
[0540] The process of determining the event trigger word to be used and the event type to be used includes: determining a third coding feature based on the text to be used and the fourth coding layer; inputting the third coding feature into the second interaction network to obtain a second interaction result output by the second interaction network; inputting the second interaction result into the fourth pointer network to obtain a first recognition result output by the fourth pointer network; and determining the event trigger word to be used and the event type to be used based on the first recognition result and the first determination network.
[0541] In a possible implementation, the first recognition result includes K trigger word recognition results and event type identifiers corresponding to the K trigger word recognition results; wherein K is a positive integer.
[0542] In a possible implementation, the second extraction subunit is specifically used to: determine a third text feature based on the event trigger word to be used, the event type to be used and the text to be used; input the third text feature into a pre-constructed second determination model to obtain the event parameter information to be used output by the second determination model; wherein the second determination model includes a fifth encoding layer and a fifth decoding layer; the input data of the fifth decoding layer includes the output data of the fifth encoding layer.
[0543] In a possible implementation, the text acquisition unit 1301 is specifically used to: after acquiring the text to be processed, perform causal relationship identification processing on the text to be processed to obtain a relationship identification result to be used; if the relationship identification result to be used indicates that there is a causal relationship in the text to be processed, then the text to be processed is determined as the text to be used.
[0544] Furthermore, an embodiment of the present application also provides a device, including: a processor, a memory, and a system bus;
[0545] The processor and the memory are connected via the system bus;
[0546] The memory is used to store one or more programs, and the one or more programs include instructions, which, when executed by the processor, enable the processor to execute any implementation method of the above-mentioned graph construction method.
[0547] Furthermore, an embodiment of the present application also provides a computer-readable storage medium, in which instructions are stored. When the instructions are executed on a terminal device, the terminal device executes any one of the implementation methods of the above-mentioned graph construction method.
[0548] Furthermore, an embodiment of the present application also provides a computer program product, which, when executed on a terminal device, enables the terminal device to execute any one of the implementation methods of the above-mentioned graph construction method.
[0549] It can be known from the description of the above implementation mode that those skilled in the art can clearly understand that all or part of the steps in the above-mentioned embodiment method can be implemented by means of software plus a necessary general hardware platform. Based on such an understanding, the technical solution of the present application, in essence, or the part that contributes to the prior art, can be embodied in the form of a software product, which can be stored in a storage medium such as ROM / RAM, a disk, an optical disk, etc., and includes several instructions for enabling a computer device (which can be a personal computer, a server, or a network communication device such as a media gateway, etc.) to execute the methods described in the various embodiments of the present application or certain parts of the embodiments.
[0550] It should be noted that the various embodiments in this specification are described in a progressive manner, and each embodiment focuses on the differences from other embodiments, and the same or similar parts between the various embodiments can be referred to each other. For the device disclosed in the embodiment, since it corresponds to the method disclosed in the embodiment, the description is relatively simple, and the relevant parts can be referred to the method part description.
[0551] It should also be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the presence of other identical elements in the process, method, article or device including the elements.
[0552] The above description of the disclosed embodiments enables those skilled in the art to implement or use the present application. Various modifications to these embodiments will be apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the present application. Therefore, the present application will not be limited to the embodiments shown herein, but will conform to the widest scope consistent with the principles and novel features disclosed herein.
Claims
1. A method for constructing a graph, characterized in that: The method comprises: Acquire a text to be used; wherein the text to be used includes at least one set of causal events; Extracting at least one to-be-used reason event from the to-be-used text; Determine, according to each of the cause events to be used and the text to be used, a result event corresponding to each of the cause events to be used; Determining a causal event graph according to the at least one cause event to be used and a result event corresponding to the at least one cause event to be used; The step of extracting at least one to-be-used reason event from the to-be-used text comprises: Input the to-be-used text into a pre-constructed cause event extraction model to obtain the at least one to-be-used cause event output by the cause event extraction model; wherein the cause event extraction model includes a first encoding layer and a first decoding layer; the input data of the first decoding layer includes the output data of the first encoding layer; The number of the cause events to be used is J; wherein J is a positive integer; The process of determining the result event corresponding to the jth cause event to be used includes: Determine a first text feature according to the jth to-be-used reason event and the to-be-used text; wherein j is a positive integer, j≤J; The first text feature is input into a pre-built event element extraction model to obtain an event element extraction result output by the event element extraction model; wherein the event element extraction result includes the result event corresponding to the j-th cause event to be used; the event element extraction model includes a second encoding layer and a second decoding layer; the input data of the second decoding layer includes the output data of the second encoding layer.
2. The method according to claim 1, characterized in that The first decoding layer includes a first interaction network, a first pointer network and a cause determination network; The process of determining the at least one cause event to be used includes: Determining a first coding feature according to the text to be used and the first coding layer; Inputting the first coding feature into the first interaction network to obtain a first interaction result output by the first interaction network; Inputting the first interaction result into the first pointer network to obtain cause location description data output by the first pointer network; The at least one cause event to be used is determined according to the cause location description data and the cause determination network.
3. The method according to claim 2, characterized in that The first interaction result includes first interaction features corresponding to K candidate causal event types, and the process of determining the first interaction feature corresponding to the kth candidate causal event type includes: The representation feature of the kth candidate causal event type is semantically interactively processed with the first coding feature to obtain a first interactive feature corresponding to the kth candidate causal event type; wherein k is a positive integer, k≤K, and K is a positive integer.
4. The method according to claim 3, characterized in that The method further comprises: Performing field classification processing on the text to be used to obtain the field of the text to be used; Searching for a causal event type set corresponding to the text field to be used from a preset mapping relationship; wherein the preset mapping relationship includes a correspondence between the text field to be used and the causal event type set corresponding to the text field to be used; According to the causal event type set corresponding to the text field to be used, K candidate causal event types are determined.
5. The method according to claim 2, characterized in that: The first interaction result includes first interaction features corresponding to K candidate causal event types; wherein K is a positive integer; The number of the cause location description data is K, and the process of determining the kth cause location description data includes: Perform full connection processing on the first interaction feature corresponding to the k-th candidate causal event type to obtain a first full connection result; wherein k is a positive integer, k≤K; According to the first full connection result, the k-th cause location description data is determined; wherein k is a positive integer, k≤K.
6. The method according to claim 2, characterized in that The number of the cause position description data is K, and the kth cause position description data includes the kth starting position description data and the kth ending position description data; wherein k is a positive integer, k≤K, and K is a positive integer; The process of determining the at least one cause event to be used includes: If the k-th reason position description data satisfies the preset single reason condition, then extracting one of the to-be-used reason events from the to-be-used text according to the k-th starting position description data and the k-th ending position description data; wherein k is a positive integer, k≤K; If the k-th reason position description data satisfies the preset multiple-cause condition, then at least two reason starting positions are determined according to the k-th starting position description data; the reason ending positions corresponding to each reason starting position are determined according to each reason starting position and the k-th ending position description data; and each reason event to be used is extracted from the text to be used according to each reason starting position and the reason ending position corresponding to each reason starting position; wherein k is a positive integer, k≤K.
7. The method according to claim 6, characterized in that The number of the starting positions of the reasons is N; wherein N is a positive integer, 2≤N; The process of determining the cause end position corresponding to the nth cause start position includes: Determine at least one candidate end position according to the description data of the nth cause start position and the kth end position; wherein each candidate end position is later than the nth cause start position; n is a positive integer, n≤N; A target end position is screened out from the at least one candidate end position, and is determined to be the cause end position corresponding to the nth cause start position; wherein the distance between the target end position and the nth cause start position is not greater than the distance between any other candidate end position among the at least one candidate end position except the target end position and the nth cause start position; and n is a positive integer, n≤N.
8. The method according to claim 1, characterized in that The second decoding layer includes a second pointer network and a result determination network; The process of determining the result event corresponding to the j-th cause event to be used includes: Inputting the first text feature into a second encoding layer to obtain a second encoding feature output by the second encoding layer; Inputting the second coding feature into the second pointer network to obtain result position description data output by the second pointer network; The result event corresponding to the j-th cause event to be used is determined according to the result location description data and the result determination network.
9. The method according to claim 8, characterized in that The event element extraction result also includes the event role corresponding to the jth cause event to be used; The second decoding layer also includes a third pointer network and an event role determination network; The process of determining the event role corresponding to the j-th cause event to be used includes: Inputting the second coding feature into the third pointer network to obtain an event role recognition result output by the third pointer network; determining the event role corresponding to the jth cause event to be used according to the event role recognition result and the event role determination network; The determining of a causal event graph according to the at least one cause event to be used and a result event corresponding to the at least one cause event to be used includes: A causal event graph is determined according to the at least one cause event to be used, the result event corresponding to the at least one cause event to be used, and the event role corresponding to the at least one cause event to be used.
10. The method according to claim 1, characterized in that The determining of a causal event graph according to the at least one cause event to be used and a result event corresponding to the at least one cause event to be used includes: Determining a plurality of cause events to be clustered according to the at least one cause event to be used and the at least one reference cause event; Clustering the multiple cause events to be clustered according to the semantic features of the multiple cause events to be clustered to obtain at least one cause event cluster; A causal event graph is determined based on the at least one causal event cluster and the result events corresponding to the multiple causal events to be clustered.
11. The method according to claim 10, characterized in that The number of cause events to be clustered is R; wherein R is a positive integer; The process of determining the semantic features of the rth cause event to be clustered includes: According to the rth cause event to be clustered and a pre-constructed semantic representation model, the semantic features of the rth cause event to be clustered are determined; wherein the semantic representation model includes a third encoding layer and a semantic representation layer; the input data of the semantic representation layer includes the output data of the third encoding layer; r is a positive integer, r≤R.
12. The method according to claim 11, characterized in that Determining the semantic features of the rth cause event to be clustered according to the rth cause event to be clustered and the pre-built semantic representation model includes: Performing word segmentation processing on the rth cause event to be clustered to obtain word block tag data of the rth cause event to be clustered; Determining a second text feature according to the rth cause event to be clustered and the word block tag data of the rth cause event to be clustered; Inputting the second text feature into the semantic representation model to obtain semantic representation data output by the semantic representation model; The semantic features of the rth cause event to be clustered are determined according to the semantic representation data.
13. The method according to claim 12, characterized in that The step of determining the semantic features of the rth cause event to be clustered according to the semantic representation data includes: The semantic representation data is subjected to maximum pooling processing to obtain the semantic features of the rth cause event to be clustered.
14. The method according to claim 10, characterized in that The step of clustering the multiple cause events to be clustered according to the semantic features of the multiple cause events to be clustered to obtain at least one cause event cluster includes: Performing a first clustering process on the plurality of cause events to be clustered to obtain at least one event cluster to be processed; According to the at least one event cluster to be processed and the semantic features of the multiple cause events to be clustered, a second clustering process is performed on the multiple cause events to be clustered to obtain the at least one cause event cluster.
15. The method according to claim 14, characterized in that The process of determining the at least one event cluster to be processed includes: Initialize i; Initializing a set of events to be extracted according to the multiple cause events to be clustered; Determine a target cause event and at least one candidate cause event according to the set of events to be extracted; According to the target cause event, determine the i-th event cluster to be processed; Determine whether there is a cause event to be aggregated in the at least one candidate cause event according to the distance between the hash value of each candidate cause event and the hash value of the target cause event; wherein the distance between the hash value of the cause event to be aggregated and the hash value of the target cause event both satisfies a preset distance condition; If it is determined that there is at least one cause event to be aggregated in the at least one candidate cause event, adding the at least one cause event to be aggregated to the i-th event cluster to be processed; Delete the target cause event and the at least one cause event to be aggregated from the set of events to be extracted, update i, and continue to execute the step of determining the target cause event and at least one candidate cause event based on the set of events to be extracted until the first stop condition is reached.
16. The method according to claim 14, characterized in that The step of performing a second clustering process on the multiple cause events to be clustered according to the at least one event cluster to be processed and the semantic features of the multiple cause events to be clustered to obtain the at least one cause event cluster includes: Determining at least one target event cluster from the at least one event cluster to be processed; wherein each of the target event clusters satisfies a preset retention condition; Determine at least one cluster community and at least one node community according to the at least one target event cluster and the plurality of cause events to be clustered; wherein the cluster community includes at least two cause events to be clustered; and the node community includes one cause event to be clustered; Determining at least one community representation node according to the semantic features of the plurality of cause events to be clustered, the at least one cluster community and the at least one node community; Determining at least one community to be processed according to the at least one community representation node; According to the at least one community to be processed, the at least one community representation node is updated, and the step of determining at least one community to be processed according to the at least one community representation node is continued until the at least one cause event cluster is determined according to the at least one community to be processed when a second stop condition is met.
17. The method according to claim 10, characterized in that The determining of a causal event graph according to the at least one cause event cluster and the result events corresponding to the plurality of cause events to be clustered comprises: Performing noise removal processing on each of the cause event clusters to obtain each denoised event cluster; A causal event graph is determined according to at least one denoised event cluster and result events corresponding to the cause events to be clustered in the at least one denoised event cluster.
18. The method according to claim 17, characterized in that The number of the cause event clusters is F; the f-th cause event cluster includes H cause events to be clustered; wherein f is a positive integer, f≤F, and F is a positive integer; The process of determining the fth denoising event cluster includes: Determining, according to the semantic features of all the cause events to be clustered in the f-th cause event cluster, the in-cluster position representation data of each cause event to be clustered in the f-th cause event cluster; According to the intra-cluster position representation data of each to-be-clustered cause event in the f-th cause event cluster, at least one core event is selected from the f-th cause event cluster; wherein the intra-cluster position representation data of each core event satisfies a preset core condition; Determining the central feature of the f-th cause event cluster according to the at least one core event; According to the distance between the semantic features of each cause event to be clustered in the f-th cause event cluster and the central feature, at least one noise event is screened out from the f-th cause event cluster; wherein the distance between the semantic features of each noise event and the central feature satisfies a preset noise condition; The at least one noise event is deleted from the f-th cause event cluster to obtain the f-th denoised event cluster.
19. The method according to claim 1, characterized in that The method further comprises: Determine event attribute description information to be used according to the text to be used; The determining of a causal event graph according to the at least one cause event to be used and a result event corresponding to the at least one cause event to be used includes: A causal event graph is determined according to the at least one cause event to be used, the result event corresponding to the at least one cause event to be used, and the attribute description information of the event to be used.
20. The method according to claim 19, characterized in that The event attribute description information to be used includes the event type to be used, the event trigger word to be used and the event parameter information to be used; The process of determining the event attribute description information to be used includes: Determining the event trigger word to be used and the event type to be used according to the text to be used; The event parameter information to be used is determined according to the event trigger word to be used, the event type to be used and the text to be used.
21. The method according to claim 20, characterized in that The step of determining the event trigger word to be used and the event type to be used according to the text to be used includes: The text to be used is input into a pre-constructed first determination model to obtain the event trigger word to be used and the event type to be used output by the first determination model; wherein the first determination model includes a fourth encoding layer and a fourth decoding layer; the input data of the fourth decoding layer includes the output data of the fourth encoding layer.
22. The method according to claim 21, characterized in that The fourth decoding layer includes a second interaction network, a fourth pointer network and a first determination network; The process of determining the event trigger word to be used and the event type to be used includes: Determining a third coding feature according to the text to be used and the fourth coding layer; Inputting the third coding feature into the second interaction network to obtain a second interaction result output by the second interaction network; Inputting the second interaction result into the fourth pointer network to obtain a first recognition result output by the fourth pointer network; The event trigger word to be used and the event type to be used are determined according to the first recognition result and the first determination network.
23. The method according to claim 22, characterized in that The first recognition result includes K trigger word recognition results and event type identifiers corresponding to the K trigger word recognition results; wherein K is a positive integer.
24. The method according to claim 20, characterized in that The determining the event parameter information to be used according to the event trigger word to be used, the event type to be used and the text to be used includes: Determining a third text feature according to the event trigger word to be used, the event type to be used, and the text to be used; The third text feature is input into a pre-constructed second determination model to obtain the event parameter information to be used output by the second determination model; wherein the second determination model includes a fifth encoding layer and a fifth decoding layer; and the input data of the fifth decoding layer includes the output data of the fifth encoding layer.
25. The method according to claim 1, characterized in that The process of obtaining the text to be used includes: After obtaining the text to be processed, performing causal relationship recognition processing on the text to be processed to obtain a relationship recognition result to be used; If the to-be-used relationship identification result indicates that there is a causal relationship in the to-be-processed text, the to-be-processed text is determined as the to-be-used text.
26. A graph construction device, characterized in that: include: A text acquisition unit, used to acquire a text to be used; wherein the text to be used includes at least one set of causal events; A reason extraction unit, used for extracting at least one to-be-used reason event from the to-be-used text; A result extraction unit, used for determining the result event corresponding to each of the cause events to be used according to each of the cause events to be used and the text to be used; A graph construction unit, configured to determine a causal event graph according to the at least one cause event to be used and a result event corresponding to the at least one cause event to be used; The cause extraction unit is specifically used to: input the to-be-used text into a pre-constructed cause event extraction model to obtain the at least one to-be-used cause event output by the cause event extraction model; wherein the cause event extraction model includes a first encoding layer and a first decoding layer; the input data of the first decoding layer includes the output data of the first encoding layer; The number of the cause events to be used is J; wherein J is a positive integer; The result extraction unit is specifically used to: determine a first text feature based on the jth cause event to be used and the text to be used; input the first text feature into a pre-constructed event element extraction model to obtain an event element extraction result output by the event element extraction model; wherein the event element extraction result includes the result event corresponding to the jth cause event to be used; the event element extraction model includes a second encoding layer and a second decoding layer; the input data of the second decoding layer includes the output data of the second encoding layer; wherein j is a positive integer, j≤J.
27. A device, characterized in that The device includes: a processor, a memory, and a system bus; The processor and the memory are connected via the system bus; The memory is used to store one or more programs, wherein the one or more programs include instructions, and when the instructions are executed by the processor, the processor performs the method according to any one of claims 1 to 25.
28. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores instructions, and when the instructions are executed on a terminal device, the terminal device executes the method according to any one of claims 1 to 25.