Movatterモバイル変換


[0]ホーム

URL:


CN111241209A - Method and apparatus for generating information - Google Patents

Method and apparatus for generating information
Download PDF

Info

Publication number
CN111241209A
CN111241209ACN202010005728.9ACN202010005728ACN111241209ACN 111241209 ACN111241209 ACN 111241209ACN 202010005728 ACN202010005728 ACN 202010005728ACN 111241209 ACN111241209 ACN 111241209A
Authority
CN
China
Prior art keywords
word sequence
text
relation
vector
layer
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN202010005728.9A
Other languages
Chinese (zh)
Other versions
CN111241209B (en
Inventor
贺薇
李双婕
史亚冰
蒋烨
张扬
朱勇
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Baidu Netcom Science and Technology Co Ltd
Original Assignee
Beijing Baidu Netcom Science and Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing Baidu Netcom Science and Technology Co LtdfiledCriticalBeijing Baidu Netcom Science and Technology Co Ltd
Priority to CN202010005728.9ApriorityCriticalpatent/CN111241209B/en
Publication of CN111241209ApublicationCriticalpatent/CN111241209A/en
Application grantedgrantedCritical
Publication of CN111241209BpublicationCriticalpatent/CN111241209B/en
Activelegal-statusCriticalCurrent
Anticipated expirationlegal-statusCritical

Links

Images

Classifications

Landscapes

Abstract

The embodiment of the application discloses a method and a device for generating information, and belongs to the fields of computer technology and knowledge graph. One embodiment of the method comprises: acquiring a main body relation binary group and a text, wherein the main body relation binary group comprises a main body and a relation; segmenting the text into a sequence of text words; inputting the subject relation binary group and the text word sequence into a pre-trained slot filling model to obtain a labeling result of the text word sequence, wherein the slot filling model is used for labeling objects in the text word sequence; and generating a subject relation object triple based on the subject relation binary group and the labeling result, wherein the subject relation object triple comprises a subject, a relation and an object of the text. This embodiment improves the object recognition accuracy.

Description

Translated fromChinese
用于生成信息的方法和装置Method and apparatus for generating information

技术领域technical field

本申请实施例涉及计算机技术领域,具体涉及用于生成信息的方法和装置。The embodiments of the present application relate to the field of computer technologies, and in particular, to methods and apparatuses for generating information.

背景技术Background technique

知识图谱是从语义角度用结构化形式表示的真实世界知识的大规模知识库,是一张有向图,其中包括实体(节点)、关系(边)等要素。SPO(Subject Predication Object,主语谓语宾语)三元组又叫做主体关系客体三元组,是指实体对(S和O)与它们间的关系(P)构成的三元组。从知识图谱构建的角度上看,实体关系抽取可以得到实体缺失的关系属性值,用于提升知识图谱的连通度,高效提升知识图谱的知识丰富度与完备性。A knowledge graph is a large-scale knowledge base of real-world knowledge represented in a structured form from a semantic point of view. It is a directed graph, which includes elements such as entities (nodes) and relationships (edges). SPO (Subject Prediction Object, Subject Predicate Object) triplet, also known as subject-relationship object triplet, refers to the triplet composed of entity pairs (S and O) and the relationship (P) between them. From the perspective of knowledge graph construction, entity relationship extraction can obtain the relationship attribute values of missing entities, which can be used to improve the connectivity of knowledge graphs and efficiently improve the knowledge richness and completeness of knowledge graphs.

目前,常用的实体抽取方法是将主体关系二元组转化成问题,并将问题和文本输入到阅读理解模型,阅读理解模型会标注出客体在文本中的起始位置和结束位置。然而,阅读理解模型实际上是将主体关系二元组退化成了问题,丢失了结构信息,影响客体识别效果。At present, the commonly used entity extraction method is to convert the subject relationship binary into a question, and input the question and text into the reading comprehension model, and the reading comprehension model will mark the starting position and ending position of the object in the text. However, the reading comprehension model actually degenerates the subject relation binary into a problem, loses structural information, and affects the object recognition effect.

发明内容SUMMARY OF THE INVENTION

本申请实施例提出了用于生成信息的方法和装置。The embodiments of the present application propose methods and apparatuses for generating information.

第一方面,本申请实施例提出了一种用于生成信息的方法,获取主体关系二元组和文本,其中,主体关系二元组包括主体和关系;将文本切分成文本词序列;将主体关系二元组和文本词序列输入至预先训练的槽填充模型,得到文本词序列的标注结果,其中,槽填充模型用于标注文本词序列中的客体;基于主体关系二元组和标注结果,生成主体关系客体三元组,其中,主体关系客体三元组包括文本的主体、关系和客体。In the first aspect, an embodiment of the present application proposes a method for generating information, obtaining a subject relationship tuples and text, wherein the subject relationship tuples include subjects and relationships; dividing the text into text word sequences; dividing the subject The relation binary group and the text word sequence are input into the pre-trained slot filling model, and the labeling result of the text word sequence is obtained, wherein the slot filling model is used to label the objects in the text word sequence; A subject-relation-object triple is generated, wherein the subject-relation-object triple includes the subject, relation and object of the text.

在一些实施例中,槽填充模型包括输入层、定位层、嵌入层、编码层、解码层和输出层。In some embodiments, the slot filling model includes an input layer, a localization layer, an embedding layer, an encoding layer, a decoding layer, and an output layer.

在一些实施例中,将主体关系二元组和文本词序列输入至预先训练的槽填充模型,得到文本词序列的标注结果,包括:将主体关系二元组和文本词序列输入至输入层,得到词序列特征和距离特征;将距离特征输入到定位层,得到位置信息;将词序列特征和位置信息输入至嵌入层,得到词序列向量和位置向量;将词序列向量输入至编码层,得到编码向量;将位置向量和编码向量输入至解码层,得到解码向量;将解码向量输入至输出层,得到标注结果。In some embodiments, inputting the subject relation dyad and the text word sequence into a pre-trained slot filling model to obtain a labeling result of the text word sequence, comprising: inputting the subject relation dyad and the text word sequence into the input layer, Obtain word sequence features and distance features; input the distance features to the positioning layer to obtain position information; input the word sequence features and position information to the embedding layer to obtain word sequence vectors and position vectors; input the word sequence vectors to the coding layer to obtain Encoding vector; input the position vector and encoding vector to the decoding layer to get the decoding vector; input the decoding vector to the output layer to get the annotation result.

在一些实施例中,编码层包括第一双向长短期记忆网络,解码层包括位置注意力模块、关系注意力模块和第二双向长短期记忆网络。In some embodiments, the encoding layer includes a first bidirectional long short-term memory network, and the decoding layer includes a positional attention module, a relational attention module, and a second bidirectional long short-term memory network.

在一些实施例中,将位置向量和编码向量输入至解码层,得到解码向量,包括:将位置向量和编码向量的拼接输入至位置注意力模块,得到文本词序列中的词距离主体和关系的位置信息;将关系的长短期记忆网络编码和编码向量输入至关系注意力模块,得到文本词序列中的词与关系的语义相似度;将编码向量、文本词序列中的词距离主体和关系的位置信息和文本词序列中的词与关系的语义相似度输入至第二双向长短期记忆网络,得到解码向量。In some embodiments, inputting the position vector and the encoding vector to the decoding layer to obtain the decoding vector includes: inputting the splicing of the position vector and the encoding vector to the position attention module to obtain the distance between the subject and the relationship between the words in the text word sequence. Location information; input the relational long-term and short-term memory network encoding and encoding vector into the relational attention module to obtain the semantic similarity between the words in the text word sequence and the relationship; the encoding vector, the word distance in the text word sequence from the subject and the relationship The location information and the semantic similarity between words and relations in the text word sequence are input to the second bidirectional long short-term memory network to obtain a decoded vector.

在一些实施例中,将解码向量输入至输出层,得到标注结果,包括:通过激活函数对文本词序列中的词的解码向量进行多分类,得到文本词序列中的词属于多种类别中的每种类别的概率,其中,多分类是计算词属于多种类别中的每种类别的概率;基于文本词序列中的词的最大概率对应的类别对文本词序列进行标注,生成标注结果。In some embodiments, inputting the decoded vector to the output layer to obtain the labeling result includes: performing multiple classifications on the decoded vectors of the words in the text word sequence through an activation function, and obtaining words in the text word sequence that belong to multiple categories The probability of each category, among which, multi-classification is to calculate the probability that the word belongs to each category of multiple categories; based on the category corresponding to the maximum probability of the word in the text word sequence, the text word sequence is labeled, and the labeling result is generated.

在一些实施例中,词序列特征包括以下至少一项:文本词序列、文本词序列的词性序列、文本词序列的命名实体识别序列和关系的关系词序列,距离特征包括以下至少一项:文本词序列中的词到主体的距离、文本词序列中的词到关系的距离。In some embodiments, the word sequence feature includes at least one of the following: a text word sequence, a part-of-speech sequence of the text word sequence, a named entity recognition sequence of the text word sequence, and a relational word sequence of a relationship, and the distance feature includes at least one of the following: text The distance from the word in the word sequence to the subject, and the distance from the word in the text word sequence to the relationship.

在一些实施例中,槽填充模型采用BIOES序列标注方式对文本词序列进行标注。In some embodiments, the slot filling model uses the BIOES sequence labeling method to label text word sequences.

第二方面,本申请实施例提出了一种用于生成信息的装置,包括:获取单元,被配置成获取主体关系二元组和文本,其中,主体关系二元组包括主体和关系;切分单元,被配置成将文本切分成文本词序列;标注单元,被配置成将主体关系二元组和文本词序列输入至预先训练的槽填充模型,得到文本词序列的标注结果,其中,槽填充模型用于标注文本词序列中的客体;生成单元,被配置成基于主体关系二元组和标注结果,生成主体关系客体三元组,其中,主体关系客体三元组包括文本的主体、关系和客体。In a second aspect, an embodiment of the present application proposes an apparatus for generating information, including: an acquisition unit configured to acquire a subject relationship binary group and text, wherein the subject relationship binary group includes a subject and a relationship; segmentation The unit is configured to divide the text into text word sequences; the labeling unit is configured to input the subject relation binary group and the text word sequence into the pre-trained slot filling model to obtain the labeling result of the text word sequence, wherein the slot filling The model is used to label the objects in the text word sequence; the generating unit is configured to generate a subject relation object triple based on the subject relation binary and the labeling result, wherein the subject relation object triple includes the subject, relation and object.

在一些实施例中,槽填充模型包括输入层、定位层、嵌入层、编码层、解码层和输出层。In some embodiments, the slot filling model includes an input layer, a localization layer, an embedding layer, an encoding layer, a decoding layer, and an output layer.

在一些实施例中,标注单元包括:输入子单元,被配置成将主体关系二元组和文本词序列输入至输入层,得到词序列特征和距离特征;定位子单元,被配置成将距离特征输入到定位层,得到位置信息;嵌入子单元,被配置成将词序列特征和位置信息输入至嵌入层,得到词序列向量和位置向量;编码子单元,被配置成将词序列向量输入至编码层,得到编码向量;解码子单元,被配置成将位置向量和编码向量输入至解码层,得到解码向量;输出子单元,被配置成将解码向量输入至输出层,得到标注结果。In some embodiments, the labeling unit includes: an input subunit, configured to input subject relation bigrams and text word sequences to the input layer, to obtain word sequence features and distance features; a positioning subunit, configured to input the distance features Input to the positioning layer to obtain position information; the embedding subunit is configured to input the word sequence feature and position information into the embedding layer to obtain the word sequence vector and the position vector; the encoding subunit is configured to input the word sequence vector to the encoding subunit The decoding subunit is configured to input the position vector and the encoding vector to the decoding layer to obtain the decoding vector; the output subunit is configured to input the decoding vector to the output layer to obtain the annotation result.

在一些实施例中,编码层包括第一双向长短期记忆网络,解码层包括位置注意力模块、关系注意力模块和第二双向长短期记忆网络。In some embodiments, the encoding layer includes a first bidirectional long short-term memory network, and the decoding layer includes a positional attention module, a relational attention module, and a second bidirectional long short-term memory network.

在一些实施例中,编码子单元进一步被配置成:将位置向量和编码向量的拼接输入至位置注意力模块,得到文本词序列中的词距离主体和关系的位置信息;将关系的长短期记忆网络编码和编码向量输入至关系注意力模块,得到文本词序列中的词与关系的语义相似度;将编码向量、文本词序列中的词距离主体和关系的位置信息和文本词序列中的词与关系的语义相似度输入至第二双向长短期记忆网络,得到解码向量。In some embodiments, the encoding subunit is further configured to: input the concatenation of the position vector and the encoding vector to the position attention module to obtain the position information of the word distance subject and relationship in the text word sequence; The network coding and coding vector are input to the relationship attention module to obtain the semantic similarity between the words and the relationship in the text word sequence; The semantic similarity with the relation is input to the second bidirectional long short-term memory network, and the decoded vector is obtained.

在一些实施例中,输出子单元进一步被配置成:通过激活函数对文本词序列中的词的解码向量进行多分类,得到文本词序列中的词属于多种类别中的每种类别的概率,其中,多分类是计算词属于多种类别中的每种类别的概率;基于文本词序列中的词的最大概率对应的类别对文本词序列进行标注,生成标注结果。In some embodiments, the output subunit is further configured to: perform multi-classification on the decoded vectors of the words in the text word sequence through an activation function, to obtain the probability that the words in the text word sequence belong to each of the various categories, Among them, the multi-classification is to calculate the probability that the word belongs to each of the various categories; the text word sequence is labeled based on the category corresponding to the maximum probability of the word in the text word sequence, and the labeling result is generated.

在一些实施例中,词序列特征包括以下至少一项:文本词序列、文本词序列的词性序列、文本词序列的命名实体识别序列和关系的关系词序列,距离特征包括以下至少一项:文本词序列中的词到主体的距离、文本词序列中的词到关系的距离。In some embodiments, the word sequence feature includes at least one of the following: a text word sequence, a part-of-speech sequence of the text word sequence, a named entity recognition sequence of the text word sequence, and a relational word sequence of a relationship, and the distance feature includes at least one of the following: text The distance from the word in the word sequence to the subject, and the distance from the word in the text word sequence to the relationship.

在一些实施例中,槽填充模型采用BIOES序列标注方式对文本词序列进行标注。In some embodiments, the slot filling model uses the BIOES sequence labeling method to label text word sequences.

第三方面,本申请实施例提供了一种电子设备,该电子设备包括:一个或多个处理器;存储装置,其上存储有一个或多个程序;当一个或多个程序被一个或多个处理器执行,使得一个或多个处理器实现如第一方面中任一实现方式描述的方法。In a third aspect, an embodiment of the present application provides an electronic device, the electronic device includes: one or more processors; a storage device on which one or more programs are stored; when one or more programs are stored by one or more The multiple processors execute such that the one or more processors implement a method as described in any one of the implementations of the first aspect.

第四方面,本申请实施例提供了一种计算机可读介质,其上存储有计算机程序,该计算机程序被处理器执行时实现如第一方面中任一实现方式描述的方法。In a fourth aspect, an embodiment of the present application provides a computer-readable medium on which a computer program is stored, and when the computer program is executed by a processor, implements the method described in any implementation manner of the first aspect.

本申请实施例提供的用于生成信息的方法和装置,首先获取主体关系二元组和文本;之后将文本切分成文本词序列;然后将主体关系二元组和文本词序列输入至预先训练的槽填充模型,得到文本词序列的标注结果;最后基于主体关系二元组和标注结果,生成主体关系客体三元组。基于槽填充模型识别客体,保留了主体和关系的和结构,提高了客体识别精准度。The method and device for generating information provided by the embodiments of the present application first acquire the subject relation binary group and text; then divide the text into text word sequences; The slot filling model is used to obtain the labeling result of the text word sequence; finally, based on the subject relation binary and the labeling result, the subject relation object triple is generated. Object recognition based on slot filling model preserves the sum structure of subject and relationship, and improves the accuracy of object recognition.

附图说明Description of drawings

通过阅读参照以下附图所作的对非限制性实施例所作的详细描述,本申请的其它特征、目的和优点将会变得更明显:Other features, objects and advantages of the present application will become more apparent by reading the detailed description of non-limiting embodiments made with reference to the following drawings:

图1是本申请可以应用于其中的示例性系统架构;FIG. 1 is an exemplary system architecture to which the present application may be applied;

图2是根据本申请的用于生成信息的方法的一个实施例的流程图;Figure 2 is a flowchart of one embodiment of a method for generating information according to the present application;

图3是根据本申请的用于生成信息的方法的又一个实施例的流程图;3 is a flowchart of yet another embodiment of a method for generating information according to the present application;

图4示出了槽填充模型的结构示意图;Fig. 4 shows the structural schematic diagram of the slot filling model;

图5是根据本申请的用于生成信息的装置的一个实施例的结构示意图;5 is a schematic structural diagram of an embodiment of an apparatus for generating information according to the present application;

图6是适于用来实现本申请实施例的电子设备的计算机系统的结构示意图。FIG. 6 is a schematic structural diagram of a computer system suitable for implementing the electronic device according to the embodiment of the present application.

具体实施方式Detailed ways

下面结合附图和实施例对本申请作进一步的详细说明。可以理解的是,此处所描述的具体实施例仅仅用于解释相关发明,而非对该发明的限定。另外还需要说明的是,为了便于描述,附图中仅示出了与有关发明相关的部分。The present application will be further described in detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the related invention, but not to limit the invention. In addition, it should be noted that, for the convenience of description, only the parts related to the related invention are shown in the drawings.

需要说明的是,在不冲突的情况下,本申请中的实施例及实施例中的特征可以相互组合。下面将参考附图并结合实施例来详细说明本申请。It should be noted that the embodiments in the present application and the features of the embodiments may be combined with each other in the case of no conflict. The present application will be described in detail below with reference to the accompanying drawings and in conjunction with the embodiments.

图1示出了可以应用本申请的用于生成信息的方法或用于生成信息的装置的实施例的示例性系统架构100。FIG. 1 illustrates anexemplary system architecture 100 to which embodiments of a method for generating information or an apparatus for generating information of the present application may be applied.

如图1所示,系统架构100中可以包括终端设备101、网络102和服务器103。网络102用以在终端设备101和服务器103之间提供通信链路的介质。网络102可以包括各种连接类型,例如有线、无线通信链路或者光纤电缆等等。As shown in FIG. 1 , thesystem architecture 100 may include aterminal device 101 , anetwork 102 and aserver 103 . Thenetwork 102 is a medium used to provide a communication link between theterminal device 101 and theserver 103 . Thenetwork 102 may include various connection types, such as wired, wireless communication links, or fiber optic cables, among others.

用户可以使用终端设备101通过网络102与服务器103交互,以接收或发送消息等。终端设备101可以是硬件,也可以是软件。当终端设备101为硬件时,可以是各种电子设备。包括但不限于智能手机、平板电脑、膝上型便携计算机和台式计算机等等。当终端设备101为软件时,可以安装在上述电子设备中。其可以实现成多个软件或软件模块,也可以实现成单个软件或软件模块。在此不做具体限定。The user can use theterminal device 101 to interact with theserver 103 through thenetwork 102 to receive or send messages and the like. Theterminal device 101 may be hardware or software. When theterminal device 101 is hardware, it can be various electronic devices. Including, but not limited to, smartphones, tablets, laptops, and desktops, among others. When theterminal device 101 is software, it can be installed in the above electronic device. It can be implemented as a plurality of software or software modules, and can also be implemented as a single software or software module. There is no specific limitation here.

服务器103可以提供各种服务。例如服务器103可以对从终端设备101获取到的主体关系二元组和文本等数据进行分析等处理,并生成处理结果(例如主体关系客体三元组)。Theserver 103 can provide various services. For example, theserver 103 may analyze and process data such as subject relationship two-tuples and texts obtained from theterminal device 101, and generate processing results (eg, subject relationship object triples).

需要说明的是,服务器103可以是硬件,也可以是软件。当服务器103为硬件时,可以实现成多个服务器组成的分布式服务器集群,也可以实现成单个服务器。当服务器103为软件时,可以实现成多个软件或软件模块(例如用来提供分布式服务),也可以实现成单个软件或软件模块。在此不做具体限定。It should be noted that theserver 103 may be hardware or software. When theserver 103 is hardware, it may be implemented as a distributed server cluster composed of multiple servers, or may be implemented as a single server. When theserver 103 is software, it can be implemented as a plurality of software or software modules (for example, for providing distributed services), or can be implemented as a single software or software module. There is no specific limitation here.

需要说明的是,本申请实施例所提供的用于生成信息的方法一般由服务器103执行,相应地,用于生成信息的装置一般设置于服务器103中。It should be noted that the method for generating information provided by the embodiments of the present application is generally executed by theserver 103 , and correspondingly, the apparatus for generating information is generally set in theserver 103 .

应该理解,图1中的终端设备、网络和服务器的数目仅仅是示意性的。根据实现需要,可以具有任意数目的终端设备、网络和服务器。It should be understood that the numbers of terminal devices, networks and servers in FIG. 1 are merely illustrative. There can be any number of terminal devices, networks and servers according to implementation needs.

继续参考图2,其示出了根据本申请的用于生成信息的方法的一个实施例的流程200。该用于生成信息的方法包括以下步骤:With continued reference to Figure 2, aflow 200 of one embodiment of a method for generating information in accordance with the present application is shown. The method for generating information includes the following steps:

步骤201,获取主体关系二元组和文本。Step 201, acquiring the subject relation binary and text.

在本实施例中,用于生成信息的方法的执行主体(例如图1所示的服务器103)可以获取主体关系二元组和文本。其中,主体关系二元组可以包括主体和关系,又被称为SP二元组。文本可以是描述主体关系二元组的信息,其内容不仅包括主体和关系,还包括关系的属性值,也就是客体。In this embodiment, the execution body of the method for generating information (for example, theserver 103 shown in FIG. 1 ) can acquire the body relation binary and text. Among them, the subject-relation tuples may include subject and relationship, and are also called SP tuples. The text can be the information describing the two-tuple of the subject relationship, and its content includes not only the subject and the relationship, but also the attribute value of the relationship, that is, the object.

步骤202,将文本切分成文本词序列。Step 202: Divide the text into text word sequences.

在本实施例中,上述执行主体可以将文本切分成文本词序列。通常,上述执行主体可以利用分词技术将文本切分成词粒度,得到文本词序列。In this embodiment, the above-mentioned execution body may segment the text into text word sequences. Generally, the above-mentioned execution body can use word segmentation technology to segment the text into word granularity to obtain a text word sequence.

步骤203,将主体关系二元组和文本词序列输入至预先训练的槽填充模型,得到文本词序列的标注结果。Step 203 , input the subject relation binary group and the text word sequence into the pre-trained slot filling model to obtain the labeling result of the text word sequence.

在本实施例中,上述执行主体可以将主体关系二元组和文本词序列输入至预先训练的槽填充模型,得到文本词序列的标注结果。其中,槽填充模型可以用于标注文本词序列中的客体,因此标注结果至少会标注出文本词序列中的客体。In this embodiment, the above-mentioned execution subject may input the subject relation binary group and the text word sequence into the pre-trained slot filling model to obtain the labeling result of the text word sequence. Among them, the slot filling model can be used to label the objects in the text word sequence, so the labeling result will at least label the objects in the text word sequence.

这里,槽填充模型可以利用槽填充技术在给定文本和主体关系二元组的情况下,从文本中抽取主体关系二元组对应的客体。槽填充模型添加了主体和关系的位置,以及关系的语义相似度,是一个序列标注模型。槽填充模型输入主体关系二元组和文本词序列,输出对文本词序列中的每个词的标注结果。根据标注结果可以识别出文本词序列中属于主体关系二元组对应的客体的词。Here, the slot-filling model can use the slot-filling technique to extract the object corresponding to the subject-relation binary from the text given the text and the subject-relation binary. The slot-filling model adds the location of subjects and relations, and the semantic similarity of relations, and is a sequence annotation model. The slot filling model inputs the subject relation bigram and the text word sequence, and outputs the labeling result of each word in the text word sequence. According to the labeling result, words belonging to the object corresponding to the subject relation binary group in the text word sequence can be identified.

在本实施例的一些可选的实现方式中,槽填充模型可以采用BIOES序列标注方式对文本词序列进行标注。其中,B即begin,表示多个词的客体标注的开始位置。I即inside,表示多个词的客体标注的中间部分。O即outside,表示不是客体的部分。E即end,表示多个词的客体标注的结束位置。S即single,表示单个词的客体。In some optional implementations of this embodiment, the slot filling model may use the BIOES sequence labeling method to label text word sequences. Among them, B is begin, which represents the starting position of the object labeling of multiple words. I is inside, which represents the middle part of the object annotation of multiple words. O stands for outside, which means the part that is not the object. E stands for end, which indicates the end position of the object labeling of multiple words. S stands for single, which means the object of a single word.

步骤204,基于主体关系二元组和标注结果,生成主体关系客体三元组。Step 204 , based on the subject-relation two-tuple and the labeling result, generate a subject-relation-object triple.

在本实施例中,上述执行主体可以基于主体关系二元组和文本词序列的标注结果,生成主体关系客体三元组。其中,主体关系客体三元组可以包括文本的主体、关系和客体。具体地,上述执行主体可以根据文本词序列的标注结果中的不同标记确定出客体,然后将客体组合到主体关系二元组中,生成主体关系客体三元组。例如,上述执行主体可以从文本词序列的标注结果中抽取出标记为B、I、E的词作为客体,或者抽取出标记为S的词作为客体。In this embodiment, the above-mentioned execution subject may generate a subject-relationship-object triplet based on the tagging result of the subject-relationship two-tuple and the text word sequence. Among them, the subject-relationship-object triple can include the subject, relationship and object of the text. Specifically, the above-mentioned execution subject may determine the object according to different tags in the labeling result of the text word sequence, and then combine the objects into a subject-relation two-tuple to generate a subject-relation-object triple. For example, the above-mentioned execution subject can extract words marked B, I, E as objects, or extract words marked S as objects from the labeling result of the text word sequence.

通常,利用本实施例提供的方法生成大量主体关系客体三元组,可以用于构建知识图谱,提升知识图谱的连通度,高效提升知识图谱的知识丰富度。另外,从应用的角度来看,主体关系客体三元组可以直接满足用户对于知识类的搜索需求。当用户搜索主体关系二元组时,可以直接给出对应的客体的相关信息,有效提高用户检索和浏览的效率。当用户搜索主体时,还可以给出对应的客体的相关信息,极大地丰富了推送给用户的信息的内容。Generally, a large number of subject-relationship-object triples are generated by using the method provided in this embodiment, which can be used to construct a knowledge graph, improve the connectivity of the knowledge graph, and efficiently improve the knowledge richness of the knowledge graph. In addition, from the application point of view, subject-relation-object triples can directly meet users' search requirements for knowledge. When the user searches for the subject relation binary group, the relevant information of the corresponding object can be directly given, which effectively improves the efficiency of the user's retrieval and browsing. When a user searches for a subject, relevant information about the corresponding object can also be given, which greatly enriches the content of the information pushed to the user.

本申请实施例提供的用于生成信息的方法和装置,首先获取主体关系二元组和文本;之后将文本切分成文本词序列;然后将主体关系二元组和文本词序列输入至预先训练的槽填充模型,得到文本词序列的标注结果;最后基于主体关系二元组和标注结果,生成主体关系客体三元组。基于槽填充模型识别客体,保留了主体和关系的和结构,提高了客体识别精准度。The method and device for generating information provided by the embodiments of the present application first acquire the subject relation binary group and text; then divide the text into text word sequences; The slot filling model is used to obtain the labeling result of the text word sequence; finally, based on the subject relation binary and the labeling result, the subject relation object triple is generated. Object recognition based on slot filling model preserves the sum structure of subject and relationship, and improves the accuracy of object recognition.

进一步参考图3,其示出了根据本申请的用于生成信息的方法的又一个实施例的流程300。该用于生成信息的方法中的槽填充模型可以包括输入层、定位层、嵌入层、编码层、解码层和输出层。其中,编码层可以包括第一双向长短期记忆网络(Bi-LSTM,Bidirectional Long Short Term Memory)。解码层可以包括位置注意力模块、关系注意力模块和第二双向长短期记忆网络。具体地,该用于生成信息的方法包括以下步骤:With further reference to FIG. 3, aflow 300 of yet another embodiment of a method for generating information according to the present application is shown. The slot filling model in the method for generating information may include an input layer, a localization layer, an embedding layer, an encoding layer, a decoding layer, and an output layer. The coding layer may include a first bidirectional long short term memory network (Bi-LSTM, Bidirectional Long Short Term Memory). The decoding layer may include a positional attention module, a relational attention module, and a second bidirectional long short-term memory network. Specifically, the method for generating information includes the following steps:

步骤301,获取主体关系二元组和文本。Step 301, acquiring the subject relation tuples and texts.

步骤302,将文本切分成文本词序列。Step 302: Divide the text into text word sequences.

在本实施例中,步骤301-302的具体操作已在图2所示的实施例中步骤201-202中进行了详细的介绍,在此不再赘述。In this embodiment, the specific operations of steps 301-302 have been described in detail in steps 201-202 in the embodiment shown in FIG. 2, and are not repeated here.

步骤303,将主体关系二元组和文本词序列输入至输入层,得到词序列特征和距离特征。Step 303: Input the subject relation binary group and the text word sequence into the input layer to obtain the word sequence feature and distance feature.

在本实施例中,用于生成信息的方法的执行主体(例如图1所示的服务器103)可以将主体关系二元组和文本词序列输入至输入层,得到词序列特征和距离特征。其中,输入层可以用于提取主体关系二元组和文本词序列的特征。词序列特征可以包括但不限于以下至少一项:文本词序列、文本词序列的词性序列、文本词序列的命名实体识别序列和关系的关系词序列等等。距离特征可以包括但不限于以下至少一项:文本词序列中的词到主体的距离、文本词序列中的词到关系的距离等等。In this embodiment, the execution body of the method for generating information (for example, theserver 103 shown in FIG. 1 ) can input the subject relation binary group and the text word sequence to the input layer to obtain the word sequence feature and distance feature. Among them, the input layer can be used to extract features of subject relation bigrams and text word sequences. The word sequence features may include, but are not limited to, at least one of the following: a text word sequence, a part-of-speech sequence of a text word sequence, a named entity recognition sequence of a text word sequence, a relational word sequence of a relationship, and the like. The distance feature may include, but is not limited to, at least one of the following: a distance from a word in a text word sequence to a subject, a word in a text word sequence to a relationship, and the like.

步骤304,将距离特征输入到定位层,得到位置信息。Step 304, input the distance feature to the positioning layer to obtain the position information.

在本实施例中,上述执行主体可以将距离特征输入到定位层,得到位置信息。其中,定位层与输出层相连,可以基于文本词序列中的词到主体的距离、文本词序列中的词到关系的距离等距离特征,定位出文本词序列中的词的位置信息。In this embodiment, the above-mentioned executive body may input the distance feature into the positioning layer to obtain the position information. The positioning layer is connected with the output layer, and can locate the position information of the words in the text word sequence based on the distance between the words in the text word sequence and the subject, and the distance between the words in the text word sequence and the relationship.

步骤305,将词序列特征和位置信息输入至嵌入层,得到词序列向量和位置向量。Step 305 , input the word sequence features and position information into the embedding layer to obtain the word sequence vector and the position vector.

在本实施例中,上述执行主体可以将词序列特征和位置信息输入至嵌入层,得到词序列向量和位置。其中,嵌入层与输出层和定位层分别相连,不仅可以对文本词序列、文本词序列的词性序列、文本词序列的命名实体识别序列和关系的关系词序列等词序列特征进行向量化,还可以对文本词序列中的词的位置信息进行向量化。In this embodiment, the above-mentioned execution body may input the word sequence feature and position information into the embedding layer to obtain the word sequence vector and position. Among them, the embedding layer is connected to the output layer and the positioning layer respectively, which can not only vectorize the word sequence features such as the text word sequence, the part-of-speech sequence of the text word sequence, the named entity recognition sequence of the text word sequence, and the relational word sequence of the relationship, but also The position information of words in a text word sequence can be vectorized.

需要说明的是,嵌入层中对词序列特征进行向量化的向量矩阵与对位置特征进行向量化的向量矩阵不同。It should be noted that the vector matrix for vectorizing word sequence features in the embedding layer is different from the vector matrix for vectorizing position features.

步骤306,将词序列向量输入至编码层,得到编码向量。Step 306, input the word sequence vector to the coding layer to obtain the coding vector.

在本实施例中,上述执行主体可以将词序列向量输入至编码层,得到编码向量。其中,编码层与嵌入层相连,可以对词序列向量进行编码。由于编码层包括第一双向长短期记忆网络,因此编码层可以采用第一双向长短期记忆网络对词序列向量进行编码。In this embodiment, the above-mentioned execution body may input the word sequence vector to the coding layer to obtain the coding vector. Among them, the encoding layer is connected with the embedding layer, which can encode the word sequence vector. Since the encoding layer includes the first bidirectional long and short-term memory network, the encoding layer can use the first bidirectional long and short-term memory network to encode the word sequence vector.

步骤307,将位置向量和编码向量的拼接输入至位置注意力模块,得到文本词序列中的词距离主体和关系的位置信息。Step 307: The splicing of the position vector and the encoding vector is input to the position attention module to obtain the position information of the word distance subject and relationship in the text word sequence.

在本实施例中,上述执行主体可以首先将位置向量和编码向量进行拼接,然后将拼接后的向量输入至位置注意力模块,得到文本词序列中的词距离主体和关系的位置信息。In this embodiment, the execution subject may first splicing the position vector and the encoding vector, and then input the spliced vector to the position attention module to obtain the position information of the word distance subject and relationship in the text word sequence.

这里,上述执行主体可以将位置向量和编码向量输入至解码层,得到解码向量。编码层为了添加更多输入端的信息,引入有注意力机制的长短期记忆网络编码器。也就是说,解码层是由位置注意力模块、关系注意力模块和第二双向长短期记忆网络组成。其中,位置注意力模块与嵌入层和编码层分别相连,可以在槽填充模型中添加主体和关系的位置注意力,也就是将文本词序列中的词距离主体和关系的位置信息作为不同的权重加入到槽填充模型中。关系注意力模块与编码层相连,可以用于计算输入端文本词序列中的每个词与主体关系二元组中的关系的重要程度,使得与关系相关的词在解码过程中传入更多的信息。第二双向长短期记忆网络与位置注意力模块、关系注意力模块和编码层分别相连,输入编码层得到的编码向量、位置注意力模块得到的文本词序列中的词距离主体和关系的位置信息和关系注意力模块得到的文本词序列中的词与关系的语义相似度,输出文本词序列中的词的解码向量。Here, the above-mentioned executive body may input the position vector and the encoding vector to the decoding layer to obtain the decoding vector. In the encoding layer, in order to add more input information, a long short-term memory network encoder with attention mechanism is introduced. That is, the decoding layer is composed of a positional attention module, a relational attention module and a second bidirectional long short-term memory network. Among them, the position attention module is connected to the embedding layer and the coding layer respectively, and the position attention of the subject and relationship can be added to the slot filling model, that is, the position information of the word distance in the text word sequence and the relationship between the subject and the relationship can be used as different weights Added to the slot filling model. The relational attention module is connected to the encoding layer and can be used to calculate the importance of the relation between each word in the input text word sequence and the subject relation binary group, so that the relation-related words are passed in more during the decoding process. Information. The second bidirectional long short-term memory network is connected with the position attention module, the relation attention module and the coding layer respectively, and the coding vector obtained by the input coding layer, the word distance in the text word sequence obtained by the position attention module and the position information of the relationship The semantic similarity between the words in the text word sequence and the relationship obtained by the relational attention module outputs the decoding vector of the words in the text word sequence.

步骤308,将关系的长短期记忆网络编码和编码向量输入至关系注意力模块,得到文本词序列中的词与关系的语义相似度。Step 308 , input the relational long short-term memory network encoding and the encoding vector to the relational attention module to obtain the semantic similarity between the words in the text word sequence and the relation.

在本实施例中,上述执行主体可以将关系的长短期记忆网络编码和编码向量输入至关系注意力模块,得到文本词序列中的词与关系的语义相似度。具体地,上述执行主体可以首先对主体关系二元组中的关系进行长短期记忆网络编码,得到关系的长短期记忆网络编码,然后将关系的长短期记忆网络编码和编码层的得到的编码向量一起输入至关系注意力模块,得到文本词序列中的词与关系的语义相似度。In this embodiment, the above-mentioned execution subject may input the long-term and short-term memory network encoding and encoding vector of the relationship into the relationship attention module to obtain the semantic similarity between the word and the relationship in the text word sequence. Specifically, the above-mentioned execution subject can first perform long-short-term memory network coding on the relationship in the subject relationship binary group to obtain the long-term and short-term memory network coding of the relationship, and then combine the long-term and short-term memory network coding of the relationship with the coding vector obtained by the coding layer. They are input to the relation attention module together to obtain the semantic similarity between words and relations in the text word sequence.

步骤309,将编码向量、文本词序列中的词距离主体和关系的位置信息和文本词序列中的词与关系的语义相似度输入至第二双向长短期记忆网络,得到解码向量。Step 309: Input the encoding vector, the position information of the word distance subject and relationship in the text word sequence, and the semantic similarity between the word and relationship in the text word sequence into the second bidirectional long short-term memory network to obtain a decoding vector.

在本实施例中,上述执行主体可以将编码向量、文本词序列中的词距离主体和关系的位置信息和文本词序列中的词与关系的语义相似度输入至第二双向长短期记忆网络,得到解码向量。In this embodiment, the above-mentioned execution subject may input the encoding vector, the position information of the word distance subject and the relationship in the text word sequence, and the semantic similarity between the words and the relationship in the text word sequence into the second bidirectional long short-term memory network, Get the decoded vector.

步骤310,将解码向量输入至输出层,得到标注结果。Step 310: Input the decoded vector to the output layer to obtain the labeling result.

在本实施例中,上述执行主体可以将解码向量输入至输出层,得到标注结果。其中,输出层与解码层中的第二双向长短期记忆网络相连。In this embodiment, the above-mentioned execution body may input the decoded vector to the output layer to obtain the labeling result. Among them, the output layer is connected with the second bidirectional long short-term memory network in the decoding layer.

在本实施例的一些可选的实现方式中,上述执行主体可以通过激活函数对文本词序列中的词的解码向量进行多分类,得到文本词序列中的词属于多种类别中的每种类别的概率;基于文本词序列中的词的最大概率对应的类别对文本词序列进行标注,生成标注结果。其中,多分类是计算词属于多种类别中的每种类别的概率。激活函数可以例如是Softmax,Softmax可以对文本词序列中的每个词的解码向量进行多分类,表征不同类别之间的相对概率,即分别对BIOES这几种标签的概率进行打分,然后取其中概率最大的标签,从而完成对序列中每个词的标注。In some optional implementations of this embodiment, the above-mentioned execution body may perform multiple classifications on the decoded vectors of the words in the text word sequence through an activation function, and obtain that the words in the text word sequence belong to each of the multiple categories The probability of the text word sequence; based on the category corresponding to the maximum probability of the word in the text word sequence, the text word sequence is labeled, and the labeling result is generated. Among them, multi-classification is to calculate the probability that a word belongs to each of several categories. The activation function can be, for example, Softmax. Softmax can perform multi-classification on the decoding vector of each word in the text word sequence to represent the relative probability between different categories, that is, to score the probabilities of the BIOES labels respectively, and then take one of them. The label with the highest probability is used to complete the labeling of each word in the sequence.

步骤311,基于主体关系二元组和标注结果,生成主体关系客体三元组。Step 311 , based on the subject relation binary and the labeling result, generate a subject relation object triple.

在本实施例中,步骤311的具体操作已在图2所示的实施例中步骤204中进行了详细的介绍,在此不再赘述。In this embodiment, the specific operation ofstep 311 has been described in detail instep 204 in the embodiment shown in FIG. 2 , and details are not repeated here.

为了便于理解,图4示出了槽填充模型的结构示意图。如图4所示,槽填充模型可以包括输入层、定位层、嵌入层、编码层、解码层和输出层。其中,编码层可以包括第一Bi-LSTM,解码层可以包括位置注意力模块、关系注意力模块和第二Bi-LSTM。若想要抽取出电视剧《XX》的上映时间,可以将主体“XX”和关系“上映时间”组合成关系二元组<XX,上映时间>,并获取描述关系二元组<XX,上映时间>的文本“XX,该剧于2015年8月10日上线”。文本“XX,该剧于2015年8月10日上线”可以被切分成文本词序列“XX,该剧于2015年8月10日上线”。主体关系二元组<XX,上映时间>和文本词序列“XX,该剧于2015年8月10日上线”输入至槽填充模型,得到对应的标注结果“O,O,O,O,B,I,E,O”。可见,文本词序列中的词“2015年”、“8月”和“10日”被标注为主体关系二元组<XX,上映时间>的客体,因此生成的主体关系客体三元组即为<XX,上映时间,2015年8月10日>。For ease of understanding, FIG. 4 shows a schematic structural diagram of the slot filling model. As shown in Figure 4, the slot filling model may include an input layer, a localization layer, an embedding layer, an encoding layer, a decoding layer, and an output layer. Wherein, the encoding layer may include the first Bi-LSTM, and the decoding layer may include a positional attention module, a relational attention module and a second Bi-LSTM. If you want to extract the release time of the TV series "XX", you can combine the subject "XX" and the relationship "release time" into a relation binary group <XX, release time>, and obtain the description relationship binary group <XX, release time >'s text "XX, the play was launched on August 10, 2015". The text "XX, the play was launched on August 10, 2015" can be segmented into the text word sequence "XX, the play was launched on August 10, 2015". The subject relation binary group <XX, release time> and the text word sequence "XX, the play was launched on August 10, 2015" are input into the slot filling model, and the corresponding labeling result "O, O, O, O, B" is obtained. , I, E, O". It can be seen that the words "2015", "August" and "10th" in the text word sequence are marked as the objects of the subject relationship binary <XX, release time>, so the generated subject relationship object triple is <XX, Released, August 10, 2015>.

从图3中可以看出,与图2对应的实施例相比,本实施例中的用于生成信息的方法的流程300突出了槽填充模型的结构。由此,本实施例描述的方案通过在槽填充模型中添加位置注意力模块和关系注意力模块,从而增加主体和关系的位置,以及关系的语义相似度等信息,进一步提高了客体识别精准度。It can be seen from FIG. 3 that, compared with the embodiment corresponding to FIG. 2 , theflow 300 of the method for generating information in this embodiment highlights the structure of the slot filling model. Therefore, the solution described in this embodiment adds a position attention module and a relationship attention module to the slot filling model, thereby increasing the position of the subject and the relationship, as well as the semantic similarity of the relationship and other information, and further improving the object recognition accuracy. .

进一步参考图5,作为对上述各图所示的方法的实现,本申请提供了一种用于生成信息的装置的一个实施例,该装置实施例与图2所示的方法实施例相对应,该装置具体可以应用于各种电子设备中。Further referring to FIG. 5 , as an implementation of the methods shown in the above figures, the present application provides an embodiment of an apparatus for generating information, and the apparatus embodiment corresponds to the method embodiment shown in FIG. 2 , Specifically, the device can be applied to various electronic devices.

如图5所示,本实施例的用于生成信息的装置500可以包括:获取单元501、切分单元502、标注单元503和生成单元504。其中,获取单元501,被配置成获取主体关系二元组和文本,其中,主体关系二元组包括主体和关系;切分单元502,被配置成将文本切分成文本词序列;标注单元503,被配置成将主体关系二元组和文本词序列输入至预先训练的槽填充模型,得到文本词序列的标注结果,其中,槽填充模型用于标注文本词序列中的客体;生成单元504,被配置成基于主体关系二元组和标注结果,生成主体关系客体三元组,其中,主体关系客体三元组包括文本的主体、关系和客体。As shown in FIG. 5 , theapparatus 500 for generating information in this embodiment may include: an obtainingunit 501 , asegmentation unit 502 , alabeling unit 503 and agenerating unit 504 . Wherein, the obtainingunit 501 is configured to obtain the subject relation binary group and the text, wherein the subject relation binary group includes the subject and the relationship; thesegmentation unit 502 is configured to segment the text into text word sequences; thelabeling unit 503, It is configured to input the subject relation binary group and the text word sequence into the pre-trained slot filling model to obtain the labeling result of the text word sequence, wherein the slot filling model is used to label the objects in the text word sequence; thegenerating unit 504 is configured by It is configured to generate a subject-relationship-object triplet based on the subject-relationship two-tuple and the labeling result, wherein the subject-relationship-object triplet includes a subject, a relationship, and an object of the text.

在本实施例中,用于生成信息的装置500中:获取单元501、切分单元502、标注单元503和生成单元504的具体处理及其所带来的技术效果可分别参考图2对应实施例中的步骤201-204的相关说明,在此不再赘述。In this embodiment, in theapparatus 500 for generating information: the specific processing of the acquiringunit 501 , the dividingunit 502 , thelabeling unit 503 and thegenerating unit 504 and the technical effects brought by them can refer to the corresponding embodiment in FIG. The relevant descriptions of steps 201-204 in the above will not be repeated here.

在本实施例的一些可选的实现方式中,槽填充模型包括输入层、定位层、嵌入层、编码层、解码层和输出层。In some optional implementations of this embodiment, the slot filling model includes an input layer, a positioning layer, an embedding layer, an encoding layer, a decoding layer, and an output layer.

在本实施例的一些可选的实现方式中,标注单元503包括:输入子单元(图中未示出),被配置成将主体关系二元组和文本词序列输入至输入层,得到词序列特征和距离特征;定位子单元(图中未示出),被配置成将距离特征输入到定位层,得到位置信息;嵌入子单元(图中未示出),被配置成将词序列特征和位置信息输入至嵌入层,得到词序列向量和位置向量;编码子单元(图中未示出),被配置成将词序列向量输入至编码层,得到编码向量;解码子单元(图中未示出),被配置成将位置向量和编码向量输入至解码层,得到解码向量;输出子单元(图中未示出),被配置成将解码向量输入至输出层,得到标注结果。In some optional implementations of this embodiment, thelabeling unit 503 includes: an input subunit (not shown in the figure), which is configured to input the subject relationship two-tuple and the text word sequence into the input layer to obtain the word sequence feature and distance feature; a localization subunit (not shown in the figure), configured to input the distance feature into the localization layer to obtain location information; an embedding subunit (not shown in the figure), configured to combine the word sequence features and The position information is input to the embedding layer to obtain the word sequence vector and the position vector; the coding subunit (not shown in the figure) is configured to input the word sequence vector to the coding layer to obtain the coding vector; the decoding subunit (not shown in the figure) output), is configured to input the position vector and the encoding vector to the decoding layer to obtain the decoding vector; the output subunit (not shown in the figure) is configured to input the decoding vector to the output layer to obtain the labeling result.

在本实施例的一些可选的实现方式中,编码层包括第一双向长短期记忆网络,解码层包括位置注意力模块、关系注意力模块和第二双向长短期记忆网络。In some optional implementations of this embodiment, the encoding layer includes a first bidirectional long short-term memory network, and the decoding layer includes a location attention module, a relational attention module, and a second bidirectional long short-term memory network.

在本实施例的一些可选的实现方式中,编码子单元进一步被配置成:将位置向量和编码向量的拼接输入至位置注意力模块,得到文本词序列中的词距离主体和关系的位置信息;将关系的长短期记忆网络编码和编码向量输入至关系注意力模块,得到文本词序列中的词与关系的语义相似度;将编码向量、文本词序列中的词距离主体和关系的位置信息和文本词序列中的词与关系的语义相似度输入至第二双向长短期记忆网络,得到解码向量。In some optional implementations of this embodiment, the encoding subunit is further configured to: input the splicing of the position vector and the encoding vector to the position attention module to obtain the position information of the word distance subject and relationship in the text word sequence ; Input the relational long and short-term memory network coding and coding vector into the relational attention module to obtain the semantic similarity between the words in the text word sequence and the relationship; the coding vector, the word distance in the text word sequence and the position information of the relationship The semantic similarity between words and relations in the text word sequence is input to the second bidirectional long short-term memory network to obtain a decoding vector.

在本实施例的一些可选的实现方式中,输出子单元进一步被配置成:通过激活函数对文本词序列中的词的解码向量进行多分类,得到文本词序列中的词属于多种类别中的每种类别的概率,其中,多分类是计算词属于多种类别中的每种类别的概率;基于文本词序列中的词的最大概率对应的类别对文本词序列进行标注,生成标注结果。In some optional implementations of this embodiment, the output subunit is further configured to: perform multi-classification on the decoded vectors of words in the text word sequence through an activation function, and obtain that the words in the text word sequence belong to multiple categories The probability of each category of , wherein, multi-classification is to calculate the probability that the word belongs to each category of multiple categories; based on the category corresponding to the maximum probability of the word in the text word sequence, the text word sequence is labeled, and the labeling result is generated.

在本实施例的一些可选的实现方式中,词序列特征包括以下至少一项:文本词序列、文本词序列的词性序列、文本词序列的命名实体识别序列和关系的关系词序列,距离特征包括以下至少一项:文本词序列中的词到主体的距离、文本词序列中的词到关系的距离。In some optional implementations of this embodiment, the word sequence feature includes at least one of the following: a text word sequence, a part-of-speech sequence of the text word sequence, a named entity recognition sequence of the text word sequence, and a relational word sequence of a relationship, and a distance feature It includes at least one of the following: the distance from the word in the text word sequence to the subject, and the distance from the word in the text word sequence to the relationship.

在本实施例的一些可选的实现方式中,槽填充模型采用BIOES序列标注方式对文本词序列进行标注。In some optional implementations of this embodiment, the slot filling model uses the BIOES sequence labeling method to label the text word sequence.

下面参考图6,其示出了适于用来实现本申请实施例的电子设备(例如图1所示的服务器103)的计算机系统600的结构示意图。图6示出的电子设备仅仅是一个示例,不应对本申请实施例的功能和使用范围带来任何限制。Referring next to FIG. 6 , it shows a schematic structural diagram of acomputer system 600 suitable for implementing the electronic device (for example, theserver 103 shown in FIG. 1 ) according to the embodiment of the present application. The electronic device shown in FIG. 6 is only an example, and should not impose any limitations on the functions and scope of use of the embodiments of the present application.

如图6所示,计算机系统600包括中央处理单元(CPU)601,其可以根据存储在只读存储器(ROM)602中的程序或者从存储部分608加载到随机访问存储器(RAM)603中的程序而执行各种适当的动作和处理。在RAM 603中,还存储有系统600操作所需的各种程序和数据。CPU 601、ROM 602以及RAM 603通过总线604彼此相连。输入/输出(I/O)接口605也连接至总线604。As shown in FIG. 6, acomputer system 600 includes a central processing unit (CPU) 601, which can be loaded into a random access memory (RAM) 603 according to a program stored in a read only memory (ROM) 602 or a program from astorage section 608 Instead, various appropriate actions and processes are performed. In theRAM 603, various programs and data necessary for the operation of thesystem 600 are also stored. The CPU 601 , theROM 602 , and theRAM 603 are connected to each other through abus 604 . An input/output (I/O)interface 605 is also connected tobus 604 .

以下部件连接至I/O接口605:包括键盘、鼠标等的输入部分606;包括诸如阴极射线管(CRT)、液晶显示器(LCD)等以及扬声器等的输出部分607;包括硬盘等的存储部分608;以及包括诸如LAN卡、调制解调器等的网络接口卡的通信部分609。通信部分609经由诸如因特网的网络执行通信处理。驱动器610也根据需要连接至I/O接口605。可拆卸介质611,诸如磁盘、光盘、磁光盘、半导体存储器等等,根据需要安装在驱动器610上,以便于从其上读出的计算机程序根据需要被安装入存储部分608。The following components are connected to the I/O interface 605: aninput section 606 including a keyboard, a mouse, etc.; anoutput section 607 including a cathode ray tube (CRT), a liquid crystal display (LCD), etc., and a speaker, etc.; astorage section 608 including a hard disk, etc. ; and acommunication section 609 including a network interface card such as a LAN card, a modem, and the like. Thecommunication section 609 performs communication processing via a network such as the Internet. Adrive 610 is also connected to the I/O interface 605 as needed. Aremovable medium 611, such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, etc., is mounted on thedrive 610 as needed so that a computer program read therefrom is installed into thestorage section 608 as needed.

特别地,根据本公开的实施例,上文参考流程图描述的过程可以被实现为计算机软件程序。例如,本公开的实施例包括一种计算机程序产品,其包括承载在计算机可读介质上的计算机程序,该计算机程序包含用于执行流程图所示的方法的程序代码。在这样的实施例中,该计算机程序可以通过通信部分609从网络上被下载和安装,和/或从可拆卸介质611被安装。在该计算机程序被中央处理单元(CPU)601执行时,执行本申请的方法中限定的上述功能。In particular, according to embodiments of the present disclosure, the processes described above with reference to the flowcharts may be implemented as computer software programs. For example, embodiments of the present disclosure include a computer program product comprising a computer program carried on a computer-readable medium, the computer program containing program code for performing the method illustrated in the flowchart. In such an embodiment, the computer program may be downloaded and installed from the network via thecommunication portion 609 and/or installed from theremovable medium 611 . When the computer program is executed by the central processing unit (CPU) 601, the above-described functions defined in the method of the present application are performed.

需要说明的是,本申请所述的计算机可读介质可以是计算机可读信号介质或者计算机可读存储介质或者是上述两者的任意组合。计算机可读存储介质例如可以是——但不限于——电、磁、光、电磁、红外线、或半导体的系统、装置或器件,或者任意以上的组合。计算机可读存储介质的更具体的例子可以包括但不限于:具有一个或多个导线的电连接、便携式计算机磁盘、硬盘、随机访问存储器(RAM)、只读存储器(ROM)、可擦式可编程只读存储器(EPROM或闪存)、光纤、便携式紧凑磁盘只读存储器(CD-ROM)、光存储器件、磁存储器件、或者上述的任意合适的组合。在本申请中,计算机可读存储介质可以是任何包含或存储程序的有形介质,该程序可以被指令执行系统、装置或者器件使用或者与其结合使用。而在本申请中,计算机可读的信号介质可以包括在基带中或者作为载波一部分传播的数据信号,其中承载了计算机可读的程序代码。这种传播的数据信号可以采用多种形式,包括但不限于电磁信号、光信号或上述的任意合适的组合。计算机可读的信号介质还可以是计算机可读存储介质以外的任何计算机可读介质,该计算机可读介质可以发送、传播或者传输用于由指令执行系统、装置或者器件使用或者与其结合使用的程序。计算机可读介质上包含的程序代码可以用任何适当的介质传输,包括但不限于:无线、电线、光缆、RF等等,或者上述的任意合适的组合。It should be noted that the computer-readable medium described in this application may be a computer-readable signal medium or a computer-readable storage medium, or any combination of the above two. The computer-readable storage medium can be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus or device, or a combination of any of the above. More specific examples of computer readable storage media may include, but are not limited to, electrical connections with one or more wires, portable computer disks, hard disks, random access memory (RAM), read only memory (ROM), erasable Programmable read only memory (EPROM or flash memory), fiber optics, portable compact disk read only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination of the foregoing. In this application, a computer-readable storage medium can be any tangible medium that contains or stores a program that can be used by or in conjunction with an instruction execution system, apparatus, or device. In this application, however, a computer-readable signal medium may include a data signal propagated in baseband or as part of a carrier wave, carrying computer-readable program code therein. Such propagated data signals may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the foregoing. A computer-readable signal medium can also be any computer-readable medium other than a computer-readable storage medium that can transmit, propagate, or transport the program for use by or in connection with the instruction execution system, apparatus, or device . Program code embodied on a computer readable medium may be transmitted using any suitable medium including, but not limited to, wireless, wireline, optical fiber cable, RF, etc., or any suitable combination of the foregoing.

可以以一种或多种程序设计语言或其组合来编写用于执行本申请的操作的计算机程序代码,所述程序设计语言包括面向目标的程序设计语言—诸如Java、Smalltalk、C++,还包括常规的过程式程序设计语言—诸如”C”语言或类似的程序设计语言。程序代码可以完全地在用户计算机上执行、部分地在用户计算机上执行、作为一个独立的软件包执行、部分在用户计算机上部分在远程计算机上执行、或者完全在远程计算机或电子设备上执行。在涉及远程计算机的情形中,远程计算机可以通过任意种类的网络——包括局域网(LAN)或广域网(WAN)—连接到用户计算机,或者,可以连接到外部计算机(例如利用因特网服务提供商来通过因特网连接)。Computer program code for performing the operations of the present application may be written in one or more programming languages, including object-oriented programming languages—such as Java, Smalltalk, C++, but also conventional Procedural programming language - such as "C" language or similar programming language. The program code may execute entirely on the user's computer, partly on the user's computer, as a stand-alone software package, partly on the user's computer and partly on a remote computer, or entirely on the remote computer or electronic device. In the case of a remote computer, the remote computer may be connected to the user's computer through any kind of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer (eg, using an Internet service provider through Internet connection).

附图中的流程图和框图,图示了按照本申请各种实施例的系统、方法和计算机程序产品的可能实现的体系架构、功能和操作。在这点上,流程图或框图中的每个方框可以代表一个模块、程序段、或代码的一部分,该模块、程序段、或代码的一部分包含一个或多个用于实现规定的逻辑功能的可执行指令。也应当注意,在有些作为替换的实现中,方框中所标注的功能也可以以不同于附图中所标注的顺序发生。例如,两个接连地表示的方框实际上可以基本并行地执行,它们有时也可以按相反的顺序执行,这依所涉及的功能而定。也要注意的是,框图和/或流程图中的每个方框、以及框图和/或流程图中的方框的组合,可以用执行规定的功能或操作的专用的基于硬件的系统来实现,或者可以用专用硬件与计算机指令的组合来实现。The flowchart and block diagrams in the Figures illustrate the architecture, functionality, and operation of possible implementations of systems, methods and computer program products according to various embodiments of the present application. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of code that contains one or more logical functions for implementing the specified functions executable instructions. It should also be noted that, in some alternative implementations, the functions noted in the blocks may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It is also noted that each block of the block diagrams and/or flowchart illustrations, and combinations of blocks in the block diagrams and/or flowchart illustrations, can be implemented in dedicated hardware-based systems that perform the specified functions or operations , or can be implemented in a combination of dedicated hardware and computer instructions.

描述于本申请实施例中所涉及到的单元可以通过软件的方式实现,也可以通过硬件的方式来实现。所描述的单元也可以设置在处理器中,例如,可以描述为:一种处理器包括获取单元、切分单元、标注单元和生成单元。其中,这些单元的名称在种情况下并不构成对该单元本身的限定,例如,获取单元还可以被描述为“获取主体关系二元组和文本的单元”。The units involved in the embodiments of the present application may be implemented in a software manner, and may also be implemented in a hardware manner. The described unit can also be set in the processor, for example, it can be described as: a processor includes an acquisition unit, a segmentation unit, a labeling unit and a generating unit. Wherein, the names of these units do not constitute a limitation on the unit itself in this case, for example, the acquisition unit may also be described as "a unit for acquiring subject-relational two-tuple and text".

作为另一方面,本申请还提供了一种计算机可读介质,该计算机可读介质可以是上述实施例中描述的电子设备中所包含的;也可以是单独存在,而未装配入该电子设备中。上述计算机可读介质承载有一个或者多个程序,当上述一个或者多个程序被该电子设备执行时,使得该电子设备:获取主体关系二元组和文本,其中,主体关系二元组包括主体和关系;将文本切分成文本词序列;将主体关系二元组和文本词序列输入至预先训练的槽填充模型,得到文本词序列的标注结果,其中,槽填充模型用于标注文本词序列中的客体;基于主体关系二元组和标注结果,生成主体关系客体三元组,其中,主体关系客体三元组包括文本的主体、关系和客体。As another aspect, the present application also provides a computer-readable medium. The computer-readable medium may be included in the electronic device described in the above embodiments; it may also exist alone without being assembled into the electronic device. middle. The above-mentioned computer-readable medium carries one or more programs, and when the above-mentioned one or more programs are executed by the electronic device, the electronic device is made to: acquire a subject relationship dyad and text, wherein the subject relationship dyad includes a subject and relationship; split the text into text word sequences; input the subject relation binary group and the text word sequence into the pre-trained slot filling model to obtain the labeling result of the text word sequence, where the slot filling model is used to label the text word sequence in the Based on the subject relation binary and the labeling result, the subject relation object triple is generated, wherein the subject relation object triple includes the subject, relation and object of the text.

以上描述仅为本申请的较佳实施例以及对所运用技术原理的说明。本领域技术人员应当理解,本申请中所涉及的发明范围,并不限于上述技术特征的特定组合而成的技术方案,同时也应涵盖在不脱离上述发明构思的情况下,由上述技术特征或其等同特征进行任意组合而形成的其它技术方案。例如上述特征与本申请中公开的(但不限于)具有类似功能的技术特征进行互相替换而形成的技术方案。The above description is only a preferred embodiment of the present application and an illustration of the applied technical principles. Those skilled in the art should understand that the scope of the invention involved in this application is not limited to the technical solution formed by the specific combination of the above technical features, and should also cover the above technical features or Other technical solutions formed by any combination of its equivalent features. For example, a technical solution is formed by replacing the above-mentioned features with the technical features disclosed in this application (but not limited to) with similar functions.

Claims (18)

CN202010005728.9A2020-01-032020-01-03 Method and apparatus for generating informationActiveCN111241209B (en)

Priority Applications (1)

Application NumberPriority DateFiling DateTitle
CN202010005728.9ACN111241209B (en)2020-01-032020-01-03 Method and apparatus for generating information

Applications Claiming Priority (1)

Application NumberPriority DateFiling DateTitle
CN202010005728.9ACN111241209B (en)2020-01-032020-01-03 Method and apparatus for generating information

Publications (2)

Publication NumberPublication Date
CN111241209Atrue CN111241209A (en)2020-06-05
CN111241209B CN111241209B (en)2023-07-11

Family

ID=70865425

Family Applications (1)

Application NumberTitlePriority DateFiling Date
CN202010005728.9AActiveCN111241209B (en)2020-01-032020-01-03 Method and apparatus for generating information

Country Status (1)

CountryLink
CN (1)CN111241209B (en)

Cited By (6)

* Cited by examiner, † Cited by third party
Publication numberPriority datePublication dateAssigneeTitle
CN111639500A (en)*2020-04-232020-09-08平安国际智慧城市科技股份有限公司Semantic role labeling method and device, computer equipment and storage medium
CN112560475A (en)*2020-11-162021-03-26和美(深圳)信息技术股份有限公司Triple extraction method and system
CN113704392A (en)*2021-04-132021-11-26腾讯科技(深圳)有限公司Method, device and equipment for extracting entity relationship in text and storage medium
CN113743118A (en)*2021-07-222021-12-03武汉工程大学 Entity relation extraction method in legal documents based on fusion relation information coding
CN114372454A (en)*2020-10-142022-04-19腾讯科技(深圳)有限公司Text information extraction method, model training method, device and storage medium
CN117407492A (en)*2023-12-142024-01-16广东海洋大学 Keyword sequence generation method, system and equipment based on knowledge graph

Citations (9)

* Cited by examiner, † Cited by third party
Publication numberPriority datePublication dateAssigneeTitle
CN104778186A (en)*2014-01-152015-07-15阿里巴巴集团控股有限公司Method and system for hanging commodity object to standard product unit (SPU)
US20180060306A1 (en)*2016-08-252018-03-01Abbyy Infopoisk LlcExtracting facts from natural language texts
CN109325201A (en)*2018-08-152019-02-12北京百度网讯科技有限公司 Method, device, device and storage medium for generating entity relationship data
CN109408812A (en)*2018-09-302019-03-01北京工业大学A method of the sequence labelling joint based on attention mechanism extracts entity relationship
CN110147437A (en)*2019-05-232019-08-20北京金山数字娱乐科技有限公司A kind of searching method and device of knowledge based map
CN110275963A (en)*2019-06-252019-09-24北京百度网讯科技有限公司 Method and device for outputting information
CN110275962A (en)*2019-06-252019-09-24北京百度网讯科技有限公司 Method and device for outputting information
US20190294648A1 (en)*2018-03-232019-09-26Baidu Online Network Technology (Beijing) Co., Ltd.Artificial intelligence-based triple checking method and apparatus, device and storage medium
CN110472235A (en)*2019-07-222019-11-19北京航天云路有限公司A kind of end-to-end entity relationship joint abstracting method towards Chinese text

Patent Citations (9)

* Cited by examiner, † Cited by third party
Publication numberPriority datePublication dateAssigneeTitle
CN104778186A (en)*2014-01-152015-07-15阿里巴巴集团控股有限公司Method and system for hanging commodity object to standard product unit (SPU)
US20180060306A1 (en)*2016-08-252018-03-01Abbyy Infopoisk LlcExtracting facts from natural language texts
US20190294648A1 (en)*2018-03-232019-09-26Baidu Online Network Technology (Beijing) Co., Ltd.Artificial intelligence-based triple checking method and apparatus, device and storage medium
CN109325201A (en)*2018-08-152019-02-12北京百度网讯科技有限公司 Method, device, device and storage medium for generating entity relationship data
CN109408812A (en)*2018-09-302019-03-01北京工业大学A method of the sequence labelling joint based on attention mechanism extracts entity relationship
CN110147437A (en)*2019-05-232019-08-20北京金山数字娱乐科技有限公司A kind of searching method and device of knowledge based map
CN110275963A (en)*2019-06-252019-09-24北京百度网讯科技有限公司 Method and device for outputting information
CN110275962A (en)*2019-06-252019-09-24北京百度网讯科技有限公司 Method and device for outputting information
CN110472235A (en)*2019-07-222019-11-19北京航天云路有限公司A kind of end-to-end entity relationship joint abstracting method towards Chinese text

Non-Patent Citations (3)

* Cited by examiner, † Cited by third party
Title
SAURABH SRIVASTAVA ET AL.: "Hierarchical Capsule Based Neural Network Architecture for Sequence Labeling", 《2019 INTERNATIONAL JOINT CONFERENCE ON NEURAL NETWORKS (IJCNN)》*
曹明宇 等: "基于神经网络的药物实体与关系联合抽取", 《计算机研究与发展》, vol. 56, no. 7*
马黎: "基于最大二元组和综合特征的文本分类框架", 《西北师范大学学报(自然科学版)》, no. 5*

Cited By (9)

* Cited by examiner, † Cited by third party
Publication numberPriority datePublication dateAssigneeTitle
CN111639500A (en)*2020-04-232020-09-08平安国际智慧城市科技股份有限公司Semantic role labeling method and device, computer equipment and storage medium
WO2021212681A1 (en)*2020-04-232021-10-28平安国际智慧城市科技股份有限公司Semantic role annotation method and apparatus, and computer device and storage medium
CN114372454A (en)*2020-10-142022-04-19腾讯科技(深圳)有限公司Text information extraction method, model training method, device and storage medium
CN112560475A (en)*2020-11-162021-03-26和美(深圳)信息技术股份有限公司Triple extraction method and system
CN112560475B (en)*2020-11-162023-05-12和美(深圳)信息技术股份有限公司Triplet extraction method and system
CN113704392A (en)*2021-04-132021-11-26腾讯科技(深圳)有限公司Method, device and equipment for extracting entity relationship in text and storage medium
CN113743118A (en)*2021-07-222021-12-03武汉工程大学 Entity relation extraction method in legal documents based on fusion relation information coding
CN117407492A (en)*2023-12-142024-01-16广东海洋大学 Keyword sequence generation method, system and equipment based on knowledge graph
CN117407492B (en)*2023-12-142024-02-23广东海洋大学 Keyword sequence generation method, system and equipment based on knowledge graph

Also Published As

Publication numberPublication date
CN111241209B (en)2023-07-11

Similar Documents

PublicationPublication DateTitle
CN111241209B (en) Method and apparatus for generating information
JP7112536B2 (en) Method and apparatus for mining entity attention points in text, electronic device, computer-readable storage medium and computer program
JP7301922B2 (en) Semantic retrieval method, device, electronic device, storage medium and computer program
CN107783960B (en) Method, apparatus and device for extracting information
CN107680579B (en) Text regularization model training method and device, text regularization method and device
CN111709240A (en) Entity relationship extraction method, device, device and storage medium thereof
US11036996B2 (en)Method and apparatus for determining (raw) video materials for news
CN111314388B (en) Method and apparatus for detecting SQL injection
CN111259112A (en)Medical fact verification method and device
WO2022174496A1 (en)Data annotation method and apparatus based on generative model, and device and storage medium
US20230367972A1 (en)Method and apparatus for processing model data, electronic device, and computer readable medium
CN113947095B (en)Multilingual text translation method, multilingual text translation device, computer equipment and storage medium
CN113158656B (en)Ironic content recognition method, ironic content recognition device, electronic device, and storage medium
CN110807311B (en)Method and device for generating information
WO2020182123A1 (en)Method and device for pushing statement
CN111368551A (en)Method and device for determining event subject
CN113392929A (en)Biological sequence feature extraction method based on word embedding and self-encoder fusion
CN112989797B (en) Model training, text expansion methods, devices, equipment and storage media
CN118820445A (en) Answer text generation method, device, equipment and storage medium
CN117131152B (en)Information storage method, apparatus, electronic device, and computer readable medium
CN117556814B (en) A Tibetan word segmentation and part-of-speech tagging integrated method and system
CN113761931A (en)Information processing method, device, electronic equipment and storage medium
CN116416645A (en)Attribute and image cross-mode pedestrian re-identification method and device based on dual-branch Transformer network
CN115048916A (en)Table processing method and device
CN112328751A (en)Method and device for processing text

Legal Events

DateCodeTitleDescription
PB01Publication
PB01Publication
SE01Entry into force of request for substantive examination
SE01Entry into force of request for substantive examination
GR01Patent grant
GR01Patent grant

[8]ページ先頭

©2009-2025 Movatter.jp