CN115618002A - Entity relationship extraction model training method, entity relationship extraction method and device - Google Patents

Entity relationship extraction model training method, entity relationship extraction method and device Download PDF

Info

Publication number
CN115618002A
CN115618002A CN202211362185.1A CN202211362185A CN115618002A CN 115618002 A CN115618002 A CN 115618002A CN 202211362185 A CN202211362185 A CN 202211362185A CN 115618002 A CN115618002 A CN 115618002A
Authority
CN
China
Prior art keywords
entity
sample
labeling
text
relationship extraction
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202211362185.1A
Other languages
Chinese (zh)
Inventor
刘霄晨
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Lianren Healthcare Big Data Technology Co Ltd
Original Assignee
Lianren Healthcare Big Data Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Lianren Healthcare Big Data Technology Co Ltd filed Critical Lianren Healthcare Big Data Technology Co Ltd
Priority to CN202211362185.1A priority Critical patent/CN115618002A/en
Publication of CN115618002A publication Critical patent/CN115618002A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/30Information retrieval; Database structures therefor; File system structures therefor of unstructured textual data
    • G06F16/35Clustering; Classification
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F40/00Handling natural language data
    • G06F40/20Natural language analysis
    • G06F40/279Recognition of textual entities
    • G06F40/289Phrasal analysis, e.g. finite state techniques or chunking
    • G06F40/295Named entity recognition

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Databases & Information Systems (AREA)
  • Data Mining & Analysis (AREA)
  • Health & Medical Sciences (AREA)
  • Artificial Intelligence (AREA)
  • Audiology, Speech & Language Pathology (AREA)
  • Computational Linguistics (AREA)
  • General Health & Medical Sciences (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The invention discloses an entity relationship extraction model training method, an entity relationship extraction method and an entity relationship extraction device. The model training method comprises the following steps: acquiring a sample text for model training, and performing entity identification on the sample text to obtain each sample entity of the sample text; determining corresponding labeling labels based on the sample entities, and labeling the sample entities based on the labeling labels to obtain relationship labeling results of the sample entities; and performing model iterative training on the initial entity relationship extraction model based on the relationship labeling result to obtain a trained target entity relationship extraction model. The technical scheme disclosed by the invention solves the problem that the judgment capability of the extraction method in the prior art on the medical entity relationship is low, and improves the accuracy of the entity relationship extraction in the medical text.

Description

Entity relationship extraction model training method, entity relationship extraction method and device
Technical Field
The invention relates to the technical field of computers, in particular to an entity relationship extraction model training method, an entity relationship extraction method and an entity relationship extraction device.
Background
There are a large amount of unstructured text and structured text in hospital data, and when data processing of medical data is required, particularly when processing unstructured data, it needs to be converted into structured information by Natural Language Processing (NLP) technology for machine processing. The medical long text has own special attributes, and is different from the traditional internet text and the commodity text in nature, and a series of characteristics such as omission of subject and object, occurrence of a plurality of continuous parallel phrases and the like often appear in the medical text, so that the judgment capability of the extraction method in the prior art on the medical entity relationship is low, and the accuracy of the entity relationship of the combined extraction is low.
Disclosure of Invention
The invention provides an entity relation extraction model training method, an entity relation extraction method and an entity relation extraction device, which are used for solving the problem that the judgment capability of an extraction method in the prior art on medical entity relations is low and improving the accuracy of entity relation extraction in medical texts.
In a first aspect, an embodiment of the present invention provides an entity relationship extraction model training method, where the method includes:
obtaining a sample text for model training, and performing entity recognition on the sample text to obtain each sample entity of the sample text;
determining corresponding labeling labels based on the sample entities, and labeling the sample entities based on the labeling labels to obtain a relation labeling result of the sample entities;
and performing model iterative training on the initial entity relationship extraction model based on the relationship labeling result to obtain a trained target entity relationship extraction model.
Optionally, the obtaining a sample text for model training includes:
acquiring medical text data for model training, and performing data preprocessing on the medical text data to obtain sample data;
and acquiring characters in the sample data, and performing data segmentation on the sample data based on the character type of the characters to obtain at least one section of sample text.
Optionally, the determining a corresponding label based on each sample entity, and labeling the sample entity based on the label to obtain a relationship labeling result of the sample entity includes:
determining entity types corresponding to the sample entities respectively;
acquiring each labeling label, and determining corresponding labeling labels for any two sample entities based on entity types respectively corresponding to the current two sample entities;
and determining a relation labeling result between the current two sample entities based on the labeling label.
Optionally, before the labeling the sample entity based on the label tag, the method further includes:
and screening character sample entities in the sample entities, and labeling based on the screened sample entities.
Optionally, the performing model iterative training on the initial entity relationship extraction model based on the relationship labeling result includes:
and obtaining a preset labeling data format, carrying out format conversion on the relation labeling result based on the labeling data format to obtain labeling data, and carrying out model iterative training on an initial entity relation extraction model based on the labeling data.
In a second aspect, an embodiment of the present invention further provides an entity relationship extraction method, where the method includes:
acquiring a text to be extracted, and determining each entity of the text to be extracted;
acquiring a pre-trained entity relationship extraction model, and inputting each entity into the entity relationship extraction model to obtain an entity relationship extraction result of the text to be extracted; the entity relationship extraction model is obtained by training based on the entity relationship extraction model training method in any embodiment;
and carrying out relation analysis on the entity relation extraction result to obtain a target extraction result of the text to be extracted.
In a third aspect, an embodiment of the present invention further provides an entity relationship extraction model training apparatus, where the apparatus includes:
the system comprises a sample entity obtaining module, a model training module and a model identification module, wherein the sample entity obtaining module is used for obtaining a sample text for model training and carrying out entity identification on the sample text to obtain each sample entity of the sample text;
a relation labeling result obtaining module, configured to determine a corresponding labeling label based on each sample entity, and label the sample entities based on the labeling labels to obtain a relation labeling result of the sample entities;
and the entity relationship extraction model training module is used for carrying out model iterative training on the initial entity relationship extraction model based on the relationship labeling result to obtain a trained target entity relationship extraction model.
In a fourth aspect, an embodiment of the present invention further provides an entity relationship extracting apparatus, where the apparatus includes:
the entity obtaining module is used for obtaining a text to be extracted and determining each entity of the text to be extracted;
the entity relationship extraction result determining module is used for acquiring a pre-trained entity relationship extraction model, inputting each entity into the entity relationship extraction model and obtaining an entity relationship extraction result of the text to be extracted; the entity relationship extraction model is obtained by training based on the entity relationship extraction model training method in any embodiment;
and the entity extraction result obtaining module is used for carrying out relationship analysis on the entity relationship extraction result to obtain a target extraction result of the text to be extracted.
In a fifth aspect, an embodiment of the present invention further provides an electronic device, including:
at least one processor; and
a memory communicatively coupled to the at least one processor; wherein the content of the first and second substances,
the memory stores a computer program executable by the at least one processor, the computer program being executable by the at least one processor to enable the at least one processor to perform the entity relationship extraction model training method of any of the embodiments of the present invention; and/or, executing the entity relation extraction method according to any embodiment of the present invention.
In a sixth aspect, an embodiment of the present invention further provides a computer-readable storage medium, where the computer-readable storage medium stores computer instructions, and the computer instructions are configured to, when executed, enable a processor to implement the entity relationship extraction model training method according to any embodiment of the present invention; and/or, executing the entity relationship extraction method according to any embodiment of the present invention.
According to the technical scheme disclosed by the embodiment of the invention, each sample entity of the sample text is obtained by obtaining the sample text for model training and carrying out entity recognition on the sample text; determining corresponding labeling labels based on the sample entities, and labeling the sample entities based on the labeling labels to obtain a relation labeling result of the sample entities; performing model iterative training on the initial entity relationship extraction model based on the relationship labeling result to obtain a trained target entity relationship extraction model; the problem that the judgment capability of the extraction method in the prior art on the medical entity relationship is low is solved, and the accuracy of the entity relationship extraction in the medical text is improved.
It should be understood that the statements in this section are not intended to identify key or critical features of the embodiments of the present invention, nor are they intended to limit the scope of the invention. Other features of the present invention will become apparent from the following description.
Drawings
In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the drawings needed to be used in the description of the embodiments will be briefly introduced below, and it is obvious that the drawings in the following description are only some embodiments of the present invention, and it is obvious for those skilled in the art to obtain other drawings based on these drawings without creative efforts.
FIG. 1 is a flowchart of a method for training an entity relationship extraction model according to an embodiment of the present invention;
fig. 2 is a flowchart of an entity relationship extraction method according to a second embodiment of the present invention;
FIG. 3 is a schematic structural diagram of an entity relationship extraction model training apparatus according to a third embodiment of the present invention;
fig. 4 is a schematic structural diagram of an entity relationship extraction apparatus according to a fourth embodiment of the present invention;
fig. 5 is a schematic structural diagram of an electronic device according to a fifth embodiment of the present invention.
Detailed Description
In order to make the technical solutions of the present invention better understood, the technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
It should be noted that the terms "first," "second," and the like in the description and claims of the present invention and in the drawings described above are used for distinguishing between similar elements and not necessarily for describing a particular sequential or chronological order. It is to be understood that the data so used is interchangeable under appropriate circumstances such that the embodiments of the invention described herein are capable of operation in sequences other than those illustrated or described herein.
The names of messages or information exchanged between devices in the embodiments of the present disclosure are for illustrative purposes only, and are not intended to limit the scope of the messages or information.
It is understood that, before the technical solutions disclosed in the embodiments of the present disclosure are used, the user should be informed of the type, the use range, the use scene, etc. of the personal information related to the present disclosure in a proper manner according to the relevant laws and regulations and obtain the authorization of the user.
For example, in response to receiving an active request from a user, a prompt message is sent to the user to explicitly prompt the user that the requested operation to be performed would require the acquisition and use of personal information to the user. Thus, the user can autonomously select whether to provide personal information to software or hardware such as an electronic device, an application program, a server, or a storage medium that performs the operations of the technical solution of the present disclosure, according to the prompt information.
As an optional but non-limiting implementation manner, in response to receiving an active request from the user, the manner of sending the prompt information to the user may be, for example, a pop-up window, and the prompt information may be presented in a text manner in the pop-up window. In addition, a selection control for providing personal information to the electronic device by the user's selection of "agreeing" or "disagreeing" can be carried in the pop-up window.
It is understood that the above notification and user authorization process is only illustrative and not limiting, and other ways of satisfying relevant laws and regulations may be applied to the implementation of the present disclosure.
It will be appreciated that the data referred to in this disclosure, including but not limited to the data itself, the acquisition or use of the data, should comply with the requirements of the applicable laws and regulations and related regulations.
Example one
Fig. 1 is a flowchart of an entity relationship extraction model training method according to an embodiment of the present invention, which is applicable to extracting entity relationships in texts, and in particular, is more applicable to extracting entity relationships in medical texts. The method can be executed by an entity relationship extraction model training device, the entity relationship extraction model training device can be realized in a hardware and/or software mode, and the entity relationship extraction model training device can be configured in an intelligent terminal and a cloud server. As shown in fig. 1, the method includes:
s110, obtaining a sample text for model training, and performing entity recognition on the sample text to obtain each sample entity of the sample text.
In the embodiment of the present invention, the sample text may be a text sentence obtained by processing the medical text data. The medical text data is generated according to the description of the visiting user in the visiting process.
In practical application, a doctor user carries out a doctor description in the doctor process, the doctor user generates diagnosis and treatment according to the doctor description, and the doctor process is collated to generate medical text data of the doctor user; the medical text data includes a plurality of text sentences. In other words, the medical text data is subjected to text segmentation, so that a plurality of text sentences can be obtained. The text sentence can be used as sample text for model training.
Optionally, in this embodiment, the method for obtaining the medical text data and processing the medical text data to obtain the sample text for model training may include: acquiring medical text data for model training, and performing data preprocessing on the medical text data to obtain sample data; and acquiring characters in the sample data, and performing data segmentation on the sample data based on the character type of the characters to obtain at least one section of sample text.
In this embodiment, the data preprocessing includes, but is not limited to, data processing such as full half-angle conversion, ASCII code check, continuous null character check, and illegal character check. In the present embodiment, the processing sequence for performing the above-described preprocessing on the medical text data is not limited.
Specifically, full half-angle conversion and ASCII coding verification are carried out on medical text data, the data format of the medical text data can be unified, the model can concentrate on learning data processing in one format in the training process, the learning capability of the model in the training process is improved, and the training effect of the model is improved. Specifically, the medical text is subjected to continuous null character check and illegal character check, so that invalid characters in the medical text data can be screened out, the operation data amount of the model in the training process is reduced, and the training efficiency of the model is improved.
In order to improve the identification efficiency of the subsequent entity identification model, in the technical scheme of this embodiment, when the preprocessed sample data is obtained, data segmentation may be performed on the sample data to obtain sample texts of a plurality of short sentences, and entity identification is performed on the sample texts of the plurality of short sentences respectively to obtain an entity identification result of each sample text of the short sentences.
Specifically, each text and each character in the sample data may be determined, and the character type of each character in the sample data may be further determined. And carrying out data segmentation on the sample data based on each character type to obtain at least one section of sample text. Illustratively, the segmentation of the sample data may be achieved based on periods, question marks, and exclamation marks as segmentation nodes. It should be noted that, for the character serving as the segmentation node, if the character interval between the determined character position and the adjacent character is smaller than the preset interval threshold, whether the character is correct or not is determined based on the text content based on the text between the character and the adjacent character; if the result is correct, the segmentation is carried out; if not, then the correct character is determined based on the text content and whether to segment is determined based on the character being determined. The operation can make the sentences among the obtained sample texts complete, thereby improving the learning ability of the model in the training process and improving the training effect of the model.
In practical application, on the basis of obtaining each sample text, the entities in the sample text are identified to obtain each entity. Optionally, in this implementation, a preset entity recognition model may be obtained, and each sample text is input into the entity recognition model, so as to obtain each entity in the sample text output by the model. Of course, the entity included in the sample text may also be identified based on other manners, and the entity identification manner is not limited in this embodiment.
And S120, determining corresponding labeling labels based on the sample entities, and labeling the sample entities based on the labeling labels to obtain a relation labeling result of the sample entities.
In practical applications, the method for labeling the obtained sample entity according to the embodiment of the present invention may include: determining entity types corresponding to the sample entities respectively; acquiring each label, and determining corresponding labels for any two sample entities based on the entity types respectively corresponding to the two current sample entities; and determining a relation labeling result between the current two sample entities based on the labeling label.
Considering a labeling paradigm in a medical text, a traditional labeling paradigm is roughly divided into 2 categories, and 1) for a text with a single relationship label, which is simpler, it is possible to label the text directly from an entity a to an entity B; 2) For the case that a plurality of entities exist in the text and are associated with a certain main entity, and a plurality of relationship labels exist, the conventional method is that the relationship labels are diverged from the main entity to a plurality of associated entities, for example, as follows: "the visiting user visits the hospital half year ago because of symptom A, symptom B, symptom C and symptom D. "the labeling result obtained includes: 1. [ half a year ago ] (time) - > [ symptom relationship ] - > [ symptom a ] (symptom); 2. [ half a year ago ] (time) - > [ symptom relationship ] - > [ symptom B ] (symptom); 3. [ half a year ago ] (time) - > [ symptom relationship ] - > [ symptom C ] (symptom); 4. [ half a year ago ] (time) - > [ symptom relationship ] - > [ symptom D ] (symptom).
In the extraction process by adopting the above mode, it can be found that when the relational model is used for score calculation, the imbedding information of a plurality of entities is combined, wherein the imbedding information of position distances is included, and in the labeling paradigm, when the distance between a main entity and an associated entity is far, the condition of label missing can occur during model inference. Based on the above technical problem, in the technical solution of the embodiment of the present invention, when determining each entity to be extracted, the entity category of each entity is determined. For example, in the above example, the category corresponding to "half year ago" is "time", "the category corresponding to symptom a" is "symptom", and the category corresponding to symptom B "is" symptom ". In this embodiment, a plurality of labels are preset according to different entity types before labeling. Specifically including side-by-side labels, limit labels, and lead labels. Specifically, for two entities with a relation to be extracted, entity types of the two entities are determined, and corresponding label tags are determined according to the entity types. Specifically, the manner of determining the tag according to the entity type may include determining if the entity types of the two entities are consistent; and the labeling label between the two entities is a parallel label, and labeling is carried out based on the label to obtain a relation labeling result of the sample entity. For example, still taking the above example as an example, based on the labeling manner of the present embodiment, the obtained labeling result is as follows: 1. [ half a year ago ] (time) - > [ limit ] - > [ symptom A ] (symptom); 2. [ symptom A ] (symptom) - [ parallel ] - > [ symptom B ] (symptom); 3. [ symptom B ] (symptom) - [ parallel ] - > [ symptom C ] (symptom); 4. [ symptom C ] (symptom) - [ side-by-side ] - > [ symptom D ] (symptom).
In addition to the above embodiments, the sample text with a missing structure may also be labeled by the above labeling method. For example: in the text of '3 cm at the left side and 2cm at the right side of the disease A', the right side 2cm omits a main word 'disease', if a traditional 'predicate guest' and 'predicate' structure is adopted, the text cannot be labeled, and because a subject is missing, the text can be labeled by adopting a 'parallel' label after the subject is supplemented. The labeling results were obtained as follows: 1. [ disorder A ] (site) - [ definition ] - > [ left ] (orientation); 2. [ left side ] (azimuth) - > [ limit ] - > [3cm ] (numerical value); 3. [ left side ] (azimuth) - [ side-by-side ] - > [ right side ] (azimuth); 4. [ right side ] (azimuth) - > [ definition ] - > [2cm ] (numerical value).
For the extraction of entity relations of medical texts, punctuation marks are not the key points of extraction, and the introduction of punctuation marks can require a model to identify more entities and relations, thereby increasing the complexity of the system and the probability of extraction errors. In order to improve the labeling efficiency, the technical solution of the embodiment of the present invention further screens character sample entities in the sample entities before labeling the sample entities based on the labeling labels, and performs labeling based on the screened sample entities.
In this embodiment, the character sample entity may be understood as a punctuation mark in the recognized entity. Illustratively, "symptom a, symptom B, symptom C, symptom D, symptom E", if punctuation is considered, the number of extracted entities is 9, if punctuation-marked entities are removed, the number of extracted entities is only 5, and 44% of the recognition amount can be reduced after the punctuation is removed.
And S130, performing model iterative training on the initial entity relationship extraction model based on the relationship labeling result to obtain a trained target entity relationship extraction model.
In the embodiment of the invention, in order to extract the input data format of the model by the initial entity relationship, the format modification is required after the relationship labeling result is obtained, so that the data format enough for modification can be matched with the input format of the model. Optionally, the method for performing data format conversion in this embodiment includes: and obtaining a preset labeling data format, carrying out format conversion on the relation labeling result based on the labeling data format to obtain labeling data, and carrying out model iterative training on an initial entity relation extraction model based on the labeling data.
In practical applications, if the initial entity relationship extraction model is a dependency sharing model with a double affine structure, the data format of the input data needs to be adjusted to the call format accordingly. Specifically, a specific format style of the format, such as [ id, text, _, tagCategory, _, _, index, relationship ], is obtained. And carrying out format conversion on the relation labeling result based on the format style to obtain converted labeling data. Specifically, the labeling data is as follows: 1. 1 no _10741_ 0 root _; 2. 2 symptom a _10729_ 1 10732 _; 3. 3 symptom B _10729_ 2 10731 _; 4. 4 symptom C _10729_ 3 10731 _.
Specifically, the labeling data are input into an initial entity relationship extraction model to be trained, and a training labeling result output by the model is obtained; calculating a model loss function based on each training annotation result and the annotation data; and adjusting model parameters of the initial entity relationship extraction model based on the model loss function until the training completion condition is met to obtain a target entity relationship extraction model.
According to the technical scheme disclosed by the embodiment of the invention, each sample entity of the sample text is obtained by obtaining the sample text for model training and carrying out entity recognition on the sample text; determining corresponding labeling labels based on the sample entities, and labeling the sample entities based on the labeling labels to obtain relationship labeling results of the sample entities; performing model iterative training on the initial entity relationship extraction model based on the relationship labeling result to obtain a trained target entity relationship extraction model; the problem that the distinguishing capability of the extraction method in the prior art on the medical entity relationship is low is solved, and the accuracy of the entity relationship extraction in the medical text is improved.
Example two
Fig. 2 is a flowchart of an entity relationship extraction method according to a second embodiment of the present invention, which is applicable to the extraction of entity relationships in texts, and in particular, is more applicable to the extraction of entity relationships in medical texts. The method can be executed by an entity relation extraction device, the entity relation extraction device can be realized in a hardware and/or software mode, and the entity relation extraction device can be configured in an intelligent terminal and a cloud server. As shown in fig. 2, the method includes:
s210, obtaining the text to be extracted, and determining each entity of the text to be extracted.
The manner of obtaining the text to be extracted and identifying the entity in the text may refer to the above embodiment, which is not described in detail in this embodiment.
S220, obtaining a pre-trained entity relationship extraction model, inputting each entity into the entity relationship extraction model, and obtaining an entity relationship extraction result of the text to be extracted.
In this embodiment, the entity-relationship extraction model may be trained based on the training method described in the above embodiment.
And S230, carrying out relationship analysis on the entity relationship extraction result to obtain a target extraction result of the text to be extracted.
In the embodiment of the invention, the entity relationship extraction result of the text to be extracted is obtained based on the entity relationship extraction model obtained by training. And performing relation analysis on the obtained entity relation, specifically, starting from a virtual node root, finding a parallel relation through a recursive algorithm, completing automatic conversion of the tree structure, realizing extraction of the SPO elements, and obtaining a target extraction result.
According to the technical scheme of the embodiment of the invention, the entity relation extraction result of the text to be extracted is obtained by collecting the entity relation extraction model obtained by training in the embodiment, and the relation analysis is carried out on the entity relation extraction result to obtain the target extraction result of the text to be extracted. By the technical scheme, the problem of inaccurate extraction of the entity relationship of the medical text in the prior art is solved, and the accuracy of the extraction of the entity relationship in the medical text is improved.
EXAMPLE III
Fig. 3 is a schematic structural diagram of an entity relationship extraction model training apparatus according to a third embodiment of the present invention. As shown in fig. 3, the apparatus includes: a sample entity obtaining module 310, a relationship labeling result obtaining module 320 and an entity relationship extraction model training module 330; wherein the content of the first and second substances,
a sample entity obtaining module 310, configured to obtain a sample text for model training, and perform entity identification on the sample text to obtain each sample entity of the sample text;
a relationship labeling result obtaining module 320, configured to determine a corresponding labeling label based on each sample entity, and label the sample entity based on the labeling label to obtain a relationship labeling result of the sample entity;
and the entity relationship extraction model training module 330 is configured to perform model iterative training on the initial entity relationship extraction model based on the relationship labeling result to obtain a trained target entity relationship extraction model.
On the basis of the foregoing embodiment, optionally, the sample entity obtaining module 310 includes:
the system comprises a sample data acquisition unit, a model training unit and a model training unit, wherein the sample data acquisition unit is used for acquiring medical text data used for model training and carrying out data preprocessing on the medical text data to obtain sample data;
and the sample text obtaining unit is used for obtaining the characters in the sample data, and performing data segmentation on the sample data based on the character types of the characters to obtain at least one section of sample text.
On the basis of the foregoing embodiment, optionally, the relationship labeling result obtaining module 320 includes:
an entity type determining unit, configured to determine an entity type corresponding to each sample entity;
the labeling label determining unit is used for acquiring each labeling label and determining corresponding labeling labels for any two sample entities based on entity types respectively corresponding to the current two sample entities;
and the relationship labeling result determining unit is used for determining a relationship labeling result between the current two sample entities based on the labeling label.
On the basis of the foregoing embodiment, optionally, the apparatus further includes:
and the entity screening module is used for screening the character sample entities in the sample entities after obtaining each sample entity of the sample text, and labeling based on the screened sample entities.
On the basis of the foregoing embodiment, optionally, the entity relationship extraction model training module 330 includes:
and the entity relationship extraction model training unit is used for acquiring a preset labeling data format, performing format conversion on the relationship labeling result based on the labeling data format to obtain labeling data, and performing model iterative training on the initial entity relationship extraction model based on the labeling data.
The entity relationship extraction model training device provided by the embodiment of the invention can execute the entity relationship extraction model training method provided by any embodiment of the invention, and has corresponding functional modules and beneficial effects of the execution method.
Example four
Fig. 4 is a schematic structural diagram of an entity relationship extraction apparatus according to a fourth embodiment of the present invention. As shown in fig. 4, the apparatus includes: an entity obtaining module 410, an entity relationship extraction result determining module 420 and an entity extraction result obtaining module 430; wherein, the first and the second end of the pipe are connected with each other,
an entity obtaining module 410, configured to obtain a text to be extracted, and determine entities of the text to be extracted;
an entity relationship extraction result determining module 420, configured to obtain a pre-trained entity relationship extraction model, input each entity into the entity relationship extraction model, and obtain an entity relationship extraction result of the text to be extracted; the entity relationship extraction model is obtained by training based on the entity relationship extraction model training method in any embodiment;
and an entity extraction result obtaining module 430, configured to perform relationship analysis on the entity relationship extraction result to obtain a target extraction result of the text to be extracted.
The entity relationship extraction device provided by the embodiment of the invention can execute the entity relationship extraction method provided by any embodiment of the invention, and has the corresponding functional modules and beneficial effects of the execution method.
EXAMPLE five
FIG. 5 illustrates a block diagram of an electronic device 10 that may be used to implement an embodiment of the invention. Electronic devices are intended to represent various forms of digital computers, such as laptops, desktops, workstations, personal digital assistants, servers, blade servers, mainframes, and other appropriate computers. The electronic device may also represent various forms of mobile devices, such as personal digital assistants, cellular phones, smart phones, wearable devices (e.g., helmets, glasses, watches, etc.), and other similar computing devices. The components shown herein, their connections and relationships, and their functions, are meant to be exemplary only, and are not meant to limit implementations of the inventions described and/or claimed herein.
As shown in fig. 5, the electronic device 10 includes at least one processor 11, and a memory communicatively connected to the at least one processor 11, such as a Read Only Memory (ROM) 12, a Random Access Memory (RAM) 13, and the like, wherein the memory stores a computer program executable by the at least one processor, and the processor 11 may perform various suitable actions and processes according to the computer program stored in the Read Only Memory (ROM) 12 or the computer program loaded from the storage unit 18 into the Random Access Memory (RAM) 13. In the RAM 13, various programs and data necessary for the operation of the electronic apparatus 10 can also be stored. The processor 11, the ROM 12, and the RAM 13 are connected to each other via a bus 14. An input/output (I/O) interface 15 is also connected to bus 14.
A number of components in the electronic device 10 are connected to the I/O interface 15, including: an input unit 16 such as a keyboard, a mouse, or the like; an output unit 17 such as various types of displays, speakers, and the like; a storage unit 18 such as a magnetic disk, optical disk, or the like; and a communication unit 19 such as a network card, modem, wireless communication transceiver, etc. The communication unit 19 allows the electronic device 10 to exchange information/data with other devices via a computer network such as the internet and/or various telecommunication networks.
Processor 11 may be a variety of general and/or special purpose processing components having processing and computing capabilities. Some examples of processor 11 include, but are not limited to, a Central Processing Unit (CPU), a Graphics Processing Unit (GPU), various dedicated Artificial Intelligence (AI) computing chips, various processors running machine learning model algorithms, a Digital Signal Processor (DSP), and any suitable processor, controller, microcontroller, and so forth. The processor 11 performs the various methods and processes described above, such as the entity relationship extraction model training method; and/or an entity relationship extraction method.
In some embodiments, an entity relationship extraction model training method; and/or, the entity relationship extraction method may be implemented as a computer program tangibly embodied on a computer-readable storage medium, such as the storage unit 18. In some embodiments, part or all of the computer program may be loaded and/or installed onto the electronic device 10 via the ROM 12 and/or the communication unit 19. The entity relationship extraction model training method described above may be performed when the computer program is loaded into RAM 13 and executed by processor 11; and/or one or more steps of an entity relationship extraction method. Alternatively, in other embodiments, the processor 11 may be configured to perform the entity relationship extraction model training method by any other suitable means (e.g., by means of firmware); and/or an entity relationship extraction method.
Various implementations of the systems and techniques described here above may be implemented in digital electronic circuitry, integrated circuitry, field Programmable Gate Arrays (FPGAs), application Specific Integrated Circuits (ASICs), application Specific Standard Products (ASSPs), system on a chip (SOCs), load programmable logic devices (CPLDs), computer hardware, firmware, software, and/or combinations thereof. These various embodiments may include: implemented in one or more computer programs that are executable and/or interpretable on a programmable system including at least one programmable processor, which may be special or general purpose, receiving data and instructions from, and transmitting data and instructions to, a storage system, at least one input device, and at least one output device.
A computer program for implementing the methods of the present invention may be written in any combination of one or more programming languages. These computer programs may be provided to a processor of a general purpose computer, special purpose computer, or other programmable data processing apparatus, such that the computer programs, when executed by the processor, cause the functions/acts specified in the flowchart and/or block diagram block or blocks to be performed. A computer program can execute entirely on a machine, partly on a machine, as a stand-alone software package partly on a machine and partly on a remote machine or entirely on a remote machine or server.
In the context of the present invention, a computer-readable storage medium may be a tangible medium that can contain, or store a computer program for use by or in connection with an instruction execution system, apparatus, or device. A computer readable storage medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any suitable combination of the foregoing. Alternatively, the computer readable storage medium may be a machine readable signal medium. More specific examples of a machine-readable storage medium would include an electrical connection based on one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
To provide for interaction with a user, the systems and techniques described here can be implemented on an electronic device having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to a user; and a keyboard and a pointing device (e.g., a mouse or a trackball) by which a user may provide input to the electronic device. Other kinds of devices may also be used to provide for interaction with a user; for example, feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user may be received in any form, including acoustic, speech, or tactile input.
The systems and techniques described here can be implemented in a computing system that includes a back-end component (e.g., as a data server), or that includes a middleware component (e.g., an application server), or that includes a front-end component (e.g., a user computer having a graphical user interface or a web browser through which a user can interact with an implementation of the systems and techniques described here), or any combination of such back-end, middleware, or front-end components. The components of the system can be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: local Area Networks (LANs), wide Area Networks (WANs), blockchain networks, and the internet.
The computing system may include clients and servers. A client and server are generally remote from each other and typically interact through a communication network. The relationship of client and server arises by virtue of computer programs running on the respective computers and having a client-server relationship to each other. The server can be a cloud server, also called a cloud computing server or a cloud host, and is a host product in a cloud computing service system, so that the defects of high management difficulty and weak service expansibility in the traditional physical host and VPS service are overcome.
It should be understood that various forms of the flows shown above may be used, with steps reordered, added, or deleted. For example, the steps described in the present invention may be executed in parallel, sequentially, or in different orders, and are not limited herein as long as the desired result of the technical solution of the present invention can be achieved.
The above-described embodiments should not be construed as limiting the scope of the invention. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions may be made in accordance with design requirements and other factors. Any modification, equivalent replacement, and improvement made within the spirit and principle of the present invention should be included in the protection scope of the present invention.

Claims (10)

1. An entity relationship extraction model training method is characterized by comprising the following steps:
obtaining a sample text for model training, and performing entity recognition on the sample text to obtain each sample entity of the sample text;
determining corresponding labeling labels based on the sample entities, and labeling the sample entities based on the labeling labels to obtain relationship labeling results of the sample entities;
and performing model iterative training on the initial entity relationship extraction model based on the relationship labeling result to obtain a trained target entity relationship extraction model.
2. The method of claim 1, wherein obtaining sample text for model training comprises:
acquiring medical text data for model training, and performing data preprocessing on the medical text data to obtain sample data;
and acquiring characters in the sample data, and performing data segmentation on the sample data based on the character type of the characters to obtain at least one section of sample text.
3. The method of claim 1, wherein the determining a corresponding labeling tag based on each sample entity and labeling the sample entities based on the labeling tags to obtain a relationship labeling result of the sample entities comprises:
determining entity types corresponding to the sample entities respectively;
acquiring each labeling label, and determining corresponding labeling labels for any two sample entities based on entity types respectively corresponding to the current two sample entities;
and determining a relation labeling result between the current two sample entities based on the labeling label.
4. The method of claim 1, further comprising, prior to said labeling the sample entity based on the label tag:
and screening character sample entities in the sample entities, and labeling based on the screened sample entities.
5. The method of claim 1, wherein performing model iterative training on an initial entity relationship extraction model based on the relationship labeling result comprises:
and obtaining a preset labeling data format, carrying out format conversion on the relation labeling result based on the labeling data format to obtain labeling data, and carrying out model iterative training on an initial entity relation extraction model based on the labeling data.
6. An entity relationship extraction method, comprising:
acquiring a text to be extracted, and determining each entity of the text to be extracted;
acquiring a pre-trained entity relationship extraction model, and inputting each entity into the entity relationship extraction model to obtain an entity relationship extraction result of the text to be extracted; the entity relationship extraction model is obtained by training based on the entity relationship extraction model training method of any one of claims 1-5;
and carrying out relation analysis on the entity relation extraction result to obtain a target extraction result of the text to be extracted.
7. An entity relationship extraction model training device, comprising:
the system comprises a sample entity obtaining module, a model training module and a model identification module, wherein the sample entity obtaining module is used for obtaining a sample text for model training and carrying out entity identification on the sample text to obtain each sample entity of the sample text;
a relation labeling result obtaining module, configured to determine a corresponding labeling label based on each sample entity, and label the sample entities based on the labeling labels to obtain a relation labeling result of the sample entities;
and the entity relationship extraction model training module is used for carrying out model iterative training on the initial entity relationship extraction model based on the relationship labeling result to obtain a trained target entity relationship extraction model.
8. An entity relationship extraction apparatus, comprising:
the entity obtaining module is used for obtaining a text to be extracted and determining each entity of the text to be extracted;
the entity relationship extraction result determining module is used for acquiring a pre-trained entity relationship extraction model, inputting each entity into the entity relationship extraction model and obtaining an entity relationship extraction result of the text to be extracted; the entity relationship extraction model is obtained by training based on the entity relationship extraction model training method of any one of claims 1-5;
and the entity extraction result obtaining module is used for carrying out relationship analysis on the entity relationship extraction result to obtain a target extraction result of the text to be extracted.
9. An electronic device, characterized in that the electronic device comprises:
at least one processor; and
a memory communicatively coupled to the at least one processor; wherein the content of the first and second substances,
the memory stores a computer program executable by the at least one processor, the computer program being executable by the at least one processor to enable the at least one processor to perform the entity relationship extraction model training method of any one of claims 1-5; and/or performing the entity relationship extraction method of claim 6.
10. A computer-readable storage medium, wherein the computer-readable storage medium stores computer instructions for causing a processor to implement the entity relationship extraction model training method of any one of claims 1-5 when executed; and/or performing the entity relationship extraction method of claim 6.
CN202211362185.1A 2022-11-02 2022-11-02 Entity relationship extraction model training method, entity relationship extraction method and device Pending CN115618002A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202211362185.1A CN115618002A (en) 2022-11-02 2022-11-02 Entity relationship extraction model training method, entity relationship extraction method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202211362185.1A CN115618002A (en) 2022-11-02 2022-11-02 Entity relationship extraction model training method, entity relationship extraction method and device

Publications (1)

Publication Number Publication Date
CN115618002A true CN115618002A (en) 2023-01-17

Family

ID=84876880

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202211362185.1A Pending CN115618002A (en) 2022-11-02 2022-11-02 Entity relationship extraction model training method, entity relationship extraction method and device

Country Status (1)

Country Link
CN (1) CN115618002A (en)

Similar Documents

Publication Publication Date Title
CN113344089B (en) Model training method and device and electronic equipment
CN111444956A (en) Low-load information prediction method and device, computer system and readable storage medium
CN112926308A (en) Method, apparatus, device, storage medium and program product for matching text
CN113963197A (en) Image recognition method and device, electronic equipment and readable storage medium
CN113157877A (en) Multi-semantic recognition method, device, equipment and medium
CN114783597B (en) Method and device for diagnosing multi-class diseases, electronic equipment and storage medium
EP4246365A1 (en) Webpage identification method and apparatus, electronic device, and medium
CN114461665B (en) Method, apparatus and computer program product for generating a statement transformation model
CN115909376A (en) Text recognition method, text recognition model training device and storage medium
CN113515591B (en) Text defect information identification method and device, electronic equipment and storage medium
CN114647727A (en) Model training method, device and equipment applied to entity information recognition
CN115186738A (en) Model training method, device and storage medium
CN115618002A (en) Entity relationship extraction model training method, entity relationship extraction method and device
JP2022165925A (en) Data labeling method, device, electronic apparatus, and readable storage medium
CN113033179A (en) Knowledge acquisition method and device, electronic equipment and readable storage medium
CN114254650A (en) Information processing method, device, equipment and medium
CN113204616A (en) Method and device for training text extraction model and extracting text
CN113590774A (en) Event query method, device and storage medium
CN113032540B (en) Man-machine interaction method, device, equipment and storage medium
CN113836939B (en) Text-based data analysis method and device
CN116737520B (en) Data braiding method, device and equipment for log data and storage medium
CN117609723A (en) Object identification method and device, electronic equipment and storage medium
CN115357796A (en) Interest classification model training method, interest classification method and device
CN114692618A (en) Search term recognition method and device, electronic equipment and storage medium
CN115481184A (en) Information extraction method and device, electronic equipment and storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination