Method and apparatus for entity classification

文档序号:1378989 发布日期:2020-08-14 浏览:6次 中文

阅读说明:本技术 用于实体分类的方法和装置 (Method and apparatus for entity classification ) 是由 程健一 赵岷 秦华鹏 于 2020-04-15 设计创作,主要内容包括:本申请公开了用于实体分类的方法,涉及知识图谱领域。具体实现方案为:获取待分类实体;将待分类实体划分成词片段,并对词片段进行概念标注,其中,词片段为预设粒度的语义单元,词片段的粒度大于词粒度;将已标注词片段概念的待分类实体输入预先训练的实体分类模型,得到待分类实体的实体分类结果,其中,实体分类模型用于表征已标注词片段概念的实体与实体分类之间的对应关系。该实现方通过引入实体的词片段概念标注,能够解决实体不存在上下文的情况下支持实体分类的特征不足、分类效果依赖上下文语料的问题,提高了实体分类的准确性。(The application discloses a method for entity classification, and relates to the field of knowledge graphs. The specific implementation scheme is as follows: acquiring an entity to be classified; dividing an entity to be classified into word segments, and carrying out concept labeling on the word segments, wherein the word segments are semantic units with preset granularity, and the granularity of the word segments is larger than the granularity of the words; and inputting the entity to be classified with the marked word segment concept into a pre-trained entity classification model to obtain an entity classification result of the entity to be classified, wherein the entity classification model is used for representing the corresponding relation between the entity with the marked word segment concept and the entity classification. By introducing the word segment concept marking of the entity, the method can solve the problems that the characteristics supporting entity classification are insufficient and the classification effect depends on context corpora under the condition that the entity does not have the context, and improves the accuracy of entity classification.)

1. A method for entity classification, comprising:

acquiring an entity to be classified;

dividing the entity to be classified into word segments, and carrying out concept labeling on the word segments, wherein the word segments are semantic units with preset granularity, and the granularity of the word segments is larger than the granularity of the words;

and inputting the entity to be classified with the marked word segment concept into a pre-trained entity classification model to obtain an entity classification result of the entity to be classified, wherein the entity classification model is used for representing the corresponding relation between the entity with the marked word segment concept and the entity classification.

2. The method of claim 1, wherein the dividing the entity to be classified into word segments and conceptually labeling the word segments comprises:

and inputting the entity to be classified into a pre-trained word segment labeling model to obtain a word segment concept label of the entity to be classified, wherein the word segment labeling model is used for carrying out concept labeling on word segments in the entity.

3. The method of claim 2, wherein the word segment tagging model is trained by:

acquiring a first training sample set, wherein the first training sample comprises unlabeled entities and entities with labeled word segment concepts;

and taking an entity which is not labeled in the first training sample as input, taking an entity which is labeled with the word segment concept in the first training sample as output, and training a pre-constructed first initial model to obtain the word segment labeling model.

4. The method of claim 3, wherein the first training sample is obtained by:

obtaining an entity sample;

performing basic granularity segmentation on the entity sample to obtain basic elements of the entity sample, and performing concept labeling on each basic element;

combining or splitting basic elements after the concept is labeled according to preset granularity to generate an entity sample of the labeled word segment concept;

and determining the entity samples which are not labeled with the entity samples and are labeled with the word segment concepts as the first training sample.

5. The method of claim 1, wherein the entity classification model is trained by:

acquiring a second training sample set, wherein the second sample set comprises entities which are labeled with word segment concepts and are not provided with classification labels and entities which are provided with classification labels;

and taking the entity which is labeled with the word segment concept and is not provided with the classification label in the second training sample as input, taking the entity which is provided with the classification label in the second training sample as output, and training a pre-constructed second initial model to obtain the entity classification model.

6. The method of claim 1, wherein the entity classification model is further used for concept labeling of word fragments in an entity;

the dividing the entity to be classified into word segments and carrying out concept labeling on the word segments comprises the following steps:

and inputting the entity to be classified into the entity classification model to obtain the word segment concept label of the entity to be classified.

7. The method of claim 6, wherein the entity classification model is further trained by:

acquiring a third training sample set, wherein the third training sample set comprises entities which are not labeled entities and labeled word segment concepts and are provided with classification labels;

and taking the entity which is not labeled in the third training sample as input, taking the entity which is labeled with the word segment concept and is provided with the classification label in the third training sample as output, and training the third initial model to obtain the entity classification model.

8. An apparatus for entity classification, comprising:

an acquisition unit configured to acquire an entity to be classified;

the labeling unit is configured to divide the entity to be classified into word segments and perform concept labeling on the word segments, wherein the word segments are semantic units with preset granularity, and the granularity of the word segments is larger than the granularity of words;

the input unit is configured to input the entity to be classified with the word segment concept labeled into a pre-trained entity classification model to obtain an entity classification result of the entity to be classified, wherein the entity classification model is used for representing the corresponding relation between the entity with the word segment concept labeled and the entity classification.

9. The apparatus of claim 8, wherein the labeling unit is further configured to:

and inputting the entity to be classified into a pre-trained word segment labeling model to obtain a word segment concept label of the entity to be classified, wherein the word segment labeling model is used for carrying out concept labeling on word segments in the entity.

10. The apparatus of claim 9, wherein the word segment labeling model is trained by:

acquiring a first training sample set, wherein the first training sample comprises unlabeled entities and entities with labeled word segment concepts;

and taking an entity which is not labeled in the first training sample as input, taking an entity which is labeled with the word segment concept in the first training sample as output, and training a pre-constructed first initial model to obtain the word segment labeling model.

11. The apparatus of claim 10, wherein the first training sample is obtained by:

obtaining an entity sample;

performing basic granularity segmentation on the entity sample to obtain basic elements of the entity sample, and performing concept labeling on each basic element;

combining or splitting basic elements after the concept is labeled according to preset granularity to generate an entity sample of the labeled word segment concept;

and determining the entity samples which are not labeled with the entity samples and are labeled with the word segment concepts as the first training sample.

12. The apparatus of claim 8, wherein the entity classification model is trained by:

acquiring a second training sample set, wherein the second sample set comprises entities which are labeled with word segment concepts and are not provided with classification labels and entities which are provided with classification labels;

and taking the entity which is labeled with the word segment concept and is not provided with the classification label in the second training sample as input, taking the entity which is provided with the classification label in the second training sample as output, and training a pre-constructed second initial model to obtain the entity classification model.

13. The apparatus of claim 8, wherein the entity classification model is further configured to conceptually label word segments in entities;

the labeling unit is further configured to:

and inputting the entity to be classified into the entity classification model to obtain the word segment concept label of the entity to be classified.

14. The apparatus of claim 13, wherein the entity classification model is further trained by:

acquiring a third training sample set, wherein the third training sample set comprises entities which are not labeled entities and labeled word segment concepts and are provided with classification labels;

and taking the entity which is not labeled in the third training sample as input, taking the entity which is labeled with the word segment concept and is provided with the classification label in the third training sample as output, and training the third initial model to obtain the entity classification model.

15. An electronic device, comprising:

at least one processor; and

a memory communicatively coupled to the at least one processor; wherein the content of the first and second substances,

the memory stores instructions executable by the at least one processor to enable the at least one processor to perform the method of any one of claims 1-7.

16. A non-transitory computer readable storage medium having stored thereon computer instructions for causing the computer to perform the method of any one of claims 1-7.

Technical Field

The embodiment of the disclosure relates to the technical field of computers, in particular to the technical field of knowledge graphs.

Background

Entity Classification (Entity Classification) technology generally refers to a technology of classifying entities in text form into specified categories according to a series of features.

Disclosure of Invention

A method, apparatus, device, and storage medium for entity classification are provided.

According to a first aspect, there is provided a method for entity classification, the method comprising: acquiring an entity to be classified; dividing an entity to be classified into word segments, and carrying out concept labeling on the word segments, wherein the word segments are semantic units with preset granularity, and the granularity of the word segments is larger than the granularity of the words; and inputting the entity to be classified with the marked word segment concept into a pre-trained entity classification model to obtain an entity classification result of the entity to be classified, wherein the entity classification model is used for representing the corresponding relation between the entity with the marked word segment concept and the entity classification.

According to a second aspect, there is provided an apparatus for entity classification, the apparatus comprising: an acquisition unit configured to acquire an entity to be classified; the labeling unit is configured to divide the entity to be classified into word segments and label the concept of the word segments, wherein the word segments are semantic units with preset granularity, and the granularity of the word segments is larger than the granularity of the words; the input unit is configured to input the entity to be classified with the word segment concept labeled into a pre-trained entity classification model to obtain an entity classification result of the entity to be classified, wherein the entity classification model is used for representing the corresponding relation between the entity with the word segment concept labeled and the entity classification.

In a third aspect, an electronic device is provided, which includes: at least one processor; and a memory communicatively coupled to the at least one processor; wherein the memory stores instructions executable by the at least one processor to enable the at least one processor to perform the above method.

In a fourth aspect, a non-transitory computer readable storage medium having stored thereon computer instructions for causing a computer to perform the above method is provided.

According to the technology of the application, the problem that the current entity classification depends on the context corpora is solved, and the accuracy of entity classification without the context corpora is improved.

It should be understood that the statements in this section do not necessarily identify key or critical features of the embodiments of the present disclosure, nor do they limit the scope of the present disclosure. Other features of the present disclosure will become apparent from the following description.

Drawings

The drawings are included to provide a better understanding of the present solution and are not intended to limit the present application. Wherein:

FIG. 1 is a schematic diagram of a first embodiment of a method for entity classification according to the present application;

FIG. 2 is a schematic diagram of a second embodiment of a method for entity classification according to the present application;

FIG. 3 is a schematic diagram of an embodiment of an apparatus for entity classification according to the present application;

FIG. 4 is a block diagram of an electronic device for implementing a method for entity classification of an embodiment of the present application.

Detailed Description

The following description of the exemplary embodiments of the present application, taken in conjunction with the accompanying drawings, includes various details of the embodiments of the application for the understanding of the same, which are to be considered exemplary only. Accordingly, those of ordinary skill in the art will recognize that various changes and modifications of the embodiments described herein can be made without departing from the scope and spirit of the present application. Also, descriptions of well-known functions and constructions are omitted in the following description for clarity and conciseness.

It should be noted that, in the present disclosure, the embodiments and features of the embodiments may be combined with each other without conflict. The present disclosure will be described in detail below with reference to the accompanying drawings in conjunction with embodiments.

Referring to fig. 1, a schematic diagram of a first embodiment of a method for entity classification according to the present application is shown. The method for entity classification may comprise the steps of:

step 101, an entity to be classified is obtained.

In this embodiment, the execution subject of the method for entity classification may be the apparatus for entity classification, and the apparatus for entity classification may be an electronic entity (e.g., a server), or may also be an application adopting software integration. In use, entities to be classified may be input into the apparatus for entity classification. The apparatus for entity classification may adopt the method for entity classification of this embodiment to classify the entities to be classified.

In this embodiment, the executing entity (e.g., the server) may obtain the entity to be classified from another electronic device through a wired connection manner or a wireless connection manner. Of course, it is understood that the entity to be classified may also be stored locally in the execution main body, and in this case, the execution main body may directly obtain the entity to be classified from the local. It should be noted that the entity to be classified may be an entity without context corpus. For example, the entity to be classified is "great lead university of Harbin industry", and no context exists in the entity to be classified. It can be understood that the above-mentioned entities to be classified have fewer features for supporting entity classification than the entities having the context corpus, and therefore, the conventional method of entity classification depending on the context corpus of the entities cannot accurately classify the entities.

In general, the present application may be applied to the field of knowledge-graphs for categorizing entities indicated by nodes in the knowledge-graph. Or, the scheme can also be applied to the technical field of search, the entity to be classified can be a query text directly input by a user when the user searches in a search engine, a question-answering system, an advertisement system and the like, or the entity to be classified can also be an entity extracted from the query text input by the user when the user searches in the search engine, the question-answering system, the advertisement system and the like. It can be seen that the entity to be classified may be an entity obtained by various methods, and there is no unique limitation here.

And 102, dividing the entity to be classified into word segments, and carrying out concept labeling on the word segments.

In this embodiment, based on the entity to be classified obtained in step 101, the executing entity may perform concept labeling on the word segments in the entity to be classified in various ways. Specifically, the executing body may perform word segmentation on the entity to be classified to obtain a word segment of the entity to be classified, and then perform concept tagging on the obtained word segment. Here, the word segment may be a semantic unit with a preset granularity, and the granularity of the word segment is greater than the word granularity, and the word segment may be a generalization of words. A concept may refer to a base unit that extracts common features from a class of entities. For example, the entity to be classified is "great lead of the university of Harbin industry", and the word segments obtained by word segmentation may include "great lead of the university of Harbin industry" and "great lead", wherein the concept of the university of Harbin industry "is" organization ", and the concept of the" great lead "is" person ", and thus, the obtained concept is labeled as" great lead of the university of Harbin industry [ organization ] great lead [ person ] ".

As an example, under the guidance of the concept system, the entity to be classified may be divided into word segments by using a word segmentation tool or a manual word segmentation method, and then the concept labels of the word segments are determined by using the concept library as prior knowledge. The concept system can be a tree structure identification of real knowledge, which describes the upper and lower relations of word segments. For example, the "master council", "actor" is "character" and the "Harbin university of industry" is "organization". The concept library may be a library storing a concept hierarchy. Therefore, the word segmentation can be carried out on the entity to be classified according to the guidance of the concept system to obtain the word segment, and the concept of the word segmentation can be determined and labeled from the concept library.

In some optional implementations of this embodiment, the term segments in the entity to be classified may be conceptually labeled as follows: carrying out basic granularity (such as word granularity) segmentation on an entity to be classified to obtain basic elements (such as words) of the entity to be classified, and carrying out concept labeling on each basic element; and combining or splitting the basic elements after the concept labeling according to the preset granularity, so that the concept labeling can be carried out on the word fragments of the entity to be classified. As an example, for an entity to be classified, "great soldier tutor of the university of the hall industry", segmentation may be performed according to word granularity to obtain word elements as basic elements, then, concept labeling is performed on each word to obtain "haar [ organizational structure ] er [ organizational structure ]. major [ person ]. tutor [ person ]", and the same concept labels in the obtained results are combined to obtain a concept labeling result "great soldier tutor [ person ]" of the university of the hall industry [ organizational structure ] of the word segment.

Step 103, inputting the entity to be classified with the word segment concept into a pre-trained entity classification model to obtain an entity classification result of the entity to be classified.

In this embodiment, based on the entity to be classified of the labeled word segment concept obtained in step 102, the executing entity may input the obtained entity to be classified of the labeled word segment concept into a pre-trained entity classification model. The entity classification model can output the entity classification result of the entity to be classified. The entity classification model can be used for representing the corresponding relation between the entity of the concept of the labeled word segment and the entity classification. For example, the entity classification model may be a database of correspondence between entities with labeled word segment concepts and entity classifications made by a technician based on a large number of data statistics.

In some optional implementation manners of this embodiment, the entity-based classification model may be trained as follows:

first, a second set of training samples is obtained. The second training sample set may include a plurality of second training samples, and each second training sample set may include an entity that has been labeled with a word segment concept and is not provided with a class label and an entity that has been provided with a class label. It is understood that the second training sample may be obtained by labeling only the word segment concepts and setting the classification labels for the same entity.

Secondly, the entity which is labeled with the word segment concept and is not provided with the classification label in the second training sample is used as input, the entity which is provided with the classification label in the second training sample is used as output, and a second pre-constructed initial model can be trained, so that an entity classification model is obtained. The entity classification model obtained by the implementation mode through machine learning training can adapt to the change of new data, and entities which do not appear in a training sample can be accurately classified.

As an example, the second initial model may be an initial model constructed by using, for example, a Convolutional Neural Network (CNN). The convolutional neural network may be a neural network of any depth. The convolutional neural network can comprise a convolutional layer, a pooling layer and the like, so that operations such as convolution, pooling and the like can be performed on input word segments to obtain the entity classification model. Among them, the convolutional layer may be used to sense the text features of the entity, and the pooling layer may be used to down-sample (down sample) the input information. Generally, before training the convolutional neural network, each layer of network may be constructed, and a connection manner between the network layer and the network layer may be specified, and further, different output and loss functions may be specified according to a target task of training. Therefore, when the convolutional neural network is trained, the convolutional neural network can be trained based on the specified loss function, so that the parameters in the convolutional neural network can be updated, and the entity classification model is obtained. It can be understood that, in the process of training the second initial model, not only the operations of convolution, pooling and the like can be performed on the word segments, but also the operations of convolution, pooling and the like can be performed on the conventional granularities of words, phrases and the like, so that the classification accuracy of the entity classification model obtained by training is higher. It should be noted that the electronic device may train the convolutional neural network by using various manners (e.g., supervised training, unsupervised training, etc.) to obtain the entity classification model.

It will be appreciated that, for example, a general pre-training language representation (BERT) model may also be employed as the second initial model. The entity classification model can be obtained by using a BERT fine tuning (fine tune) method. The method of fine tuning usually refers to loading a pre-trained BERT model, in other words, fine tuning may refer to loading values of a plurality of network weights, then inputting each second training sample in the second training sample set into the model, continuing to perform back propagation training on the network, and continuously adjusting the weight of the original model to obtain a model suitable for entity classification, which is the entity classification model. It can be understood that the entity classification model is trained by using a preset BERT model as a second initial model, which is equivalent to initializing an initial weight of a network by using the BERT model, and then training the initial weight, so that the entity classification model is a transfer learning means, and the entity classification effect can be realized without additionally constructing a complex model.

The method for entity classification provided by the above embodiment of the present application can obtain the entity to be classified, then divide the obtained entity to be classified into word segments, label the word segments with concepts, and finally input the entity to be classified with the concept of the labeled word segment into the entity classification model trained in advance, so as to obtain the entity classification result of the entity to be classified. The method provided by the embodiment introduces concept labeling of word segments, can solve the problem of insufficient characteristics of supporting entity classification caused by the fact that the entity does not have context, avoids the dependence of the entity classification on context linguistic data, and improves the accuracy of the entity classification without context.

Referring next to fig. 2, fig. 2 is a schematic diagram of a second embodiment of a method for entity classification according to the present application. The method for entity classification may comprise the steps of:

step 201, a method for entity classification.

Step 202, inputting the entity to be classified into a pre-trained word segment labeling model to obtain the word segment concept label of the entity to be classified.

In this embodiment, based on the entity to be classified acquired in step 201, the executing entity may input the acquired entity to be classified into a pre-trained word segment tagging model. The word segment labeling model can be used for carrying out word segment division and concept labeling on the entity to be classified and outputting the entity to be classified with the word segment concept labeled. As an example, the word segment tagging model may be a database of correspondence relationships between entities with unlabeled entities and tagged word segment concepts, which is made by a technician based on a large amount of data statistics.

In some optional implementations of this embodiment, the word segment tagging model may be obtained by training as follows:

first, a first set of training samples is obtained. The first training sample set may include a plurality of first training samples, and each of the first training samples may include an unlabeled entity and an entity of a labeled word segment concept. It can be understood that the first training sample can be obtained by respectively carrying out no concept labeling and word segment concept labeling on the same entity.

Secondly, taking an entity which is not marked in the first training sample as input, taking an entity which is marked with the word segment concept in the first training sample as output, and training a pre-constructed first initial model to obtain a word segment marking model. The implementation mode adopts a machine learning mode to train the obtained word segment labeling model, so that the method can adapt to the change of new data, and can accurately label the concept of the word segment for the entity which does not appear in the training sample.

In this implementation, the first initial Model may be constructed by using a Hidden Markov Model (HMM), a Conditional Random Field (CRF), or a Long-short Term Memory network (LSTM), for example. The first initial model can perform word segmentation on an entity which is not labeled in the input first training sample and perform concept prediction on a word segmentation result, so that the concept of a word segment in the entity can be obtained. Then, based on the predicted concept of the word segment in the entity and the concept of the labeled word segment in the first training sample, parameters in the first initial model can be adjusted, so that a word segment labeling model is obtained.

Optionally, the first training sample may be obtained by:

first, a sample of an entity is obtained.

Secondly, performing basic granularity segmentation on the obtained entity sample to obtain basic elements of the entity sample, and performing concept labeling on each basic element. Here, the basic granularity may be segmented for the entity sample by using a word segmentation tool or an artificial word segmentation method, so as to obtain the basic elements, and the basic elements are labeled conceptually. As an example, the base granularity may be a word granularity, with the base element being a word. In this step, the basic granularity segmentation and concept tagging of the entity sample can be used as a sequence tagging task. In performing the sequence labeling task, the boundary to be divided may be identified in the entity sample, for example, the boundary of each word may be identified in the entity for word-granularity division, and then each divided word may be labeled. The labeling can be performed in a "location tag-part of speech" manner, for example, the labeling can be performed using a "BIO" location tag, so that a location tag labeling result of the entity sample can be obtained. BIO labeling may label each element as "B-X", "I-X", or "O". Wherein "B-X" indicates that the fragment in which the element is located belongs to X type and the element is at the beginning of the fragment, "I-X" indicates that the fragment in which the element is located belongs to X type and the element is in the middle position of the fragment, and "O" indicates that the fragment does not belong to any type. As an example, the sample tag is "great mentor at harbin university of industry," and the resulting location tag labeling result is "ha [ B-organizational ] er [ I-organizational ]. major [ B-character ]. teacher [ I-character ]".

And then, combining or splitting the basic elements after the concept is labeled according to the preset granularity to generate an entity sample of the labeled word segment concept. Here, the split basic elements may be combined or split according to a predefined combination or splitting manner, the combination or splitting result of the basic elements is a word segment, and meanwhile, a concept of the word segment may also be obtained. As an example, for the position tag labeling result "haar [ B-organization ] er [ I-organization ]. major [ B-person ]. teacher [ I-person ]" of the entity sample "haar university of the industry great teacher", combining the labels belonging to the same noun phrase therein, the word segment concept labeling "haar university of the industry [ organization ] major [ person ]" of the entity sample can be obtained.

And finally, merging the entity samples which are not marked with the word segment concept and the entity samples which are marked with the word segment concept, and determining a merging result as a first training sample.

It can be understood that, when the word segment labeling is performed on the entity to be classified by using the word segment labeling model obtained by training the first training sample, concepts of the basic elements in the entity to be classified can be predicted first, and then the basic elements are combined in a preset combination mode, so that the entity to be classified with the word segment concept label can be obtained. According to the method for acquiring the first training sample disclosed in the implementation mode, the basic elements are obtained in a basic granularity division mode, and then the entity samples of the concept of the label word segment can be obtained by splitting or combining the basic elements.

Step 203, inputting the entity to be classified with the word segment concept into a pre-trained entity classification model to obtain an entity classification result of the entity to be classified.

In this embodiment, the content included in step 201 and step 203 is the same as or similar to that in step 101 and step 103 in the embodiment shown in fig. 1, respectively, and is not repeated here.

In some optional implementation manners of this embodiment, the entity classification model may further implement a function of the word segment tagging model. Namely, the entity classification model can be used for representing the corresponding relation between the entity with the labeled word segment concept and the entity classification, and can also be used for carrying out concept labeling on the word segments in the entity. Therefore, after the entity to be classified is obtained, the executing body can directly input the entity to be classified into the entity classification model, so that the classification result of the entity to be classified can be directly obtained. It can be understood that the entity classification model can output the classification result of the entity to be classified and can also output the entity to be classified with the concept label of the word segmentation segment. The implementation mode can obtain the entity classification result introduced with the word segment concept label to a certain extent.

In some optional implementation manners of this embodiment, the word segment concept labeling task and the entity classification task are trained simultaneously, so that the entity classification model, which is used for representing the correspondence between the entity of the labeled word segment concept and the entity classification and for performing concept labeling on the word segment in the entity, can be obtained. Specifically, the entity classification model can be trained in the following way:

first, a third set of training samples is obtained. The third training sample set may include a plurality of third training samples, and each third training sample may include entities that are unlabeled entities and labeled word segment concepts and are provided with classification labels. The unlabeled entities in the third training sample may be entities that neither label the word segment concept nor set the classification label. Here, if the entity generating the first training sample set and the entity generating the second training sample set are the same, the first training sample set and the second training sample set may be fused to obtain the third training sample set.

Secondly, the entity which is not marked in the third training sample is used as input, the entity which is marked with the word segment concept and is provided with the classification label in the third training sample is used as output, and the third initial model can be trained, so that the entity classification model is obtained. The method for training the entity classification model in this implementation manner may refer to the entity classification model in the embodiment shown in fig. 1 and the training of the word segment tagging model in this embodiment. It can be understood that, in the process of training the entity classification model, the sum of losses of two training tasks of word segment concept labeling and entity classification can be optimized.

As can be seen from fig. 2, compared with the embodiment corresponding to fig. 1, the method for entity classification in this embodiment performs word segment division and concept labeling on the entity to be classified by using the pre-trained word segment labeling model, and can quickly acquire the entity to be classified with the labeled word segment concept input into the entity classification model, so that the method for entity classification provided in this embodiment can quickly and accurately classify the entity.

With further reference to fig. 3, as an implementation of the methods shown in the above figures, the present disclosure provides an embodiment of an apparatus for entity classification, which corresponds to the method embodiment shown in fig. 1, and which is particularly applicable to various electronic devices.

As shown in fig. 3, the apparatus 300 for entity classification of the present embodiment includes: an acquisition unit 301, a labeling unit 302, and an input unit 303. Wherein the obtaining unit 301 is configured to obtain an entity to be classified; the labeling unit 302 is configured to divide the entity to be classified into word segments, and perform concept labeling on the word segments, where the word segments are semantic units with preset granularity, and the granularity of the word segments is greater than the granularity of the words; the input unit 302 is configured to input the entity to be classified with the tagged word segment concept into a pre-trained entity classification model, resulting in an entity classification result of the entity to be classified, where the entity classification model is used to represent a correspondence between the entity with the tagged word segment concept and the entity classification.

In some optional implementations of the present embodiment, the labeling unit 302 is further configured to: and inputting the entity to be classified into a pre-trained word segment labeling model to obtain a word segment concept label of the entity to be classified, wherein the word segment labeling model is used for carrying out concept labeling on word segments in the entity.

In some optional implementations of this embodiment, the word segment labeling model is trained as follows: acquiring a first training sample set, wherein the first training sample comprises unlabeled entities and entities with labeled word segment concepts; and taking the entity which is not marked in the first training sample as input, taking the entity which is marked with the word segment concept in the first training sample as output, and training a pre-constructed first initial model to obtain a word segment marking model.

In some optional implementations of this embodiment, the first training sample is obtained by: obtaining an entity sample; performing basic granularity segmentation on the entity sample to obtain basic elements of the entity sample, and performing concept labeling on each basic element; combining or splitting basic elements after the concept is labeled according to preset granularity to generate an entity sample of the labeled word segment concept; and determining the entity samples which are not labeled and are labeled with the word segment concepts as first training samples.

In some optional implementations of this embodiment, the entity classification model is trained by the following steps: acquiring a second training sample set, wherein the second sample set comprises entities which are labeled with word segment concepts and are not provided with classification labels and entities which are provided with classification labels; and taking the entity which is labeled with the word segment concept and is not provided with the classification label in the second training sample as input, taking the entity which is provided with the classification label in the second training sample as output, and training a pre-constructed second initial model to obtain an entity classification model.

In some optional implementations of this embodiment, the entity classification model is further configured to perform concept labeling on word segments in the entity; the annotation unit 302 is further configured to: and inputting the entity to be classified into the entity classification model to obtain the word segment concept label of the entity to be classified.

In some optional implementations of this embodiment, the entity classification model may be further trained by the following steps: acquiring a third training sample set, wherein the third training sample set comprises entities which are not labeled entities and labeled word segment concepts and are provided with classification labels; and taking the entity which is not labeled in the third training sample as input, taking the entity which is labeled with the word segment concept and is provided with the classification label in the third training sample as output, and training the third initial model to obtain an entity classification model.

The units recited in the apparatus 300 correspond to the various steps in the method described with reference to fig. 1. Thus, the operations and features described above for the method are equally applicable to the apparatus 300 and the units included therein and will not be described again here.

According to an embodiment of the present application, an electronic device and a readable storage medium are also provided.

Fig. 4 is a block diagram of an electronic device for a method for entity classification according to an embodiment of the present application. Electronic devices are intended to represent various forms of digital computers, such as laptops, desktops, workstations, personal digital assistants, servers, blade servers, mainframes, and other appropriate computers. The electronic device may also represent various forms of mobile devices, such as personal digital processing, cellular phones, smart phones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions, are meant to be examples only, and are not meant to limit implementations of the present application that are described and/or claimed herein.

As shown in fig. 4, the electronic apparatus includes: one or more processors 401, memory 402, and interfaces for connecting the various components, including high-speed interfaces and low-speed interfaces. The various components are interconnected using different buses and may be mounted on a common motherboard or in other manners as desired. The processor may process instructions for execution within the electronic device, including instructions stored in or on the memory to display graphical information of a GUI on an external input/output apparatus (such as a display device coupled to the interface). In other embodiments, multiple processors and/or multiple buses may be used, along with multiple memories and multiple memories, as desired. Also, multiple electronic devices may be connected, with each device providing portions of the necessary operations (e.g., as a server array, a group of blade servers, or a multi-processor system). In fig. 4, one processor 401 is taken as an example.

Memory 402 is a non-transitory computer readable storage medium as provided herein. Wherein the memory stores instructions executable by the at least one processor to cause the at least one processor to perform the method for entity classification provided herein. The non-transitory computer readable storage medium of the present application stores computer instructions for causing a computer to perform the method for entity classification provided herein.

The memory 402, as a non-transitory computer readable storage medium, may be used to store non-transitory software programs, non-transitory computer executable programs, and modules, such as program instructions/modules corresponding to the method for entity classification in the embodiment of the present application (e.g., the obtaining unit 301, the labeling unit 302, and the input unit 303 shown in fig. 3). The processor 401 executes various functional applications of the server and data processing, i.e., implements the method for entity classification in the above-described method embodiments, by running non-transitory software programs, instructions, and modules stored in the memory 402.

The memory 402 may include a storage program area and a storage data area, wherein the storage program area may store an operating system, an application program required for at least one function; the storage data area may store data created according to use of the electronic device for entity classification, and the like. Further, the memory 402 may include high speed random access memory, and may also include non-transitory memory, such as at least one magnetic disk storage device, flash memory device, or other non-transitory solid state storage device. In some embodiments, memory 402 optionally includes memory located remotely from processor 401, which may be connected to an electronic device for entity classification via a network. Examples of such networks include, but are not limited to, the internet, intranets, local area networks, mobile communication networks, and combinations thereof.

The electronic device of the method for entity classification may further include: an input device 403 and an output device 404. The processor 401, the memory 402, the input device 403 and the output device 404 may be connected by a bus or other means, and fig. 4 illustrates an example of a connection by a bus.

The input device 403 may receive input numeric or character information and generate key signal inputs related to user settings and function control of the electronic apparatus for entity classification, such as an input device of a touch screen, a keypad, a mouse, a track pad, a touch pad, a pointing stick, one or more mouse buttons, a track ball, a joystick, or the like. The output devices 404 may include a display device, auxiliary lighting devices (e.g., LEDs), and haptic feedback devices (e.g., vibrating motors), among others. The display device may include, but is not limited to, a Liquid Crystal Display (LCD), a Light Emitting Diode (LED) display, and a plasma display. In some implementations, the display device can be a touch screen.

Various implementations of the systems and techniques described here can be realized in digital electronic circuitry, integrated circuitry, application specific ASICs (application specific integrated circuits), computer hardware, firmware, software, and/or combinations thereof. These various embodiments may include: implemented in one or more computer programs that are executable and/or interpretable on a programmable system including at least one programmable processor, which may be special or general purpose, receiving data and instructions from, and transmitting data and instructions to, a storage system, at least one input device, and at least one output device.

These computer programs (also known as programs, software applications, or code) include machine instructions for a programmable processor, and may be implemented using high-level procedural and/or object-oriented programming languages, and/or assembly/machine languages. As used herein, the terms "machine-readable medium" and "computer-readable medium" refer to any computer program product, apparatus, and/or device (e.g., magnetic discs, optical disks, memory, Programmable Logic Devices (PLDs)) used to provide machine instructions and/or data to a programmable processor, including a machine-readable medium that receives machine instructions as a machine-readable signal. The term "machine-readable signal" refers to any signal used to provide machine instructions and/or data to a programmable processor.

To provide for interaction with a user, the systems and techniques described here can be implemented on a computer having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to a user; and a keyboard and a pointing device (e.g., a mouse or a trackball) by which a user can provide input to the computer. Other kinds of devices may also be used to provide for interaction with a user; for example, feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user may be received in any form, including acoustic, speech, or tactile input.

The systems and techniques described here can be implemented in a computing system that includes a back-end component (e.g., as a data server), or that includes a middleware component (e.g., an application server), or that includes a front-end component (e.g., a user computer having a graphical user interface or a web browser through which a user can interact with an implementation of the systems and techniques described here), or any combination of such back-end, middleware, or front-end components. The components of the system can be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: local Area Networks (LANs), Wide Area Networks (WANs), and the Internet.

The computer system may include clients and servers. A client and server are generally remote from each other and typically interact through a communication network. The relationship of client and server arises by virtue of computer programs running on the respective computers and having a client-server relationship to each other.

According to the technical scheme of the embodiment of the application, the entity to be classified can be obtained, then the obtained entity to be classified is divided into word segments, concept labeling is carried out on the word segments, finally the entity to be classified with the concept of the word segments labeled is input into a pre-trained entity classification model, and an entity classification result of the entity to be classified can be obtained. The method provided by the embodiment introduces concept labeling of word segments, can solve the problem of insufficient characteristics of supporting entity classification caused by the fact that the entity does not have context, avoids the dependence of the entity classification on context linguistic data, and improves the accuracy of the entity classification without context.

It should be understood that various forms of the flows shown above may be used, with steps reordered, added, or deleted. For example, the steps described in the present application may be executed in parallel, sequentially, or in different orders, and the present invention is not limited thereto as long as the desired results of the technical solutions disclosed in the present application can be achieved.

The above-described embodiments should not be construed as limiting the scope of the present application. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions may be made in accordance with design requirements and other factors. Any modification, equivalent replacement, and improvement made within the spirit and principle of the present application shall be included in the protection scope of the present application.

15页详细技术资料下载
上一篇:一种医用注射器针头装配设备
下一篇:跨网络实体的识别方法、装置、电子设备及介质

网友询问留言

已有0条留言

还没有人留言评论。精彩留言会获得点赞!

精彩留言,会给你点赞!