WO2023060795A1 - 关键词自动提取方法、装置、设备及存储介质 - Google Patents

关键词自动提取方法、装置、设备及存储介质 Download PDF

Info

Publication number
WO2023060795A1
WO2023060795A1 PCT/CN2022/071258 CN2022071258W WO2023060795A1 WO 2023060795 A1 WO2023060795 A1 WO 2023060795A1 CN 2022071258 W CN2022071258 W CN 2022071258W WO 2023060795 A1 WO2023060795 A1 WO 2023060795A1
Authority
WO
WIPO (PCT)
Prior art keywords
keywords
target
keyword
text
vector
Prior art date
Application number
PCT/CN2022/071258
Other languages
English (en)
French (fr)
Inventor
袁超
徐介夫
Original Assignee
平安科技(深圳)有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 平安科技(深圳)有限公司 filed Critical 平安科技(深圳)有限公司
Publication of WO2023060795A1 publication Critical patent/WO2023060795A1/zh

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F40/00Handling natural language data
    • G06F40/20Natural language analysis
    • G06F40/279Recognition of textual entities
    • G06F40/284Lexical analysis, e.g. tokenisation or collocates
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F18/00Pattern recognition
    • G06F18/20Analysing
    • G06F18/21Design or setup of recognition systems or techniques; Extraction of features in feature space; Blind source separation
    • G06F18/214Generating training patterns; Bootstrap methods, e.g. bagging or boosting
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F40/00Handling natural language data
    • G06F40/30Semantic analysis
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F40/00Handling natural language data
    • G06F40/40Processing or translation of natural language
    • G06F40/42Data-driven translation
    • G06F40/44Statistical methods, e.g. probability models
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR 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; CALCULATING OR COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N3/00Computing arrangements based on biological models
    • G06N3/02Neural networks
    • G06N3/08Learning methods

Definitions

  • the present application relates to the field of natural language technology of artificial intelligence, in particular to a keyword automatic extraction method, device, equipment and storage medium.
  • Text keywords condense the gist and gist of the entire text, and are a high-level summary of a text. By extracting words or phrases with a summary function from a text, it can help users quickly retrieve the information they need and quickly judge the need for the text, and effectively solve the problem of information overload.
  • the attention mechanism and replication mechanism are introduced into the recurrent neural network, which enables the neural network to predict keywords other than the vocabulary and source documents, which improves the quality of keyword extraction. efficiency still needs to be improved.
  • the present application provides a keyword automatic extraction method, device, equipment and storage medium, which can improve the efficiency and accuracy of keyword acquisition, and solve the current problem of low efficiency and inaccuracy caused by extracting abstracts from texts.
  • a technical solution adopted by this application is to provide a method for automatically extracting keywords, including:
  • the pre-built language prediction model is trained, and the language prediction model is iteratively optimized by using the gradient descent method to obtain the target language prediction model;
  • an automatic keyword extraction device including:
  • the label processing module is used to obtain sample text for training, extract keywords from the sample text, sort the keywords according to the sequence of keyword extraction, and perform label processing on all the keywords in sequence , to obtain a set of keywords containing the tag;
  • An association processing module configured to associate the sample text with the keyword set to form a training data set
  • a model training module configured to train a pre-built language prediction model based on the training data set and a cross-entropy loss function, and iteratively optimize the language prediction model by using a gradient descent method to obtain a target language prediction model;
  • a keyword extraction module configured to acquire text to be processed and input the text to be processed into the target language prediction model, output a set of target keywords including the label, and select from the set of target keywords according to the label Extract target keywords of the text to be processed.
  • a computer device including: a memory, a processor, and a computer program stored in the memory and operable on the processor, and the processor executes the computer program.
  • the pre-built language prediction model is trained, and the language prediction model is iteratively optimized by using the gradient descent method to obtain the target language prediction model;
  • Another technical solution adopted by the present application is to provide a computer storage medium on which a computer program is stored, and when the computer program is executed by a processor, the following steps are implemented:
  • the pre-built language prediction model is trained, and the language prediction model is iteratively optimized by using the gradient descent method to obtain the target language prediction model;
  • the beneficial effect of the present application is: by performing label recognition on the output result of the language prediction model and extracting keywords according to the recognition result, the number of keywords to be extracted is not limited, thereby realizing the extraction of a plurality of unlimited keywords from the text, Directly extract keywords through tag recognition results.
  • Fig. 1 is the schematic flow chart of the keyword automatic extraction method of the first embodiment of the present application
  • Fig. 2 is a schematic flow chart of step S101 in the keyword automatic extraction method of the embodiment of the present application
  • Fig. 3 is a schematic flow chart of step S104 in the keyword automatic extraction method of the embodiment of the present application.
  • Fig. 4 is a schematic flow chart of step S304 in the keyword automatic extraction method of the embodiment of the present application.
  • Fig. 5 is a schematic structural diagram of a keyword automatic extraction device according to an embodiment of the present application.
  • FIG. 6 is a schematic structural diagram of a computer device according to an embodiment of the present application.
  • Fig. 7 is a schematic structural diagram of a computer storage medium according to an embodiment of the present application.
  • first”, “second”, and “third” in this application are used for descriptive purposes only, and cannot be understood as indicating or implying relative importance or implicitly specifying the quantity of indicated technical features. Thus, features defined as “first”, “second”, and “third” may explicitly or implicitly include at least one of these features.
  • “plurality” means at least two, such as two, three, etc., unless otherwise specifically defined. All directional indications (such as up, down, left, right, front, back%) in the embodiments of the present application are only used to explain the relative positional relationship between the various components in a certain posture (as shown in the drawings) , sports conditions, etc., if the specific posture changes, the directional indication also changes accordingly.
  • AI artificial intelligence
  • digital computers or machines controlled by digital computers to simulate, extend and expand human intelligence, perceive the environment, acquire knowledge and use knowledge to obtain the best results.
  • Artificial intelligence basic technologies generally include technologies such as sensors, dedicated artificial intelligence chips, cloud computing, distributed storage, big data processing technology, operation/interaction systems, and mechatronics.
  • Artificial intelligence software technology mainly includes computer vision technology, robotics technology, biometrics technology, speech processing technology, natural language processing technology, and machine learning/deep learning.
  • FIG. 1 is a schematic flowchart of a method for automatically extracting keywords according to the first embodiment of the present application. It should be noted that, if substantially the same result is obtained, the method of the present application is not limited to the flow sequence shown in FIG. 1 . As shown in Figure 1, the method includes steps:
  • Step S101 Obtain sample texts for training, extract keywords from the sample texts, sort keywords according to the sequence of keyword extraction, and label all keywords sequentially to obtain a keyword set containing tags.
  • step S101 the sample texts used for training are obtained, and the sample texts are preprocessed. Since the quality of the obtained sample texts is closely related to the prediction accuracy of the subsequent trained prediction model, similar sample texts need to be Deduplication processing, filtering low-quality sample text.
  • the keyword extraction algorithm is used to extract keywords and the extraction results are manually rechecked.
  • the keyword extraction algorithm in this embodiment includes, for example, the TF-IDF algorithm and the TextRank algorithm.
  • all keywords are sorted according to the sequence of keyword extraction, the start tag is inserted at the beginning of the first keyword, the end tag is inserted at the end of the last keyword, and the adjacent A connection tag is inserted between two keywords, so as to obtain a keyword set including a keyword, a start tag, an end tag and a connection tag.
  • the start tag is ⁇ START>
  • the end tag is ⁇ EOS>
  • the connection tag is [unused50]
  • keywords are extracted from a sample text as follows: "pre-trained language model, natural language processing, extractive summarization, small data set”
  • the keyword set can be expressed as " ⁇ START>pre-trained language model [unused50] natural language processing [unused50] extractive summarization [unused50] small data set ⁇ EOS>".
  • step S101 also includes the following steps:
  • Step S201 Acquiring sample texts for training, extracting keywords from the sample texts, and arranging the keywords according to the sequence of keyword extraction.
  • Step S202 Insert the first label before the first keyword in the ranking result, insert the second label after the last keyword in the ranking result, insert the third label between two adjacent keywords, and obtain A collection of keywords containing the first tag, the second tag, and the third tag.
  • the first label is the start label, indicating the start of keyword extraction
  • the second label is the end label, indicating the end of keyword extraction
  • the third label is the connection label, indicating the connection between two adjacent keywords , keywords can be accurately identified and acquired through the identification of the third tag.
  • the start and end of keywords are identified and extracted through the start tag and the end tag, and the number of keywords to be extracted is not limited, so as to realize the extraction of multiple unlimited keywords from the text, and the keywords are divided by connecting tags , in order to directly identify keywords.
  • the keywords are divided by connecting tags , in order to directly identify keywords.
  • Step S102 Associate the sample text with the keyword set to form a training data set.
  • a sample text corresponds to a keyword set
  • a sample text is associated with the corresponding keyword set to form a piece of training data
  • multiple sample texts are associated with their corresponding keyword sets to form a training data set .
  • Step S103 Train the pre-built language prediction model based on the training data set and the cross-entropy loss function, use the gradient descent method to iteratively optimize the language prediction model, and obtain the target language prediction model.
  • the pre-built language prediction model is an encoding-decoding model based on the Seq2seq framework, which incorporates a pointer generation network.
  • the language prediction model of this embodiment includes a feature extraction module, an encoding module, a decoding module, and a pointer module.
  • the feature extraction module uses the Bert network to perform feature extraction for each word, and integrates each word with contextual semantics to strengthen the characteristics of each word.
  • the encoding module uses a bidirectional LSTM to capture the long-distance dependencies and positional relationships of the output results of the feature extraction module, and uses the self-attention mechanism to optimize the semantic representation of the hidden state to extract the features of keywords in the text;
  • the decoding module uses one-way The LSTM uses the pointer network and the coverage mechanism to improve the attention distribution of keywords; the pointer module judges whether the extracted keywords should be directly copied from the text or regenerated by calculating the generation probability.
  • the training data set is divided, the training data set is divided into a first training set and a test set according to a first preset ratio, and the first training set is divided into a second training set and a verification set according to a second preset ratio.
  • the first preset ratio may be 7:3, and the second preset ratio may be 9:1.
  • the second training set is used to train the pre-built language prediction model.
  • the sample text is used as the input of the encoding module to train the encoding module
  • the keyword set is used to train the encoding module.
  • the decoding module is trained, the verification set is used to verify the test results of the trained language prediction model, and the test set is used to test the language prediction model readjusted after verification.
  • Step S104 Obtain the text to be processed and input the text to be processed into the target language prediction model, output the target keyword set including tags, and extract the target keywords of the text to be processed from the target keyword set according to the tags.
  • the input of the target language prediction model is a sequence of texts to be processed, and the output is a set of target keywords including labels.
  • the second tag is identified from the target keyword set; all target keywords in the text to be processed are extracted according to the position of the second tag. For example, if the target keyword set is expressed as " ⁇ START>pre-trained language model[unused50]natural language processing[unused50]extractive summarization[unused50]small data set ⁇ EOS>", then from the target keyword set, "[ unused50]" label, the words appearing on the left and right of the label are all target keywords.
  • the target language prediction model of this embodiment includes a feature extraction module, an encoding module, a decoding module, and a pointer module.
  • the feature extraction module of this embodiment extracts features from the text to be processed based on the Bert network; the encoding module receives the feature extraction result and passes through a two-way LSTM Encode the feature extraction result of the feature extraction module to obtain the intermediate hidden vector and splicing the intermediate hidden vector; the decoding module receives the splicing result and decodes the splicing result; the pointer module calculates the pointer weight through the encoding result and the decoding result, according to the pointer The weight determines how the target keywords are acquired.
  • step S104 also includes the following steps:
  • Step S301 Obtain the text to be processed, perform feature extraction on the text to be processed based on the Bert network, and obtain a feature vector.
  • This embodiment obtains the text to be processed, and extracts features from each word in the text to be processed based on the Bert network to obtain a feature vector corresponding to each word, and can integrate each word with contextual semantics through the Bert network, thereby improving the performance of each word. relationship between.
  • Step S302 Encoding the feature vectors to obtain a hidden vector of each feature vector, and splicing the hidden vectors to obtain a concatenated vector.
  • the feature vectors are input into the encoding module, and each feature vector is sequentially encoded based on a bidirectional LSTM, and a hidden vector of an intermediate layer is obtained corresponding to each feature vector, and then all hidden vectors are spliced to obtain splicing vector, concatenating the vector as an output of the encoding module.
  • Step S303 Perform decoding processing on the concatenated vector to obtain a decoded vector corresponding to the feature vector.
  • the splicing vector is used as the input of the decoding module, and each element in the splicing vector is decoded in sequence, and the decoding result of the middle layer is obtained corresponding to each element, and all the decoding results are spliced to obtain the corresponding decoding vector. Take the decoded vector as the output of the decoding module.
  • Step S304 Calculate pointer weights according to hidden vectors, concatenated vectors, and decoded vectors, obtain target keyword probability distributions according to pointer weights, and determine target keyword sets according to target keyword probability distributions.
  • the pointer weight in this embodiment is used to determine the acquisition method of the target keyword, and the acquisition method includes a generation method and an extraction method.
  • step S304 also includes the following steps:
  • Step S401 Obtain the attention distribution of each word in the text to be processed according to the hidden vector and the decoded vector based on the self-attention mechanism.
  • the attention value is calculated according to the hidden vector and decoding vector of each word, and the attention distribution of the vocabulary corresponding to the text to be processed is obtained. word probabilities.
  • Step S402 Predict the vocabulary distribution of the words to be generated according to the attention distribution and the decoding vector.
  • a linear transformation is performed on the attention distribution and the decoding vector, and the linear transformation result is converted into a vocabulary probability distribution based on a softmax function, that is, a vocabulary distribution.
  • the vocabulary distribution indicates the probability that a regenerated vocabulary is used as a target keyword.
  • Step S403 Calculate pointer weights according to the hidden vector, concatenated vector and decoded vector.
  • the pointer weight in this embodiment represents the probability of obtaining the target keyword in a generating manner.
  • the method of obtaining the target keyword can be determined according to the pointer weight.
  • the pointer weight is [0,1], and the pointer weight tends to 0. It is determined to obtain the target keyword in an extraction manner. Words, the weight of the pointer tends to 1, and it is determined to obtain the target keywords in a generative way.
  • pointer weight is calculated according to the following formula:
  • Step S404 Perform weighted calculation of the pointer weight, attention distribution, and vocabulary distribution to obtain the target keyword probability distribution, and determine the target keyword set according to the target keyword probability distribution.
  • step S404 the target keyword probability distribution is calculated according to the following formula:
  • w i represents the i-th vocabulary in the vocabulary distribution
  • P gen represents the generation probability
  • 1-P gen represents the probability of directly copying the target keyword from the text to be processed
  • P vocab (w) represents The probability distribution of the target keyword is generated in a generative way
  • P(w) means that the probability of obtaining the target keyword w is equal to the probability of generating w from the vocabulary distribution plus the probability of directly copying w from the text to be processed.
  • the keyword automatic extraction method in the first embodiment of the present application recognizes the labels of the output results of the language prediction model and extracts keywords according to the recognition results without limiting the number of keywords to be extracted, thereby realizing the extraction of multiple unlimited keywords from the text.
  • a large number of keywords can be directly extracted from the tag recognition results.
  • FIG. 5 is a schematic structural diagram of an automatic keyword extraction device according to an embodiment of the present application.
  • the device 50 includes a label processing module 51 , an association processing module 52 , a model training module 53 and a keyword extraction module 54 .
  • the label processing module 51 is used to obtain the sample text used for training, extract keywords from the sample text, sort the keywords according to the sequence of keyword extraction, and perform label processing on all keywords in order to obtain the key words containing labels. word set;
  • the association processing module 52 is used for associating the sample text with the keyword set to form a training data set
  • the model training module 53 is used to train the pre-built language prediction model based on the training data set and the cross-entropy loss function, and use the gradient descent method to iteratively optimize the language prediction model to obtain the target language prediction model;
  • the keyword extraction module 54 is used to obtain the text to be processed and input the text to be processed into the target language prediction model, output the target keyword set including tags, and extract the target keywords of the text to be processed from the target keyword set according to the tags.
  • FIG. 6 is a schematic structural diagram of a computer device according to an embodiment of the present application.
  • the computer device 60 includes a processor 61 and a memory 62 coupled to the processor 61 .
  • the memory 62 stores program instructions for implementing the automatic keyword extraction method described in any of the above-mentioned embodiments.
  • the processor 61 is used to execute the program instructions stored in the memory 62 to extract keywords.
  • the processor 61 may also be called a CPU (Central Processing Unit, central processing unit).
  • the processor 61 may be an integrated circuit chip with signal processing capability.
  • the processor 61 can also be a general-purpose processor, a digital signal processor (DSP), an application-specific integrated circuit (ASIC), an off-the-shelf programmable gate array (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components .
  • a general-purpose processor may be a microprocessor, or the processor may be any conventional processor, or the like.
  • FIG. 7 is a schematic structural diagram of a computer storage medium according to an embodiment of the present application.
  • the computer storage medium of the embodiment of the present application stores a program file 71 capable of realizing all the above-mentioned methods, wherein the program file 71 can be stored in the above-mentioned computer storage medium in the form of a software product, including several instructions to make a computer device (It may be a personal computer, a server, or a network device, etc.) or a processor (processor) executes all or part of the steps of the methods described in various embodiments of the present application.
  • a computer device It may be a personal computer, a server, or a network device, etc.
  • processor processor
  • the aforementioned computer storage medium can be nonvolatile or volatile, and the storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), magnetic disks or optical discs and other media that can store program codes, or terminal devices such as computers, servers, mobile phones, and tablets.
  • the disclosed system, device and method can be implemented in other ways.
  • the device embodiments described above are only illustrative.
  • the division of units is only a logical function division. In actual implementation, there may be other division methods.
  • multiple units or components can be combined or integrated. to another system, or some features may be ignored, or not implemented.
  • the mutual coupling or direct coupling or communication connection shown or discussed may be through some interfaces, and the indirect coupling or communication connection of devices or units may be in electrical, mechanical or other forms.
  • each functional unit in each embodiment of the present application may be integrated into one processing unit, each unit may exist separately physically, or two or more units may be integrated into one unit.
  • the above-mentioned integrated units can be implemented in the form of hardware or in the form of software functional units.

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • Artificial Intelligence (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Health & Medical Sciences (AREA)
  • General Health & Medical Sciences (AREA)
  • Computational Linguistics (AREA)
  • Data Mining & Analysis (AREA)
  • Audiology, Speech & Language Pathology (AREA)
  • Evolutionary Computation (AREA)
  • Life Sciences & Earth Sciences (AREA)
  • Molecular Biology (AREA)
  • Biomedical Technology (AREA)
  • Biophysics (AREA)
  • Computing Systems (AREA)
  • Mathematical Physics (AREA)
  • Software Systems (AREA)
  • Evolutionary Biology (AREA)
  • Computer Vision & Pattern Recognition (AREA)
  • Bioinformatics & Computational Biology (AREA)
  • Bioinformatics & Cheminformatics (AREA)
  • Probability & Statistics with Applications (AREA)
  • Machine Translation (AREA)

Abstract

本申请涉及人工智能的自然语言处理领域,具体公开了一种关键词自动提取方法、装置、设备及存储介质。该方法包括:获取用于训练的样本文本,从样本文本中提取关键词,按照关键词提取的先后顺序对关键词进行排序,依序对所有关键词进行标签处理,获得含有标签的关键词集合;将样本文本与关键词集合进行关联处理以形成训练数据集;基于训练数据集和交叉熵损失函数对预构建好的语言预测模型进行训练,利用梯度下降法迭代优化语言预测模型,获得目标语言预测模型;获取待处理文本并将待处理文本输入目标语言预测模型中,输出包含标签的目标关键词集合,根据标签从目标关键词集合中提取待处理文本的目标关键词。本申请能够提高关键词获取效率和准确率。

Description

关键词自动提取方法、装置、设备及存储介质
本申请要求于2021年10月12日提交中国专利局、申请号为202111187827.4,发明名称为“关键词自动提取方法、装置、设备及存储介质”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。
技术领域
本申请涉及人工智能的自然语言技术领域,特别是涉及一种关键词自动提取方法、装置、设备及存储介质。
背景技术
关键词抽取作为文本挖掘中一项重要的技术,是信息检索、文本分类以及推荐系统等基础性和必要性的工作。文本关键词浓缩了整篇文本的主旨和要义,是对一篇文本的高度概括。通过从一篇文本中提取具有概括功能的词或短语,可以帮助用户快速检索到用户所需要的信息以及快速判断文本的需要性,并有效解决了信息过载的问题。
当前提取关键词的方法有很多种,采用的主要方法有基于统计TF-IDF的算法、基于图模型的TextRank算法以及基于主题模型的LDA算法。但发明人发现,大多数是利用词频、位置等信息来作为衡量关键词的重要特征,这种方式提取的关键词不能很好的概括文本内容,无法很好的获取句子之间以及关键词之间的深层次语义联系,会造成潜在的有用关键词无法提取出来,从而使抽取的关键词的查准率和查全率都不高。
随着Seq2seq框架的提出,在循环神经网络中引入了注意力机制和复制机制,使得该神经网络能够预测出词汇表和源文档以外的关键词,提高了关键词抽取的质量,但关键词抽取的效率仍有待提高。
发明内容
本申请提供一种关键词自动提取方法、装置、设备及存储介质,能够提高关键词获取效率和准确率,解决目前从文本中通过提取摘要获取关键词导致的效率低且不准确的问题。
为解决上述技术问题,本申请采用的一个技术方案是:提供一种关键词自动提取方法,包括:
获取用于训练的样本文本,从所述样本文本中提取关键词,按照关键词提取的先后顺序对所述关键词进行排序,依序对所有所述关键词进行标签处理,获得含有所述标签的关键词集合;
将所述样本文本与所述关键词集合进行关联处理以形成训练数据集;
基于所述训练数据集和交叉熵损失函数对预构建好的语言预测模型进行训练,利用梯度下降法迭代优化所述语言预测模型,获得目标语言预测模型;
获取待处理文本并将所述待处理文本输入所述目标语言预测模型中,输出包含所述标签的目标关键词集合,根据所述标签从所述目标关键词集合中提取所述待处理文本的目标关键词。
为解决上述技术问题,本申请采用的另一个技术方案是:提供一种关键词自动提取装置,包括:
标签处理模块,用于获取用于训练的样本文本,从所述样本文本中提取关键词, 按照关键词提取的先后顺序对所述关键词进行排序,依序对所有所述关键词进行标签处理,获得含有所述标签的关键词集合;
关联处理模块,用于将所述样本文本与所述关键词集合进行关联处理以形成训练数据集;
模型训练模块,用于基于所述训练数据集和交叉熵损失函数对预构建好的语言预测模型进行训练,利用梯度下降法迭代优化所述语言预测模型,获得目标语言预测模型;
关键词提取模块,用于获取待处理文本并将所述待处理文本输入所述目标语言预测模型中,输出包含所述标签的目标关键词集合,根据所述标签从所述目标关键词集合中提取所述待处理文本的目标关键词。
为解决上述技术问题,本申请采用的再一个技术方案是:提供一种计算机设备,包括:存储器、处理器及存储在存储器上并可在处理器上运行的计算机程序,所述处理器执行所述计算机程序时实现以下步骤:
获取用于训练的样本文本,从所述样本文本中提取关键词,按照关键词提取的先后顺序对所述关键词进行排序,依序对所有所述关键词进行标签处理,获得含有所述标签的关键词集合;
将所述样本文本与所述关键词集合进行关联处理以形成训练数据集;
基于所述训练数据集和交叉熵损失函数对预构建好的语言预测模型进行训练,利用梯度下降法迭代优化所述语言预测模型,获得目标语言预测模型;
获取待处理文本并将所述待处理文本输入所述目标语言预测模型中,输出包含所述标签的目标关键词集合,根据所述标签从所述目标关键词集合中提取所述待处理文本的目标关键词。
为解决上述技术问题,本申请采用的再一个技术方案是:提供一种计算机存储介质,其上存储有计算机程序,所述计算机程序被处理器执行时实现以下步骤:
获取用于训练的样本文本,从所述样本文本中提取关键词,按照关键词提取的先后顺序对所述关键词进行排序,依序对所有所述关键词进行标签处理,获得含有所述标签的关键词集合;
将所述样本文本与所述关键词集合进行关联处理以形成训练数据集;
基于所述训练数据集和交叉熵损失函数对预构建好的语言预测模型进行训练,利用梯度下降法迭代优化所述语言预测模型,获得目标语言预测模型;
获取待处理文本并将所述待处理文本输入所述目标语言预测模型中,输出包含所述标签的目标关键词集合,根据所述标签从所述目标关键词集合中提取所述待处理文本的目标关键词。
本申请的有益效果是:通过对语言预测模型的输出结果进行标签识别并根据识别结果提取关键词,并不限制关键词的提取数量,从而实现从文本中提取多个不限数量的关键词,通过标签识别结果直接提取关键词,与现有方案相比,无需通过统计词频或者机器学习的方式获取关键词,从而提高了关键词获取效率和准确率,解决了目前从文本中通过提取摘要获取关键词导致的效率低且不准确的问题。
附图说明
图1是本申请第一实施例的关键词自动提取方法的流程示意图;
图2是本申请实施例的关键词自动提取方法中步骤S101的流程示意图;
图3是本申请实施例的关键词自动提取方法中步骤S104的流程示意图;
图4是本申请实施例的关键词自动提取方法中步骤S304的流程示意图;
图5是本申请实施例的关键词自动提取装置的结构示意图;
图6是本申请实施例的计算机设备的结构示意图;
图7是本申请实施例的计算机存储介质的结构示意图。
具体实施方式
下面将结合本申请实施例中的附图,对本申请实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例仅是本申请的一部分实施例,而不是全部的实施例。基于本申请中的实施例,本领域普通技术人员在没有做出创造性劳动前提下所获得的所有其他实施例,都属于本申请保护的范围。
本申请中的术语“第一”、“第二”、“第三”仅用于描述目的,而不能理解为指示或暗示相对重要性或者隐含指明所指示的技术特征的数量。由此,限定有“第一”、“第二”、“第三”的特征可以明示或者隐含地包括至少一个该特征。本申请的描述中,“多个”的含义是至少两个,例如两个,三个等,除非另有明确具体的限定。本申请实施例中所有方向性指示(诸如上、下、左、右、前、后……)仅用于解释在某一特定姿态(如附图所示)下各部件之间的相对位置关系、运动情况等,如果该特定姿态发生改变时,则该方向性指示也相应地随之改变。此外,术语“包括”和“具有”以及它们任何变形,意图在于覆盖不排他的包含。例如包含了一系列步骤或单元的过程、方法、系统、产品或设备没有限定于已列出的步骤或单元,而是可选地还包括没有列出的步骤或单元,或可选地还包括对于这些过程、方法、产品或设备固有的其它步骤或单元。
在本文中提及“实施例”意味着,结合实施例描述的特定特征、结构或特性可以包含在本申请的至少一个实施例中。在说明书中的各个位置出现该短语并不一定均是指相同的实施例,也不是与其它实施例互斥的独立的或备选的实施例。本领域技术人员显式地和隐式地理解的是,本文所描述的实施例可以与其它实施例相结合。
本申请实施例可以基于人工智能技术对相关的数据进行获取和处理。其中,人工智能(Artificial Intelligence,AI)是利用数字计算机或者数字计算机控制的机器模拟、延伸和扩展人的智能,感知环境、获取知识并使用知识获得最佳结果的理论、方法、技术及应用系统。
人工智能基础技术一般包括如传感器、专用人工智能芯片、云计算、分布式存储、大数据处理技术、操作/交互系统、机电一体化等技术。人工智能软件技术主要包括计算机视觉技术、机器人技术、生物识别技术、语音处理技术、自然语言处理技术以及机器学习/深度学习等几大方向。
图1是本申请第一实施例的关键词自动提取方法的流程示意图。需注意的是,若有实质上相同的结果,本申请的方法并不以图1所示的流程顺序为限。如图1所示,该方法包括步骤:
步骤S101:获取用于训练的样本文本,从样本文本中提取关键词,按照关键词提取的先后顺序对关键词进行排序,依序对所有关键词进行标签处理,获得含有标签的关键词集合。
在步骤S101中,获取用于训练的样本文本,对样本文本进行预处理,由于所获取的样本文本的质量与后续训练出的预测模型的预测准确度息息相关,因此,需对相似的样本文本进行去重处理,对低质量的样本文本进行过滤处理。对预处理后的样本文本在人工干预的情况下,采用关键词提取算法进行关键词提取并对提取结果进行人工复检。本实施例的关键词提取算法例如,TF-IDF算法以及TextRank算法等。本实施例提取关键词后,按照关键词提取的先后顺序对所有关键词进行排序, 在第一个关键词的开头插入起始标签,在最后一个关键词的结尾插入结束标签,在相邻的两个关键词之间插入连接标签,从而获得包含关键词、起始标签、结束标签以及连接标签的关键词集合。例如:起始标签为<START>,结束标签为<EOS>,连接标签为[unused50],从一个样本文本中提取关键词如下:“预训练语言模型、自然语言处理、抽取式摘要、小数据集”,则关键词集合可以表示为“<START>预训练语言模型[unused50]自然语言处理[unused50]抽取式摘要[unused50]小数据集<EOS>”。
进一步地,请参见图2,步骤S101还包括以下步骤:
步骤S201:获取用于训练的样本文本,从样本文本中提取关键词,按照关键词提取的先后顺序对关键词进行排列。
步骤S202:在排列结果中的第一个关键词之前插入第一标签,在排列结果中的最后一个关键词之后插入第二标签,在相邻的两个关键词之间插入第三标签,获得含有第一标签、第二标签以及第三标签的关键词集合。
在步骤S202中,第一标签为起始标签,表示关键词提取开始,第二标签为结束标签,表示关键词提取结束,第三标签为连接标签,表示相邻两个关键词之间的连接,通过第三标签的标识能够准确识别并获取关键词。
本实施例通过起始标签和结束标签识别提取关键词的开始和结束,并不限制关键词的提取数量,从而实现从文本中提取多个不限数量的关键词,通过连接标签将关键词分割,以便直接识别关键词,与现有方案相比,在后续关键词预测结果中无需通过统计词频或者机器学习的方式获取关键词,从而提高了关键词获取效率和准确率,解决了目前从文本中获取摘要,再通过摘要获取关键词导致的获取效率低且不准确的问题。
步骤S102:将样本文本与关键词集合进行关联处理以形成训练数据集。
在步骤S102中,一个样本文本对应一个关键词集合,一个样本文本与对应的关键词集合进行关联处理形成一条训练数据,将多个样本文本分别与其对应的关键词集合进行关联处理形成训练数据集。
步骤S103:基于训练数据集和交叉熵损失函数对预构建好的语言预测模型进行训练,利用梯度下降法迭代优化语言预测模型,获得目标语言预测模型。
在步骤S103中,预构建好的语言预测模型为基于Seq2seq框架的编码-解码模型,该模型融合了指针生成网络。本实施例的语言预测模型包括特征提取模块、编码模块、解码模块以及指针模块,特征提取模块采用Bert网络对每个词进行特征提取,将每个词融合上下文语义,加强了每个词的特征获取能力;编码模块采用双向的LSTM,捕捉特征提取模块输出结果的长距离依赖关系以及位置关系,并运用自注意力机制优化隐藏状态语义表示,提取文本中关键词的特征;解码模块采用单向的LSTM,利用指针网络和Coverage机制提高关键词的注意力分布;指针模块通过计算生成概率判断提取的关键词应该直接从文本中复制还是重新生成。
本实施例对训练数据集进行分割处理,将训练数据集按照第一预设比例分成第一训练集和测试集,将第一训练集按照第二预设比例分成第二训练集和验证集。第一预设比例可以为7:3,第二预设比例可以为9:1。第二训练集用于对预构建好的语言预测模型进行训练,本实施例第二训练集的每一条训练数据中,利用样本文本作为编码模块的输入,对编码模块进行训练,利用关键词集合作为解码模块的输入,对解码模块进行训练,验证集用于对训练好的语言预测模型的测试结果进行验证,测试集用于用经过验证之后重新调整的语言预测模型进行测试。
步骤S104:获取待处理文本并将待处理文本输入目标语言预测模型中,输出包含标签的目标关键词集合,根据标签从目标关键词集合中提取待处理文本的目标关 键词。
在步骤S104中,目标语言预测模型的输入为待处理文本的序列,输出为含有标签的目标关键词集合。本实施例从目标关键词集合中识别第二标签;根据第二标签的位置提取待处理文本中的所有目标关键词。例如,目标关键词集合表示为“<START>预训练语言模型[unused50]自然语言处理[unused50]抽取式摘要[unused50]小数据集<EOS>”,则从目标关键词集合中识别出“[unused50]”标签标识,出现在该标签标识左右的词均为目标关键词。
本实施例的目标语言预测模型包括特征提取模块、编码模块、解码模块以及指针模块,本实施例的特征提取模块基于Bert网络对待处理文本进行特征提取;编码模块接收特征提取结果并经过双向的LSTM对特征提取模块的特征提取结果进行编码,得到中间隐藏向量并将中间隐藏向量进行拼接;解码模块接收拼接结果并将拼接结果进行解码;指针模块则通过编码结果和解码结果计算指针权重,根据指针权重确定目标关键词的获取方式。
进一步地,请参见图3,步骤S104中还包括以下步骤:
步骤S301:获取待处理文本,基于Bert网络对待处理文本进行特征提取,获得特征向量。
本实施例获取待处理文本,基于Bert网络对待处理文本中的每个词进行特征提取,获得与每个词对应的特征向量,通过Bert网络可以将每个词融合上下文语义,提高了每个词之间的关联关系。
步骤S302:对特征向量进行编码处理,获得每个特征向量的隐藏向量,对隐藏向量进行拼接处理,获得拼接向量。
本实施例将特征向量输入编码模块中,基于双向的LSTM依序对每个特征向量进行编码处理,对应每个特征向量获得一个中间层的隐藏向量,再对所有隐藏向量进行拼接处理,获得拼接向量,将拼接向量作为编码模块的一个输出。
步骤S303:对拼接向量进行解码处理,获得与特征向量对应的解码向量。
本实施例将拼接向量作为解码模块的输入,依序对拼接向量中的每个元素进行解码,对应每个元素均获得中间层的解码结果,将所有解码结果进行拼接,获得对应的解码向量,将解码向量作为解码模块的输出。
步骤S304:根据隐藏向量、拼接向量以及解码向量计算指针权重,并根据指针权重获得目标关键词概率分布,根据目标关键词概率分布确定目标关键词集合。
本实施例的指针权重用于确定目标关键词的获取方式,获取方式包括生成式和抽取式。
进一步地,请参见图4,步骤S304还包括以下步骤:
步骤S401:基于自注意力机制根据隐藏向量和解码向量获得待处理文本中每个词的注意力分布。
本实施例中,基于自注意力机制,根据每个词的隐藏向量和解码向量计算注意力值,得到与待处理文本对应的词汇的注意力分布,该注意力分布表示从文本中复制目标关键词的概率。
步骤S402:根据注意力分布和解码向量预测所需生成词的词汇分布。
本实施例对注意力分布和解码向量进行线性变换,基于softmax函数将线性变换结果转换成词汇概率分布,即词汇分布,该词汇分布表示重新生成的词汇作为目标关键词的概率。
步骤S403:根据隐藏向量、拼接向量以及解码向量计算指针权重。
本实施例的指针权重表示以生成方式获取目标关键词的概率,根据指针权重能 够确定获取目标关键词的方式,指针权重取[0,1],指针权重趋向0,确定以抽取方式获得目标关键词,指针权重趋向1,确定以生成方式获得目标关键词。
进一步地,指针权重按照如下公式进行计算:
Figure PCTCN2022071258-appb-000001
其中,
Figure PCTCN2022071258-appb-000002
为编码处理过程中每个t时刻的隐藏向量,s t为解码过程中t时刻的解码向量,x t为t时刻的拼接向量,σ表示sigmoid函数,将值映射到0-1,则,P gen∈[0,1],P gen表示生成概率,当P gen偏向1时,以生成式的方式根据词汇分布生成目标关键词,当P gen偏向0时,以抽取式的方式根据注意力分布从待处理文本中直接复制目标关键词。
步骤S404:将指针权重与注意力分布、词汇分布进行加权计算,获得目标关键词概率分布,根据目标关键词概率分布确定目标关键词集合。
在步骤S404中,目标关键词概率分布按照如下公式进行计算:
Figure PCTCN2022071258-appb-000003
其中,
Figure PCTCN2022071258-appb-000004
表示以抽取式的方式从词汇分布中获得目标关键词的概率分布,其中,w i表示词汇分布中的第i个词汇,
Figure PCTCN2022071258-appb-000005
表示第t个时间步中,词汇分布中第i个词的注意力权重,P gen表示生成概率,1-P gen表示从待处理文本中直接复制目标关键词的概率,P vocab(w)表示以生成式的方式生成目标关键词的概率分布,P(w)表示获取目标关键词w的概率等于从词汇分布生成w的概率再加上从待处理文本直接复制w的概率。
本申请第一实施例的关键词自动提取方法通过对语言预测模型的输出结果进行标签识别并根据识别结果提取关键词,并不限制关键词的提取数量,从而实现从文本中提取多个不限数量的关键词,通过标签识别结果直接提取关键词,与现有方案相比,无需通过统计词频或者机器学习的方式获取关键词,从而提高了关键词获取效率和准确率,解决了目前从文本中通过提取摘要获取关键词导致的效率低且不准确的问题。
图5是本申请实施例的关键词自动提取装置的结构示意图。如图5所示,该装置50包括标签处理模块51、关联处理模块52、模型训练模块53和关键词提取模块54。
标签处理模块51用于获取用于训练的样本文本,从样本文本中提取关键词,按照关键词提取的先后顺序对关键词进行排序,依序对所有关键词进行标签处理,获得含有标签的关键词集合;
关联处理模块52用于将样本文本与关键词集合进行关联处理以形成训练数据集;
模型训练模块53用于基于训练数据集和交叉熵损失函数对预构建好的语言预测模型进行训练,利用梯度下降法迭代优化语言预测模型,获得目标语言预测模型;
关键词提取模块54用于获取待处理文本并将待处理文本输入目标语言预测模型中,输出包含标签的目标关键词集合,根据标签从目标关键词集合中提取待处理文本的目标关键词。
请参阅图6,图6为本申请实施例的计算机设备的结构示意图。如图6所示,该计算机设备60包括处理器61及和处理器61耦接的存储器62。
存储器62存储有用于实现上述任一实施例所述的关键词自动提取方法的程序指令。
处理器61用于执行存储器62存储的程序指令以提取关键词。
其中,处理器61还可以称为CPU(Central Processing Unit,中央处理单元)。处理器61可能是一种集成电路芯片,具有信号的处理能力。处理器61还可以是通用处理器、数字信号处理器(DSP)、专用集成电路(ASIC)、现成可编程门阵列(FPGA) 或者其他可编程逻辑器件、分立门或者晶体管逻辑器件、分立硬件组件。通用处理器可以是微处理器或者该处理器也可以是任何常规的处理器等。
参阅图7,图7为本申请实施例的计算机存储介质的结构示意图。本申请实施例的计算机存储介质存储有能够实现上述所有方法的程序文件71,其中,该程序文件71可以以软件产品的形式存储在上述计算机存储介质中,包括若干指令用以使得一台计算机设备(可以是个人计算机,服务器,或者网络设备等)或处理器(processor)执行本申请各个实施方式所述方法的全部或部分步骤。而前述的计算机存储介质,可以是非易失性,也可以是易失性,存储介质包括:U盘、移动硬盘、只读存储器(ROM,Read-Only Memory)、随机存取存储器(RAM,Random Access Memory)、磁碟或者光盘等各种可以存储程序代码的介质,或者是计算机、服务器、手机、平板等终端设备。
在本申请所提供的几个实施例中,应该理解到,所揭露的系统,装置和方法,可以通过其它的方式实现。例如,以上所描述的装置实施例仅仅是示意性的,例如,单元的划分,仅仅为一种逻辑功能划分,实际实现时可以有另外的划分方式,例如多个单元或组件可以结合或者可以集成到另一个系统,或一些特征可以忽略,或不执行。另一点,所显示或讨论的相互之间的耦合或直接耦合或通信连接可以是通过一些接口,装置或单元的间接耦合或通信连接,可以是电性,机械或其它的形式。
另外,在本申请各个实施例中的各功能单元可以集成在一个处理单元中,也可以是各个单元单独物理存在,也可以两个或两个以上单元集成在一个单元中。上述集成的单元既可以采用硬件的形式实现,也可以采用软件功能单元的形式实现。
以上仅为本申请的实施方式,并非因此限制本申请的专利范围,凡是利用本申请说明书及附图内容所作的等效结构或等效流程变换,或直接或间接运用在其他相关的技术领域,均同理包括在本申请的专利保护范围内。

Claims (20)

  1. 一种关键词自动提取方法,其中,包括:
    获取用于训练的样本文本,从所述样本文本中提取关键词,按照关键词提取的先后顺序对所述关键词进行排序,依序对所有所述关键词进行标签处理,获得含有所述标签的关键词集合;
    将所述样本文本与所述关键词集合进行关联处理以形成训练数据集;
    基于所述训练数据集和交叉熵损失函数对预构建好的语言预测模型进行训练,利用梯度下降法迭代优化所述语言预测模型,获得目标语言预测模型;
    获取待处理文本并将所述待处理文本输入所述目标语言预测模型中,输出包含所述标签的目标关键词集合,根据所述标签从所述目标关键词集合中提取所述待处理文本的目标关键词。
  2. 根据权利要求1所述的方法,其中,所述获取用于训练的样本文本,从所述样本文本中提取关键词,按照关键词提取的先后顺序对所述关键词进行排序,依序对所有所述关键词进行标签处理,获得含有所述标签的关键词集合包括:
    获取用于训练的样本文本,从所述样本文本中提取关键词,按照关键词提取的先后顺序对所述关键词进行排列;
    在排列结果中的第一个关键词之前插入第一标签,在排列结果中的最后一个关键词之后插入第二标签,在相邻的两个所述关键词之间插入第三标签,获得含有所述第一标签、所述第二标签以及所述第三标签的关键词集合。
  3. 根据权利要求2所述的方法,其中,所述根据所述标签从所述目标关键词集合中提取所述待处理文本的目标关键词包括:
    从所述目标关键词集合中识别所述第二标签;
    根据所述第二标签的位置提取所述待处理文本中的所有所述目标关键词。
  4. 根据权利要求1所述的方法,其中,所述获取待处理文本并将所述待处理文本输入所述目标语言预测模型中,输出包含所述标签的目标关键词集合包括:
    获取所述待处理文本,基于Bert网络对所述待处理文本进行特征提取,获得特征向量;
    对所述特征向量进行编码处理,获得每个所述特征向量的隐藏向量,对所述隐藏向量进行拼接处理,获得拼接向量;
    对所述拼接向量进行解码处理,获得与所述特征向量对应的解码向量;
    根据所述隐藏向量、所述拼接向量以及所述解码向量计算指针权重,并根据所述指针权重获得目标关键词概率分布,根据所述目标关键词概率分布确定所述目标关键词集合。
  5. 根据权利要求4所述的方法,其中,所述根据所述隐藏向量、所述拼接向量以及所述解码向量计算指针权重,并根据所述指针权重获得目标关键词概率分布,根据所述目标关键词概率分布确定所述目标关键词集合包括:
    基于自注意力机制根据所述隐藏向量和所述解码向量获得所述待处理文本中每个词的注意力分布;
    根据所述注意力分布和所述解码向量预测所需生成词的词汇分布;
    根据所述隐藏向量、所述拼接向量以及所述解码向量计算指针权重;
    将所述指针权重与所述注意力分布、所述词汇分布进行加权计算,获得目标关键词概率分布,根据目标关键词概率分布确定所述目标关键词集合。
  6. 根据权利要求5所述的方法,其中,所述指针权重用于确定所述目标关键词 的获取方式,所述获取方式包括生成式和抽取式,所述指针权重按照如下公式进行计算:
    Figure PCTCN2022071258-appb-100001
    其中,
    Figure PCTCN2022071258-appb-100002
    为编码处理过程中每个t时刻的隐藏向量,s t为解码过程中t时刻的解码向量,x t为t时刻的所述拼接向量,σ表示sigmoid函数,将值映射到0-1,则,P gen∈[0,1],P gen表示生成概率,当P gen偏向1时,以生成式的方式根据所述词汇分布生成所述目标关键词,当P gen偏向0时,以抽取式的方式根据所述注意力分布从所述待处理文本中直接复制所述目标关键词。
  7. 根据权利要求6所述的方法,其中,所述目标关键词概率分布按照如下公式进行计算:
    Figure PCTCN2022071258-appb-100003
    其中,
    Figure PCTCN2022071258-appb-100004
    表示以抽取式的方式从所述词汇分布中获得所述目标关键词的概率分布,其中,w i表示所述词汇分布中的第i个词汇,
    Figure PCTCN2022071258-appb-100005
    表示第t个时间步中,所述词汇分布中第i个词的注意力权重,P gen表示生成概率,1-P gen表示从所述待处理文本中直接复制所述目标关键词的概率,P vocab(w)表示以生成式的方式生成所述目标关键词的概率分布,P(w)表示获取目标关键词w的概率等于从所述词汇分布生成w的概率再加上从所述待处理文本直接复制w的概率。
  8. 一种关键词自动提取装置,其中,包括:
    标签处理模块,用于获取用于训练的样本文本,从所述样本文本中提取关键词,按照关键词提取的先后顺序对所述关键词进行排序,依序对所有所述关键词进行标签处理,获得含有所述标签的关键词集合;
    关联处理模块,用于将所述样本文本与所述关键词集合进行关联处理以形成训练数据集;
    模型训练模块,用于基于所述训练数据集和交叉熵损失函数对预构建好的语言预测模型进行训练,利用梯度下降法迭代优化所述语言预测模型,获得目标语言预测模型;
    关键词提取模块,用于获取待处理文本并将所述待处理文本输入所述目标语言预测模型中,输出包含所述标签的目标关键词集合,根据所述标签从所述目标关键词集合中提取所述待处理文本的目标关键词。
  9. 一种计算机设备,包括:存储器、处理器及存储在存储器上并可在处理器上运行的计算机程序,其中,所述处理器执行所述计算机程序时实现一下步骤:
    获取用于训练的样本文本,从所述样本文本中提取关键词,按照关键词提取的先后顺序对所述关键词进行排序,依序对所有所述关键词进行标签处理,获得含有所述标签的关键词集合;
    将所述样本文本与所述关键词集合进行关联处理以形成训练数据集;
    基于所述训练数据集和交叉熵损失函数对预构建好的语言预测模型进行训练,利用梯度下降法迭代优化所述语言预测模型,获得目标语言预测模型;
    获取待处理文本并将所述待处理文本输入所述目标语言预测模型中,输出包含所述标签的目标关键词集合,根据所述标签从所述目标关键词集合中提取所述待处理文本的目标关键词。
  10. 根据权利要求9所述的计算机设备,其中,所述获取用于训练的样本文本,从所述样本文本中提取关键词,按照关键词提取的先后顺序对所述关键词进行排序,依序对所有所述关键词进行标签处理,获得含有所述标签的关键词集合包括:
    获取用于训练的样本文本,从所述样本文本中提取关键词,按照关键词提取的先后顺序对所述关键词进行排列;
    在排列结果中的第一个关键词之前插入第一标签,在排列结果中的最后一个关键词之后插入第二标签,在相邻的两个所述关键词之间插入第三标签,获得含有所述第一标签、所述第二标签以及所述第三标签的关键词集合。
  11. 根据权利要求10所述的计算机设备,其中,所述根据所述标签从所述目标关键词集合中提取所述待处理文本的目标关键词包括:
    从所述目标关键词集合中识别所述第二标签;
    根据所述第二标签的位置提取所述待处理文本中的所有所述目标关键词。
  12. 根据权利要求9所述的计算机设备,其中,所述获取待处理文本并将所述待处理文本输入所述目标语言预测模型中,输出包含所述标签的目标关键词集合包括:
    获取所述待处理文本,基于Bert网络对所述待处理文本进行特征提取,获得特征向量;
    对所述特征向量进行编码处理,获得每个所述特征向量的隐藏向量,对所述隐藏向量进行拼接处理,获得拼接向量;
    对所述拼接向量进行解码处理,获得与所述特征向量对应的解码向量;
    根据所述隐藏向量、所述拼接向量以及所述解码向量计算指针权重,并根据所述指针权重获得目标关键词概率分布,根据所述目标关键词概率分布确定所述目标关键词集合。
  13. 根据权利要求12所述的计算机设备,其中,所述根据所述隐藏向量、所述拼接向量以及所述解码向量计算指针权重,并根据所述指针权重获得目标关键词概率分布,根据所述目标关键词概率分布确定所述目标关键词集合包括:
    基于自注意力机制根据所述隐藏向量和所述解码向量获得所述待处理文本中每个词的注意力分布;
    根据所述注意力分布和所述解码向量预测所需生成词的词汇分布;
    根据所述隐藏向量、所述拼接向量以及所述解码向量计算指针权重;
    将所述指针权重与所述注意力分布、所述词汇分布进行加权计算,获得目标关键词概率分布,根据目标关键词概率分布确定所述目标关键词集合。
  14. 根据权利要求13所述的计算机设备,其中,所述指针权重用于确定所述目标关键词的获取方式,所述获取方式包括生成式和抽取式,所述指针权重按照如下公式进行计算:
    Figure PCTCN2022071258-appb-100006
    其中,
    Figure PCTCN2022071258-appb-100007
    为编码处理过程中每个t时刻的隐藏向量,s t为解码过程中t时刻的解码向量,x t为t时刻的所述拼接向量,σ表示sigmoid函数,将值映射到0-1,则,P gen∈[0,1],P gen表示生成概率,当P gen偏向1时,以生成式的方式根据所述词汇分布生成所述目标关键词,当P gen偏向0时,以抽取式的方式根据所述注意力分布从所述待处理文本中直接复制所述目标关键词。
  15. 根据权利要求14所述的计算机设备,其中,所述目标关键词概率分布按照如下公式进行计算:
    Figure PCTCN2022071258-appb-100008
    其中,
    Figure PCTCN2022071258-appb-100009
    表示以抽取式的方式从所述词汇分布中获得所述目标关键词的概率分布,其中,w i表示所述词汇分布中的第i个词汇,
    Figure PCTCN2022071258-appb-100010
    表示第t个时间步中,所述词汇分布中第i个词的注意力权重,P gen表示生成概率,1-P gen表示从所述待处理文本中直接复制所述目标关键词的概率,P vocab(w)表示以生成式的方式生成所述目标关键词的概率分布,P(w)表示获取目标关键词w的概率等于从所述词汇分布生成w的概率再加上从所述待处理文本直接复制w的概率。
  16. 一种计算机存储介质,其上存储有计算机程序,其中,所述计算机程序被处理器执行时实现以下步骤:
    获取用于训练的样本文本,从所述样本文本中提取关键词,按照关键词提取的先后顺序对所述关键词进行排序,依序对所有所述关键词进行标签处理,获得含有所述标签的关键词集合;
    将所述样本文本与所述关键词集合进行关联处理以形成训练数据集;
    基于所述训练数据集和交叉熵损失函数对预构建好的语言预测模型进行训练,利用梯度下降法迭代优化所述语言预测模型,获得目标语言预测模型;
    获取待处理文本并将所述待处理文本输入所述目标语言预测模型中,输出包含所述标签的目标关键词集合,根据所述标签从所述目标关键词集合中提取所述待处理文本的目标关键词。
  17. 根据权利要求16所述的计算机存储介质,其中,所述获取用于训练的样本文本,从所述样本文本中提取关键词,按照关键词提取的先后顺序对所述关键词进行排序,依序对所有所述关键词进行标签处理,获得含有所述标签的关键词集合包括:
    获取用于训练的样本文本,从所述样本文本中提取关键词,按照关键词提取的先后顺序对所述关键词进行排列;
    在排列结果中的第一个关键词之前插入第一标签,在排列结果中的最后一个关键词之后插入第二标签,在相邻的两个所述关键词之间插入第三标签,获得含有所述第一标签、所述第二标签以及所述第三标签的关键词集合。
  18. 根据权利要求17所述的计算机存储介质,其中,所述根据所述标签从所述目标关键词集合中提取所述待处理文本的目标关键词包括:
    从所述目标关键词集合中识别所述第二标签;
    根据所述第二标签的位置提取所述待处理文本中的所有所述目标关键词。
  19. 根据权利要求16所述的计算机存储介质,其中,所述获取待处理文本并将所述待处理文本输入所述目标语言预测模型中,输出包含所述标签的目标关键词集合包括:
    获取所述待处理文本,基于Bert网络对所述待处理文本进行特征提取,获得特征向量;
    对所述特征向量进行编码处理,获得每个所述特征向量的隐藏向量,对所述隐藏向量进行拼接处理,获得拼接向量;
    对所述拼接向量进行解码处理,获得与所述特征向量对应的解码向量;
    根据所述隐藏向量、所述拼接向量以及所述解码向量计算指针权重,并根据所述指针权重获得目标关键词概率分布,根据所述目标关键词概率分布确定所述目标关键词集合。
  20. 根据权利要求19所述的计算机存储介质,其中,所述根据所述隐藏向量、所述拼接向量以及所述解码向量计算指针权重,并根据所述指针权重获得目标关键词概率分布,根据所述目标关键词概率分布确定所述目标关键词集合包括:
    基于自注意力机制根据所述隐藏向量和所述解码向量获得所述待处理文本中每个词的注意力分布;
    根据所述注意力分布和所述解码向量预测所需生成词的词汇分布;
    根据所述隐藏向量、所述拼接向量以及所述解码向量计算指针权重;
    将所述指针权重与所述注意力分布、所述词汇分布进行加权计算,获得目标关键词概率分布,根据目标关键词概率分布确定所述目标关键词集合。
PCT/CN2022/071258 2021-10-12 2022-01-11 关键词自动提取方法、装置、设备及存储介质 WO2023060795A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202111187827.4A CN113869044A (zh) 2021-10-12 2021-10-12 关键词自动提取方法、装置、设备及存储介质
CN202111187827.4 2021-10-12

Publications (1)

Publication Number Publication Date
WO2023060795A1 true WO2023060795A1 (zh) 2023-04-20

Family

ID=78999228

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2022/071258 WO2023060795A1 (zh) 2021-10-12 2022-01-11 关键词自动提取方法、装置、设备及存储介质

Country Status (2)

Country Link
CN (1) CN113869044A (zh)
WO (1) WO2023060795A1 (zh)

Cited By (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116564539A (zh) * 2023-07-10 2023-08-08 神州医疗科技股份有限公司 基于信息抽取和实体归一的医学相似病例推荐方法和系统
CN116756294A (zh) * 2023-08-14 2023-09-15 北京智精灵科技有限公司 对话意图识别模型的构建方法、对话意图识别方法及系统
CN117251559A (zh) * 2023-09-20 2023-12-19 广东筑小宝人工智能科技有限公司 基于自然语言大模型的工程标准规范获取方法及系统
CN117422428A (zh) * 2023-12-19 2024-01-19 尚恰实业有限公司 一种基于人工智能的机器人自动审批方法及系统
CN117520754A (zh) * 2024-01-05 2024-02-06 北京睿企信息科技有限公司 一种模型训练数据的预处理系统

Families Citing this family (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113869044A (zh) * 2021-10-12 2021-12-31 平安科技(深圳)有限公司 关键词自动提取方法、装置、设备及存储介质
CN114492669A (zh) * 2022-02-16 2022-05-13 平安科技(深圳)有限公司 关键词推荐模型训练方法、推荐方法和装置、设备、介质
CN114186066B (zh) * 2022-02-16 2022-10-25 子长科技(北京)有限公司 一种报告生成方法、系统、存储介质及电子设备
CN114817456B (zh) * 2022-03-10 2023-09-05 马上消费金融股份有限公司 关键词检测方法、装置、计算机设备及存储介质
CN114818685B (zh) * 2022-04-21 2023-06-20 平安科技(深圳)有限公司 关键词提取方法、装置、电子设备及存储介质
CN115062596A (zh) * 2022-06-07 2022-09-16 南京信息工程大学 一种气象专报的生成方法、装置、电子设备及存储介质
CN115329751B (zh) * 2022-10-17 2023-01-17 广州数说故事信息科技有限公司 针对网络平台发文的关键词提取方法、装置、介质及设备

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108376131A (zh) * 2018-03-14 2018-08-07 中山大学 基于seq2seq深度神经网络模型的关键词抽取方法
CN110110330A (zh) * 2019-04-30 2019-08-09 腾讯科技(深圳)有限公司 基于文本的关键词提取方法和计算机设备
CN110119765A (zh) * 2019-04-18 2019-08-13 浙江工业大学 一种基于Seq2seq框架的关键词提取方法
US20210027018A1 (en) * 2019-07-22 2021-01-28 Advanced New Technologies Co., Ltd. Generating recommendation information
CN113869044A (zh) * 2021-10-12 2021-12-31 平安科技(深圳)有限公司 关键词自动提取方法、装置、设备及存储介质

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108376131A (zh) * 2018-03-14 2018-08-07 中山大学 基于seq2seq深度神经网络模型的关键词抽取方法
CN110119765A (zh) * 2019-04-18 2019-08-13 浙江工业大学 一种基于Seq2seq框架的关键词提取方法
CN110110330A (zh) * 2019-04-30 2019-08-09 腾讯科技(深圳)有限公司 基于文本的关键词提取方法和计算机设备
US20210027018A1 (en) * 2019-07-22 2021-01-28 Advanced New Technologies Co., Ltd. Generating recommendation information
CN113869044A (zh) * 2021-10-12 2021-12-31 平安科技(深圳)有限公司 关键词自动提取方法、装置、设备及存储介质

Cited By (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116564539A (zh) * 2023-07-10 2023-08-08 神州医疗科技股份有限公司 基于信息抽取和实体归一的医学相似病例推荐方法和系统
CN116564539B (zh) * 2023-07-10 2023-10-24 神州医疗科技股份有限公司 基于信息抽取和实体归一的医学相似病例推荐方法和系统
CN116756294A (zh) * 2023-08-14 2023-09-15 北京智精灵科技有限公司 对话意图识别模型的构建方法、对话意图识别方法及系统
CN116756294B (zh) * 2023-08-14 2023-12-26 北京智精灵科技有限公司 对话意图识别模型的构建方法、对话意图识别方法及系统
CN117251559A (zh) * 2023-09-20 2023-12-19 广东筑小宝人工智能科技有限公司 基于自然语言大模型的工程标准规范获取方法及系统
CN117251559B (zh) * 2023-09-20 2024-04-26 广东筑小宝人工智能科技有限公司 基于自然语言大模型的工程标准规范获取方法及系统
CN117422428A (zh) * 2023-12-19 2024-01-19 尚恰实业有限公司 一种基于人工智能的机器人自动审批方法及系统
CN117422428B (zh) * 2023-12-19 2024-03-08 尚恰实业有限公司 一种基于人工智能的机器人自动审批方法及系统
CN117520754A (zh) * 2024-01-05 2024-02-06 北京睿企信息科技有限公司 一种模型训练数据的预处理系统
CN117520754B (zh) * 2024-01-05 2024-04-12 北京睿企信息科技有限公司 一种模型训练数据的预处理系统

Also Published As

Publication number Publication date
CN113869044A (zh) 2021-12-31

Similar Documents

Publication Publication Date Title
WO2023060795A1 (zh) 关键词自动提取方法、装置、设备及存储介质
US11403680B2 (en) Method, apparatus for evaluating review, device and storage medium
CN111753060B (zh) 信息检索方法、装置、设备及计算机可读存储介质
CN108717406B (zh) 文本情绪分析方法、装置及存储介质
CN108829757B (zh) 一种聊天机器人的智能服务方法、服务器及存储介质
CN110580292B (zh) 一种文本标签生成方法、装置和计算机可读存储介质
US8787683B1 (en) Image classification
WO2017118427A1 (zh) 网页训练的方法和装置、搜索意图识别的方法和装置
CN113011533A (zh) 文本分类方法、装置、计算机设备和存储介质
CN111563384B (zh) 面向电商产品的评价对象识别方法、装置及存储介质
CN113569050B (zh) 基于深度学习的政务领域知识图谱自动化构建方法和装置
CN111291177A (zh) 一种信息处理方法、装置和计算机存储介质
WO2023108993A1 (zh) 基于深度聚类算法的产品推荐方法、装置、设备及介质
CN111985228A (zh) 文本关键词提取方法、装置、计算机设备和存储介质
WO2021190662A1 (zh) 医学文献排序方法、装置、电子设备及存储介质
CN111581943A (zh) 一种基于句子关联图的汉越双语多文档新闻观点句识别方法
CN115859980A (zh) 一种半监督式命名实体识别方法、系统及电子设备
CN116628186A (zh) 文本摘要生成方法及系统
CN113204956B (zh) 多模型训练方法、摘要分段方法、文本分段方法及装置
US20220101060A1 (en) Text partitioning method, text classifying method, apparatus, device and storage medium
CN112580330A (zh) 基于中文触发词指导的越南语新闻事件检测方法
Zhang et al. Active learning with semi-automatic annotation for extractive speech summarization
CN115115432B (zh) 基于人工智能的产品信息推荐方法及装置
CN114003750B (zh) 物料上线方法、装置、设备及存储介质
CN113408287B (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: 22879749

Country of ref document: EP

Kind code of ref document: A1