[go: up one dir, main page]

CN111241209B - Method and apparatus for generating information - Google Patents

Method and apparatus for generating information Download PDF

Info

Publication number
CN111241209B
CN111241209B CN202010005728.9A CN202010005728A CN111241209B CN 111241209 B CN111241209 B CN 111241209B CN 202010005728 A CN202010005728 A CN 202010005728A CN 111241209 B CN111241209 B CN 111241209B
Authority
CN
China
Prior art keywords
word sequence
relationship
subject
text
text word
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.)
Active
Application number
CN202010005728.9A
Other languages
Chinese (zh)
Other versions
CN111241209A (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 Ltd filed Critical Beijing Baidu Netcom Science and Technology Co Ltd
Priority to CN202010005728.9A priority Critical patent/CN111241209B/en
Publication of CN111241209A publication Critical patent/CN111241209A/en
Application granted granted Critical
Publication of CN111241209B publication Critical patent/CN111241209B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/28Databases characterised by their database models, e.g. relational or object models
    • G06F16/284Relational databases
    • G06F16/288Entity relationship models
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N3/00Computing arrangements based on biological models
    • G06N3/02Neural networks
    • G06N3/04Architecture, e.g. interconnection topology
    • G06N3/044Recurrent networks, e.g. Hopfield networks
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N3/00Computing arrangements based on biological models
    • G06N3/02Neural networks
    • G06N3/04Architecture, e.g. interconnection topology
    • G06N3/045Combinations of networks
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N3/00Computing arrangements based on biological models
    • G06N3/02Neural networks
    • G06N3/08Learning methods

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • Data Mining & Analysis (AREA)
  • General Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Health & Medical Sciences (AREA)
  • Artificial Intelligence (AREA)
  • Biophysics (AREA)
  • Evolutionary Computation (AREA)
  • Biomedical Technology (AREA)
  • Molecular Biology (AREA)
  • Computing Systems (AREA)
  • Computational Linguistics (AREA)
  • Life Sciences & Earth Sciences (AREA)
  • Mathematical Physics (AREA)
  • Software Systems (AREA)
  • Health & Medical Sciences (AREA)
  • Databases & Information Systems (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

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 maps. One embodiment of the method comprises the following steps: 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 text word sequences; inputting the subject relation binary groups and the text word sequences into a pre-trained groove filling model to obtain a labeling result of the text word sequences, wherein the groove filling model is used for labeling objects in the text word sequences; and generating a subject relationship object triplet based on the subject relationship triplet and the labeling result, wherein the subject relationship object triplet comprises a subject, a relationship and an object of the text. This embodiment improves object recognition accuracy.

Description

用于生成信息的方法和装置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 devices 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 expressed 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 Predication Object, subject predicate object) triples are also called subject-relationship-object triples, which refer to triples composed of entity pairs (S and O) and their relationship (P). From the perspective of knowledge graph construction, entity relationship extraction can obtain the relationship attribute values of entities missing, which is used to improve the connectivity of knowledge graphs, and effectively improve the knowledge richness and completeness of knowledge graphs.

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

发明内容Contents of the invention

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

第一方面,本申请实施例提出了一种用于生成信息的方法,获取主体关系二元组和文本,其中,主体关系二元组包括主体和关系;将文本切分成文本词序列;将主体关系二元组和文本词序列输入至预先训练的槽填充模型,得到文本词序列的标注结果,其中,槽填充模型用于标注文本词序列中的客体;基于主体关系二元组和标注结果,生成主体关系客体三元组,其中,主体关系客体三元组包括文本的主体、关系和客体。In the first aspect, the embodiment of the present application proposes a method for generating information to obtain subject-relationship dyads and texts, wherein the subject-relationship dyads include subjects and relations; texts are segmented into text word sequences; subjects The relational dyads and text word sequences are input to the pre-trained slot filling model to obtain the labeling results of the text word sequences, wherein the slot filling model is used to label the objects in the text word sequences; based on the subject-relational dyads and the labeling results, A subject-relation-object triplet is generated, wherein the subject-relation-object triplet 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, the subject-relationship pair and the text word sequence are input to the pre-trained slot filling model to obtain the labeling result of the text word sequence, including: input the subject-relationship pair and the text word sequence into the input layer, Obtain the word sequence feature and distance feature; input the distance feature to the positioning layer to obtain position information; input the word sequence feature and position information to the embedding layer to obtain the word sequence vector and position vector; input the word sequence vector to the encoding layer to obtain Encoding vector; input the position vector and encoding vector to the decoding layer to obtain the decoding vector; input the decoding vector to the output layer to obtain the labeling result.

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

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

在一些实施例中,将解码向量输入至输出层,得到标注结果,包括:通过激活函数对文本词序列中的词的解码向量进行多分类,得到文本词序列中的词属于多种类别中的每种类别的概率,其中,多分类是计算词属于多种类别中的每种类别的概率;基于文本词序列中的词的最大概率对应的类别对文本词序列进行标注,生成标注结果。In some embodiments, the decoding vector is input to the output layer to obtain the labeling result, including: performing multi-classification on the decoding vector of the words in the text word sequence through the activation function, and obtaining the words in the text word sequence belonging to multiple categories The probability of each category, wherein, the multi-classification is to calculate the probability of words belonging to each category in multiple categories; the text word sequence is marked 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 a text word sequence, a named entity recognition sequence of a text word sequence, and a relational word sequence of a relationship, and the distance feature includes at least one of the following: text Distances from words in word sequences to subjects, and distances from words in text word sequences to relations.

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

第二方面,本申请实施例提出了一种用于生成信息的装置,包括:获取单元,被配置成获取主体关系二元组和文本,其中,主体关系二元组包括主体和关系;切分单元,被配置成将文本切分成文本词序列;标注单元,被配置成将主体关系二元组和文本词序列输入至预先训练的槽填充模型,得到文本词序列的标注结果,其中,槽填充模型用于标注文本词序列中的客体;生成单元,被配置成基于主体关系二元组和标注结果,生成主体关系客体三元组,其中,主体关系客体三元组包括文本的主体、关系和客体。In the second aspect, the embodiment of the present application proposes a device for generating information, including: an acquisition unit configured to acquire a subject-relationship tuple and text, wherein the subject-relationship tuple includes subject and relationship; segmentation The unit is configured to divide the text into text word sequences; the labeling unit is configured to input the subject-relationship binary 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 mark the object in the text word sequence; the generating unit is configured to generate a subject-relation-object triplet based on the subject-relationship pair and the tagging result, wherein the subject-relationship-object triplet 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 the subject-relationship pair and the text word sequence to the input layer to obtain the word sequence feature and the distance feature; the localization subunit is configured to input the distance feature Input to the positioning layer to obtain position information; the embedding subunit is configured to input the word sequence feature and position information to the embedding layer to obtain the word sequence vector and position vector; the encoding subunit is configured to input the word sequence vector to the encoding layer to obtain the encoding vector; 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 labeling result.

在一些实施例中,编码层包括第一双向长短期记忆网络,解码层包括位置注意力模块、关系注意力模块和第二双向长短期记忆网络。In some embodiments, the encoding layer includes a first bidirectional LSTM network, and the decoding layer includes a positional attention module, a relational attention module, and a second bidirectional LSTM 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 distance between the word in the text word sequence and the relationship between the subject and the relationship; The network encoding and encoding vector are input to the relationship attention module to obtain the semantic similarity between the words in the text word sequence and the relationship; The semantic similarity with the relationship is input to the second bidirectional long-short-term memory network to obtain a decoding vector.

在一些实施例中,输出子单元进一步被配置成:通过激活函数对文本词序列中的词的解码向量进行多分类,得到文本词序列中的词属于多种类别中的每种类别的概率,其中,多分类是计算词属于多种类别中的每种类别的概率;基于文本词序列中的词的最大概率对应的类别对文本词序列进行标注,生成标注结果。In some embodiments, the output subunit is further configured to: perform multi-classification on the decoding 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 category in multiple categories, Among them, multi-classification is to calculate the probability that words belong to each category in multiple categories; based on the category corresponding to the maximum probability of words in the text word sequence, the text word sequence is tagged to generate tagging results.

在一些实施例中,词序列特征包括以下至少一项:文本词序列、文本词序列的词性序列、文本词序列的命名实体识别序列和关系的关系词序列,距离特征包括以下至少一项:文本词序列中的词到主体的距离、文本词序列中的词到关系的距离。In some embodiments, the word sequence feature includes 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, and a relational word sequence of a relationship, and the distance feature includes at least one of the following: text Distances from words in word sequences to subjects, and distances from words in text word sequences to relations.

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

第三方面,本申请实施例提供了一种电子设备,该电子设备包括:一个或多个处理器;存储装置,其上存储有一个或多个程序;当一个或多个程序被一个或多个处理器执行,使得一个或多个处理器实现如第一方面中任一实现方式描述的方法。In the third aspect, the 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 used by one or more processors, so that one or more processors implement the method described in any implementation manner in 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, the method described in any implementation manner in the first aspect is implemented.

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

附图说明Description of drawings

通过阅读参照以下附图所作的对非限制性实施例所作的详细描述,本申请的其它特征、目的和优点将会变得更明显:Other characteristics, 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 can be applied;

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

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

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

图5是根据本申请的用于生成信息的装置的一个实施例的结构示意图;Fig. 5 is a schematic structural diagram of an embodiment of a device 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 of the embodiment of the present application.

具体实施方式Detailed ways

下面结合附图和实施例对本申请作进一步的详细说明。可以理解的是,此处所描述的具体实施例仅仅用于解释相关发明,而非对该发明的限定。另外还需要说明的是,为了便于描述,附图中仅示出了与有关发明相关的部分。The application will be further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described here are only used to explain related inventions, rather than to limit the invention. It should also 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, in the case of no conflict, the embodiments in the present application and the features in the embodiments can be combined with each other. The present application will be described in detail below with reference to the accompanying drawings and embodiments.

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

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

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

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

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

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

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

继续参考图2,其示出了根据本申请的用于生成信息的方法的一个实施例的流程200。该用于生成信息的方法包括以下步骤:Continue referring to FIG. 2 , which shows a flow 200 of an embodiment of a method for generating information according to the present application. The method for generating information includes the following steps:

步骤201,获取主体关系二元组和文本。Step 201, acquire subject-relationship tuples and text.

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

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

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

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

在本实施例中,上述执行主体可以将主体关系二元组和文本词序列输入至预先训练的槽填充模型,得到文本词序列的标注结果。其中,槽填充模型可以用于标注文本词序列中的客体,因此标注结果至少会标注出文本词序列中的客体。In this embodiment, the execution subject can input the subject-relationship pair and the text word sequence into the pre-trained slot-filling model to obtain the tagging 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 mark 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-relationship pair from the text given the text and the subject-relationship pair. The slot-filling model adds the location of subjects and relations, as well as the semantic similarity of relations, and is a sequence labeling model. The slot-filling model inputs subject-relationship dyads and text word sequences, and outputs the labeling results for each word in the text word sequence. According to the labeling results, the words belonging to the object corresponding to the subject-relational dyad 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 a BIOES sequence tagging method to tag text word sequences. Among them, B is begin, indicating the starting position of the object labeling of multiple words. I is inside, which means the middle part of the object labeling of multiple words. O is outside, which means the part that is not the object. E is end, indicating the end position of the object annotation of multiple words. S is single, which means the object of a single word.

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

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

通常,利用本实施例提供的方法生成大量主体关系客体三元组,可以用于构建知识图谱,提升知识图谱的连通度,高效提升知识图谱的知识丰富度。另外,从应用的角度来看,主体关系客体三元组可以直接满足用户对于知识类的搜索需求。当用户搜索主体关系二元组时,可以直接给出对应的客体的相关信息,有效提高用户检索和浏览的效率。当用户搜索主体时,还可以给出对应的客体的相关信息,极大地丰富了推送给用户的信息的内容。Generally, a large number of subject-object-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, the subject-object triplet can directly meet the user's search needs for knowledge. When a user searches for a subject-relationship dyad, relevant information of the corresponding object can be directly given, effectively improving the efficiency of user retrieval and browsing. When a user searches for a subject, relevant information of 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 firstly obtain subject-relationship dyads and texts; then text is segmented into text word sequences; then subject-relationship dyads and text word sequences are input to the pre-trained The slot-filling model is used to obtain the tagging results of the text word sequence; finally, based on the subject-relationship doublets and the tagging results, the subject-relationship-object triplets are generated. The object is recognized based on the slot-filling model, which retains the sum structure of the subject and the relationship, and improves the accuracy of object recognition.

进一步参考图3,其示出了根据本申请的用于生成信息的方法的又一个实施例的流程300。该用于生成信息的方法中的槽填充模型可以包括输入层、定位层、嵌入层、编码层、解码层和输出层。其中,编码层可以包括第一双向长短期记忆网络(Bi-LSTM,Bidirectional Long Short Term Memory)。解码层可以包括位置注意力模块、关系注意力模块和第二双向长短期记忆网络。具体地,该用于生成信息的方法包括以下步骤:Further referring to FIG. 3 , it shows a flow 300 of still another embodiment of the method for generating information according to the present application. 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. Wherein, the encoding 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, acquire subject-relationship tuples and text.

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

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

步骤303,将主体关系二元组和文本词序列输入至输入层,得到词序列特征和距离特征。Step 303, input the subject-relationship pair and the text word sequence to the input layer to obtain word sequence features and distance features.

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

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

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

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

在本实施例中,上述执行主体可以将词序列特征和位置信息输入至嵌入层,得到词序列向量和位置。其中,嵌入层与输出层和定位层分别相连,不仅可以对文本词序列、文本词序列的词性序列、文本词序列的命名实体识别序列和关系的关系词序列等词序列特征进行向量化,还可以对文本词序列中的词的位置信息进行向量化。In this embodiment, the above-mentioned execution subject may input word sequence features and position information into the embedding layer to obtain word sequence vectors and positions. 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 the words in the 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 positional features.

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

在本实施例中,上述执行主体可以将词序列向量输入至编码层,得到编码向量。其中,编码层与嵌入层相连,可以对词序列向量进行编码。由于编码层包括第一双向长短期记忆网络,因此编码层可以采用第一双向长短期记忆网络对词序列向量进行编码。In this embodiment, the execution subject may input the word sequence vector into the encoding layer to obtain the encoding 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-short-term memory network, the encoding layer can use the first bidirectional long-short-term memory network to encode the word sequence vector.

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

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

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

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

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

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

在本实施例中,上述执行主体可以将编码向量、文本词序列中的词距离主体和关系的位置信息和文本词序列中的词与关系的语义相似度输入至第二双向长短期记忆网络,得到解码向量。In this embodiment, the above-mentioned execution subject can input the encoding vector, the word distance subject and the position information of the relationship in the text word sequence and the semantic similarity between the word and the relationship in the text word sequence to 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 execution subject may input the decoding vector to the output layer to obtain the labeling result. Wherein, the output layer is connected to 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 executive body can perform multi-classification on the decoding vectors of the words in the text word sequence through the 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 is tagged based on the category corresponding to the maximum probability of the word in the text word sequence, and a tagging result is generated. Among them, multi-category is to calculate the probability that a word belongs to each category in multiple categories. The activation function can be Softmax, for example. Softmax can perform multi-classification on the decoding vector of each word in the text word sequence, and represent the relative probability between different categories, that is, score the probabilities of the BIOES labels separately, and then take one of them The label with the highest probability, so as to complete the labeling of each word in the sequence.

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

在本实施例中,步骤311的具体操作已在图2所示的实施例中步骤204中进行了详细的介绍,在此不再赘述。In this embodiment, the specific operation of step 311 has been introduced in detail in step 204 in the embodiment shown in FIG. 2 , and will not be 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 diagram of the structure 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 a first Bi-LSTM, and the decoding layer may include a position attention module, a relation 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 relational dyad <XX, release time>, and obtain the description relation dyad <XX, release time >The text of "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 relationship dyad <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 , I, E, O". It can be seen that the words "2015", "August" and "10th" in the text word sequence are marked as the object of the subject relationship dyad <XX, release time>, so the generated subject relationship object triplet is <XX, release time, August 10, 2015>.

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

进一步参考图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 a device for generating information, the device embodiment corresponds to the method embodiment shown in FIG. 2 , The device can be specifically applied to various electronic devices.

如图5所示,本实施例的用于生成信息的装置500可以包括:获取单元501、切分单元502、标注单元503和生成单元504。其中,获取单元501,被配置成获取主体关系二元组和文本,其中,主体关系二元组包括主体和关系;切分单元502,被配置成将文本切分成文本词序列;标注单元503,被配置成将主体关系二元组和文本词序列输入至预先训练的槽填充模型,得到文本词序列的标注结果,其中,槽填充模型用于标注文本词序列中的客体;生成单元504,被配置成基于主体关系二元组和标注结果,生成主体关系客体三元组,其中,主体关系客体三元组包括文本的主体、关系和客体。As shown in FIG. 5 , the apparatus 500 for generating information in this embodiment may include: an acquiring unit 501 , a segmentation unit 502 , a labeling unit 503 and a generating unit 504 . Wherein, the acquisition unit 501 is configured to acquire the subject-relationship pair and the text, wherein the subject-relationship pair includes a subject and a relationship; the segmentation unit 502 is configured to segment the text into text word sequences; the labeling unit 503, It is configured to input the subject-relationship pair 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 mark the object in the text word sequence; the generating unit 504 is It is configured to generate a subject-relation-object triplet based on the subject-relationship pair and the labeling result, wherein the subject-relationship-object triplet includes the subject, relation and object of the text.

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

在本实施例的一些可选的实现方式中,槽填充模型包括输入层、定位层、嵌入层、编码层、解码层和输出层。In some optional implementation manners 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, the labeling unit 503 includes: an input subunit (not shown in the figure), configured to input the subject-relationship pair and the text word sequence into the input layer to obtain the word sequence feature and distance features; the positioning subunit (not shown in the figure), is configured to input the distance feature to the positioning layer to obtain position information; the embedding subunit (not shown in the figure), is configured to use the word sequence feature and The location 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), configured to input the position vector and 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 position attention module, a relation 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 concatenation of the position vector and the encoding vector to the position attention module to obtain the position information of the distance subject and relationship between words in the text word sequence ; Input the long-short-term memory network encoding and encoding vector of the relationship into the relationship 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 and the location 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: use an activation function to perform multi-classification on the decoding vectors of the words in the text word sequence, 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 words belong to each category in multiple categories; based on the category corresponding to the maximum probability of words in the text word sequence, the text word sequence is marked to generate the labeling result.

在本实施例的一些可选的实现方式中,词序列特征包括以下至少一项:文本词序列、文本词序列的词性序列、文本词序列的命名实体识别序列和关系的关系词序列,距离特征包括以下至少一项:文本词序列中的词到主体的距离、文本词序列中的词到关系的距离。In some optional implementations of this embodiment, the word sequence features include at least one of the following: text word sequences, part-of-speech sequences of text word sequences, named entity recognition sequences of text word sequences and relational word sequences of relations, distance features At least one of the following is included: 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 relation.

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

下面参考图6,其示出了适于用来实现本申请实施例的电子设备(例如图1所示的服务器103)的计算机系统600的结构示意图。图6示出的电子设备仅仅是一个示例,不应对本申请实施例的功能和使用范围带来任何限制。Referring now to FIG. 6 , it shows a schematic structural diagram of a computer system 600 suitable for implementing the electronic device (such as the server 103 shown in FIG. 1 ) of the embodiment of the present application. The electronic device shown in FIG. 6 is only an example, and should not limit the functions and scope of use of this embodiment 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 , a computer system 600 includes a central processing unit (CPU) 601 that can be programmed according to a program stored in a read-only memory (ROM) 602 or a program loaded from a storage section 608 into a random-access memory (RAM) 603 Instead, various appropriate actions and processes are performed. In the RAM 603, various programs and data necessary for the operation of the system 600 are also stored. The CPU 601 , ROM 602 , and RAM 603 are connected to each other via a bus 604 . An input/output (I/O) interface 605 is also connected to the bus 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: an input section 606 including a keyboard, a mouse, etc.; an output section 607 including a cathode ray tube (CRT), a liquid crystal display (LCD), etc., and a speaker; a storage section 608 including a hard disk, etc. and a communication section 609 including a network interface card such as a LAN card, a modem, or the like. The communication section 609 performs communication processing via a network such as the Internet. A drive 610 is also connected to the I/O interface 605 as needed. A removable medium 611 such as a magnetic disk, optical disk, magneto-optical disk, semiconductor memory, etc. is mounted on the drive 610 as necessary so that a computer program read therefrom is installed into the storage section 608 as necessary.

特别地,根据本公开的实施例,上文参考流程图描述的过程可以被实现为计算机软件程序。例如,本公开的实施例包括一种计算机程序产品,其包括承载在计算机可读介质上的计算机程序,该计算机程序包含用于执行流程图所示的方法的程序代码。在这样的实施例中,该计算机程序可以通过通信部分609从网络上被下载和安装,和/或从可拆卸介质611被安装。在该计算机程序被中央处理单元(CPU)601执行时,执行本申请的方法中限定的上述功能。In particular, according to an embodiment of the present disclosure, the processes described above with reference to the flowcharts can be implemented as computer software programs. For example, embodiments of the present disclosure include a computer program product, which includes a computer program carried on a computer-readable medium, where the computer program includes program codes for executing the methods shown in the flowcharts. In such an embodiment, the computer program may be downloaded and installed from a network via communication portion 609 and/or installed from removable media 611 . When the computer program is executed by the central processing unit (CPU) 601, the above-mentioned 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 two. A computer readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device, or device, or any combination thereof. More specific examples of computer-readable storage media may include, but are not limited to, electrical connections with one or more wires, portable computer diskettes, hard disks, random access memory (RAM), read-only memory (ROM), erasable Programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage device, magnetic storage device, or any suitable combination of the above. In the present application, a computer-readable storage medium may 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, in which computer-readable program codes are carried. Such propagated data signals may take many forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the foregoing. A computer-readable signal medium may also be any computer-readable medium other than a computer-readable storage medium, which can send, propagate, or transmit a program for use by or in conjunction with an instruction execution system, apparatus, or device. . Program code embodied on a computer readable medium may be transmitted using any appropriate medium, including but not limited to wireless, wireline, optical fiber cable, RF, etc., or any suitable combination of the foregoing.

可以以一种或多种程序设计语言或其组合来编写用于执行本申请的操作的计算机程序代码,所述程序设计语言包括面向目标的程序设计语言—诸如Java、Smalltalk、C++,还包括常规的过程式程序设计语言—诸如”C”语言或类似的程序设计语言。程序代码可以完全地在用户计算机上执行、部分地在用户计算机上执行、作为一个独立的软件包执行、部分在用户计算机上部分在远程计算机上执行、或者完全在远程计算机或电子设备上执行。在涉及远程计算机的情形中,远程计算机可以通过任意种类的网络——包括局域网(LAN)或广域网(WAN)—连接到用户计算机,或者,可以连接到外部计算机(例如利用因特网服务提供商来通过因特网连接)。Computer program code for carrying out the operations of this application can be written in one or more programming languages, or combinations thereof, including object-oriented programming languages—such as Java, Smalltalk, C++, and conventional A procedural programming language—such as "C" or a 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 cases involving a remote computer, the remote computer can be connected to the user computer through any kind of network, including a local area network (LAN) or a wide area network (WAN), or it can be connected to an external computer (such as through an Internet service provider). 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 a flowchart or block diagram may represent a module, program segment, or portion of code that contains one or more logical functions for implementing specified executable instructions. It should also be noted that, in some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or they may sometimes be executed in the reverse order, depending upon the functionality involved. It should also be 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 by a dedicated hardware-based system that performs the specified functions or operations , or may be implemented by a combination of dedicated hardware and computer instructions.

描述于本申请实施例中所涉及到的单元可以通过软件的方式实现,也可以通过硬件的方式来实现。所描述的单元也可以设置在处理器中,例如,可以描述为:一种处理器包括获取单元、切分单元、标注单元和生成单元。其中,这些单元的名称在种情况下并不构成对该单元本身的限定,例如,获取单元还可以被描述为“获取主体关系二元组和文本的单元”。The units involved in the embodiments described in the present application may be implemented by means of software or by means of hardware. The described units may also be set in a processor, for example, it may be described as: a processor includes an acquisition unit, a segmentation unit, a labeling unit and a generation unit. Wherein, the names of these units do not limit the unit itself in this case, for example, the acquisition unit may also be described as "a unit for acquiring subject-relationship tuples 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 independently 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: acquires the subject-relationship pair and the text, wherein the subject-relationship pair includes subject and relations; split the text into text word sequences; input the subject-relationship dyads and text word sequences into the pre-trained slot filling model to obtain the tagging results of the text word sequences, where the slot filling model is used to mark the text word sequences based on the subject-relationship pair and the labeling results, a subject-relation-object triplet is generated, where the subject-relationship-object triplet 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 principle. 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-mentioned technical features, and should also cover the technical solution formed by the above-mentioned technical features or Other technical solutions formed by any combination of equivalent features. For example, a technical solution formed by replacing the above-mentioned features with technical features with similar functions disclosed in (but not limited to) this application.

Claims (14)

1.一种用于生成信息的方法,包括:1. A method for generating information comprising: 获取主体关系二元组和文本,其中,所述主体关系二元组包括主体和关系;Obtaining a subject-relationship pair and text, wherein the subject-relationship pair includes subject and relation; 将所述文本切分成文本词序列;Segmenting the text into sequences of text words; 将所述主体关系二元组和所述文本词序列输入至预先训练的槽填充模型,得到所述文本词序列的标注结果,其中,所述槽填充模型用于标注所述文本词序列中的客体;Input the subject-relationship pair and the text word sequence into a pre-trained slot-filling model to obtain the tagging result of the text word sequence, wherein the slot-filling model is used to tag the text word sequence object; 基于所述主体关系二元组和所述标注结果,生成主体关系客体三元组,其中,所述主体关系客体三元组包括所述文本的主体、关系和客体;Based on the subject-relationship pair and the annotation result, a subject-relation-object triplet is generated, wherein the subject-relationship-object triplet includes the subject, relation, and object of the text; 其中,所述槽填充模型包括输入层、定位层、嵌入层、编码层、解码层和输出层;以及Wherein, the slot filling model includes an input layer, a positioning layer, an embedding layer, an encoding layer, a decoding layer and an output layer; and 所述将所述主体关系二元组和所述文本词序列输入至预先训练的槽填充模型,得到所述文本词序列的标注结果,包括:Said inputting said subject-relationship pair and said text word sequence into the pre-trained slot filling model to obtain the labeling result of said text word sequence, including: 将所述主体关系二元组和所述文本词序列输入至所述输入层,得到词序列特征和距离特征;Input the subject-relationship binary group and the text word sequence to the input layer to obtain word sequence features and distance features; 将所述距离特征输入到所述定位层,得到位置信息;Inputting the distance feature into the positioning layer to obtain position information; 将所述词序列特征和所述位置信息输入至所述嵌入层,得到词序列向量和位置向量;The word sequence feature and the position information are input to the embedding layer to obtain a word sequence vector and a position vector; 将所述词序列向量输入至所述编码层,得到编码向量;The word sequence vector is input to the encoding layer to obtain an encoding vector; 将所述位置向量和所述编码向量输入至所述解码层,得到解码向量;inputting the position vector and the encoding vector to the decoding layer to obtain a decoding vector; 将所述解码向量输入至所述输出层,得到所述标注结果。The decoding vector is input to the output layer to obtain the labeling result. 2.根据权利要求1所述的方法,其中,所述编码层包括第一双向长短期记忆网络,所述解码层包括位置注意力模块、关系注意力模块和第二双向长短期记忆网络。2. The method of claim 1, wherein the encoding layer comprises a first bidirectional LSTM network and the decoding layer comprises a positional attention module, a relational attention module and a second bidirectional LSTM network. 3.根据权利要求2所述的方法,其中,所述将所述位置向量和所述编码向量输入至所述解码层,得到解码向量,包括:3. The method according to claim 2, wherein said inputting said position vector and said encoding vector to said decoding layer to obtain a decoding vector comprises: 将所述位置向量和所述编码向量的拼接输入至所述位置注意力模块,得到所述文本词序列中的词距离所述主体和所述关系的位置信息;The concatenation of the position vector and the encoding vector is input to the position attention module to obtain the position information of the words in the text word sequence from the subject and the relationship; 将所述关系的长短期记忆网络编码和所述编码向量输入至所述关系注意力模块,得到所述文本词序列中的词与所述关系的语义相似度;The long-short-term memory network encoding of the relationship and the encoding vector are input to the relationship attention module to obtain the semantic similarity between the words in the text word sequence and the relationship; 将所述编码向量、所述文本词序列中的词距离所述主体和所述关系的位置信息和所述文本词序列中的词与所述关系的语义相似度输入至所述第二双向长短期记忆网络,得到所述解码向量。Input the encoding vector, the position information of the words in the text word sequence from the subject and the relationship, and the semantic similarity between the words in the text word sequence and the relationship to the second bidirectional long short-term memory network to obtain the decoded vector. 4.根据权利要求1所述的方法,其中,所述将所述解码向量输入至所述输出层,得到所述标注结果,包括:4. The method according to claim 1, wherein said inputting said decoding vector to said output layer to obtain said labeling result comprises: 通过激活函数对所述文本词序列中的词的解码向量进行多分类,得到所述文本词序列中的词属于多种类别中的每种类别的概率,其中,多分类是计算词属于多种类别中的每种类别的概率;The decoding vectors of the words in the text word sequence are multi-classified by the activation function to obtain the probability that the words in the text word sequence belong to each category in multiple categories, wherein the multi-classification is to calculate the word belonging to multiple categories the probability of each of the categories; 基于所述文本词序列中的词的最大概率对应的类别对所述文本词序列进行标注,生成所述标注结果。The text word sequence is tagged based on the category corresponding to the maximum probability of the word in the text word sequence, and the tagging result is generated. 5.根据权利要求1-4之一所述的方法,其中,所述词序列特征包括以下至少一项:所述文本词序列、所述文本词序列的词性序列、所述文本词序列的命名实体识别序列和所述关系的关系词序列,所述距离特征包括以下至少一项:所述文本词序列中的词到所述主体的距离、所述文本词序列中的词到所述关系的距离。5. The method according to one of claims 1-4, wherein the word sequence feature comprises at least one of the following: the text word sequence, the part-of-speech sequence of the text word sequence, the naming of the text word sequence An entity recognition sequence and a relational word sequence of the relationship, the distance feature includes at least one of the following: the distance from the word in the text word sequence to the subject, the distance from the word in the text word sequence to the relationship distance. 6.根据权利要求1-4之一所述的方法,其中,所述槽填充模型采用BIOES序列标注方式对所述文本词序列进行标注。6. The method according to any one of claims 1-4, wherein the slot-filling model uses a BIOES sequence tagging method to tag the text word sequence. 7.一种用于生成信息的装置,包括:7. An apparatus for generating information comprising: 获取单元,被配置成获取主体关系二元组和文本,其中,所述主体关系二元组包括主体和关系;An acquisition unit configured to acquire a subject-relationship tuple and text, wherein the subject-relationship tuple includes a subject and a relationship; 切分单元,被配置成将所述文本切分成文本词序列;a segmentation unit configured to segment the text into text word sequences; 标注单元,被配置成将所述主体关系二元组和所述文本词序列输入至预先训练的槽填充模型,得到所述文本词序列的标注结果,其中,所述槽填充模型用于标注所述文本词序列中的客体;A labeling unit configured to input the subject-relationship pair 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 to label the object in the sequence of words in the prescriptive text; 生成单元,被配置成基于所述主体关系二元组和所述标注结果,生成主体关系客体三元组,其中,所述主体关系客体三元组包括所述文本的主体、关系和客体;A generating unit configured to generate a subject-relation-object triplet based on the subject-relationship pair and the annotation result, wherein the subject-relationship-object triplet includes the subject, relation, and object of the text; 其中,所述槽填充模型包括输入层、定位层、嵌入层、编码层、解码层和输出层;以及Wherein, the slot filling model includes an input layer, a positioning layer, an embedding layer, an encoding layer, a decoding layer and an output layer; and 所述标注单元包括:The labeling unit includes: 输入子单元,被配置成将所述主体关系二元组和所述文本词序列输入至所述输入层,得到词序列特征和距离特征;The input subunit is configured to input the subject-relationship pair and the text word sequence to the input layer to obtain word sequence features and distance features; 定位子单元,被配置成将所述距离特征输入到所述定位层,得到位置信息;a positioning subunit configured to input the distance feature to the positioning layer to obtain position information; 嵌入子单元,被配置成将所述词序列特征和所述位置信息输入至所述嵌入层,得到词序列向量和位置向量;An embedding subunit configured to input the word sequence feature and the position information to the embedding layer to obtain a word sequence vector and a position vector; 编码子单元,被配置成将所述词序列向量输入至所述编码层,得到编码向量;An encoding subunit configured to input the word sequence vector to the encoding layer to obtain an encoding vector; 解码子单元,被配置成将所述位置向量和所述编码向量输入至所述解码层,得到解码向量;a decoding subunit configured to input the position vector and the encoding vector to the decoding layer to obtain a decoding vector; 输出子单元,被配置成将所述解码向量输入至所述输出层,得到所述标注结果。The output subunit is configured to input the decoding vector to the output layer to obtain the labeling result. 8.根据权利要求7所述的装置,其中,所述编码层包括第一双向长短期记忆网络,所述解码层包括位置注意力模块、关系注意力模块和第二双向长短期记忆网络。8. The apparatus of claim 7, wherein the encoding layer comprises a first bidirectional LSTM network and the decoding layer comprises a positional attention module, a relational attention module and a second bidirectional LSTM network. 9.根据权利要求8所述的装置,其中,所述编码子单元进一步被配置成:9. The apparatus according to claim 8, wherein the encoding subunit is further configured to: 将所述位置向量和所述编码向量的拼接输入至所述位置注意力模块,得到所述文本词序列中的词距离所述主体和所述关系的位置信息;The concatenation of the position vector and the encoding vector is input to the position attention module to obtain the position information of the words in the text word sequence from the subject and the relationship; 将所述关系的长短期记忆网络编码和所述编码向量输入至所述关系注意力模块,得到所述文本词序列中的词与所述关系的语义相似度;The long-short-term memory network encoding of the relationship and the encoding vector are input to the relationship attention module to obtain the semantic similarity between the words in the text word sequence and the relationship; 将所述编码向量、所述文本词序列中的词距离所述主体和所述关系的位置信息和所述文本词序列中的词与所述关系的语义相似度输入至所述第二双向长短期记忆网络,得到所述解码向量。Input the encoding vector, the position information of the words in the text word sequence from the subject and the relationship, and the semantic similarity between the words in the text word sequence and the relationship to the second bidirectional long short-term memory network to obtain the decoded vector. 10.根据权利要求7所述的装置,其中,所述输出子单元进一步被配置成:10. The apparatus of claim 7, wherein the output subunit is further configured to: 通过激活函数对所述文本词序列中的词的解码向量进行多分类,得到所述文本词序列中的词属于多种类别中的每种类别的概率,其中,多分类是计算词属于多种类别中的每种类别的概率;The decoding vectors of the words in the text word sequence are multi-classified by the activation function to obtain the probability that the words in the text word sequence belong to each category in multiple categories, wherein the multi-classification is to calculate the word belonging to multiple categories the probability of each of the categories; 基于所述文本词序列中的词的最大概率对应的类别对所述文本词序列进行标注,生成所述标注结果。The text word sequence is tagged based on the category corresponding to the maximum probability of the word in the text word sequence, and the tagging result is generated. 11.根据权利要求7-10之一所述的装置,其中,所述词序列特征包括以下至少一项:所述文本词序列、所述文本词序列的词性序列、所述文本词序列的命名实体识别序列和所述关系的关系词序列,所述距离特征包括以下至少一项:所述文本词序列中的词到所述主体的距离、所述文本词序列中的词到所述关系的距离。11. The device according to any one of claims 7-10, wherein the word sequence features include at least one of the following: the text word sequence, the part-of-speech sequence of the text word sequence, the naming of the text word sequence An entity recognition sequence and a relational word sequence of the relationship, the distance feature includes at least one of the following: the distance from the word in the text word sequence to the subject, the distance from the word in the text word sequence to the relationship distance. 12.根据权利要求7-10之一所述的装置,其中,所述槽填充模型采用BIOES序列标注方式对所述文本词序列进行标注。12. The device according to any one of claims 7-10, wherein the slot-filling model uses a BIOES sequence tagging method to tag the text word sequence. 13.一种电子设备,包括:13. An electronic device comprising: 一个或多个处理器;one or more processors; 存储装置,其上存储有一个或多个程序,a storage device on which one or more programs are stored, 当所述一个或多个程序被所述一个或多个处理器执行,使得所述一个或多个处理器实现如权利要求1-6中任一所述的方法。When the one or more programs are executed by the one or more processors, the one or more processors are made to implement the method according to any one of claims 1-6. 14.一种计算机可读介质,其上存储有计算机程序,其中,所述计算机程序被处理器执行时实现如权利要求1-6中任一所述的方法。14. A computer-readable medium, on which a computer program is stored, wherein the computer program implements the method according to any one of claims 1-6 when executed by a processor.
CN202010005728.9A 2020-01-03 2020-01-03 Method and apparatus for generating information Active CN111241209B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010005728.9A CN111241209B (en) 2020-01-03 2020-01-03 Method and apparatus for generating information

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010005728.9A CN111241209B (en) 2020-01-03 2020-01-03 Method and apparatus for generating information

Publications (2)

Publication Number Publication Date
CN111241209A CN111241209A (en) 2020-06-05
CN111241209B true CN111241209B (en) 2023-07-11

Family

ID=70865425

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010005728.9A Active CN111241209B (en) 2020-01-03 2020-01-03 Method and apparatus for generating information

Country Status (1)

Country Link
CN (1) CN111241209B (en)

Families Citing this family (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111639500A (en) * 2020-04-23 2020-09-08 平安国际智慧城市科技股份有限公司 Semantic role labeling method and device, computer equipment and storage medium
CN114372454B (en) * 2020-10-14 2024-08-16 腾讯科技(深圳)有限公司 Text information extraction method, model training method, device and storage medium
CN112560475B (en) * 2020-11-16 2023-05-12 和美(深圳)信息技术股份有限公司 Triplet extraction method and system
CN113704392B (en) * 2021-04-13 2025-12-12 腾讯科技(深圳)有限公司 Methods, apparatus, devices, and storage media for extracting entity relations from text
CN113743118B (en) * 2021-07-22 2024-06-21 武汉工程大学 Entity relation extraction method in legal document based on fusion relation information coding
CN117407492B (en) * 2023-12-14 2024-02-23 广东海洋大学 Keyword sequence generation method, system and equipment based on knowledge graph

Family Cites Families (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104778186B (en) * 2014-01-15 2018-06-22 阿里巴巴集团控股有限公司 Merchandise items are mounted to the method and system of standardized product unit
RU2637992C1 (en) * 2016-08-25 2017-12-08 Общество с ограниченной ответственностью "Аби Продакшн" Method of extracting facts from texts on natural language
CN110569335B (en) * 2018-03-23 2022-05-27 百度在线网络技术(北京)有限公司 Triple verification method and device based on artificial intelligence and storage medium
CN109325201B (en) * 2018-08-15 2025-07-15 北京百度网讯科技有限公司 Method, device, equipment and storage medium for generating entity relationship data
CN109408812A (en) * 2018-09-30 2019-03-01 北京工业大学 A method of the sequence labelling joint based on attention mechanism extracts entity relationship
CN110147437B (en) * 2019-05-23 2022-09-02 北京金山数字娱乐科技有限公司 Knowledge graph-based searching method and device
CN110275963A (en) * 2019-06-25 2019-09-24 北京百度网讯科技有限公司 Method and device for outputting information
CN110275962B (en) * 2019-06-25 2021-07-20 北京百度网讯科技有限公司 Method and apparatus for outputting information
CN110472235A (en) * 2019-07-22 2019-11-19 北京航天云路有限公司 A kind of end-to-end entity relationship joint abstracting method towards Chinese text

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
Hierarchical Capsule Based Neural Network Architecture for Sequence Labeling;Saurabh Srivastava et al.;《2019 International Joint Conference on Neural Networks (IJCNN)》;全文 *
基于最大二元组和综合特征的文本分类框架;马黎;《西北师范大学学报(自然科学版)》(第5期);全文 *

Also Published As

Publication number Publication date
CN111241209A (en) 2020-06-05

Similar Documents

Publication Publication Date Title
CN111241209B (en) Method and apparatus for generating information
CN111639710B (en) Image recognition model training method, device, equipment and storage medium
CN111274815B (en) Method and apparatus for mining entity attention points in text
US11151177B2 (en) Search method and apparatus based on artificial intelligence
US12536386B2 (en) Method and apparatus for processing model data, electronic device, and computer readable medium
CN115062134B (en) Knowledge question-answering model training and knowledge question-answering method, device and computer equipment
WO2022174496A1 (en) Data annotation method and apparatus based on generative model, and device and storage medium
CN111314388B (en) Method and apparatus for detecting SQL injection
CN111259112A (en) Medical fact verification method and device
CN112528658A (en) Hierarchical classification method and device, electronic equipment and storage medium
CN111488742B (en) Method and apparatus for translation
US20210004406A1 (en) Method and apparatus for storing media files and for retrieving media files
CN113392929A (en) Biological sequence feature extraction method based on word embedding and self-encoder fusion
CN116579338A (en) Method and system for document-level event extraction based on integrated federated learning
CN110991183A (en) Method, device, equipment and storage medium for determining predicate of problem
CN114328837A (en) Sequence labeling method and device, computer equipment and storage medium
CN113946648B (en) Structured information generation method and device, electronic equipment and medium
CN112989797B (en) Model training, text expansion methods, devices, equipment and storage media
CN112329429B (en) Text similarity learning method, device, equipment and storage medium
CN117131152B (en) Information storage method, apparatus, electronic device, and computer readable medium
CN116127925B (en) Text data enhancement method and device based on destruction processing of text
CN116416645B (en) Attribute and image cross-mode pedestrian re-identification method and device based on dual-branch Transformer network
CN118820445A (en) Answer text generation method, device, equipment and storage medium
CN112988778A (en) A method and device for processing database query script
CN116719915A (en) Intelligent question and answer method, device, equipment and storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant