WO2022116435A1 - 标题生成方法、装置、电子设备及存储介质 - Google Patents

标题生成方法、装置、电子设备及存储介质 Download PDF

Info

Publication number
WO2022116435A1
WO2022116435A1 PCT/CN2021/083719 CN2021083719W WO2022116435A1 WO 2022116435 A1 WO2022116435 A1 WO 2022116435A1 CN 2021083719 W CN2021083719 W CN 2021083719W WO 2022116435 A1 WO2022116435 A1 WO 2022116435A1
Authority
WO
WIPO (PCT)
Prior art keywords
corpus
title
original
generation model
vector set
Prior art date
Application number
PCT/CN2021/083719
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 WO2022116435A1 publication Critical patent/WO2022116435A1/zh

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F40/00Handling natural language data
    • G06F40/20Natural language analysis
    • G06F40/258Heading extraction; Automatic titling; Numbering
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F40/00Handling natural language data
    • G06F40/10Text processing
    • G06F40/12Use of codes for handling textual entities
    • G06F40/126Character encoding
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F40/00Handling natural language data
    • G06F40/30Semantic analysis

Definitions

  • the present application relates to the field of intelligent decision-making, and in particular, to a title generation method, apparatus, electronic device, and computer-readable storage medium.
  • Title generation is the automatic generation of corresponding titles from the original content.
  • title generation can be used as a means of information extraction to help dig out hot events in public opinion events.
  • eye-catching headlines are automatically generated based on news, making users more Tendency to click to read news, improve overall news exposure and clicks.
  • a title generation method provided by this application includes:
  • the present application also provides a title generating device, the device comprising:
  • a preprocessing module used to obtain an original corpus, and perform a preprocessing operation on the original corpus to obtain a standard corpus
  • an identification module used to identify the standard corpus with a separator to generate a target corpus
  • a model training module is used to perform vector coding on the target corpus set by using a pre-built title generation model to obtain a corpus vector set, and use the encoder in the title generation model to perform semantic coding on the corpus vector set to obtain semantic vector set;
  • the model training module is further configured to use the decoder in the title generation model to decode the title sequence of the semantic vector set to obtain a decoded title, and calculate the loss value of the decoded title and the corresponding label of the original corpus set , adjust the parameters of the title generation model according to the loss value, until the loss value is less than a preset threshold, obtain the title generation model that has been trained;
  • the generating module is used for generating the title based on the title style input by the user, using the title generation model completed by the training to generate the title from the corpus for which the title is to be generated, and obtaining the generating result.
  • the present application also provides an electronic device, the electronic device comprising:
  • the memory stores a computer program executable by the at least one processor, the computer program being executed by the at least one processor to implement the following steps:
  • the present application also provides a computer-readable storage medium, where at least one computer program is stored in the computer-readable storage medium, and the at least one computer program is executed by a processor in an electronic device to implement the following steps:
  • FIG. 1 is a schematic flowchart of a title generation method provided by an embodiment of the present application.
  • Fig. 2 is a detailed flow chart of one of the steps of the title generation method provided by Fig. 1 in the first embodiment of the present application;
  • FIG. 3 is a schematic block diagram of a title generating apparatus provided by an embodiment of the present application.
  • FIG. 4 is a schematic diagram of the internal structure of an electronic device implementing a method for generating a title provided by an embodiment of the present application;
  • the embodiment of the present application provides a method for generating a title.
  • the execution subject of the title generation method includes, but is not limited to, at least one of electronic devices that can be configured to execute the method provided by the embodiments of the present application, such as a server and a terminal.
  • the title generating method may be executed by software or hardware installed in a terminal device or a server device, and the software may be a blockchain platform.
  • the server includes but is not limited to: a single server, a server cluster, a cloud server or a cloud server cluster, and the like.
  • the title generating method includes:
  • the original corpus refers to news data, including original news content and original news titles.
  • a crawler tool is used to crawl the original corpus from a web page.
  • the crawler tool is constructed based on node.js technology.
  • the obtaining the original corpus through the crawler tool includes: using node.js to crawl the Uniform Resource Locator (URL) address of the original corpus to be obtained, and retrieving the original corpus to be obtained. Character identification is performed, according to the URL address, the system interface corresponding to the original corpus to be obtained is loaded, and the corresponding original corpus is obtained from the system interface according to the character identification.
  • URL Uniform Resource Locator
  • the embodiment of the present application performs a preprocessing operation on the original corpus to improve the processing efficiency of subsequent data.
  • performing a preprocessing operation on the original corpus to obtain a standard corpus includes: performing data cleaning on the original corpus to obtain an initial corpus, and performing title sentence on the original titles in the initial corpus formula recognition and character calculation to obtain the title category, perform keyword extraction on the initial corpus to obtain a corpus keyword set, and filter out the keywords that overlap with the original title in the initial corpus from the corpus keyword set , obtain the target keyword, and combine the initial corpus, title category and target keyword to obtain a standard corpus.
  • performing data cleaning on the original corpus includes: filtering garbled symbols and special symbols on webpages in the original corpus, and filtering the filtered original corpus according to punctuation (. nowadays;;!?).
  • Sentence processing is performed on the set to obtain a sentence corpus, and single sentences exceeding the first preset number of characters and original titles less than the second preset number of characters and more than the third preset number of characters are removed from the sentence corpus, Get the standard corpus.
  • the first preset data quantity is 500
  • the second preset quantity is 4
  • the third preset quantity is 60.
  • performing title sentence pattern recognition and character calculation on the original titles in the initial corpus, and obtaining the title category includes: using sentence patterns to identify the title sentence patterns (such as declarative sentences, judgment sentences and interrogative sentences) of the original title,
  • the title length (short title, medium title and long title) of the original title is identified by the number of characters, and the title sentence pattern and title length are summarized to obtain the title category of the original title.
  • the title length of less than 12 characters corresponds to the original title and is marked as a short title
  • the title length between 12-26 characters corresponds to the original title as a medium title
  • the title length of more than 26 characters corresponds to the original title for long titles.
  • the keyword extraction of the initial corpus is implemented by a keyword extraction algorithm, and the keyword extraction algorithm may be a TF-IDF algorithm or a TextRank algorithm.
  • the present application can identify the text content, keywords, original title content and original title category of the original corpus in the corpus, so as to better identify subsequent titles
  • the training of the generative model improves the robustness of subsequent model training, thereby improving the semantic fluency of title generation and the title style that meets user needs.
  • the position information of the standard corpus in the standard corpus is determined by identifying the corpus separator on the standard corpus, so as to better perform model training.
  • the step of marking the standard corpus with a separator to generate a target corpus includes: acquiring the sentence beginning, sentence end, text content, target keyword, original title category and original title of the standard corpus in the standard corpus. For the title content, add a sentence start label before the sentence start, add a sentence end label after the sentence end, and add a separator label between the text content, target keyword, original title category, and original title content. After adding and splicing the marked sentence start, sentence end, text content, target keyword, original title category and original title content, a target corpus is obtained, and a target corpus set is generated according to the target corpus.
  • the following method is used to identify the segmentation character of the standard corpus:
  • inputk represents the target corpus
  • [CLS] represents the sentence start label
  • [SEP] represents the separator label
  • [EOS] represents the sentence end label
  • content text content kw represents the target keyword
  • js represents the sentence in the original title category.
  • formula, jc represents the sentence length in the original title category
  • title represents the original title content.
  • the target corpus can also be stored in a blockchain node.
  • the pre-built title generation model includes: a UniLM model, which is used to generate a semantic text title with high fluency based on title styles input by different users. Further, the embodiment of the present application performs vector coding on the target corpus, so as to identify the text position information of the target corpus in the target corpus and distinguish the segmentation information between the texts, which is used for the encoder identification of the subsequent title generation model. .
  • the use of the pre-built title generation model to perform vector coding on the target corpus to obtain a corpus vector set including:
  • the character encoding algorithm may be the Token Embedding algorithm
  • the position encoding algorithm may be the Position Embedding algorithm
  • the paragraph encoding algorithm may be the Token Embedding algorithm.
  • the encoder in the title generation model is used to semantically encode the corpus vector set, so as to better learn the contextual semantic information between the text contents in the target corpus set.
  • semantically encode the corpus vector set to obtain a semantic vector set including:
  • the forward semantic coding is to perform forward coding on the corpus vector in the order from front to back
  • the backward semantic coding is to perform backward coding on the corpus vector in the order from back to front
  • the generated semantic vector set can represent the degree of association between different corpus vectors, so that the accuracy of subsequent title generation can be improved.
  • the decoder in the title generation model is used to decode the title sequence of the semantic vector set to obtain the decoded sequence title.
  • the following method is used to decode the title sequence of the semantic vector set:
  • f t represents the decoded header, represents the bias of the cell unit in the decoder
  • w f represents the activation factor of the genetic decoder
  • x t represents the semantic vector of the semantic vector set input at time t
  • b f represents the weight of the cell unit in the decoder
  • the embodiment of the present application uses the loss function of the title generation model to calculate the loss value of the decoded title and the corresponding label of the original corpus, and adjusts the parameters of the title generation model according to the loss value until the When the loss value is less than the preset threshold, the trained title generation model is obtained.
  • the label refers to the original title of the original corpus
  • the preset threshold is 0.1.
  • the loss function includes:
  • loss represents the loss value
  • y t represents the t-th character of the decoded title
  • t represents the number of original title characters of the original corpus
  • h L represents the L-th semantic vector in the semantic vector set.
  • the title generation model after the training is used to generate the title from the corpus of the title to be generated, and the generation result is obtained.
  • the title style refers to the sentence pattern and sentence length required by the user to generate the title.
  • the original corpus is first subjected to preprocessing operations and segmenter identification to generate a target corpus.
  • the original corpus can be used for joint model training of titles, keyword information and text content with different sentence patterns and sentence lengths to ensure that Users can generate different styles of titles they want based on different forms of control information;
  • the embodiment of the present application uses a pre-built title generation model to perform vector encoding, semantic encoding and title sequence decoding on the target corpus to obtain the decoded title.
  • the generation model can well learn the contextual semantic information between the text contents in the target corpus, and improve the semantic fluency of subsequent title generation; further, the embodiment of the present application is based on the title style input by the user, using the training to complete
  • the title generation model of the title generation model performs title generation on the corpus to be generated, and obtains the generation result. Therefore, the present application can generate titles that fluently conform to semantics and satisfy the user's style.
  • FIG. 3 it is a functional block diagram of the title generating apparatus of the present application.
  • the title generating apparatus 100 described in this application may be installed in an electronic device. According to the implemented functions, the title generating apparatus may include a preprocessing module 101 , an identification module 102 , a model training module 103 and a generation module 104 .
  • the modules described in the present invention can also be called units, which refer to a series of computer program segments that can be executed by the electronic device processor and can perform fixed functions, and are stored in the memory of the electronic device.
  • each module/unit is as follows:
  • the preprocessing module 101 is used to obtain an original corpus, and perform a preprocessing operation on the original corpus to obtain a standard corpus;
  • the identification module 102 is used to identify the standard corpus with a segmentation character to generate a target corpus
  • the model training module 103 is used to perform vector encoding on the target corpus set by using a pre-built title generation model to obtain a corpus vector set, and use the encoder in the title generation model to perform semantic processing on the corpus vector set. Encoding to get the semantic vector set;
  • the model training module 103 is further configured to use the decoder in the title generation model to decode the title sequence of the semantic vector set to obtain the decoded title, and calculate the loss of the corresponding label of the decoded title and the original corpus set. value, adjust the parameters of the title generation model according to the loss value, until the loss value is less than the preset threshold, obtain the title generation model that has been trained;
  • the generating module 104 is configured to generate the title based on the title style input by the user, using the trained title generation model to generate the title from the corpus of the title to be generated, and obtain the generation result.
  • each module in the title generating apparatus 100 in the embodiment of the present application adopts the same technical means as the title generating method described in the above-mentioned FIG. 1 and FIG. 2 when in use, and can generate the same technology The effect will not be repeated here.
  • FIG. 4 it is a schematic structural diagram of an electronic device implementing the title generation method of the present application.
  • the electronic device 1 may include a processor 10, a memory 11 and a bus, and may also include a computer program, such as a title generation program 12, stored in the memory 11 and executable on the processor 10.
  • a computer program such as a title generation program 12 stored in the memory 11 and executable on the processor 10.
  • the memory 11 includes at least one type of readable storage medium, and the readable storage medium includes flash memory, mobile hard disk, multimedia card, card-type memory (for example: SD or DX memory, etc.), magnetic memory, magnetic disk, CD etc.
  • the memory 11 may be an internal storage unit of the electronic device 1 in some embodiments, such as a mobile hard disk of the electronic device 1 .
  • the memory 11 may also be an external storage device of the electronic device 1, such as a pluggable mobile hard disk, a smart memory card (Smart Media Card, SMC), a secure digital (Secure Digital) equipped on the electronic device 1. , SD) card, flash memory card (Flash Card), etc.
  • the memory 11 may also include both an internal storage unit of the electronic device 1 and an external storage device.
  • the memory 11 can not only be used to store application software installed in the electronic device 1 and various types of data, such as the code of the title generating program, etc., but also can be used to temporarily store data that has been output or will be output.
  • the processor 10 may be composed of integrated circuits, for example, may be composed of a single packaged integrated circuit, or may be composed of multiple integrated circuits packaged with the same function or different functions, including one or more integrated circuits.
  • Central Processing Unit CPU
  • microprocessor digital processing chip
  • graphics processor and combination of various control chips, etc.
  • the processor 10 is the control core (Control Unit) of the electronic device, and uses various interfaces and lines to connect the various components of the entire electronic device, by running or executing the program or module (for example, executing the program) stored in the memory 11. title generation program, etc.), and call data stored in the memory 11 to execute various functions of the electronic device 1 and process data.
  • the bus may be a peripheral component interconnect (PCI for short) bus or an extended industry standard architecture (Extended industry standard architecture, EISA for short) bus or the like.
  • PCI peripheral component interconnect
  • EISA Extended industry standard architecture
  • the bus can be divided into address bus, data bus, control bus and so on.
  • the bus is configured to implement connection communication between the memory 11 and at least one processor 10 and the like.
  • FIG. 4 only shows an electronic device with components. Those skilled in the art can understand that the structure shown in FIG. 4 does not constitute a limitation on the electronic device 1, and may include fewer or more components than those shown in the drawings. components, or a combination of certain components, or a different arrangement of components.
  • the electronic device 1 may also include a power supply (such as a battery) for powering the various components, preferably, the power supply may be logically connected to the at least one processor 10 through a power management device, so that the power management
  • the device implements functions such as charge management, discharge management, and power consumption management.
  • the power source may also include one or more DC or AC power sources, recharging devices, power failure detection circuits, power converters or inverters, power status indicators, and any other components.
  • the electronic device 1 may further include various sensors, Bluetooth modules, Wi-Fi modules, etc., which will not be repeated here.
  • the electronic device 1 may also include a network interface, optionally, the network interface may include a wired interface and/or a wireless interface (such as a WI-FI interface, a Bluetooth interface, etc.), which is usually used in the electronic device 1 Establish a communication connection with other electronic devices.
  • a network interface optionally, the network interface may include a wired interface and/or a wireless interface (such as a WI-FI interface, a Bluetooth interface, etc.), which is usually used in the electronic device 1 Establish a communication connection with other electronic devices.
  • the electronic device 1 may further include a user interface, and the user interface may be a display (Display), an input unit (eg, a keyboard (Keyboard)), optionally, the user interface may also be a standard wired interface or a wireless interface.
  • the display may be an LED display, a liquid crystal display, a touch-sensitive liquid crystal display, an OLED (Organic Light-Emitting Diode, organic light-emitting diode) touch device, and the like.
  • the display may also be appropriately called a display screen or a display unit, which is used for displaying information processed in the electronic device 1 and for displaying a visualized user interface.
  • the title generation program 12 stored in the memory 11 in the electronic device 1 is a combination of multiple programs, and when running in the processor 10, it can realize:
  • the modules/units integrated in the electronic device 1 may be stored in a non-volatile computer-readable storage medium.
  • the computer-readable storage medium may be volatile or non-volatile.
  • the computer-readable medium may include: any entity or device capable of carrying the computer program code, a recording medium, a USB flash drive, a removable hard disk, a magnetic disk, an optical disc, a computer memory, a read-only memory (ROM, Read-Only). Memory).
  • the present application also provides a computer-readable storage medium, where the readable storage medium stores a computer program, and when executed by a processor of an electronic device, the computer program can realize:
  • modules described as separate components may or may not be physically separated, and the components shown as modules may or may not be physical units, that is, may be located in one place, or may be distributed to multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution in this embodiment.
  • each functional module in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically alone, or two or more units may be integrated into one unit.
  • the above-mentioned integrated units can be implemented in the form of hardware, or can be implemented in the form of hardware plus software function modules.
  • the blockchain referred to in this application is a new application mode of computer technologies such as distributed data storage, point-to-point transmission, consensus mechanism, and encryption algorithm.
  • Blockchain essentially a decentralized database, is a series of data blocks associated with cryptographic methods. Each data block contains a batch of network transaction information to verify its Validity of information (anti-counterfeiting) and generation of the next block.
  • the blockchain can include the underlying platform of the blockchain, the platform product service layer, and the application service layer.

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Health & Medical Sciences (AREA)
  • Artificial Intelligence (AREA)
  • Audiology, Speech & Language Pathology (AREA)
  • Computational Linguistics (AREA)
  • General Health & Medical Sciences (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Machine Translation (AREA)

Abstract

本申请涉及一种智能决策领域,揭露了一种标题生成方法,包括:获取原始语料集,对所述原始语料集进行预处理操作及分割符标识,生成目标语料集;利用预构建的标题生成模型对所述目标语料集进行向量编码、语义编码及标题序列解码,得到解码标题,计算所述解码标题与所述原始语料集对应标签的损失值,根据所述损失值调整所述标题生成模型的参数,直至所述损失值小于预设的阈值时,得到训练完成的标题生成模型;基于用户输入的标题风格,利用所述训练完成的标题生成模型对待生成标题的语料进行标题生成,得到生成结果。此外,本申请还涉及区块链技术,所述目标语料集可存储于区块链中。本申请可以生成流畅符合语义及满足用户风格的标题。

Description

标题生成方法、装置、电子设备及存储介质
本申请要求于2020年12月1日提交中国专利局、申请号为CN202011385255.6、名称为“标题生成方法、装置、电子设备及存储介质”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。
技术领域
本申请涉及智能决策领域,尤其涉及一种标题生成方法、装置、电子设备及计算机可读存储介质。
背景技术
标题生成是从原始内容中自动生成对应的标题。在金融舆情事件中,标题生成可以作为信息抽取的一种手段方式,帮助挖掘舆情事件中的热点事件,同样,在财经领域新闻等媒体网站中,根据新闻自动生成吸引眼球的标题,使得用户更加倾向点击阅读新闻,提升整体新闻的曝光和点击。
发明人意识到,关于标题生成的方法存在以下两种问题:第一、主要基于抽取方式去做,即从文章中抽取重要的词语作为文章的主题,再将这些词按照一定的语法规则组成标题,无法生成流畅的符合语义的标题;第二、生成的标题不能很好的结合用户的风格来生成符合用户个性化需求的标题。
发明内容
本申请提供的一种标题生成方法,包括:
获取原始语料集,对所述原始语料集进行预处理操作,得到标准语料集;
对所述标准语料集进行分割符标识,生成目标语料集;
利用预构建的标题生成模型对所述目标语料集进行向量编码,得到语料向量集,并利用所述标题生成模型中的编码器对所述语料向量集进行语义编码,得到语义向量集;
利用所述标题生成模型中的解码器对所述语义向量集进行标题序列解码,得到解码标题,计算所述解码标题与所述原始语料集对应标签的损失值,根据所述损失值调整所述标题生成模型的参数,直至所述损失值小于预设的阈值时,得到训练完成的标题生成模型;
基于用户输入的标题风格,利用所述训练完成的标题生成模型对待生成标题的语料进行标题生成,得到生成结果。
本申请还提供一种标题生成装置,所述装置包括:
预处理模块,用于获取原始语料集,对所述原始语料集进行预处理操作,得到标准语料集;
标识模块,用于对所述标准语料集进行分割符标识,生成目标语料集;
模型训练模块,用于利用预构建的标题生成模型对所述目标语料集进行向量编码,得到语料向量集,并利用所述标题生成模型中的编码器对所述语料向量集进行语义编码,得到语义向量集;
所述模型训练模块,还用于利用所述标题生成模型中的解码器对所述语义向量集进行标题序列解码,得到解码标题,计算所述解码标题与所述原始语料集对应标签的损失值,根据所述损失值调整所述标题生成模型的参数,直至所述损失值小于预设的阈值时,得到训练完成的标题生成模型;
生成模块,用于基于用户输入的标题风格,利用所述训练完成的标题生成模型对待生成标题的语料进行标题生成,得到生成结果。
本申请还提供一种电子设备,所述电子设备包括:
至少一个处理器;以及,
与所述至少一个处理器通信连接的存储器;其中,
所述存储器存储有可被所述至少一个处理器执行的计算机程序,所述计算机程序被所述至少一个处理器执行,以实现如下步骤:
获取原始语料集,对所述原始语料集进行预处理操作,得到标准语料集;
对所述标准语料集进行分割符标识,生成目标语料集;
利用预构建的标题生成模型对所述目标语料集进行向量编码,得到语料向量集,并利用所述标题生成模型中的编码器对所述语料向量集进行语义编码,得到语义向量集;
利用所述标题生成模型中的解码器对所述语义向量集进行标题序列解码,得到解码标题,计算所述解码标题与所述原始语料集对应标签的损失值,根据所述损失值调整所述标题生成模型的参数,直至所述损失值小于预设的阈值时,得到训练完成的标题生成模型;
基于用户输入的标题风格,利用所述训练完成的标题生成模型对待生成标题的语料进行标题生成,得到生成结果。
本申请还提供一种计算机可读存储介质,所述计算机可读存储介质中存储有至少一个计算机程序,所述至少一个计算机程序被电子设备中的处理器执行以实现如下步骤:
获取原始语料集,对所述原始语料集进行预处理操作,得到标准语料集;
对所述标准语料集进行分割符标识,生成目标语料集;
利用预构建的标题生成模型对所述目标语料集进行向量编码,得到语料向量集,并利用所述标题生成模型中的编码器对所述语料向量集进行语义编码,得到语义向量集;
利用所述标题生成模型中的解码器对所述语义向量集进行标题序列解码,得到解码标题,计算所述解码标题与所述原始语料集对应标签的损失值,根据所述损失值调整所述标题生成模型的参数,直至所述损失值小于预设的阈值时,得到训练完成的标题生成模型;
基于用户输入的标题风格,利用所述训练完成的标题生成模型对待生成标题的语料进行标题生成,得到生成结果。
附图说明
图1为本申请一实施例提供的标题生成方法的流程示意图;
图2为本申请第一实施例中图1提供的标题生成方法其中一个步骤的详细流程示意图;
图3为本申请一实施例提供的标题生成装置的模块示意图;
图4为本申请一实施例提供的实现标题生成方法的电子设备的内部结构示意图;
本申请目的的实现、功能特点及优点将结合实施例,参照附图做进一步说明。
具体实施方式
应当理解,此处所描述的具体实施例仅仅用以解释本申请,并不用于限定本申请。
本申请实施例提供一种标题生成方法。所述标题生成方法的执行主体包括但不限于服务端、终端等能够被配置为执行本申请实施例提供的该方法的电子设备中的至少一种。换言之,所述标题生成方法可以由安装在终端设备或服务端设备的软件或硬件来执行,所述软件可以是区块链平台。所述服务端包括但不限于:单台服务器、服务器集群、云端服务器或云端服务器集群等。
参照图1所示,为本申请一实施例提供的标题生成方法的流程示意图。在本申请实施例中,所述标题生成方法包括:
S1、获取原始语料集,对所述原始语料集进行预处理操作,得到标准语料集。
本申请实施例中,所述原始语料集指的是新闻数据,包括原始新闻内容和原始新闻标题。进一步地,本申请实施例通过爬虫工具从网页中爬取所述原始语料集,可选的,所述爬虫工具基于node.js技术构建。
详细地,所述通过爬虫工具获取所述原始语料集包括:利用node.js爬取待获取原始语料集的统一资源定位符(Uniform Resource Locator,URL)地址,并对所述待获取原始 语料集进行字符标识,根据所述URL地址,加载所述待获取原始语料集对应的系统界面,根据所述字符标识,从所述系统界面中获取对应的原始语料集。
应该了解,爬取的所述原始语料集中包含着大量的无用的数据,因此,本申请实施例通过对所述原始语料集进行预处理操作,以提高后续数据的处理效率。
具体的,所述对所述原始语料集进行预处理操作,得到标准语料集,包括:对所述原始语料集进行数据清洗,得到初始语料集,对所述初始语料集中的原始标题进行标题句式识别及字符计算,得到标题类别,对所述初始语料集进行关键词提取,得到语料关键词集,并从所述语料关键词集中筛选出与所述初始语料集中原始标题具有重叠的关键词,得到目标关键词,将所述初始语料集、标题类别以及目标关键词进行组合,得到标准语料集。
其中,所述对所述原始语料集进行数据清洗包括:过滤所述原始语料集中的乱码符号、网页特殊符号,并根据标点符号(。?!;;!?)对过滤后的所述原始语料集进行分句处理,得到分句语料集,从所述分句语料集中剔除超过第一预设数量字符的单句及少于第二预设数量字符和超过第三预设数量字符的原始标题,得到标准语料集。可选的,所述第一预设数据数量为500、第二预设数量为4以及第三预设数量为60。
进一步地,所述对所述初始语料集中的原始标题进行标题句式识别及字符计算,得到标题类别包括:利用句式识别所述原始标题的标题句式(如陈述句、判断句及疑问句),通过字符数量识别所述原始标题的标题长度(短标题、中标题及长标题),对所述标题句式和标题长度进行汇总,得到所述原始标题的标题类别。其中,本申请实施例将少于12个字符的标题长度对应原始标题标记为短标题、介于12-26个字符的标题长度对应原始标题为中标题及超过26个字符的标题长度对应原始标题为长标题。
进一步地,本申请实施例中,所述初始语料集的关键词提取通过关键词提取算法实现,所述关键词提取算法可以为TF-IDF算法或TextRank算法。
基于上述的实施手段,本申请通过对所述原始语料集进行预处理,可以识别出所述语料集中原始语料的文本内容、关键词、原始标题内容以及原始标题类别,以更好地对后续标题生成模型的训练,提高后续模型训练的鲁棒性,从而可以提高标题生成的语义流畅度以及符合用户需求的标题风格。
S2、对所述标准语料集进行分割符标识,生成目标语料集。
本申请实施例通过对所述标准语料集进行语料分割符标识,以确定所述标准语料集中标准语料的位置信息,以更好的进行模型训练。
详细地,所述对所述标准语料集进行分割符标识,生成目标语料集,包括:获取所述标准语料集中标准语料的句首、句末、文本内容、目标关键词、原始标题类别以及原始标题内容,在所述句首之前添加句首标注,在所述句末之后添加句末标注,在所述文本内容、目标关键词、原始标题类别以及原始标题内容之间添加分割符标注,将添加标注后的所述句首、句末、文本内容、目标关键词、原始标题类别以及原始标题内容进行拼接,得到目标语料,根据所述目标语料,生成目标语料集。
一个可选实施例中,利用下述方法对所述标准语料集进行分割符标识:
inputk=[CLS]content[SEP]kw[SEP]js[SEP]jc[SEP]title[EOS]
其中,inputk表示目标语料集,[CLS]表示句首标注,[SEP]表示分割符标注,[EOS]表示句末标注,content文本内容,kw表示目标关键词,js表示原始标题类别中的句式,jc表示原始标题类别中的句长,title表示原始标题内容。
进一步地,为保障上述目标语料集的复用性,所述目标语料集还可存储于一区块链节点中。
S3、利用预构建的标题生成模型对所述目标语料集进行向量编码,得到语料向量集,并利用所述标题生成模型中的编码器对所述语料向量集进行语义编码,得到语义向量集,对所述语义向量集中所有的语义向量进行聚合,得到聚合语义向量。
本申请实施例中,所述预构建的标题生成模型包括:UniLM模型,用于基于不同用户输入的标题风格,生成流畅度高的语义文本标题。进一步地,本申请实施例对所述目标语料集进行向量编码,以辨别所述目标语料集中目标语料的文本位置信息及区分出文本之间的分割信息,用于后续标题生成模型的编码器识别。
具体的,参阅图2所示:所述利用预构建的标题生成模型对所述目标语料集进行向量编码,得到语料向量集,包括:
S20、利用所述标题生成模型中的字符编码算法对所述目标语料集进行字符编码;
S21、利用所述标题生成模型中的位置编码算法对字符编码后的所述目标语料集进行位置编码;
S22、利用所述标题生成模型中的段落编码算法对位置编码后的所述目标语料集进行段落编码,得到语料向量集。
本申请的其中一个可选实施例中,所述字符编码算法可以为Token Embedding算法,所述位置编码算法可以为Position Embedding算法,所述段落编码算法可以为Token Embedding算法。
进一步地,本申请实施例利用所述标题生成模型中的编码器对所述语料向量集进行语义编码,以更好的学习所述目标语料集中文本内容之间的上下文语义信息。
详细地,所述利用所述标题生成模型中的编码器对所述语料向量集进行语义编码,得到语义向量集,包括:
利用所述编码器的前向编码器bi-LSTM对所述语料向量集中的每一个语料向量进行前向语义编码,得到前向语义向量,利用所述编码器的后向编码器bi-LSTM对所述语料向量集中的每一个语料向量进行后向语义编码,得到后向语义向量,将所述前向语义向量与所述后向语义向量进行拼接,得到语义向量,根据所述语义向量生成所述语义向量集。
其中,所述前向语义编码是按照从前到后的顺序对所述语料向量进行前向编码,所述后向语义编码是按照从后到前的顺序对所述语料向量进行后向编码。
基于上述的实施方案,通过生成的语义向量集可以表征出不同语料向量之间的关联度,从而可以提高后续标题生成的准确性。
S4、利用所述标题生成模型中的解码器对所述语义向量集进行标题解码,得到解码标题,计算所述解码标题与所述原始语料集对应标签的损失值,根据所述损失值调整所述标题生成模型的参数,直至所述损失值小于预设的阈值时,得到训练完成的标题生成模型。
本申请实施例中,利用所述标题生成模型中的解码器对所述语义向量集进行标题序列解码,得到解码序列标题。
本申请的其中一个可选实施例中,利用下述方法对所述语义向量集进行标题序列解码:
Figure PCTCN2021083719-appb-000001
其中,f t表示解码标题,
Figure PCTCN2021083719-appb-000002
表示所述解码器中细胞单元的偏置,w f表示所述遗解码器的激活因子,
Figure PCTCN2021083719-appb-000003
表示语义向量集的语义向量在所述解码器t-1时刻的峰值,x t表示在t时刻输入的语义向量集的语义向量,b f表示解码器中细胞单元的权重。
进一步地,本申请实施例利用所述标题生成模型的损失函数计算所述解码标题与所述原始语料集对应标签的损失值,根据所述损失值调整所述标题生成模型的参数,直至所述损失值小于预设的阈值时,得到训练完成的标题生成模型。其中,所述标签指的是所述原始语料集的原始标题,所述预设的阈值为0.1。
一个可选实施例中,所述损失函数包括:
Figure PCTCN2021083719-appb-000004
其中,loss表示损失值,y t表示解码标题的第t个字符,,
Figure PCTCN2021083719-appb-000005
表示原始语料集的原始标题的第t个字符,t表示原始语料集的原始标题字符数量,h L表示语义向量集中第L个语义 向量。
S5、基于用户输入的标题风格,利用所述训练完成的标题生成模型对待生成标题的语料进行标题生成,得到生成结果。
本申请实施例中,根据用户输入的标题风格,利用所述训练完成的标题生成模型对待生成标题的语料进行标题生成,得到生成结果。其中,所述标题风格指的是用户所需生成标题的句式和句长。
本申请实施例首先对原始语料集进行预处理操作及分割符标识,生成目标语料集,可以将原始语料集中不同句式、句长的标题、关键词信息以及文本内容联合进行模型训练,以保证用户可以基于不同形式的控制信息来生成自己想要的不同风格标题;其次,本申请实施例利用预构建的标题生成模型对所述目标语料集进行向量编码、语义编码及标题序列解码,得到解码标题,计算所述解码标题与所述原始语料集对应标签的损失值,根据所述损失值调整所述标题生成模型的参数,直至所述损失值小于预设的阈值时,得到训练完成的标题生成模型,可以很好的学习所述目标语料集中文本内容之间的上下文语义信息,提高后续标题生成的语义流畅度;进一步地,本申请实施例基于用户输入的标题风格,利用所述训练完成的标题生成模型对待生成标题的语料进行标题生成,得到生成结果。因此,本申请可以生成流畅符合语义及满足用户风格的标题。
如图3所示,是本申请标题生成装置的功能模块图。
本申请所述标题生成装置100可以安装于电子设备中。根据实现的功能,所述标题生成装置可以包括预处理模块101、标识模块102、模型训练模块103以及生成模块104。本发所述模块也可以称之为单元,是指一种能够被电子设备处理器所执行,并且能够完成固定功能的一系列计算机程序段,其存储在电子设备的存储器中。
在本实施例中,关于各模块/单元的功能如下:
所述预处理模块101,用于获取原始语料集,对所述原始语料集进行预处理操作,得到标准语料集;
所述标识模块102,用于对所述标准语料集进行分割符标识,生成目标语料集;
所述模型训练模块103,用于利用预构建的标题生成模型对所述目标语料集进行向量编码,得到语料向量集,并利用所述标题生成模型中的编码器对所述语料向量集进行语义编码,得到语义向量集;
所述模型训练模块103,还用于利用所述标题生成模型中的解码器对所述语义向量集进行标题序列解码,得到解码标题,计算所述解码标题与所述原始语料集对应标签的损失值,根据所述损失值调整所述标题生成模型的参数,直至所述损失值小于预设的阈值时,得到训练完成的标题生成模型;
所述生成模块104,用于基于用户输入的标题风格,利用所述训练完成的标题生成模型对待生成标题的语料进行标题生成,得到生成结果。
详细地,本申请实施例中所述标题生成装置100中的所述各模块在使用时采用与上述的图1和图2中所述的标题生成方法一样的技术手段,并能够产生相同的技术效果,这里不再赘述。
如图4所示,是本申请实现标题生成方法的电子设备的结构示意图。
所述电子设备1可以包括处理器10、存储器11和总线,还可以包括存储在所述存储器11中并可在所述处理器10上运行的计算机程序,如标题生成程序12。
其中,所述存储器11至少包括一种类型的可读存储介质,所述可读存储介质包括闪存、移动硬盘、多媒体卡、卡型存储器(例如:SD或DX存储器等)、磁性存储器、磁盘、光盘等。所述存储器11在一些实施例中可以是电子设备1的内部存储单元,例如该电子设备1的移动硬盘。所述存储器11在另一些实施例中也可以是电子设备1的外部存储设备,例如电子设备1上配备的插接式移动硬盘、智能存储卡(Smart Media Card,SMC)、安全 数字(Secure Digital,SD)卡、闪存卡(Flash Card)等。进一步地,所述存储器11还可以既包括电子设备1的内部存储单元也包括外部存储设备。所述存储器11不仅可以用于存储安装于电子设备1的应用软件及各类数据,例如标题生成程序的代码等,还可以用于暂时地存储已经输出或者将要输出的数据。
所述处理器10在一些实施例中可以由集成电路组成,例如可以由单个封装的集成电路所组成,也可以是由多个相同功能或不同功能封装的集成电路所组成,包括一个或者多个中央处理器(Central Processing unit,CPU)、微处理器、数字处理芯片、图形处理器及各种控制芯片的组合等。所述处理器10是所述电子设备的控制核心(Control Unit),利用各种接口和线路连接整个电子设备的各个部件,通过运行或执行存储在所述存储器11内的程序或者模块(例如执行标题生成程序等),以及调用存储在所述存储器11内的数据,以执行电子设备1的各种功能和处理数据。
所述总线可以是外设部件互连标准(peripheral component interconnect,简称PCI)总线或扩展工业标准结构(extended industry standard architecture,简称EISA)总线等。该总线可以分为地址总线、数据总线、控制总线等。所述总线被设置为实现所述存储器11以及至少一个处理器10等之间的连接通信。
图4仅示出了具有部件的电子设备,本领域技术人员可以理解的是,图4示出的结构并不构成对所述电子设备1的限定,可以包括比图示更少或者更多的部件,或者组合某些部件,或者不同的部件布置。
例如,尽管未示出,所述电子设备1还可以包括给各个部件供电的电源(比如电池),优选地,电源可以通过电源管理装置与所述至少一个处理器10逻辑相连,从而通过电源管理装置实现充电管理、放电管理、以及功耗管理等功能。电源还可以包括一个或一个以上的直流或交流电源、再充电装置、电源故障检测电路、电源转换器或者逆变器、电源状态指示器等任意组件。所述电子设备1还可以包括多种传感器、蓝牙模块、Wi-Fi模块等,在此不再赘述。
进一步地,所述电子设备1还可以包括网络接口,可选地,所述网络接口可以包括有线接口和/或无线接口(如WI-FI接口、蓝牙接口等),通常用于在该电子设备1与其他电子设备之间建立通信连接。
可选地,该电子设备1还可以包括用户接口,用户接口可以是显示器(Display)、输入单元(比如键盘(Keyboard)),可选地,用户接口还可以是标准的有线接口、无线接口。可选地,在一些实施例中,显示器可以是LED显示器、液晶显示器、触控式液晶显示器以及OLED(Organic Light-Emitting Diode,有机发光二极管)触摸器等。其中,显示器也可以适当的称为显示屏或显示单元,用于显示在电子设备1中处理的信息以及用于显示可视化的用户界面。
应该了解,所述实施例仅为说明之用,在专利申请范围上并不受此结构的限制。
所述电子设备1中的所述存储器11存储的标题生成程序12是多个程序的组合,在所述处理器10中运行时,可以实现:
获取原始语料集,对所述原始语料集进行预处理操作,得到标准语料集;
对所述标准语料集进行分割符标识,生成目标语料集;
利用预构建的标题生成模型对所述目标语料集进行向量编码,得到语料向量集,并利用所述标题生成模型中的编码器对所述语料向量集进行语义编码,得到语义向量集;
利用所述标题生成模型中的解码器对所述语义向量集进行标题序列解码,得到解码标题,计算所述解码标题与所述原始语料集对应标签的损失值,根据所述损失值调整所述标题生成模型的参数,直至所述损失值小于预设的阈值时,得到训练完成的标题生成模型;
基于用户输入的标题风格,利用所述训练完成的标题生成模型对待生成标题的语料进行标题生成,得到生成结果。
具体地,所述处理器10对上述程序的具体实现方法可参考图1对应实施例中相关步骤的描述,在此不赘述。
进一步地,所述电子设备1集成的模块/单元如果以软件功能单元的形式实现并作为独立的产品销售或使用时,可以存储在一个非易失性计算机可读取存储介质中。所述计算机可读存储介质可以是易失性的,也可以是非易失性的。例如,所述计算机可读介质可以包括:能够携带所述计算机程序代码的任何实体或装置、记录介质、U盘、移动硬盘、磁碟、光盘、计算机存储器、只读存储器(ROM,Read-Only Memory)。
本申请还提供一种计算机可读存储介质,所述可读存储介质存储有计算机程序,所述计算机程序在被电子设备的处理器所执行时,可以实现:
获取原始语料集,对所述原始语料集进行预处理操作,得到标准语料集;
对所述标准语料集进行分割符标识,生成目标语料集;
利用预构建的标题生成模型对所述目标语料集进行向量编码,得到语料向量集,并利用所述标题生成模型中的编码器对所述语料向量集进行语义编码,得到语义向量集;
利用所述标题生成模型中的解码器对所述语义向量集进行标题序列解码,得到解码标题,计算所述解码标题与所述原始语料集对应标签的损失值,根据所述损失值调整所述标题生成模型的参数,直至所述损失值小于预设的阈值时,得到训练完成的标题生成模型;
基于用户输入的标题风格,利用所述训练完成的标题生成模型对待生成标题的语料进行标题生成,得到生成结果。
在本申请所提供的几个实施例中,应该理解到,所揭露的设备,装置和方法,可以通过其它的方式实现。例如,以上所描述的装置实施例仅仅是示意性的,例如,所述模块的划分,仅仅为一种逻辑功能划分,实际实现时可以有另外的划分方式。
所述作为分离部件说明的模块可以是或者也可以不是物理上分开的,作为模块显示的部件可以是或者也可以不是物理单元,即可以位于一个地方,或者也可以分布到多个网络单元上。可以根据实际的需要选择其中的部分或者全部模块来实现本实施例方案的目的。
另外,在本申请各个实施例中的各功能模块可以集成在一个处理单元中,也可以是各个单元单独物理存在,也可以两个或两个以上单元集成在一个单元中。上述集成的单元既可以采用硬件的形式实现,也可以采用硬件加软件功能模块的形式实现。
对于本领域技术人员而言,显然本申请不限于上述示范性实施例的细节,而且在不背离本申请的精神或基本特征的情况下,能够以其他的具体形式实现本申请。
因此,无论从哪一点来看,均应将实施例看作是示范性的,而且是非限制性的,本申请的范围由所附权利要求而不是上述说明限定,因此旨在将落在权利要求的等同要件的含义和范围内的所有变化涵括在本申请内。不应将权利要求中的任何附关联图标记视为限制所涉及的权利要求。
本申请所指区块链是分布式数据存储、点对点传输、共识机制、加密算法等计算机技术的新型应用模式。区块链(Blockchain),本质上是一个去中心化的数据库,是一串使用密码学方法相关联产生的数据块,每一个数据块中包含了一批次网络交易的信息,用于验证其信息的有效性(防伪)和生成下一个区块。区块链可以包括区块链底层平台、平台产品服务层以及应用服务层等。
此外,显然“包括”一词不排除其他单元或步骤,单数不排除复数。系统权利要求中陈述的多个单元或装置也可以由一个单元或装置通过软件或者硬件来实现。第二等词语用来表示名称,而并不表示任何特定的顺序。
最后应说明的是,以上实施例仅用以说明本申请的技术方案而非限制,尽管参照较佳实施例对本申请进行了详细说明,本领域的普通技术人员应当理解,可以对本申请的技术方案进行修改或等同替换,而不脱离本申请技术方案的精神和范围。

Claims (20)

  1. 一种标题生成方法,其中,所述方法包括:
    获取原始语料集,对所述原始语料集进行预处理操作,得到标准语料集;
    对所述标准语料集进行分割符标识,生成目标语料集;
    利用预构建的标题生成模型对所述目标语料集进行向量编码,得到语料向量集,并利用所述标题生成模型中的编码器对所述语料向量集进行语义编码,得到语义向量集;
    利用所述标题生成模型中的解码器对所述语义向量集进行标题序列解码,得到解码标题,计算所述解码标题与所述原始语料集对应标签的损失值,根据所述损失值调整所述标题生成模型的参数,直至所述损失值小于预设的阈值时,得到训练完成的标题生成模型;
    基于用户输入的标题风格,利用所述训练完成的标题生成模型对待生成标题的语料进行标题生成,得到生成结果。
  2. 如权利要求1所述的标题生成方法,其中,所述获取所述原始语料集包括:
    爬取待获取原始语料集的统一资源定位符地址,并对所述待获取原始语料集进行字符标识,根据所述统一资源定位符地址,加载所述待获取原始语料集对应的系统界面,根据所述字符标识,从所述系统界面中获取对应的原始语料集。
  3. 如权利要求1所述的标题生成方法,其中,所述对所述原始语料集进行预处理操作,得到标准语料集,包括:
    对所述原始语料集进行数据清洗,得到初始语料集;
    对所述初始语料集中的原始标题进行标题句式识别及字符计算,得到标题类别;
    对所述初始语料集进行关键词提取,得到语料关键词集,并从所述语料关键词集中筛选出与所述初始语料集中原始标题具有重叠的关键词,得到目标关键词;
    将所述初始语料集、标题类别以及目标关键词进行组合,得到标准语料集。
  4. 如权利要求1所述的标题生成方法,其中,所述对所述标准语料集进行分割符标识,包括:
    利用下述方法对所述标准语料集进行分割符标识:
    inputk=[CLS]content[SEP]kw[SEP]js[SEP]jc[SEP]title[EOS]
    其中,inputk表示目标语料集,[CLS]表示句首标注,[SEP]表示分割符标注,[EOS]表示句末标注,content标准语料集中的文本内容,kw表示标准语料集中的目标关键词,js表示标准语料集中原始标题类别的句式,jc表示标准语料集中原始标题类别的句长,title表示标准语料集中的原始标题内容。
  5. 如权利要求1所述的标题生成方法,其中,所述利用预构建的标题生成模型对所述目标语料集进行向量编码,得到语料向量集,包括:
    利用所述标题生成模型中的字符编码算法对所述目标语料集进行字符编码;
    利用所述标题生成模型中的位置编码算法对字符编码后的所述目标语料集进行位置编码;
    利用所述标题生成模型中的段落编码算法对位置编码后的所述目标语料集进行段落编码,得到语料向量集。
  6. 如权利要求1所述的标题生成方法,其中,所述利用所述标题生成模型中的解码器对所述语义向量集进行标题序列解码,包括:
    利用下述方法对所述语义向量集进行标题序列解码:
    Figure PCTCN2021083719-appb-100001
    其中,f t表示解码标题,
    Figure PCTCN2021083719-appb-100002
    表示所述解码器中细胞单元的偏置,w f表示所述遗解码器的激活因子,
    Figure PCTCN2021083719-appb-100003
    表示语义向量集的语义向量在所述解码器t-1时刻的峰值,x t表示在t时刻输入的语义向量集的语义向量,b f表示解码器中细胞单元的权重。
  7. 如权利要求1至6中任意一项所述的标题生成方法,其中,所述计算所述解码标题与所述原始语料集对应标签的损失值,包括:
    利用下述方法计算所述解码标题与所述原始语料集对应标签的损失值:
    Figure PCTCN2021083719-appb-100004
    其中,loss表示损失值,y t表示解码标题的第t个字符,,
    Figure PCTCN2021083719-appb-100005
    表示原始语料集的原始标题的第t个字符,t表示原始语料集的原始标题字符数量,h L表示语义向量集中第L个语义向量。
  8. 一种标题生成装置,其中,所述装置包括:
    预处理模块,用于获取原始语料集,对所述原始语料集进行预处理操作,得到标准语料集;
    标识模块,用于对所述标准语料集进行分割符标识,生成目标语料集;
    模型训练模块,用于利用预构建的标题生成模型对所述目标语料集进行向量编码,得到语料向量集,并利用所述标题生成模型中的编码器对所述语料向量集进行语义编码,得到语义向量集;
    所述模型训练模块,还用于利用所述标题生成模型中的解码器对所述语义向量集进行标题序列解码,得到解码标题,计算所述解码标题与所述原始语料集对应标签的损失值,根据所述损失值调整所述标题生成模型的参数,直至所述损失值小于预设的阈值时,得到训练完成的标题生成模型;
    生成模块,用于基于用户输入的标题风格,利用所述训练完成的标题生成模型对待生成标题的语料进行标题生成,得到生成结果。
  9. 一种电子设备,其中,所述电子设备包括:
    至少一个处理器;以及,
    与所述至少一个处理器通信连接的存储器;其中,
    所述存储器存储有可被所述至少一个处理器执行的计算机程序,所述计算机程序被所述至少一个处理器执行,以使所述至少一个处理器能够执行如下步骤:
    获取原始语料集,对所述原始语料集进行预处理操作,得到标准语料集;
    对所述标准语料集进行分割符标识,生成目标语料集;
    利用预构建的标题生成模型对所述目标语料集进行向量编码,得到语料向量集,并利用所述标题生成模型中的编码器对所述语料向量集进行语义编码,得到语义向量集;
    利用所述标题生成模型中的解码器对所述语义向量集进行标题序列解码,得到解码标题,计算所述解码标题与所述原始语料集对应标签的损失值,根据所述损失值调整所述标题生成模型的参数,直至所述损失值小于预设的阈值时,得到训练完成的标题生成模型;
    基于用户输入的标题风格,利用所述训练完成的标题生成模型对待生成标题的语料进行标题生成,得到生成结果。
  10. 如权利要求9所述的电子设备,其中,所述获取所述原始语料集包括:
    爬取待获取原始语料集的统一资源定位符地址,并对所述待获取原始语料集进行字符标识,根据所述统一资源定位符地址,加载所述待获取原始语料集对应的系统界面,根据所述字符标识,从所述系统界面中获取对应的原始语料集。
  11. 如权利要求9所述的电子设备,其中,所述对所述原始语料集进行预处理操作,得到标准语料集,包括:
    对所述原始语料集进行数据清洗,得到初始语料集;
    对所述初始语料集中的原始标题进行标题句式识别及字符计算,得到标题类别;
    对所述初始语料集进行关键词提取,得到语料关键词集,并从所述语料关键词集中筛选出与所述初始语料集中原始标题具有重叠的关键词,得到目标关键词;
    将所述初始语料集、标题类别以及目标关键词进行组合,得到标准语料集。
  12. 如权利要求9所述的电子设备,其中,所述对所述标准语料集进行分割符标识,包括:
    利用下述方法对所述标准语料集进行分割符标识:
    inputk=[CLS]content[SEP]kw[SEP]js[SEP]jc[SEP]title[EOS]
    其中,inputk表示目标语料集,[CLS]表示句首标注,[SEP]表示分割符标注,[EOS]表示句末标注,content标准语料集中的文本内容,kw表示标准语料集中的目标关键词,js表示标准语料集中原始标题类别的句式,jc表示标准语料集中原始标题类别的句长,title表示标准语料集中的原始标题内容。
  13. 如权利要求9所述的电子设备,其中,所述利用预构建的标题生成模型对所述目标语料集进行向量编码,得到语料向量集,包括:
    利用所述标题生成模型中的字符编码算法对所述目标语料集进行字符编码;
    利用所述标题生成模型中的位置编码算法对字符编码后的所述目标语料集进行位置编码;
    利用所述标题生成模型中的段落编码算法对位置编码后的所述目标语料集进行段落编码,得到语料向量集。
  14. 如权利要求9所述的电子设备,其中,所述利用所述标题生成模型中的解码器对所述语义向量集进行标题序列解码,包括:
    利用下述方法对所述语义向量集进行标题序列解码:
    Figure PCTCN2021083719-appb-100006
    其中,f t表示解码标题,
    Figure PCTCN2021083719-appb-100007
    表示所述解码器中细胞单元的偏置,w f表示所述遗解码器的激活因子,
    Figure PCTCN2021083719-appb-100008
    表示语义向量集的语义向量在所述解码器t-1时刻的峰值,x t表示在t时刻输入的语义向量集的语义向量,b f表示解码器中细胞单元的权重。
  15. 如权利要求9至14中任意一项所述的电子设备,其中,所述计算所述解码标题与所述原始语料集对应标签的损失值,包括:
    利用下述方法计算所述解码标题与所述原始语料集对应标签的损失值:
    Figure PCTCN2021083719-appb-100009
    其中,loss表示损失值,y t表示解码标题的第t个字符,,
    Figure PCTCN2021083719-appb-100010
    表示原始语料集的原始标题的第t个字符,t表示原始语料集的原始标题字符数量,h L表示语义向量集中第L个语义向量。
  16. 一种计算机可读存储介质,存储有计算机程序,其中,所述计算机程序被处理器执行时实现如下步骤:
    获取原始语料集,对所述原始语料集进行预处理操作,得到标准语料集;
    对所述标准语料集进行分割符标识,生成目标语料集;
    利用预构建的标题生成模型对所述目标语料集进行向量编码,得到语料向量集,并利用所述标题生成模型中的编码器对所述语料向量集进行语义编码,得到语义向量集;
    利用所述标题生成模型中的解码器对所述语义向量集进行标题序列解码,得到解码标题,计算所述解码标题与所述原始语料集对应标签的损失值,根据所述损失值调整所述标题生成模型的参数,直至所述损失值小于预设的阈值时,得到训练完成的标题生成模型;
    基于用户输入的标题风格,利用所述训练完成的标题生成模型对待生成标题的语料进行标题生成,得到生成结果。
  17. 如权利要求16所述的计算机可读存储介质,其中,所述获取所述原始语料集包括:
    爬取待获取原始语料集的统一资源定位符地址,并对所述待获取原始语料集进行字符 标识,根据所述统一资源定位符地址,加载所述待获取原始语料集对应的系统界面,根据所述字符标识,从所述系统界面中获取对应的原始语料集。
  18. 如权利要求16所述的计算机可读存储介质,其中,所述对所述原始语料集进行预处理操作,得到标准语料集,包括:
    对所述原始语料集进行数据清洗,得到初始语料集;
    对所述初始语料集中的原始标题进行标题句式识别及字符计算,得到标题类别;
    对所述初始语料集进行关键词提取,得到语料关键词集,并从所述语料关键词集中筛选出与所述初始语料集中原始标题具有重叠的关键词,得到目标关键词;
    将所述初始语料集、标题类别以及目标关键词进行组合,得到标准语料集。
  19. 如权利要求16所述的计算机可读存储介质,其中,所述对所述标准语料集进行分割符标识,包括:
    利用下述方法对所述标准语料集进行分割符标识:
    inputk=[CLS]content[SEP]kw[SEP]js[SEP]jc[SEP]title[EOS]
    其中,inputk表示目标语料集,[CLS]表示句首标注,[SEP]表示分割符标注,[EOS]表示句末标注,content标准语料集中的文本内容,kw表示标准语料集中的目标关键词,js表示标准语料集中原始标题类别的句式,jc表示标准语料集中原始标题类别的句长,title表示标准语料集中的原始标题内容。
  20. 如权利要求16所述的计算机可读存储介质,其中,所述利用预构建的标题生成模型对所述目标语料集进行向量编码,得到语料向量集,包括:
    利用所述标题生成模型中的字符编码算法对所述目标语料集进行字符编码;
    利用所述标题生成模型中的位置编码算法对字符编码后的所述目标语料集进行位置编码;
    利用所述标题生成模型中的段落编码算法对位置编码后的所述目标语料集进行段落编码,得到语料向量集。
PCT/CN2021/083719 2020-12-01 2021-03-30 标题生成方法、装置、电子设备及存储介质 WO2022116435A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202011385255.6A CN112446207A (zh) 2020-12-01 2020-12-01 标题生成方法、装置、电子设备及存储介质
CN202011385255.6 2020-12-01

Publications (1)

Publication Number Publication Date
WO2022116435A1 true WO2022116435A1 (zh) 2022-06-09

Family

ID=74740220

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2021/083719 WO2022116435A1 (zh) 2020-12-01 2021-03-30 标题生成方法、装置、电子设备及存储介质

Country Status (2)

Country Link
CN (1) CN112446207A (zh)
WO (1) WO2022116435A1 (zh)

Families Citing this family (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112446207A (zh) * 2020-12-01 2021-03-05 平安科技(深圳)有限公司 标题生成方法、装置、电子设备及存储介质
CN113139575B (zh) * 2021-03-18 2022-03-01 杭州电子科技大学 一种基于条件嵌入预训练语言模型的图像标题生成方法
CN113468289A (zh) * 2021-07-23 2021-10-01 京东城市(北京)数字科技有限公司 事件检测模型的训练方法及装置
CN113722425A (zh) * 2021-07-23 2021-11-30 阿里巴巴达摩院(杭州)科技有限公司 数据处理方法、计算机设备及计算机可读存储介质
CN113806540B (zh) * 2021-09-18 2023-08-08 平安银行股份有限公司 文本打标签方法、装置、电子设备及存储介质
CN113919328A (zh) * 2021-09-30 2022-01-11 北京搜狗科技发展有限公司 一种生成文章标题的方法及装置
CN115270778B (zh) * 2022-08-25 2023-10-17 北京达佳互联信息技术有限公司 标题简化方法、装置、设备和存储介质

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20120047175A1 (en) * 2009-04-29 2012-02-23 Google Inc. Short Point-Of-Interest Title Generation
CN106383817A (zh) * 2016-09-29 2017-02-08 北京理工大学 利用分布式语义信息的论文标题生成方法
CN106845390A (zh) * 2017-01-18 2017-06-13 腾讯科技(深圳)有限公司 视频标题生成方法及装置
CN107203509A (zh) * 2017-04-20 2017-09-26 北京拓尔思信息技术股份有限公司 标题生成方法和装置
CN112446207A (zh) * 2020-12-01 2021-03-05 平安科技(深圳)有限公司 标题生成方法、装置、电子设备及存储介质

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20120047175A1 (en) * 2009-04-29 2012-02-23 Google Inc. Short Point-Of-Interest Title Generation
CN106383817A (zh) * 2016-09-29 2017-02-08 北京理工大学 利用分布式语义信息的论文标题生成方法
CN106845390A (zh) * 2017-01-18 2017-06-13 腾讯科技(深圳)有限公司 视频标题生成方法及装置
CN107203509A (zh) * 2017-04-20 2017-09-26 北京拓尔思信息技术股份有限公司 标题生成方法和装置
CN112446207A (zh) * 2020-12-01 2021-03-05 平安科技(深圳)有限公司 标题生成方法、装置、电子设备及存储介质

Also Published As

Publication number Publication date
CN112446207A (zh) 2021-03-05

Similar Documents

Publication Publication Date Title
WO2022116435A1 (zh) 标题生成方法、装置、电子设备及存储介质
US10579736B2 (en) Method and device for determining comment, server and storage medium
WO2022142593A1 (zh) 文本分类方法、装置、电子设备及可读存储介质
WO2022134759A1 (zh) 关键词生成方法、装置、电子设备及计算机存储介质
WO2022141861A1 (zh) 情感分类方法、装置、电子设备及存储介质
WO2019153551A1 (zh) 文章分类方法、装置、计算机设备及存储介质
WO2022121171A1 (zh) 相似文本匹配方法、装置、电子设备及计算机存储介质
Ding et al. Entity discovery and assignment for opinion mining applications
JP5534280B2 (ja) テキストクラスタリング装置、テキストクラスタリング方法、およびプログラム
WO2022222300A1 (zh) 开放关系抽取方法、装置、电子设备及存储介质
US20160188569A1 (en) Generating a Table of Contents for Unformatted Text
WO2022142020A1 (zh) 资讯推送方法、装置、电子设备及计算机可读存储介质
US20120158742A1 (en) Managing documents using weighted prevalence data for statements
WO2023159755A1 (zh) 虚假新闻检测方法、装置、设备及存储介质
CN113449187A (zh) 基于双画像的产品推荐方法、装置、设备及存储介质
CN107924398B (zh) 用于提供以评论为中心的新闻阅读器的系统和方法
CN112989208B (zh) 一种信息推荐方法、装置、电子设备及存储介质
CN113704429A (zh) 基于半监督学习的意图识别方法、装置、设备及介质
CN112559687A (zh) 问题识别及查询方法、装置、电子设备及存储介质
CN106663123B (zh) 以评论为中心的新闻阅读器
CN113536182A (zh) 长文本网页的生成方法、装置、电子设备和存储介质
CN113704420A (zh) 文本中的角色识别方法、装置、电子设备及存储介质
CN108763202A (zh) 识别敏感文本的方法、装置、设备及可读存储介质
CN113360654B (zh) 文本分类方法、装置、电子设备及可读存储介质
Wong et al. An unsupervised method for joint information extraction and feature mining across different web sites

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: 21899479

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: 21899479

Country of ref document: EP

Kind code of ref document: A1