CN114266230A - Text structuring processing method and device, storage medium and computer equipment - Google Patents

Text structuring processing method and device, storage medium and computer equipment Download PDF

Info

Publication number
CN114266230A
CN114266230A CN202111644937.9A CN202111644937A CN114266230A CN 114266230 A CN114266230 A CN 114266230A CN 202111644937 A CN202111644937 A CN 202111644937A CN 114266230 A CN114266230 A CN 114266230A
Authority
CN
China
Prior art keywords
entity
text
coding
feature
features
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
CN202111644937.9A
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.)
Anhui Iflytek Medical Information Technology Co ltd
Original Assignee
Anhui Iflytek Medical Information 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 Anhui Iflytek Medical Information Technology Co ltd filed Critical Anhui Iflytek Medical Information Technology Co ltd
Priority to CN202111644937.9A priority Critical patent/CN114266230A/en
Publication of CN114266230A publication Critical patent/CN114266230A/en
Pending legal-status Critical Current

Links

Images

Landscapes

  • Document Processing Apparatus (AREA)

Abstract

The application discloses a text structuring processing method and device, a storage medium and computer equipment. The method comprises the following steps: the method comprises the steps of carrying out entity extraction coding processing on text information to be structured based on entities and entity types in a knowledge dictionary to obtain entity coding features of all entities in the text information, splicing text character features corresponding to the text information with the entity coding features to obtain a feature set comprising the text character features and the entity coding features, obtaining entity attention weights of all features in the feature set relative to the text information, coding the text information according to the entity attention weights to obtain text coding features corresponding to the text information, and decoding the text coding features to obtain structured information in the text information. The method and the device can simultaneously extract the incidence relation and the entity in the text information, eliminate error propagation, enhance information interaction among different entities and improve the accuracy of text structuring processing.

Description

Text structuring processing method and device, storage medium and computer equipment
Technical Field
The present application relates to the field of data processing technologies, and in particular, to a text structured processing method and apparatus, a computer-readable storage medium, and a computer device.
Background
Document structuring is one of the important tasks in natural language processing, which aims to identify entities and relationships between entities in a document. In many fields, such as education, medical treatment, finance, industrial manufacturing and other fields, a great variety of documents exist, for example, in the medical field, a great number of electronic medical records, examination reports, medical teaching materials, medical guidelines and the like are involved, the unstructured documents or semi-structured documents are converted into structured documents, the document contents can be quickly understood through the structured documents, the working efficiency of workers in the corresponding fields can be effectively improved, and important information in the documents can be better mined and utilized.
At present, document structuring processing includes a two-stage mode, that is, the document structuring processing is divided into two subtasks: and the two subtasks are independently performed without considering the dependency relationship between the two subtasks, so that the result of document structured processing is inaccurate.
Disclosure of Invention
The embodiment of the application provides a text structuring processing method and device, a computer readable storage medium and computer equipment, which can improve the accuracy of text data structuring.
The embodiment of the application provides a text structuring processing method, which comprises the following steps:
based on entities and entity types in the knowledge dictionary, performing entity extraction coding processing on text information to be structured to obtain entity coding features of each entity in the text information;
splicing the text character features corresponding to the text information with the entity coding features to obtain a feature set comprising the text character features and the entity coding features;
acquiring entity attention weight of each feature in the feature set relative to the text information;
according to the entity attention weight, coding the text information to obtain text coding characteristics corresponding to the text information;
and decoding the text coding features to obtain structural information in the text information, wherein the structural information comprises a target entity, a target entity type corresponding to the target entity and a relation type between the target entity types.
An embodiment of the present application further provides a text structured processing apparatus, including:
the entity coding module is used for carrying out entity extraction coding processing on the text information to be structured based on the entities and the entity types in the knowledge dictionary to obtain the entity coding characteristics of each entity in the text information;
the feature splicing module is used for splicing the text character features corresponding to the text information with the entity coding features to obtain a feature set comprising the text character features and the entity coding features;
the weight acquisition module is used for acquiring entity attention weights of all the features in the feature set relative to the text information;
the text coding module is used for coding the text information according to the entity attention weight to obtain text coding characteristics corresponding to the text information;
and the decoding module is used for decoding the text coding features to obtain structural information in the text information, wherein the structural information comprises a target entity, a target entity type corresponding to the target entity and a relation type between the target entity types.
The embodiment of the present application further provides a computer-readable storage medium, where a computer program is stored, where the computer program is suitable for being loaded by a processor to perform the steps in the text structuring processing method according to any of the above embodiments.
The embodiment of the present application further provides a computer device, where the computer device includes a memory and a processor, where the memory stores a computer program, and the processor executes the steps in the text structuring processing method according to any of the above embodiments by calling the computer program stored in the memory.
The text structured processing method, the text structured processing device, the computer readable storage medium and the computer device provided by the embodiments of the present application perform entity extraction coding processing on text information to be structured based on entities and entity types in a knowledge dictionary to obtain entity coding features of each entity in the text information, perform splicing processing on text character features and entity coding features corresponding to the text information to obtain a feature set including text character features and entity coding features, and obtain an entity attention weight of each feature in the feature set relative to the text information, the embodiments of the present application can determine the entity attention weight according to the feature set composed of the entity coding features and the text character features in the knowledge dictionary, so that the knowledge information is fused in the entity attention weight, and the entity attention weight is determined according to each feature in the feature set, the text character features and the entity coding features are considered, information interaction between text characters and entities can be realized more effectively, the relevance between the text characters and the entities in the text information is more concerned, the information interaction between the text characters and the entities is improved, the text information is coded according to the entity attention weight to obtain the text coding features corresponding to the text information, so that the interaction between the entities, the entities and the text characters is strengthened in the text coding features, redundant information is weakened, the text coding features are decoded to obtain structural information in the text information, the structural information comprises target entities, target entity types corresponding to the target entities and relationship types among the target entity types, therefore, the scheme in the embodiment of the application can simultaneously extract the incidence relationship and the entities in the text information, and eliminate error propagation, the information interaction between different entities is enhanced, and the accuracy of text structuring processing is improved.
Drawings
In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings needed to be used in the description of the embodiments are briefly introduced below, and it is obvious that the drawings in the following description are only some embodiments of the present application, 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 schematic diagram of structured information of text information provided in an embodiment of the present application.
Fig. 2 is a schematic flowchart of a text structuring processing method according to an embodiment of the present application.
Fig. 3 is another schematic flow chart of a text structuring processing method according to an embodiment of the present application.
Fig. 4 is a sub-flow diagram of a text structuring processing method according to an embodiment of the present application.
Fig. 5 is a schematic diagram of a processing result of a text structuring process provided in an embodiment of the present application.
Fig. 6 is a schematic flowchart of a text structuring processing method according to an embodiment of the present application.
Fig. 7 is a schematic structural diagram of a text structuring processing apparatus according to an embodiment of the present application.
Fig. 8 is a schematic structural diagram of a computer device according to an embodiment of the present application.
Detailed Description
The technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application, and it is obvious that the described embodiments are only a part of the embodiments of the present application, 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 application.
The embodiment of the application provides a text structuring processing method and device, a computer readable storage medium and computer equipment. Specifically, the text structuring processing method according to the embodiment of the present application may be executed by a computer device, where the computer device may be a terminal or a server, and the like. The terminal can be a smart phone, a tablet Computer, a notebook Computer, a game machine, a Personal Computer (PC), a smart vehicle terminal, a robot, and the like. The server may be an independent physical server, may also be a server cluster composed of a plurality of physical servers, and may also be a cloud server providing basic cloud computing services such as a cloud service, a cloud database, cloud computing, a cloud function, cloud storage, a Network service, cloud communication, a middleware service, a domain name service, a security service, a Content Delivery Network (CDN), a big data and artificial intelligence platform, and the like.
Before formally introducing the technical scheme of the embodiment of the application, a current text structuring processing scheme is simply analyzed so as to facilitate understanding of the technical scheme of the application.
In the existing text structuring processing scheme, there are two main ways: a two-stage approach and a joint extraction approach.
The two-stage method divides entity identification and relationship identification into two subtasks: and the two subtasks adopt a serial connection mode, and the result of the entity recognition is input into a model corresponding to the relationship recognition, so that the structured information in the text information is obtained. Because the two subtasks are connected in series, the relationship recognition is influenced by the error of the entity recognition, and a certain dependency relationship exists between the recognized entity and the relationship recognition, but the two subtasks of the entity recognition and the relationship recognition are independently carried out in a two-stage mode, and the dependency relationship between the two subtasks is not considered, so that the result of text structuring processing is inaccurate.
For joint extraction, it is desirable to extract entities and association relations in text information through a unified framework, and joint extraction models are generally divided into two types: parameter sharing and joint decoding. By sharing the input features or the state of the hidden layer by the two subtasks, joint extraction can be realized. The scheme has no limitation on the sub-models, but the interaction between the entity model and the relationship model is not strong due to the use of an independent decoding algorithm, and the effect of text structuring processing needs to be improved.
In order to solve the above-mentioned method, embodiments of the present application provide a text structuring method, a text structuring device, a computer-readable storage medium, and a computer device, which will be described in detail respectively below. The numbers in the following examples are not intended to limit the order of preference of the examples.
The structured information in the text information is represented in the form of a triple, that is, the entity and the association relationship between the entities are represented in the form of a triple (head entity, tail entity, association relationship). Fig. 1 is a schematic diagram illustrating a text information structuring according to an embodiment of the present application. The input text corresponding to the decoder is ' progressive decline of left-eye vision ', wherein the entity type of ' left-eye ' is ' part ', ' entity type of ' progressive decline of left-eye vision ' is ' symptom ', the relationship type between the two entities is ' attribute ', and the text is recorded as (progressive decline of left-eye vision, part/symptom/attribute) in a triple mode. In the triplet, "left eye" is "head entity", "left eye vision progressive decline" is tail entity ", and the association relationship is" part/symptom/attribute ". Similarly, another triplet (progressive, progressive decline in left eye vision, nature/symptom/attribute) can also be constructed from fig. 1. The following description will be given taking text information in the medical field as an example.
Fig. 2 is a schematic flowchart of a text structuring processing method according to an embodiment of the present application. The text structuring processing method is applied to computer equipment and comprises the following steps.
And 101, performing entity extraction and coding processing on the text information to be structured based on the entities and the entity types in the knowledge dictionary to obtain entity coding features of each entity in the text information.
In each domain, a knowledge dictionary includes a number of terms (entities) and their corresponding types (entity types). For example, in the medical field, the entities include "left eye", "left eye vision deterioration", and the entity types correspond to "part", "symptom", and the like.
As shown in table 1, is an example of a medical knowledge dictionary. Each row in Table 1 corresponds to each entry, each entry consisting of three parts, namely, medical term (entity), attribute, and type (entity type).
TABLE 1 medical knowledge dictionary example
Figure BDA0003444803120000051
Figure BDA0003444803120000061
As can be seen from table 1, "left eye" belongs to the site class, "sinus tachycardia" belongs to the disease class, etc., and "progressive" belongs to the nature class, etc.
In an embodiment, the step 101 includes: performing entity extraction on the text information to be structured based on the entities and the entity types in the knowledge dictionary to obtain each entity and the corresponding entity type in the text information; and coding each entity and the corresponding entity type to obtain the entity coding characteristics of each entity in the text information.
And based on the knowledge dictionary, performing entity extraction on the text information to be structured to obtain each entity and the corresponding entity type in the text information. Specifically, the method comprises the following steps: comparing the text information to be structured with the entities in the knowledge dictionary to extract the entities in the text information; and determining the entity type corresponding to the entity in the text information according to the corresponding relation between the entity and the entity type in the knowledge dictionary.
Specifically, for each word or a plurality of words in the text information, matching is carried out with each entity in the knowledge dictionary, and the word or the plurality of words which are successfully matched are used as the entity in the text information; and determining the entity type of the entity which is successfully matched according to the corresponding relation between the entity and the entity type in the knowledge dictionary.
Determining entities and entity types in text information to be structured can be accomplished using the following pseudo-code.
Figure BDA0003444803120000062
Figure BDA0003444803120000071
The pseudo code part inputs text information to be structured and a knowledge dictionary and outputs position information of the entity matched into the text information in the text information and the corresponding entity type.
For example, if the text message is "progressive deterioration of left eye vision", the corresponding output is shown in table 2. Wherein, the corresponding entity includes: left eye, progressive and progressive visual deterioration, the corresponding entity types are respectively: location, nature, symptoms.
Table 2 input and output examples of entity matching
Figure BDA0003444803120000072
After each entity and the corresponding entity type in the text information to be structured are obtained, each entity and the corresponding entity type are coded to obtain the entity coding characteristics of each entity in the text information. In an embodiment, the step of performing encoding processing on each entity and the corresponding entity type to obtain the entity encoding characteristic of each entity in the text message includes: carrying out feature coding processing on each entity to obtain entity text features corresponding to each entity; coding each entity type to obtain type coding characteristics corresponding to each entity type; and overlapping the entity text characteristics corresponding to each entity and the corresponding type coding characteristics to determine the entity coding characteristics of each entity in the text information.
In an embodiment, feature encoding processing may be performed on each entity through a neural network to obtain entity text features corresponding to each entity. For example, a convolutional neural network is used to perform feature coding processing on each entity in the text message. For example, each entity such as "left eye", "progressive visual deterioration" is input into a convolutional neural network for feature encoding processing, so as to convert each corresponding entity into low-dimensional dense entity text features. The convolutional neural network can effectively capture local characteristics of each entity through sparse interaction, parameter sharing and other modes, and can obtain the most important information in each entity through the pooling layer and the full connection layer, so that the text characteristics of the entities comprise the important information in the entities. Specifically, a convolutional neural network is used to perform feature coding processing on the text corresponding to each entity, please refer to the scheme in the prior art, which is not described in detail here. Taking a 512-dimensional feature vector as an example, feature coding processing is performed on the left eye, the progressive feature and the progressive vision decline, and the dimensions corresponding to the obtained entity text features are 1 × 512, 1 × 512 and 1 × 512.
And after the entity text characteristics are obtained, coding each entity type to obtain type coding characteristics. And coding each entity type by using a word embedding vector method to obtain type coding characteristics. For example, the text such as "part", "property", and "symptom" is encoded. The method for coding each entity type to obtain the type coding feature may use a neural network method, or may use other methods to code the text corresponding to each entity type. The text such as the "part", "nature", and "symptom" is coded, and the dimension of the obtained type coding feature is 1 × 512, and 1 × 512, respectively.
And after the entity text characteristics and the type coding characteristics are obtained, determining the entity coding characteristics of each entity in the text information according to the entity text characteristics and the type coding characteristics. Specifically, the entity text features corresponding to the entities and the type coding features corresponding to the entities are superimposed to obtain the entity coding features of the entities in the text information.
For example, the entity text feature corresponding to the "left eye" and the type coding feature corresponding to the "part" are superimposed, the entity text feature corresponding to the "progressive" and the type coding feature corresponding to the "property" are superimposed, the entity text feature corresponding to the "vision progressive decline" and the type coding feature corresponding to the "symptom" are superimposed, and the dimension of the entity coding feature obtained after the superimposition is still 1 × 512, so that the entity coding features with three dimensions of 1 × 512 are obtained.
In the step, the entity coding in the text information to be structured is realized, or the step can also be understood as coding the knowledge in the text information, correspondingly searching the entity (knowledge) in the text information, and vectorizing the entity, thereby integrating the prior knowledge into the text structuring. In the method, the knowledge dictionary with the structure can be used as a knowledge source, so that the generalization performance of the scheme is good.
And 102, splicing the text character features and the entity coding features corresponding to the text information to obtain a feature set comprising the text character features and the entity coding features.
Vectorizing the text information to obtain text character features corresponding to the text information, wherein each text character corresponds to one text character feature, and if a plurality of text characters exist in the text information, the text characters correspond to a plurality of text character features. For example, the text information may be vectorized by embedding words into vectors to obtain text character features, and other ways may also be used to obtain text character features corresponding to the text information. For example, the text message "progressive left eye vision decline", each text character therein is vectorized to obtain 9 text character features, one text/one character for each text character feature. The dimension corresponding to each text character feature may be 1 × 512, and the text character feature corresponding to the text message is 9 × 512.
And after the text character features and the entity coding features are obtained, splicing the text character features and the entity coding features to obtain a feature set comprising the text character features and the entity coding features. For example, the dimension of the text character feature is 9 × 512, and the dimension of the entity coding feature is 3 × 512, that is, 1 × 512 entity coding features corresponding to 3 entities, and the text character feature and the entity coding features are spliced to obtain a 12 × 512 feature set. There are 12 features 1 × 512 in the feature set after splicing. As can be seen in fig. 3.
In the step, the text character features and the entity coding features are spliced, so that the feature set comprises both the text character features in the text information and the entity coding features in the text information.
And 103, acquiring entity attention weight of each feature in the feature set relative to the text information.
In order to better distinguish the entity in the text information from the original text and strengthen the connection and interaction between the entity and the original text, and the entity information is integrated into the text structuring processing, the embodiment of the application provides an entity attention mechanism in the process of carrying out feature coding on the text information, and the entity attention mechanism can clearly distinguish the entity information from the original text information by controlling corresponding parameters.
And determining an entity attention weight of each feature in the feature set relative to the text information through an entity attention mechanism, and performing feature coding on the text character features according to the entity attention weight.
In an embodiment, the step 103 includes: and determining the correlation among the features in the feature set, and determining the determined correlation as the entity attention weight of each feature in the feature set relative to the text information. Wherein, determining the correlation between the features in the feature set can also be understood as the contribution degree of each feature relative to other features in the feature set.
In one embodiment, the step of determining a correlation between features in the feature set comprises: determining a correlation between each text character feature and each text character feature in the feature set, determining a correlation between each text character feature and each entity coding feature, determining a correlation between each entity coding feature and each text character feature, and determining a correlation between each entity coding feature and each entity coding feature.
Since the feature set includes text character features (e.g., 9) corresponding to each text character and entity coding features (e.g., 3) corresponding to each entity, determining the contribution/correlation of each feature to other features in the feature set requires calculating the correlation between each text character feature and each text character feature in the feature set, determining the correlation between each text character feature and each entity coding feature, determining the correlation between each entity coding feature and each text character feature, and determining the correlation between each entity coding feature and each entity coding feature.
Wherein each feature in the feature set is assumed to be represented by X ═ { X ═ X1,x2,x3,....,xnThe correlation between the features in the feature set can be calculated according to the following formula (1).
Figure BDA0003444803120000101
Where K, Q is the parameter matrix and L is the dimension of the corresponding eigenvector, divided by
Figure BDA0003444803120000102
Denotes normalization, xiAnd xjRepresenting the ith and jth features, a, in a feature setijRepresenting the correlation between the ith and jth features. The text parameter matrix includes K, Qc2cThe text entity parameter matrix comprises K, Qc2eThe entity text parameter matrix includes K, Qe2cThe entity parameter matrix comprises K, Qe2e. Wherein, the text parameter matrix, the text entity parameter matrix, the entity text parameter matrix and the entity parameter momentThe arrays are all obtained by the training process. X in the first formula of the above formula (1)iAnd xjAll are text character features in the text information; x in the second of the above equations (1)iFor text character features in text information, xjEncoding the feature for the entity; x in the third formula in the above formula (1)iFor entity-coded features, xjThe character features are text character features in the text information; x in the fourth formula in the above formula (1)iAnd xjAre both physical coding features.
Wherein the step of determining the correlation between each text character feature and each text character feature comprises: performing dot product processing on any text character feature in the feature set and the transpose of any text character feature in the feature set by using the text parameter matrix to obtain dot product processing results of each text character feature and the transpose of each text character feature; and carrying out normalization processing on the dot product processing result to obtain the correlation between each text character characteristic and each text character characteristic. Specifically, reference may be made to the first formula in the above formula (1).
For example, assuming that the first 9 features in the feature set are text character features, the correlation between each text character feature and each text character feature is determined, that is, the 9 text character features are subjected to correlation processing with the transpose of the 9 text character features in the feature set. For example, a text character feature corresponding to a text character "left" is dot-product-processed with a transpose of any one of the text character features "left", "eye", "look", "force", "go", "line", "nature", "down" and "down", and is normalized to obtain a correlation corresponding to the text character "left" and the text character "left", "eye", "look", "force", "go", "line", "nature", "down" and "down", where i is 1, and j is in a range of [1,9 ]. Similarly, the correlation corresponding to other text characters and the text characters such as left, eye, sight, force, line, nature, down and descending can be calculated.
It should be noted that, when calculating the correlation, one of the two features needs to be transposed and then calculated, and hereinafter, when calculating the correlation, the feature which is not written with the transpose needs to be understood as such, and will not be described again.
Wherein the step of determining the correlation between each text character feature and each entity encoding feature comprises: performing dot product processing on any text character feature in the feature set and any entity coding feature in the feature set by using the text entity parameter matrix to obtain a dot product processing result between each text character feature and each entity coding feature; and carrying out normalization processing on the dot product processing result to obtain the correlation between each text character characteristic and each entity coding characteristic. Reference may be made in particular to the second of the above-mentioned equations (1).
For example, assuming that the first 9 features in the feature set are text character features and the last 3 features are entity encoding features, the second formula in formula (1) is used in calculating the correlation between the first 9 features and the last 3 features. For example, when any one of the text character features of the text characters "left", "eye", "view", "force", "forward", "line", "nature", "downward" is correlated with any one of the entity coding features corresponding to "left eye" + "position", "progressive" + "nature", "progressive vision decline" + "symptom", the second formula in the above formula (1) is used, and correspondingly, i is in the range of [1,9] and j is in the range of [10,12 ].
Wherein the step of determining the correlation between each entity coding feature and each text character feature comprises: carrying out dot product processing on any entity coding feature in the feature set and any text character feature in the feature set by using the entity text parameter matrix to obtain a dot product processing result between each entity coding feature and each text character feature; and carrying out normalization processing on the dot product processing result to obtain the correlation between each entity coding feature and each text character feature. Reference may be made in particular to the third formula of the above formula (1).
For example, assuming that the first 9 features in the feature set are text character features and the last 3 features are entity encoding features, the third formula in formula (1) is used in calculating the correlation between the last 3 features and the first 9 features. For example, when any one of the physical coding features corresponding to "left eye" + "region", "progressive" + "property", "progressive decrease in vision" + "symptom" is correlated with any one of the text character features of "left", "eye", "sight", "force", "forward", "reverse", "downward" and "decrease", the third formula of the above formula (1) is used, and corresponding ranges of i and j are [10,12] and [1,9 ].
Wherein the step of determining the correlation between each entity coding feature and each entity coding feature comprises: performing dot product processing on any entity coding feature in the feature set and the transpose of any entity coding feature in the feature set by using the entity parameter matrix to obtain a dot product processing result between each entity coding feature and each entity coding feature; and carrying out normalization processing on the dot product processing result to obtain the correlation between each entity coding feature and each entity coding feature. See in particular the fourth formula in formula (1) above.
For example, assuming that the last 3 features in the feature set are entity-coded features, the fourth formula in formula (1) is used in calculating the correlation between the last 3 features and the devices of the last 3 features. For example, when any one of the physical coding features corresponding to the "left eye" + "region", "progressive" + "property", and "progressive deterioration of vision" + "symptom" is subjected to correlation processing with the transpose of any one of the physical coding features corresponding to the "left eye" + "region", "progressive" + "property", and "progressive deterioration of vision" + "symptom", the fourth formula in the above formula (1) is used, and accordingly, the range of i is [10,12], and the range of j is [10,12 ].
When i is in the range of [1,12 ]]J has a range of [1,12 ]]Then, alpha is finally obtainedijA matrix with dimension 12 x 12, where each value in the matrix represents the degree of correlation between the corresponding two features. It will be appreciated that the correlation between any two features is a scalar.
By the calculation mode of the entity attention weight, knowledge information is fused in the entity attention weight, and the entity attention weight is determined according to each feature in the feature set, so that text character features and entity coding features are considered, text characters and entity information in the text information can be distinguished in an explicit mode, information interaction between the text characters and the entities can be achieved more effectively, and the relevance of the text characters and the entities in the text information is more concerned.
And 104, coding the text information according to the entity attention weight to obtain the text coding characteristics corresponding to the text information.
Because the entity attention weight considers the text character feature and the entity coding feature, the information interaction between the text character and the entity can be more effectively realized, and the relevance between the text character and the entity in the text information is more concerned, therefore, the text information is coded according to the entity attention weight to obtain the text coding feature corresponding to the text information, so that the interaction of the entity, the entity and the character is strengthened in the text coding feature, and the redundant information is weakened.
Because the text information includes entity information and text character information, the text feature code corresponding to the text information in step 104 includes: text feature codes corresponding to the text character information and text feature codes corresponding to the entity information.
In an embodiment, the step 104 includes: for each feature in the feature set, performing dot product processing on the entity attention weight corresponding to the feature and each feature in the feature set; and summing the features obtained by the dot product processing to obtain the text coding feature corresponding to each feature.
For example, when the number of features in the feature set is 12, the attention weight of the entity corresponding to the ith feature is αi1To alphai12Will be alphai1To alphai12And performing dot product processing on the features in the feature set. Such as alphai1Dot product with the first feature in the feature set, αi2Dot product with the second feature in the feature set, and so on, alphai12And performing dot product processing on the 12 th feature in the feature set, thus obtaining 12 features respectively. And summing all the features obtained by the dot product processing, namely summing 12 features obtained by the dot product processing to obtain the text coding feature corresponding to the ith feature.
The text encoding characteristic corresponding to the text information can be determined according to the formula (2).
Figure BDA0003444803120000131
Wherein n is the total number of features in the feature set, hiAnd representing the text coding features corresponding to the ith feature in the feature set. The text coding feature corresponding to each feature in the feature set can be obtained according to the formula (2), and the text coding feature corresponding to the text information can also be understood to be obtained. Wherein, the feature set can be understood as feature information corresponding to the text information.
For example, if the number of features in the feature set is 12, and the dimension of each feature in the feature set is 1 × 512, the number of the obtained text encoding features is also 12, as shown in fig. 3. Wherein the dimension of each text encoding feature is 1 × 512.
The above steps 101 to 104 are implemented by an encoder, and the output of the encoder is a text feature code. In a practical implementation there may be multiple encoders, the output of the first encoder will be the input to the second encoder, up to the output of the last encoder. The output of the last encoder is taken as the text feature vector finally obtained in the encoding stage. Where the processing in each encoder is identical, only the inputs are different.
It should be noted that the text encoding features include encoding features corresponding to text character features and encoding features obtained by encoding the entity encoding features again, so that the output of the encoder includes entity content and original text content, interaction between the original text and the entity is enhanced, and the accuracy of the structuring process is improved.
And 105, decoding the text coding features to obtain structural information in the text information, wherein the structural information comprises the target entity and the incidence relation between the target entities.
The incidence relation between the target entities comprises target entity types of the target entities and relation types between the target entity types.
Wherein the decoding process is similar to the encoding process, and the decoding process uses a mask attention mechanism. It should be noted that, in general, there are several encoders and several decoders. The encoder and decoder shown in fig. 3 are both one, but there may be more than one. For example, if there are 2 encoders, then there are 2 decoders, and the output of the last encoder is input to a Cross attribute module, also called an encoder-decoder attribute module, in each decoder. And (4) utilizing a Cross Attention module to carry out interactive processing on the text coding characteristics and the input characteristics obtained by the first two modules (a mask from an Attention module and a normalization and summation module) in the decoder.
In one embodiment, as shown in FIG. 4, step 105 includes the following steps 201 to 204.
And 201, performing mask processing on the current characteristic input at the current moment and the input characteristic input before the current moment in the decoder based on a mask attention mechanism to obtain a mask characteristic.
And 202, normalizing and summing the features after the mask processing.
The decoder decodes one by one in sequence, so that the input features of the decoder at the current moment comprise the current features input at the current moment and the input features input before the current moment, and the input features of the decoder at the current moment are subjected to mask processing to obtain mask attention weights.
For example, when the current time is 0 th time, and the input of the decoder is the text character feature corresponding to "left", the text character feature corresponding to "left" and the text character feature corresponding to "left" are subjected to dot product processing to obtain a mask attention weight; and performing dot product processing on the mask attention weight and the text character feature corresponding to the left to obtain a mask feature. If the current mask feature is one, the corresponding mask feature is obtained after normalization processing and summation processing.
For example, the current time is time 1, and the input of the decoder includes text character features corresponding to "eye" input at the current time and text character features corresponding to "left" input before the current time/hidden vectors corresponding to "left" input before the current time. And performing dot product processing on the text character features corresponding to the left and the eye to obtain four mask attention weights respectively, and performing dot product processing on the four mask attention weights and four text character features formed by the text character features corresponding to the left and the eye to obtain the mask features. And normalizing the mask features and performing summation processing to obtain summed features, wherein the dimension of the summed features is 1 × 512.
And so on, so that the input of the decoder comprises the entity coding characteristics corresponding to the 'progressive vision decline' + 'symptom' input at the current moment and 11 characteristics input before the current moment. And performing mask processing on the input features at the current moment in the decoder to obtain mask features, and performing normalization and summation processing on the mask features to obtain summed features.
The above-mentioned mask obtaining feature is realized by a mask self-attention module, and the normalization and summation processing is realized by a normalization and summation module.
And 203, performing interactive processing on the summed features and the text coding features to obtain the output features of the decoder at the current moment.
Wherein, step 203, includes: performing dot product processing on the summed features and each text coding feature to obtain cross attention weight; and decoding each text coding characteristic according to the cross attention weight to obtain the output characteristic of the decoder at the current moment.
Assume that the text encoding feature is denoted as H ═ H1,h2,...,hj,...,hnThe characteristic of the decoder after summation processing at the t time is expressed as ytThen the corresponding cross attention weight can be calculated according to equation (3).
βtj=WytQhj (3)
Wherein, betatjFor the corresponding cross attention weight, as a scalar, W, Q is a learnable parameter. After the cross attention weight is calculated, the output characteristic of the decoder can be obtained according to the formula (4).
Figure BDA0003444803120000161
Yt' is the output characteristic of the decoder at the time t, and the dimension of the output characteristic is 1 × 512.
It should be noted that in the embodiment of the present application, the text encoding features obtained by the encoder are input to the decoder for interactive processing, so as to strengthen the connection between encoding and decoding, and improve the accuracy of entity identification and relationship extraction.
And 204, mapping the output features to the dictionary space to obtain target entities in the dictionary space corresponding to the output features or incidence relations among the target entities.
Step 204 may be implemented by a Feed-Forward module, as shown in FIG. 3.
And mapping the output features to a dictionary space to obtain feature vectors in the dictionary space corresponding to the output features, and performing normalization processing on the feature vectors to obtain target entities corresponding to the output features and/or association relations between the target entities.
For example, if the output feature is 1 × 512 and the feature corresponding to the dictionary space is 512 × 10000, the feature vector in the dictionary space corresponding to the output feature is 1 × 10000, the feature vector is normalized, for example, by using a softmax function, to obtain a corresponding probability, and information corresponding to the position of the dictionary space with the highest probability is used as the decoding result corresponding to the t-th time.
It should be noted that the above decoding process is only an example. No matter what the decoding process is, the result (text encoding characteristic) obtained by the encoder needs to be interacted with the decoder to obtain the corresponding decoding result, so that the relation between encoding and decoding is strengthened, and the accuracy of entity identification and relation extraction is improved.
In the embodiment of the application, the decoding result obtained by the final decoder is used as the processing result of the text structuring processing, and the processing result displays the corresponding relation triple in a sequence form. In an output sequence, a symbol "|" is used as a separator between relation triplets, and a special symbol is adopted for the types of a head entity, a tail entity and entities in the relation triplets; "as a separator. As shown in table 3, are input and output examples.
Table 3 input output example
Figure BDA0003444803120000171
Fig. 5 is a schematic diagram of structured information of an electronic medical record provided in an embodiment of the present application. The method comprises the steps of obtaining an association relation between an entity and a text in an electronic medical record, wherein the text in the electronic medical record is 'numb and powerless limbs on the right side and unclear speech for half a day' and is structured. As shown in fig. 5: the entity names of the right limb are ' position ', ' the right limb is numb and powerless ' and ' the speech is unclear ', the entity type is ' symptom ', and the entity type is ' attack time ' in half a day '. And the relation of 'attribute' between 'numbness and weakness of right limb', 'slurred speech' and 'half a day' can be obtained, and the relation can show that the two symptoms last for half a day.
It should be noted that the present application embodiment is described taking the medical field as an example, but the method in the present application embodiment may be applied to text structuring processing in any field.
The implementation of the above steps 101 to 105 can be realized by a text structuring model, which includes an encoder and a decoder, corresponding to the encoding stage and the decoding stage, respectively. Step 101 to step 104 correspond to the encoding stage and step 105 corresponds to the decoding stage.
In an embodiment, an embodiment of the present application further provides a text structuring processing method, where the text structuring processing method includes a training process of a text structuring model. Specifically, as shown in fig. 6, the text structuring processing method includes the following steps.
And 301, based on the entities and entity types in the knowledge dictionary, performing entity extraction and coding processing on each training text information in the training text data set to be subjected to structured processing to obtain the training entity coding features of each entity in the training text information.
Performing entity extraction on each training text information in a training text data set to be subjected to structured processing based on entities and entity types in the knowledge dictionary to obtain each entity and corresponding entity type in the training text information; and coding each entity and the corresponding entity type to obtain the training entity coding characteristics of each entity in the training text information.
And 302, splicing the training text character features corresponding to the training text information with the training entity coding features to obtain a training feature set comprising the training text character features and the training entity coding features.
303, obtaining the attention weight of each training feature in the training feature set relative to the training entity of the training text information.
In one embodiment, obtaining the training entity attention weight comprises: determining the correlation among training features in a training feature set; the relevance is determined as a training entity attention weight of each training feature relative to the training text information.
In one embodiment, the step of determining a correlation between training features in the set of training features comprises: determining the correlation between each training text character feature and each training text character feature in the training feature set, determining the correlation between each training text character feature and each training entity coding feature, determining the correlation between each training entity coding feature and each training text character feature, and determining the correlation between each training entity coding feature and each training entity coding feature.
And 304, coding the training text information according to the attention weight of the training entity to obtain the training text coding characteristics corresponding to the training text information.
For each training feature in the training feature set, performing dot product processing on the training entity attention weight corresponding to the training feature and each training feature in the training feature set; and summing the training features obtained by the dot product processing to obtain the training text coding features corresponding to the training text information.
And 305, decoding the coding features of the training text to obtain training structured information in the training text information, wherein the training structured information comprises the target entity and the incidence relation between the target entities.
Based on a mask self-attention mechanism, performing mask processing on training input features at the current moment in a decoder to obtain training mask features, wherein the training input features comprise features input at the current moment and features input before the current moment; summing and normalizing the training mask features; carrying out interactive processing on the features after the normalization processing and the text coding features to obtain the training output features of the decoder at the current moment; and mapping the training output features to a dictionary space to obtain target entities and/or incidence relations between the target entities in the dictionary space corresponding to the training output features.
A loss function is calculated from the training structured information and training parameters are adjusted based on the loss function 306.
In one embodiment, the Loss function of the present application may be a Focal local, a GHM local, or a combined Loss function of the Focal local and the GHM local.
And carrying out reverse transfer according to the loss function, adjusting the training parameters of the text structured modeling until the loss function is converged, or stopping training until the number of training rounds reaches a preset number of rounds, or other ending conditions are reached. The training parameters can refer to the parameters in formula (1) and formula (3). It should be noted that the parameters mentioned in formula (1) and formula (3) are only a part of the training parameters, and other training parameters are not represented in the formula.
It should be noted that the processing in the training process is consistent with the processing steps in the application, and please refer to the above flow, which is not described in detail. Except that training two characters are added before all nouns in the training process to distinguish.
All the above technical solutions can be combined arbitrarily to form the optional embodiments of the present application, and are not described herein again.
In order to better implement the text structuring method according to the embodiments of the present application, an embodiment of the present application further provides a text structuring device. Referring to fig. 7, fig. 7 is a schematic structural diagram of a text structuring processing device according to an embodiment of the present application. The text structuring processing apparatus 400 may include an entity encoding module 401, a feature concatenation module 402, a weight obtaining module 403, a text encoding module 404, and a decoding module 405.
And the entity encoding module 401 is configured to perform entity extraction and encoding processing on the text information to be structured based on the entities and the entity types in the knowledge dictionary to obtain entity encoding features of each entity in the text information.
In an embodiment, the entity encoding module 401 is specifically configured to perform entity extraction on text information to be structured based on entities and entity types in a knowledge dictionary to obtain each entity and a corresponding entity type in the text information; and coding each entity and the corresponding entity type to obtain the entity coding characteristics of each entity in the text information.
In an embodiment, when the entity encoding module 401 performs the step of encoding each entity and the corresponding entity type to obtain the entity encoding characteristic of each entity in the text message, the following steps are specifically performed: carrying out feature coding processing on each entity to obtain entity text features corresponding to each entity; coding each entity type to obtain type coding characteristics corresponding to each entity type; and overlapping the entity text characteristics corresponding to each entity and the corresponding type coding characteristics to determine the entity coding characteristics of each entity in the text information.
In an embodiment, when the entity encoding module 401 performs the step of performing entity extraction on the text information to be structured based on the entities and the entity types in the knowledge dictionary to obtain each entity and the corresponding entity type in the text information, the following steps are specifically performed: comparing the text information to be structured with entities in a knowledge dictionary to extract the entities in the text information; and determining the entity type corresponding to the entity in the text information according to the corresponding relation between the entity and the entity type in the knowledge dictionary.
A feature splicing module 402, configured to splice text character features corresponding to the text information with the entity coding features to obtain a feature set including the text character features and the entity coding features.
A weight obtaining module 403, configured to obtain an entity attention weight of each feature in the feature set with respect to the text information.
In an embodiment, the weight obtaining module 403 is specifically configured to determine a correlation between features in the feature set, where the features include text character features and entity encoding features; determining the relevance as an entity attention weight of each feature in the feature set relative to the textual information.
In an embodiment, when the step of determining the correlation between the features in the feature set is executed, the weight obtaining module 403 specifically executes: determining a correlation between each text character feature and each text character feature in the feature set, determining a correlation between each text character feature and each entity coding feature, determining a correlation between each entity coding feature and each text character feature, and determining a correlation between each entity coding feature and each entity coding feature.
In an embodiment, when the step of determining the correlation between each text character feature and each text character feature is executed, the weight obtaining module 403 specifically executes: performing dot product processing on any text character feature in the feature set and the transpose of any text character feature in the feature set by using the text parameter matrix to obtain dot product processing results of each text character feature and the transpose of each text character feature; and carrying out normalization processing on the dot product processing result to obtain the correlation between each text character characteristic and each text character characteristic.
In an embodiment, when the step of determining the correlation between each text character feature and each entity encoding feature is executed, the weight obtaining module 403 specifically executes: performing dot product processing on any text character feature in the feature set and any entity coding feature in the feature set by using the text entity parameter matrix to obtain a dot product processing result between each text character feature and each entity coding feature; and carrying out normalization processing on the dot product processing result to obtain the correlation between each text character characteristic and each entity coding characteristic.
In an embodiment, when the step of determining the correlation between each entity encoding feature and each text character feature is executed, the weight obtaining module 403 specifically executes: carrying out dot product processing on any entity coding feature in the feature set and any text character feature in the feature set by using the entity text parameter matrix to obtain a dot product processing result between each entity coding feature and each text character feature; and carrying out normalization processing on the dot product processing result to obtain the correlation between each entity coding feature and each text character feature.
In an embodiment, the weight obtaining module 403 performs the step of determining the correlation between each entity coding feature and each entity coding feature, including: performing dot product processing on any entity coding feature in the feature set and the transpose of any entity coding feature in the feature set by using the entity parameter matrix to obtain a dot product processing result between each entity coding feature and each entity coding feature; and carrying out normalization processing on the dot product processing result to obtain the correlation between each entity coding feature and each entity coding feature.
And a text encoding module 404, configured to encode the text information according to the entity attention weight to obtain a text encoding characteristic corresponding to the text information.
In an embodiment, the text encoding module 404 is specifically configured to perform entity extraction on text information to be structured based on entities and entity types in the knowledge dictionary to obtain each entity and a corresponding entity type in the text information; and coding each entity and the corresponding entity type to obtain the entity coding characteristics of each entity in the text information.
A decoding module 405, configured to decode the text encoding feature to obtain structured information in the text information, where the structured information includes a target entity and an association relationship between the target entities.
In an embodiment, the decoding module 405 is specifically configured to perform mask processing on an input feature at a current time in a decoder based on a mask attention mechanism to obtain a mask feature, where the input feature at the current time includes a current feature input at the current time and an input feature input before the current time; normalizing and summing the mask features; performing interactive processing on the summed features and the text coding features to obtain the output features of the decoder at the current moment; and mapping the output features to a dictionary space to obtain target entities and/or incidence relations between the target entities in the dictionary space corresponding to the output features.
In one embodiment, the text structuring device further comprises a training module 406. The training module 406 is configured to train a text structured model, and specifically includes: based on entities and entity types in a knowledge dictionary, performing entity extraction coding processing on each training text information in a training text data set to be subjected to structured processing to obtain training entity coding features of each entity in the training text information; splicing the training text character features corresponding to the training text information with the training entity coding features to obtain a training feature set comprising the training text character features and the training entity coding features; acquiring the attention weight of each training feature in the training feature set relative to the training entity of the training text information; coding the training text information according to the attention weight of the training entity to obtain a training text coding characteristic corresponding to the training text information; decoding the coding features of the training text to obtain training structured information in the training text information, wherein the training structured information comprises an association relation between a target entity and the target entity; a loss function is calculated from the training structured information, and training parameters are adjusted based on the loss function.
All the above technical solutions can be combined arbitrarily to form the optional embodiments of the present application, and are not described herein again.
Correspondingly, the embodiment of the application also provides a computer device, and the computer device can be a terminal or a server. As shown in fig. 8, fig. 8 is a schematic structural diagram of a computer device according to an embodiment of the present application. The computer apparatus 500 includes a processor 501 having one or more processing cores, a memory 502 having one or more computer-readable storage media, and a computer program stored on the memory 502 and executable on the processor. The processor 501 is electrically connected to the memory 502. Those skilled in the art will appreciate that the computer device configurations illustrated in the figures are not meant to be limiting of computer devices and may include more or fewer components than those illustrated, or some components may be combined, or a different arrangement of components.
The processor 501 is a control center of the computer apparatus 500, connects the respective parts of the entire computer apparatus 500 by various interfaces and lines, performs various functions of the computer apparatus 500 and processes data by running or loading software programs (computer programs) and/or modules stored in the memory 502, and calling data stored in the memory 502, thereby monitoring the computer apparatus 500 as a whole.
In this embodiment of the present application, the processor 501 in the computer device 500 loads instructions corresponding to processes of one or more applications into the memory 502, and the processor 501 executes the applications stored in the memory 502, so as to implement functions corresponding to any of the above text structuring processing methods. For specific implementation, reference may be made to the foregoing embodiments, which are not described herein again.
Optionally, as shown in fig. 8, the computer device 500 further includes: touch-sensitive display screen 503, radio frequency circuit 504, audio circuit 505, input unit 506 and power 507. The processor 501 is electrically connected to the touch display screen 503, the radio frequency circuit 504, the audio circuit 505, the input unit 506, and the power supply 507, respectively. Those skilled in the art will appreciate that the computer device configuration illustrated in FIG. 8 does not constitute a limitation of computer devices, and may include more or fewer components than those illustrated, or some components may be combined, or a different arrangement of components.
The touch display screen 503 can be used for displaying a graphical user interface and receiving an operation instruction generated by a user acting on the graphical user interface. The touch display screen 503 may include a display panel and a touch panel. The display panel may be used, among other things, to display information entered by or provided to a user and various graphical user interfaces of the computer device, which may be made up of graphics, text, icons, video, and any combination thereof. Alternatively, the Display panel may be configured in the form of a Liquid Crystal Display (LCD), an Organic Light-Emitting Diode (OLED), or the like. The touch panel may be used to collect touch operations of a user on or near the touch panel (for example, operations of the user on or near the touch panel using any suitable object or accessory such as a finger, a stylus pen, and the like), and generate corresponding operation instructions, and the operation instructions execute corresponding programs. The touch panel may overlay the display panel, and when the touch panel detects a touch operation thereon or nearby, the touch panel transmits the touch operation to the processor 501 to determine the type of the touch event, and then the processor 501 provides a corresponding visual output on the display panel according to the type of the touch event. In the embodiment of the present application, the touch panel and the display panel may be integrated into the touch display screen 503 to implement input and output functions. However, in some embodiments, the touch panel and the touch panel can be implemented as two separate components to perform the input and output functions. That is, the touch display 503 can also be used as a part of the input unit 506 to implement an input function.
In the embodiment of the present application, the touch display screen 503 is used for presenting a graphical user interface and receiving an operation instruction generated by a user acting on the graphical user interface.
The rf circuit 504 may be used for transceiving rf signals to establish wireless communication with a network device or other computer device via wireless communication, and for transceiving signals with the network device or other computer device.
Audio circuitry 505 may be used to provide an audio interface between a user and a computer device through speakers, microphones. The audio circuit 505 may transmit the electrical signal converted from the received audio data to a speaker, and convert the electrical signal into a sound signal for output; on the other hand, the microphone converts the collected sound signal into an electrical signal, which is received by the audio circuit 505 and converted into audio data, which is then processed by the audio data output processor 501, and then transmitted to, for example, another computer device via the rf circuit 504, or output to the memory 502 for further processing. The audio circuitry 505 may also include an earbud jack to provide communication of a peripheral headset with the computer device.
The input unit 506 may be used to receive input numbers, character information, or user characteristic information (e.g., fingerprint, iris, facial information, etc.), and generate keyboard, mouse, joystick, optical, or trackball signal inputs related to user settings and function control.
The power supply 507 is used to power the various components of the computer device 500. Optionally, the power supply 507 may be logically connected to the processor 501 through a power management system, so as to implement functions of managing charging, discharging, power consumption management, and the like through the power management system. The power supply 507 may also include any component including one or more dc or ac power sources, recharging systems, power failure detection circuitry, power converters or inverters, power status indicators, and the like.
Although not shown in fig. 8, the computer device 500 may further include a camera, a sensor, a wireless fidelity module, a bluetooth module, etc., which are not described in detail herein.
In the foregoing embodiments, the descriptions of the respective embodiments have respective emphasis, and for parts that are not described in detail in a certain embodiment, reference may be made to related descriptions of other embodiments.
It will be understood by those skilled in the art that all or part of the steps of the methods of the above embodiments may be performed by instructions or by associated hardware controlled by the instructions, which may be stored in a computer readable storage medium and loaded and executed by a processor.
To this end, the present application provides a computer-readable storage medium, in which a plurality of computer programs are stored, and the computer programs can be loaded by a processor to execute the steps in any one of the text structuring processing methods provided by the embodiments of the present application. For example, the computer program may perform the steps of:
acquiring data information to be identified in a data identification scene; generating text data and graph structure data corresponding to the data information to be identified, wherein the graph structure data is data formed on the basis of a graph structure, and the graph structure data comprises keywords in the data information to be identified and incidence relations among the keywords; performing first feature extraction on the text data to obtain text coding features corresponding to the text data; performing second feature extraction on the graph structure data to obtain graph coding features corresponding to the graph structure data; and fusing the text coding features and the image coding features to determine the identification result corresponding to the data information to be identified.
The above operations can be implemented in the foregoing embodiments, and are not described in detail herein.
Wherein the storage medium may include: read Only Memory (ROM), Random Access Memory (RAM), magnetic or optical disks, and the like.
Since the computer program stored in the storage medium can execute the steps in any text structuring processing method provided in the embodiments of the present application, beneficial effects that can be achieved by any text structuring processing method provided in the embodiments of the present application can be achieved, which are detailed in the foregoing embodiments and will not be described herein again.
The text structuring method, the text structuring device, the storage medium and the computer apparatus provided in the embodiments of the present application are described in detail above, and a specific example is applied in the text to explain the principle and the implementation of the present application, and the description of the embodiments above is only used to help understand the method and the core idea of the present application; meanwhile, for those skilled in the art, according to the idea of the present application, there may be variations in the specific embodiments and the application scope, and in summary, the content of the present specification should not be construed as a limitation to the present application.

Claims (13)

1. A text structuring processing method is characterized by comprising the following steps:
based on entities and entity types in the knowledge dictionary, performing entity extraction coding processing on text information to be structured to obtain entity coding features of each entity in the text information;
splicing the text character features corresponding to the text information with the entity coding features to obtain a feature set comprising the text character features and the entity coding features;
acquiring entity attention weight of each feature in the feature set relative to the text information;
according to the entity attention weight, coding the text information to obtain text coding characteristics corresponding to the text information;
and decoding the text coding features to obtain structural information in the text information, wherein the structural information comprises a target entity, a target entity type corresponding to the target entity and a relation type between the target entity types.
2. The method according to claim 1, wherein the step of obtaining the entity attention weight of each feature in the feature set with respect to the text information comprises:
determining the correlation among all the characteristics in the characteristic set, wherein all the characteristics comprise all the text character characteristics and all the entity coding characteristics;
determining the relevance as an entity attention weight of each feature in the feature set relative to the textual information.
3. The method according to claim 2, wherein the step of determining the correlation between the features in the feature set comprises:
determining a correlation between each text character feature and each text character feature in the feature set, determining a correlation between each text character feature and each entity coding feature, determining a correlation between each entity coding feature and each text character feature, and determining a correlation between each entity coding feature and each entity coding feature.
4. The text structuring process according to claim 3,
the step of determining the correlation between each text character feature and each entity encoding feature comprises:
performing dot product processing on any text character feature in the feature set and any entity coding feature in the feature set by using a text entity parameter matrix to obtain a dot product processing result between each text character feature and each entity coding feature;
carrying out normalization processing on the dot product processing result to obtain the correlation between each text character characteristic and each entity coding characteristic;
the step of determining the correlation between each entity encoding characteristic and each text character characteristic includes:
carrying out dot product processing on any entity coding feature in the feature set and any text character feature in the feature set by using an entity text parameter matrix to obtain a dot product processing result between each entity coding feature and each text coding feature;
and carrying out normalization processing on the dot product processing result to obtain the correlation between each text character characteristic and each entity coding characteristic.
5. The method according to claim 1, wherein the step of encoding the text information according to the entity attention weight to obtain the text encoding characteristic corresponding to the text information comprises:
for each feature in the feature set, performing dot product processing on the entity attention weight corresponding to the feature and each feature in the feature set;
and summing the features obtained by the dot product processing to obtain the text coding features corresponding to the text information.
6. The text structuring processing method according to claim 1, wherein the step of performing entity extraction coding processing on the text information to be structured based on the entities and the entity types in the knowledge dictionary to obtain the entity coding features of each entity in the text information comprises:
performing entity extraction on the text information to be structured based on entities and entity types in the knowledge dictionary to obtain each entity and corresponding entity type in the text information;
and coding each entity and the corresponding entity type to obtain the entity coding characteristics of each entity in the text information.
7. The text structuring processing method according to claim 6, wherein the step of encoding each entity and the corresponding entity type to obtain the entity encoding characteristic of each entity in the text information comprises:
carrying out feature coding processing on each entity to obtain entity text features corresponding to each entity;
coding each entity type to obtain type coding characteristics corresponding to each entity type;
and overlapping the entity text characteristics corresponding to each entity and the corresponding type coding characteristics to determine the entity coding characteristics of each entity in the text information.
8. The text structuring processing method according to claim 6, wherein the step of performing entity extraction on the text information to be structured based on the entities and the entity types in the knowledge dictionary to obtain each entity and the corresponding entity type in the text information comprises:
comparing the text information to be structured with entities in a knowledge dictionary to extract the entities in the text information;
and determining the entity type corresponding to the entity in the text information according to the corresponding relation between the entity and the entity type in the knowledge dictionary.
9. The method according to claim 1, wherein the step of decoding the text encoding features to obtain the structured information in the text information comprises:
performing mask processing on input features at the current moment in a decoder based on a mask attention mechanism to obtain mask features, wherein the input features at the current moment comprise the current features input at the current moment and input features input before the current moment;
normalizing and summing the mask features;
performing interactive processing on the summed features and the text coding features to obtain the output features of the decoder at the current moment;
and mapping the output features to a dictionary space to obtain target entities in the dictionary space corresponding to the output features and/or target entity types corresponding to the target entities and/or relationship types among the target entity types.
10. The text structuring processing method according to claim 1, further comprising:
based on entities and entity types in a knowledge dictionary, performing entity extraction coding processing on each training text information in a training text data set to be subjected to structured processing to obtain training entity coding features of each entity in the training text information;
splicing the training text character features corresponding to the training text information with the training entity coding features to obtain a training feature set comprising the training text character features and the training entity coding features;
acquiring the attention weight of each training feature in the training feature set relative to the training entity of the training text information;
coding the training text information according to the attention weight of the training entity to obtain a training text coding characteristic corresponding to the training text information;
decoding the coding features of the training text to obtain training structured information in the training text information, wherein the training structured information comprises a target entity, a target entity type corresponding to the target entity and a relation type between the target entity types;
a loss function is calculated from the training structured information, and training parameters are adjusted based on the loss function.
11. A text structuring processing apparatus, comprising:
the entity coding module is used for carrying out entity extraction coding processing on the text information to be structured based on the entities and the entity types in the knowledge dictionary to obtain the entity coding characteristics of each entity in the text information;
the feature splicing module is used for splicing the text character features corresponding to the text information with the entity coding features to obtain a feature set comprising the text character features and the entity coding features;
the weight acquisition module is used for acquiring entity attention weights of all the features in the feature set relative to the text information;
the text coding module is used for coding the text information according to the entity attention weight to obtain text coding characteristics corresponding to the text information;
and the decoding module is used for decoding the text coding features to obtain structural information in the text information, wherein the structural information comprises a target entity, a target entity type corresponding to the target entity and a relation type between the target entity types.
12. A computer-readable storage medium, characterized in that it stores a computer program adapted to be loaded by a processor for performing the steps of the text structuring method according to any one of claims 1-10.
13. A computer device, characterized in that the computer device comprises a memory and a processor, the memory stores a computer program, the processor executes the steps of the text structuring processing method according to any one of claims 1-10 by calling the computer program stored in the memory.
CN202111644937.9A 2021-12-30 2021-12-30 Text structuring processing method and device, storage medium and computer equipment Pending CN114266230A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202111644937.9A CN114266230A (en) 2021-12-30 2021-12-30 Text structuring processing method and device, storage medium and computer equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202111644937.9A CN114266230A (en) 2021-12-30 2021-12-30 Text structuring processing method and device, storage medium and computer equipment

Publications (1)

Publication Number Publication Date
CN114266230A true CN114266230A (en) 2022-04-01

Family

ID=80831455

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202111644937.9A Pending CN114266230A (en) 2021-12-30 2021-12-30 Text structuring processing method and device, storage medium and computer equipment

Country Status (1)

Country Link
CN (1) CN114266230A (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114663896A (en) * 2022-05-17 2022-06-24 深圳前海环融联易信息科技服务有限公司 Document information extraction method, device, equipment and medium based on image processing
CN114818609A (en) * 2022-06-29 2022-07-29 阿里巴巴达摩院(杭州)科技有限公司 Interaction method for virtual object, electronic device and computer storage medium

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111428443A (en) * 2020-04-15 2020-07-17 中国电子科技网络信息安全有限公司 Entity linking method based on entity context semantic interaction
CN112084331A (en) * 2020-08-27 2020-12-15 清华大学 Text processing method, text processing device, model training method, model training device, computer equipment and storage medium
WO2021000362A1 (en) * 2019-07-04 2021-01-07 浙江大学 Deep neural network model-based address information feature extraction method
CN112989796A (en) * 2021-03-10 2021-06-18 北京大学 Text named entity information identification method based on syntactic guidance

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2021000362A1 (en) * 2019-07-04 2021-01-07 浙江大学 Deep neural network model-based address information feature extraction method
CN111428443A (en) * 2020-04-15 2020-07-17 中国电子科技网络信息安全有限公司 Entity linking method based on entity context semantic interaction
CN112084331A (en) * 2020-08-27 2020-12-15 清华大学 Text processing method, text processing device, model training method, model training device, computer equipment and storage medium
CN112989796A (en) * 2021-03-10 2021-06-18 北京大学 Text named entity information identification method based on syntactic guidance

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
夏鹤珑;严丹丹;: "基于多头注意力机制的人物关系抽取方法", 成都工业学院学报, no. 01, 15 March 2020 (2020-03-15) *

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114663896A (en) * 2022-05-17 2022-06-24 深圳前海环融联易信息科技服务有限公司 Document information extraction method, device, equipment and medium based on image processing
CN114818609A (en) * 2022-06-29 2022-07-29 阿里巴巴达摩院(杭州)科技有限公司 Interaction method for virtual object, electronic device and computer storage medium
CN114818609B (en) * 2022-06-29 2022-09-23 阿里巴巴达摩院(杭州)科技有限公司 Interaction method for virtual object, electronic device and computer storage medium

Similar Documents

Publication Publication Date Title
CN112668671B (en) Method and device for acquiring pre-training model
CN112131366B (en) Method, device and storage medium for training text classification model and text classification
CN111755078B (en) Drug molecule attribute determination method, device and storage medium
CN110472002B (en) Text similarity obtaining method and device
CN113806552B (en) Information extraction method and device, electronic equipment and storage medium
CN114266230A (en) Text structuring processing method and device, storage medium and computer equipment
EP4006909A1 (en) Method, apparatus and device for quality control and storage medium
EP4057283A2 (en) Method for detecting voice, method for training, apparatuses and smart speaker
CN111159409A (en) Text classification method, device, equipment and medium based on artificial intelligence
CN115019237B (en) Multi-mode emotion analysis method and device, electronic equipment and storage medium
CN111767729A (en) Text classification method, device, equipment and storage medium
CN113407850A (en) Method and device for determining and acquiring virtual image and electronic equipment
CN113705315A (en) Video processing method, device, equipment and storage medium
CN116432012A (en) Method, electronic device and computer program product for training a model
CN116701574A (en) Text semantic similarity calculation method, device, equipment and storage medium
CN113468857B (en) Training method and device for style conversion model, electronic equipment and storage medium
CN113360683B (en) Method for training cross-modal retrieval model and cross-modal retrieval method and device
CN113239799A (en) Training method, recognition method, device, electronic equipment and readable storage medium
CN112989134A (en) Node relation graph processing method, device, equipment and storage medium
CN117290478A (en) Knowledge graph question-answering method, device, equipment and storage medium
CN112329429A (en) Text similarity learning method, device, equipment and storage medium
CN116775875A (en) Question corpus construction method and device, question answering method and device and storage medium
CN112559727B (en) Method, apparatus, device, storage medium, and program for outputting information
CN114282606A (en) Object identification method and device, computer readable storage medium and computer equipment
CN113239215A (en) Multimedia resource classification 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
CB02 Change of applicant information

Address after: 230088 floor 23-24, building A5, No. 666, Wangjiang West Road, high tech Zone, Hefei, Anhui Province

Applicant after: Anhui Xunfei Medical Co.,Ltd.

Address before: 230008 floor 23-24, building A5, No. 666, Wangjiang West Road, high tech Zone, Hefei, Anhui Province

Applicant before: ANHUI IFLYTEK MEDICAL INFORMATION TECHNOLOGY CO.,LTD.

CB02 Change of applicant information
CB02 Change of applicant information

Address after: 230088 floor 23-24, building A5, No. 666, Wangjiang West Road, high tech Zone, Hefei, Anhui Province

Applicant after: IFLYTEK Medical Technology Co.,Ltd.

Address before: 230088 floor 23-24, building A5, No. 666, Wangjiang West Road, high tech Zone, Hefei, Anhui Province

Applicant before: Anhui Xunfei Medical Co.,Ltd.

CB02 Change of applicant information