WO2020155769A1 - 关键词生成模型的建模方法和装置 - Google Patents
关键词生成模型的建模方法和装置 Download PDFInfo
- Publication number
- WO2020155769A1 WO2020155769A1 PCT/CN2019/118329 CN2019118329W WO2020155769A1 WO 2020155769 A1 WO2020155769 A1 WO 2020155769A1 CN 2019118329 W CN2019118329 W CN 2019118329W WO 2020155769 A1 WO2020155769 A1 WO 2020155769A1
- Authority
- WO
- WIPO (PCT)
- Prior art keywords
- text
- sample
- keyword
- model
- target
- 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.)
- Ceased
Links
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F40/00—Handling natural language data
- G06F40/20—Natural language analysis
- G06F40/279—Recognition of textual entities
Definitions
- This application relates to the field of intelligent decision-making, and more specifically, to a method and device for modeling keyword generation models in the field of intelligent decision-making.
- a key word is a short summary content that expresses the main semantic meaning of a longer text.
- the typical usage of keywords is to provide the core information of the paper in scientific publications. High-quality key phrases can help understand, organize, and access document content.
- the first idea is to use statistical information, typically the TF-IDF method, which determines the criticality of words by calculating the frequency of occurrence of words in the text and the frequency of occurrence in the entire document library;
- the second idea is to use semantic information
- the keygraph algorithm finds the clusters of words in the text by establishing the graphical representation of the text, so as to obtain the words that best represent the text as keywords.
- the RNN recurrent neural network
- the Encoder-Decoder model provides a powerful tool for modeling variable length sentences, and has a wide range of applications in the field of natural language processing.
- the present application provides a modeling method and device for a keyword generation model, which can establish a model for effectively extracting text keywords.
- this application provides a method for modeling a keyword generation model, including the following content:
- sample data including sample text and M i sample keywords of the sample text, the sample text including and each sample keyword is a sequence of words, and M i is an integer greater than 1;
- the text of the sample and the samples keywords M i determining the sample data corresponding to text M i - of keywords, the text M i - keywords of the i th text - Image including the sample text keywords and the i-th sample, i is greater than 0 and less than or equal to M i is an integer;
- M i according to the text - and keywords of the encoder - decoder model, a model generating the keyword, wherein said coder - decoder model model includes an encoder and a decoder model, the keyword
- the generative model is used to represent the mapping relationship between the word sequence in the sample text and the word sequence in the sample keywords.
- this application provides a method for generating text keywords, including the following content:
- sample data including sample text and M i sample keywords of the sample text, the sample text including and each sample keyword is a sequence of words, and M i is an integer greater than 1;
- the text of the sample and the samples keywords M i determining the sample data corresponding to text M i - of keywords, the text M i - keywords of the i th text - Image including the sample text keywords and the i-th sample, i is greater than 0 and less than or equal to M i is an integer;
- M i according to the text - and keywords of the encoder - decoder model, a model generating the keyword, wherein said coder - decoder model model includes an encoder and a decoder model, the keyword
- the generative model is used to represent the mapping relationship between the word sequence in the sample text and the word sequence in the sample keywords.
- Target text where the target text is a sequence of words
- a target keyword of the target text is generated.
- this application also provides a modeling device for a keyword generation model, which specifically includes:
- An acquisition unit configured to acquire the sample data, the sample includes a sample of text data and the sample text keywords M i samples, and each sample of the sample text keywords are the words in the sequence, greater than 1 M i Integer
- Determining means for, according to the text sample and the samples keywords M i, determining the sample data corresponding to text M i - of keywords, the text M i - i-th keyword pair text - text keywords including the sample and the i-th sample keywords, i is greater than 0 and less than or equal to M i is an integer;
- the keyword generation model is used to represent the mapping relationship between the word sequence in the sample text and the word sequence in the sample keyword.
- this application also provides a device for generating text keywords, which specifically includes:
- An acquisition unit configured to acquire the sample data, the sample includes a sample of text data and the sample text keywords M i samples, and each sample of the sample text keywords are the words in the sequence, greater than 1 M i Integer
- Determining means for, according to the text sample and the samples keywords M i, determining the sample data corresponding to text M i - of keywords, the text M i - i-th keyword pair text - text keywords including the sample and the i-th sample keywords, i is greater than 0 and less than or equal to M i is an integer;
- the keyword generation model is used to represent the mapping relationship between the word sequence in the sample text and the word sequence in the sample keyword.
- the acquiring unit is also used to acquire target text, where the target text is a sequence of words;
- the generating unit is configured to generate the target keyword of the target text according to the target text and the keyword generation model.
- the present application also provides a computer device, including a memory, a processor, a communication interface, and a computer program stored in the memory and running on the processor, wherein the memory, the The processor and the communication interface communicate with each other through an internal connection path, and the processor implements the following steps when executing the computer program:
- sample data includes a sample of text data and the sample text keywords M i samples, and each sample of the sample text keywords are the words in the sequence, M i is an integer greater than 1;
- the text of the sample and the samples keywords M i determining the sample data corresponding to text M i - of keywords, the text M i - keywords of the i th text - Image including the sample text keywords and the i-th sample, i is greater than 0 and less than or equal to M i is an integer;
- M i according to the text - and keywords of the encoder - decoder model, a model generating the keyword, wherein said coder - decoder model model includes an encoder and a decoder model, the keyword
- the generative model is used to represent the mapping relationship between the word sequence in the sample text and the word sequence in the sample keywords; and/or,
- Target text where the target text is a sequence of words
- a target keyword of the target text is generated.
- the present application also provides a computer-readable storage medium on which a computer program is stored, and when the computer program is executed by a processor, the following steps are implemented:
- sample data includes a sample of text data and the sample text keywords M i samples, and each sample of the sample text keywords are the words in the sequence, M i is an integer greater than 1;
- the text of the sample and the samples keywords M i determining the sample data corresponding to text M i - of keywords, the text M i - keywords of the i th text - Image including the sample text keywords and the i-th sample, i is greater than 0 and less than or equal to M i is an integer;
- M i according to the text - and keywords of the encoder - decoder model, a model generating the keyword, wherein said coder - decoder model model includes an encoder and a decoder model, the keyword
- the generative model is used to represent the mapping relationship between the word sequence in the sample text and the word sequence in the sample keywords; and/or,
- Target text where the target text is a sequence of words
- a target keyword of the target text is generated.
- FIG. 1 is a schematic flowchart of a method for modeling a keyword generation model provided by an embodiment of the present application
- FIG. 2 is a schematic flowchart of a method for generating text keywords provided by an embodiment of the present application
- FIG. 3 is a schematic block diagram of a modeling device for a keyword generation model provided by an embodiment of the present application.
- FIG. 4 is a schematic block diagram of a device for generating text keywords provided by an embodiment of the present application
- FIG. 5 is a schematic block diagram of another keyword generation model modeling apparatus provided by an embodiment of the present application.
- Fig. 6 is a schematic block diagram of another apparatus for generating text keywords according to an embodiment of the present application.
- FIG. 1 shows a schematic flowchart of a method 100 for modeling a keyword generation model provided by an embodiment of the present application. It should be understood that the method 100 can be executed by a modeling device of a keyword generation model.
- the device may be a device with a computing function and a communication interface, for example, a mobile terminal.
- the device may be a functional module in the mobile terminal.
- the method 100 includes the following steps:
- sample data includes a sample of text data and the sample text keywords M i samples, and each sample of the sample text keywords are the words in the sequence, M i is an integer greater than 1;
- text keyword data set includes several "text-keyword” pairs for training the model, where text refers to the title and abstract of the publication, and keywords refer to keywords assigned by the author of the publication.
- the method further includes: acquiring a target text, the target text being a sequence of words; and generating a target keyword of the target text according to the target text and the keyword generation model.
- generating the target keywords of the target text according to the target text and the keyword generation model includes: encoding the target text according to the encoder model to obtain a hidden expression Formula; According to the hidden expression and the preset nonlinear function, the context vector is obtained; the context vector is decoded according to the decoder model to obtain the target keyword.
- the keyword generation model in the embodiment of the present application may be a variety of deep learning models, which is not limited in the embodiment of the present application.
- both the encoder model and the decoder model are RNN (recursive neural network).
- a given keyword data set comprising N data samples, wherein, the i-th sample data (x (i), P (i)), comprising a text sample x (i) and M i samples Key words
- the sample text x (i) and the sample keywords p (i, j) are both word sequences, as shown in formula (1) and formula (2):
- L x (i) and L p (i, j) represent the length of the word sequence x (i) and p (i, j) , respectively.
- (x, y) is used to represent sample data below, where x represents sample text and y represents sample keywords.
- the basic idea of the keyword generation model is to compress the content of the word sequence of the sample text into a hidden representation with an encoder model, and based on the hidden representation and the decoder model to generate the corresponding word sequence of the sample keywords.
- the following formula (4) is obtained by iterating along time t:
- formula (4) is a non-linear equation.
- the context vector c is obtained as a representation of the entire input x through the non-linear function q.
- the context vector c is shown in formula (5):
- s t f(y t-1 ,s t-1 ,c), p(y t
- y 1,...,t-1 ,x) g(y t-1 ,s t ,c ), st is the hidden state of the decoder model at time t, and the nonlinear function g is a softmax classifier, which outputs the probability of all words in the vocabulary.
- y t is the predicted word at time t, usually the word with the highest probability after g( ⁇ ).
- the encoder model and decoder model network are jointly trained to maximize the conditional probability of the target sequence. After training, use beam search to generate keywords, and reserve the largest heap to obtain the predicted keyword sequence with the highest probability.
- the encoder model is a GRU
- the decoding model is a forward GRU
- GRU bidirectional gated recurrent unit
- GRU can be used as an encoder to replace a simple RNN.
- LSTM long short-term memory, long-term short-term memory networks
- it is usually It can provide better language modeling performance than simple RNN and simpler structure. Therefore, GRU can be used to replace the aforementioned f function, and the forward GRU is used as a decoder.
- an attention mechanism is used to improve performance. The attention mechanism makes the model dynamically pay attention to the important part of the input.
- generating the target keywords of the target text according to the target text and the keyword generation model includes: encoding the target text according to the encoder model , Obtain a hidden expression; obtain a context vector according to the hidden expression and the weight of each word sequence in the hidden expression; decode the context vector according to the decoder model to obtain the target key word.
- a(s i-1 ,h j ) is a soft alignment function used to measure the similarity between s i-1 and h j , that is, the degree to which the input around position j matches the output at position i.
- the RNN model usually considers a certain number of frequent words, but a large number of long-tail keywords may be ignored, that is, the RNN cannot recall any words that contain extra-word words. Key words.
- a replication mechanism can be used to enable RNN to predict words other than vocabulary words by selecting appropriate words from the text.
- long tail keyword is a combination keyword that is not a target keyword but is related to the target keyword and has the same or similar meaning.
- car is the target keyword
- “convertible car” is a long-tail keyword developed based on the characteristics of the product.
- hand cream as the target keyword
- hand cream direct sales, hand cream group purchase, hand cream online shopping are all long-tail keywords based on the sales model.
- weight loss as the target keyword, "I want to lose weight, what kind of medicine to lose weight” are long-tail keywords that are expanded through Internet users' search intentions.
- the probability of predicting each new word y t consists of two parts.
- the first term is the probability of generating the word
- the second term is the probability of copying it from the target text, as shown in formula (7):
- ⁇ is the set of all unique words in the text x
- ⁇ is a nonlinear function
- W c ⁇ R is the learning parameter matrix
- z is the sum of all scores, used for normalization.
- the replication mechanism weights the importance of each word in the target text with the measure of position attention. But unlike the generated RNN that predicts the next word of all words in the vocabulary, the copy part p c (y t
- RNN with a copy mechanism can predict words whose etymology is beyond the vocabulary but in the target text; on the other hand, the model may give priority to the words that appear, and these words cater to most keywords. The facts that appear in the target text.
- FIG. 2 shows a schematic flowchart of a method 200 for generating text keywords provided by an embodiment of the present application.
- the method 200 includes the following steps:
- sample data includes a sample of text data and the sample text keywords M i samples, and each sample of the sample text keywords are the words in the sequence, M i is an integer greater than 1.
- S240 Acquire target text, where the target text is a sequence of words.
- FIG. 3 shows a schematic block diagram of an apparatus 300 for modeling a keyword generation model provided by an embodiment of the present application.
- the device 300 includes:
- Obtaining unit 310 for obtaining the sample data the sample includes a sample of text data and the sample text keywords M i samples, and each sample of the sample text keywords are the words in the sequence, M i is greater than 1 Integer
- Determination unit 320 determines the sample data corresponding to text M i - of keywords, the text M i - a first pair of keywords i text - text keywords including the sample and the i-th sample keywords, i is greater than 0 and less than or equal to M i is an integer;
- the keyword generation model is used to represent the mapping relationship between the word sequence in the sample text and the word sequence in the sample keyword.
- the device further includes a generating unit; the obtaining unit is also used to obtain target text, and the target text is a sequence of words; the generating unit is used to obtain the target text according to the target text and the The keyword generation model generates the target keywords of the target text.
- the generating unit is specifically configured to encode the target text according to the encoder model to obtain a hidden expression; according to the hidden expression and a preset nonlinear function, obtain Context vector; decode the context vector according to the decoder model to obtain the target keyword.
- the generating unit is specifically configured to encode the target text according to the encoder model to obtain a hidden expression; according to each of the hidden expression and the hidden expression The weight of the word sequence obtains a context vector; the context vector is decoded according to the decoder model to obtain the target keyword.
- both the encoder model and the decoder model are RNNs.
- the encoder model is a GRU
- the decoder model is a forward GRU
- FIG. 4 shows a schematic block diagram of an apparatus 400 for generating text keywords according to an embodiment of the present application.
- the device 400 includes:
- Obtaining unit 410 for obtaining the sample data the sample includes a sample of text data and the sample text keywords M i samples, and each sample of the sample text keywords are the words in the sequence, M i is greater than 1 Integer
- Determination unit 420 determines the sample data corresponding to text M i - of keywords, the text M i - a first pair of keywords i text - text keywords including the sample and the i-th sample keywords, i is greater than 0 and less than or equal to M i is an integer;
- the acquiring unit 410 is also configured to acquire target text, and the target text is a sequence of words.
- the generating unit 440 is configured to generate target keywords of the target text according to the target text and the keyword generation model.
- the generating unit is specifically configured to encode the target text according to the encoder model to obtain a hidden expression; according to the hidden expression and a preset nonlinear function, obtain Context vector; decode the context vector according to the decoder model to obtain the target keyword.
- the generating unit is specifically configured to encode the target text according to the encoder model to obtain a hidden expression; according to each of the hidden expression and the hidden expression The weight of the word sequence obtains a context vector; the context vector is decoded according to the decoder model to obtain the target keyword.
- both the encoder model and the decoder model are RNNs.
- the encoder model is a GRU
- the decoder model is a forward GRU
- FIG. 5 shows a schematic block diagram of an apparatus 500 for modeling a keyword generation model provided by an embodiment of the present application.
- the device 500 may be the device 300 described in FIG. 3, and the device 500 may adopt the hardware architecture shown in FIG.
- the device 500 may include a processor 510, a communication interface 520, and a memory 530.
- the processor 510, the communication interface 520, and the memory 530 communicate with each other through an internal connection path.
- the related functions implemented by the determining unit 320 and the establishing unit 330 in FIG. 3 may be implemented by the processor 510.
- the related functions implemented by the acquiring unit 310 in FIG. 3 may be implemented by the processor 510 controlling the communication interface 520.
- the processor 510 may include one or more processors, for example, include one or more central processing units (central processing units, CPUs).
- CPUs central processing units
- the processor may be a single-core CPU or It can be a multi-core CPU.
- the communication interface 520 is used to input and/or output data.
- the communication interface may include a sending interface and a receiving interface, the sending interface is used for outputting data, and the receiving interface is used for inputting data.
- the memory 530 includes but is not limited to random access memory (RAM), read-only memory (ROM), erasable programmable memory (erasable read only memory, EPROM), read-only memory A compact disc (read-only memory, CD-ROM).
- RAM random access memory
- ROM read-only memory
- EPROM erasable programmable memory
- read-only memory A compact disc read-only memory, CD-ROM.
- the memory 530 is used to store related instructions and data.
- the memory 530 is used to store program codes and data of the device, and may be a separate device or integrated in the processor 510.
- the processor 510 is configured to control the communication interface 520 to call the code instructions stored in the memory 530 and execute the code instructions.
- the processor 510 is configured to control the communication interface 520 to call the code instructions stored in the memory 530 and execute the code instructions.
- Figure 5 only shows a simplified design of the device.
- the device 500 may also include other necessary components, including but not limited to any number of communication interfaces, processors, controllers, memories, etc., and all devices that can implement the application are protected by the application. Within range.
- the device 500 may be replaced with a chip device, for example, a chip that can be used in the device to implement related functions of the processor 510 in the device.
- the chip device can be a field programmable gate array, a dedicated integrated chip, a system chip, a central processing unit, a network processor, a digital signal processing circuit, a microcontroller, and a programmable controller or other integrated chips for realizing related functions.
- the chip may optionally include one or more memories for storing program codes, and when the codes are executed, the processor realizes corresponding functions.
- FIG. 6 shows a schematic block diagram of an apparatus 600 for generating text keywords according to an embodiment of the present application.
- the device 600 may be the device 400 described in FIG. 4, and the device 600 may adopt the hardware architecture shown in FIG.
- the device 600 may include a processor 610, a communication interface 620, and a memory 630, and the processor 610, the communication interface 620, and the memory 630 communicate with each other through an internal connection path.
- the related functions implemented by the determining unit 420, the establishing unit 430, and the generating unit 440 in FIG. 4 may be implemented by the processor 610.
- the related functions implemented by the acquiring unit 410 in FIG. 4 may be implemented by the processor 610 controlling the communication interface 620.
- the processor 610 may include one or more processors, such as one or more central processing units (CPU).
- processors such as one or more central processing units (CPU).
- CPU central processing units
- the CPU may be a single-core CPU, or It can be a multi-core CPU.
- the communication interface 620 is used to input and/or output data.
- the communication interface may include a sending interface and a receiving interface, the sending interface is used for outputting data, and the receiving interface is used for inputting data.
- the memory 630 includes but is not limited to random access memory (RAM), read-only memory (ROM), erasable programmable memory (erasable read only memory, EPROM), read-only memory A compact disc (read-only memory, CD-ROM).
- RAM random access memory
- ROM read-only memory
- EPROM erasable programmable memory
- read-only memory A compact disc read-only memory, CD-ROM.
- the memory 630 is used to store related instructions and data.
- the memory 630 is used to store program codes and data of the device, and may be a separate device or integrated in the processor 610.
- the processor 610 is configured to control the communication interface 620 to call the code instructions stored in the memory 630 and execute the code instructions.
- the processor 610 is configured to control the communication interface 620 to call the code instructions stored in the memory 630 and execute the code instructions.
- Fig. 6 only shows a simplified design of the device.
- the device 600 may also include other necessary elements, including but not limited to any number of communication interfaces, processors, controllers, memories, etc., and all devices that can implement the application are protected by the application. Within range.
- the device 600 can be replaced with a chip device, for example, a chip that can be used in the device to implement related functions of the processor 610 in the device.
- the chip device can be a field programmable gate array, a dedicated integrated chip, a system chip, a central processing unit, a network processor, a digital signal processing circuit, a microcontroller, and a programmable controller or other integrated chips for realizing related functions.
- the chip may optionally include one or more memories for storing program codes, and when the codes are executed, the processor realizes corresponding functions.
- the disclosed system, device, and method may be implemented in other ways.
- the device embodiments described above are merely illustrative.
- the division of the units is only a logical function division, and there may be other divisions in actual implementation, for example, multiple units or components may be combined or It can be integrated into another system, or some features can be ignored or not implemented.
- the displayed or discussed mutual coupling or direct coupling or communication connection may be indirect coupling or communication connection through some interfaces, devices or units, and may be in electrical, mechanical or other forms.
- the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the objectives of the solutions of the embodiments.
- the functional units in the various embodiments of the present application may be integrated into one processing unit, or each unit may exist alone physically, or two or more units may be integrated into one unit.
- the function is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer readable storage medium.
- the technical solution of this application essentially or the part that contributes to the existing technology or the part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including Several instructions are used to make a computer device (which may be a personal computer, a server, or a network device, etc.) execute all or part of the steps of the method described in each embodiment of the present application.
- the aforementioned storage media include: U disk, mobile hard disk, ROM, RAM, magnetic disk or optical disk and other media that can store program codes.
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Health & Medical Sciences (AREA)
- Artificial Intelligence (AREA)
- Audiology, Speech & Language Pathology (AREA)
- Computational Linguistics (AREA)
- General Health & Medical Sciences (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Machine Translation (AREA)
- Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
Abstract
一种关键词生成模型的建模方法和装置,该方法包括:获取样本数据,该样本数据包括样本文本和该样本文本的M i个样本关键词(S110);根据该样本文本和该M i个样本关键词,确定该样本数据对应的M i个文本-关键词对,该M i个文本-关键词对中的第i个文本-关键词对包括该样本文本和第i个样本关键词(S120);根据该M i个文本-关键词对和编码器-解码器模型,建立该关键词生成模型,其中,该编码器-解码器模型包括编码器模型和解码器模型,该关键词生成模型用于表示该样本文本中的词语序列和样本关键词中的词语序列之间的映射关系(S130)。采用上述关键词生成模型的建模方法和装置,能够建立有效提取文本关键词的模型。
Description
本申请申明享有2019年01月30日递交的申请号为CN201910090894.0、名称为“关键词生成模型的建模方法和装置”的中国专利申请的优先权,该中国专利申请的整体内容以参考的方式结合在本申请中。
本申请涉及智能决策领域,并且更具体地,涉及智能决策领域中关键词生成模型的建模方法和装置。
关键词是一段简短的总结性内容,表达了较长文本的主要语义含义。关键词的典型用法是在科学出版物中提供论文的核心信息。高质量的关键短语可以帮助理解,组织和访问文档内容。
现有技术中,发明人发现通常通过以下两种方法提取文本中的关键词:
第一种思路是利用统计信息,典型的有TF-IDF方法,通过计算文本中词的出现频率,以及在整个文档库中的出现频率来确定词的关键程度;第二中思路是利用语义信息,比如keygraph算法,通过建立文本的图表达来发现文本中字的聚类,从而获得最能表现这段文字的字,作为关键词。
RNN(递归神经网络)组合Encoder-Decoder(编码解码器)的模型作为一种端对端的模型,为变长的语句建模提供了强大的工具,在自然语言处理领域有有着广泛的应用。
因此,如何建立能够从文本中提取出高质量关键词的关键件词生成模型是一个亟待解决的问题。
申请内容
本申请提供一种关键词生成模型的建模方法和装置,能够建立有效提取文本关键词的模型。
为实现上述目的,本申请提供一种关键词生成模型的建模方法,包括以下内容:
获取样本数据,所述样本数据包括样本文本和所述样本文本的M
i个样本关键词,所述样本文本包括和每个样本关键词均为词语序列,M
i为大于1的整数;
根据所述样本文本和所述M
i个样本关键词,确定所述样本数据对应的M
i个文本-关键词对,所述M
i个文本-关键词对中的第i个文本-关键词对包括所述样本文本和第i个样本关 键词,i为大于0且小于或等于M
i的整数;
根据所述M
i个文本-关键词对和编码器-解码器模型,建立所述关键词生成模型,其中,所述编码器-解码器模型包括编码器模型和解码器模型,所述关键词生成模型用于表示所述样本文本中的词语序列和样本关键词中的词语序列之间的映射关系。
为实现上述目的,本申请提供一种文本关键词的生成方法,包括以下内容:
获取样本数据,所述样本数据包括样本文本和所述样本文本的M
i个样本关键词,所述样本文本包括和每个样本关键词均为词语序列,M
i为大于1的整数;
根据所述样本文本和所述M
i个样本关键词,确定所述样本数据对应的M
i个文本-关键词对,所述M
i个文本-关键词对中的第i个文本-关键词对包括所述样本文本和第i个样本关键词,i为大于0且小于或等于M
i的整数;
根据所述M
i个文本-关键词对和编码器-解码器模型,建立所述关键词生成模型,其中,所述编码器-解码器模型包括编码器模型和解码器模型,所述关键词生成模型用于表示所述样本文本中的词语序列和样本关键词中的词语序列之间的映射关系。
获取目标文本,所述目标文本为词语序列;
根据所述目标文本和所述关键词生成模型,生成所述目标文本的目标关键词。
为实现上述目的,本申请还提供一种关键词生成模型的建模装置,该装置具体包括:
获取单元,用于获取样本数据,所述样本数据包括样本文本和所述样本文本的M
i个样本关键词,所述样本文本和每个样本关键词均为词语序列,M
i为大于1的整数;
确定单元,用于根据所述样本文本和所述M
i个样本关键词,确定所述样本数据对应的M
i个文本-关键词对,所述M
i个文本-关键词对中的第i个文本-关键词对包括所述样本文本和第i个样本关键词,i为大于0且小于或等于M
i的整数;
建立单元,用于根据所述M
i个文本-关键词对和编码器-解码器模型,建立所述关键词生成模型,其中,所述编码器-解码器模型包括编码器模型和解码器模型,所述关键词生成模型用于表示所述样本文本中的词语序列和样本关键词中的词语序列之间的映射关系。
为实现上述目的,本申请还提供一种文本关键词的生成装置,该装置具体包括:
获取单元,用于获取样本数据,所述样本数据包括样本文本和所述样本文本的M
i个样本关键词,所述样本文本和每个样本关键词均为词语序列,M
i为大于1的整数;
确定单元,用于根据所述样本文本和所述M
i个样本关键词,确定所述样本数据对应的M
i个文本-关键词对,所述M
i个文本-关键词对中的第i个文本-关键词对包括所述样本文本 和第i个样本关键词,i为大于0且小于或等于M
i的整数;
建立单元,用于根据所述M
i个文本-关键词对和编码器-解码器模型,建立所述关键词生成模型,其中,所述编码器-解码器模型包括编码器模型和解码器模型,所述关键词生成模型用于表示所述样本文本中的词语序列和样本关键词中的词语序列之间的映射关系。
所述获取单元还用于获取目标文本,所述目标文本为词语序列;
生成单元,用于根据所述目标文本和所述关键词生成模型,生成所述目标文本的目标关键词。
为实现上述目的,本申请还提供一种计算机设备,包括存储器、处理器、通信接口以及存储在所述存储器上并可在所述处理器上运行的计算机程序,其中,所述存储器、所述处理器以及所述通信接口之间通过内部连接通路互相通信,所述处理器执行所述计算机程序时实现以下步骤:
获取样本数据,所述样本数据包括样本文本和所述样本文本的M
i个样本关键词,所述样本文本和每个样本关键词均为词语序列,M
i为大于1的整数;
根据所述样本文本和所述M
i个样本关键词,确定所述样本数据对应的M
i个文本-关键词对,所述M
i个文本-关键词对中的第i个文本-关键词对包括所述样本文本和第i个样本关键词,i为大于0且小于或等于M
i的整数;
根据所述M
i个文本-关键词对和编码器-解码器模型,建立所述关键词生成模型,其中,所述编码器-解码器模型包括编码器模型和解码器模型,所述关键词生成模型用于表示所述样本文本中的词语序列和样本关键词中的词语序列之间的映射关系;和/或,
获取目标文本,所述目标文本为词语序列;
根据所述目标文本和所述关键词生成模型,生成所述目标文本的目标关键词。
为实现上述目的,本申请还提供计算机可读存储介质,其上存储有计算机程序,所述计算机程序被处理器执行时实现以下步骤:
获取样本数据,所述样本数据包括样本文本和所述样本文本的M
i个样本关键词,所述样本文本和每个样本关键词均为词语序列,M
i为大于1的整数;
根据所述样本文本和所述M
i个样本关键词,确定所述样本数据对应的M
i个文本-关键词对,所述M
i个文本-关键词对中的第i个文本-关键词对包括所述样本文本和第i个样本关键词,i为大于0且小于或等于M
i的整数;
根据所述M
i个文本-关键词对和编码器-解码器模型,建立所述关键词生成模型,其中,所述编码器-解码器模型包括编码器模型和解码器模型,所述关键词生成模型用于表示所述 样本文本中的词语序列和样本关键词中的词语序列之间的映射关系;和/或,
获取目标文本,所述目标文本为词语序列;
根据所述目标文本和所述关键词生成模型,生成所述目标文本的目标关键词。
图1是本申请实施例提供的关键词生成模型的建模方法的示意性流程图;
图2是本申请实施例提供的文本关键词的生成方法的示意性流程图;
图3是本申请实施例提供的关键词生成模型的建模装置的示意性框图;
图4是本申请实施例提供的文本关键词的生成装置的示意性框图;
图5是本申请实施例提供的另一关键词生成模型的建模装置的示意性框图;
图6是本申请实施例提供的另一文本关键词的生成装置的示意性框图。
为了使本申请的目的、技术方案及优点更加清楚明白,以下结合附图及实施例,对本申请进行进一步详细说明。应当理解,此处所描述的具体实施例仅用以解释本申请,并不用于限定本申请。基于本申请中的实施例,本领域普通技术人员在没有做出创造性劳动前提下所获得的所有其他实施例,都属于本申请保护的范围。
图1示出了本申请实施例提供的关键词生成模型的建模方法100的示意性流程图。应理解,该方法100可以由关键词生成模型的建模装置执行。
可选地,该装置可以为具有计算功能和通信接口的装置,例如,移动终端,更进一步地,该装置可以为移动终端中的功能模块。
该方法100包括如下步骤:
S110,获取样本数据,所述样本数据包括样本文本和所述样本文本的M
i个样本关键词,所述样本文本和每个样本关键词均为词语序列,M
i为大于1的整数;
S120,根据所述样本文本和所述M
i个样本关键词,确定所述样本数据对应的M
i个文本-关键词对,所述M
i个文本-关键词对中的第i个文本-关键词对包括所述样本文本和第i个样本关键词,i为大于0且小于或等于M
i的整数;
S130,根据所述M
i个文本-关键词对和编码器-解码器模型,建立所述关键词生成模型,其中,所述编码器-解码器模型包括编码器模型和解码器模型,所述关键词生成模型用于表示所述样本文本中的词语序列和样本关键词中的词语序列之间的映射关系。
需要说明的是,该文本关键词数据集中包括若干用于训练模型的“文本-关键词”对, 其中,文本指出版物的标题和摘要,关键词指出版物的作者分配的关键词。
可选地,所述方法还包括:获取目标文本,所述目标文本为词语序列;根据所述目标文本和所述关键词生成模型,生成所述目标文本的目标关键词。
在一种可能的方式中,根据所述目标文本和所述关键词生成模型,生成所述目标文本的目标关键词,包括:根据所述编码器模型对所述目标文本进行编码,得到隐藏表达式;根据所述隐藏表达式和预设的非线性函数,得到上下文向量;根据所述解码器模型对所述上下文向量进行解编码,得到所述目标关键词。
可选地,本申请实施例中的关键词生成模型可以为多种深度学习模型,本申请实施例对此不作限定。
在一种可能的实现方式中,所述编码器模型和所述解码器模型均为RNN(recursive neural network,递归神经网络)。
例如,假设给定的关键词数据集包括N个样本数据时,其中,第i个样本数据为(x
(i),p
(i)),包括一个样本文本x
(i)和M
i个样本关键词
样本文本x
(i)和样本关键词p
(i,j)都是词语序列,如公式(1)和公式(2)所示:
其中,L
x(i)和L
p(i,j)分别代表词序列x
(i)和p
(i,j)的长度。
由于每个样本数据包含一个样本文本多个样本关键词,为了应用RNN编码器-解码器模型,需要将样本数据转换为仅包含一个样本文本词序列和一个样本关键词序列的文本-关键词对。所以将(x
(i),p
(i))重新定义为M
i对,如公式(3)所示:
为简单起见,下面用(x,y)表示样本数据,其中x表示样本文本,y表示样本关键词。
应理解,关键词生成模型的基本思想是将样本文本的词语序列的内容压缩成带有编码器模型的隐藏表示,并基于该隐藏表示与解码器模型一起生成相应的样本关键词的词语序列。
那么,编码器模型将可变长度输入序列x=(x
1,x
2,...,x
t)转换为一组隐藏表示h=(h
1,h
2,...,h
t),通过沿时间t迭代得到以下公式(4):
h
t=f(x
t,h
t-1) (4)
其中,公式(4)是一个非线性方程,通过非线性函数q得到上下文向量c作为整个输入x的表示,上下文向量c如公式(5)所示:
c=q(h
1,h
2,...,h
t) (5)
接下来,解码器模型通过条件语言模型解压缩上下文向量c并逐个字地生成可变长度的序列y=(y
1,y
2,...,y
t),
其中,s
t=f(y
t-1,s
t-1,c),p(y
t|y
1,...,t-1,x)=g(y
t-1,s
t,c),s
t是时间t时解码器模型的隐藏状态,非线性函数g是一个softmax分类器,它输出词汇表中所有单词的概率。y
t是t时刻的预测词,通常取g(·)之后的概率最大的词。
应理解,在给定样本文本词序列的情况下,编码器模型和解码器模型网络被联合训练以用于最大化目标序列的条件概率。训练后,使用波束搜索生成关键词,并保留最大堆以获得具有最高概率的预测关键词序列。
在另一种可能的实现方式中,所述编码器模型为GRU,所述解码模型为前向GRU。
需要说明的是,GRU(bidirectional gated recurrent unit,双向门控递归单元)可以被用作编码器来代替简单的RNN,它与其他LSTM(long short-term memory,长期短期记忆网络)相比,通常可以提供比简单RNN和更简单结构更好的语言建模性能。因此,可以采用用GRU替代上述的f函数,前向GRU被用作解码器。此外,还采用了关注机制来提高性能。关注机制使模型动态地关注输入中的重要部分。
因此,在另一种可能的实现方式中,根据所述目标文本和所述关键词生成模型,生成所述目标文本的目标关键词,包括:根据所述编码器模型对所述目标文本进行编码,得到隐藏表达式;根据所述隐藏表达式和所述隐藏表达式中每个词语序列的权重,得到上下文向量;根据所述解码器模型对所述上下文向量进行解编码,得到所述目标关键词。
例如,上述上下文向量c被计算为隐藏表示h=(h
1,h
2,...,h
t)的加权和,如公式(6)所示:
c
i=∑α
ijh
j (6)
更进一步地,为了确保学习表示的质量和缩小词汇量,RNN模型通常考虑一定数量的频繁词汇,但是大量的长尾关键词可能会被忽略,也就是说,RNN不能回忆任何包含词外单词的关键词。
实际上,一些比较重要的短语也可以通过其上下文中的位置和语法信息来识别,尽管它们的确切含义是未知的。因此,可以采用复制机制使RNN能够通过从文本中选择适当的单词来预测词汇单词以外的单词。
需要说明的是,长尾关键词(Long Tail Keyword)是非目标关键词但与目标关键词相关的具有相同或类似意思的组合型关键词。
例如:以“汽车”为目标关键词,“敞篷汽车”是根据该产品特点拓展的长尾关键词。
又例如:以“除湿机”为目标关键词,“工业用途除湿机”是根据应用领域拓展的长尾关键词。
又例如:以“童装”为目标关键词,“童装批发市场,童装代理商,童装品牌加盟”都是通过商业模式拓展的长尾关键词。
又例如:以“英语培训”为目标关键词,“英语培训机构,英语培训中心,英语培训学校”都是通过企业性质拓展的长尾关键词。
又例如:以“护手霜”为目标关键词,“护手霜直销,护手霜团购,护手霜网购”都是根据销售模式拓展的长尾关键词。
又例如:以“减肥”为目标关键词,“我要减肥,减肥用什么药”都是通过网民搜索意图拓展的长尾关键词。
因此,通过结合复制机制,预测每个新词y
t的概率由两部分组成。第一项是产生这个词的概率,第二项是从目标文本中复制它的概率,如公式(7)所示:
p(y
t|y
1,...,t-1,x)=p
g(y
t|y
1,...,t-1,x)+p
c(y
t|y
1,...,t-1,x) (7)
类似于关注机制,复制机制将目标文本中每个单词的重要性与位置关注的度量进行加权。但与预测词汇中所有单词的下一个单词的生成RNN不同,复制部分p
c(y
t|y
1,...,t-1,x)仅考虑目标文本中的单词。
需要说明的是,一方面,具有复制机制的RNN能够预测词源超出词汇但在目标文本中的单词;另一方面,该模型可能会优先考虑出现的单词,这些单词迎合了大多数关键词往往 出现在目标文本中的事实。
图2示出了本申请实施例提供的文本关键词的生成方法200的示意性流程图。该方法200包括如下步骤:
S210,获取样本数据,所述样本数据包括样本文本和所述样本文本的M
i个样本关键词,所述样本文本和每个样本关键词均为词语序列,M
i为大于1的整数。
S220,根据所述样本文本和所述M
i个样本关键词,确定所述样本数据对应的M
i个文本-关键词对,所述M
i个文本-关键词对中的第i个文本-关键词对包括所述样本文本和第i个样本关键词,i为大于0且小于或等于M
i的整数。
S230,根据所述M
i个文本-关键词对和编码器-解码器模型,建立所述关键词生成模型,其中,所述编码器-解码器模型包括编码器模型和解码器模型,所述关键词生成模型用于表示所述样本文本中的词语序列和样本关键词中的词语序列之间的映射关系。
S240,获取目标文本,所述目标文本为词语序列。
S250,根据所述目标文本和所述关键词生成模型,生成所述目标文本的目标关键词
上面结合图1和图2介绍了本申请实施例提供的关键词生成模型的建模方法和文本关键词的生成方法,下面将结合图3和图4介绍本申请实施例提供的关键词生成模型的建模装置和文本关键词的生成装置。
图3示出了本申请实施例提供的关键词生成模型的建模装置300的示意性框图。该装置300包括:
获取单元310,用于获取样本数据,所述样本数据包括样本文本和所述样本文本的M
i个样本关键词,所述样本文本和每个样本关键词均为词语序列,M
i为大于1的整数;
确定单元320,用于根据所述样本文本和所述M
i个样本关键词,确定所述样本数据对应的M
i个文本-关键词对,所述M
i个文本-关键词对中的第i个文本-关键词对包括所述样本文本和第i个样本关键词,i为大于0且小于或等于M
i的整数;
建立单元330,用于根据所述M
i个文本-关键词对和编码器-解码器模型,建立所述关键词生成模型,其中,所述编码器-解码器模型包括编码器模型和解码器模型,所述关键词生成模型用于表示所述样本文本中的词语序列和样本关键词中的词语序列之间的映射关系。
在一种可能的实现方式中,所述装置还包括生成单元;所述获取单元还用于获取目标文本,所述目标文本为词语序列;所述生成单元用于根据所述目标文本和所述关键词生成模型,生成所述目标文本的目标关键词。
在一种可能的实现方式中,所述生成单元具体用于根据所述编码器模型对所述目标文本进行编码,得到隐藏表达式;根据所述隐藏表达式和预设的非线性函数,得到上下文向 量;根据所述解码器模型对所述上下文向量进行解编码,得到所述目标关键词。
在一种可能的实现方式中,所述生成单元具体用于根据所述编码器模型对所述目标文本进行编码,得到隐藏表达式;根据所述隐藏表达式和所述隐藏表达式中每个词语序列的权重,得到上下文向量;根据所述解码器模型对所述上下文向量进行解编码,得到所述目标关键词。
在一种可能的实现方式中,所述编码器模型和所述解码器模型均为RNN。
在一种可能的实现方式中,所述编码器模型为GRU,所述解码器模型为前向GRU。
图4示出了本申请实施例提供的文本关键词的生成装置400的示意性框图。该装置400包括:
获取单元410,用于获取样本数据,所述样本数据包括样本文本和所述样本文本的M
i个样本关键词,所述样本文本和每个样本关键词均为词语序列,M
i为大于1的整数;
确定单元420,用于根据所述样本文本和所述M
i个样本关键词,确定所述样本数据对应的M
i个文本-关键词对,所述M
i个文本-关键词对中的第i个文本-关键词对包括所述样本文本和第i个样本关键词,i为大于0且小于或等于M
i的整数;
建立单元430,用于根据所述M
i个文本-关键词对和编码器-解码器模型,建立所述关键词生成模型,其中,所述编码器-解码器模型包括编码器模型和解码器模型,所述关键词生成模型用于表示所述样本文本中的词语序列和样本关键词中的词语序列之间的映射关系;
所述获取单元410还用于获取目标文本,所述目标文本为词语序列。
生成单元440,用于根据所述目标文本和所述关键词生成模型,生成所述目标文本的目标关键词。
在一种可能的实现方式中,所述生成单元具体用于根据所述编码器模型对所述目标文本进行编码,得到隐藏表达式;根据所述隐藏表达式和预设的非线性函数,得到上下文向量;根据所述解码器模型对所述上下文向量进行解编码,得到所述目标关键词。
在一种可能的实现方式中,所述生成单元具体用于根据所述编码器模型对所述目标文本进行编码,得到隐藏表达式;根据所述隐藏表达式和所述隐藏表达式中每个词语序列的权重,得到上下文向量;根据所述解码器模型对所述上下文向量进行解编码,得到所述目标关键词。
在一种可能的实现方式中,所述编码器模型和所述解码器模型均为RNN。
在一种可能的实现方式中,所述编码器模型为GRU,所述解码器模型为前向GRU。
图5示出了本申请实施例提供的关键词生成模型的建模装置500的示意性框图。该装 置500可以为图3中所述的装置300,该装置500可以采用如图5所示的硬件架构。该装置500可以包括处理器510、通信接口520和存储器530,该处理器510、通信接口520和存储器530通过内部连接通路互相通信。图3中的确定单元320和建立单元330所实现的相关功能可以由处理器510来实现。图3中的获取单元310所实现的相关功能可以由处理器510控制通信接口520来实现。
该处理器510可以包括是一个或多个处理器,例如包括一个或多个中央处理单元(central processing unit,CPU),在处理器是一个CPU的情况下,该CPU可以是单核CPU,也可以是多核CPU。
该通信接口520用于输入和/或输出数据。该通信接口可以包括发送接口和接收接口,发送接口用于输出数据,接收接口用于输入数据。
该存储器530包括但不限于是随机存取存储器(random access memory,RAM)、只读存储器(read-only memory,ROM)、可擦除可编程存储器(erasable programmable read only memory,EPROM)、只读光盘(compact disc read-only memory,CD-ROM),该存储器530用于存储相关指令及数据。
存储器530用于存储该装置的程序代码和数据,可以为单独的器件或集成在处理器510中。
具体地,所述处理器510用于控制通信接口520调用存储器530中存储的代码指令并执行该代码指令。具体可参见方法实施例中的描述,在此不再赘述。
可以理解的是,图5仅仅示出了装置的简化设计。在实际应用中,该装置500还可以分别包含必要的其他元件,包含但不限于任意数量的通信接口、处理器、控制器、存储器等,而所有可以实现本申请的装置都在本申请的保护范围之内。
在一种可能的设计中,该装置500可以被替换为芯片装置,例如可以为可用于该装置中的芯片,用于实现该装置中处理器510的相关功能。该芯片装置可以为实现相关功能的现场可编程门阵列,专用集成芯片,系统芯片,中央处理器,网络处理器,数字信号处理电路,微控制器,还可以采用可编程控制器或其他集成芯片。该芯片中,可选的可以包括一个或多个存储器,用于存储程序代码,当所述代码被执行时,使得处理器实现相应的功能。
图6示出了本申请实施例提供的文本关键词的生成装置600的示意性框图。该装置600可以为图4中所述的装置400,该装置600可以采用如图6所示的硬件架构。该装置600可以包括处理器610、通信接口620和存储器630,该处理器610、通信接口620和存储器630通过内部连接通路互相通信。图4中的确定单元420、建立单元430和生成单元440所实现的相关功能可以由处理器610来实现。图4中的获取单元410所实现的相关功能可以 由处理器610控制通信接口620来实现。
该处理器610可以包括是一个或多个处理器,例如包括一个或多个中央处理单元(central processing unit,CPU),在处理器是一个CPU的情况下,该CPU可以是单核CPU,也可以是多核CPU。
该通信接口620用于输入和/或输出数据。该通信接口可以包括发送接口和接收接口,发送接口用于输出数据,接收接口用于输入数据。
该存储器630包括但不限于是随机存取存储器(random access memory,RAM)、只读存储器(read-only memory,ROM)、可擦除可编程存储器(erasable programmable read only memory,EPROM)、只读光盘(compact disc read-only memory,CD-ROM),该存储器630用于存储相关指令及数据。
存储器630用于存储该装置的程序代码和数据,可以为单独的器件或集成在处理器610中。
具体地,所述处理器610用于控制通信接口620调用存储器630中存储的代码指令并执行该代码指令。具体可参见方法实施例中的描述,在此不再赘述。
可以理解的是,图6仅仅示出了装置的简化设计。在实际应用中,该装置600还可以分别包含必要的其他元件,包含但不限于任意数量的通信接口、处理器、控制器、存储器等,而所有可以实现本申请的装置都在本申请的保护范围之内。
在一种可能的设计中,该装置600可以被替换为芯片装置,例如可以为可用于该装置中的芯片,用于实现该装置中处理器610的相关功能。该芯片装置可以为实现相关功能的现场可编程门阵列,专用集成芯片,系统芯片,中央处理器,网络处理器,数字信号处理电路,微控制器,还可以采用可编程控制器或其他集成芯片。该芯片中,可选的可以包括一个或多个存储器,用于存储程序代码,当所述代码被执行时,使得处理器实现相应的功能。
本领域普通技术人员可以意识到,结合本文中所公开的实施例描述的各示例的单元及算法步骤,能够以电子硬件、或者计算机软件和电子硬件的结合来实现。这些功能究竟以硬件还是软件方式来执行,取决于技术方案的特定应用和设计约束条件。专业技术人员可以对每个特定的应用来使用不同方法来实现所描述的功能,但是这种实现不应认为超出本申请的范围。
所属领域的技术人员可以清楚地了解到,为描述的方便和简洁,上述描述的系统、装置和单元的具体工作过程,可以参考前述方法实施例中的对应过程,在此不再赘述。
在本申请所提供的几个实施例中,应该理解到,所揭露的系统、装置和方法,可以通过其它的方式实现。例如,以上所描述的装置实施例仅仅是示意性的,例如,所述单元的 划分,仅仅为一种逻辑功能划分,实际实现时可以有另外的划分方式,例如多个单元或组件可以结合或者可以集成到另一个系统,或一些特征可以忽略,或不执行。另一点,所显示或讨论的相互之间的耦合或直接耦合或通信连接可以是通过一些接口,装置或单元的间接耦合或通信连接,可以是电性,机械或其它的形式。
所述作为分离部件说明的单元可以是或者也可以不是物理上分开的,作为单元显示的部件可以是或者也可以不是物理单元,即可以位于一个地方,或者也可以分布到多个网络单元上。可以根据实际的需要选择其中的部分或者全部单元来实现本实施例方案的目的。
另外,在本申请各个实施例中的各功能单元可以集成在一个处理单元中,也可以是各个单元单独物理存在,也可以两个或两个以上单元集成在一个单元中。
所述功能如果以软件功能单元的形式实现并作为独立的产品销售或使用时,可以存储在一个计算机可读取存储介质中。基于这样的理解,本申请的技术方案本质上或者说对现有技术做出贡献的部分或者该技术方案的部分可以以软件产品的形式体现出来,该计算机软件产品存储在一个存储介质中,包括若干指令用以使得一台计算机设备(可以是个人计算机,服务器,或者网络设备等)执行本申请各个实施例所述方法的全部或部分步骤。而前述的存储介质包括:U盘、移动硬盘、ROM、RAM、磁碟或者光盘等各种可以存储程序代码的介质。
以上所述,仅为本申请的具体实施方式,但本申请的保护范围并不局限于此,任何熟悉本技术领域的技术人员在本申请揭露的技术范围内,可轻易想到变化或替换,都应涵盖在本申请的保护范围之内。因此,本申请的保护范围应以所述权利要求的保护范围为准。
Claims (20)
- 一种关键词生成模型的建模方法,其特征在于,包括:获取样本数据,所述样本数据包括样本文本和所述样本文本的Mi个样本关键词,所述样本文本和每个样本关键词均为词语序列,Mi为大于1的整数;根据所述样本文本和所述Mi个样本关键词,确定所述样本数据对应的Mi个文本-关键词对,所述Mi个文本-关键词对中的第i个文本-关键词对包括所述样本文本和第i个样本关键词,i为大于0且小于或等于Mi的整数;根据所述Mi个文本-关键词对和编码器-解码器模型,建立所述关键词生成模型,其中,所述编码器-解码器模型包括编码器模型和解码器模型,所述关键词生成模型用于表示所述样本文本中的词语序列和样本关键词中的词语序列之间的映射关系。
- 根据权利要求1所述的方法,其特征在于,所述方法还包括:获取目标文本,所述目标文本为词语序列;根据所述目标文本和所述关键词生成模型,生成所述目标文本的目标关键词。
- 根据权利要求2所述的方法,其特征在于,根据所述目标文本和所述关键词生成模型,生成所述目标文本的目标关键词,包括:根据所述编码器模型对所述目标文本进行编码,得到隐藏表达式;根据所述隐藏表达式和预设的非线性函数,得到上下文向量;根据所述解码器模型对所述上下文向量进行解编码,得到所述目标关键词。
- 根据权利要求2所述的方法,其特征在于,根据所述目标文本和所述关键词生成模型,生成所述目标文本的目标关键词,包括:根据所述编码器模型对所述目标文本进行编码,得到隐藏表达式;根据所述隐藏表达式和所述隐藏表达式中每个词语序列的权重,得到上下文向量;根据所述解码器模型对所述上下文向量进行解编码,得到所述目标关键词。
- 根据权利要求1至4中任一项所述的方法,其特征在于,所述编码器模型和所述解码器模型均为RNN;或,所述编码器模型为GRU,所述解码器模型为前向GRU。
- 一种文本关键词的生成方法,其特征在于,包括:获取样本数据,所述样本数据包括样本文本和所述样本文本的Mi个样本关键词,所述样本文本和每个样本关键词均为词语序列,Mi为大于1的整数;根据所述样本文本和所述Mi个样本关键词,确定所述样本数据对应的Mi个文本-关键词对,所述Mi个文本-关键词对中的第i个文本-关键词对包括所述样本文本和第i个样本关键词,i为大于0且小于或等于Mi的整数;根据所述Mi个文本-关键词对和编码器-解码器模型,建立所述关键词生成模型,其中,所述编码器-解码器模型包括编码器模型和解码器模型,所述关键词生成模型用于表示所述样本文本中的词语序列和样本关键词中的词语序列之间的映射关系;获取目标文本,所述目标文本为词语序列;根据所述目标文本和所述关键词生成模型,生成所述目标文本的目标关键词。
- 一种关键词生成模型的建模装置,其特征在于,包括:获取单元,用于获取样本数据,所述样本数据包括样本文本和所述样本文本的Mi个样本关键词,所述样本文本和每个样本关键词均为词语序列,Mi为大于1的整数;确定单元,用于根据所述样本文本和所述Mi个样本关键词,确定所述样本数据对应的Mi个文本-关键词对,所述Mi个文本-关键词对中的第i个文本-关键词对包括所述样本文本和第i个样本关键词,i为大于0且小于或等于Mi的整数;建立单元,用于根据所述Mi个文本-关键词对和编码器-解码器模型,建立所述关键词生成模型,其中,所述编码器-解码器模型包括编码器模型和解码器模型,所述关键词生成模型用于表示所述样本文本中的词语序列和样本关键词中的词语序列之间的映射关系。
- 根据权利要求7中所述的装置,其特征在于,所述装置还包括生成单元;所述获取单元还用于获取目标文本,所述目标文本为词语序列;所述生成单元用于根据所述目标文本和所述关键词生成模型,生成所述目标文本的目标关键词。
- 根据权利要求8所述的装置,其特征在于,所述生成单元具体用于:根据所述编码器模型对所述目标文本进行编码,得到隐藏表达式;根据所述隐藏表达式和预设的非线性函数,得到上下文向量;根据所述解码器模型对所述上下文向量进行解编码,得到所述目标关键词。
- 根据权利要求8所述的装置,其特征在于,所述生成单元具体用于:根据所述编码器模型对所述目标文本进行编码,得到隐藏表达式;根据所述隐藏表达式和所述隐藏表达式中每个词语序列的权重,得到上下文向量;根据所述解码器模型对所述上下文向量进行解编码,得到所述目标关键词。
- 根据权利要求7至10中任一项所述的装置,其特征在于,所述编码器模型和所述解码器模型均为RNN;或,所述编码器模型为GRU,所述解码器模型为前向GRU。
- 一种文本关键词的生成装置,其特征在于,包括:获取单元,用于获取样本数据,所述样本数据包括样本文本和所述样本文本的Mi个样本关键词,所述样本文本和每个样本关键词均为词语序列,Mi为大于1的整数;确定单元,用于根据所述样本文本和所述Mi个样本关键词,确定所述样本数据对应的Mi个文本-关键词对,所述Mi个文本-关键词对中的第i个文本-关键词对包括所述样本文本和第i个样本关键词,i为大于0且小于或等于Mi的整数;建立单元,用于根据所述Mi个文本-关键词对和编码器-解码器模型,建立所述关键词生成模型,其中,所述编码器-解码器模型包括编码器模型和解码器模型,所述关键词生成模型用于表示所述样本文本中的词语序列和样本关键词中的词语序列之间的映射关系;所述获取单元还用于获取目标文本,所述目标文本为词语序列;生成单元,用于根据所述目标文本和所述关键词生成模型,生成所述目标文本的目标关键词。
- 一种计算机设备,包括存储器、处理器以及存储在存储器上并可在处理器上运行的计算机程序,所述处理器执行所述计算机程序时实现以下步骤:获取样本数据,所述样本数据包括样本文本和所述样本文本的Mi个样本关键词,所述样本文本和每个样本关键词均为词语序列,Mi为大于1的整数;根据所述样本文本和所述Mi个样本关键词,确定所述样本数据对应的Mi个文本-关键词对,所述Mi个文本-关键词对中的第i个文本-关键词对包括所述样本文本和第i个样本关键词,i为大于0且小于或等于Mi的整数;根据所述Mi个文本-关键词对和编码器-解码器模型,建立所述关键词生成模型,其中,所述编码器-解码器模型包括编码器模型和解码器模型,所述关键词生成模型用于表示所述样本文本中的词语序列和样本关键词中的词语序列之间的映射关系。
- 根据权利要求13所述的计算机设备,其特征在于,关键词生成模型的建模方法还包括以下步骤:获取目标文本,所述目标文本为词语序列;根据所述目标文本和所述关键词生成模型,生成所述目标文本的目标关键词。
- 根据权利要求14所述的计算机设备,其特征在于,所述根据所述目标文本和所述关键词生成模型,生成所述目标文本的目标关键词,包括:根据所述编码器模型对所述目标文本进行编码,得到隐藏表达式;根据所述隐藏表达式和预设的非线性函数,得到上下文向量;根据所述解码器模型对所述上下文向量进行解编码,得到所述目标关键词。
- 根据权利要求14所述的计算机设备,其特征在于,所述根据所述目标文本和所述关键词生成模型,生成所述目标文本的目标关键词,包括:根据所述编码器模型对所述目标文本进行编码,得到隐藏表达式;根据所述隐藏表达式和所述隐藏表达式中每个词语序列的权重,得到上下文向量;根据所述解码器模型对所述上下文向量进行解编码,得到所述目标关键词。
- 一种计算机可读存储介质,其上存储有计算机程序,其特征在于:所述计算机程序被处理器执行时实现关键词生成模型的建模方法的以下步骤:获取样本数据,所述样本数据包括样本文本和所述样本文本的Mi个样本关键词,所述样本文本和每个样本关键词均为词语序列,Mi为大于1的整数;根据所述样本文本和所述Mi个样本关键词,确定所述样本数据对应的Mi个文本-关键词对,所述Mi个文本-关键词对中的第i个文本-关键词对包括所述样本文本和第i个样本关键词,i为大于0且小于或等于Mi的整数;根据所述Mi个文本-关键词对和编码器-解码器模型,建立所述关键词生成模型,其中,所述编码器-解码器模型包括编码器模型和解码器模型,所述关键词生成模型用于表示所述样本文本中的词语序列和样本关键词中的词语序列之间的映射关系。
- 根据权利要求17所述的计算机可读存储介质,其特征在于,关键词生成模型的建模方法还包括以下步骤:获取目标文本,所述目标文本为词语序列;根据所述目标文本和所述关键词生成模型,生成所述目标文本的目标关键词。
- 根据权利要求18所述的计算机可读存储介质,其特征在于,所述根据所述目标文本和所述关键词生成模型,生成所述目标文本的目标关键词,包括:根据所述编码器模型对所述目标文本进行编码,得到隐藏表达式;根据所述隐藏表达式和预设的非线性函数,得到上下文向量;根据所述解码器模型对所述上下文向量进行解编码,得到所述目标关键词。
- 根据权利要求18所述的计算机可读存储介质,其特征在于,所述根据所述目标文本和所述关键词生成模型,生成所述目标文本的目标关键词,包括:根据所述编码器模型对所述目标文本进行编码,得到隐藏表达式;根据所述隐藏表达式和所述隐藏表达式中每个词语序列的权重,得到上下文向量;根据所述解码器模型对所述上下文向量进行解编码,得到所述目标关键词。
Applications Claiming Priority (2)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN201910090894.0A CN109902273B (zh) | 2019-01-30 | 2019-01-30 | 关键词生成模型的建模方法和装置 |
| CN201910090894.0 | 2019-01-30 |
Publications (1)
| Publication Number | Publication Date |
|---|---|
| WO2020155769A1 true WO2020155769A1 (zh) | 2020-08-06 |
Family
ID=66944415
Family Applications (1)
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| PCT/CN2019/118329 Ceased WO2020155769A1 (zh) | 2019-01-30 | 2019-11-14 | 关键词生成模型的建模方法和装置 |
Country Status (2)
| Country | Link |
|---|---|
| CN (1) | CN109902273B (zh) |
| WO (1) | WO2020155769A1 (zh) |
Families Citing this family (4)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN109902273B (zh) * | 2019-01-30 | 2024-05-07 | 平安科技(深圳)有限公司 | 关键词生成模型的建模方法和装置 |
| CN111191428B (zh) * | 2019-12-27 | 2022-02-25 | 北京百度网讯科技有限公司 | 评论信息处理方法、装置、计算机设备和介质 |
| CN114692613A (zh) * | 2020-12-29 | 2022-07-01 | 阿里巴巴集团控股有限公司 | 一种关键词抽取方法及装置和编码器和解码器 |
| CN113515619B (zh) * | 2021-07-12 | 2024-08-13 | 南京理工大学 | 一种基于显著性信息门控机制的关键词生成方法 |
Citations (6)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN107783960A (zh) * | 2017-10-23 | 2018-03-09 | 百度在线网络技术(北京)有限公司 | 用于抽取信息的方法、装置和设备 |
| CN108334489A (zh) * | 2017-01-19 | 2018-07-27 | 百度在线网络技术(北京)有限公司 | 文本核心词识别方法和装置 |
| CN108376131A (zh) * | 2018-03-14 | 2018-08-07 | 中山大学 | 基于seq2seq深度神经网络模型的关键词抽取方法 |
| CN108763213A (zh) * | 2018-05-25 | 2018-11-06 | 西南电子技术研究所(中国电子科技集团公司第十研究所) | 主题特征文本关键词提取方法 |
| CN109255118A (zh) * | 2017-07-11 | 2019-01-22 | 普天信息技术有限公司 | 一种关键词提取方法及装置 |
| CN109902273A (zh) * | 2019-01-30 | 2019-06-18 | 平安科技(深圳)有限公司 | 关键词生成模型的建模方法和装置 |
Family Cites Families (3)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN106095749A (zh) * | 2016-06-03 | 2016-11-09 | 杭州量知数据科技有限公司 | 一种基于深度学习的文本关键词提取方法 |
| CN108304365A (zh) * | 2017-02-23 | 2018-07-20 | 腾讯科技(深圳)有限公司 | 关键词提取方法及装置 |
| CN107862058B (zh) * | 2017-11-10 | 2021-10-22 | 北京百度网讯科技有限公司 | 用于生成信息的方法和装置 |
-
2019
- 2019-01-30 CN CN201910090894.0A patent/CN109902273B/zh active Active
- 2019-11-14 WO PCT/CN2019/118329 patent/WO2020155769A1/zh not_active Ceased
Patent Citations (6)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN108334489A (zh) * | 2017-01-19 | 2018-07-27 | 百度在线网络技术(北京)有限公司 | 文本核心词识别方法和装置 |
| CN109255118A (zh) * | 2017-07-11 | 2019-01-22 | 普天信息技术有限公司 | 一种关键词提取方法及装置 |
| CN107783960A (zh) * | 2017-10-23 | 2018-03-09 | 百度在线网络技术(北京)有限公司 | 用于抽取信息的方法、装置和设备 |
| CN108376131A (zh) * | 2018-03-14 | 2018-08-07 | 中山大学 | 基于seq2seq深度神经网络模型的关键词抽取方法 |
| CN108763213A (zh) * | 2018-05-25 | 2018-11-06 | 西南电子技术研究所(中国电子科技集团公司第十研究所) | 主题特征文本关键词提取方法 |
| CN109902273A (zh) * | 2019-01-30 | 2019-06-18 | 平安科技(深圳)有限公司 | 关键词生成模型的建模方法和装置 |
Also Published As
| Publication number | Publication date |
|---|---|
| CN109902273A (zh) | 2019-06-18 |
| CN109902273B (zh) | 2024-05-07 |
Similar Documents
| Publication | Publication Date | Title |
|---|---|---|
| US11816442B2 (en) | Multi-turn dialogue response generation with autoregressive transformer models | |
| JP7406606B2 (ja) | テキスト認識モデルの訓練方法、テキスト認識方法及び装置 | |
| US11900056B2 (en) | Stylistic text rewriting for a target author | |
| CN110287278B (zh) | 评论生成方法、装置、服务器及存储介质 | |
| US11468239B2 (en) | Joint intent and entity recognition using transformer models | |
| US11113479B2 (en) | Utilizing a gated self-attention memory network model for predicting a candidate answer match to a query | |
| CN110134971B (zh) | 一种机器翻译的方法、设备以及计算机可读存储介质 | |
| WO2020107878A1 (zh) | 文本摘要生成方法、装置、计算机设备及存储介质 | |
| CN112487182A (zh) | 文本处理模型的训练方法、文本处理方法及装置 | |
| CN108419094A (zh) | 视频处理方法、视频检索方法、装置、介质及服务器 | |
| CN115270719B (zh) | 基于多模态信息的文本摘要生成方法、训练方法及其装置 | |
| CN110347790B (zh) | 基于注意力机制的文本查重方法、装置、设备及存储介质 | |
| CN111401079A (zh) | 神经网络机器翻译模型的训练方法、装置及存储介质 | |
| CN110852066B (zh) | 一种基于对抗训练机制的多语言实体关系抽取方法及系统 | |
| CN109918630B (zh) | 文本生成方法、装置、计算机设备及存储介质 | |
| WO2020155769A1 (zh) | 关键词生成模型的建模方法和装置 | |
| CN110705284A (zh) | 基于神经网络生成模型的诗词生成质量的优化方法及系统 | |
| CN110263218B (zh) | 视频描述文本生成方法、装置、设备和介质 | |
| CN111401081A (zh) | 神经网络机器翻译方法、模型及模型形成方法 | |
| CN113761895A (zh) | 文本摘要的生成方法、装置、电子设备及存储介质 | |
| CN112711943A (zh) | 一种维吾尔文语种识别方法、装置及存储介质 | |
| JP2023002690A (ja) | セマンティックス認識方法、装置、電子機器及び記憶媒体 | |
| CN116306612A (zh) | 一种词句生成方法及相关设备 | |
| CN117494815A (zh) | 面向档案的可信大语言模型训练、推理方法和装置 | |
| CN114428832A (zh) | 文档生成方法及装置、存储介质 |
Legal Events
| Date | Code | Title | Description |
|---|---|---|---|
| 121 | Ep: the epo has been informed by wipo that ep was designated in this application |
Ref document number: 19913599 Country of ref document: EP Kind code of ref document: A1 |
|
| NENP | Non-entry into the national phase |
Ref country code: DE |
|
| 122 | Ep: pct application non-entry in european phase |
Ref document number: 19913599 Country of ref document: EP Kind code of ref document: A1 |

