Named entity recognition method and device based on language model

Through language model-based methods, primary and larger-scale language models are used to perform named entity recognition on long texts, which solves the problem of poor long text recognition in the existing technology and achieves more efficient and consistent recognition results.

CN118313383BActive Publication Date: 2024-08-23BEIJING SABISI INTELLIGENT TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410743846.8
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-06-11
Publication Date
2024-08-23
Estimated Expiration
2044-06-11

AI Technical Summary

Technical Problem

The existing technology has poor performance in long text named entity recognition, especially in long contexts, it is difficult to ensure the consistency of recognition results.

Method used

Using a language model-based method, the text to be recognized is obtained and divided into sentence sets according to sentence fragmentation symbols. The primary language model is used for pre-recognition, and sentences that need further processing are screened out. Local and global sentence sets are combined to use a larger-scale language. The model is re-identified.

Benefits of technology

The accuracy and consistency of long text named entity recognition are improved, the workload is reduced, and the recognition efficiency is improved.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118313383B
    Figure CN118313383B
Patent Text Reader

Abstract

The present application provides a method and device for named entity recognition based on a language model. The method includes: obtaining a text to be subjected to named entity recognition, dividing the text according to the sentence segmentation symbols in the text, and obtaining a first sentence set; performing named entity recognition on each sentence in the first sentence set using a first language model, and obtaining a pre-recognition result; screening the first sentence set according to the pre-recognition result, and obtaining a second sentence set; determining the local sentence set and the global sentence set of each sentence in the second sentence set from the first sentence set; based on the local sentence set and the global sentence set of each sentence in the second sentence set, performing named entity recognition on each sentence in the second sentence set using a second language model, and obtaining a re-recognition result. The above technical means are used to solve the problem of poor named entity recognition effect of long texts in the prior art.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the technical field of named entity recognition, and in particular to a method and device for named entity recognition based on a language model. Background Art

[0002] With the in-depth development of digital and intelligent technologies in various fields, more intelligent devices are playing a role in life. Various intelligent voice devices, such as smart speakers, smart phones, smart robots and other devices, already support voice conversations. There are various conversation scenarios, including hotels, supermarkets, hospitals, office buildings, etc. In different scenarios, there may be corresponding named entities (names of people, places, names of institutions, etc.). The discovery and recognition of entities is a very important part. It is particularly important to discover potential named entities in a timely manner. Because generally speaking, named entities will be the content of more concern in conversations. If they cannot be effectively understood, it will seriously hinder the progress of the conversation and bring a bad experience to users. The currently commonly used named entity recognition methods have poor recognition effects, especially for long texts. It is even more difficult to ensure the consistency of recognition results under such a long context relationship. Summary of the invention

[0003] In view of this, the embodiments of the present application provide a method, device, electronic device and computer-readable storage medium for named entity recognition based on a language model to solve the problem of poor named entity recognition effect of long texts in the prior art.

[0004] In a first aspect of an embodiment of the present application, a method for named entity recognition based on a language model is provided, comprising: obtaining a text to be subjected to named entity recognition, dividing the text according to sentence segmentation symbols in the text to obtain a first sentence set, wherein the first sentence set includes multiple sentences; performing named entity recognition on each sentence in the first sentence set using a first language model to obtain a pre-recognition result; screening the first sentence set according to the pre-recognition result to obtain a second sentence set, wherein the second sentence set includes multiple sentences, and the number of sentences in the second sentence set is less than or equal to the number of sentences in the first sentence set; determining a local sentence set and a global sentence set of each sentence in the second sentence set from the first sentence set; performing named entity recognition on each sentence in the second sentence set using a second language model based on the local sentence set and the global sentence set of each sentence in the second sentence set to obtain a re-recognition result, wherein the model scale of the first language model is smaller than the model scale of the second language model.

[0005] According to a second aspect of an embodiment of the present application, a language model-based named entity recognition device is provided, comprising: a segmentation module, configured to obtain a text to be subjected to named entity recognition, and to segment the text according to sentence segmentation symbols in the text to obtain a first sentence set, wherein the first sentence set includes a plurality of sentences; a pre-recognition module, configured to perform named entity recognition on each sentence in the first sentence set using a first language model to obtain a pre-recognition result; a screening module, configured to screen the first sentence set according to the pre-recognition result to obtain a second sentence set, wherein the second sentence set includes a plurality of sentences, and the number of sentences in the second sentence set is less than or equal to the number of sentences in the first sentence set; a determination module, configured to determine a local sentence set and a global sentence set of each sentence in the second sentence set from the first sentence set; and a re-recognition module, configured to perform named entity recognition on each sentence in the second sentence set using a second language model based on the local sentence set and the global sentence set of each sentence in the second sentence set to obtain a re-recognition result, wherein the model scale of the first language model is smaller than the model scale of the second language model.

[0006] According to a third aspect of an embodiment of the present application, an electronic device is provided, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the steps of the above method when executing the computer program.

[0007] According to a fourth aspect of an embodiment of the present application, a computer-readable storage medium is provided, which stores a computer program, and when the computer program is executed by a processor, the steps of the above method are implemented.

[0008] Compared with the prior art, the embodiments of the present application have the following beneficial effects: obtaining a text to be subjected to named entity recognition, dividing the text according to the sentence segmentation symbols in the text, and obtaining a first sentence set, wherein the first sentence set includes multiple sentences; performing named entity recognition on each sentence in the first sentence set using a first language model, and obtaining a pre-recognition result; screening the first sentence set according to the pre-recognition result, and obtaining a second sentence set, wherein the second sentence set includes multiple sentences, and the number of sentences in the second sentence set is less than or equal to the number of sentences in the first sentence set; determining the local sentence set and the global sentence set of each sentence in the second sentence set from the first sentence set; based on the local sentence set and the global sentence set of each sentence in the second sentence set, performing named entity recognition on each sentence in the second sentence set using a second language model, and obtaining a re-recognition result, wherein the model scale of the first language model is smaller than the model scale of the second language model. The above technical means can solve the problem of poor named entity recognition effect of long texts in the prior art, thereby improving the named entity recognition effect of long texts. BRIEF DESCRIPTION OF THE DRAWINGS

[0009] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings in the following description are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.

[0010] Figure 1 It is a flowchart of a method for named entity recognition based on a language model provided by an embodiment of the present application;

[0011] Figure 2 It is a flowchart of a statement set screening method provided by an embodiment of the present application;

[0012] Figure 3 The present invention provides a schematic diagram of a structure of a named entity recognition device based on a language model.

[0013] Figure 4 This is a schematic diagram of the structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0014] In the following description, specific details such as specific system structures and technologies are provided for the purpose of illustration rather than limitation, so as to provide a thorough understanding of the embodiments of the present application. However, it should be clear to those skilled in the art that the present application can also be implemented in other embodiments without these specific details. In other cases, detailed descriptions of well-known systems, devices, circuits, and methods are omitted to prevent unnecessary details from obstructing the description of the present application.

[0015] A method and device for named entity recognition based on a language model according to an embodiment of the present application will be described in detail below with reference to the accompanying drawings.

[0016] Figure 1 The present invention provides a flowchart of a method for named entity recognition based on a language model. Figure 1 The named entity recognition method based on the language model can be executed by a computer or a server, or by software on the computer or the server. Figure 1 As shown, the language model-based named entity recognition method includes:

[0017] S101, obtaining a text to be subjected to named entity recognition, dividing the text according to sentence segmentation symbols in the text, and obtaining a first sentence set, wherein the first sentence set includes a plurality of sentences;

[0018] S102, performing named entity recognition on each sentence in the first sentence set using the first language model to obtain a pre-recognition result;

[0019] S103, screening the first statement set according to the pre-recognition result to obtain a second statement set, wherein the second statement set includes multiple statements, and the number of statements in the second statement set is less than or equal to the number of statements in the first statement set;

[0020] S104, determining a local sentence set and a global sentence set of each sentence in the second sentence set from the first sentence set;

[0021] S105, based on the local sentence set and the global sentence set of each sentence in the second sentence set, using the second language model to perform named entity recognition on each sentence in the second sentence set to obtain a re-recognition result, wherein the model scale of the first language model is smaller than the model scale of the second language model.

[0022] Named Entity (NE) is an important concept in natural language processing (NLP), which usually refers to a noun phrase or proper noun in a text that has a specific meaning or refers to a specific object. These entities can be names of people, places, organizations, dates, times, quantities, currencies, percentages, etc.

[0023] Sentence segmentation symbols include period, question mark, exclamation mark and other symbols. The text is divided into multiple sentences according to the sentence segmentation symbols, and the first sentence set is obtained. The first language model performs initial recognition on each sentence in the first sentence set to obtain the pre-recognition result of named entity recognition. The first sentence set is screened using the pre-recognition result to obtain the second sentence set. This process can delete the sentences that do not need to be recognized by named entities, reducing the subsequent workload. The local sentence set and the global sentence set of each sentence in the second sentence set are determined from the first sentence set, and the local sentence set and the global sentence set of each sentence are used as the context information of the sentence. The second language model is used to re-recognize the sentence in the second sentence set to obtain the re-recognition result of named entity recognition. Generally, the first language model can use a language model with a smaller model scale, and the second language model can use a language model with a larger model scale. For example, the first language model uses the BERT (Bidirectional Encoder Representations from Transformers) model, and the second language model uses the GPT-4V (GPT-4 with vision).

[0024] According to the technical solution provided by the embodiment of the present application, a text to be subjected to named entity recognition is obtained, the text is divided according to the sentence segmentation symbols in the text, and a first sentence set is obtained, wherein the first sentence set includes multiple sentences; the first language model is used to perform named entity recognition on each sentence in the first sentence set to obtain a pre-recognition result; the first sentence set is screened according to the pre-recognition result to obtain a second sentence set, wherein the second sentence set includes multiple sentences, and the number of sentences in the second sentence set is less than or equal to the number of sentences in the first sentence set; the local sentence set and the global sentence set of each sentence in the second sentence set are determined from the first sentence set; based on the local sentence set and the global sentence set of each sentence in the second sentence set, the second language model is used to perform named entity recognition on each sentence in the second sentence set to obtain a re-recognition result, wherein the model scale of the first language model is smaller than the model scale of the second language model. The above technical means can solve the problem of poor named entity recognition effect of long text in the prior art, thereby improving the named entity recognition effect of long text.

[0025] Figure 2 is a flow chart of a method for filtering a statement set provided by an embodiment of the present application, such as Figure 2 As shown, the method includes:

[0026] The pre-recognition result includes the named entities appearing in each sentence in the first sentence set that are recognized;

[0027] S201, determining whether any named entity appears in each statement in the first statement set;

[0028] S202, if it appears, keep the statement;

[0029] S203, if not, determining whether any word greater than a preset byte length in any named entity appears in the sentence;

[0030] S204, if it appears, keep the statement;

[0031] S205: If it does not appear, delete the statement.

[0032] As long as a previously identified named entity appears in a sentence, the sentence is retained. For sentences that do not contain a whole named entity, continue to determine whether the sentence contains a word in the named entity that is greater than the preset byte length. For example, if a named entity is "Yangtze River Bridge", "Yangtze River Bridge" does not appear in the sentence, but "Yangtze River" appears. If so, the sentence is retained. If the sentence does not contain even some words in the named entity, the sentence is deleted.

[0033] Furthermore, a local sentence set of each statement in the second statement set is determined from the first statement set, including: determining the first K statements and the last K statements of each statement in the second statement set from the first statement set; and using the determined 2K statements of each statement in the second statement set as the local sentence set of the statement.

[0034] When the text is divided to obtain the first sentence set, the multiple sentences in the first sentence set are in order, and the order of each sentence is its position in the text. The first K sentences and the last K sentences of each sentence in the second sentence set can be found from the first sentence set to obtain the local sentence set of the sentence.

[0035] Furthermore, a global sentence set of each statement in the second statement set is determined from the first statement set, including: a pre-recognition result includes the named entities appearing in each statement in the first statement set that are identified; for each statement in the first statement set: based on the named entity appearing in the statement, a global search is performed on the first statement set to determine the K statements with the highest similarity to the named entity appearing in the statement; based on the statement, a global search is performed on the first statement set to determine the K statements with the highest similarity to the statement; and the determined 2K statements of the statement are used as the global sentence set of the statement.

[0036] BM25 (Best Matching 25) can be used as a global search algorithm. BM25 is an algorithm used for information retrieval and text mining. Based on the named entities that appear in the sentence, a global search is performed on the first sentence set to determine the sentences containing the K named entities that are closest to the named entity (with the highest similarity), thus obtaining K sentences. Then, based on the sentence, a global search is performed on the first sentence set to determine the K sentences that are closest to the sentence again. The 2K sentences determined for the sentence are used as the global sentence set for the sentence.

[0037] In an optional embodiment, 2K sentences of the sentence are deduplicated, and then the remaining sentences after deduplication are sorted according to the order of the sentences in the first sentence set, and the first K sentences after sorting are used as the global sentence set of the sentence.

[0038] Furthermore, based on the local sentence set and the global sentence set of each sentence in the second sentence set, named entity recognition is performed on each sentence in the second sentence set using a second language model to obtain a re-recognition result, including: for each sentence in the second sentence set: taking the local sentence set and the global sentence set of the sentence as context information of the sentence, performing named entity recognition on the sentence based on the context information of the sentence using the second language model to obtain a re-recognition result of the sentence.

[0039] The command that the user gives to the second language model can be to perform named entity recognition on the sentence based on the local sentence set and the global sentence set of the sentence. The advantage of doing this is that the re-recognition result of the sentence can be improved based on the context information of the sentence to ensure the consistency of the recognition result under a longer context relationship. For example, the word "apple" that appears in a sentence may be a fruit or a company name. Then, based on the context information of the sentence, it can be further determined whether the word "apple" is a fruit or a company name.

[0040] In an optional embodiment, the pre-recognition result includes sentences and named entities appearing therein. Based on the local sentence set and the global sentence set of each sentence in the second sentence set, the pre-recognition result is corrected for the named entities using the second language model to obtain a re-recognition result.

[0041] The difference of the embodiment of the present application is that a second language model is used to perform named entity recognition based on the pre-recognition results, which can reduce workload and improve efficiency.

[0042] Furthermore, based on the local sentence set and the global sentence set of each sentence in the second sentence set, named entity recognition is performed on each sentence in the second sentence set using a second language model. After the re-recognition result is obtained, the method also includes: the re-recognition result includes the named entities appearing in each sentence in the second sentence set that have been identified, and named entity recognition for a sentence is to identify a word in the sentence as a corresponding named entity; for each sentence in the second sentence set, verifying whether it is correct to identify a word in the sentence as a corresponding named entity according to the following method: using the word as the named entity as a search word, searching using a search engine, and obtaining the heat frequency of the word as the named entity; using the word as the search word, searching using a search engine, and obtaining the heat frequency of the word; determining whether it is correct to identify the word as the named entity based on the ratio of the heat frequency of the word as the named entity to the heat frequency of the word.

[0043] A word appears in a sentence , identify the word as a person, place, or organization, etc., then the corresponding:

[0044] by" "I am a character" is the search term, use the search engine to search, and return the number of relevant results found , which represents the It could be the popularity frequency of a person's name; or

[0045] by" is a place" as the search term, use the search engine to search, and return the number of relevant results found , which represents the It may be the popularity frequency of a place name; or

[0046] by" is an organization" as the search term, use the search engine to search, and return the number of relevant results found , which represents the It may be the popularity frequency of an institution’s name.

[0047] Hot frequency is the frequency of the search term appearing in the search results.

[0048] by" What is it? is used as the search term, and the search engine is used to search and return the number of relevant results found. , which represents the It is the popularity frequency of a common word.

[0049] Furthermore, whether the word is correctly identified as the named entity is determined based on the ratio of the heat frequency of the word as the named entity and the heat frequency of the word, including: calculating the ratio of the heat frequency of the word as the named entity and the heat frequency of the word; when the ratio is greater than a preset ratio, determining that the word is correctly identified as the named entity; when the ratio is less than or equal to the preset ratio, determining that the word is incorrectly identified as the named entity.

[0050] for example is identified as a person, then the ratio r is calculated = When r is greater than a preset ratio, it is determined that the word is correctly identified as the named entity; otherwise, it is determined that the word is incorrectly identified as the named entity.

[0051] All the above-mentioned optional technical solutions can be arbitrarily combined to form optional embodiments of the present application, which will not be described one by one here.

[0052] The following is an embodiment of the device of the present application, which can be used to execute the embodiment of the method of the present application. For details not disclosed in the embodiment of the device of the present application, please refer to the embodiment of the method of the present application.

[0053] Figure 3 FIG. 1 is a schematic diagram of a named entity recognition device based on a language model provided by an embodiment of the present application. Figure 3As shown, the named entity recognition device based on the language model includes:

[0054] The division module 301 is configured to obtain a text to be subjected to named entity recognition, divide the text according to the sentence segmentation symbols in the text, and obtain a first sentence set, wherein the first sentence set includes a plurality of sentences;

[0055] A pre-recognition module 302 is configured to perform named entity recognition on each sentence in the first sentence set using a first language model to obtain a pre-recognition result;

[0056] A screening module 303 is configured to screen the first statement set according to the pre-recognition result to obtain a second statement set, wherein the second statement set includes multiple statements, and the number of statements in the second statement set is less than or equal to the number of statements in the first statement set;

[0057] A determination module 304 is configured to determine, from the first sentence set, a local sentence set and a global sentence set of each sentence in the second sentence set;

[0058] The re-recognition module 305 is configured to perform named entity recognition on each sentence in the second sentence set using a second language model based on a local sentence set and a global sentence set of each sentence in the second sentence set to obtain a re-recognition result, wherein the model scale of the first language model is smaller than the model scale of the second language model.

[0059] According to the technical solution provided by the embodiment of the present application, a text to be subjected to named entity recognition is obtained, the text is divided according to the sentence segmentation symbols in the text, and a first sentence set is obtained, wherein the first sentence set includes multiple sentences; the first language model is used to perform named entity recognition on each sentence in the first sentence set to obtain a pre-recognition result; the first sentence set is screened according to the pre-recognition result to obtain a second sentence set, wherein the second sentence set includes multiple sentences, and the number of sentences in the second sentence set is less than or equal to the number of sentences in the first sentence set; the local sentence set and the global sentence set of each sentence in the second sentence set are determined from the first sentence set; based on the local sentence set and the global sentence set of each sentence in the second sentence set, the second language model is used to perform named entity recognition on each sentence in the second sentence set to obtain a re-recognition result, wherein the model scale of the first language model is smaller than the model scale of the second language model. The above technical means can solve the problem of poor named entity recognition effect of long text in the prior art, thereby improving the named entity recognition effect of long text.

[0060] In some embodiments, the screening module 303 is further configured to pre-recognize the named entities appearing in each statement in the first sentence set included in the pre-recognized results; determine whether any named entity appears in each statement in the first sentence set; if so, retain the statement; if not, determine whether any word greater than a preset byte length appears in any named entity in the statement; if so, retain the statement; if not, delete the statement.

[0061] In some embodiments, the determination module 304 is further configured to determine the first K statements and the last K statements of each statement in the second statement set from the first statement set; and use the determined 2K statements of each statement in the second statement set as the local sentence set of the statement.

[0062] In some embodiments, the determination module 304 is also configured to pre-recognize that the results include named entities appearing in each sentence in the identified first sentence set; for each sentence in the first sentence set: based on the named entity appearing in the sentence, perform a global search on the first sentence set to determine the K sentences with the highest similarity to the named entity appearing in the sentence; based on the sentence, perform a global search on the first sentence set to determine the K sentences with the highest similarity to the sentence; and use the determined 2K sentences of the sentence as the global sentence set of the sentence.

[0063] In some embodiments, the determination module 304 is also configured to deduplicate 2K statements of the statement, and then sort the remaining statements after deduplication of the statement according to the order of the statements in the first statement set, and after sorting, the first K statements are used as the global sentence set of the statement.

[0064] In some embodiments, the re-recognition module 305 is further configured to: for each statement in the second sentence set: use the local sentence set and the global sentence set of the statement as context information of the statement, use the second language model to perform named entity recognition on the statement based on the context information of the statement, and obtain a re-recognition result of the statement.

[0065] In some embodiments, the re-recognition module 305 is further configured such that the pre-recognition result includes sentences and named entities appearing therein. Based on the local sentence set and the global sentence set of each sentence in the second sentence set, the pre-recognition result is corrected for the named entities using the second language model to obtain a re-recognition result.

[0066] In some embodiments, the re-identification module 305 is further configured to include in the re-identification results the named entities that appear in each sentence in the identified second sentence set, and performing named entity recognition on a sentence is to identify a word in the sentence as a corresponding named entity; for each sentence in the second sentence set, verify whether the recognition of a word in the sentence as a corresponding named entity is correct according to the following method: using the word as the named entity as the search word, searching using a search engine, and obtaining the heat frequency of the word as the named entity; using the word as the search word, searching using a search engine, and obtaining the heat frequency of the word; determining whether the recognition of the word as the named entity is correct based on the ratio of the heat frequency of the word as the named entity and the heat frequency of the word.

[0067] In some embodiments, the re-identification module 305 is also configured to calculate the ratio of the heat frequency of the word as the named entity and the heat frequency of the word; when the ratio is greater than a preset ratio, it is determined that the word is correctly identified as the named entity; when the ratio is less than or equal to the preset ratio, it is determined that the word is incorrectly identified as the named entity.

[0068] It should be understood that the sequence numbers of the steps in the above embodiments do not imply a sequence of execution. The execution sequence of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of the present application.

[0069] Figure 4 Schematic diagram of electronic device 4 provided in the embodiment of the present application. Figure 4 As shown, the electronic device 4 of this embodiment includes: a processor 401, a memory 402, and a computer program 403 stored in the memory 402 and capable of running on the processor 401. When the processor 401 executes the computer program 403, the steps in the above-mentioned method embodiments are implemented. Alternatively, when the processor 401 executes the computer program 403, the functions of each module / unit in the above-mentioned device embodiments are implemented.

[0070] The electronic device 4 may be a desktop computer, a notebook, a PDA, a cloud server, or other electronic device. The electronic device 4 may include, but is not limited to, a processor 401 and a memory 402. Those skilled in the art will appreciate that Figure 4 The electronic device 4 is merely an example and does not limit the electronic device 4 , which may include more or fewer components than those shown in the figure, or different components.

[0071] The processor 401 may be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc.

[0072] The memory 402 may be an internal storage unit of the electronic device 4, for example, a hard disk or memory of the electronic device 4. The memory 402 may also be an external storage device of the electronic device 4, for example, the electronic device 4 is equipped with a plug-in hard disk, a smart memory card (Smart Media Card, SMC), a secure digital (Secure Digital, SD) card, a flash card (Flash Card), etc. The memory 402 may also include both an internal storage unit of the electronic device 4 and an external storage device. The memory 402 is used to store computer programs and other programs and data required by the electronic device.

[0073] Those skilled in the art can clearly understand that, for the convenience and simplicity of description, only the above-mentioned functional units and module divisions are used as examples for illustration. In practical applications, the above-mentioned functions can be assigned to different functional units and modules as needed, that is, the internal structure of the device can be divided into different functional units or modules to complete all or part of the functions described above. In the embodiment, each functional unit and module can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit, and the above-mentioned integrated unit can be implemented in the form of hardware or in the form of software functional units.

[0074] If the integrated module / unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the present application implements all or part of the process in the above-mentioned embodiment method, and can also be completed by instructing the relevant hardware through a computer program. The computer program can be stored in a computer-readable storage medium, and the computer program can implement the above-mentioned various method embodiment steps when executed by the processor. The computer program may include computer program code, and the computer program code may be in source code form, object code form, executable file or some intermediate form. The computer-readable medium may include: any entity or device capable of carrying computer program code, recording medium, U disk, mobile hard disk, magnetic disk, optical disk, computer memory, read-only memory (ROM), random access memory (RAM), electric carrier signal, telecommunication signal and software distribution medium. It should be noted that the content contained in the computer-readable medium can be appropriately increased or decreased according to the requirements of legislation and patent practice in the jurisdiction. For example, in some jurisdictions, according to legislation and patent practice, the computer-readable medium does not include electric carrier signals and telecommunication signals.

[0075] The above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit them. Although the present application has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or replace some of the technical features therein by equivalents. These modifications or replacements do not essentially deviate the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present application, and should all be included in the protection scope of the present application.

Claims

1. A method for named entity recognition based on a language model, characterized in that: include: Acquire a text to be subjected to named entity recognition, divide the text according to sentence segmentation symbols in the text, and obtain a first sentence set, wherein the first sentence set includes a plurality of sentences; Using a first language model to perform the named entity recognition on each sentence in the first sentence set to obtain a pre-recognition result; Filtering the first statement set according to the pre-recognition result to obtain a second statement set, wherein the second statement set includes a plurality of statements, and the number of statements in the second statement set is less than or equal to the number of statements in the first statement set; Determining, from the first sentence set, a local sentence set and a global sentence set for each sentence in the second sentence set; Based on the local sentence set and the global sentence set of each sentence in the second sentence set, using a second language model to perform the named entity recognition on each sentence in the second sentence set to obtain a re-recognition result, wherein the model scale of the first language model is smaller than the model scale of the second language model; Wherein, determining the local sentence set of each statement in the second statement set from the first statement set includes: determining the first K statements and the last K statements of each statement in the second statement set from the first statement set; using the determined 2K statements of each statement in the second statement set as the local sentence set of the statement; Among them, determining a global sentence set of each statement in the second statement set from the first statement set includes: the pre-recognition result includes the named entities appearing in each statement in the first statement set that are identified; for each statement in the first statement set: based on the named entity appearing in the statement, performing a global search on the first statement set to determine the K statements with the highest similarity to the named entity appearing in the statement; based on the statement, performing a global search on the first statement set to determine the K statements with the highest similarity to the statement; and using the determined 2K statements of the statement as the global sentence set of the statement.

2. The method according to claim 1, characterized in that: The first sentence set is screened according to the pre-recognition result to obtain a second sentence set, including: The pre-recognition result includes the named entities that appear in each sentence in the first sentence set that are recognized; Determine whether any named entity appears in each statement in the first statement set, and if so, retain the statement; If not, determine whether the sentence contains any word greater than the preset byte length in any named entity. If so, retain the sentence; if not, delete the sentence.

3. The method according to claim 1, characterized in that: Based on the local sentence set and the global sentence set of each sentence in the second sentence set, the named entity recognition is performed on each sentence in the second sentence set by using a second language model to obtain a re-recognition result, including: For each statement in the second statement set: The local sentence set and the global sentence set of the sentence are used as the context information of the sentence, and the second language model is used to perform the named entity recognition on the sentence based on the context information of the sentence to obtain a re-recognition result of the sentence.

4. The method according to claim 1, characterized in that: Based on the local sentence set and the global sentence set of each sentence in the second sentence set, the named entity recognition is performed on each sentence in the second sentence set using a second language model, and after obtaining the re-recognition result, the method further includes: The re-recognition result includes the named entities appearing in each sentence in the second sentence set, and the named entity recognition for a sentence is to recognize a word in the sentence as a corresponding named entity; For each sentence in the second sentence set, verify whether a word in the sentence is correctly identified as a corresponding named entity in the following manner: Using the word as the named entity as the search word, search using a search engine to obtain the frequency of popularity of the word as the named entity; Using the word as a search word, searching using the search engine to obtain the popularity frequency of the word; Whether the word is correctly identified as the named entity is determined based on the ratio of the heat frequency of the word as the named entity and the heat frequency of the word.

5. The method according to claim 4, characterized in that: Determining whether identifying the word as the named entity is correct based on the ratio of the heat frequency of the word as the named entity and the heat frequency of the word includes: Calculate the ratio of the heat frequency of the word as the named entity to the heat frequency of the word; When the ratio is greater than a preset ratio, it is determined that the word is correctly identified as the named entity; When the ratio is less than or equal to a preset ratio, it is determined that the word is recognized as the named entity error.

6. A named entity recognition device based on a language model, characterized in that: include: A segmentation module is configured to obtain a text to be subjected to named entity recognition, and segment the text according to sentence segmentation symbols in the text to obtain a first sentence set, wherein the first sentence set includes a plurality of sentences; a pre-recognition module configured to perform the named entity recognition on each sentence in the first sentence set using a first language model to obtain a pre-recognition result; a screening module configured to screen the first statement set according to the pre-recognition result to obtain a second statement set, wherein the second statement set includes a plurality of statements, and the number of statements in the second statement set is less than or equal to the number of statements in the first statement set; a determination module, configured to determine, from the first sentence set, a local sentence set and a global sentence set of each sentence in the second sentence set; a re-recognition module configured to perform the named entity recognition on each sentence in the second sentence set using a second language model based on a local sentence set and a global sentence set of each sentence in the second sentence set to obtain a re-recognition result, wherein a model scale of the first language model is smaller than a model scale of the second language model; The determination module is further configured to determine the first K sentences and the last K sentences of each sentence in the second sentence set from the first sentence set; and use the determined 2K sentences of each sentence in the second sentence set as the local sentence set of the sentence; The determination module is also configured so that the pre-recognition result includes the named entities appearing in each sentence in the first sentence set that are identified; for each sentence in the first sentence set: based on the named entity appearing in the sentence, a global search is performed on the first sentence set to determine the K sentences with the highest similarity to the named entity appearing in the sentence; based on the sentence, a global search is performed on the first sentence set to determine the K sentences with the highest similarity to the sentence; and the determined 2K sentences of the sentence are used as the global sentence set of the sentence.

7. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 5 are implemented.

8. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 5 are implemented.