Metonymy sentence pattern component extraction method and device, computer readable medium and equipment

By preprocessing the text and using the BERT encoder and GAT algorithm, the accuracy of component recognition and extraction in simile sentences was solved, thus improving the accuracy of recognition and extraction.

CN115688765BActive Publication Date: 2026-01-06XIAMEN UNIV
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202211338577.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-10-28
Publication Date
2026-01-06
Estimated Expiration
2042-10-28

AI Technical Summary

Technical Problem

Existing technologies lack accuracy in identifying and extracting components in simile sentences, especially when the subject and the metaphor are far apart.

Method used

By preprocessing the text to be processed, determining the word segmentation results and syntactic dependency relation matrix, and combining the BERT encoder and GAT algorithm, word sense retrieval and node representation update are performed to extract simile components.

Benefits of technology

It improves the accuracy of component identification and extraction in simile sentences and reduces the difficulty of identification when the subject and the metaphor are far apart.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115688765B_ABST
    Figure CN115688765B_ABST
Patent Text Reader

Abstract

Embodiments of the present application provide a kind of allegory sentence pattern component extraction method, device, computer readable medium and equipment.The method comprises: determining the part-of-speech result, part-of-speech mask matrix and adjacent matrix based on syntax dependency relationship corresponding to the text to be processed;Word meaning retrieval is carried out to the part-of-speech of noun, and the noun interpretation set corresponding to the text to be processed is obtained;The text to be processed and the noun interpretation set are spliced, and input into BERT encoder, and the corresponding text representation matrix is obtained;The text representation matrix is multiplied by the part-of-speech mask matrix, and the corresponding word node matrix is obtained;Based on GAT algorithm, the word node matrix and the adjacent matrix are updated to obtain the node representation corresponding to the text to be processed;Based on the node representation, the allegory component extraction of the text to be processed is carried out.The technical scheme of the embodiment of the present application improves the accuracy of component identification and extraction in allegory sentence pattern.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of natural language processing technology, and more specifically, to a method, apparatus, computer-readable medium, and device for extracting components from simile sentences. Background Technology

[0002] With the development of natural language understanding, artificial intelligence, and machine translation, the automatic analysis and understanding of rhetorical devices has increasingly become a bottleneck hindering the in-depth development of natural language processing. The most commonly used rhetorical device is metaphor, which formally consists of two components: the subject and the metaphor. Based on the similarities, differences, and impliedness of these components, it is mainly divided into simile and metaphor. Current technical solutions for identifying and extracting components from simile sentences utilize recurrent networks to construct connections between subtasks and combine local attention mechanisms to enhance the accuracy of identification and extraction. However, the above methods do not fully utilize the characteristics of simile, and the local attention mechanism performs poorly when the distance between the subject and the metaphor is large. Therefore, how to improve the accuracy of component identification and extraction in simile sentences has become an urgent technical problem to be solved. Summary of the Invention

[0003] The embodiments of this application provide a method, apparatus, computer-readable medium, and device for extracting components from simile sentences, which can at least to some extent improve the accuracy of component identification and extraction in simile sentences.

[0004] Other features and advantages of this application will become apparent from the following detailed description, or may be learned in part from practice of this application.

[0005] According to one aspect of the embodiments of this application, a method for extracting components from simile sentences is provided, the method comprising:

[0006] The text to be processed is preprocessed to determine the word segmentation result, word segmentation mask matrix, and adjacency matrix based on syntactic dependency relations.

[0007] Word segmentation with noun part of speech is subjected to semantic retrieval to obtain a set of noun definitions corresponding to the text to be processed;

[0008] The text to be processed is concatenated with the set of noun definitions, and the concatenation result is input into the BERT encoder to obtain the text representation matrix corresponding to the text to be processed.

[0009] Multiply the text representation matrix by the word segmentation mask matrix to obtain the corresponding word node matrix;

[0010] The word node matrix and the adjacency matrix are updated based on the GAT algorithm to obtain the node representation corresponding to the text to be processed.

[0011] Based on the node representation, the text to be processed is subjected to metaphor component extraction, wherein the metaphor component includes the subject and the metaphor.

[0012] According to one aspect of the embodiments of this application, a component extraction device for simile sentences is provided, the device comprising:

[0013] The preprocessing module is used to preprocess the text to be processed, and to determine the word segmentation result, word segmentation mask matrix and adjacency matrix based on syntactic dependency relation of the text to be processed.

[0014] The retrieval module is used to perform semantic retrieval on word segments with noun parts of speech to obtain a set of noun definitions corresponding to the text to be processed;

[0015] The first processing module is used to concatenate the text to be processed with the set of noun definitions, and input the concatenation result into the BERT encoder to obtain the text representation matrix corresponding to the text to be processed;

[0016] The second processing module is used to multiply the text representation matrix with the word segmentation mask matrix to obtain the corresponding word node matrix;

[0017] The third processing module is used to update the representation of the word node matrix and the adjacency matrix based on the GAT algorithm to obtain the node representation corresponding to the text to be processed;

[0018] The fourth processing module is used to extract metaphor components from the text to be processed based on the node representation, wherein the metaphor components include the subject and the metaphor.

[0019] According to one aspect of the embodiments of this application, a computer-readable medium is provided having a computer program stored thereon, which, when executed by a processor, implements the component extraction method for simile sentences as described in the above embodiments.

[0020] According to one aspect of the embodiments of this application, an electronic device is provided, including: one or more processors; and a storage device for storing one or more programs, which, when executed by the one or more processors, cause the one or more processors to implement the simile sentence component extraction method as described in the above embodiments.

[0021] According to one aspect of the embodiments of this application, a computer program product or computer program is provided, which includes computer instructions stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium and executes the computer instructions, causing the computer device to perform the simile sentence component extraction method provided in the above embodiments.

[0022] In some embodiments of this application, the technical solutions involve preprocessing the text to be processed to determine the word segmentation results, word segmentation mask matrix, and adjacency matrix based on syntactic dependency relations. For words with noun parts of speech, semantic retrieval is performed to obtain a set of noun definitions corresponding to the text. The text to be processed and the set of noun definitions are concatenated, and the concatenation result is input into the BERT encoder to obtain the text representation matrix corresponding to the text. This text representation matrix is ​​then multiplied by the word segmentation mask matrix to obtain the corresponding word node matrix. The word node matrix and adjacency matrix are updated using the GAT algorithm to obtain the corresponding node representation. Finally, based on this node representation, metaphorical components are extracted from the text. Therefore, by introducing multiple types of information and constructing a heterogeneous graph network, the difficulty of identification due to the large distance between the ontology and the metaphor can be reduced, improving the accuracy of component identification in metaphorical sentences and ensuring the accuracy of component extraction results.

[0023] It should be understood that the above general description and the following detailed description are exemplary and explanatory only, and do not limit this application. Attached Figure Description

[0024] The accompanying drawings, which are incorporated in and form part of this specification, illustrate embodiments consistent with this application and, together with the description, serve to explain the principles of this application. It is obvious that the drawings described below are merely some embodiments of this application, and those skilled in the art can obtain other drawings based on these drawings without any inventive effort. In the drawings:

[0025] Figure 1 A flowchart illustrating a method for extracting components from simile sentences according to an embodiment of this application is shown.

[0026] Figure 2 A block diagram of a component extraction apparatus for simile sentences according to an embodiment of this application is shown;

[0027] Figure 3 A schematic diagram of the structure of a computer system suitable for implementing the electronic device of the present application is shown. Detailed Implementation

[0028] Exemplary embodiments will now be described more fully with reference to the accompanying drawings. However, these exemplary embodiments can be implemented in many forms and should not be construed as limited to the examples set forth herein; rather, these embodiments are provided to make this application more comprehensive and complete, and to fully convey the concept of the exemplary embodiments to those skilled in the art.

[0029] In addition, the described features, structures, or characteristics may be combined in any suitable manner in one or more embodiments. In the following description, numerous specific details are provided to give a thorough understanding of the embodiments of the present application. However, those skilled in the art will realize that the technical solutions of the present application may be practiced without one or more of the specific details, or other methods, components, devices, steps, etc. may be employed. In other cases, well-known methods, devices, implementations, or operations are not shown or described in detail to avoid obscuring aspects of the present application.

[0030] The block diagrams shown in the drawings are merely functional entities and do not necessarily correspond to physically independent entities. That is, these functional entities may be implemented in software form, or in one or more hardware modules or integrated circuits, or in different networks and / or processor devices and / or microcontroller devices.

[0031] The flowcharts shown in the drawings are merely illustrative and do not necessarily include all the content and operations / steps, nor are they necessarily executed in the described order. For example, some operations / steps may be decomposed, while some operations / steps may be combined or partially combined, so the actual execution order may change according to the actual situation.

[0032] Figure 1 The flowchart of the method for extracting components of a simile sentence according to an embodiment of the present application is shown. Referring to Figure 1 as shown, the method at least includes steps S110 to step S160, which are introduced in detail as follows:

[0033] In step S110, preprocess the text to be processed to determine the word segmentation result, word segmentation mask matrix, and adjacency matrix based on syntactic dependency relationships corresponding to the text to be processed.

[0034] Specifically, the text to be processed can be input into the syntactic dependency analysis interface for preprocessing to determine the word segmentation result, word segmentation mask matrix, and adjacency matrix based on syntactic dependency relationships corresponding to the text to be processed. Assume the length of the text to be processed is m and the number of words is n. Then the word segmentation mask matrix M is an (n + 2) * m matrix, the adjacency matrix E based on syntactic dependency relationships is an (n + 2) * (n + 2) matrix, and the word segmentation mask matrix is a 0-1 matrix. Except for the first two rows representing the left and right clause nodes divided by "like" as the center, each row represents a word. In each row, the positions belonging to the content of the word are 1, and the rest are 0.

[0035] The adjacency matrix E contains n words and two nodes: a left clause and a right clause, resulting in n+2 nodes. If a syntactic relationship exists between words, it is coded according to a pre-defined relation dictionary; otherwise, it is coded as 0. Furthermore, based on the part of speech and the word's position, noun nodes and their corresponding left and right clause nodes are coded as "con," while nodes not belonging to the clause are coded as "not-con."

[0036] In step S120, word meaning retrieval is performed on the word segments with the part of speech as nouns to obtain a set of noun definitions corresponding to the text to be processed.

[0037] Specifically, the noun segments in the word segmentation results can be input into the WordNet interface for word meaning retrieval, obtaining the noun definition corresponding to each noun segment. The noun definitions corresponding to all noun segments form the noun definition set corresponding to the text to be processed.

[0038] In step S130, the text to be processed is concatenated with the set of noun definitions, and the concatenation result is input into the BERT encoder to obtain the text representation matrix corresponding to the text to be processed.

[0039] In one embodiment, the set of noun definitions can be appended to the text to be processed, and the two can be separated by the SEP delimiter. This ensures that the original content of the text to be processed is not destroyed, thereby improving the accuracy of subsequent component identification. In other embodiments, the set of noun definitions can also be appended to the text to be processed, as long as the original content of the text to be processed is not destroyed. This application does not impose any special limitations on this.

[0040] After concatenation, the concatenation result is input into the BERT encoder to obtain the text representation matrix H∈R corresponding to the text to be processed. m*d , where d is the dimension of each word node.

[0041] In step S140, the text representation matrix is ​​multiplied by the word segmentation mask matrix to obtain the corresponding word node matrix.

[0042] Specifically, the text representation matrix H∈R m*d With the word segmentation mask matrix M=R m*(n+2) Multiplying these results in the word node matrix G = {g0, g1, ..., g} corresponding to the text to be processed. n+1}, where g0 and g n+1 These represent the left and right clause nodes, respectively.

[0043] In step S150, the word node matrix and the adjacency matrix are updated based on the GAT algorithm to obtain the node representation corresponding to the text to be processed.

[0044] In this embodiment, the word node matrix and adjacency matrix can be updated based on the GAT (Graph Attention Networks) algorithm. The GAT algorithm can include L layers of network. After the representation update, the node representation function G corresponding to the text to be processed is obtained. (L) In one example, the adjacency matrix can be randomly initialized first, and then the word node matrix and the randomly initialized adjacency matrix can be updated according to the GAT algorithm. After stacking L layers of GAT, the final node representation function is obtained.

[0045] Specifically, as shown in the following formula:

[0046]

[0047]

[0048]

[0049] Among them, g * Represents node representation, e ij The edges representing the relationships between nodes are represented by N. i This represents neighboring nodes that are connected. α ij W represents the importance of node i to node j. * These are all parameter matrices of the model.

[0050] Based on the above formula, z ij Represent node i as g i The node representation of node j, which is adjacent to it, is g. j spliced ​​together, α ij This indicates the importance of node i to node j, and thus the node representation g of node i can be updated based on the importance obtained above. i .

[0051] In step S160, based on the node representation, metaphor components are extracted from the text to be processed, and the metaphor components include the subject and the metaphor.

[0052] In this embodiment, based on the node representation G corresponding to the text to be processed (L) The metaphor component is extracted, specifically, according to the following formula:

[0053]

[0054] Among them, Tc2 For the correctly labeled sequence of the second component, g c1 The word node representation extracted for the first predicted component.

[0055] It should be noted that the component prediction result output by the component prediction network (which may be an ontology or a metaphor) can be used as the first component extraction result, and the probability distribution result of the second component corresponding to the component prediction result can be determined according to the above formula. Based on the above formula, the word node representation of the first component extraction is concatenated with each other word node representation g. i Above, thus determining g i Is it related to g? c1 The corresponding components. Therefore, based on the probability distribution results corresponding to each word segment, the second component corresponding to the predicted first component is determined. Specifically, the component with the largest probability distribution result can be selected as the component corresponding to the first component.

[0056] In one embodiment of this application, it is understood that there are three extraction orders in simile component extraction: extracting the subject first and then the metaphor, extracting the metaphor first and then the subject, and extracting simultaneously. Since each order has its advantages, an integrated approach can be used to combine the three extraction results (i.e., the probability distribution results corresponding to each word segment). For example, the probability distribution results corresponding to each word segment in the three extraction orders can be added together. Therefore, the simile component is determined based on the integrated probability distribution results, thereby improving the accuracy of the simile component extraction results.

[0057] In one embodiment of this application, the method further includes:

[0058] Based on the node representation, the text to be processed is identified using the following formula:

[0059]

[0060] Where g0 is the left clause node representation, g n+1 This represents the right clause node. At this point, based on the above formula, the left and right clause node representations are concatenated with their subtraction representation, and then processed through W... c Sentence classification is performed to obtain probability distribution results. It should be understood that based on the above simile sentence pattern recognition results, recognition errors may occur. Therefore, regardless of the recognition result of the simile sentence pattern, subsequent simile component extraction can still be performed.

[0061] Based on the foregoing embodiments, in one embodiment of this application, the method further includes:

[0062] The model is updated based on the loss for simile recognition and the loss for simile component extraction.

[0063] In this embodiment, the model can be updated using a loss function to improve the accuracy of subsequent recognition. Specifically, the model can be updated according to the following formula:

[0064]

[0065] Where λ and α are both hyperparameters, J sc The loss represents the loss for simile recognition, Jce represents the loss for simile extraction, the KL term represents the difference loss between the three extraction order sub-models and the extraction results after integration, S represents the sample, θ represents the model parameters, c\in{true,false} indicates whether the current sentence is a simile, and T represents the component labeling sequence of the current sentence (i.e., assuming a sentence has n words, the length of the labeling sequence is also n, indicating whether each word is the subject / metaphor).

[0066] Therefore, according to the above loss function formula, a loss can be calculated for each sample, and the model parameters can be updated through backpropagation to achieve the purpose of updating the model and thus improve the accuracy of subsequent recognition.

[0067] The following describes an apparatus embodiment of this application, which can be used to execute the component extraction method for simile sentences in the above embodiments of this application. For details not disclosed in the apparatus embodiments of this application, please refer to the embodiments of the component extraction method for simile sentences described above.

[0068] Figure 2 A block diagram of a component extraction apparatus for simile sentences according to an embodiment of this application is shown.

[0069] Reference Figure 2 As shown, a component extraction apparatus for simile sentences according to an embodiment of this application includes:

[0070] The preprocessing module 210 is used to preprocess the text to be processed, and to determine the word segmentation result, word segmentation mask matrix and adjacency matrix based on syntactic dependency relation corresponding to the text to be processed.

[0071] The retrieval module 220 is used to perform semantic retrieval on word segments with noun parts of speech to obtain a set of noun definitions corresponding to the text to be processed;

[0072] The first processing module 230 is used to concatenate the text to be processed with the set of noun definitions, and input the concatenation result into the BERT encoder to obtain the text representation matrix corresponding to the text to be processed;

[0073] The second processing module 240 is used to multiply the text representation matrix with the word segmentation mask matrix to obtain the corresponding word node matrix;

[0074] The third processing module 250 is used to update the representation of the word node matrix and the adjacency matrix based on the GAT algorithm to obtain the node representation corresponding to the text to be processed.

[0075] The fourth processing module 260 is used to extract metaphor components from the text to be processed based on the node representation, wherein the metaphor components include the subject and the metaphor.

[0076] In one embodiment of this application, the third processing module 250 is used to: randomly initialize the adjacency matrix; and update the representation of the word node matrix and the randomly initialized adjacency matrix based on the GAT algorithm to obtain the node representation function corresponding to the text to be processed.

[0077] In one embodiment of this application, the first processing module 230 is configured to: append the set of noun definitions to the text to be processed, and separate the two using the SEP delimiter.

[0078] In one embodiment of this application, metaphor components are extracted according to the following formula:

[0079]

[0080] Among them, T c2 For the correctly labeled sequence of the second component, g c1 The word node representation extracted for the first predicted component;

[0081] Based on the probability distribution results corresponding to each word segment, the second component corresponding to the predicted first component is determined.

[0082] In one embodiment of this application, the fourth processing module 260 is further configured to: based on the node representation, perform simile sentence pattern recognition on the text to be processed according to the following formula:

[0083]

[0084] Where g0 is the left clause node representation, g n+1 This represents the node of the right clause.

[0085] In one embodiment of this application, the fourth processing module 260 is further configured to: update the model based on the simile sentence recognition loss and the simile component extraction loss.

[0086] Figure 3 A schematic diagram of the structure of a computer system suitable for implementing the electronic device of the present application is shown.

[0087] It should be noted that, Figure 3The computer system of the electronic device shown is merely an example and should not impose any limitation on the functionality and scope of use of the embodiments of this application.

[0088] like Figure 3 As shown, the computer system includes a Central Processing Unit (CPU) 301, which can perform various appropriate actions and processes based on programs stored in Read-Only Memory (ROM) 302 or programs loaded from storage portion 308 into Random Access Memory (RAM) 303, such as performing the methods described in the above embodiments. The RAM 303 also stores various programs and data required for system operation. The CPU 301, ROM 302, and RAM 303 are interconnected via a bus 304. An Input / Output (I / O) interface 305 is also connected to the bus 304.

[0089] The following components are connected to I / O interface 305: an input section 306 including a keyboard, mouse, etc.; an output section 307 including a cathode ray tube (CRT), liquid crystal display (LCD), etc., and speakers, etc.; a storage section 308 including a hard disk, etc.; and a communication section 309 including a network interface card such as a LAN (Local Area Network) card, modem, etc. The communication section 309 performs communication processing via a network such as the Internet. A drive 310 is also connected to I / O interface 305 as needed. Removable media 311, such as a disk, optical disk, magneto-optical disk, semiconductor memory, etc., are installed on drive 310 as needed so that computer programs read from them can be installed into storage section 308 as needed.

[0090] Specifically, according to embodiments of this application, the processes described above with reference to the flowcharts can be implemented as computer software programs. For example, embodiments of this application include a computer program product comprising a computer program carried on a computer-readable medium, the computer program including a computer program for performing the methods shown in the flowcharts. In such embodiments, the computer program can be downloaded and installed from a network via communication section 309, and / or installed from removable medium 311. When the computer program is executed by central processing unit (CPU) 301, it performs various functions defined in the system of this application.

[0091] It should be noted that the computer-readable medium shown in the embodiments of this application can be a computer-readable signal medium or a computer-readable storage medium, or any combination of the two. A computer-readable storage medium can be, for example,—but not limited to—an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination thereof. More specific examples of a computer-readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer disk, a hard disk, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM), flash memory, optical fiber, portable compact disk read-only memory (CD-ROM), optical storage device, magnetic storage device, or any suitable combination thereof. In this application, a computer-readable storage medium can be any tangible medium containing or storing a program that can be used by or in conjunction with an instruction execution system, apparatus, or device. In this application, a computer-readable signal medium can include a data signal propagated in baseband or as part of a carrier wave, carrying a computer-readable computer program. The transmitted data signal can take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination thereof. The computer-readable signal medium can also be any computer-readable medium other than a computer-readable storage medium, which can send, propagate, or transmit a program for use by or in connection with an instruction execution system, apparatus, or device. The computer program contained on the computer-readable medium can be transmitted using any suitable medium, including but not limited to wireless, wired, etc., or any suitable combination thereof.

[0092] The flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of systems, methods, and computer program products according to various embodiments of this application. Each block in a flowchart or block diagram may represent a module, segment, or portion of code, which contains one or more executable instructions for implementing a specified logical function. It should also be noted that in some alternative implementations, the functions indicated in the blocks may occur in a different order than those indicated in the drawings. For example, two consecutively indicated blocks may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each block in a block diagram or flowchart, and combinations of blocks in a block diagram or flowchart, can be implemented using a dedicated hardware-based system that performs the specified function or operation, or using a combination of dedicated hardware and computer instructions.

[0093] The units described in the embodiments of this application can be implemented in software or hardware, and the described units can also be located in a processor. The names of these units do not necessarily limit the specific unit itself.

[0094] In another aspect, this application also provides a computer-readable medium, which may be included in the electronic device described in the above embodiments; or it may exist independently and not assembled into the electronic device. The computer-readable medium carries one or more programs, which, when executed by the electronic device, cause the electronic device to perform the methods described in the above embodiments.

[0095] It should be noted that although several modules or units for the device used to perform actions have been mentioned in the detailed description above, this division is not mandatory. In fact, according to the embodiments of this application, the features and functions of two or more modules or units described above can be embodied in one module or unit. Conversely, the features and functions of one module or unit described above can be further divided and embodied by multiple modules or units.

[0096] Through the above description of the embodiments, those skilled in the art will readily understand that the exemplary embodiments described herein can be implemented by software or by combining software with necessary hardware. Therefore, the technical solutions according to the embodiments of this application can be embodied in the form of a software product, which can be stored in a non-volatile storage medium (such as a CD-ROM, USB flash drive, external hard drive, etc.) or on a network, including several instructions to cause a computing device (such as a personal computer, server, touch terminal, or network device, etc.) to execute the method according to the embodiments of this application.

[0097] Other embodiments of this application will readily occur to those skilled in the art upon consideration of the specification and practice of the embodiments disclosed herein. This application is intended to cover any variations, uses, or adaptations of this application that follow the general principles of this application and include common knowledge or customary techniques in the art not disclosed herein.

[0098] It should be understood that this application is not limited to the precise structure described above and shown in the accompanying drawings, and various modifications and changes can be made without departing from its scope. The scope of this application is limited only by the appended claims.

Claims

1. A method of extracting components of a simile sentence, characterized by, The method comprises the following steps: preprocessing the to-be-processed text to determine the word segmentation result, the word segmentation mask matrix, and the adjacency matrix based on the syntactic dependency relationship corresponding to the to-be-processed text; performing word meaning retrieval on the word segmentation with a part of speech being a noun to obtain a noun interpretation set corresponding to the to-be-processed text; concatenating the to-be-processed text and the noun interpretation set, and inputting the concatenation result into a BERT encoder to obtain a text representation matrix corresponding to the to-be-processed text; multiplying the text representation matrix and the word segmentation mask matrix to obtain a corresponding word node matrix; updating the representation of the word node matrix and the adjacency matrix based on a GAT algorithm to obtain a node representation corresponding to the to-be-processed text; based on the node representation, performing explicit metaphorical component extraction on the to-be-processed text, the explicit metaphorical component including a subject and an object; explicit metaphorical component extraction is performed according to the following formula: ; where T c2 is the correct sequence of the second component, g c1 is the predicted first component extracted word node representation; determining the second component corresponding to the first component predicted according to the probability distribution result corresponding to each word segmentation; concatenating the first constituent extracted word node representation g i to each other word node representation g i to determine if the constituent corresponds to g c1 g The method further comprises: based on the node representation, explicit metaphorical sentence pattern recognition is performed on the to-be-processed text according to the following formula: ; wherein is a left clause node representation, is a right clause node representation; concatenate the left and right sub-sentence node representations and their subtraction representations together, and classify the sentences through Wc to obtain a probability distribution result.

2. The method of claim 1, wherein, The concatenation of the to-be-processed text and the noun interpretation set comprises: concatenate the noun interpretation set after the to-be-processed text, and separate them by a SEP separator.

3. The method of claim 1, wherein, updating the representation of the word node matrix and the adjacency matrix based on a GAT algorithm to obtain a node representation function corresponding to the to-be-processed text, comprising: randomly initializing the adjacency matrix; updating the representation of the word node matrix and the randomly initialized adjacency matrix based on a GAT algorithm to obtain a node representation function corresponding to the to-be-processed text.

4. The method of claim 1, wherein, The method further comprises: updating the model according to the explicit metaphorical sentence pattern recognition loss and the explicit metaphorical component extraction loss.

5. A device for extracting components of a simile sentence, characterized by comprising: The method comprises the following steps: a preprocessing module for preprocessing the to-be-processed text to determine the word segmentation result, the word segmentation mask matrix, and the adjacency matrix based on the syntactic dependency relationship corresponding to the to-be-processed text; a retrieval module for performing word meaning retrieval on the word segmentation with a part of speech being a noun to obtain a noun interpretation set corresponding to the to-be-processed text; a first processing module for concatenating the to-be-processed text and the noun interpretation set, and inputting the concatenation result into a BERT encoder to obtain a text representation matrix corresponding to the to-be-processed text; a second processing module for multiplying the text representation matrix and the word segmentation mask matrix to obtain a corresponding word node matrix; a third processing module for updating the representation of the word node matrix and the adjacency matrix based on a GAT algorithm to obtain a node representation corresponding to the to-be-processed text; a fourth processing module for performing explicit metaphorical component extraction on the to-be-processed text based on the node representation, the explicit metaphorical component including a subject and an object; explicit metaphorical component extraction is performed according to the following formula: ; where T c2 is the correct sequence of the second component, g c1 is the predicted first component extracted word node representation; determining the second component corresponding to the first component predicted according to the probability distribution result corresponding to each word segmentation; concatenating the first constituent extracted word node representation g i to each other word node representation g i to determine if the constituent corresponds to g c1 g The device further comprises: Based on the node representation, the simile sentence pattern of the to-be-processed text is identified according to the following formula: ; wherein is a left clause node representation, is a right clause node representation; The left and right sub-sentence node representations and the subtraction representation are spliced together, and sentence classification is performed through Wc, so as to obtain a probability distribution result.

6. The apparatus of claim 5, wherein, The third processing module is configured to: Randomly initialize an adjacency matrix; Based on the GAT algorithm, the word node matrix and the randomly initialized adjacency matrix are updated to obtain a node representation function corresponding to the to-be-processed text.

7. A computer readable medium having stored thereon a computer program, characterized in that, The computer program, when executed by a processor, implements the component extraction method of the simile sentence pattern according to any one of claims 1 to 4.

8. An electronic device, comprising: Comprise: One or more processors; A storage device for storing one or more programs, when the one or more programs are executed by the one or more processors, so that the one or more processors implement the component extraction method of the simile sentence pattern according to any one of claims 1 to 4.

Citation Information

Patent Citations

  • Automatic metaphor rhetoric sentence analysis and judgment method based on part of speech, syntax and dictionary

    CN106502981A

  • Metaphor calculation and device based on knowledge graph representation learning

    CN113157932A