Text extraction method and system, medium and terminal

By extracting text and relation semantic vectors in parallel within the BERT model and simultaneously extracting relation triples and non-relation entities using a pointer network, the problems of slow inference speed and lack of location information in existing technologies are solved, achieving efficient and real-time text extraction.

CN121524367APending Publication Date: 2026-02-13SHANGHAI MIDU INFORMATION TECH CO LTD
View PDF 6 Cites 0 Cited by

Patent Information

Application Number
CN202610043413.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-01-14
Publication Date
2026-02-13

AI Technical Summary

Technical Problem

Existing entity and relation extraction models based on large language models have bottlenecks in inference speed and resource consumption, and the output results lack the location information of entities in the original text, which increases the complexity of downstream tasks and the possibility of location errors.

Method used

The BERT model is used to extract text semantic vectors and relation semantic vectors in parallel. Combined with relation pointer networks and non-relation pointer networks, relation triples and non-relation entities are extracted simultaneously, and the output includes entity location information.

Benefits of technology

It significantly improves extraction efficiency, shortens inference time by more than 50%, reduces system complexity, meets the needs of high-concurrency real-time scenarios, and directly provides entity location information to simplify downstream tasks.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121524367A_ABST
    Figure CN121524367A_ABST
Patent Text Reader

Abstract

The invention provides a text extraction method and system, a medium and a terminal. The method comprises the following steps: acquiring a target text; extracting a text semantic vector and a relation semantic vector of the target text; based on the text semantic vector and the relation semantic vector, extracting a relation triple and a non-relation entity in the target text; and outputting the relation triple, the non-relation entity, the relation triple position information and the non-relation entity position information as text extraction results. According to the text extraction method and system, the medium and the terminal, synchronous extraction of the relation triad and the non-relation entity can be achieved, and the extraction efficiency is effectively improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of deep learning technology, and in particular to a text extraction method, system, medium, and terminal. Background Technology

[0002] Entity and relation extraction is one of the core tasks in Natural Language Processing (NLP). Its goal is to identify named entities (such as names of people, places, and organizations) from unstructured text and mine semantic relationships between entities (such as "belongs to" or "holds a position in"), ultimately forming structured relation triples (head entity-relation-tail entity). This technology is widely used in knowledge graph construction, information retrieval, intelligent question answering, and public opinion analysis, serving as a key support for achieving structured and intelligent processing of textual information.

[0003] With the development of deep learning technology, entity and relation extraction models have evolved from traditional machine learning methods (such as support vector machines and conditional random fields) to deep learning methods. In recent years, extraction models based on pre-trained language models (such as BERT, RoBERTa, and GPT series) have become mainstream. These models significantly improve the performance of extraction tasks by making full use of the semantic information of large-scale corpora.

[0004] However, generative inference methods based on large language model (LLM) decoder architectures require token-by-token output, and the model parameters typically reach billions or even hundreds of billions, resulting in massive computational load and high memory consumption during a single inference process. Therefore, in entity and relation extraction tasks, there are problems of slow inference speed and high resource consumption, making it difficult to meet the needs of real-time extraction scenarios. Furthermore, its output generally only contains textual information of entities and relations, lacking the location information of entities in the original text. This forces downstream tasks (such as text annotation and context analysis) to additionally locate entity positions through string matching, which not only increases operational complexity but may also lead to positioning errors due to ambiguity of entities (such as the same entity name appearing multiple times in the text). Summary of the Invention

[0005] In view of the shortcomings of the prior art described above, the purpose of this invention is to provide a text extraction method, system, medium and terminal that can realize the synchronous extraction of relation triples and non-relation entities, effectively improving the extraction efficiency.

[0006] In a first aspect, the present invention provides a text extraction method, the method comprising the following steps: acquiring target text; extracting text semantic vector and relation semantic vector of the target text; extracting relation triples and non-relation entities from the target text based on the text semantic vector and relation semantic vector; and outputting the relation triples, the non-relation entities, the position information of the relation triples and the position information of the non-relation entities as the text extraction result.

[0007] In one implementation of the first aspect, extracting the text semantic vector and relational semantic vector of the target text includes the following steps:

[0008] The target text is segmented to obtain the corresponding word units;

[0009] For each word, obtain the corresponding word identifier, segment identifier, and attention mask. The segment identifier is used to identify the segment in which the word is located, and the attention mask is used to indicate whether the word is a valid word.

[0010] Obtain the start and end positions of each word element in the target text;

[0011] Input the lexical identifier, the segment identifier, and the attention mask into the BERT model to obtain the text semantic vector and the relational semantic vector.

[0012] In one implementation of the first aspect, the BERT model includes a multi-layer Transformer encoder to extract the text semantic vector and the relational semantic vector in parallel, each Transformer encoder including a multi-head attention mechanism and a fully connected neural network.

[0013] In one implementation of the first aspect, extracting relation triples and non-relation entities from the target text based on the text semantic vector and relation semantic vector includes the following steps:

[0014] Obtain the relational pointer network and the non-relational pointer network;

[0015] The text semantic vector is input into the non-relational pointer network to obtain the non-relational entity;

[0016] The text semantic vector and the relation semantic vector are input into the relation pointer network to obtain the relation triplet.

[0017] In one implementation of the first aspect, the relation pointer network includes a relation entity pointer network and a relation pair pointer network;

[0018] The process of inputting the text semantic vector and the relation semantic vector into the relation pointer network to obtain the relation triplet includes the following steps:

[0019] The text semantic vector and the relation semantic vector are input into the relation entity pointer network to obtain the entities in the target text;

[0020] The text semantic vector and the relation semantic vector are input into the relation pairing pointer network to obtain the entity relations in the target text;

[0021] The relation triples are constructed based on the entities and their relationships.

[0022] In one implementation of the first aspect, the relation pointer network, the relation entity pointer network, and the relation pairing pointer network all employ a binary classifier.

[0023] In one implementation of the first aspect, the relation pointer network and the non-relation pointer network are obtained through joint training, and the total loss function used for training is a weighted sum of the loss functions of the relation pointer network and the non-relation pointer network.

[0024] Secondly, the present invention provides a text extraction system, the system comprising an acquisition module, an extraction module, an extraction module, and an output module;

[0025] The acquisition module is used to acquire the target text;

[0026] The extraction module is used to extract the text semantic vector and relational semantic vector of the target text;

[0027] The extraction module is used to extract relation triples and non-relation entities from the target text based on the text semantic vector and relation semantic vector;

[0028] The output module is used to output the relation triples, the non-relation entities, the position information of the relation triples, and the position information of the non-relation entities as text extraction results.

[0029] Thirdly, the present invention provides a storage medium on which a computer program is stored, which, when executed by a processor, implements the above-described text extraction method.

[0030] Fourthly, the present invention provides a terminal, comprising: a processor and a memory;

[0031] The memory is used to store computer programs;

[0032] The processor is used to execute the computer program stored in the memory, so that the terminal performs the text extraction method described above.

[0033] As described above, the text extraction method, system, medium, and device of the present invention have the following beneficial effects:

[0034] (1) It can realize the synchronous extraction of relation triples and non-relation entities. Compared with the existing solutions, the inference time is reduced by more than 50%, and no additional entity recognition models need to be called, which significantly reduces the complexity of system deployment.

[0035] (2) The encoder architecture (such as BERT) uses parallel computing to process text, without the need for token-by-token generation, and the number of parameters can be flexibly adjusted according to the needs (such as BERT-base which contains only 110 million parameters). Its inference speed is much lower than that of the decoder architecture in the existing technology. For example, in a single GPU environment, the average inference time for 1,000 characters of text is only 5-10ms. Compared with LLM with equivalent performance (such as GPT-3.5), the inference speed is increased by 10-20 times, which can meet the high concurrency and real-time extraction scenarios, such as real-time public opinion monitoring and intelligent customer service dialogue analysis.

[0036] (3) Incorporate entity location information into the model output so that the extraction results contain both "text content and location coordinates" information. Downstream tasks can directly locate the entity context based on the location information without additional processing, effectively reducing the complexity of downstream tasks.

[0037] (4) It enhances the ability to learn the features of non-relational entities and improves the accuracy and completeness of multi-target extraction. Attached Figure Description

[0038] Figure 1 The flowchart shown is an embodiment of the text extraction method of the present invention;

[0039] Figure 2 This is a schematic diagram illustrating the extraction of relation triples and non-relational entities in one embodiment of the present invention;

[0040] Figure 3 The diagram shown is a structural schematic of the text extraction system of the present invention in one embodiment.

[0041] Figure 4 The diagram shown is a structural schematic of the terminal of the present invention in one embodiment. Detailed Implementation

[0042] The following specific examples illustrate the implementation of the present invention. Those skilled in the art can easily understand other advantages and effects of the present invention from the content disclosed in this specification. The present invention can also be implemented or applied through other different specific embodiments, and various details in this specification can also be modified or changed based on different viewpoints and applications without departing from the spirit of the present invention. It should be noted that, unless otherwise specified, the following embodiments and features described therein can be combined with each other.

[0043] It should be noted that the illustrations provided in the following embodiments are only schematic representations of the basic concept of the present invention. Therefore, the drawings only show the components related to the present invention and are not drawn according to the actual number, shape and size of the components in the actual implementation. In the actual implementation, the form, quantity and proportion of each component can be arbitrarily changed, and the layout of the components may also be more complex.

[0044] The following embodiments of the present invention provide a text extraction method that can be applied to a terminal. The terminal described in this invention may include mobile phones with wireless charging capabilities, tablet computers, laptops, wearable devices, in-vehicle devices, augmented reality (AR) / virtual reality (VR) devices, ultra-mobile personal computers (UMPCs), netbooks, personal digital assistants (PDAs), etc. The embodiments of the present invention do not impose any restrictions on the specific type of terminal.

[0045] For example, the terminal may be a station (STAION, ST) in a WLAN with wireless charging capability, a cellular phone, cordless phone, Session Initiation Protocol (SIP) phone, Wireless Local Loop (WLL) station, Personal Digital Assistant (PDA) device, handheld device with wireless charging capability, computing device or other processing device, computer, laptop computer, handheld communication device, handheld computing device, and / or other devices for communication over a wireless system, as well as next-generation communication systems, such as mobile terminals in 5G networks, mobile terminals in future evolved Public Land Mobile Networks (PLMNs), or mobile terminals in future evolved Non-terrestrial Networks (NTNs).

[0046] For example, the terminal can communicate with networks and other devices wirelessly. The wireless communication can use any communication standard or protocol, including but not limited to Global System for Mobile Communication (GSM), General Packet Radio Service (GPRS), Code Division Multiple Access (CDMA), Wideband Code Division Multiple Access (WCDMA), Long Term Evolution (LTE), email, Short Messaging Service (SMS), BT, GNSS, WLAN, NFC, FM, and / or IR technologies. The GNSS can include Global Positioning System (GPS), Global Navigation Satellite System (GLONASS), BeiDou Navigation Satellite System (BDS), Quasi-Zenith Satellite System (QZSS), and / or Satellite Based Augmentation Systems (SBAS).

[0047] The technical solutions of the present invention will now be described in detail with reference to the accompanying drawings.

[0048] like Figure 1 As shown, in one embodiment, the text extraction method of the present invention includes steps S1-S4.

[0049] Step S1: Obtain the target text.

[0050] Specifically, the target text is the text to be extracted.

[0051] Step S2: Extract the text semantic vector and relational semantic vector of the target text.

[0052] Specifically, extracting the text semantic vector and relational semantic vector of the target text includes the following steps:

[0053] 21) Segment the target text to obtain the corresponding word units.

[0054] Among them, the WordPiece tokenizer provided by BERT is used to tokenize the target text, and the target text is split into a sequence of tokens. For example, after tokenizing the sentence "Zhang San has a very high evaluation of the Tang Dynasty poet Li Bai", we get: [CLS, Zhang, San, dui, Tang, Chao, shi, ren, Li, Bai, ping, jia, hen, gao, SEP]. Here, [CLS] is the sentence start marker, and [SEP] is the sentence end marker. In addition, the detected relationship type text is concatenated to obtain [CLS, Zhang, San, dui, Tang, Chao, shi, ren, Li, Bai, ping, jia, hen, gao, SEP, Chao, dai, SEP].

[0055] 22) For each token, obtain the corresponding token ID, segment ID, and attention mask. The segment ID is used to identify the paragraph where the token is located, and the attention mask is used to indicate whether the token is a valid token.

[0056] Among them, three features are constructed for each token:

[0057] ① Token ID: Map the token after tokenization to the unique ID in the BERT vocabulary;

[0058] ② Segment ID: Used to distinguish the paragraph where the sentence is located, and all are 0 in the single-sentence extraction task;

[0059] ③ Attention Mask: Used to mark valid tokens, where the non-padding part is 1 and the padding part is 0.

[0060] 23) Obtain the start position and end position of each token in the target text.

[0061] Among them, record the start character position and end character position of each token in the target text for subsequent output of entity position information. For example, "Li" corresponds to the 7th character of the target text, and "Bai" corresponds to the 8th character of the target text.

[0062] 24) Input the token ID, the segment ID, and the attention mask into the BERT model to obtain the text semantic vector and the relationship semantic vector.

[0063] Specifically, a pre-trained BERT model (supporting different specifications such as BERT-base and BERT-large) is used as the encoder to output semantic vectors. Its parallel computing advantage is leveraged to improve inference speed, while parameter fine-tuning balances model performance and computational cost. The BERT model includes multi-layer Transformer encoders to extract the text semantic vectors and relational semantic vectors in parallel. Each Transformer encoder layer includes a multi-head attention mechanism and a fully connected neural network, capable of capturing long-distance dependencies and contextual semantic information between tokens.

[0064] Step S3: Extract relation triples and non-relation entities from the target text based on the text semantic vector and relation semantic vector.

[0065] Specifically, a relational entity refers to an entity that has a relationship with other entities; a non-relational entity refers to an entity that does not have a relationship with other entities. For example, in the statement "Zhang San has a high opinion of Li Bai of the Tang Dynasty", the relational triple "Li Bai-Dynasty-Tang Dynasty" and the non-relational entity "Zhang San" can be extracted.

[0066] like Figure 2 As shown, extracting relation triples and non-relation entities from the target text based on the text semantic vector and relation semantic vector includes the following steps:

[0067] 31) Obtain the relational pointer network and the non-relational pointer network.

[0068] This invention employs a dual-pointer network, comprising a relation pointer network and a non-relation pointer network, to simultaneously extract relational entities and non-relational entities, thereby achieving dual-objective prediction in a single step. The relation pointer network includes a relational entity pointer network and a relational pairing pointer network, used to extract entities and the relationship types between entities, respectively.

[0069] 32) Input the text semantic vector into the non-relational pointer network to obtain the non-relational entity.

[0070] The non-relational pointer network employs a binary classifier structure. It takes the text semantic vector as input, without involving the relational semantic vector to avoid interference from relational information in the identification of non-relational entities. It outputs the probability that each token represents the "starting position" or "ending position" of a non-relational entity. By filtering position combinations through a threshold and combining them with position encoding, the non-relational entity text and location information are obtained, for example, "Zhang San".

[0071] 33) Input the text semantic vector and the relation semantic vector into the relation pointer network to obtain the relation triplet.

[0072] Specifically, the text semantic vector and the relation semantic vector are input into the relation entity pointer network to obtain entities in the target text. The text semantic vector and the relation semantic vector are input into the relation pairing pointer network to obtain entity relations in the target text. Relation triples are constructed based on the entities and entity relations.

[0073] The relation entity pointer network uses a binary classifier (Sigmoid activation function) to predict the position. It processes the text semantic vector and the relation semantic vector, outputting the probability that each token is the "entity start position" or "entity end position", thus obtaining the relation entity. The relation pairing pointer network uses a binary classifier with a Sigmoid activation function to predict the relation type. Let the text length be N and the total number of relation types be M. Finally, M matrices with dimensions N×N are output. Each matrix m_k (k∈[1,M]) corresponds to a relation type. The value of coordinate (i,j) in the matrix represents the probability that the relation triple "starting at i and ending at j" is true. The matrix as a whole covers all possible triple extraction results under this relation.

[0074] Step S4: Output the relation triples, the non-relation entities, the position information of the relation triples, and the position information of the non-relation entities as the text extraction results.

[0075] Specifically, when outputting the text extraction results, the position information corresponding to the relation triple and the position information corresponding to the non-relation entity are obtained based on the start and end positions of each recorded word in the target text, thereby realizing the synchronous output of "text content-position information". Downstream tasks can directly locate the entity context based on the position information without additional processing, improving the operation efficiency by 30%.

[0076] It should be noted that the relation pointer network and the non-relation pointer network are obtained through joint training. The total loss function L used in training is a weighted sum of the loss function L1 of the relation pointer network and the loss function L2 of the non-relation pointer network. That is, L = α*L1 + β*L2, where α and β are weight coefficients, both set to 0.5 (which can be adjusted according to task requirements). Both L1 and L2 use the binary cross-entropy loss function.

[0077] The scope of protection of the text extraction method described in this embodiment is not limited to the execution order of the steps listed in this embodiment. Any solution implemented by adding, subtracting, or replacing steps in the prior art based on the principle of this invention is included within the scope of protection of this invention.

[0078] This invention also provides a text extraction system that can implement the text extraction method described in this invention. However, the implementation device of the text extraction system described in this invention includes, but is not limited to, the structure of the text extraction system listed in this embodiment. All structural modifications and substitutions of the prior art made in accordance with the principles of this invention are included within the protection scope of this invention.

[0079] like Figure 3 As shown, in one embodiment, the text extraction system of the present invention includes an acquisition module 31, an extraction module 32, an extraction module 33, and an output module 34.

[0080] The acquisition module 31 is used to acquire the target text.

[0081] The extraction module 32 is connected to the acquisition module 31 and is used to extract the text semantic vector and relational semantic vector of the target text.

[0082] The extraction module 33 is connected to the extraction module 32 and is used to extract relation triples and non-relation entities from the target text based on the text semantic vector and relation semantic vector.

[0083] The output module 34 is connected to the extraction module 33 and is used to output the relation triples, the non-relation entities, the position information of the relation triples and the position information of the non-relation entities as text extraction results.

[0084] The structure and principle of the acquisition module 31, extraction module 32, extraction module 33 and output module 34 correspond one-to-one with the steps in the above text extraction method, so they will not be described again here.

[0085] In the embodiments provided by this invention, it should be understood that the disclosed systems, apparatuses, or methods can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative. For instance, the division of modules / units is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple modules or units may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be through some interfaces; the indirect coupling or communication connection of apparatuses or modules or units may be electrical, mechanical, or other forms.

[0086] The modules / units described as separate components may or may not be physically separate. The components shown as modules / units may or may not be physical modules; that is, they may be located in one place or distributed across multiple network units. Some or all of the modules / units can be selected to achieve the objectives of the embodiments of the present invention, depending on actual needs. For example, the functional modules / units in the various embodiments of the present invention may be integrated into one processing module, or each module / unit may exist physically separately, or two or more modules / units may be integrated into one module / unit.

[0087] Those skilled in the art will further recognize that the units and algorithm steps of the various examples described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of both. To clearly illustrate the interchangeability of hardware and software, the components and steps of the various examples have been generally described in terms of functionality in the foregoing description. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementations should not be considered beyond the scope of this invention.

[0088] This invention also provides a computer-readable storage medium. Those skilled in the art will understand that all or part of the steps in the text extraction method of the above embodiments can be implemented by a program instructing a processor. The program can be stored in a computer-readable storage medium, which is a non-transitory medium, such as random access memory, read-only memory, flash memory, hard disk, solid-state drive, magnetic tape, floppy disk, optical disk, and any combination thereof. The storage medium can be any available medium accessible to a computer or a data storage device such as a server or data center that integrates one or more available media. This available medium can be a magnetic medium (e.g., floppy disk, hard disk, magnetic tape), an optical medium (e.g., digital video disc (DVD)), or a semiconductor medium (e.g., solid-state disk (SSD)).

[0089] This invention also provides a terminal. The terminal includes a processor and a memory.

[0090] The memory is used to store computer programs.

[0091] The memory includes various media capable of storing program code, such as ROM, RAM, magnetic disk, USB flash drive, memory card, or optical disk.

[0092] The processor is connected to the memory and is used to execute the computer program stored in the memory so that the terminal performs the above-described text extraction method.

[0093] Preferably, the processor can be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; it can also be a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components.

[0094] like Figure 4 As shown, the terminal of the present invention is presented in the form of a general-purpose computing device. The components of the terminal may include, but are not limited to: one or more processors or processing units 41, a memory 42, and a bus 43 connecting different system components (including the memory 42 and the processing unit 41).

[0095] Bus 43 represents one or more of several bus architectures, including a memory bus or memory controller, a peripheral bus, a graphics acceleration port, a processor, or a local bus using any of the various bus architectures. For example, these architectures include, but are not limited to, the Industry Standard Architecture (ISA) bus, the Micro Channel Architecture (MAC) bus, the Enhanced ISA bus, the Video Electronics Standards Association (VESA) local bus, and the Peripheral Component Interconnect (PCI) bus.

[0096] Terminals typically include various computer system-readable media. These media can be any available media that can be accessed by the terminal, including volatile and non-volatile media, and removable and non-removable media.

[0097] Memory 42 may include computer system readable media in the form of volatile memory, such as random access memory (RAM) 421 and / or cache memory 422. The terminal may further include other removable / non-removable, volatile / non-volatile computer system storage media. By way of example only, storage system 423 may be used to read and write non-removable, non-volatile magnetic media (…). Figure 4 Not shown; usually referred to as a "hard drive"). Although Figure 4Not shown, a disk drive for reading and writing to a removable non-volatile disk (e.g., a "floppy disk") and an optical disk drive for reading and writing to a removable non-volatile optical disk (e.g., a CD-ROM, DVD-ROM, or other optical media) may be provided. In these cases, each drive may be connected to bus 43 via one or more data media interfaces. Memory 42 may include at least one program product having a set (e.g., at least one) of program modules configured to perform the functions of the embodiments of the present invention.

[0098] A program / utility 424 having a set (at least one) of program modules 4241 may be stored, for example, in memory 42. Such program modules 4241 include, but are not limited to, an operating system, one or more application programs, other program modules, and program data. Each or some combination of these examples may include an implementation of a network environment. Program modules 4241 typically perform the functions and / or methods described in the embodiments of the present invention.

[0099] The terminal can also communicate with one or more external devices (e.g., keyboard, pointing device, display, etc.), one or more devices that enable user interaction with the terminal, and / or any device that enables the terminal to communicate with one or more other computing devices (e.g., network interface card, modem, etc.). This communication can be performed through input / output (I / O) interface 44. Furthermore, the terminal can also communicate with one or more networks (e.g., local area network (LAN), wide area network (WAN), and / or public networks, such as the Internet) through network adapter 45. Figure 4 As shown, network adapter 45 communicates with other modules of the terminal via bus 43. It should be understood that, although not shown in the figure, other hardware and / or software modules can be used in conjunction with the terminal, including but not limited to: microcode, device drivers, redundant processing units, external disk drive arrays, RAID systems, tape drives, and data backup storage systems.

[0100] The above embodiments are merely illustrative of the principles and effects of the present invention and are not intended to limit the invention. Any person skilled in the art can modify or alter the above embodiments without departing from the spirit and scope of the present invention. Therefore, all equivalent modifications or alterations made by those skilled in the art without departing from the spirit and technical concept disclosed in the present invention should still be covered by the claims of the present invention.

Claims

1. A text extraction method, characterized in that, The method includes the following steps: Get the target text; Extract the text semantic vector and relational semantic vector of the target text; Based on the text semantic vector and relation semantic vector, extract relation triples and non-relation entities from the target text; The relation triples, the non-relation entities, the position information of the relation triples, and the position information of the non-relation entities are output as text extraction results. Extracting relational triples and non-relational entities from the target text based on the text semantic vector and relational semantic vector includes the following steps: Obtain the relational pointer network and the non-relational pointer network; The text semantic vector is input into the non-relational pointer network to obtain the non-relational entity; Input the text semantic vector and the relation semantic vector into the relation pointer network to obtain the relation triples; The relation pointer network includes a relation entity pointer network and a relation pair pointer network; The process of inputting the text semantic vector and the relation semantic vector into the relation pointer network to obtain the relation triplet includes the following steps: The text semantic vector and the relation semantic vector are input into the relation entity pointer network to obtain the entities in the target text; The text semantic vector and the relation semantic vector are input into the relation pairing pointer network to obtain the entity relations in the target text; The relation triples are constructed based on the entities and their relationships.

2. The text extraction method according to claim 1, characterized in that, Extracting the text semantic vector and relational semantic vector of the target text includes the following steps: The target text is segmented to obtain the corresponding word units; For each word, obtain the corresponding word identifier, segment identifier, and attention mask. The segment identifier is used to identify the segment in which the word is located, and the attention mask is used to indicate whether the word is a valid word. Obtain the start and end positions of each word element in the target text; Input the lexical identifier, the segment identifier, and the attention mask into the BERT model to obtain the text semantic vector and the relational semantic vector.

3. The text extraction method according to claim 2, characterized in that, The BERT model includes a multi-layer Transformer encoder to extract the text semantic vector and the relation semantic vector in parallel. Each Transformer encoder includes a multi-head attention mechanism and a fully connected neural network.

4. The text extraction method according to claim 1, characterized in that, The relation pointer network, the relation entity pointer network, and the relation pairing pointer network all employ a binary classifier.

5. The text extraction method according to claim 1, characterized in that, The relation pointer network and the non-relation pointer network are obtained through joint training. The total loss function used in training is a weighted sum of the loss functions of the relation pointer network and the non-relation pointer network.

6. A text extraction system, characterized in that, The system includes an acquisition module, an extraction module, a decomposition module, and an output module; The acquisition module is used to acquire the target text; The extraction module is used to extract the text semantic vector and relational semantic vector of the target text; The extraction module is used to extract relation triples and non-relation entities from the target text based on the text semantic vector and relation semantic vector; The output module is used to output the relation triplet, the non-relation entity, the position information of the relation triplet, and the position information of the non-relation entity as the text extraction result; Extracting relational triples and non-relational entities from the target text based on the text semantic vector and relational semantic vector includes the following steps: Obtain the relational pointer network and the non-relational pointer network; The text semantic vector is input into the non-relational pointer network to obtain the non-relational entity; Input the text semantic vector and the relation semantic vector into the relation pointer network to obtain the relation triples; The relation pointer network includes a relation entity pointer network and a relation pair pointer network; The process of inputting the text semantic vector and the relation semantic vector into the relation pointer network to obtain the relation triplet includes the following steps: The text semantic vector and the relation semantic vector are input into the relation entity pointer network to obtain the entities in the target text; The text semantic vector and the relation semantic vector are input into the relation pairing pointer network to obtain the entity relations in the target text; The relation triples are constructed based on the entities and their relationships.

7. A storage medium having a computer program stored thereon, characterized in that, When the program is executed by the processor, it implements the text extraction method according to any one of claims 1 to 5.

8. A terminal, characterized in that, include: Processor and memory; The memory is used to store computer programs; The processor is used to execute the computer program stored in the memory to cause the terminal to perform the text extraction method according to any one of claims 1 to 5.

Citation Information

Patent Citations

  • Fusion relation information coding-based entity relation extraction method in a legal instrument

    CN113743118A

  • Medical text entity relation joint extraction method based on decomposition-recombination strategy

    CN114841151A

  • Knowledge graph construction method and device and medium

    CN116595195A

  • Method, device and equipment for extracting patent entity relationship, medium and product

    CN120218067A

  • Entity relation joint extraction method and system based on deep learning

    CN120450025A