A system for acquiring entities and entity relationships
By using the same model to process entities and entity relationships in medical record text, and combining jieba word segmentation and preset tags, the problem of poor interactivity between entity models and relationship models is solved, and the accuracy and efficiency of entity relationships in medical record texts are improved.
Patent Information
- Application Number
- CN202410488598.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-04-23
- Publication Date
- 2024-09-13
- Estimated Expiration
- 2044-04-23
AI Technical Summary
In the existing technology, when entities and entity relationships in medical record text are obtained, the interaction between the entity model and the relationship model is poor, resulting in reduced acquisition accuracy.
Use the same model to process medical record text, obtain the initial word list through jieba word segmentation, and use the preset model to obtain the target word pair list and tag score list, combined with the preset entity and entity relationship tags, obtain the target entity and entity relationship list, and reduce word combinations quantity to improve model training speed and accuracy.
It improves the accuracy and efficiency of entities and entity relationships in medical record text, avoids the problem of poor interactivity between entity models and relationship models, and enhances the accuracy and model training speed of obtaining entity relationships from medical record text.
Smart Images

Figure CN118113792B
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of text processing, and in particular to a system for acquiring entities and entity relationships. Background Art
[0002] With the rapid development of Internet technology, medical record texts are becoming electronic, and most medical record text information is unstructured. It is particularly important to obtain entities and the relationships between entities from a large amount of unstructured medical record text data. This can provide corresponding services for downstream subtasks, such as obtaining events from medical record texts, popularizing disease-related knowledge, and conducting disease-related data mining. How to efficiently and accurately obtain entities and entity relationships in medical record texts has become a hot research direction.
[0003] In the prior art, the method for obtaining entities and entity relationships is: using an entity extraction model to obtain entities in a medical record text, and determining the relationships between entities obtained by the entity extraction model based on preset rules and a relationship extraction model.
[0004] In summary, the method of obtaining entities and entity relationships has problems: different models are used to obtain entities in medical record texts and the relationships between entities and entities respectively. Since the interaction between the entity model and the relationship model is not strong, the accuracy of obtaining entities and the relationships between entities in medical record texts is reduced. Summary of the invention
[0005] In view of the above technical problems, the technical solution adopted by the present invention is: a system for obtaining entities and entity relationships, the system comprising: a processor and a memory storing a computer program, when the computer program is executed by the processor, the following steps are implemented:
[0006] S100, obtaining target medical record text, wherein the target medical record text is the medical record text of the entity and entity relationship to be obtained.
[0007] S200, according to the target medical record text, obtain the initial word list A corresponding to the target medical record text = {A1, ..., A i , ..., A n}, A i is the i-th initial word, i=1…n, n is the number of initial words, wherein the initial word is the word obtained by performing word segmentation processing on the target medical record text through Jieba word segmentation.
[0008] S300, input A into the preset model, and obtain the target word pair list B={B1, ..., B e , ..., B f The first label score list set D corresponding to B = {D1, ..., D e, ..., D f}, D e ={D e1 , ..., D ex , ..., D eN}, B e is the e-th target word pair, e=1…f, f is the number of target word pairs, D ex For B e The xth first label score in the corresponding first label score list, x=1...N, N is the number of first label scores in the first label score list.
[0009] S400, according to B and D, obtain a target entity list corresponding to the target medical record text, wherein the target entity list includes a plurality of target entities, wherein the target entity is obtained in S400 through the following steps:
[0010] S401, when D e D ex =1 and D e+1 All D (e+1)x =0, get B e The corresponding entity is the target entity, where D e+1 is the first label score list corresponding to the (e+1)th target word, D (e+1)x D e+1 The score of the x-th first label in .
[0011] S403, when D e D ex =1 and D e+1 D (e+1)x =1, get B e+1 The corresponding entity is the target entity.
[0012] S500, obtaining a second tag score list set P={P1, ..., P u , ..., P M} and the third label score list set Q = {Q1, ..., Q u , ..., Q M}, P u ={P u1 , ..., P ue , ..., P uf}, Q u ={Q u1 , ..., Q ue , ..., Q uf}, where P ue B is the second label score list corresponding to the u-th preset entity relationship label e The corresponding second label score, Q ueB is the third label score list corresponding to the u-th preset entity relationship label e The corresponding third label score is u=1…M, where M is the number of preset entity relationship labels.
[0013] S600, according to the target entity list, P and Q, obtain the target entity relationship list corresponding to the target medical record text, wherein the target entity relationship list includes a plurality of target entity relationships, and the target entity relationship includes two target entities obtained from the target entity list that meet the preset entity relationship labels and the preset entity relationship labels corresponding to the two target entities.
[0014] Compared with the prior art, the present invention has obvious beneficial effects. By means of the above technical solution, the system for obtaining entities and entity relationships provided by the present invention can achieve considerable technical advancement and practicality, and has wide industrial utilization value, and has at least the following beneficial effects:
[0015] The present invention is a system for acquiring entities and entity relationships. The system comprises: a processor and a memory storing a computer program. When the computer program is executed by the processor, the following steps are implemented: acquiring a target medical record text, acquiring an initial word list corresponding to the target medical record text according to the target medical record text, inputting the initial word list into a preset model, acquiring a target word pair list and a first label score list set corresponding to the target word pair list, acquiring a target entity list corresponding to the target medical record text according to the target word pair list and the first label score list set, acquiring a second label score list set and acquiring a third label score list set, acquiring a target entity relationship list corresponding to the target medical record text according to the target entity list, the second label score list set and the second label score list set. The present invention uses the same model for processing and simultaneously acquires entities and entity relationships in the medical record text, does not have the problem of poor interactivity between the entity model and the relationship model, can more accurately capture the complex relationship between entities, so that the accuracy of the entity and entity relationship acquired from the medical record text is higher, and at the same time, the acquired medical record text is segmented based on semantic information, the number of word combinations is reduced, the training speed of the model is accelerated, and the efficiency of acquiring entities and entity-entity relationships in the medical record text is improved.
[0016] The above description is only an overview of the technical solution of the present invention. In order to more clearly understand the technical means of the present invention, it can be implemented in accordance with the contents of the specification. In order to make the above and other purposes, features and advantages of the present invention more obvious and easy to understand, the following specifically cites a preferred embodiment and describes it in detail with the accompanying drawings as follows. BRIEF DESCRIPTION OF THE DRAWINGS
[0017] Figure 1A flowchart implemented when a processor of a system for acquiring entities and entity relationships executes a computer program provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0018] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative work are within the scope of protection of the present invention.
[0019] It should be noted that the terms "first", "second", etc. in the specification and claims of the present invention and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchangeable where appropriate, so that the embodiments of the present invention described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions, for example, a process, method, system, product, or server that includes a series of steps or units is not necessarily limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products, or devices.
[0020] Example
[0021] This embodiment provides a system for acquiring entities and entity relationships, the system comprising: a processor and a memory storing a computer program, when the computer program is executed by the processor, the following steps are implemented, such as: Figure 1 As shown:
[0022] S100, obtaining target medical record text, wherein the target medical record text is the medical record text of the entity and entity relationship to be obtained.
[0023] S200, according to the target medical record text, obtain the initial word list A corresponding to the target medical record text = {A1, ..., A i , ..., A n}, A i is the i-th initial word, i=1…n, n is the number of initial words, wherein the initial word is the word obtained by performing word segmentation processing on the target medical record text through Jieba word segmentation.
[0024] Specifically, A 0 i ≥1, where A 0 i A i The number of corresponding text characters.
[0025] As mentioned above, the target medical record text is segmented using Jieba word segmentation, which reduces the number of words obtained based on the semantic information corresponding to the medical record text, thereby reducing the number of target word pairs obtained subsequently, reducing the amount of model training, and speeding up the model training, thereby improving the efficiency of obtaining entities in the medical record text and the relationships between entities.
[0026] S300, input A into the preset model, and obtain the target word pair list B={B1, ..., B e , ..., B f The first label score list set D corresponding to B = {D1, ..., D e , ..., D f}, D e ={D e1 , ..., D ex , ..., D eN}, B e is the e-th target word pair, e=1…f, f is the number of target word pairs, D ex For B e The xth first label score in the corresponding first label score list, x=1...N.
[0027] Specifically, after inputting A into the preset model, we first need to obtain the initial word vector list A corresponding to A. 0 ={A 0 1, ..., A 0 i , ..., A 0 n}, A 0 i =(A 0 i1 , ..., A 0 iα , ..., A 0 iβ ), A 0 iα A i The corresponding bit value of the αth position in the initial word vector is α=1…β, where β is the dimension of the initial word vector, and β meets the following conditions:
[0028] β=2×(β1+β2+β3), where β1 is the dimension of the encoding vector obtained based on the position of the initial word in A, β2 is the dimension of the encoding vector obtained based on the part of speech of the initial word in the jieba word segmentation process, and β3 is the dimension of the word encoding vector corresponding to the initial word.
[0029] Preferably, β1=20, β2=20, β3=128.
[0030] Furthermore, the initial word vector is a vector corresponding to the initial word, and the initial word vector is obtained by concatenating the encoding vector obtained based on the position of the initial word in A, the encoding vector obtained based on the part of speech of the initial word in the jieba word segmentation process, and the word encoding vector corresponding to the initial word.
[0031] In the above, the vector corresponding to the initial word is obtained from three aspects: the position information of the initial word, the semantic information involved in the jieba word segmentation, and the word encoding. This enriches the dimension of the vector corresponding to the initial word, making the initial word vector express the initial word more accurately, thereby improving the accuracy of obtaining entities and entity relationships from the medical record text in the future.
[0032] Specifically, the preset model is a pre-trained TPlinker model, wherein those skilled in the art know that any method for training a TPlinker model in the prior art falls within the protection scope of the present invention and will not be described in detail herein.
[0033] Specifically, B e =(B e1 , B e2 ), where B e1 is the initial word obtained from A, B e2 is the number of cells in A except those in B e1 Any initial word other than the initial word before the position.
[0034] Furthermore, the method of obtaining B is to sequentially add P from i=1 and j=1 ij Insert into B, where P ij =(A i , A j ), where j=i, i+1,...,n.
[0035] Specifically, f meets the following conditions:
[0036] f=(n+1)×(n / 2).
[0037] Specifically, the first tag score is the score corresponding to the first tag, wherein the first tag is a tag of a preset entity tag and an EH-to-ET tag obtained based on a preset model, wherein EH-to-ET represents that the first token of the same entity points to the last token.
[0038] Specifically, D ex =0 or 1.
[0039] Specifically, the preset entity tag is a tag corresponding to a pre-set entity, wherein the tag corresponding to the entity is a tag corresponding to a word that characterizes the user's physical state. Those skilled in the art know that the preset entity tags can be set according to actual needs, which all fall within the protection scope of the present invention and will not be repeated here.
[0040] Further, it can be understood that: when the target medical record text is characterized as a medical record text of a blood-related state corresponding to the user's body, preset entity tags such as gene name, test result, and examination gene site are set.
[0041] S400, according to B and D, obtain a target entity list corresponding to the target medical record text, wherein the target entity list includes a plurality of target entities, wherein the target entity is obtained in S400 through the following steps:
[0042] S401, when D e D ex =1 and D e+1 All D (e+1)x =0, get B e The corresponding entity is the target entity, where D e+1 is the first label score list corresponding to the (e+1)th target word, D (e+1)x D e+1 The score of the x-th first label in .
[0043] Specifically, when B e =(A i , A n ), then B e The corresponding entity is A i A i+1 ...A n , which can be understood as: when the target medical record text excerpt is an amino acid codon of threonine, the corresponding initial word list obtained is {amino acid, codon, codon, is, threonine}. e = (amino acid, sub) corresponds to the amino acid codon, then the target entity obtained is the amino acid codon.
[0044] S403, when D e D ex =1 and D e+1 D (e+1)x =1, get B e+1 The corresponding entity is the target entity.
[0045] S500, obtaining a second tag score list set P={P1, ..., P u , ..., P M} and the third label score list set Q = {Q1, ..., Q u, ..., Q M}, P u ={P u1 , ..., P ue , ..., P uf}, Q u ={Q u1 , ..., Q ue , ..., Q uf}, where P ue B is the second label score list corresponding to the u-th preset entity relationship label e The corresponding second label score, Q ue B is the third label score list corresponding to the u-th preset entity relationship label e The corresponding third label score is u=1…M, where M is the number of preset entity relationship labels.
[0046] Specifically, the preset entity relationship label is a pre-set label for the relationship between entities, wherein the label for the relationship between entities is a label for the correspondence between words that characterize the user's physical state. Those skilled in the art know that the preset entity relationship labels can be set according to actual needs, which all fall within the protection scope of the present invention and will not be repeated here, for example: preset entity relationship labels such as occurrence location and confirmed relationship.
[0047] Specifically, the second label score is a score corresponding to the second label, wherein the second label is a label representing the first token of one entity of an entity pair having a relationship combined with the first token of another entity.
[0048] Furthermore, the second label score is obtained by inputting A into a preset model.
[0049] Specifically, the third label score is a score corresponding to the third label, wherein the third label is a label representing the last token of one entity of an entity pair having a relationship combined with the last token of another entity.
[0050] Furthermore, the third label score is obtained by inputting A into a preset model.
[0051] Specifically, P ue = 0 or 1, where P ue =0 indicates B e The two target words are not the first token of one entity combined with the first token of another entity and / or B eThe two target words are the relationship between the first token of one entity and the first token of another entity, but not the relationship corresponding to the u-th preset entity relationship label. When P ue =1 indicates B e The entities corresponding to the two target words in B satisfy the relationship corresponding to the u-th preset entity relationship label and B e The two target words are the first token of one entity combined with the first token of another entity.
[0052] Specifically, Q ue = 0 or 1, where P ue =0 indicates B e The two target words are not the last token of one entity combined with the last token of another entity and / or B e The two target words are the last token of one entity and the last token of another entity, but not the relationship corresponding to the u-th preset entity relationship label. When P ue =1 indicates B e The entities corresponding to the two target words in B satisfy the relationship corresponding to the u-th preset entity relationship label and B e The two target words are the last token of one entity combined with the last token of another entity.
[0053] In the above, the labels of the acquired entities are combined with the preset entity labels, and the entities with preset entity labels are acquired from the medical record text using the training model, which enriches the feature information of the acquired entities. By setting the scores, the acquired relationships are not restricted in direction, thereby improving the efficiency and accuracy of the acquired entities and entity relationships.
[0054] S600, according to the target entity list, P and Q, obtain the target entity relationship list corresponding to the target medical record text, wherein the target entity relationship list includes a plurality of target entity relationships, and the target entity relationship includes two target entities obtained from the target entity list that meet the preset entity relationship labels and the preset entity relationship labels corresponding to the two target entities.
[0055] Specifically, in S600, the target entity relationship is obtained through the following steps:
[0056] S601, obtaining a target entity relationship tag ζ, wherein the target entity relationship tag ζ is any preset entity relationship tag.
[0057] S602, obtaining a first target word pair list according to the target entity relationship tag and P, wherein the first target word pair list includes a plurality of first target word pairs, and the first target word pairs are target word pairs corresponding to the third label scores not being zero in the third label score list corresponding to the target entity relationship tag obtained from B.
[0058] S603, obtaining a second target word pair list according to the target entity relationship label and Q, wherein the second target word pair list includes a plurality of second target word pairs, and the second target word pairs are target word pairs corresponding to the second label scores not being zero in the second label score list corresponding to the target entity relationship label obtained from B.
[0059] S604: Obtain a candidate entity pair list R={R1, ..., R v , ..., R d}, R v =(R v1 , R v2 ), R v is the vth candidate entity pair, R v1 For R v The first candidate entity in R v2 For R v The second candidate entity in , v = 1…d, d is the number of candidate entity pairs, where when the first second target word in the second target word pair is consistent with the first word corresponding to a target entity ω1 in the target entity list and the second second target word in the second target word pair is consistent with the first word corresponding to a target entity ω2 in the target entity list, (ω1, ω2) is obtained as a candidate entity pair.
[0060] S605, according to R, obtain the third target word pair list R 0 ={R 0 1, ..., R 0 v , ..., R 0 d}, R 0 v =(R 0 v1 , R 0 v2 ), R 0 v1 For R v1 The last initial word in R 0 v2 For R v2 The last initial word in .
[0061] S607, when R 0v When it is consistent with a first target word pair in the first target word pair list, the entity relationship triple {R v1 ,ζ,R v2} is a target entity relationship.
[0062] As described above, the same model is used to simultaneously obtain entities and entity relationships in medical record texts. There is no problem of poor interactivity between entity models and relationship models, and the complex relationships between entities can be captured more accurately, so that the accuracy of entities and entity relationships obtained from medical record texts is higher. At the same time, the obtained medical record texts are segmented based on semantic information to reduce the number of word combinations, speed up model training, and improve the efficiency of obtaining entities and relationships between entities in medical record texts.
[0063] The present embodiment provides a system for acquiring entities and entity relationships, the system comprising: a processor and a memory storing a computer program, wherein when the computer program is executed by the processor, the following steps are implemented: acquiring a target medical record text, acquiring an initial word list corresponding to the target medical record text based on the target medical record text, inputting the initial word list into a preset model, acquiring a target word pair list and a first label score list set corresponding to the target word pair list, acquiring a target entity list corresponding to the target medical record text based on the target word pair list and the first label score list set, acquiring a second label score list set and acquiring a third label score list set, and obtaining a target entity list corresponding to the target medical record text based on the target word pair list and the first label score list set. The target entity relationship list corresponding to the target medical record text is obtained by using the first label score list, the second label score list set and the second label score list set. The present embodiment adopts the same model for processing and simultaneously obtains the entities and entity relationships in the medical record text. There is no problem of poor interactivity between the entity model and the relationship model. The complex relationship between entities can be captured more accurately, so that the accuracy of the entities and entity relationships obtained from the medical record text is higher. At the same time, the obtained medical record text is segmented based on semantic information to reduce the number of word combinations, speed up the training of the model, and improve the efficiency of obtaining entities and the relationships between entities in the medical record text.
[0064] Although some specific embodiments of the present invention have been described in detail by way of example, it will be appreciated by those skilled in the art that the above examples are for illustration only and are not intended to limit the scope of the present invention. It will also be appreciated by those skilled in the art that various modifications may be made to the embodiments without departing from the scope and spirit of the present invention. The scope of the present invention is defined by the appended claims.
Claims
1. A system for acquiring entities and entity relationships, characterized in that: The system comprises: a processor and a memory storing a computer program, and when the computer program is executed by the processor, the following steps are implemented: S100, obtaining a target medical record text, wherein the target medical record text is a medical record text of an entity and an entity relationship to be obtained; S200, according to the target medical record text, obtain the initial word list A corresponding to the target medical record text = {A1, ..., A i , ..., A n }, A i is the i-th initial word, i=1...n, n is the number of initial words, wherein the initial word is the word obtained by segmenting the target medical record text through Jieba word segmentation; S300, input A into the preset model, and obtain the target word pair list B={B1, ..., B e , ..., B f The first label score list set D corresponding to B = {D1, ..., D e , ..., D f }, D e ={D e1 , ..., D ex , ..., D eN }, B e is the e-th target word pair, e=1…f, f is the number of target word pairs, D ex For B e The xth first label score in the corresponding first label score list, x=1...N, N is the number of first label scores in the first label score list, the first label score is the score corresponding to the first label, wherein the first label is a label obtained based on a preset model with a preset entity label and an EH-to-ET label, EH-to-ET represents that the first token of the same entity points to the last token, the preset entity label is a label corresponding to a preset entity, wherein the label corresponding to the entity is a label corresponding to a word representing the user's physical state; S400, according to B and D, obtain a target entity list corresponding to the target medical record text, wherein the target entity list includes a plurality of target entities, wherein the target entity is obtained in S400 through the following steps: S401, when D e D ex =1 and D e+1 All D (e+1)x =0, get B e The corresponding entity is the target entity, where D e+1 is the first label score list corresponding to the e+1th target word, D (e+1)x D e+1 The score of the xth first label in ; S403, when D e D ex =1 and D e+1 D (e+1)x =1, get B e+1 The corresponding entity is the target entity; S500, obtaining a second tag score list set P={P1, ..., P u , ..., P M } and the third label score list set Q = {Q1, ..., Q u , ..., Q M }, P u ={P u1 , ..., P ue , ..., P uf }, Q u ={Q u1 , ..., Q ue , ..., Q uf }, where P ue B is the second label score list corresponding to the u-th preset entity relationship label e The corresponding second label score, Q ue B is the third label score list corresponding to the u-th preset entity relationship label e The corresponding third label score, u=1...M, M is the number of preset entity relationship labels, the preset entity relationship labels are preset labels of the relationship between entities, wherein the labels of the relationship between entities are labels of the corresponding relationship between words representing the user's physical state, the second label score is the score corresponding to the second label, the second label is a label representing the first token of one entity of the entity pair with a relationship combined with the first token of the other entity, the third label score is the score corresponding to the third label, the third label is a label representing the last token of one entity of the entity pair with a relationship combined with the last token of the other entity; S600, according to the target entity list, P and Q, obtain a target entity relationship list corresponding to the target medical record text, wherein the target entity relationship list includes a plurality of target entity relationships, and the target entity relationship includes two target entities obtained from the target entity list that meet the preset entity relationship labels and the preset entity relationship labels corresponding to the two target entities. In S600, the target entity relationship is obtained by the following steps: S601, obtaining a target entity relationship tag ζ, wherein the target entity relationship tag ζ is any preset entity relationship tag; S602, obtaining a first target word pair list according to the target entity relationship tag and P, wherein the first target word pair list includes a plurality of first target word pairs, and the first target word pairs are target word pairs corresponding to the third tag scores that are not zero in the third tag score list corresponding to the target entity relationship tag obtained from B; S603, obtaining a second target word pair list according to the target entity relationship tag and Q, wherein the second target word pair list includes a plurality of second target word pairs, and the second target word pairs are target word pairs corresponding to the second label scores that are not zero in the second label score list corresponding to the target entity relationship tag obtained from B; S604: Obtain a candidate entity pair list R={R1, ..., R v , ..., R d }, R v =(R v1 , R v2 ), R v is the vth candidate entity pair, R v1 For R v The first candidate entity in R v2 For R v The second candidate entity in , v = 1...d, d is the number of candidate entity pairs, wherein when the first second target word in the second target word pair is consistent with the first word corresponding to a target entity ω1 in the target entity list and the second second target word in the second target word pair is consistent with the first word corresponding to a target entity ω2 in the target entity list, (ω1, ω2) is obtained as a candidate entity pair; S605, according to R, obtain the third target word pair list R 0 ={R 0 1, ..., R 0 v , ..., R 0 d }, R 0 v =(R 0 v1 , R 0 v2 ), R 0 v1 For R v1 The last initial word in R 0 v2 For R v2 The last initial word in ; S607, when R 0 v When it is consistent with a first target word pair in the first target word pair list, the entity relationship triple {R v1 ,ζ,R v2 } is a target entity relationship.
2. The system for acquiring entities and entity relationships according to claim 1, characterized in that: B e =(B e1 , B e2 ), where B e1 is the initial word obtained from A, B e2 is the number of cells in A except those in B e1 Any initial word other than the initial word before the position.
3. The system for acquiring entities and entity relationships according to claim 1, characterized in that: f meets the following conditions: f=(n+1)×(n / 2).
4. The system for acquiring entities and entity relationships according to claim 1, characterized in that: D ex =0 or 1.
