CN114861642A - Method, electronic device and computer-readable storage medium for identifying entities in text - Google Patents

Method, electronic device and computer-readable storage medium for identifying entities in text Download PDF

Info

Publication number
CN114861642A
CN114861642A CN202210283924.1A CN202210283924A CN114861642A CN 114861642 A CN114861642 A CN 114861642A CN 202210283924 A CN202210283924 A CN 202210283924A CN 114861642 A CN114861642 A CN 114861642A
Authority
CN
China
Prior art keywords
entity
text
pointer
recognized
entities
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
CN202210283924.1A
Other languages
Chinese (zh)
Inventor
易璟雯
刘伟棠
陈立力
龙毅
周明伟
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Zhejiang Dahua Technology Co Ltd
Original Assignee
Zhejiang Dahua 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 Zhejiang Dahua Technology Co Ltd filed Critical Zhejiang Dahua Technology Co Ltd
Priority to CN202210283924.1A priority Critical patent/CN114861642A/en
Publication of CN114861642A publication Critical patent/CN114861642A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F40/00Handling natural language data
    • G06F40/20Natural language analysis
    • G06F40/279Recognition of textual entities
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/24Querying
    • G06F16/242Query formulation
    • G06F16/2433Query languages
    • G06F16/244Grouping and aggregation
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F40/00Handling natural language data
    • G06F40/30Semantic analysis

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • Computational Linguistics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Audiology, Speech & Language Pathology (AREA)
  • General Health & Medical Sciences (AREA)
  • Health & Medical Sciences (AREA)
  • Artificial Intelligence (AREA)
  • Mathematical Physics (AREA)
  • Data Mining & Analysis (AREA)
  • Databases & Information Systems (AREA)
  • Machine Translation (AREA)

Abstract

The application discloses a method for identifying entities in texts, an electronic device and a computer readable storage medium, wherein the method comprises the following steps: obtaining a text to be recognized; the text to be recognized comprises entities of various entity types, and the text to be recognized corresponds to at least one entity aggregation type; converting the text to be recognized into a text vector to be recognized, and determining corresponding fields of entities in each entity aggregation type in the text to be recognized in the text vector to be recognized; wherein, at least partial entity corresponding fields are overlapped; and analyzing the fields corresponding to the entities in each entity aggregation type based on a regularization method, and determining the entity types corresponding to the entities in each entity aggregation type. According to the scheme, the accuracy rate of recognizing the entities in the text can be improved.

Description

Method for identifying entities in text, electronic device and computer-readable storage medium
Technical Field
The present application relates to the field of text recognition technologies, and in particular, to a method, an electronic device, and a computer-readable storage medium for recognizing entities in text.
Background
The entity is an important information carrier in the text, so that the identification of the entity in the text becomes an important task in the field of text identification, the identification of the entity in the text mainly needs to determine the field and the entity type corresponding to the entity, however, the field corresponding to the entity may have a nested condition, the definition of the entity type corresponding to the entity may have a large difference, the number of the subdivided part of the entity types is large, and the accuracy of the existing identification method for identifying the entity in the text in a complex scene is low. In view of the above, how to improve the accuracy of identifying entities in texts is an urgent problem to be solved.
Disclosure of Invention
The technical problem mainly solved by the application is to provide a method, an electronic device and a computer readable storage medium for identifying entities in a text, which can improve the accuracy of identifying the entities in the text.
In order to solve the above technical problem, a first aspect of the present application provides a method for identifying an entity in a text, where the method includes: obtaining a text to be recognized; the text to be recognized comprises entities of various entity types, and the text to be recognized corresponds to at least one entity aggregation type; converting the text to be recognized into a text vector to be recognized, and determining corresponding fields of the entities in each entity aggregation type in the text to be recognized in the text vector to be recognized; wherein, at least part of the fields corresponding to the entities are overlapped; analyzing fields corresponding to the entities in the entity aggregation types based on a regularization method, and determining entity types corresponding to the entities in the entity aggregation types.
In order to solve the above technical problem, a second aspect of the present application provides an electronic device, including: a memory and a processor coupled to each other, wherein the memory stores program data, and the processor calls the program data to execute the method of the first aspect.
To solve the above technical problem, a third aspect of the present application provides a computer storage medium having stored thereon program data, which when executed by a processor, implements the method of the first aspect.
In the scheme, the text to be recognized corresponds to at least one entity aggregation type, the entity aggregation type can reduce the number of subdivided entity types, thereby reducing the recognition difficulty, improving the recognition accuracy, converting the text to be recognized into the text vector to be recognized, thereby extracting deeper semantic information, determining corresponding fields of the entities in the entity aggregation type in the text to be recognized from the text vector, and at least partial fields of the entities are overlapped, thereby extracting the entities with nested fields, determining the fields of the entities in each entity aggregation type corresponding to the text to be recognized, in each entity aggregation type, fields corresponding to entities in each entity aggregation type are analyzed in more detail by using a regularization method, subdivided entity types corresponding to the entities are determined, and the accuracy of identifying the entities in the text 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. Wherein:
FIG. 1 is a flow chart illustrating an embodiment of a method for identifying entities in text according to the present application;
FIG. 2 is a flow chart illustrating another embodiment of a method for identifying entities in text according to the present application;
FIG. 3 is a schematic flow chart diagram illustrating an embodiment of obtaining a training text according to the present application;
FIG. 4 is a flowchart illustrating an embodiment of a model training process according to the present application;
FIG. 5 is a schematic structural diagram of an embodiment of an electronic device of the present application;
FIG. 6 is a schematic structural diagram of an embodiment of a computer-readable storage medium according to 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 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 terms "system" and "network" are often used interchangeably herein. The term "and/or" herein is merely an association describing an associated object, meaning that three relationships may exist, e.g., a and/or B, may mean: a exists alone, A and B exist simultaneously, and B exists alone. In addition, the character "/" herein generally indicates that the former and latter related objects are in an "or" relationship. Further, the term "plurality" herein means two or more than two.
Referring to fig. 1, fig. 1 is a schematic flowchart illustrating an embodiment of a method for identifying entities in a text according to the present application, the method including:
s101: the method comprises the steps of obtaining a text to be recognized, wherein the text to be recognized comprises entities of various entity types, and the text to be recognized corresponds to at least one entity aggregation type.
Specifically, the text to be recognized may be text information converted from voice data, text information composed of a plurality of characters, or text information extracted from a knowledge graph.
Further, the text to be recognized corresponds to at least one predefined entity aggregation type, and each entity aggregation type can be subdivided into a plurality of entity types.
In an application mode, input voice data is acquired, and the voice data is sequentially converted into text data according to characters to obtain a text to be recognized.
In an application scenario, a predefined entity aggregation type corresponding to a text to be recognized is related to the application scenario of the text to be recognized, for example, the entity aggregation type may be specifically defined as a color and a material, and then the color may be subdivided into a clothing color, an accessory color, a vehicle color, and the like, and the material may be subdivided into a clothing material, an accessory material, a vehicle structure material, and the like.
S102: converting the text to be recognized into a text vector to be recognized, and determining fields corresponding to the entities in each entity aggregation type in the text to be recognized in the text vector to be recognized, wherein at least part of the fields corresponding to the entities are overlapped.
Specifically, feature depth mining is carried out on a text to be recognized so that the text to be recognized is converted into a text vector to be recognized, the position of an entity in each entity aggregation type in the text vector to be recognized is sequentially extracted in the sequence of the entity aggregation types, and therefore a field corresponding to the entity in each entity aggregation type in the text to be recognized is determined, wherein when the entity corresponds to one character, the field corresponding to the entity in the text to be recognized is one character.
Further, fields corresponding to entities in each entity aggregation type are extracted respectively, the entities in each entity aggregation type are not affected when extracted, when characters corresponding to the entities in different entity aggregation types are partially overlapped, partial character overlapping exists between the fields corresponding to partial entities, so that different entity aggregation types are met, and entities with nested fields are also extracted.
In an application mode, a text to be recognized is input into a BERT model, the text to be recognized is converted into a text vector to be recognized, so that deeper semantic information is extracted, entities in each entity aggregation type are determined in the text vector by using a pointer network, so that the pointer network determines the position where the entities in the text vector to be recognized start through a head pointer and determines the position where the entities in the text vector to be recognized end through a tail pointer, and the pointer network determines fields corresponding to the entities from the text vector to be recognized respectively based on the entity aggregation types, and when nested entities, namely, entities with overlapped at least part of characters, exist in the text to be recognized, the pointer network can recognize the nested entities at the same time.
In an application scenario, a text to be recognized comprises a section of text data of 'women on a trolley', an entity aggregation type comprises a driving energy type and a vehicle type, a field corresponding to the driving energy type is extracted from the text to be recognized as 'electricity', a field corresponding to the vehicle type is 'trolley', and for the character 'electricity', the fields are extracted from different entity aggregation types, so that nested entities are recognized, and the accuracy of recognizing the entities in the text is improved.
S103: and analyzing the fields corresponding to the entities in each entity aggregation type based on a regularization method, and determining the entity types corresponding to the entities in each entity aggregation type.
Specifically, rules for entity type analysis are set based on a regularization method, entities in each entity aggregation type are analyzed according to a regularization analysis mode, and entity types corresponding to the entities in each entity aggregation type are determined.
In an application mode, a description mode of an entity is set based on a regularization method, wherein a specific description mode can be set according to an application scene, and when an entity aggregation type is a color, a description mode of a regularization analysis method can be set to (xx) (yes/yes)? (% s) (% color/color)? "and further obtain the color of a certain object, so as to obtain a more accurate detection result of the entity type according to a unified rule, wherein,% s represents a color word, such as red, yellow, blue, white, and the like, and xx is the object.
In the scheme, the text to be recognized corresponds to at least one entity aggregation type, the entity aggregation type can reduce the number of subdivided entity types, thereby reducing the recognition difficulty, improving the recognition accuracy, converting the text to be recognized into the text vector to be recognized, thereby extracting deeper semantic information, determining fields corresponding to the entities in the entity aggregation type in the text to be recognized from the text vector, and at least partial fields corresponding to the entities are overlapped, thereby extracting the entities with nested fields, determining the corresponding fields of the entities in each entity aggregation type in the text to be recognized, in each entity aggregation type, fields corresponding to entities in each entity aggregation type are analyzed in more detail by using a regularization method, subdivided entity types corresponding to the entities are determined, and the accuracy of identifying the entities in the text is improved.
Referring to fig. 2, fig. 2 is a schematic flowchart illustrating another embodiment of a method for identifying an entity in a text according to the present application, the method including:
s201: the method comprises the steps of obtaining a text to be recognized, wherein the text to be recognized comprises entities of various entity types, and the text to be recognized corresponds to at least one entity aggregation type.
Specifically, a text to be recognized is obtained, wherein an entity type corresponding to the text to be recognized and an entity aggregation type corresponding to the text to be recognized are matched with the entity type and the entity aggregation type which have been determined in the following training phase.
S202: and coding characters in the text to be recognized by using the language representation model to obtain a text vector to be recognized corresponding to the text to be recognized.
Specifically, the text to be recognized is input into the language representation model, so that the language representation model encodes characters in the text to be recognized, and the text to be recognized is converted into a corresponding text vector to be recognized.
In an application mode, the language characterization model is a BERT model, the BERT model adopts a Masked Language Model (MLM) to pre-train bidirectional transformations so as to generate deep bidirectional language characterization, and an additional output layer is added after the BERT model is pre-trained to perform fine tuning, so that the BERT model can be used for processing downstream tasks by a subsequent model.
And finding the corresponding text in an application scene, and outputting a vector with n x d dimensions by the BERT model, wherein n is the length of a sequence corresponding to the text to be recognized, and d is the vector dimension of the last layer of the BERT model.
S203: and determining whether each character corresponds to a head pointer and/or a tail pointer in the text vector to be recognized by utilizing the network layer in the pointer network model, wherein each network layer in the pointer network model corresponds to one entity aggregation type.
Specifically, the text vector to be recognized is input into the pointer network model, each network layer of the pointer network model corresponds to one entity aggregation type, and each network layer of the pointer network model determines whether each character corresponds to a head pointer and/or a tail pointer in the text vector to be recognized. The same character may correspond to a head pointer and a tail pointer, so that the character between the matched head pointer and tail pointer is a field corresponding to the entity.
Further, when the text recognition method comprises a plurality of entity aggregation types, the pointer network model comprises a corresponding number of network layers, each network layer is independent of each other and is used for judging whether each character corresponds to a head pointer and a tail pointer in a text vector to be recognized, wherein each network layer corresponds to the entity aggregation type when judging whether the character corresponds to the head pointer and the tail pointer, for the same text to be recognized, each network layer can extract a field corresponding to an entity under the corresponding entity aggregation type, and when the entity is nested in the corresponding text to be recognized, the fields corresponding to the entities extracted by different network layers are partially overlapped.
S204: and determining whether the head pointer and the tail pointer are matched by using a binary classification model, and taking the characters between the successfully matched head pointer and tail pointer as corresponding fields of the entities in the entity aggregation types corresponding to the network layers in the text to be recognized.
Specifically, the head pointer and the tail pointer are correspondingly input into a binary model in pairs, the binary model judges whether the head pointer and the tail pointer are matched, and characters between the successfully matched head pointer and tail pointer are used as fields corresponding to entities. The same entity type can appear in the text to be recognized for many times, so that a plurality of starting positions and ending positions exist, and whether the head pointer and the tail pointer are matched is judged through the binary model, so that the probability that the extraction of fields corresponding to the entities is inaccurate due to the fact that the same entity appears for many times in the text to be recognized is reduced.
In an application scene, the binary model judges the matching probability value of the head pointer and the tail pointer, when the matching probability value exceeds a probability threshold value, the head pointer and the tail pointer are judged to be matched, otherwise, the head pointer and the tail pointer are not matched. The above process is formulated as follows:
Figure BDA0003557376610000061
wherein the content of the first and second substances,
Figure BDA0003557376610000062
in order to match the probability values,
Figure BDA0003557376610000063
is a head pointer, and the head pointer is a pointer,
Figure BDA0003557376610000064
is a tail pointer, wherein the function expression of the Sigmoid function is as follows:
Figure BDA0003557376610000071
its domain is (- ∞, + ∞) and its range is (0, 1).
Further, the language representation model, the pointer network model and the two classification models are obtained after being trained in advance based on a training text, and the training text comprises at least one entity aggregation type.
Specifically, the training text is selected based on the application scenario, and an entity type and an entity aggregation type are defined based on the application scenario.
In an application manner, please refer to fig. 3, where fig. 3 is a schematic flowchart of an embodiment corresponding to the obtaining of the training text in the present application, and the process of obtaining the training text specifically includes:
s301: the method comprises the steps of obtaining an initial text, and marking an entity label corresponding to an entity in the initial text, wherein the entity label comprises an entity type of the entity and a start position and a stop position of the entity in the initial text.
Specifically, an initial text is obtained, and the initial text is preprocessed, so that an entity tag corresponding to an entity is marked in the initial text, where the entity tag includes an entity type of the entity and a start position and a stop position of a field corresponding to the entity in the initial text. The entity labels are used for training the corresponding models, and basis is provided for model optimization and training.
In an application mode, an initial text is obtained, the initial text is decomposed into corresponding sentences, the start bits and the end bits of entities are marked in the sentences, entity types are marked for the entities in the sentences, and the end bits of the entity types mark corresponding entity aggregation types.
Specifically, the initial text is preprocessed, so that each sentence in the initial text is processed into a dictionary-type sample, wherein the key values of the dictionary type are the sentence text and the marked entity labels, the entity labels correspond to the entity types of the entities and the start bits and the end bits of the entities in the sentences, and the end bits of the entity types are matched with the entity aggregation type.
In an application scenario, the entity tag is represented by (start, end, type). Wherein, start represents the start position of the entity in the text to be recognized, end represents the end position of the entity in the text to be recognized, and type represents the entity type. When the entity aggregation type is a color, the subdivided entity types corresponding to the entity aggregation type use the color as a last position identifier, for example, hair color, coatColor and bag color respectively correspond to hair color, coat color and bag color, wherein the hair color, the coat color and the bag color are the entity types, the color is the entity aggregation type, and the last position identifier of the entity types is used to judge which entity types belong to the same entity aggregation type.
S302: and classifying at least part of entity types into the same entity aggregation type to generate a training text.
Specifically, based on the last identifiers of the entity types, the entity types with the quantity exceeding the quantity threshold are classified into the same entity aggregation type, the entity types with the quantity not exceeding the quantity threshold are directly used as one entity aggregation type, and the training texts marked with at least one entity aggregation type are obtained, so that when the entity types with the same last identifiers are numerous and the granularity of entity aggregation type subdivision is fine, the condition of entity type distribution imbalance caused by the numerous entity types with the same last identifiers is reduced, and the probability that the entity features are difficult to learn by a model due to the fact that the quantity corresponding to part of the entity types is very small is reduced.
In an application, in response to the number of last identifiers exceeding a number threshold, the entity types corresponding to the same last identifier are classified as the same entity aggregation type.
Specifically, if the number of last identifiers exceeds the number threshold, it indicates that there are more subdivided entity types in the entity aggregation types corresponding to the last identifiers, and when the model is trained and optimized by using the training text, when there are many part of the entity types, the model is mainly focused on the types with many numbers after training, and the recognition capability of the entity type model with less number is limited, so that the recognition accuracy of the trained model on the part of the entity types is low.
Further, when the number of the last marks exceeds the number threshold, the entity types corresponding to the same last mark are classified into the same entity aggregation type, so that the number of types in the training text is reduced, the number relation between a large number of partial entity types and a small number of partial entity types is balanced, and the recognition effect of the model on each entity aggregation type is improved.
In an application manner, please refer to fig. 4, where fig. 4 is a flowchart illustrating an embodiment of a training process of a language representation model, a pointer network model, and a binary model according to the present application, the training process includes:
s401: and inputting the training text into the language representation model so that the language representation model encodes characters in the training text to obtain a training text vector corresponding to the training text.
Specifically, the training text is input into the language representation model, so that the language representation model encodes characters in the training text, and generates a training text vector corresponding to the training text, wherein an output layer of the language representation model is matched with the pointer network model, and the training text vector output by the language representation model can be applied to the pointer network model.
S402: and inputting the training text vector into the pointer network model, so that each network layer in the pointer network model predicts whether each character corresponds to a head pointer and/or a tail pointer in the training text vector based on the entity label.
Specifically, a training text vector is input into a pointer network model, each network layer in the pointer network model is respectively matched with an entity aggregation type, and each network layer predicts whether each character corresponds to a head pointer, a tail pointer and a head pointer and a tail pointer in the training text vector based on an entity label.
Further, the pointer network is converted into two Sigmoid classification problems when judging, the first classification is used for judging whether each token is a head pointer, and the second classification is used for judging whether each token is a tail pointer.
In an application scene, predicting an entity of an entity aggregation type corresponding to a network layer based on an entity type in an entity label; and predicting whether the character corresponds to a head pointer or not based on the start bit of the entity in the initial text, and predicting whether the character corresponds to a tail pointer or not based on the end bit of the entity in the initial text.
Specifically, the network layers in the pointer network model correspond to the entity aggregation type, each network layer is configured to predict an entity belonging to the same entity aggregation type, predict whether a character corresponds to a head pointer by a start bit in the entity label, and predict whether a character corresponds to a tail pointer by a stop bit in the entity label, where the above process is expressed by a formula as follows:
P start =softmax each row (E·T start )∈R n×2 (3)
P end =softmax each row (E·T end )∈R n×2 (4)
wherein, P start To representWhether or not it is the probability distribution of the head pointer, P end Indicating the probability distribution of whether it is a tail pointer or not.
Further, when the entity appears in the text to be processed for multiple times, the network layer confirms all the entities appearing for multiple times through the head pointer and the tail pointer, and when the pointer network model is trained by using the training text, the network layer of the pointer network model corresponds the start bit of each entity to the head pointer and the end bit of each entity to the tail pointer when predicting the entity, so that the capability of each network layer in identifying and positioning the entity is improved, and each network layer corresponds to one entity aggregation type and is responsible for determining the position of the entity in one entity aggregation type.
S403: and inputting the head pointer and the tail pointer into a two-classification model so that the two-classification model predicts whether the head pointer and the tail pointer are matched or not based on the entity label, and taking the characters between the successfully matched head pointer and the successfully matched tail pointer as a field prediction result corresponding to the entity in the entity aggregation type corresponding to each network layer in the training text.
Specifically, a head pointer and a tail pointer are input into a binary classification model in pairs, the binary classification model judges whether the input head pointer and the input tail pointer are matched based on an entity label, only characters between the successfully matched head pointer and the successfully matched tail pointer are used as field prediction results corresponding to entities in entity aggregation types corresponding to network layers in a training text, and the head pointer and the tail pointer in each network layer are judged by the binary classification model, so that the field prediction results corresponding to each network layer are output.
In an application mode, matching the head pointer and the tail pointer pairwise and inputting the two pointers into a two-classification model, so that the two-classification model determines the probability value of the matching of the head pointer and the tail pointer based on the start bit and the end bit of the entity in the initial text; and determining whether the head pointer and the tail pointer are matched or not based on the probability threshold corresponding to the probability value and the probability value.
Specifically, the binary classification model is based on the start bit and the end bit of the entity in the initial text, so that the actual field of the entity between the start bit and the end bit is determined, the corresponding field between the input head pointer and the input tail pointer is compared with the actual field corresponding to the entity, so that the probability value of the matching of the head pointer and the tail pointer is output, when the probability value is larger than the corresponding probability threshold value, the matching of the head pointer and the tail pointer is determined, when the probability value is smaller than or equal to the probability threshold value, the mismatching of the head pointer and the tail pointer is determined, so that the position of the entity can be accurately judged by the trained binary classification model, and the identification accuracy when the entity appears in the sentence for many times is improved.
S404: the language characterization model, the pointer network model, and the binary classification model are adjusted based on the entity labels and the field predictions.
Specifically, the difference between the entity label and the field prediction result is compared in each training process, the training loss is determined, and parameters in the language representation model, the pointer network model and the two classification models are adjusted based on the training loss.
S405: and responding to the condition of meeting the convergence, and obtaining the trained language representation model, the pointer network model and the binary classification model.
Specifically, after the training loss and/or the training times meet the convergence condition, parameters in the language representation model, the pointer network model and the two classification models are fixed, and the trained language representation model, the pointer network model and the two classification models are obtained.
S205: and analyzing the fields corresponding to the entities in each entity aggregation type based on a regularization method, and determining the entity types corresponding to the entities in each entity aggregation type.
Specifically, rules for entity type analysis are set based on a regularization method, entities in each entity aggregation type are analyzed in a regularization analysis mode, and entity types corresponding to the entities in each entity aggregation type are determined.
In an application mode, the entity aggregation type corresponds to a plurality of interested entities, each interested entity corresponds to a description mode of the regularized analytic method, when the entity aggregation type is color, the entity types include hair color, coat color and driving vehicle color, and the description mode of the regularized analytic method corresponding to the hair color can be set to (% s)? ? (hair/hair), similarly, the coat color and the color of the driving vehicle can also be set, so that the fields corresponding to the entities in each entity aggregation type are analyzed in more detail, and the accuracy of identifying the entities in the text is improved.
In this embodiment, the entity in the text is identified through a language representation model, a pointer network model and a binary model, the language representation model, the pointer network model and the binary model are obtained after training the training text, the entity in the training text corresponds to an entity tag, the entity tag corresponds to the entity type of the entity and the start bit and the end bit of the entity in the initial text, the entity type corresponding to the same end bit identifier and the number of which exceeds a number threshold is classified as the same entity aggregation type, so as to balance the number relationship between a large number of partial entity types and a small number of partial entity types, improve the identification effect of the model on each entity aggregation type, each network layer in the pointer network model corresponds to one entity aggregation type, the network layer determines the position of the entity through a head pointer and a tail pointer, and determines a matched head pointer and tail pointer through the binary model, and even if different entity aggregation types comprise entities with nested characters, each network layer can determine the fields corresponding to the entities through the head pointer and the tail pointer, and determine the entity types corresponding to the entities in each entity aggregation type through a regularized analytic method, so that the accuracy of identifying the entities in the text is improved.
Referring to fig. 5, fig. 5 is a schematic structural diagram of an embodiment of an electronic device 50 of the present application, where the electronic device 50 includes a memory 501 and a processor 502 coupled to each other, where the memory 501 stores program data (not shown), and the processor 502 calls the program data to implement the method for identifying entities in text in any of the above embodiments, and the description of relevant contents refers to the detailed description of the above method embodiments, which is not repeated herein.
Referring to fig. 6, fig. 6 is a schematic structural diagram of an embodiment of a computer-readable storage medium 60 of the present application, the computer-readable storage medium 60 stores program data 600, and the program data 600 is executed by a processor to implement the method for identifying an entity in text in any of the above embodiments, and for a description of related contents, reference is made to the detailed description of the above method embodiment, which is not repeated herein.
It should be noted that, units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on multiple network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the embodiment.
In addition, functional units in the embodiments of the present application may be integrated into one processing unit, or each unit may exist alone physically, or two or more units are integrated into one unit. The integrated unit can be realized in a form of hardware, and can also be realized in a form of a software functional unit.
The integrated unit, if implemented in the form of a software functional unit and sold or used as a stand-alone product, may be stored in a computer readable storage medium. Based on such understanding, the technical solution of the present application may be substantially implemented or contributed to by the prior art, or all or part of the technical solution may be embodied in a software product, which is stored in a storage medium and includes instructions for causing a computer device (which may be a personal computer, a server, a network device, or the like) or a processor (processor) to execute all or part of the steps of the method according to the embodiments of the present application. And the aforementioned storage medium includes: a U-disk, a removable hard disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk or an optical disk, and other various media capable of storing program codes.
The above description is only for the purpose of illustrating embodiments of the present application and is not intended to limit the scope of the present application, and all modifications of equivalent structures and equivalent processes, which are made by the contents of the specification and the drawings of the present application or are directly or indirectly applied to other related technical fields, are also included in the scope of the present application.

Claims (10)

1. A method for identifying entities in text, the method comprising:
obtaining a text to be recognized; the text to be recognized comprises entities of various entity types, and the text to be recognized corresponds to at least one entity aggregation type;
converting the text to be recognized into a text vector to be recognized, and determining corresponding fields of the entities in each entity aggregation type in the text to be recognized in the text vector to be recognized; wherein, at least part of the fields corresponding to the entities are overlapped;
analyzing fields corresponding to the entities in the entity aggregation types based on a regularization method, and determining entity types corresponding to the entities in the entity aggregation types.
2. The method of claim 1, wherein the step of converting the text to be recognized into a text vector to be recognized, and determining a corresponding field in the text to be recognized of each entity in the entity aggregation type in the text vector to be recognized comprises:
coding characters in the text to be recognized by using a language representation model to obtain a text vector to be recognized corresponding to the text to be recognized;
determining whether each character corresponds to a head pointer and/or a tail pointer in the text vector to be recognized by utilizing a network layer in a pointer network model; wherein each of the network layers in the pointer network model corresponds to one of the entity aggregation types;
determining whether the head pointer and the tail pointer are matched by using a binary classification model, and taking the characters between the head pointer and the tail pointer which are successfully matched as fields corresponding to the entities in the entity aggregation type corresponding to each network layer in the text to be recognized;
the language representation model, the pointer network model and the two classification models are obtained after being trained in advance based on a training text, and the training text comprises at least one entity aggregation type.
3. The method for recognizing entities in text according to claim 2, wherein the obtaining process of the training text comprises:
obtaining an initial text, and marking an entity label corresponding to an entity in the initial text; wherein the entity tag comprises an entity type of the entity and a start position and a stop position of the entity in the initial text;
and classifying at least part of the entity types into the same entity aggregation type to generate a training text.
4. The method for recognizing entities in text according to claim 3, wherein the training process of the language characterization model, the pointer network model and the two-class model comprises:
inputting the training text into the language representation model so that the language representation model encodes characters in the training text to obtain a training text vector corresponding to the training text;
inputting the training text vector into the pointer network model, so that each network layer in the pointer network model predicts whether each character corresponds to a head pointer and/or a tail pointer in the training text vector based on the entity label;
inputting the head pointer and the tail pointer into the two classification models, so that the two classification models predict whether the head pointer and the tail pointer are matched based on the entity labels, and using characters between the head pointer and the tail pointer which are successfully matched as field prediction results corresponding to entities in the entity aggregation type corresponding to each network layer in the training text;
adjusting the language characterization model, the pointer network model, and the two classification models based on the entity labels and the field prediction results;
and responding to the condition of meeting convergence, and obtaining the trained language representation model, the pointer network model and the two classification models.
5. The method of claim 4, wherein the step of predicting whether each of the characters corresponds to a head pointer and/or a tail pointer in the training text vector based on the entity labels comprises:
predicting an entity of an entity aggregation type corresponding to the network layer based on the entity type in the entity label;
and predicting whether the character corresponds to the head pointer or not based on the start bit of the entity in the initial text, and predicting whether the character corresponds to the tail pointer or not based on the end bit of the entity in the initial text.
6. The method of claim 4, wherein the step of inputting the head pointer and the tail pointer into the binary model to make the binary model predict whether the head pointer and the tail pointer match based on the entity label comprises:
matching the head pointer and the tail pointer pairwise and inputting the head pointer and the tail pointer into the binary model, so that the binary model determines a probability value of matching the head pointer and the tail pointer based on a start bit and a stop bit of the entity in the initial text;
and determining whether the head pointer and the tail pointer are matched or not based on the probability threshold corresponding to the probability value and the probability value.
7. The method of claim 3, wherein the step of obtaining the initial text and labeling the entity label corresponding to the entity in the initial text comprises:
obtaining the initial text, decomposing the initial text into corresponding sentences and marking the start position and the end position of the entity in the sentences;
marking entity types for the entities in the sentences; and the last bit identifier of the entity type corresponds to the entity aggregation type.
8. The method of claim 7, wherein the step of classifying at least part of the entity types as the same entity aggregation type comprises:
and in response to the number of the last identifiers exceeding a number threshold, attributing the entity types corresponding to the same last identifiers to the same entity aggregation type.
9. An electronic device, comprising: a memory and a processor coupled to each other, wherein the memory stores program data that the processor calls to perform the method of any of claims 1-8.
10. A computer-readable storage medium, on which program data are stored, which program data, when being executed by a processor, carry out the method of any one of claims 1-8.
CN202210283924.1A 2022-03-21 2022-03-21 Method, electronic device and computer-readable storage medium for identifying entities in text Pending CN114861642A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210283924.1A CN114861642A (en) 2022-03-21 2022-03-21 Method, electronic device and computer-readable storage medium for identifying entities in text

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210283924.1A CN114861642A (en) 2022-03-21 2022-03-21 Method, electronic device and computer-readable storage medium for identifying entities in text

Publications (1)

Publication Number Publication Date
CN114861642A true CN114861642A (en) 2022-08-05

Family

ID=82627423

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210283924.1A Pending CN114861642A (en) 2022-03-21 2022-03-21 Method, electronic device and computer-readable storage medium for identifying entities in text

Country Status (1)

Country Link
CN (1) CN114861642A (en)

Similar Documents

Publication Publication Date Title
CN114610515B (en) Multi-feature log anomaly detection method and system based on log full semantics
CN108376151B (en) Question classification method and device, computer equipment and storage medium
CN110727779A (en) Question-answering method and system based on multi-model fusion
CN111444723B (en) Information extraction method, computer device, and storage medium
CN111191275A (en) Sensitive data identification method, system and device
CN111198948A (en) Text classification correction method, device and equipment and computer readable storage medium
EP2671190B1 (en) System for data extraction and processing
CN112036168B (en) Event main body recognition model optimization method, device, equipment and readable storage medium
CN108205524B (en) Text data processing method and device
CN110750978A (en) Emotional tendency analysis method and device, electronic equipment and storage medium
CN111091004A (en) Training method and training device for sentence entity labeling model and electronic equipment
CN112800184A (en) Short text comment emotion analysis method based on Target-Aspect-Opinion joint extraction
CN115357699A (en) Text extraction method, device, equipment and storage medium
CN111368066B (en) Method, apparatus and computer readable storage medium for obtaining dialogue abstract
CN110795942A (en) Keyword determination method and device based on semantic recognition and storage medium
CN112036169B (en) Event recognition model optimization method, device, equipment and readable storage medium
CN107783958B (en) Target statement identification method and device
CN116991875A (en) SQL sentence generation and alias mapping method and device based on big model
CN111898386A (en) Semantic parsing method, device, equipment and storage medium based on natural language
CN111723182A (en) Key information extraction method and device for vulnerability text
CN115796141A (en) Text data enhancement method and device, electronic equipment and storage medium
US20230084845A1 (en) Entry detection and recognition for custom forms
CN115563278A (en) Question classification processing method and device for sentence text
CN115130475A (en) Extensible universal end-to-end named entity identification method
CN114861642A (en) Method, electronic device and computer-readable storage medium for identifying entities in text

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