Named entity identification method and device based on resume file and electronic equipment
1. A named entity identification method based on a resume file comprises the following steps:
acquiring a resume file;
in response to determining that the file type of the resume file is the target file type, generating at least one text area image according to the resume file;
performing image segmentation on each text region image in the at least one text region image to generate a sub-text region image group to obtain a sub-text region image group set;
performing image size normalization processing on each sub-text region image in the sub-text region image group set to generate a normalized text region image to obtain a normalized text region image group set;
identifying characters included in each normalized text region image in the normalized text region image group set to generate a character information set, wherein the character information in the character information set includes: character and character position information;
generating text information according to the character information set;
and generating an entity information set according to the character information set, the text information and the target named entity recognition model.
2. The method of claim 1, wherein said generating at least one text region image from said resume file comprises:
carrying out binarization processing on the resume file to generate a first candidate resume file;
performing noise reduction processing on the first candidate resume file to generate a second candidate resume file;
and performing text region segmentation on the second candidate resume file to generate the at least one text region image.
3. The method of claim 2, wherein said text region segmenting said second candidate resume file to generate said at least one text region image comprises:
determining a text area in the second candidate resume file to obtain at least one text area;
clustering the text regions in the at least one text region to generate a text region image, and obtaining the at least one text region image.
4. The method of claim 1, wherein generating a set of entity information from the set of character information, the textual information, and a target named entity recognition model comprises:
encoding each character information in the character information set to generate a character information vector to obtain a character information vector set, wherein the character information vector in the character information vector set is composed of a character vector and a character position information vector;
encoding the text information to generate a text information vector;
splicing the text information vector and each character information vector in the character information vector set to generate an input vector to obtain an input vector set;
and inputting the input vector set into the target named entity recognition model to generate the entity information set.
5. The method of claim 4, wherein the target named entity recognition model is derived by the training steps of:
and adjusting model parameters of the initial named entity recognition model through a target domain training sample data set to generate the target named entity recognition model, wherein the length of a feature word included in target domain training sample data in the target domain training sample data set is not more than the target length.
6. The method of claim 5, wherein the set of target domain training sample data is obtained by:
performing feature mapping on each source domain training sample data in the source domain training sample data set to generate a source domain data vector to obtain a source domain data vector set;
performing feature mapping on each candidate training sample data in the candidate training sample data set to generate candidate training sample data vectors to obtain a candidate training sample data vector set;
determining the similarity between each candidate training sample data vector in the candidate training sample data vector set and a source domain data vector in the source domain data vector set as a similarity numerical value to obtain a similarity numerical value set;
and for each candidate training sample data vector in the candidate training sample data vector set, determining the candidate training sample data corresponding to the candidate training sample data vector as the target domain training sample data in response to determining that the similarity degree value in the similarity degree value group corresponding to the candidate training sample data vector meets the preset condition.
7. The method of claim 1, wherein the method further comprises:
for each entity information in the set of entity information, determining a frequency of occurrence of the entity information in the set of entity information to generate a frequency value in response to determining that the entity information is not present in a target dictionary, and adding the entity information to the target dictionary in response to determining that the frequency value is greater than a target frequency value.
8. A named entity recognition apparatus based on a resume file, comprising:
an acquisition unit configured to acquire a resume file;
a first generating unit configured to generate at least one text area image from the resume file in response to determining that the file type of the resume file is a target file type;
an image segmentation unit configured to perform image segmentation on each of the at least one text region image to generate a sub-text region image group, resulting in a sub-text region image group set;
an image size normalization processing unit configured to perform image size normalization processing on each sub-text region image in the sub-text region image group set to generate a normalized text region image, resulting in a normalized text region image group set;
an identifying unit configured to identify a character included in each normalized text region image in the set of normalized text region image groups to generate a set of character information, wherein the character information in the set of character information includes: character and character position information;
a second generating unit configured to generate text information from the set of character information;
a third generating unit configured to generate an entity information set according to the character information set, the text information and a target named entity recognition model.
9. An electronic device, comprising:
one or more processors;
a storage device having one or more programs stored thereon;
when executed by the one or more processors, cause the one or more processors to implement the method of any one of claims 1-7.
10. A computer-readable medium, on which a computer program is stored, wherein the program, when executed by a processor, implements the method of any one of claims 1 to 7.
Background
With the development of natural language processing technology, the application of natural language processing is more and more extensive. Named entity recognition is a cornerstone of many natural language processing techniques, such as knowledge graph construction, information extraction, and the like. Therefore, the accuracy of named entity identification for the resume file can be improved, and the accuracy of information extraction for the resume file can be effectively improved. Conventionally, when identifying an entity in a resume file, the following methods are generally adopted: and extracting entity information from the resume file through the manually set entity identification rule.
However, when the above-described manner is adopted, there are often technical problems as follows:
firstly, when the field of entity identification changes, the accuracy of entity identification may be affected by adopting the previously set entity identification rule;
secondly, when the entity recognition model is trained, a large amount of training data is often needed, the entity recognition model is trained to ensure the robustness and the prediction accuracy of the model, but the history file is labeled to generate the training data, and a large amount of human resources are often consumed.
Disclosure of Invention
This summary is provided to introduce a selection of concepts in a simplified form that are further described below in the detailed description. This summary is not intended to identify key features or essential features of the claimed subject matter, nor is it intended to be used to limit the scope of the claimed subject matter.
Some embodiments of the present disclosure provide a method, an apparatus, and an electronic device for named entity identification based on a resume file to solve one or more of the technical problems mentioned in the background section above.
In a first aspect, some embodiments of the present disclosure provide a method for identifying a named entity based on a resume file, the method including: acquiring a resume file; in response to determining that the file type of the resume file is the target file type, generating at least one text area image according to the resume file; performing image segmentation on each text region image in the at least one text region image to generate a sub-text region image group to obtain a sub-text region image group set; performing image size normalization processing on each sub-text region image in the sub-text region image group set to generate a normalized text region image to obtain a normalized text region image group set; identifying characters included in each normalized text region image in the normalized text region image group set to generate a character information set, wherein the character information in the character information set includes: character and character position information; generating text information according to the character information set; and generating an entity information set according to the character information set, the text information and the target named entity recognition model.
Optionally, the generating at least one text region image according to the resume file includes: performing binarization processing on the resume file to generate a first candidate resume file; performing noise reduction processing on the first candidate resume file to generate a second candidate resume file; and performing text region segmentation on the second candidate resume file to generate the at least one text region image.
Optionally, the performing text region segmentation on the second candidate resume file to generate the at least one text region image includes: determining a text area in the second candidate resume file to obtain at least one text area; and clustering the text regions in the at least one text region to generate a text region image, so as to obtain the at least one text region image.
Optionally, the generating an entity information set according to the character information set, the text information, and the target named entity recognition model includes: encoding each character information in the character information set to generate a character information vector to obtain a character information vector set, wherein the character information vector in the character information vector set is composed of a character vector and a character position information vector; encoding the text information to generate a text information vector; splicing the text information vector and each character information vector in the character information vector set to generate an input vector to obtain an input vector set; and inputting the input vector set into the target named entity recognition model to generate the entity information set.
Optionally, the target named entity recognition model is obtained through the following training steps: and adjusting model parameters of the initial named entity recognition model through a target domain training sample data set to generate the target named entity recognition model, wherein the length of a feature word included in target domain training sample data in the target domain training sample data set is not more than the target length.
Optionally, the target domain training sample data set is obtained through the following steps: performing feature mapping on each source domain training sample data in the source domain training sample data set to generate a source domain data vector to obtain a source domain data vector set; performing feature mapping on each candidate training sample data in the candidate training sample data set to generate candidate training sample data vectors to obtain a candidate training sample data vector set; determining the similarity between each candidate training sample data vector in the candidate training sample data vector set and the source domain data vector in the source domain data vector set as a similarity numerical value to obtain a similarity numerical value set; and for each candidate training sample data vector in the candidate training sample data vector set, determining the candidate training sample data corresponding to the candidate training sample data vector as the target domain training sample data in response to determining that the similarity degree value in the similarity degree value group corresponding to the candidate training sample data vector meets the preset condition.
Optionally, the method further includes: for each entity information in the set of entity information, determining a frequency of occurrence of the entity information in the set of entity information in response to determining that the entity information is not present in the target dictionary to generate a frequency value, and adding the entity information to the target dictionary in response to determining that the frequency value is greater than a target frequency value.
In a second aspect, some embodiments of the present disclosure provide an apparatus for named entity identification based on a resume file, the apparatus comprising: an acquisition unit configured to acquire a resume file; a generating unit configured to generate at least one text area image based on the resume file in response to determining that the file type of the resume file is a target file type; an image segmentation unit configured to perform image segmentation on each of the at least one text region image to generate a sub-text region image group, resulting in a sub-text region image group set; an image size normalization processing unit configured to perform image size normalization processing on each sub-text region image in the sub-text region image group set to generate a normalized text region image, resulting in a normalized text region image group set; identifying characters included in each normalized text region image in the normalized text region image group set to generate a character information set, wherein the character information in the character information set includes: character and character position information; generating text information according to the character information set; and generating an entity information set according to the character information set, the text information and the target named entity recognition model.
Optionally, the first generating unit is configured to: performing binarization processing on the resume file to generate a first candidate resume file; performing noise reduction processing on the first candidate resume file to generate a second candidate resume file; and performing text region segmentation on the second candidate resume file to generate the at least one text region image.
Optionally, the first generating unit is configured to: determining a text area in the second candidate resume file to obtain at least one text area; and clustering the text regions in the at least one text region to generate a text region image, so as to obtain the at least one text region image.
Optionally, the third generating unit is configured to: encoding each character information in the character information set to generate a character information vector to obtain a character information vector set, wherein the character information vector in the character information vector set is composed of a character vector and a character position information vector; encoding the text information to generate a text information vector; splicing the text information vector and each character information vector in the character information vector set to generate an input vector to obtain an input vector set; and inputting the input vector set into the target named entity recognition model to generate the entity information set.
Optionally, the target named entity recognition model is obtained through the following training steps: and adjusting model parameters of the initial named entity recognition model through a target domain training sample data set to generate the target named entity recognition model, wherein the length of a feature word included in target domain training sample data in the target domain training sample data set is not more than the target length.
Optionally, the target domain training sample data set is obtained through the following steps: performing feature mapping on each source domain training sample data in the source domain training sample data set to generate a source domain data vector to obtain a source domain data vector set; performing feature mapping on each candidate training sample data in the candidate training sample data set to generate candidate training sample data vectors to obtain a candidate training sample data vector set; determining the similarity between each candidate training sample data vector in the candidate training sample data vector set and the source domain data vector in the source domain data vector set as a similarity numerical value to obtain a similarity numerical value set; and for each candidate training sample data vector in the candidate training sample data vector set, determining the candidate training sample data corresponding to the candidate training sample data vector as the target domain training sample data in response to determining that the similarity degree value in the similarity degree value group corresponding to the candidate training sample data vector meets the preset condition.
Optionally, the apparatus further comprises: for each entity information in the set of entity information, determining a frequency of occurrence of the entity information in the set of entity information in response to determining that the entity information is not present in the target dictionary to generate a frequency value, and adding the entity information to the target dictionary in response to determining that the frequency value is greater than a target frequency value.
In a third aspect, some embodiments of the present disclosure provide an electronic device, comprising: one or more processors; a storage device having one or more programs stored thereon, which when executed by one or more processors, cause the one or more processors to implement the method described in any of the implementations of the first aspect.
In a fourth aspect, some embodiments of the present disclosure provide a computer readable medium on which a computer program is stored, wherein the program, when executed by a processor, implements the method described in any of the implementations of the first aspect.
The above embodiments of the present disclosure have the following beneficial effects: by the named entity identification method based on the resume file, the accuracy of entity identification is improved. Specifically, the reason for the low accuracy of entity identification is that: with the manually set entity recognition rules, the accuracy of entity recognition may be reduced when the field of entity recognition changes. Based on this, the named entity identification method based on the resume file of some embodiments of the present disclosure first acquires the resume file. Then, in response to determining that the file type of the resume file is the target file type, at least one text region image is generated based on the resume file. In actual situations, there are some resume files that are difficult to directly extract content. Such as picture format, etc. Therefore, by adopting the entity identification method corresponding to the file type of the resume file, the accuracy of entity identification can be greatly improved. Second, the resume file often includes at least one module, such as an "educational background" module, a "basic information" module, and an "educational history" module. Since the text in each module often has a certain relevance, the relevance characteristics of the text in the module can be reserved by generating at least one text region image, so that the accuracy of text recognition of the resume text is improved. Then, image segmentation is carried out on each text region image in the at least one text region image to generate a sub-text region image group, and a sub-text region image group set is obtained. And carrying out image segmentation on the text region image to obtain a sub-text region image corresponding to each word. Further, image size normalization processing is performed on each sub-text region image in the sub-text region image group set to generate a normalized text region image, and a normalized text region image group set is obtained. In actual circumstances, since the history file often contains characters of different font sizes, the resolution of the sub-text region images obtained by image division often differs, and the uniformity of the resolution of the text region images can be ensured by the image size normalization processing. Further, the characters included in each of the normalized text region images in the above-described set of normalized text region images are identified to generate a set of character information. And identifying the characters contained in the normalized text region image one by one to obtain a character information set corresponding to the resume file. Further, text information is generated according to the character information set. Because the position relationship between the characters included in the text in the resume file may also affect the accuracy of entity recognition, the text information is generated through the character information set, and the characteristics of the position relationship between adjacent characters can be effectively retained. And finally, generating an entity information set according to the character information set, the text information and the target named entity recognition model. The method does not need to set a complex entity identification rule, and simultaneously, the identification accuracy and the identification efficiency of entity identification are greatly improved.
Drawings
The above and other features, advantages and aspects of various embodiments of the present disclosure will become more apparent by referring to the following detailed description when taken in conjunction with the accompanying drawings. Throughout the drawings, the same or similar reference numbers refer to the same or similar elements. It should be understood that the drawings are schematic and that elements and elements are not necessarily drawn to scale.
FIG. 1 is a schematic diagram of one application scenario of a resume file-based named entity identification method according to some embodiments of the present disclosure;
FIG. 2 is a flow diagram of some embodiments of a resume file based named entity identification method according to the present disclosure;
FIG. 3 is a schematic illustration of a resume file;
FIG. 4 is a schematic diagram of generating text information from a set of character information;
FIG. 5 is a flow diagram of further embodiments of a resume file-based named entity identification method according to the present disclosure;
FIG. 6 is a block diagram of some embodiments of a named entity recognition apparatus based on a resume file according to the present disclosure;
FIG. 7 is a schematic structural diagram of an electronic device suitable for use in implementing some embodiments of the present disclosure.
Detailed Description
Embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. While certain embodiments of the present disclosure are shown in the drawings, it is to be understood that the disclosure may be embodied in various forms and should not be construed as limited to the embodiments set forth herein. Rather, these embodiments are provided for a more thorough and complete understanding of the present disclosure. It should be understood that the drawings and embodiments of the disclosure are for illustration purposes only and are not intended to limit the scope of the disclosure.
It should be noted that, for convenience of description, only the portions related to the related invention are shown in the drawings. The embodiments and features of the embodiments in the present disclosure may be combined with each other without conflict.
It should be noted that the terms "first", "second", and the like in the present disclosure are only used for distinguishing different devices, modules or units, and are not used for limiting the order or interdependence relationship of the functions performed by the devices, modules or units.
It is noted that references to "a", "an", and "the" modifications in this disclosure are intended to be illustrative rather than limiting, and that those skilled in the art will recognize that "one or more" may be used unless the context clearly dictates otherwise.
The names of messages or information exchanged between devices in the embodiments of the present disclosure are for illustrative purposes only, and are not intended to limit the scope of the messages or information.
The present disclosure will be described in detail below with reference to the accompanying drawings in conjunction with embodiments.
Fig. 1 is a schematic diagram of an application scenario of a resume file-based named entity identification method according to some embodiments of the present disclosure.
In the application scenario of fig. 1, first, the computing device 101 may obtain a resume file 102; then, the computing device 101 may generate at least one text region image 103 based on the resume file 102 in response to determining that the file type of the resume file 102 is the target file type; secondly, the computing device 101 performs image segmentation on each text region image in the at least one text region image 103 to generate a sub-text region image group, so as to obtain a sub-text region image group set 104; further, the computing device 101 performs image size normalization processing on each sub-text region image in the sub-text region image group 104 to generate a normalized text region image, resulting in a normalized text region image group 105; further, the computing device 101 identifies characters included in each normalized text region image in the set of normalized text region images 105 to generate a set of character information 106, wherein the character information in the set of character information 106 includes: character and character position information; in addition, the computing device 101 generates text information 107 according to the character information set 106; finally, the computing device 101 generates an entity information set 109 based on the character information set 106, the text information 107, and the target named entity recognition model 108.
The computing device 101 may be hardware or software. When the computing device is hardware, it may be implemented as a distributed cluster composed of multiple servers or terminal devices, or may be implemented as a single server or a single terminal device. When the computing device is embodied as software, it may be installed in the hardware devices enumerated above. It may be implemented, for example, as multiple software or software modules to provide distributed services, or as a single software or software module. And is not particularly limited herein.
It should be understood that the number of computing devices in FIG. 1 is merely illustrative. There may be any number of computing devices, as implementation needs dictate.
With continued reference to FIG. 2, a flow 200 of some embodiments of a resume-file-based named entity identification method in accordance with the present disclosure is shown. The named entity identification method based on the resume file comprises the following steps:
step 201, acquiring a resume file.
In some embodiments, the entity performing the named entity identification method based on the resume file (e.g., computing device 101 of FIG. 1) may obtain the resume file from the target database via a wired connection or a wireless connection. The target database may be a database for storing a history file. The target database may be a distributed database, such as an HBase database. The aforementioned resume file may be a file for describing personal experiences and resumes. For example, the resume file may be a file with a file extension DOC. The resume file may be an image file, and for example, the resume file may be a file with a file extension name JPEG (Joint Photographic Experts Group). The resume file may be a file with a file extension name of PDF (Portable Document Format).
As an example, the aforementioned resume file may be as shown in fig. 3. The resume file may be a file with a file extension name of PDF. The resume file may include: "personal information" module 301, "educational history" module 302, "work history" module 303, "project history" module 304, and "outside work history" module 305.
In response to determining that the file type of the resume file is the target file type, at least one text region image is generated according to the resume file, step 202.
In some embodiments, the execution subject may generate the at least one text region image based on the resume file in response to determining that the file type of the resume file is the target file type. The target file type may be a JPEG file type or a PDF file type. The text region image in the at least one text region image may be an image of a region corresponding to a text module in the resume file. For example, the text module may be a "personal information" module. The execution subject may determine the text module in the resume file by a target text detection algorithm to generate the at least one text region image. The target file detection algorithm may be, but is not limited to, any one of the following: CTPN (connectionist Text forward network) Text detection algorithm and Faster R-CNN (regions with CNN features) Text detection algorithm.
As an example, the text region image of the at least one text region image may be an image of a region corresponding to the "personal information" module in fig. 3.
Step 203, performing image segmentation on each text region image in at least one text region image to generate a sub-text region image group, so as to obtain a sub-text region image group set.
In some embodiments, the execution subject may perform image segmentation on each of the at least one text region image to generate a sub-text region image group, resulting in a set of sub-text region image groups. And the sub-text area image in the sub-text area image group set corresponds to the image of the area where one character in the history file is located. The execution main body may generate a candidate box through an RNN (Recurrent Neural Network) model, where the candidate box may be used to frame characters in the resume file. The execution body may determine the region within the candidate frame as a sub-text region image.
And 204, carrying out image size normalization processing on each sub-text region image in the sub-text region image group set to generate a normalized text region image, so as to obtain a normalized text region image group set.
In some embodiments, the performing the main body performing image size normalization processing on each sub-text region image in the set of sub-text region images to generate a normalized text region image, resulting in the set of normalized text region images, may include:
the first step is to determine the sub-text region image with the highest resolution in the sub-text region image group set as the first image.
As an example, the resolution of the sub-text region image with the highest resolution in the above-described sub-text region image group set may be 50 × 50.
And secondly, determining the sub-text region image with the minimum resolution in the sub-text region image group set as a second image.
As an example, the resolution of the sub-text region image having the smallest resolution in the above-described sub-text region image group set may be 20 × 20.
And thirdly, generating a target resolution according to the resolution of the first image and the resolution of the second image.
As an example, the resolution of the first image may be 50 × 50. The resolution of the second image may be 20 x 20. The target resolution may be 35 × 35.
And fourthly, zooming each sub-text region image in the sub-text region image group set according to the target resolution to generate a normalized text region image to obtain a normalized text region image group set.
As an example, the execution main body may scale each of the sub-text region images in the sub-text region image group set so that the resolution of the sub-text region image is updated to the target resolution.
In step 205, the characters included in each normalized text region image in the set of normalized text region images are identified to generate a set of character information.
In some embodiments, the executing entity may identify a Character included in each normalized text region image in the set of normalized text region images by an OCR (Optical Character Recognition) technique to generate the set of Character information. The character information in the character information set may include: characters and character position information. The character position information may be coordinates of center coordinates of characters in the history file.
As an example, the character information may be [ character: "one", character position information: (0,0)].
And step 206, generating text information according to the character information set.
In some embodiments, the execution main body may arrange characters included in the character information according to character position information included in the character information set to generate the text information.
As an example, as shown in fig. 4. The set of character information may be { [ characters: "one", character position information: (0, 0) ], [ character: "person", character position information: (0, 1) ], [ character: "letter", character position information: (0, 2) ], [ character: "information", character position information: (0, 3) ], [ character: "last name", character position information: (1, 0) ], [ character: "name", character position information: (1,1)]}. The generated text information 401 may be [ [ person, information ], [ surname, first name ] ].
And step 207, generating an entity information set according to the character information set, the text information and the target named entity recognition model.
In some embodiments, the generating the entity information set by the executing entity according to the character information set, the text information, and the target named entity recognition model may include:
firstly, the text information is coded to generate a text information vector.
And secondly, encoding each character information in the character information set to generate a character information vector to obtain a character information vector set.
And thirdly, generating a splicing vector by using each character information vector in the character information vector set and the text information vector to obtain a splicing vector set.
And fourthly, inputting the splicing vector set into the target named entity recognition model to generate the entity information set.
As an example, the target named entity recognition model may be composed of a CRF (conditional random field) model and an LSTM (Long Short-Term Memory neural network) model. First, the execution agent may label the character history data corresponding to the training sample by a BMES information labeling method. Then, the execution agent may perform feature extraction on the labeled character history data by using a CRF model to generate a feature template. Further, the executive may train the CRF model through the feature template and the training sample to determine model parameters of the CRF model. Then, the executive body may train the LSTM model using at least one sentence vector corresponding to the character history data and a training sample to obtain the entity information set.
The above embodiments of the present disclosure have the following beneficial effects: by the named entity identification method based on the resume file, the accuracy of entity identification is improved. Specifically, the reason for the low accuracy of entity identification is that: with the manually set entity recognition rules, the accuracy of entity recognition may be reduced when the field of entity recognition changes. Based on this, the named entity identification method based on the resume file of some embodiments of the present disclosure first acquires the resume file. Then, in response to determining that the file type of the resume file is the target file type, at least one text region image is generated based on the resume file. In actual situations, there are some resume files that are difficult to directly extract content. Such as picture format, etc. Therefore, by adopting the entity identification method corresponding to the file type of the resume file, the accuracy of entity identification can be greatly improved. Second, the resume file often includes at least one module, such as an "educational background" module, a "basic information" module, and an "educational history" module. Since the text in each module often has a certain relevance, the relevance characteristics of the text in the module can be reserved by generating at least one text region image, so that the accuracy of text recognition of the resume text is improved. Then, image segmentation is carried out on each text region image in the at least one text region image to generate a sub-text region image group, and a sub-text region image group set is obtained. And carrying out image segmentation on the text region image to obtain a sub-text region image corresponding to each word. Further, image size normalization processing is performed on each sub-text region image in the sub-text region image group set to generate a normalized text region image, and a normalized text region image group set is obtained. In actual circumstances, since the history file often contains characters of different font sizes, the resolution of the sub-text region images obtained by image division often differs, and the uniformity of the resolution of the text region images can be ensured by the image size normalization processing. Further, the characters included in each of the normalized text region images in the above-described set of normalized text region images are identified to generate a set of character information. And identifying the characters contained in the normalized text region image one by one to obtain a character information set corresponding to the resume file. Further, text information is generated according to the character information set. Because the position relationship between the characters included in the text in the resume file may also affect the accuracy of entity recognition, the text information is generated through the character information set, and the characteristics of the position relationship between adjacent characters can be effectively retained. And finally, generating an entity information set according to the character information set, the text information and the target named entity recognition model. The method does not need to set a complex entity identification rule, and simultaneously, the identification accuracy and the identification efficiency of entity identification are greatly improved.
With further reference to FIG. 5, a flow 500 of further embodiments of a resume file-based named entity identification method is illustrated. The process 500 of the named entity identification method based on the resume file includes the following steps:
step 501, obtaining a resume file.
In some embodiments, the specific implementation of step 501 and the technical effect thereof may refer to step 201 in those embodiments corresponding to fig. 2, and are not described herein again.
Step 502, in response to determining that the file type of the resume file is the target file type, performing binarization processing on the resume file to generate a first candidate resume file.
In some embodiments, the executing body may perform binarization processing on the resume file to generate the first candidate resume file in response to determining that the file type of the resume file is the target file type, and may include:
first, in response to determining that the resume file is a file of a file extension PDF, the resume file is converted into a target file.
The target file may be a file with JPEG as a file extension name.
As an example, the execution subject may convert the resume file into the target file by:
from wand.image import Image
import PythonMagick
with Image (filename = "resume file. pdf") as img:
with img.convert('JPEG') as converted:
converted. save (filename = 'destination file. jpeg')
And a second step of determining the resume file as a target file in response to determining that the resume file is a file with a file extension name of JPEG.
And thirdly, performing binarization processing on the target file through an OTSU (Otsu binarization) algorithm to generate the first candidate resume file.
In step 503, the first candidate resume file is subjected to noise reduction processing to generate a second candidate resume file.
In some embodiments, the executing entity may perform noise reduction processing on the first candidate resume file by using any one of a gaussian filtering algorithm, a median filtering algorithm, and a mean filtering algorithm to generate the second candidate resume file.
Step 504, a text region segmentation is performed on the second candidate resume file to generate at least one text region image.
In some embodiments, the executing entity may perform text region segmentation on the second candidate resume file by using a target text region segmentation algorithm to generate the at least one text region image. The target text region segmentation algorithm may be, but is not limited to, any one of the following: a threshold-based segmentation method, a region-based image segmentation algorithm, an edge detection-based segmentation algorithm, and a genetic algorithm-based image segmentation algorithm.
Optionally, the executing entity may perform text region segmentation on the second candidate resume file to generate at least one text region image, and may include:
the first step, confirm the text area in the above-mentioned second candidate resume file, receive at least one text area.
The executing body may determine the text region in the second candidate resume file by the target text detection algorithm, so as to obtain the at least one text region. The execution main body may determine a candidate block framing region for framing a text as the text region.
And secondly, clustering the text regions in the at least one text region to generate a text region image, so as to obtain the at least one text region image.
First, the execution subject may cluster the text regions in the at least one text region according to coordinates of a center point of the text region in the at least one text region. Then, the execution body may merge the text regions of the same category. Finally, the execution subject may determine an image corresponding to the merged region as a text region image. The executing entity may cluster the text regions in the at least one text region by a target clustering algorithm. The above target clustering algorithm may be, but is not limited to, any one of the following: K-Means clustering algorithm, mean-shift clustering algorithm, DBSCAN (Density-based clustering of applications with noise) algorithm and K-NN (K-near Neighbor) algorithm.
Step 505, performing image segmentation on each text region image in at least one text region image to generate a sub-text region image group, so as to obtain a sub-text region image group set.
Step 506, performing image size normalization processing on each sub-text region image in the sub-text region image group set to generate a normalized text region image, so as to obtain a normalized text region image group set.
In step 507, the characters included in each normalized text region image in the normalized text region image group set are identified to generate a character information set.
And step 508, generating text information according to the character information set.
In some embodiments, the specific implementation of steps 505 and 508 and the technical effects thereof can refer to steps 203 and 206 in the embodiments corresponding to fig. 2, which are not described herein again.
Step 509, generating an entity information set according to the character information set, the text information and the target named entity recognition model.
In some embodiments, the generating the entity information set by the executing entity according to the character information set, the text information and the target named entity recognition model may include:
firstly, coding each character information in the character information set to generate a character information vector, and obtaining a character information vector set.
The execution main body can encode each character information in the character information set through one-hot encoding to generate a character information vector, so that the character information vector set is obtained.
As an example, the above character information may be [ character: "person", character position information: (0, 1), the corresponding character information vector may be "0000000010000".
And secondly, encoding the text information to generate a text information vector.
First, the execution main body may encode each character in the text information by using one-hot encoding to generate a word vector, so as to obtain a word vector set. Then, the execution body may concatenate each word vector in the word vector set to generate the text information vector.
As an example, the above text information may be "personal information". The word vector corresponding to each character in the text information may be [ "0001", "0010", "0100", "1000" ]. The generated text information vector may be "0001001001001000".
And thirdly, splicing the text information vector and each character information vector in the character information vector set to generate an input vector, so as to obtain an input vector set.
As an example, the above-described character information vector set may be [ "0000000010000", "0000000000010", "0001000000000", "0000001000000" ]. The text information vector may be "0001001001001000". The resulting set of input vectors may be:
[“00010010010010000000000010000”,
“00010010010010000000000000010”,
“00010010010010000001000000000”,
“00010010010010000000001000000”]。
and fourthly, inputting the input vector set into the target named entity recognition model to generate the entity information set.
The target named entity recognition model can be obtained by training through the following steps: and adjusting model parameters of the initial named entity recognition model through a target domain training sample data set to generate the target named entity recognition model. And the length of the feature words included in the target domain training sample data set is not more than the target length. The target length may be 3. The initial named entity recognition model may be obtained by training a source domain training sample data set. The initial named entity model may be composed of a BERT (Bidirectional Encoder representation from converters) model, a CRF (conditional random field) model, and an LSTM (Long Short-Term Memory neural network) model.
The target domain training sample data set can be obtained through the following steps:
the first substep, performing feature mapping on each source domain training sample data in the source domain training sample data set to generate a source domain data vector, and obtaining a source domain data vector set.
The execution subject may perform feature mapping on the source domain training sample data through a target model to generate a source domain data vector. The target model may include: a first convolutional layer, a second convolutional layer, a third convolutional layer and a full link layer. The target model may use a Sigmoid function as an activation function.
And a second substep, performing feature mapping on each candidate training sample data in the candidate training sample data set to generate candidate training sample data vectors and obtain a candidate training sample data vector set.
The execution subject may perform feature mapping on the candidate training sample data through the target model to generate a candidate training sample data vector.
And a third substep, determining the similarity between each candidate training sample data vector in the candidate training sample data vector set and the source domain data vector in the source domain data vector set as a similarity numerical value, and obtaining a similarity numerical value set.
The executing body may determine similarity between the candidate training sample data vector and the source domain data vector in the source domain data vector set by a cosine similarity algorithm, so as to obtain a similarity value group.
And a fourth substep, for each candidate training sample data vector in the candidate training sample data vector set, determining the candidate training sample data corresponding to the candidate training sample data vector as the target domain training sample data in response to determining that the similarity value in the similarity value group corresponding to the candidate training sample data vector meets a preset condition.
The preset condition may be that the similarity value is greater than a target value. The above target value may be 0.9.
For each entity information in the set of entity information, determining a frequency of occurrence of the entity information in the set of entity information to generate a frequency value in response to determining that the entity information does not exist in the target dictionary, and adding the entity information to the target dictionary in response to determining that the frequency value is greater than the target frequency value, step 510.
In some embodiments, the execution subject determines, for each entity information in the set of entity information, a frequency of occurrence of the entity information in the set of entity information in response to determining that the entity information is not present in the target dictionary to generate a frequency value, and adds the entity information to the target dictionary in response to determining that the frequency value is greater than the target frequency value. The target dictionary may be a dictionary for storing entity information. The target frequency may be 5 times.
As can be seen from fig. 5, compared with the description of some embodiments corresponding to fig. 2, in the present disclosure, first, model parameter adjustment is performed on the initial named entity recognition model through the target domain training sample data set to generate the above target named entity recognition model. In practical situations, a large amount of training data is often required when training the entity recognition model. Labeling of training data often requires a significant amount of labor and time. And adjusting model parameters of the initial named entity recognition model to generate the target named entity recognition model. The training time of the model is reduced, and meanwhile, the required quantity of training data is less, so that the labor and time consumed by labeling of the training data are reduced. Secondly, in order to ensure the recognition accuracy of the trained target named entity recognition model. Candidate training sample data with higher similarity to the source domain training sample data is screened from the candidate training sample data set and used as target domain training sample data. Thereby greatly improving the prediction precision of the model. In addition, when the entity information set is generated through the target named entity recognition model, in order to ensure the character and the associated feature before the character, the text information vector and the character information vector are spliced to generate the input vector. In this way, not only the characteristics of each character are highlighted, but also the associated characteristics between the characters are reserved. And further, the accuracy of generating the entity information set is improved.
With further reference to fig. 6, as an implementation of the methods shown in the above figures, the present disclosure provides some embodiments of a named entity recognition apparatus based on a resume file, which correspond to those of the method embodiments shown in fig. 2, and which may be applied in various electronic devices in particular.
As shown in fig. 6, the named entity recognition apparatus 600 based on a resume file according to some embodiments includes: an acquisition unit 601, a first generation unit 602, an image segmentation unit 603, an image size normalization processing unit 604, a recognition unit 605, a second generation unit 606, and a third generation unit 607. Wherein, the obtaining unit 601 is configured to obtain a resume file; a first generating unit 602 configured to generate at least one text region image from the resume file in response to determining that the file type of the resume file is a target file type; an image segmentation unit 603 configured to perform image segmentation on each of the at least one text region image to generate a sub-text region image group, resulting in a sub-text region image group set; an image size normalization processing unit 604 configured to perform image size normalization processing on each sub-text region image in the above-described sub-text region image group set to generate a normalized text region image, resulting in a normalized text region image group set; an identifying unit 605 configured to identify a character included in each normalized text region image in the normalized text region image group set to generate a character information set, wherein the character information in the character information set includes: character and character position information; a second generating unit 606 configured to generate text information from the character information set; a third generating unit 607 configured to generate an entity information set according to the character information set, the text information, and the target named entity recognition model.
In some optional implementations of some embodiments, the first generating unit 602 is configured to: performing binarization processing on the resume file to generate a first candidate resume file; performing noise reduction processing on the first candidate resume file to generate a second candidate resume file; and performing text region segmentation on the second candidate resume file to generate the at least one text region image.
In some optional implementations of some embodiments, the first generating unit 602 is configured to: determining a text area in the second candidate resume file to obtain at least one text area; and clustering the text regions in the at least one text region to generate a text region image, so as to obtain the at least one text region image.
In some optional implementations of some embodiments, the third generating unit 607 is configured to: encoding each character information in the character information set to generate a character information vector to obtain a character information vector set, wherein the character information vector in the character information vector set is composed of a character vector and a character position information vector; encoding the text information to generate a text information vector; splicing the text information vector and each character information vector in the character information vector set to generate an input vector to obtain an input vector set; and inputting the input vector set into the target named entity recognition model to generate the entity information set.
In some optional implementations of some embodiments, the target named entity recognition model is obtained by the following training steps: and adjusting model parameters of the initial named entity recognition model through a target domain training sample data set to generate the target named entity recognition model, wherein the length of a feature word included in target domain training sample data in the target domain training sample data set is not more than the target length.
In some optional implementations of some embodiments, the target domain training sample data set is obtained by: performing feature mapping on each source domain training sample data in the source domain training sample data set to generate a source domain data vector to obtain a source domain data vector set; performing feature mapping on each candidate training sample data in the candidate training sample data set to generate candidate training sample data vectors to obtain a candidate training sample data vector set; determining the similarity between each candidate training sample data vector in the candidate training sample data vector set and the source domain data vector in the source domain data vector set as a similarity numerical value to obtain a similarity numerical value set; and for each candidate training sample data vector in the candidate training sample data vector set, determining the candidate training sample data corresponding to the candidate training sample data vector as the target domain training sample data in response to determining that the similarity degree value in the similarity degree value group corresponding to the candidate training sample data vector meets the preset condition.
In some optional implementations of some embodiments, the apparatus 600 further includes: for each entity information in the set of entity information, determining a frequency of occurrence of the entity information in the set of entity information in response to determining that the entity information is not present in the target dictionary to generate a frequency value, and adding the entity information to the target dictionary in response to determining that the frequency value is greater than a target frequency value.
It will be understood that the elements described in the apparatus 600 correspond to various steps in the method described with reference to fig. 2. Thus, the operations, features and resulting advantages described above with respect to the method are also applicable to the apparatus 600 and the units included therein, and are not described herein again.
Referring now to FIG. 7, a block diagram of an electronic device (such as computing device 101 shown in FIG. 1) 700 suitable for use in implementing some embodiments of the present disclosure is shown. The electronic device shown in fig. 7 is only an example, and should not bring any limitation to the functions and the scope of use of the embodiments of the present disclosure.
As shown in fig. 7, electronic device 700 may include a processing means (e.g., central processing unit, graphics processor, etc.) 701 that may perform various appropriate actions and processes in accordance with a program stored in a Read Only Memory (ROM) 702 or a program loaded from storage 708 into a Random Access Memory (RAM) 703. In the RAM 703, various programs and data necessary for the operation of the electronic apparatus 700 are also stored. The processing device 701, the ROM 702, and the RAM 703 are connected to each other by a bus 704. An input/output (I/O) interface 705 is also connected to bus 704.
Generally, the following devices may be connected to the I/O interface 705: input devices 706 including, for example, a touch screen, touch pad, keyboard, mouse, camera, microphone, accelerometer, gyroscope, etc.; an output device 707 including, for example, a Liquid Crystal Display (LCD), a speaker, a vibrator, and the like; storage 708 including, for example, magnetic tape, hard disk, etc.; and a communication device 709. The communication means 709 may allow the electronic device 700 to communicate wirelessly or by wire with other devices to exchange data. While fig. 7 illustrates an electronic device 700 having various means, it is to be understood that not all illustrated means are required to be implemented or provided. More or fewer devices may alternatively be implemented or provided. Each block shown in fig. 7 may represent one device or may represent multiple devices as desired.
In particular, according to some embodiments of the present disclosure, the processes described above with reference to the flow diagrams may be implemented as computer software programs. For example, some embodiments of the present disclosure include a computer program product comprising a computer program embodied on a computer readable medium, the computer program comprising program code for performing the method illustrated in the flow chart. In some such embodiments, the computer program may be downloaded and installed from a network via communications means 709, or may be installed from storage 708, or may be installed from ROM 702. The computer program, when executed by the processing device 701, performs the above-described functions defined in the methods of some embodiments of the present disclosure.
It should be noted that the computer readable medium described in some embodiments of the present disclosure may be a computer readable signal medium or a computer readable storage medium or any combination of the two. A computer readable storage medium may be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination of the foregoing. More specific examples of the computer readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing. In some embodiments of the disclosure, a computer readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device. In some embodiments of the present disclosure, however, a computer readable signal medium may include a propagated data signal with computer readable program code embodied therein, for example, in baseband or as part of a carrier wave. Such a propagated data signal may take many forms, including, but not limited to, electro-magnetic, optical, or any suitable combination thereof. A computer readable signal medium may also be any computer readable medium that is not a computer readable storage medium and that can communicate, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device. Program code embodied on a computer readable medium may be transmitted using any appropriate medium, including but not limited to: electrical wires, optical cables, RF (radio frequency), etc., or any suitable combination of the foregoing.
In some embodiments, the clients, servers may communicate using any currently known or future developed network Protocol, such as HTTP (HyperText Transfer Protocol), and may interconnect with any form or medium of digital data communication (e.g., a communications network). Examples of communication networks include a local area network ("LAN"), a wide area network ("WAN"), the Internet (e.g., the Internet), and peer-to-peer networks (e.g., ad hoc peer-to-peer networks), as well as any currently known or future developed network.
The computer readable medium may be embodied in the electronic device; or may exist separately without being assembled into the electronic device. The computer readable medium carries one or more programs which, when executed by the electronic device, cause the electronic device to: acquiring a resume file; in response to determining that the file type of the resume file is the target file type, generating at least one text area image according to the resume file; performing image segmentation on each text region image in the at least one text region image to generate a sub-text region image group to obtain a sub-text region image group set; performing image size normalization processing on each sub-text region image in the sub-text region image group set to generate a normalized text region image to obtain a normalized text region image group set; identifying characters included in each normalized text region image in the normalized text region image group set to generate a character information set, wherein the character information in the character information set includes: character and character position information; generating text information according to the character information set; and generating an entity information set according to the character information set, the text information and the target named entity recognition model.
Computer program code for carrying out operations for embodiments of the present disclosure may be written in any combination of one or more programming languages, including an object oriented programming language such as Java, Smalltalk, C + +, and conventional procedural programming languages, such as the "C" programming language or similar programming languages. The program code may execute entirely on the user's computer, partly on the user's computer, as a stand-alone software package, partly on the user's computer and partly on a remote computer or entirely on the remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer through any type of network, including a Local Area Network (LAN) or a Wide Area Network (WAN), or the connection may be made to an external computer (for example, through the Internet using an Internet service provider).
The flowchart and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of systems, methods and computer program products according to various embodiments of the present disclosure. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of code, which comprises one or more executable instructions for implementing the specified logical function(s). It should also be noted that, in some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams and/or flowchart illustration, and combinations of blocks in the block diagrams and/or flowchart illustration, can be implemented by special purpose hardware-based systems which perform the specified functions or acts, or combinations of special purpose hardware and computer instructions.
The units described in some embodiments of the present disclosure may be implemented by software, and may also be implemented by hardware. The described units may also be provided in a processor, and may be described as: a processor includes an acquisition unit, a first generation unit, an image segmentation unit, an image size normalization processing unit, a recognition unit, a second generation unit, and a third generation unit. Here, the names of these units do not constitute a limitation to the unit itself in some cases, and for example, the acquisition unit may also be described as "a unit that acquires a resume file".
The functions described herein above may be performed, at least in part, by one or more hardware logic components. For example, without limitation, exemplary types of hardware logic components that may be used include: field Programmable Gate Arrays (FPGAs), Application Specific Integrated Circuits (ASICs), Application Specific Standard Products (ASSPs), systems on a chip (SOCs), Complex Programmable Logic Devices (CPLDs), and the like.
The foregoing description is only exemplary of the preferred embodiments of the disclosure and is illustrative of the principles of the technology employed. It will be appreciated by those skilled in the art that the scope of the invention in the embodiments of the present disclosure is not limited to the specific combination of the above-mentioned features, but also encompasses other embodiments in which any combination of the above-mentioned features or their equivalents is made without departing from the inventive concept as defined above. For example, the above features and (but not limited to) technical features with similar functions disclosed in the embodiments of the present disclosure are mutually replaced to form the technical solution.