WO2022048210A1 - 命名实体识别方法、装置、电子设备及可读存储介质 - Google Patents

命名实体识别方法、装置、电子设备及可读存储介质 Download PDF

Info

Publication number
WO2022048210A1
WO2022048210A1 PCT/CN2021/097069 CN2021097069W WO2022048210A1 WO 2022048210 A1 WO2022048210 A1 WO 2022048210A1 CN 2021097069 W CN2021097069 W CN 2021097069W WO 2022048210 A1 WO2022048210 A1 WO 2022048210A1
Authority
WO
WIPO (PCT)
Prior art keywords
named entity
category
entity category
sub
recognition model
Prior art date
Application number
PCT/CN2021/097069
Other languages
English (en)
French (fr)
Inventor
刘玉
徐国强
Original Assignee
平安科技(深圳)有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 平安科技(深圳)有限公司 filed Critical 平安科技(深圳)有限公司
Publication of WO2022048210A1 publication Critical patent/WO2022048210A1/zh

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F40/00Handling natural language data
    • G06F40/20Natural language analysis
    • G06F40/279Recognition of textual entities
    • G06F40/289Phrasal analysis, e.g. finite state techniques or chunking
    • G06F40/295Named entity recognition

Definitions

  • the present application relates to the field of data processing, and in particular, to a named entity identification method, apparatus, electronic device, and readable storage medium.
  • named entity recognition is the basic task of natural language processing applications such as information retrieval, machine translation, automatic question answering, sentiment analysis, etc. It is of great significance to the research of named entity recognition.
  • the inventor realizes that currently, there are few datasets related to named entities, and the named entity categories marked by different datasets are different, so it is impossible to directly mix the existing datasets to train the named entity model, and it is time-consuming to manually label the datasets. It is laborious, resulting in inefficient acquisition of named entity data sets; at the same time, a single statistical-based model is usually used as a named entity recognition model to identify different named entities. Due to the different structures and lengths of different named entities, the models are not named. The recognition accuracy of the entity is not high enough. Therefore, there is an urgent need for a named entity recognition method to improve the acquisition efficiency of named entity datasets and the accuracy of named entity recognition.
  • the named entity recognition method provided by this application includes:
  • the named entity recognition model includes a plurality of output branches, each output branch corresponds to a named entity category, and the sub-data sets corresponding to each named entity category are input into the named entity recognition model for training, Get the trained named entity recognition model;
  • the present application also provides a named entity identification device, the device comprising:
  • an extraction module configured to obtain multiple datasets from the database, and perform named entity category extraction on the multiple datasets to obtain sub datasets corresponding to each named entity category;
  • a training module for constructing a named entity recognition model the named entity recognition model includes a plurality of output branches, each output branch corresponds to a named entity category, and the sub-data sets corresponding to the named entity categories are input into the named entity
  • the recognition model is trained to obtain a trained named entity recognition model
  • a request module configured to respond to a named entity identification request sent by a user based on the client, parse the request, and obtain the identification text of the entity to be named and the target named entity category carried by the request;
  • the output module is configured to input the text to be recognized as the named entity recognition model, and use the recognition result output by the output branch corresponding to the target named entity category as the target recognition of the text to be recognized. result.
  • the present application also provides an electronic device, the electronic device comprising:
  • the memory stores a named entity recognition program executable by the at least one processor, the named entity recognition program being executed by the at least one processor to enable the at least one processor to perform the following steps:
  • the named entity recognition model includes a plurality of output branches, each output branch corresponds to a named entity category, and the sub-data sets corresponding to each named entity category are input into the named entity recognition model for training, Get the trained named entity recognition model;
  • the present application also provides a computer-readable storage medium on which a named entity identification program is stored, and the named entity identification program can be executed by one or more processors to implement the following steps:
  • the named entity recognition model includes a plurality of output branches, each output branch corresponds to a named entity category, and the sub-data sets corresponding to each named entity category are input into the named entity recognition model for training, Get the trained named entity recognition model;
  • FIG. 1 is a schematic flowchart of a named entity identification method provided by an embodiment of the present application.
  • FIG. 2 is a schematic block diagram of a named entity identification device provided by an embodiment of the present application.
  • FIG. 3 is a schematic structural diagram of an electronic device implementing a named entity identification method provided by an embodiment of the present application
  • the present application provides a named entity recognition method.
  • FIG. 1 it is a schematic flowchart of a named entity identification method according to an embodiment of the present application.
  • the method may be performed by an electronic device, which may be implemented by software and/or hardware.
  • the named entity recognition method includes:
  • S1 obtain multiple datasets from the database, perform named entity category extraction on the multiple datasets to obtain sub datasets corresponding to each named entity category;
  • Named entities are names of people, institutions, places, and all other entities identified by names. For example, named entities also include numbers, dates, currencies, addresses, and so on.
  • the multiple datasets are datasets with label information related to named entity recognition collected from the Internet, such as MSRA, People's Daily, Weibo, CLUENER, BOSON and other datasets.
  • the purpose of this step is to fuse each data set to form a large data set with a suitable amount of data for training the named entity recognition model.
  • the label information carried by each data set in the multiple data sets is converted from the initial label format to the preset label format
  • the initial annotation formats of the collected datasets may not be uniform.
  • the initial annotation formats include BIOES, BMES, and BIO.
  • the annotation format of the CLUENER dataset is BIOES
  • the annotation format of the Weibo dataset is BMES
  • the annotation format of the daily dataset is BIO.
  • BIOES in BIOES means at the beginning of a named entity
  • I (inside) means at the inside of a named entity
  • O (outside) means a non-named entity
  • E (end) means at the end of a named entity
  • S (single) means A single character is a named entity, for example, I am Cantonese is marked as I/Sis/SGuang/Bdong/Iren/E.
  • B in BMES means at the beginning of a named entity
  • M (middle) means at the middle of a named entity
  • E means at the end of a named entity
  • S means a single character is a named entity.
  • the B in BIO represents the beginning of the named entity, the I represents the tail of the named entity, and the O represents the non-named entity.
  • the preset annotation format is BIO
  • converting the annotation information from the initial annotation format to the preset annotation format includes steps B1-B2:
  • the I mark in the BIOES format is deleted, the S mark is revised to the B mark, and the E mark is modified to the I mark;
  • BIO as the target annotation format, other annotation formats can be quickly converted to BIO format, with high conversion efficiency. If the BIO format is converted to BIOES or BMES format, manual annotation needs to be added, and the conversion efficiency is low.
  • A2. Determine the named entity category set corresponding to each data set according to the annotation information in the preset annotation format, and split each data set into the corresponding named entity category in the corresponding named entity category set. initial dataset;
  • the named entity categories annotated in each dataset may also be different, for example, temporal entities are annotated in the People's Daily dataset, while no temporal entities are annotated in the MSRA dataset.
  • the corresponding named entity category set of each dataset can be determined. It is assumed that the three named entity categories of PER (person name), LOC (place name) and ORG (organization name) are marked in the annotation information of the MSRA dataset.
  • each data set into an initial data set corresponding to each named entity category in the corresponding named entity category set includes:
  • the newly obtained data set is recorded as MSRA-PER (ie, the initial data set corresponding to the PER category in the MSRA data set), and by analogy, the MSRA-ORG and MSRA-LOC data sets can be obtained.
  • MSRA-PER ie, the initial data set corresponding to the PER category in the MSRA data set
  • step A2 for the PER category, five initial data sets of MSRA-PER, People's Daily-PER, CLUENER-PER, Weibo-PER, and BOSON-PER can be obtained. These five initial data sets only contain the PER category. The named entities of , and the named entities of other categories are negative samples, so these five initial data sets can be mixed to form a new data set, which is recorded as the PER data set (ie, the sub-data set corresponding to the PER category), followed by By analogy, sub-data sets corresponding to named entity categories such as LOC, ORG, TIM, ADD, COM, and BOOK can be obtained.
  • named entity categories such as LOC, ORG, TIM, ADD, COM, and BOOK
  • sub-data sets with moderate data amount corresponding to each named entity category can be obtained without manual annotation, and the efficiency of obtaining named entity data sets is high.
  • the named entity recognition model includes a plurality of output branches, each output branch corresponds to a named entity category, and the sub-data sets corresponding to the named entity categories are input into the named entity recognition model for processing. Training to get the trained named entity recognition model;
  • the building a named entity recognition model includes:
  • the BERT model is used as the main branch of the named entity recognition model, and multiple output branches are added after the main branch according to the number of named entity categories, and the output branch includes a fully connected layer.
  • the named entity recognition model has one input and multiple outputs, and each output branch outputs a corresponding identification result of a named entity category.
  • the training process of the named entity recognition model includes:
  • the weight parameters of the output branch corresponding to each named entity category of the named entity recognition model can be obtained by training
  • the calculation formula of the accuracy loss value is:
  • qi is the predicted named entity of the sub-dataset corresponding to the ith named entity category
  • pi is the real named entity of the sub-dataset corresponding to the ith named entity category
  • loss(q i , p i ) is the ith named entity category.
  • c is the total number of named entity categories.
  • the target named entity category carried in the request is PER (person name).
  • the result recognized by the output branch corresponding to the PER category in the model is used as the target recognition result.
  • a plurality of output branches are added to the model, and each output branch correspondingly outputs a recognition result of a named entity category, so that the named entity recognition accuracy is high.
  • each data set is split according to the named entity category (target naming).
  • the samples corresponding to the entity category are positive samples, and the samples corresponding to other named entity categories are negative samples), obtain the initial data set corresponding to each named entity category in each data set, and then summarize the initial data set to obtain the corresponding subclasses of each named entity category.
  • Data set this step does not require any manual labeling. Multiple data sets with different label formats and label entities can be fused to obtain a data set with a moderate amount of data corresponding to each named entity category, which improves the named entity data set.
  • the named entity recognition model includes a plurality of output branches, each output branch corresponds to a named entity category, rather than the traditional use of an output branch to identify different categories of named entities, The named entity recognition accuracy is higher; finally, the text to be named entity recognition is input into the trained named entity recognition model, and the recognition result output by the output branch corresponding to the target named entity category is used as the target recognition result of the text to be named entity recognition. , the obtained target recognition results have high accuracy. Therefore, the present application improves the acquisition efficiency of the named entity data set and improves the recognition accuracy of the named entity.
  • FIG. 2 it is a schematic block diagram of a named entity recognition apparatus provided by an embodiment of the present application.
  • the named entity recognition apparatus 100 described in this application can be installed in an electronic device. According to the implemented functions, the named entity recognition apparatus 100 may include an extraction module 110 , a training module 120 , a request module 130 and an output module 140 .
  • the modules described in this application may also be referred to as units, which refer to a series of computer program segments that can be executed by the processor of an electronic device and can perform fixed functions, and are stored in the memory of the electronic device.
  • each module/unit is as follows:
  • the extraction module 110 is configured to obtain multiple datasets from the database, and perform named entity category extraction on the multiple datasets to obtain sub datasets corresponding to each named entity category;
  • Named entities are names of people, institutions, places, and all other entities identified by names. For example, named entities also include numbers, dates, currencies, addresses, and so on.
  • the multiple datasets are datasets with label information related to named entity recognition collected from the Internet, such as MSRA, People's Daily, Weibo, CLUENER, BOSON and other datasets.
  • the purpose of this step is to fuse each data set to form a large data set with a suitable amount of data for training the named entity recognition model.
  • the label information carried by each data set in the multiple data sets is converted from the initial label format to the preset label format
  • the initial annotation formats of the collected datasets may not be uniform.
  • the initial annotation formats include BIOES, BMES, and BIO.
  • the annotation format of the CLUENER dataset is BIOES
  • the annotation format of the Weibo dataset is BMES
  • the annotation format of the daily dataset is BIO.
  • BIOES in BIOES means at the beginning of a named entity
  • I (inside) means at the inside of a named entity
  • O (outside) means a non-named entity
  • E (end) means at the end of a named entity
  • S (single) means A single character is a named entity, for example, I am Cantonese is marked as I/Sis/SGuang/Bdong/Iren/E.
  • B in BMES means at the beginning of a named entity
  • M (middle) means at the middle of a named entity
  • E means at the end of a named entity
  • S means a single character is a named entity.
  • the B in BIO represents the beginning of the named entity, the I represents the tail of the named entity, and the O represents the non-named entity.
  • the preset annotation format is BIO
  • converting the annotation information from the initial annotation format to the preset annotation format includes steps B1-B2:
  • the I mark in the BIOES format is deleted, the S mark is revised to the B mark, and the E mark is modified to the I mark;
  • BIO as the target annotation format, other annotation formats can be quickly converted to BIO format, with high conversion efficiency. If the BIO format is converted to BIOES or BMES format, manual annotation needs to be added, and the conversion efficiency is low.
  • A2. Determine the named entity category set corresponding to each data set according to the annotation information in the preset annotation format, and split each data set into the corresponding named entity category in the corresponding named entity category set. initial dataset;
  • the named entity categories annotated in each dataset may also be different, for example, temporal entities are annotated in the People's Daily dataset, while no temporal entities are annotated in the MSRA dataset.
  • the corresponding named entity category set of each dataset can be determined. It is assumed that the three named entity categories of PER (person name), LOC (place name) and ORG (organization name) are marked in the annotation information of the MSRA dataset.
  • each data set into an initial data set corresponding to each named entity category in the corresponding named entity category set includes:
  • the newly obtained data set is recorded as MSRA-PER (ie, the initial data set corresponding to the PER category in the MSRA data set), and by analogy, the MSRA-ORG and MSRA-LOC data sets can be obtained.
  • MSRA-PER ie, the initial data set corresponding to the PER category in the MSRA data set
  • step A2 for the PER category, five initial data sets of MSRA-PER, People's Daily-PER, CLUENER-PER, Weibo-PER, and BOSON-PER can be obtained. These five initial data sets only contain the PER category. The named entities of , and the named entities of other categories are negative samples, so these five initial data sets can be mixed to form a new data set, which is recorded as the PER data set (ie, the sub-data set corresponding to the PER category), followed by By analogy, sub-data sets corresponding to named entity categories such as LOC, ORG, TIM, ADD, COM, and BOOK can be obtained.
  • named entity categories such as LOC, ORG, TIM, ADD, COM, and BOOK
  • sub-data sets with moderate data amount corresponding to each named entity category can be obtained without manual annotation, and the efficiency of obtaining named entity data sets is high.
  • the training module 120 is configured to construct a named entity recognition model, the named entity recognition model includes a plurality of output branches, each output branch corresponds to a named entity category, and the sub-data sets corresponding to the named entity categories are input into the named entity category
  • the entity recognition model is trained to obtain a trained named entity recognition model
  • the building a named entity recognition model includes:
  • the BERT model is used as the main branch of the named entity recognition model, and multiple output branches are added after the main branch according to the number of named entity categories, and the output branch includes a fully connected layer.
  • the named entity recognition model has one input and multiple outputs, and each output branch outputs a corresponding identification result of a named entity category.
  • the training process of the named entity recognition model includes:
  • the weight parameters of the output branch corresponding to each named entity category of the named entity recognition model can be obtained by training
  • the calculation formula of the accuracy loss value is:
  • qi is the predicted named entity of the sub-dataset corresponding to the ith named entity category
  • pi is the real named entity of the sub-dataset corresponding to the ith named entity category
  • loss(q i , p i ) is the ith named entity category.
  • c is the total number of named entity categories.
  • the request module 130 is configured to respond to the named entity identification request sent by the user based on the client, parse the request, and obtain the identification text to be named entity and the target named entity category carried by the request;
  • the output module 140 is configured to input the text to be recognized as the named entity into the trained named entity recognition model, and use the recognition result output by the output branch corresponding to the target named entity category as the target of the text to be recognized Identify the results.
  • the target named entity category carried in the request is PER (person name).
  • the result recognized by the output branch corresponding to the PER category in the model is used as the target recognition result.
  • a plurality of output branches are added to the model, and each output branch correspondingly outputs a recognition result of a named entity category, so that the named entity recognition accuracy is high.
  • FIG. 3 it is a schematic structural diagram of an electronic device implementing a method for identifying a named entity according to an embodiment of the present application.
  • the electronic device 1 is a device that can automatically perform numerical calculation and/or information processing according to pre-set or stored instructions.
  • the electronic device 1 may be a computer, a single network server, a server group composed of multiple network servers, or a cloud composed of a large number of hosts or network servers based on cloud computing, where cloud computing is a type of distributed computing, A super virtual computer consisting of a collection of loosely coupled computers.
  • the electronic device 1 includes, but is not limited to, a memory 11, a processor 12, and a network interface 13 that can be communicatively connected to each other through a system bus.
  • the memory 11 stores a named entity recognition program 10, the named entity
  • the identification program 10 is executable by the processor 12 .
  • FIG. 3 only shows the electronic device 1 having the components 11-13 and the named entity recognition program 10. Those skilled in the art can understand that the structure shown in FIG. 3 does not constitute a limitation on the electronic device 1, and may include Fewer or more components are shown, or some components are combined, or a different arrangement of components.
  • the memory 11 includes a memory and at least one type of readable storage medium.
  • the memory provides a cache for the operation of the electronic device 1;
  • the readable storage medium can be, for example, flash memory, hard disk, multimedia card, card-type memory (for example, SD or DX memory, etc.), random access memory (RAM), static random access memory (SRAM) ), read only memory (ROM), electrically erasable programmable read only memory (EEPROM), programmable read only memory (PROM), magnetic memory, magnetic disk, optical disk, etc. non-volatile storage media.
  • the readable storage medium may be an internal storage unit of the electronic device 1, such as a hard disk of the electronic device 1; in other embodiments, the non-volatile storage medium may also be an external storage unit of the electronic device 1
  • a storage device such as a pluggable hard disk, a smart memory card (Smart Media Card, SMC), a secure digital (Secure Digital, SD) card, a flash memory card (Flash Card), etc. equipped on the electronic device 1.
  • the readable storage medium of the memory 11 is generally used to store the operating system and various application software installed in the electronic device 1 , for example, to store the code of the named entity recognition program 10 in an embodiment of the present application.
  • the memory 11 can also be used to temporarily store various types of data that have been output or will be output.
  • the processor 12 may be a central processing unit (Central Processing Unit, CPU), a controller, a microcontroller, a microprocessor, or other data processing chips.
  • the processor 12 is generally used to control the overall operation of the electronic device 1, such as performing control and processing related to data interaction or communication with other devices.
  • the processor 12 is configured to run the program code or process data stored in the memory 11, for example, run the named entity recognition program 10 and the like.
  • the network interface 13 may include a wireless network interface or a wired network interface, and the network interface 13 is used to establish a communication connection between the electronic device 1 and a client (not shown in the figure).
  • the electronic device 1 may further include a user interface, and the user interface may include a display (Display), an input unit such as a keyboard (Keyboard), and an optional user interface may also include a standard wired interface and a wireless interface.
  • the display may be an LED display, a liquid crystal display, a touch-sensitive liquid crystal display, an OLED (Organic Light-Emitting Diode, organic light-emitting diode) touch device, and the like.
  • the display may also be appropriately called a display screen or a display unit, which is used for displaying information processed in the electronic device 1 and for displaying a visualized user interface.
  • the named entity recognition program 10 stored in the memory 11 in the electronic device 1 is a combination of multiple instructions, and when running in the processor 12, can realize:
  • the named entity recognition model includes a plurality of output branches, each output branch corresponds to a named entity category, and the sub-data sets corresponding to each named entity category are input into the named entity recognition model for training, Get the trained named entity recognition model;
  • the above data sets can also be stored in a node of a blockchain.
  • the modules/units integrated in the electronic device 1 are implemented in the form of software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium, and the computer-readable storage medium can be stored in a computer-readable storage medium. It is volatile and can also be non-volatile.
  • the computer-readable storage medium may include: any entity or device capable of carrying the computer program code, a recording medium, a U disk, a removable hard disk, a magnetic disk, an optical disk, a computer memory, a read-only memory (ROM, Read-Only Memory) ).
  • a named entity identification program 10 is stored on the computer-readable storage medium, and the named entity identification program 10 can be executed by one or more processors to realize the following steps:
  • the named entity recognition model includes a plurality of output branches, each output branch corresponds to a named entity category, and the sub-data sets corresponding to each named entity category are input into the named entity recognition model for training, Get the trained named entity recognition model;
  • modules described as separate components may or may not be physically separated, and the components shown as modules may or may not be physical units, that is, may be located in one place, or may be distributed to multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution in this embodiment.
  • each functional module in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically alone, or two or more units may be integrated into one unit.
  • the above-mentioned integrated units can be implemented in the form of hardware, or can be implemented in the form of hardware plus software function modules.
  • the blockchain referred to in this application is a new application mode of computer technologies such as distributed data storage, point-to-point transmission, consensus mechanism, and encryption algorithm.
  • Blockchain essentially a decentralized database, is a series of data blocks associated with cryptographic methods. Each data block contains a batch of network transaction information to verify its Validity of information (anti-counterfeiting) and generation of the next block.
  • the blockchain can include the underlying platform of the blockchain, the platform product service layer, and the application service layer.

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Health & Medical Sciences (AREA)
  • Artificial Intelligence (AREA)
  • Audiology, Speech & Language Pathology (AREA)
  • Computational Linguistics (AREA)
  • General Health & Medical Sciences (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

一种命名实体识别方法、装置、电子设备及可读存储介质,涉及数据处理技术领域。上述方法包括:对多个数据集执行命名实体类别提取得到各个命名实体类别对应的子数据集;构建命名实体识别模型,所述命名实体识别模型包括多个输出分支,每个输出分支对应一个命名实体类别,将子数据集输入命名实体识别模型进行训练,得到训练好的命名实体识别模型(S2);获取请求携带的待命名实体识别文本及目标命名实体类别;将待命名实体识别文本输入训练好的命名实体识别模型,将目标命名实体类别对应的输出分支输出的识别结果作为目标识别结果(S4)。上述方法可提升命名实体数据集的获取效率、提高命名实体识别准确度。

Description

命名实体识别方法、装置、电子设备及可读存储介质
本申请要求于2020年9月3日提交中国专利局、申请号为CN202010920446.1、名称为“命名实体识别方法、装置、电子设备及可读存储介质”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。
技术领域
本申请涉及数据处理领域,尤其涉及一种命名实体识别方法、装置、电子设备及可读存储介质。
背景技术
在自然语言处理应用领域中,命名实体识别是信息检索、机器翻译、自动问答、情感分析等自然语言处理应用的基础任务,对命名实体识别的研究具有重要意义。
发明人意识到,当前,与命名实体相关的数据集较少,且不同数据集标注的命名实体类别不同,无法直接将现有数据集混合后对命名实体模型进行训练,而人工标注数据集费时费力,导致命名实体数据集的获取效率低下;同时,当前通常采用单一的基于统计的模型作为命名实体识别模型对不同命名实体进行识别,由于不同命名实体的结构不同、长度不同,导致模型对命名实体的识别准确度不够高。因此,亟需一种命名实体识别方法,以提升命名实体数据集的获取效率、提高命名实体识别准确度。
发明内容
本申请提供的命名实体识别方法,包括:
从数据库中获取多个数据集,对所述多个数据集执行命名实体类别提取得到各个命名实体类别对应的子数据集;
构建命名实体识别模型,所述命名实体识别模型包括多个输出分支,每个输出分支对应一个命名实体类别,将所述各个命名实体类别对应的子数据集输入所述命名实体识别模型进行训练,得到训练好的命名实体识别模型;
响应用户基于客户端发出的命名实体识别请求,解析所述请求,获取所述请求携带的待命名实体识别文本及目标命名实体类别;
将所述待命名实体识别文本输入所述训练好的命名实体识别模型,将所述目标命名实体类别对应的输出分支输出的识别结果作为所述待命名实体识别文本的目标识别结果。
本申请还提供一种命名实体识别装置,所述装置包括:
提取模块,用于从数据库中获取多个数据集,对所述多个数据集执行命名实体类别提取得到各个命名实体类别对应的子数据集;
训练模块,用于构建命名实体识别模型,所述命名实体识别模型包括多个输出分支,每个输出分支对应一个命名实体类别,将所述各个命名实体类别对应的子数据集输入所述命名实体识别模型进行训练,得到训练好的命名实体识别模型;
请求模块,用于响应用户基于客户端发出的命名实体识别请求,解析所述请求,获取所述请求携带的待命名实体识别文本及目标命名实体类别;
输出模块,用于将所述待命名实体识别文本输入所述训练好的命名实体识别模型,将所述目标命名实体类别对应的输出分支输出的识别结果作为所述待命名实体识别文本的目标识别结果。
本申请还提供一种电子设备,所述电子设备包括:
至少一个处理器;以及,
与所述至少一个处理器通信连接的存储器;其中,
所述存储器存储有可被所述至少一个处理器执行的命名实体识别程序,所述命名实体 识别程序被所述至少一个处理器执行,以使所述至少一个处理器能够执行如下步骤:
从数据库中获取多个数据集,对所述多个数据集执行命名实体类别提取得到各个命名实体类别对应的子数据集;
构建命名实体识别模型,所述命名实体识别模型包括多个输出分支,每个输出分支对应一个命名实体类别,将所述各个命名实体类别对应的子数据集输入所述命名实体识别模型进行训练,得到训练好的命名实体识别模型;
响应用户基于客户端发出的命名实体识别请求,解析所述请求,获取所述请求携带的待命名实体识别文本及目标命名实体类别;
将所述待命名实体识别文本输入所述训练好的命名实体识别模型,将所述目标命名实体类别对应的输出分支输出的识别结果作为所述待命名实体识别文本的目标识别结果。
本申请还提供一种计算机可读存储介质,所述计算机可读存储介质上存储有命名实体识别程序,所述命名实体识别程序可被一个或者多个处理器执行,以实现如下步骤:
从数据库中获取多个数据集,对所述多个数据集执行命名实体类别提取得到各个命名实体类别对应的子数据集;
构建命名实体识别模型,所述命名实体识别模型包括多个输出分支,每个输出分支对应一个命名实体类别,将所述各个命名实体类别对应的子数据集输入所述命名实体识别模型进行训练,得到训练好的命名实体识别模型;
响应用户基于客户端发出的命名实体识别请求,解析所述请求,获取所述请求携带的待命名实体识别文本及目标命名实体类别;
将所述待命名实体识别文本输入所述训练好的命名实体识别模型,将所述目标命名实体类别对应的输出分支输出的识别结果作为所述待命名实体识别文本的目标识别结果。
附图说明
图1为本申请一实施例提供的命名实体识别方法的流程示意图;
图2为本申请一实施例提供的命名实体识别装置的模块示意图;
图3为本申请一实施例提供的实现命名实体识别方法的电子设备的结构示意图;
本申请目的的实现、功能特点及优点将结合实施例,参照附图做进一步说明。
具体实施方式
为了使本申请的目的、技术方案及优点更加清楚明白,以下结合附图及实施例,对本申请进行进一步详细说明。应当理解,此处所描述的具体实施例仅用以解释本申请,并不用于限定本申请。基于本申请中的实施例,本领域普通技术人员在没有做出创造性劳动前提下所获得的所有其他实施例,都属于本申请保护的范围。
需要说明的是,在本申请中涉及“第一”、“第二”等的描述仅用于描述目的,而不能理解为指示或暗示其相对重要性或者隐含指明所指示的技术特征的数量。由此,限定有“第一”、“第二”的特征可以明示或者隐含地包括至少一个该特征。另外,各个实施例之间的技术方案可以相互结合,但是必须是以本领域普通技术人员能够实现为基础,当技术方案的结合出现相互矛盾或无法实现时应当认为这种技术方案的结合不存在,也不在本申请要求的保护范围之内。
本申请提供一种命名实体识别方法。参照图1所示,为本申请一实施例提供的命名实体识别方法的流程示意图。该方法可以由一个电子设备执行,该电子设备可以由软件和/或硬件实现。
本实施例中,命名实体识别方法包括:
S1、从数据库中获取多个数据集,对所述多个数据集执行命名实体类别提取得到各个命名实体类别对应的子数据集;
命名实体是人名、机构名、地名以及其他所有以名称为标识的实体,例如,命名实体 还包括数字、日期、货币、地址等。
本实施例中,所述多个数据集为从网络上已收集到的与命名实体识别相关的携带标注信息的数据集,例如,MSRA、人民日报、微博、CLUENER、BOSON等数据集。
本步骤的目的在于将各个数据集融合后形成一个合适数据量的大数据集,以对命名实体识别模型进行训练。
所述对所述多个数据集执行命名实体类别提取得到各个命名实体类别对应的子数据集,包括步骤A1-A3:
A1、将所述多个数据集中的每个数据集携带的标注信息由初始标注格式转换为预设标注格式;
已收集到的各个数据集的初始标注格式可能不统一,所述初始标注格式包括BIOES、BMES及BIO,例如,CLUENER数据集的标注格式为BIOES,而微博数据集的标注格式为BMES,人民日报数据集的标注格式为BIO。
BIOES中的B(begin)表示位于命名实体的开始,I(inside)表示位于命名实体的内部,O(outside)表示非命名实体,E(end)表示位于命名实体的尾部,S(single)表示单个字符为一个命名实体,例如,我是广东人被标注为我/S是/S广/B东/I人/E。
BMES中的B表示位于命名实体的开始,M(middle)表示位于命名实体的中间,E表示位于命名实体的尾部,S表示单个字符为一个命名实体。
BIO中的B表示命名实体的开始,I表示命名实体的尾部,O表示非命名实体。
本实施例中,所述预设标注格式为BIO,将标注信息由初始标注格式转换为预设标注格式包括步骤B1-B2:
B1、将所述BIOES格式中的I标注删除、S标注修改为B标注、E标注修改为I标注;
B2、将所述BMES格式中的M标注删除、S标注修改为B标注、E标注修改为I标注。
将BIO作为目标标注格式,可快速将其他标注格式转换为BIO格式,转换效率高,若将BIO格式转换为BIOES或BMES格式,则需要增加人工标注,转换效率低下。
A2、根据所述预设标注格式的标注信息确定所述每个数据集对应的命名实体类别集合,将所述每个数据集拆分为其对应的命名实体类别集合中各个命名实体类别对应的初始数据集;
每个数据集标注的命名实体类别也可能不同,例如,人民日报数据集中有标注时间实体,而MSRA数据集中未标注时间实体。根据标注信息可确定每个数据集对应的命名实体类别集合,假设MSRA数据集的标注信息中标注了PER(人名)、LOC(地名)、ORG(机构名)这三个命名实体类别,将L(MSRA)作为MSRA数据集对应的命名实体类别集合,则L(MSRA)={PER、LOC、ORG},类似的,本实施例假设得到L(人民日报)={PER、LOC、ORG、TIM},L{微博}={PER、ORG、LOC},L(CLUENER)={PER,LOC、ORG、COM、ADD,GAME、GOV、SCENCE、BOOK、MOVIE},L(BOSON)={PER、LOC、ORG、COM、TIM、PRODUCT}。
本实施例中,所述将所述每个数据集拆分为其对应的命名实体类别集合中各个命名实体类别对应的初始数据集,包括:
对于所述每个数据集,将其对应的命名实体类别集合中某一指定命名实体类别对应的正样本保留,将其他命名实体类别对应的样本作为负样本,得到所述指定命名实体类别对应的初始数据集。
例如,对于MSRA数据集,其L(MSRA)={PER、LOC、ORG},以PER类别为例进行说明,将MSRA数据集中的所有PER类别的正样本保留,其他的诸如LOC、ORG这两个类别的正样本全部标注为负样本,MSRA数据集中原本存在的负样本保持不变,则新得到的数据集中只包含了PER类别的正样本,其他类别的正样本全部变成了负样本,将新得到的这个数据集记为MSRA-PER(即MSRA数据集中PER类别对应的初始数据集),依 次类推,可得到MSRA-ORG,MSRA-LOC数据集。针对另外四个数据集,也可以到CLUENER-PER、CLUENER-ADD...等数据集。
A3、汇总各个命名实体类别对应的初始数据集得到各个命名实体类别对应的子数据集。
根据上述步骤A2,对于PER类别,可得到MSRA-PER、人民日报-PER、CLUENER-PER、微博-PER、BOSON-PER这五个初始数据集,这五个初始数据集中都只包含PER类别的命名实体,其他类别的命名实体都是负样本,因此可以将这五个初始数据集混合起来,构成一个新的数据集,记为PER数据集(即PER类别对应的子数据集),依次类推,可得到LOC、ORG、TIM、ADD、COM、BOOK等命名实体类别对应的子数据集。
故而,本申请不需要进行人工标注即可得到每个命名实体类别对应的数据量适中的子数据集,获取命名实体数据集的效率较高。
S2、构建命名实体识别模型,所述命名实体识别模型包括多个输出分支,每个输出分支对应一个命名实体类别,将所述各个命名实体类别对应的子数据集输入所述命名实体识别模型进行训练,得到训练好的命名实体识别模型;
所述构建命名实体识别模型包括:
将BERT模型作为所述命名实体识别模型的主支干,按照命名实体类别的数量在所述主支干后增加多个输出分支,所述输出分支包括一个全连接层。
本实施例中,所述命名实体识别模型有一个输入、多个输出,每个输出分支对应输出一个命名实体类别的识别结果。
所述命名实体识别模型的训练过程包括:
C1、选择一个命名实体类别对应的子数据集输入所述命名实体识别模型,将与所述选择的命名实体类别对应的输出分支输出的识别结果作为所述选择的命名识别类别对应的子数据集的预测命名实体;
C2、根据所述预设标注格式的标注信息获取所述选择的命名实体类别对应的子数据集的真实命名实体,通过最小化真实命名实体与预测命名实体之间的准确度损失值确定所述命名实体识别模型的所述选择的命名实体类别对应的输出分支的权重参数。
通过上述步骤C1-C2,可训练得到所述命名实体识别模型的每个命名实体类别对应的输出分支的权重参数
本实施例中,所述准确度损失值的计算公式为:
Figure PCTCN2021097069-appb-000001
其中,q i为第i个命名实体类别对应的子数据集的预测命名实体,p i为第i个命名实体类别对应的子数据集的真实命名实体,loss(q i,p i)为第i个命名实体类别对应的子数据集的真实命名实体与预测命名实体之间的准确度损失值,c为命名实体类别的总数量。
S3、响应用户基于客户端发出的命名实体识别请求,解析所述请求,获取所述请求携带的待命名实体识别文本及目标命名实体类别;
S4、将所述待命名实体识别文本输入所述训练好的命名实体识别模型,将所述目标命名实体类别对应的输出分支输出的识别结果作为所述待命名实体识别文本的目标识别结果。
例如,请求中携带的目标命名实体类别为PER(人名),将待识别文本输入训练好的命名实体识别模型后,将模型中PER类别对应的输出分支识别到的结果作为目标识别结果。
本申请通过在模型中增加多个输出分支,每个输出分支对应输出一个命名实体类别的识别结果,使得命名实体识别准确度高。
由上述实施例可知,本申请提出的命名实体识别方法,首先,在将多个数据集的标注格式统一转换为预设标注格式后,按照命名实体类别对每个数据集进行拆分(目标命名实体类别对应的样本为正样本,其它命名实体类别对应的样本为负样本),得到每个数据集 中各个命名实体类别对应的初始数据集,再汇总初始数据集,得到各个命名实体类别对应的子数据集,本步骤不需要进行任何人工标注,可将多个标注格式不一、标注实体不同的数据集进行融合,得到各个命名实体类别对应的数据量适中的数据集,提升了命名实体数据集的获取效率;接着,构建命名实体识别模型,所述命名实体识别模型包括多个输出分支,每个输出分支对应一个命名实体类别,而非传统的采用一个输出分支来识别不同类别的命名实体,使得命名实体识别准确度更高;最后,将待命名实体识别文本输入训练好的命名实体识别模型,将与目标命名实体类别对应的输出分支输出的识别结果作为待命名实体识别文本的目标识别结果,得到的目标识别结果准确度较高。故而,本申请提升了命名实体数据集的获取效率,提高了命名实体识别准确度。
如图2所示,为本申请一实施例提供的命名实体识别装置的模块示意图。
本申请所述命名实体识别装置100可以安装于电子设备中。根据实现的功能,所述命名实体识别装置100可以包括提取模块110、训练模块120、请求模块130及输出模块140。本申请所述模块也可以称之为单元,是指一种能够被电子设备处理器所执行,并且能够完成固定功能的一系列计算机程序段,其存储在电子设备的存储器中。
在本实施例中,关于各模块/单元的功能如下:
提取模块110,用于从数据库中获取多个数据集,对所述多个数据集执行命名实体类别提取得到各个命名实体类别对应的子数据集;
命名实体是人名、机构名、地名以及其他所有以名称为标识的实体,例如,命名实体还包括数字、日期、货币、地址等。
本实施例中,所述多个数据集为从网络上已收集到的与命名实体识别相关的携带标注信息的数据集,例如,MSRA、人民日报、微博、CLUENER、BOSON等数据集。
本步骤的目的在于将各个数据集融合后形成一个合适数据量的大数据集,以对命名实体识别模型进行训练。
所述对所述多个数据集执行命名实体类别提取得到各个命名实体类别对应的子数据集,包括步骤A1-A3:
A1、将所述多个数据集中的每个数据集携带的标注信息由初始标注格式转换为预设标注格式;
已收集到的各个数据集的初始标注格式可能不统一,所述初始标注格式包括BIOES、BMES及BIO,例如,CLUENER数据集的标注格式为BIOES,而微博数据集的标注格式为BMES,人民日报数据集的标注格式为BIO。
BIOES中的B(begin)表示位于命名实体的开始,I(inside)表示位于命名实体的内部,O(outside)表示非命名实体,E(end)表示位于命名实体的尾部,S(single)表示单个字符为一个命名实体,例如,我是广东人被标注为我/S是/S广/B东/I人/E。
BMES中的B表示位于命名实体的开始,M(middle)表示位于命名实体的中间,E表示位于命名实体的尾部,S表示单个字符为一个命名实体。
BIO中的B表示命名实体的开始,I表示命名实体的尾部,O表示非命名实体。
本实施例中,所述预设标注格式为BIO,将标注信息由初始标注格式转换为预设标注格式包括步骤B1-B2:
B1、将所述BIOES格式中的I标注删除、S标注修改为B标注、E标注修改为I标注;
B2、将所述BMES格式中的M标注删除、S标注修改为B标注、E标注修改为I标注。
将BIO作为目标标注格式,可快速将其他标注格式转换为BIO格式,转换效率高,若将BIO格式转换为BIOES或BMES格式,则需要增加人工标注,转换效率低下。
A2、根据所述预设标注格式的标注信息确定所述每个数据集对应的命名实体类别集合,将所述每个数据集拆分为其对应的命名实体类别集合中各个命名实体类别对应的初始数据集;
每个数据集标注的命名实体类别也可能不同,例如,人民日报数据集中有标注时间实体,而MSRA数据集中未标注时间实体。根据标注信息可确定每个数据集对应的命名实体类别集合,假设MSRA数据集的标注信息中标注了PER(人名)、LOC(地名)、ORG(机构名)这三个命名实体类别,将L(MSRA)作为MSRA数据集对应的命名实体类别集合,则L(MSRA)={PER、LOC、ORG},类似的,本实施例假设得到L(人民日报)={PER、LOC、ORG、TIM},L{微博}={PER、ORG、LOC},L(CLUENER)={PER,LOC、ORG、COM、ADD,GAME、GOV、SCENCE、BOOK、MOVIE},L(BOSON)={PER、LOC、ORG、COM、TIM、PRODUCT}。
本实施例中,所述将所述每个数据集拆分为其对应的命名实体类别集合中各个命名实体类别对应的初始数据集,包括:
对于所述每个数据集,将其对应的命名实体类别集合中某一指定命名实体类别对应的正样本保留,将其他命名实体类别对应的样本作为负样本,得到所述指定命名实体类别对应的初始数据集。
例如,对于MSRA数据集,其L(MSRA)={PER、LOC、ORG},以PER类别为例进行说明,将MSRA数据集中的所有PER类别的正样本保留,其他的诸如LOC、ORG这两个类别的正样本全部标注为负样本,MSRA数据集中原本存在的负样本保持不变,则新得到的数据集中只包含了PER类别的正样本,其他类别的正样本全部变成了负样本,将新得到的这个数据集记为MSRA-PER(即MSRA数据集中PER类别对应的初始数据集),依次类推,可得到MSRA-ORG,MSRA-LOC数据集。针对另外四个数据集,也可以到CLUENER-PER、CLUENER-ADD...等数据集。
A3、汇总各个命名实体类别对应的初始数据集得到各个命名实体类别对应的子数据集。
根据上述步骤A2,对于PER类别,可得到MSRA-PER、人民日报-PER、CLUENER-PER、微博-PER、BOSON-PER这五个初始数据集,这五个初始数据集中都只包含PER类别的命名实体,其他类别的命名实体都是负样本,因此可以将这五个初始数据集混合起来,构成一个新的数据集,记为PER数据集(即PER类别对应的子数据集),依次类推,可得到LOC、ORG、TIM、ADD、COM、BOOK等命名实体类别对应的子数据集。
故而,本申请不需要进行人工标注即可得到每个命名实体类别对应的数据量适中的子数据集,获取命名实体数据集的效率较高。
训练模块120,用于构建命名实体识别模型,所述命名实体识别模型包括多个输出分支,每个输出分支对应一个命名实体类别,将所述各个命名实体类别对应的子数据集输入所述命名实体识别模型进行训练,得到训练好的命名实体识别模型;
所述构建命名实体识别模型包括:
将BERT模型作为所述命名实体识别模型的主支干,按照命名实体类别的数量在所述主支干后增加多个输出分支,所述输出分支包括一个全连接层。
本实施例中,所述命名实体识别模型有一个输入、多个输出,每个输出分支对应输出一个命名实体类别的识别结果。
所述命名实体识别模型的训练过程包括:
C1、选择一个命名实体类别对应的子数据集输入所述命名实体识别模型,将与所述选择的命名实体类别对应的输出分支输出的识别结果作为所述选择的命名识别类别对应的子数据集的预测命名实体;
C2、根据所述预设标注格式的标注信息获取所述选择的命名实体类别对应的子数据集的真实命名实体,通过最小化真实命名实体与预测命名实体之间的准确度损失值确定所述命名实体识别模型的所述选择的命名实体类别对应的输出分支的权重参数。
通过上述步骤C1-C2,可训练得到所述命名实体识别模型的每个命名实体类别对应的输出分支的权重参数
本实施例中,所述准确度损失值的计算公式为:
Figure PCTCN2021097069-appb-000002
其中,q i为第i个命名实体类别对应的子数据集的预测命名实体,p i为第i个命名实体类别对应的子数据集的真实命名实体,loss(q i,p i)为第i个命名实体类别对应的子数据集的真实命名实体与预测命名实体之间的准确度损失值,c为命名实体类别的总数量。
请求模块130,用于响应用户基于客户端发出的命名实体识别请求,解析所述请求,获取所述请求携带的待命名实体识别文本及目标命名实体类别;
输出模块140,用于将所述待命名实体识别文本输入所述训练好的命名实体识别模型,将所述目标命名实体类别对应的输出分支输出的识别结果作为所述待命名实体识别文本的目标识别结果。
例如,请求中携带的目标命名实体类别为PER(人名),将待识别文本输入训练好的命名实体识别模型后,将模型中PER类别对应的输出分支识别到的结果作为目标识别结果。
本申请通过在模型中增加多个输出分支,每个输出分支对应输出一个命名实体类别的识别结果,使得命名实体识别准确度高。
如图3所示,为本申请一实施例提供的实现命名实体识别方法的电子设备的结构示意图。
所述电子设备1是一种能够按照事先设定或者存储的指令,自动进行数值计算和/或信息处理的设备。所述电子设备1可以是计算机、也可以是单个网络服务器、多个网络服务器组成的服务器组或者基于云计算的由大量主机或者网络服务器构成的云,其中云计算是分布式计算的一种,由一群松散耦合的计算机集组成的一个超级虚拟计算机。
在本实施例中,电子设备1包括,但不仅限于,可通过系统总线相互通信连接的存储器11、处理器12、网络接口13,该存储器11中存储有命名实体识别程序10,所述命名实体识别程序10可被所述处理器12执行。图3仅示出了具有组件11-13以及命名实体识别程序10的电子设备1,本领域技术人员可以理解的是,图3示出的结构并不构成对电子设备1的限定,可以包括比图示更少或者更多的部件,或者组合某些部件,或者不同的部件布置。
其中,存储器11包括内存及至少一种类型的可读存储介质。内存为电子设备1的运行提供缓存;可读存储介质可为如闪存、硬盘、多媒体卡、卡型存储器(例如,SD或DX存储器等)、随机访问存储器(RAM)、静态随机访问存储器(SRAM)、只读存储器(ROM)、电可擦除可编程只读存储器(EEPROM)、可编程只读存储器(PROM)、磁性存储器、磁盘、光盘等的非易失性存储介质。在一些实施例中,可读存储介质可以是电子设备1的内部存储单元,例如该电子设备1的硬盘;在另一些实施例中,该非易失性存储介质也可以是电子设备1的外部存储设备,例如电子设备1上配备的插接式硬盘,智能存储卡(Smart Media Card,SMC),安全数字(Secure Digital,SD)卡,闪存卡(Flash Card)等。本实施例中,存储器11的可读存储介质通常用于存储安装于电子设备1的操作系统和各类应用软件,例如存储本申请一实施例中的命名实体识别程序10的代码等。此外,存储器11还可以用于暂时地存储已经输出或者将要输出的各类数据。
处理器12在一些实施例中可以是中央处理器(Central Processing Unit,CPU)、控制器、微控制器、微处理器、或其他数据处理芯片。该处理器12通常用于控制所述电子设备1的总体操作,例如执行与其他设备进行数据交互或者通信相关的控制和处理等。本实施例中,所述处理器12用于运行所述存储器11中存储的程序代码或者处理数据,例如运行命名实体识别程序10等。
网络接口13可包括无线网络接口或有线网络接口,该网络接口13用于在所述电子设备1与客户端(图中未画出)之间建立通信连接。
可选的,所述电子设备1还可以包括用户接口,用户接口可以包括显示器(Display)、输入单元比如键盘(Keyboard),可选的用户接口还可以包括标准的有线接口、无线接口。可选的,在一些实施例中,显示器可以是LED显示器、液晶显示器、触控式液晶显示器以及OLED(Organic Light-Emitting Diode,有机发光二极管)触摸器等。其中,显示器也可以适当的称为显示屏或显示单元,用于显示在电子设备1中处理的信息以及用于显示可视化的用户界面。
应该了解,所述实施例仅为说明之用,在专利申请范围上并不受此结构的限制。
所述电子设备1中的所述存储器11存储的命名实体识别程序10是多个指令的组合,在所述处理器12中运行时,可以实现:
从数据库中获取多个数据集,对所述多个数据集执行命名实体类别提取得到各个命名实体类别对应的子数据集;
构建命名实体识别模型,所述命名实体识别模型包括多个输出分支,每个输出分支对应一个命名实体类别,将所述各个命名实体类别对应的子数据集输入所述命名实体识别模型进行训练,得到训练好的命名实体识别模型;
响应用户基于客户端发出的命名实体识别请求,解析所述请求,获取所述请求携带的待命名实体识别文本及目标命名实体类别;
将所述待命名实体识别文本输入所述训练好的命名实体识别模型,将所述目标命名实体类别对应的输出分支输出的识别结果作为所述待命名实体识别文本的目标识别结果。
具体地,所述处理器12对上述命名实体识别程序10的具体实现方法可参考图1对应实施例中相关步骤的描述,在此不赘述。需要强调的是,为进一步保证上述各个数据集的私密和安全性,上述数据集还可以存储于一区块链的节点中。
进一步地,所述电子设备1集成的模块/单元如果以软件功能单元的形式实现并作为独立的产品销售或使用时,可以存储在一个计算机可读存储介质中,所述计算机可读存储介质可以是易失性的,也可以是非易失性的。所述计算机可读存储介质可以包括:能够携带所述计算机程序代码的任何实体或装置、记录介质、U盘、移动硬盘、磁碟、光盘、计算机存储器、只读存储器(ROM,Read-Only Memory)。
所述计算机可读存储介质上存储有命名实体识别程序10,所述命名实体识别程序10可被一个或者多个处理器执行,以实现如下步骤:
从数据库中获取多个数据集,对所述多个数据集执行命名实体类别提取得到各个命名实体类别对应的子数据集;
构建命名实体识别模型,所述命名实体识别模型包括多个输出分支,每个输出分支对应一个命名实体类别,将所述各个命名实体类别对应的子数据集输入所述命名实体识别模型进行训练,得到训练好的命名实体识别模型;
响应用户基于客户端发出的命名实体识别请求,解析所述请求,获取所述请求携带的待命名实体识别文本及目标命名实体类别;
将所述待命名实体识别文本输入所述训练好的命名实体识别模型,将所述目标命名实体类别对应的输出分支输出的识别结果作为所述待命名实体识别文本的目标识别结果。
在本申请所提供的几个实施例中,应该理解到,所揭露的设备,装置和方法,可以通过其它的方式实现。例如,以上所描述的装置实施例仅仅是示意性的,例如,所述模块的划分,仅仅为一种逻辑功能划分,实际实现时可以有另外的划分方式。
所述作为分离部件说明的模块可以是或者也可以不是物理上分开的,作为模块显示的部件可以是或者也可以不是物理单元,即可以位于一个地方,或者也可以分布到多个网络单元上。可以根据实际的需要选择其中的部分或者全部模块来实现本实施例方案的目的。
另外,在本申请各个实施例中的各功能模块可以集成在一个处理单元中,也可以是各个单元单独物理存在,也可以两个或两个以上单元集成在一个单元中。上述集成的单元既 可以采用硬件的形式实现,也可以采用硬件加软件功能模块的形式实现。
对于本领域技术人员而言,显然本申请不限于上述示范性实施例的细节,而且在不背离本申请的精神或基本特征的情况下,能够以其他的具体形式实现本申请。
因此,无论从哪一点来看,均应将实施例看作是示范性的,而且是非限制性的,本申请的范围由所附权利要求而不是上述说明限定,因此旨在将落在权利要求的等同要件的含义和范围内的所有变化涵括在本申请内。不应将权利要求中的任何附关联图标记视为限制所涉及的权利要求。
本申请所指区块链是分布式数据存储、点对点传输、共识机制、加密算法等计算机技术的新型应用模式。区块链(Blockchain),本质上是一个去中心化的数据库,是一串使用密码学方法相关联产生的数据块,每一个数据块中包含了一批次网络交易的信息,用于验证其信息的有效性(防伪)和生成下一个区块。区块链可以包括区块链底层平台、平台产品服务层以及应用服务层等。
此外,显然“包括”一词不排除其他单元或步骤,单数不排除复数。系统权利要求中陈述的多个单元或装置也可以由一个单元或装置通过软件或者硬件来实现。第二等词语用来表示名称,而并不表示任何特定的顺序。
最后应说明的是,以上实施例仅用以说明本申请的技术方案而非限制,尽管参照较佳实施例对本申请进行了详细说明,本领域的普通技术人员应当理解,可以对本申请的技术方案进行修改或等同替换,而不脱离本申请技术方案的精神和范围。

Claims (20)

  1. 一种命名实体识别方法,其中,所述方法包括:
    从数据库中获取多个数据集,对所述多个数据集执行命名实体类别提取得到各个命名实体类别对应的子数据集;
    构建命名实体识别模型,所述命名实体识别模型包括多个输出分支,每个输出分支对应一个命名实体类别,将所述各个命名实体类别对应的子数据集输入所述命名实体识别模型进行训练,得到训练好的命名实体识别模型;
    响应用户基于客户端发出的命名实体识别请求,解析所述请求,获取所述请求携带的待命名实体识别文本及目标命名实体类别;
    将所述待命名实体识别文本输入所述训练好的命名实体识别模型,将所述目标命名实体类别对应的输出分支输出的识别结果作为所述待命名实体识别文本的目标识别结果。
  2. 如权利要求1所述的命名实体识别方法,其中,所述对所述多个数据集执行命名实体类别提取得到各个命名实体类别对应的子数据集,包括:
    将所述多个数据集中的每个数据集携带的标注信息由初始标注格式转换为预设标注格式;
    根据所述预设标注格式的标注信息确定所述每个数据集对应的命名实体类别集合,将所述每个数据集拆分为其对应的命名实体类别集合中各个命名实体类别对应的初始数据集;
    汇总各个命名实体类别对应的初始数据集得到各个命名实体类别对应的子数据集。
  3. 如权利要求1所述的命名实体识别方法,其中,所述构建命名实体识别模型包括:
    将BERT模型作为所述命名实体识别模型的主支干,按照命名实体类别的数量在所述主支干后增加多个输出分支,所述输出分支包括一个全连接层。
  4. 如权利要求3所述的命名实体识别方法,其中,所述命名实体识别模型的训练过程包括:
    选择一个命名实体类别对应的子数据集输入所述命名实体识别模型,将与所述选择的命名实体类别对应的输出分支输出的识别结果作为所述选择的命名识别类别对应的子数据集的预测命名实体;
    根据所述预设标注格式的标注信息获取所述选择的命名实体类别对应的子数据集的真实命名实体,通过最小化真实命名实体与预测命名实体之间的准确度损失值确定所述命名实体识别模型的所述选择的命名实体类别对应的输出分支的权重参数。
  5. 如权利要求4所述的命名实体识别方法,其中,所述准确度损失值的计算公式为:
    Figure PCTCN2021097069-appb-100001
    其中,q i为第i个命名实体类别对应的子数据集的预测命名实体,p i为第i个命名实体类别对应的子数据集的真实命名实体,loss(q i,p i)为第i个命名实体类别对应的子数据集的真实命名实体与预测命名实体之间的准确度损失值,c为命名实体类别的总数量。
  6. 如权利要求2所述的命名实体识别方法,其中,所述将所述每个数据集拆分为其对应的命名实体类别集合中各个命名实体类别对应的初始数据集,包括:
    对于所述每个数据集,将其对应的命名实体类别集合中某一指定命名实体类别对应的正样本保留,将其他命名实体类别对应的样本作为负样本,得到所述指定命名实体类别对应的初始数据集。
  7. 如权利要求2所述的命名实体识别方法,其中,所述初始标注格式包括BIOES、BMES及BIO,所述预设标注格式为BIO,将标注信息由初始标注格式转换为预设标注格式包括:
    将所述BIOES格式中的I标注删除、S标注修改为B标注、E标注修改为I标注;
    将所述BMES格式中的M标注删除、S标注修改为B标注、E标注修改为I标注。
  8. 一种命名实体识别装置,其中,所述装置包括:
    提取模块,用于从数据库中获取多个数据集,对所述多个数据集执行命名实体类别提取得到各个命名实体类别对应的子数据集;
    训练模块,用于构建命名实体识别模型,所述命名实体识别模型包括多个输出分支,每个输出分支对应一个命名实体类别,将所述各个命名实体类别对应的子数据集输入所述命名实体识别模型进行训练,得到训练好的命名实体识别模型;
    请求模块,用于响应用户基于客户端发出的命名实体识别请求,解析所述请求,获取所述请求携带的待命名实体识别文本及目标命名实体类别;
    输出模块,用于将所述待命名实体识别文本输入所述训练好的命名实体识别模型,将所述目标命名实体类别对应的输出分支输出的识别结果作为所述待命名实体识别文本的目标识别结果。
  9. 一种电子设备,其中,所述电子设备包括:
    至少一个处理器;以及,
    与所述至少一个处理器通信连接的存储器;其中,
    所述存储器存储有可被所述至少一个处理器执行的命名实体识别程序,所述命名实体识别程序被所述至少一个处理器执行,以使所述至少一个处理器能够执行如下步骤:
    从数据库中获取多个数据集,对所述多个数据集执行命名实体类别提取得到各个命名实体类别对应的子数据集;
    构建命名实体识别模型,所述命名实体识别模型包括多个输出分支,每个输出分支对应一个命名实体类别,将所述各个命名实体类别对应的子数据集输入所述命名实体识别模型进行训练,得到训练好的命名实体识别模型;
    响应用户基于客户端发出的命名实体识别请求,解析所述请求,获取所述请求携带的待命名实体识别文本及目标命名实体类别;
    将所述待命名实体识别文本输入所述训练好的命名实体识别模型,将所述目标命名实体类别对应的输出分支输出的识别结果作为所述待命名实体识别文本的目标识别结果。
  10. 如权利要求9所述的电子设备,其中,所述对所述多个数据集执行命名实体类别提取得到各个命名实体类别对应的子数据集,包括:
    将所述多个数据集中的每个数据集携带的标注信息由初始标注格式转换为预设标注格式;
    根据所述预设标注格式的标注信息确定所述每个数据集对应的命名实体类别集合,将所述每个数据集拆分为其对应的命名实体类别集合中各个命名实体类别对应的初始数据集;
    汇总各个命名实体类别对应的初始数据集得到各个命名实体类别对应的子数据集。
  11. 如权利要求9所述的电子设备,其中,所述构建命名实体识别模型包括:
    将BERT模型作为所述命名实体识别模型的主支干,按照命名实体类别的数量在所述主支干后增加多个输出分支,所述输出分支包括一个全连接层。
  12. 如权利要求11所述的电子设备,其中,所述命名实体识别模型的训练过程包括:
    选择一个命名实体类别对应的子数据集输入所述命名实体识别模型,将与所述选择的命名实体类别对应的输出分支输出的识别结果作为所述选择的命名识别类别对应的子数据集的预测命名实体;
    根据所述预设标注格式的标注信息获取所述选择的命名实体类别对应的子数据集的真实命名实体,通过最小化真实命名实体与预测命名实体之间的准确度损失值确定所述命名实体识别模型的所述选择的命名实体类别对应的输出分支的权重参数。
  13. 如权利要求12所述的电子设备,其中,所述准确度损失值的计算公式为:
    Figure PCTCN2021097069-appb-100002
    其中,q i为第i个命名实体类别对应的子数据集的预测命名实体,p i为第i个命名实体类别对应的子数据集的真实命名实体,loss(q i,p i)为第i个命名实体类别对应的子数据集的真实命名实体与预测命名实体之间的准确度损失值,c为命名实体类别的总数量。
  14. 如权利要求10所述的电子设备,其中,所述将所述每个数据集拆分为其对应的命名实体类别集合中各个命名实体类别对应的初始数据集,包括:
    对于所述每个数据集,将其对应的命名实体类别集合中某一指定命名实体类别对应的正样本保留,将其他命名实体类别对应的样本作为负样本,得到所述指定命名实体类别对应的初始数据集。
  15. 如权利要求10所述的电子设备,其中,所述初始标注格式包括BIOES、BMES及BIO,所述预设标注格式为BIO,将标注信息由初始标注格式转换为预设标注格式包括:
    将所述BIOES格式中的I标注删除、S标注修改为B标注、E标注修改为I标注;
    将所述BMES格式中的M标注删除、S标注修改为B标注、E标注修改为I标注。
  16. 一种计算机可读存储介质,其中,所述计算机可读存储介质上存储有命名实体识别程序,所述命名实体识别程序可被一个或者多个处理器执行,以实现如下步骤:
    从数据库中获取多个数据集,对所述多个数据集执行命名实体类别提取得到各个命名实体类别对应的子数据集;
    构建命名实体识别模型,所述命名实体识别模型包括多个输出分支,每个输出分支对应一个命名实体类别,将所述各个命名实体类别对应的子数据集输入所述命名实体识别模型进行训练,得到训练好的命名实体识别模型;
    响应用户基于客户端发出的命名实体识别请求,解析所述请求,获取所述请求携带的待命名实体识别文本及目标命名实体类别;
    将所述待命名实体识别文本输入所述训练好的命名实体识别模型,将所述目标命名实体类别对应的输出分支输出的识别结果作为所述待命名实体识别文本的目标识别结果。
  17. 如权利要求16所述的计算机可读存储介质,其中,所述对所述多个数据集执行命名实体类别提取得到各个命名实体类别对应的子数据集,包括:
    将所述多个数据集中的每个数据集携带的标注信息由初始标注格式转换为预设标注格式;
    根据所述预设标注格式的标注信息确定所述每个数据集对应的命名实体类别集合,将所述每个数据集拆分为其对应的命名实体类别集合中各个命名实体类别对应的初始数据集;
    汇总各个命名实体类别对应的初始数据集得到各个命名实体类别对应的子数据集。
  18. 如权利要求16所述的计算机可读存储介质,其中,所述构建命名实体识别模型包括:
    将BERT模型作为所述命名实体识别模型的主支干,按照命名实体类别的数量在所述主支干后增加多个输出分支,所述输出分支包括一个全连接层。
  19. 如权利要求18所述的计算机可读存储介质,其中,所述命名实体识别模型的训练过程包括:
    选择一个命名实体类别对应的子数据集输入所述命名实体识别模型,将与所述选择的命名实体类别对应的输出分支输出的识别结果作为所述选择的命名识别类别对应的子数据集的预测命名实体;
    根据所述预设标注格式的标注信息获取所述选择的命名实体类别对应的子数据集的真实命名实体,通过最小化真实命名实体与预测命名实体之间的准确度损失值确定所述命名实体识别模型的所述选择的命名实体类别对应的输出分支的权重参数。
  20. 如权利要求19所述的计算机可读存储介质,其中,所述准确度损失值的计算公式为:
    Figure PCTCN2021097069-appb-100003
    其中,q i为第i个命名实体类别对应的子数据集的预测命名实体,p i为第i个命名实体类别对应的子数据集的真实命名实体,loss(q i,p i)为第i个命名实体类别对应的子数据集的真实命名实体与预测命名实体之间的准确度损失值,c为命名实体类别的总数量。
PCT/CN2021/097069 2020-09-03 2021-05-30 命名实体识别方法、装置、电子设备及可读存储介质 WO2022048210A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202010920446.1 2020-09-03
CN202010920446.1A CN112001179A (zh) 2020-09-03 2020-09-03 命名实体识别方法、装置、电子设备及可读存储介质

Publications (1)

Publication Number Publication Date
WO2022048210A1 true WO2022048210A1 (zh) 2022-03-10

Family

ID=73469821

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2021/097069 WO2022048210A1 (zh) 2020-09-03 2021-05-30 命名实体识别方法、装置、电子设备及可读存储介质

Country Status (2)

Country Link
CN (1) CN112001179A (zh)
WO (1) WO2022048210A1 (zh)

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114496115A (zh) * 2022-04-18 2022-05-13 北京白星花科技有限公司 实体关系的标注自动生成方法和系统
CN114912455A (zh) * 2022-07-12 2022-08-16 共道网络科技有限公司 命名实体识别的方法和装置
CN117077679A (zh) * 2023-10-16 2023-11-17 之江实验室 命名实体识别方法和装置
WO2023226367A1 (zh) * 2022-05-23 2023-11-30 华为云计算技术有限公司 样本标注的校对方法、装置、计算设备集群和存储介质

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112001179A (zh) * 2020-09-03 2020-11-27 平安科技(深圳)有限公司 命名实体识别方法、装置、电子设备及可读存储介质
CN112528662A (zh) * 2020-12-15 2021-03-19 深圳壹账通智能科技有限公司 基于元学习的实体类别识别方法、装置、设备和存储介质

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20150340024A1 (en) * 2014-05-23 2015-11-26 Google Inc. Language Modeling Using Entities
CN109190120A (zh) * 2018-08-31 2019-01-11 第四范式(北京)技术有限公司 神经网络训练方法和装置及命名实体识别方法和装置
CN109359291A (zh) * 2018-08-28 2019-02-19 昆明理工大学 一种命名实体识别方法
CN109783604A (zh) * 2018-12-14 2019-05-21 平安科技(深圳)有限公司 基于少量样本的信息提取方法、装置和计算机设备
CN111563383A (zh) * 2020-04-09 2020-08-21 华南理工大学 一种基于BERT与SemiCRF的中文命名实体识别方法
CN112001179A (zh) * 2020-09-03 2020-11-27 平安科技(深圳)有限公司 命名实体识别方法、装置、电子设备及可读存储介质

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20150340024A1 (en) * 2014-05-23 2015-11-26 Google Inc. Language Modeling Using Entities
CN109359291A (zh) * 2018-08-28 2019-02-19 昆明理工大学 一种命名实体识别方法
CN109190120A (zh) * 2018-08-31 2019-01-11 第四范式(北京)技术有限公司 神经网络训练方法和装置及命名实体识别方法和装置
CN109783604A (zh) * 2018-12-14 2019-05-21 平安科技(深圳)有限公司 基于少量样本的信息提取方法、装置和计算机设备
CN111563383A (zh) * 2020-04-09 2020-08-21 华南理工大学 一种基于BERT与SemiCRF的中文命名实体识别方法
CN112001179A (zh) * 2020-09-03 2020-11-27 平安科技(深圳)有限公司 命名实体识别方法、装置、电子设备及可读存储介质

Cited By (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114496115A (zh) * 2022-04-18 2022-05-13 北京白星花科技有限公司 实体关系的标注自动生成方法和系统
CN114496115B (zh) * 2022-04-18 2022-08-23 北京白星花科技有限公司 实体关系的标注自动生成方法和系统
WO2023226367A1 (zh) * 2022-05-23 2023-11-30 华为云计算技术有限公司 样本标注的校对方法、装置、计算设备集群和存储介质
CN114912455A (zh) * 2022-07-12 2022-08-16 共道网络科技有限公司 命名实体识别的方法和装置
CN114912455B (zh) * 2022-07-12 2022-09-30 共道网络科技有限公司 命名实体识别的方法和装置
CN117077679A (zh) * 2023-10-16 2023-11-17 之江实验室 命名实体识别方法和装置
CN117077679B (zh) * 2023-10-16 2024-03-12 之江实验室 命名实体识别方法和装置

Also Published As

Publication number Publication date
CN112001179A (zh) 2020-11-27

Similar Documents

Publication Publication Date Title
WO2022048210A1 (zh) 命名实体识别方法、装置、电子设备及可读存储介质
WO2022048211A1 (zh) 文档目录生成方法、装置、电子设备及可读存储介质
US11544623B2 (en) Consistent filtering of machine learning data
CN111813963B (zh) 知识图谱构建方法、装置、电子设备及存储介质
WO2022105115A1 (zh) 问答对匹配方法、装置、电子设备及存储介质
WO2022121171A1 (zh) 相似文本匹配方法、装置、电子设备及计算机存储介质
WO2022078308A1 (zh) 裁判文书摘要生成方法、装置、电子设备及可读存储介质
US20150379072A1 (en) Input processing for machine learning
CN112183091A (zh) 问答对生成方法、装置、电子设备及可读存储介质
CN110750654A (zh) 知识图谱获取方法、装置、设备和介质
WO2022160442A1 (zh) 答案生成方法、装置、电子设备及可读存储介质
WO2022179123A1 (zh) 数据更新及展示方法、装置、电子设备及存储介质
CN112506486A (zh) 搜索系统建立方法、装置、电子设备及可读存储介质
CN114610747A (zh) 数据查询方法、装置、设备及存储介质
WO2023178978A1 (zh) 基于人工智能的处方审核方法、装置、设备及介质
CN112597135A (zh) 用户分类方法、装置、电子设备及可读存储介质
CN112395401B (zh) 自适应负样本对采样方法、装置、电子设备及存储介质
US10719536B2 (en) Efficiently finding potential duplicate values in data
CN111046085A (zh) 数据的溯源处理方法及装置、介质和设备
CN116842012A (zh) 一种Redis集群的分片存储方法、装置、设备及存储介质
CN115114297A (zh) 数据轻量存储及查找方法、装置、电子设备及存储介质
JP2022153339A (ja) データベースシステムにおけるレコードマッチング(データベースシステムにおけるレコードマッチングのコンピュータ実装方法、コンピュータプログラム、コンピュータシステム)
CN115269523A (zh) 基于人工智能的文件存储与查询方法及相关设备
WO2022141860A1 (zh) 文本去重方法、装置、电子设备及计算机可读存储介质
CN112528647A (zh) 相似文本生成方法、装置、电子设备及可读存储介质

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 21863280

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 21863280

Country of ref document: EP

Kind code of ref document: A1