[go: up one dir, main page]

CN111241815A - Text increment method and device and terminal equipment - Google Patents

Text increment method and device and terminal equipment Download PDF

Info

Publication number
CN111241815A
CN111241815A CN202010019294.8A CN202010019294A CN111241815A CN 111241815 A CN111241815 A CN 111241815A CN 202010019294 A CN202010019294 A CN 202010019294A CN 111241815 A CN111241815 A CN 111241815A
Authority
CN
China
Prior art keywords
text
incremented
feature matrix
feature
increment
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN202010019294.8A
Other languages
Chinese (zh)
Other versions
CN111241815B (en
Inventor
王健宗
于凤英
程宁
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Ping An Technology Shenzhen Co Ltd
Original Assignee
Ping An Technology Shenzhen Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Ping An Technology Shenzhen Co Ltd filed Critical Ping An Technology Shenzhen Co Ltd
Priority to CN202010019294.8A priority Critical patent/CN111241815B/en
Publication of CN111241815A publication Critical patent/CN111241815A/en
Priority to PCT/CN2020/136069 priority patent/WO2021139486A1/en
Application granted granted Critical
Publication of CN111241815B publication Critical patent/CN111241815B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/30Information retrieval; Database structures therefor; File system structures therefor of unstructured textual data
    • G06F16/33Querying
    • G06F16/332Query formulation
    • G06F16/3329Natural language query formulation

Landscapes

  • Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • Mathematical Physics (AREA)
  • Theoretical Computer Science (AREA)
  • Data Mining & Analysis (AREA)
  • Computational Linguistics (AREA)
  • Human Computer Interaction (AREA)
  • Databases & Information Systems (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Artificial Intelligence (AREA)
  • Machine Translation (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

本申请适用于自然语言处理技术领域,提供了一种文本增量方法,包括:获取待增量文本;对所述待增量文本进行特征提取,获得所述待增量文本对应的特征矩阵;确定所述待增量文本的文本主题;将所述特征矩阵输入与所述文本主题对应的变分自编码器,获得所述待增量文本的增量文本。本申请提高了增量文本与待增量文本的相关度,从而大大提高了生成文本的准确度。

Figure 202010019294

The present application is applicable to the technical field of natural language processing, and provides a text increment method, including: acquiring text to be incremented; performing feature extraction on the text to be incremented, and obtaining a feature matrix corresponding to the text to be incremented; determining the text topic of the text to be incremented; inputting the feature matrix into a variational autoencoder corresponding to the text topic to obtain the incremental text of the text to be incremented. The present application improves the correlation between the incremental text and the text to be incremented, thereby greatly improving the accuracy of the generated text.

Figure 202010019294

Description

文本增量方法、装置及终端设备Text increment method, device and terminal device

技术领域technical field

本申请属于自然语言处理技术领域,尤其涉及一种文本增量方法、装置、终端设备及计算机可读存储介质。The present application belongs to the technical field of natural language processing, and in particular, relates to a text increment method, an apparatus, a terminal device, and a computer-readable storage medium.

背景技术Background technique

当前,在诸如问答系统、机器翻译等很多人工智能领域,都有根据原始文本数据生成其他文本数据的需求。例如人机问答系统中,当用户询问机器人时,机器人的回答需与用户的问题相关,也就是说,要求机器人生成的回答文本数据与用户询问的文本数据之间相关联。Currently, in many artificial intelligence fields such as question answering systems, machine translation, etc., there is a need to generate other text data based on original text data. For example, in a human-machine question answering system, when a user asks a robot, the robot's answer must be related to the user's question, that is, the answer text data generated by the robot is required to be associated with the text data asked by the user.

但是传统的文本生成模型面临的挑战是,生成的文本随机性过强,因此,亟需提供一种新的文本增量方案。However, the challenge faced by traditional text generation models is that the generated text is too random. Therefore, it is urgent to provide a new text increment scheme.

发明内容SUMMARY OF THE INVENTION

本申请实施例提供了一种文本增量方法、装置、终端设备及计算机可读存储介质,提供了一种新的文本增量方案,提高了增量文本与待增量文本的相关度。Embodiments of the present application provide a text increment method, apparatus, terminal device, and computer-readable storage medium, provide a new text increment scheme, and improve the correlation between incremented text and to-be- incremented text.

第一方面,本申请实施例提供了一种文本增量方法,包括:In a first aspect, an embodiment of the present application provides a text increment method, including:

获取待增量文本;Get the text to be incremented;

对所述待增量文本进行特征提取,获得所述待增量文本对应的特征矩阵;Perform feature extraction on the text to be incremented to obtain a feature matrix corresponding to the text to be incremented;

确定所述待增量文本的文本主题;determining the text topic of the text to be incremented;

将所述特征矩阵输入与所述文本主题对应的变分自编码器,获得所述待增量文本的增量文本。Inputting the feature matrix into a variational autoencoder corresponding to the text topic to obtain the incremental text of the text to be incremented.

第二方面,本申请实施例提供了一种文本增量装置,包括:In a second aspect, an embodiment of the present application provides a text increment device, including:

获取模块,用于获取待增量文本;Get module, used to get the text to be incremented;

提取模块,用于对所述待增量文本进行特征提取,获得所述待增量文本对应的特征矩阵;an extraction module, configured to perform feature extraction on the text to be incremented to obtain a feature matrix corresponding to the text to be incremented;

确定模块,用于确定所述待增量文本的文本主题;a determining module, used for determining the text topic of the text to be incremented;

增量模块,用于将所述特征矩阵输入与所述文本主题对应的变分自编码器,获得所述待增量文本的增量文本。an increment module, configured to input the feature matrix into a variational autoencoder corresponding to the text topic to obtain an increment text of the text to be incremented.

第三方面,本申请实施例提供了一种终端设备,包括:存储器、处理器以及存储在所述存储器中并可在所述处理器上运行的计算机程序,所述处理器执行所述计算机程序时实现如第一方面所述的文本增量方法。In a third aspect, an embodiment of the present application provides a terminal device, including: a memory, a processor, and a computer program stored in the memory and executable on the processor, where the processor executes the computer program When implementing the text increment method described in the first aspect.

第四方面,本申请实施例提供了一种计算机可读存储介质,所述计算机可读存储介质存储有计算机程序,所述计算机程序被处理器执行时实现如第一方面所述的文本增量方法。In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium, where the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the text increment according to the first aspect is implemented method.

第五方面,本申请实施例提供了一种计算机程序产品,当计算机程序产品在终端设备上运行时,使得终端设备执行如第一方面所述的文本增量方法。In a fifth aspect, an embodiment of the present application provides a computer program product, which, when the computer program product runs on a terminal device, enables the terminal device to execute the text increment method described in the first aspect.

在本申请实施例中,通过先提取待增量文本的特征矩阵,确定待增量文本的文本主题,再结合与文本主题对应的VAE生成增量文本。一方面,利用与文本主题对应的VAE生成增量文本,不同的主题设置一个不同的VAE;另一方面,由于VAE计算出的分布依赖于输入的变量,所有对这个分布的采样都会生成与输入相似或相关的输出,其本身可以帮助生成文本时实现确定性,因而通过这两方面的双重作用就避免了生成文本时的完全随机性,提高了增量文本与待增量文本的相关度,从而可以大幅提升文本生成的质量。In the embodiment of the present application, by first extracting the feature matrix of the text to be incremented, the text subject of the text to be incremented is determined, and then the increment text is generated in combination with the VAE corresponding to the text subject. On the one hand, the VAE corresponding to the text topic is used to generate incremental text, and different topics are set to a different VAE; on the other hand, since the distribution calculated by the VAE depends on the input variables, all sampling of this distribution will be generated and input. Similar or related outputs can help to achieve certainty when generating text. Therefore, through the dual effects of these two aspects, the complete randomness when generating text is avoided, and the correlation between the incremental text and the text to be incremented is improved. This can greatly improve the quality of text generation.

附图说明Description of drawings

为了更清楚地说明本申请实施例中的技术方案,下面将对实施例或现有技术描述中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本申请的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动性的前提下,还可以根据这些附图获得其他的附图。In order to illustrate the technical solutions in the embodiments of the present application more clearly, the following briefly introduces the accompanying drawings that need to be used in the description of the embodiments or the prior art. Obviously, the drawings in the following description are only for the present application. In some embodiments, for those of ordinary skill in the art, other drawings can also be obtained according to these drawings without any creative effort.

图1是本申请一实施例提供的文本增量方法所适用于的手机的结构示意图;1 is a schematic structural diagram of a mobile phone to which a text increment method provided by an embodiment of the present application is applicable;

图2是本申请一实施例提供的文本增量方法的流程示意图;2 is a schematic flowchart of a text increment method provided by an embodiment of the present application;

图3是本申请一实施例提供的文本增量方法中步骤202的流程示意图;3 is a schematic flowchart of step 202 in the text increment method provided by an embodiment of the present application;

图4是本申请一实施例提供的文本增量方法中VAE的结构示意图;4 is a schematic structural diagram of a VAE in a text increment method provided by an embodiment of the present application;

图5是本申请一实施例提供的文本增量装置的结构示意图;5 is a schematic structural diagram of a text increment device provided by an embodiment of the present application;

图6是本申请一实施例提供的文本增量方法所适用于的终端设备的结构示意图。FIG. 6 is a schematic structural diagram of a terminal device to which the text increment method provided by an embodiment of the present application is applicable.

具体实施方式Detailed ways

以下描述中,为了说明而不是为了限定,提出了诸如特定系统结构、技术之类的具体细节,以便透彻理解本申请实施例。In the following description, for the purpose of illustration rather than limitation, specific details such as a specific system structure and technology are set forth in order to provide a thorough understanding of the embodiments of the present application.

为了使本技术领域的人员更好地理解本申请方案,下面将结合本申请实施例中的附图,对本申请实施例中的技术方案进行清楚,完整地描述,显然,所描述的实施例仅仅是本申请一部分的实施例,而不是全部的实施例。基于本申请中的实施例,对于本领域普通技术人员来讲,在不付出创造性劳动性的前提下,所获得的所有其他实施例,都应当属于本申请保护的范围。需要说明的是,在不冲突的情况下,本申请中的实施例及实施例中的特征可以相互组合。In order to enable those skilled in the art to better understand the solutions of the present application, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present application. Obviously, the described embodiments are only The embodiments are part of the present application, but not all of the embodiments. Based on the embodiments in the present application, for those of ordinary skill in the art, all other embodiments obtained under the premise of no creative labor should fall within the protection scope of the present application. It should be noted that the embodiments in the present application and the features of the embodiments may be combined with each other in the case of no conflict.

以下描述中,为了说明而不是为了限定,提出了诸如特定系统结构、技术之类的具体细节,以便透彻理解本申请实施例。然而,本领域的技术人员应当清楚,在没有这些具体细节的其它实施例中也可以实现本申请。在其它情况中,省略对众所周知的系统、装置、电路以及方法的详细说明,以免不必要的细节妨碍本申请的描述。In the following description, for the purpose of illustration rather than limitation, specific details such as a specific system structure and technology are set forth in order to provide a thorough understanding of the embodiments of the present application. However, it will be apparent to those skilled in the art that the present application may be practiced in other embodiments without these specific details. In other instances, detailed descriptions of well-known systems, devices, circuits, and methods are omitted so as not to obscure the description of the present application with unnecessary detail.

应当理解,当在本申请说明书和所附权利要求书中使用时,术语“包括”指示所描述特征、整体、步骤、操作、元素和/或组件的存在,但并不排除一个或多个其它特征、整体、步骤、操作、元素、组件和/或其集合的存在或添加。It is to be understood that, when used in this specification and the appended claims, the term "comprising" indicates the presence of the described feature, integer, step, operation, element and/or component, but does not exclude one or more other The presence or addition of features, integers, steps, operations, elements, components and/or sets thereof.

还应当理解,在本申请说明书和所附权利要求书中使用的术语“和/或”是指相关联列出的项中的一个或多个的任何组合以及所有可能组合,并且包括这些组合。It will also be understood that, as used in this specification and the appended claims, the term "and/or" refers to and including any and all possible combinations of one or more of the associated listed items.

如在本申请说明书和所附权利要求书中所使用的那样,术语“如果”可以依据上下文被解释为“当...时”或“一旦”或“响应于确定”或“响应于检测到”。类似地,短语“如果确定”或“如果检测到[所描述条件或事件]”可以依据上下文被解释为意指“一旦确定”或“响应于确定”或“一旦检测到[所描述条件或事件]”或“响应于检测到[所描述条件或事件]”。As used in the specification of this application and the appended claims, the term "if" may be contextually interpreted as "when" or "once" or "in response to determining" or "in response to detecting ". Similarly, the phrases "if it is determined" or "if the [described condition or event] is detected" may be interpreted, depending on the context, to mean "once it is determined" or "in response to the determination" or "once the [described condition or event] is detected. ]" or "in response to detection of the [described condition or event]".

另外,在本申请说明书和所附权利要求书的描述中,术语“第一”、“第二”、“第三”等仅用于区分描述,而不能理解为指示或暗示相对重要性。In addition, in the description of the specification of the present application and the appended claims, the terms "first", "second", "third", etc. are only used to distinguish the description, and should not be construed as indicating or implying relative importance.

在本申请说明书中描述的参考“一个实施例”或“一些实施例”等意味着在本申请的一个或多个实施例中包括结合该实施例描述的特定特征、结构或特点。由此,在本说明书中的不同之处出现的语句“在一个实施例中”、“在一些实施例中”、“在其他一些实施例中”、“在另外一些实施例中”等不是必然都参考相同的实施例,而是意味着“一个或多个但不是所有的实施例”,除非是以其他方式另外特别强调。术语“包括”、“包含”、“具有”及它们的变形都意味着“包括但不限于”,除非是以其他方式另外特别强调。References in this specification to "one embodiment" or "some embodiments" and the like mean that a particular feature, structure or characteristic described in connection with the embodiment is included in one or more embodiments of the present application. Thus, appearances of the phrases "in one embodiment," "in some embodiments," "in other embodiments," "in other embodiments," etc. in various places in this specification are not necessarily All refer to the same embodiment, but mean "one or more but not all embodiments" unless specifically emphasized otherwise. The terms "including", "including", "having" and their variants mean "including but not limited to" unless specifically emphasized otherwise.

本申请实施例提供的文本增量方法可以应用于手机、平板电脑、可穿戴设备、车载设备、增强现实(augmented reality,AR)/虚拟现实(virtual reality,VR)设备、笔记本电脑、超级移动个人计算机(ultra-mobile personal computer,UMPC)、上网本、个人数字助理(personal digital assistant,PDA)、或服务器等终端设备上,本申请实施例对终端设备的具体类型不作任何限制。其中,服务器包括但不限于独立服务器、云端服务器、分布式服务器和服务器集群等。The text increment method provided by the embodiments of the present application can be applied to mobile phones, tablet computers, wearable devices, in-vehicle devices, augmented reality (AR)/virtual reality (VR) devices, notebook computers, and super mobile personal On terminal devices such as a computer (ultra-mobile personal computer, UMPC), a netbook, a personal digital assistant (PDA), or a server, the embodiments of the present application do not limit the specific type of the terminal device. The servers include but are not limited to independent servers, cloud servers, distributed servers, and server clusters.

例如,所述终端设备可以是WLAN中的站点(STAION,ST),可以是蜂窝电话、无绳电话、会话启动协议(Session InitiationProtocol,SIP)电话、无线本地环路(WirelessLocal Loop,WLL)站、PDA、具有无线通信功能的手持设备、计算设备或连接到无线调制解调器的其它处理设备、车载设备、车联网终端、电脑、膝上型计算机、手持式通信设备、手持式计算设备、卫星无线设备、无线调制解调器卡、电视机顶盒(set top box,STB)、用户驻地设备(customer premise equipment,CPE)和/或用于在无线系统上进行通信的其它设备以及下一代通信系统,例如,5G网络中的移动终端或者未来演进的公共陆地移动网络(PublicLand Mobile Network,PLMN)网络中的移动终端等。For example, the terminal device may be a station (STAION, ST) in a WLAN, a cellular phone, a cordless phone, a Session Initiation Protocol (Session Initiation Protocol, SIP) phone, a Wireless Local Loop (WLL) station, a PDA , handheld devices with wireless communication capabilities, computing devices or other processing devices connected to wireless modems, in-vehicle devices, connected car terminals, computers, laptop computers, handheld communication devices, handheld computing devices, satellite wireless devices, wireless Modem cards, set top boxes (STBs), customer premise equipment (CPEs) and/or other equipment for communicating over wireless systems and next generation communication systems, e.g. mobile in 5G networks A terminal or a mobile terminal in a public land mobile network (PublicLand Mobile Network, PLMN) network that evolves in the future, and the like.

作为示例而非限定,当所述终端设备为可穿戴设备时,该可穿戴设备还可以是应用穿戴式技术对日常穿戴进行智能化设计、开发出可以穿戴的设备的总称,如眼镜、手套、手表、服饰及鞋等。可穿戴设备即直接穿在身上,或是整合到用户的衣服或配件的一种便携式设备。可穿戴设备不仅仅是一种硬件设备,更是通过软件支持以及数据交互、云端交互来实现强大的功能。广义穿戴式智能设备包括功能全、尺寸大、可不依赖智能手机实现完整或者部分的功能,如智能手表或智能眼镜等,以及只专注于某一类应用功能,需要和其它设备如智能手机配合使用,如各类进行体征监测的智能手环、智能首饰等。As an example and not a limitation, when the terminal device is a wearable device, the wearable device may also be a general term for the intelligent design of daily wear and the development of wearable devices using wearable technology, such as glasses, gloves, Watches, clothing and shoes, etc. A wearable device is a portable device that is worn directly on the body or integrated into the user's clothing or accessories. Wearable device is not only a hardware device, but also realizes powerful functions through software support, data interaction, and cloud interaction. In a broad sense, wearable smart devices include full-featured, large-scale, complete or partial functions without relying on smart phones, such as smart watches or smart glasses, and only focus on a certain type of application function, which needs to be used in conjunction with other devices such as smart phones. , such as various types of smart bracelets and smart jewelry that monitor physical signs.

以所述终端设备为手机为例。图1示出的是与本申请实施例提供的手机的部分结构的框图。参考图1,手机包括:射频(Radio Frequency,RF)电路110、存储器120、输入单元130、显示单元140、传感器150、音频电路160、无线保真(wireless fidelity,WiFi)模块170、处理器180、以及电源190等部件。本领域技术人员可以理解,图1中示出的手机结构并不构成对手机的限定,可以包括比图示更多或更少的部件,或者组合某些部件,或者不同的部件布置。Take the terminal device as a mobile phone as an example. FIG. 1 is a block diagram showing a partial structure of a mobile phone provided by an embodiment of the present application. Referring to FIG. 1 , the mobile phone includes: a radio frequency (RF) circuit 110 , a memory 120 , an input unit 130 , a display unit 140 , a sensor 150 , an audio circuit 160 , a wireless fidelity (WiFi) module 170 , and a processor 180 , and components such as the power supply 190 . Those skilled in the art can understand that the structure of the mobile phone shown in FIG. 1 does not constitute a limitation on the mobile phone, and may include more or less components than the one shown, or combine some components, or arrange different components.

下面结合图1对手机的各个构成部件进行具体的介绍:The following describes the various components of the mobile phone in detail with reference to Figure 1:

RF电路110可用于收发信息或通话过程中,信号的接收和发送,特别地,将基站的下行信息接收后,给处理器180处理;另外,将设计上行的数据发送给基站。通常,RF电路包括但不限于天线、至少一个放大器、收发信机、耦合器、低噪声放大器(Low NoiseAmplifier,LNA)、双工器等。此外,RF电路110还可以通过无线通信与网络和其他设备通信。上述无线通信可以使用任一通信标准或协议,包括但不限于全球移动通讯系统(GlobalSystem of Mobile communication,GSM)、通用分组无线服务(General Packet RadioService,GPRS)、码分多址(Code Division Multiple Access,CDMA)、宽带码分多址(Wideband Code Division Multiple Access,WCDMA)、长期演进(Long Term Evolution,LTE)、电子邮件、以及短消息服务(Short Messaging Service,SMS)等。The RF circuit 110 can be used for receiving and sending signals during sending and receiving of information or during a call. In particular, after receiving the downlink information of the base station, it is processed by the processor 180; in addition, the designed uplink data is sent to the base station. Typically, the RF circuit includes, but is not limited to, an antenna, at least one amplifier, a transceiver, a coupler, a Low Noise Amplifier (LNA), a duplexer, and the like. In addition, the RF circuitry 110 may also communicate with networks and other devices via wireless communication. The above-mentioned wireless communication can use any communication standard or protocol, including but not limited to Global System of Mobile communication (GSM), General Packet Radio Service (General Packet Radio Service, GPRS), Code Division Multiple Access (Code Division Multiple Access) , CDMA), Wideband Code Division Multiple Access (Wideband Code Division Multiple Access, WCDMA), Long Term Evolution (Long Term Evolution, LTE), email, and Short Messaging Service (Short Messaging Service, SMS) and the like.

存储器120可用于存储软件程序以及模块,处理器180通过运行存储在存储器120的软件程序以及模块,从而执行手机的各种功能应用以及数据处理。存储器120可主要包括存储程序区和存储数据区,其中,存储程序区可存储操作系统、至少一个功能所需的应用程序(比如声音播放功能、图像播放功能等)、引导装载程序(Boot Loader)等;存储数据区可存储根据手机的使用所创建的数据(比如音频数据、电话本等)等。此外,存储器120可以包括高速随机存取存储器,还可以包括非易失性存储器,例如至少一个磁盘存储器件、闪存器件、或其他易失性固态存储器件。可以理解的是,本申请实施例中,存储器120中存储有文本增量的程序。The memory 120 can be used to store software programs and modules, and the processor 180 executes various functional applications and data processing of the mobile phone by running the software programs and modules stored in the memory 120 . The memory 120 may mainly include a stored program area and a stored data area, wherein the stored program area may store an operating system, an application program required for at least one function (such as a sound playback function, an image playback function, etc.), a boot loader (Boot Loader) etc.; the storage data area can store data (such as audio data, phone book, etc.) created according to the use of the mobile phone, and the like. Additionally, memory 120 may include high-speed random access memory, and may also include non-volatile memory, such as at least one magnetic disk storage device, flash memory device, or other volatile solid state storage device. It can be understood that, in this embodiment of the present application, a program for text increment is stored in the memory 120 .

输入单元130可用于接收输入的数字或字符信息,以及产生与手机100的用户设置以及功能控制有关的键信号输入。具体地,输入单元130可包括触控面板131以及其他输入设备132。触控面板131,也称为触摸屏,可收集用户在其上或附近的触摸操作(比如用户使用手指、触笔等任何适合的物体或附件在触控面板131上或在触控面板131附近的操作),并根据预先设定的程式驱动相应的连接装置。可选的,触控面板131可包括触摸检测装置和触摸控制器两个部分。其中,触摸检测装置检测用户的触摸方位,并检测触摸操作带来的信号,将信号传送给触摸控制器;触摸控制器从触摸检测装置上接收触摸信息,并将它转换成触点坐标,再送给处理器180,并能接收处理器180发来的命令并加以执行。此外,可以采用电阻式、电容式、红外线以及表面声波等多种类型实现触控面板131。除了触控面板131,输入单元130还可以包括其他输入设备132。具体地,其他输入设备132可以包括但不限于物理键盘、功能键(比如音量控制按键、开关按键等)、轨迹球、鼠标、操作杆等中的一种或多种。The input unit 130 may be used to receive input numerical or character information, and generate key signal input related to user settings and function control of the mobile phone 100 . Specifically, the input unit 130 may include a touch panel 131 and other input devices 132 . The touch panel 131, also referred to as a touch screen, can collect the user's touch operations on or near it (such as the user's finger, stylus, etc., any suitable objects or accessories on or near the touch panel 131 ). operation), and drive the corresponding connection device according to the preset program. Optionally, the touch panel 131 may include two parts, a touch detection device and a touch controller. Among them, the touch detection device detects the user's touch orientation, detects the signal brought by the touch operation, and transmits the signal to the touch controller; the touch controller receives the touch information from the touch detection device, converts it into contact coordinates, and then sends it to the touch controller. To the processor 180, and can receive the commands sent by the processor 180 and execute them. In addition, the touch panel 131 can be implemented in various types such as resistive, capacitive, infrared, and surface acoustic waves. Besides the touch panel 131 , the input unit 130 may also include other input devices 132 . Specifically, other input devices 132 may include, but are not limited to, one or more of physical keyboards, function keys (such as volume control keys, switch keys, etc.), trackballs, mice, joysticks, and the like.

显示单元140可用于显示由用户输入的信息或提供给用户的信息以及手机的各种菜单。显示单元140可包括显示面板141,可选的,可以采用液晶显示器(Liquid CrystalDisplay,LCD)、有机发光二极管(Organic Light-Emitting Diode,OLED)等形式来配置显示面板141。进一步的,触控面板131可覆盖显示面板141,当触控面板131检测到在其上或附近的触摸操作后,传送给处理器180以确定触摸事件的类型,随后处理器180根据触摸事件的类型在显示面板141上提供相应的视觉输出。虽然在图1中,触控面板131与显示面板141是作为两个独立的部件来实现手机的输入和输入功能,但是在某些实施例中,可以将触控面板131与显示面板141集成而实现手机的输入和输出功能。The display unit 140 may be used to display information input by the user or information provided to the user and various menus of the mobile phone. The display unit 140 may include a display panel 141, and optionally, the display panel 141 may be configured in the form of a liquid crystal display (Liquid Crystal Display, LCD), an organic light-emitting diode (Organic Light-Emitting Diode, OLED), or the like. Further, the touch panel 131 may cover the display panel 141, and when the touch panel 131 detects a touch operation on or near it, it transmits it to the processor 180 to determine the type of the touch event, and then the processor 180 determines the type of the touch event according to the touch event. Type provides corresponding visual output on display panel 141 . Although in FIG. 1, the touch panel 131 and the display panel 141 are used as two independent components to realize the input and input functions of the mobile phone, in some embodiments, the touch panel 131 and the display panel 141 can be integrated to form a Realize the input and output functions of the mobile phone.

手机100还可包括至少一种传感器150,比如光传感器、运动传感器以及其他传感器。具体地,光传感器可包括环境光传感器及接近传感器,其中,环境光传感器可根据环境光线的明暗来调节显示面板141的亮度,接近传感器可在手机移动到耳边时,关闭显示面板141和/或背光。作为运动传感器的一种,加速计传感器可检测各个方向上(一般为三轴)加速度的大小,静止时可检测出重力的大小及方向,可用于识别手机姿态的应用(比如横竖屏切换、相关游戏、磁力计姿态校准)、振动识别相关功能(比如计步器、敲击)等;至于手机还可配置的陀螺仪、气压计、湿度计、温度计、红外线传感器等其他传感器,在此不再赘述。The cell phone 100 may also include at least one sensor 150, such as a light sensor, a motion sensor, and other sensors. Specifically, the light sensor may include an ambient light sensor and a proximity sensor, wherein the ambient light sensor may adjust the brightness of the display panel 141 according to the brightness of the ambient light, and the proximity sensor may turn off the display panel 141 and/or when the mobile phone is moved to the ear. or backlight. As a kind of motion sensor, the accelerometer sensor can detect the magnitude of acceleration in all directions (usually three axes), and can detect the magnitude and direction of gravity when it is stationary. games, magnetometer attitude calibration), vibration recognition related functions (such as pedometer, tapping), etc.; as for other sensors such as gyroscope, barometer, hygrometer, thermometer, infrared sensor, etc. Repeat.

音频电路160,扬声器161,传声器162可提供用户与手机之间的音频接口。音频电路160可将接收到的音频数据转换后的电信号,传输到扬声器161,由扬声器161转换为声音信号输出;另一方面,传声器162将收集的声音信号转换为电信号,由音频电路160接收后转换为音频数据,再将音频数据输出处理器180处理后,经RF电路110以发送给比如另一手机,或者将音频数据输出至存储器120以便进一步处理。The audio circuit 160, the speaker 161, and the microphone 162 can provide an audio interface between the user and the mobile phone. The audio circuit 160 can transmit the received audio data converted electrical signal to the speaker 161, and the speaker 161 converts it into a sound signal for output; on the other hand, the microphone 162 converts the collected sound signal into an electrical signal, which is converted by the audio circuit 160 After receiving, it is converted into audio data, and then the audio data is output to the processor 180 for processing, and then sent to, for example, another mobile phone through the RF circuit 110, or the audio data is output to the memory 120 for further processing.

WiFi属于短距离无线传输技术,手机通过WiFi模块170可以帮助用户收发电子邮件、浏览网页和访问流式媒体等,它为用户提供了无线的宽带互联网访问。虽然图1示出了WiFi模块170,但是可以理解的是,其并不属于手机100的必须构成,完全可以根据需要在不改变发明的本质的范围内而省略。WiFi is a short-distance wireless transmission technology, and the mobile phone can help users to send and receive emails, browse web pages and access streaming media through the WiFi module 170, which provides users with wireless broadband Internet access. Although FIG. 1 shows the WiFi module 170, it can be understood that it is not a necessary component of the mobile phone 100, and can be completely omitted as required within the scope of not changing the essence of the invention.

处理器180是手机的控制中心,利用各种接口和线路连接整个手机的各个部分,通过运行或执行存储在存储器120内的软件程序和/或模块,以及调用存储在存储器120内的数据,执行手机的各种功能和处理数据,从而对手机进行整体监控。可选的,处理器180可包括一个或多个处理单元;优选的,处理器180可集成应用处理器和调制解调处理器,其中,应用处理器主要处理操作系统、用户界面和应用程序等,调制解调处理器主要处理无线通信。可以理解的是,上述调制解调处理器也可以不集成到处理器180中。可以理解的是,本申请实施例中,存储器120中存储有文本增量的程序,而处理器180可以用于调用存储器120中存储的文本增量的程序并执行,以实现本申请实施例的文本增量方法。The processor 180 is the control center of the mobile phone, using various interfaces and lines to connect various parts of the entire mobile phone, by running or executing the software programs and/or modules stored in the memory 120, and calling the data stored in the memory 120. Various functions of the mobile phone and processing data, so as to monitor the mobile phone as a whole. Optionally, the processor 180 may include one or more processing units; preferably, the processor 180 may integrate an application processor and a modem processor, wherein the application processor mainly processes the operating system, user interface, and application programs, etc. , the modem processor mainly deals with wireless communication. It can be understood that, the above-mentioned modulation and demodulation processor may not be integrated into the processor 180 . It can be understood that, in this embodiment of the present application, the memory 120 stores a program of text increment, and the processor 180 can be configured to call and execute the program of text increment stored in the memory 120, so as to realize the program of this embodiment of the present application. Text increment method.

手机100还包括给各个部件供电的电源190(比如电池),优选的,电源可以通过电源管理系统与处理器180逻辑相连,从而通过电源管理系统实现管理充电、放电、以及功耗管理等功能。The mobile phone 100 also includes a power source 190 (such as a battery) for supplying power to various components. Preferably, the power source can be logically connected to the processor 180 through a power management system, so as to manage charging, discharging, and power consumption management functions through the power management system.

尽管未示出,手机100还可以包括摄像头。可选地,摄像头在手机100的上的位置可以为前置的,也可以为后置的,还可以为内置的(在使用时可伸出机身),本申请实施例对此不作限定。Although not shown, the cell phone 100 may also include a camera. Optionally, the position of the camera on the mobile phone 100 may be front-mounted, rear-mounted, or built-in (can extend out of the body when in use), which is not limited in this embodiment of the present application.

可选地,手机100可以包括单摄像头、双摄像头或三摄像头等,本申请实施例对此不作限定。摄像头包括但不限于广角摄像头、长焦摄像头或深度摄像头等。Optionally, the mobile phone 100 may include a single camera, a dual camera, or a triple camera, etc., which is not limited in this embodiment of the present application. Cameras include, but are not limited to, wide-angle cameras, telephoto cameras, or depth cameras.

例如,手机100可以包括三摄像头,其中,一个为主摄像头、一个为广角摄像头、一个为长焦摄像头。For example, the mobile phone 100 may include three cameras, wherein one is a main camera, one is a wide-angle camera, and one is a telephoto camera.

可选地,当手机100包括多个摄像头时,这多个摄像头可以全部前置,或者全部后置,或者全部内置,或者至少部分前置,或者至少部分后置,或者至少部分内置等,本申请实施例对此不作限定。Optionally, when the mobile phone 100 includes multiple cameras, the multiple cameras may be all front-facing, or all rear-facing, or all built-in, or at least partially front-facing, or at least partially rear-facing, or at least partially built-in, etc. This is not limited in the application examples.

另外,尽管未示出,手机100还可以包括蓝牙模块等,在此不再赘述。In addition, although not shown, the mobile phone 100 may also include a Bluetooth module, etc., which will not be described herein again.

图2示出了本申请实施例提供的一种文本增量方法的实现流程图。所述文本增量方法应用于终端设备。作为示例而非限定,该文本增量方法可以应用于具有上述硬件结构的手机100中。所述文本增量方法包括步骤S201至步骤S204,各个步骤的具体实现原理如下。FIG. 2 shows an implementation flowchart of a text increment method provided by an embodiment of the present application. The text increment method is applied to a terminal device. As an example and not a limitation, the text increment method can be applied to the mobile phone 100 having the above-mentioned hardware structure. The text increment method includes steps S201 to S204, and the specific implementation principles of each step are as follows.

S201,获取待增量文本。S201, acquiring the text to be incremented.

在本申请实施例中,所述待增量文本为进行文本增量的对象,例如句子文本等。In the embodiment of the present application, the text to be incremented is an object for text increment, such as sentence text and the like.

待增量文本可以是用户通过终端设备的输入单元即时输入的文本;还可以是用户通过终端设备的音频采集单元即时采集到的语音数据;还可以是用户通过终端设备的摄像头即时拍摄到的包括文本的图片;还可以是用户通过终端设备的扫描装置即时扫描到的包括文本的图片;还可以是原本已存储在终端设备中的文本;甚至可以是终端设备通过有线或无线网络从其它终端设备处所获取到的文本等。The text to be incremented can be the text that the user instantly enters through the input unit of the terminal device; it can also be the voice data that the user instantly collects through the audio collection unit of the terminal device; A picture of text; it can also be a picture including text instantly scanned by the user through the scanning device of the terminal device; it can also be the text originally stored in the terminal device; it can even be the terminal device through a wired or wireless network from other terminal devices The text obtained from the location, etc.

需要说明的是,针对包括文本的图片,需要通过启用终端设备的图片识别功能提取图片中的文本作为待增量文本;针对语音数据,需要通过启动终端设备的音频转文字功能识别语音数据中的文本作为待增量文本。It should be noted that, for pictures including text, it is necessary to extract the text in the picture as the text to be incremented by enabling the picture recognition function of the terminal device; for voice data, it is necessary to activate the audio-to-text function of the terminal device to identify the text in the voice data. Text as the text to be incremented.

在本申请一种非限定性使用场景中,当用户通过终端设备的音频采集单元采集到用户语音输入的一段语音数据后,启用音频转文字功能,获取到用户输入的文本,这时若用户想要进行文本增量,用户可以通过点击终端设备特定的物理按键或者虚拟按键的方式启用终端设备的文本增量功能,在这种模式下,终端设备会对用户输入的文本自动按照步骤S202至步骤S204的过程进行处理,得到增量文本。此处需要说明的是,用户输入文本和点击按键的顺序可以互换,即也可以先点击按键,再获取用户输入的文本,最后针对用户输入的文本自动按照步骤S202至步骤S204的过程进行处理。In a non-limiting usage scenario of the present application, after the user collects a piece of voice data input by the user's voice through the audio collection unit of the terminal device, the audio-to-text function is enabled to obtain the text input by the user. To perform text increment, the user can enable the text increment function of the terminal device by clicking the specific physical button or virtual button of the terminal device. In this mode, the terminal device will automatically follow steps S202 to S202 to the text input by the user in this mode. The process of S204 is processed to obtain incremental text. It should be noted here that the order in which the user enters the text and clicks the button can be interchanged, that is, the button can be clicked first, then the text input by the user can be obtained, and finally the text input by the user is automatically processed according to the process from step S202 to step S204. .

在本申请另一种非限定性使用场景中,当用户想要对终端设备已经存储的文本进行增量时,可以通过点击特定的物理按键或者虚拟按键的方式启用终端设备的文本增量功能,并选定待增量文本,则终端设备会对选定的待增量文本自动按照步骤S202至步骤S204的过程进行处理,得到增量文本。此处需要说明的是,点击按键和选定文本的顺序可以互换,即也可以先选定文本,再启用终端设备的文本增量功能。In another non-limiting usage scenario of the present application, when the user wants to increment the text already stored in the terminal device, the text increment function of the terminal device can be enabled by clicking a specific physical button or virtual button, If the text to be incremented is selected, the terminal device will automatically process the selected text to be incremented according to the process from step S202 to step S204 to obtain the incremented text. It should be noted here that the order of clicking the button and the selected text can be interchanged, that is, the text can be selected first, and then the text increment function of the terminal device can be enabled.

S202,对所述待增量文本进行特征提取,获得所述待增量文本对应的特征矩阵。S202: Perform feature extraction on the text to be incremented to obtain a feature matrix corresponding to the text to be incremented.

步骤S202为对待增量文本进行特征提取的步骤,获得所述待增量文本对应的特征矩阵,实现采用低维的矩阵表示文本。Step S202 is the step of performing feature extraction on the text to be incremented, obtaining a feature matrix corresponding to the text to be incremented, and implementing a low-dimensional matrix to represent the text.

在本申请一些实施例中,可以通过词向量模型对待增量文本进行特征提取,获得所述待增量文本对应的特征矩阵。也就是说,通过词向量模型将待增量文本转换成特征矩阵。In some embodiments of the present application, feature extraction may be performed on the text to be incremented by using a word vector model to obtain a feature matrix corresponding to the text to be incremented. That is, the text to be incremented is converted into a feature matrix through the word vector model.

词向量模型包括但不限于word2vec(word to vector),ELMo,和BERT(Bidirectional Encoder Representation from Transformers)等模型。本申请实施例通过步骤S202,利用词向量模型,把真实世界抽象存在的文本转换成可以进行数学公式操作的向量或矩阵。将数据处理成可由机器处理的数据,使得本申请能够实施。Word vector models include but are not limited to models such as word2vec (word to vector), ELMo, and BERT (Bidirectional Encoder Representation from Transformers). In the embodiment of the present application, through step S202, the word vector model is used to convert the abstract existing text in the real world into a vector or a matrix that can be operated by mathematical formulas. The processing of data into machine-processable data enables this application to be implemented.

需要说明的是,在利用词向量模型之前,需要完成对词向量模型的训练,预训练产生词向量。此外,在对词向量模型的训练过程中,为了获得更准确的特征提取结果,可以保留待增量文本中的标点符号,对完整的待增量文本进行特征提取。It should be noted that, before using the word vector model, the training of the word vector model needs to be completed, and the word vector is generated by pre-training. In addition, in the training process of the word vector model, in order to obtain more accurate feature extraction results, the punctuation marks in the text to be incremented can be retained, and feature extraction is performed on the complete text to be incremented.

示例性地,BERT模型的训练过程中,为了能够在庞大的数据集上进行非监督的预训练,在训练过程中随机选择了用于训练的训练语句中15%的词作为要遮盖的词。这样的遮盖设计是为了让BERT模型实现对被遮盖位置进行填空,实现非监督的训练。Exemplarily, in the training process of the BERT model, in order to be able to perform unsupervised pre-training on a huge dataset, 15% of the words in the training sentences used for training are randomly selected as words to be masked during the training process. Such a masking design is to allow the BERT model to fill in the blanks in the masked positions and achieve unsupervised training.

作为本申请一非限制性示例,步骤S202包括:通过预设的BERT模型对所述待增量文本进行特征提取,获得所述待增量文本对应的特征矩阵。As a non-limiting example of the present application, step S202 includes: performing feature extraction on the text to be incremented by using a preset BERT model to obtain a feature matrix corresponding to the text to be incremented.

示例性地,通过预设的BERT模型将所述待增量文本转换为N×768维的特征矩阵,预设的所述BERT模型包括24层编码层,也就是说采用的是BERT Large模型,该模型中Transformer块的个数为24个;其中,所述待增量文本包括N个字符,N为正整数。Exemplarily, the text to be incremented is converted into an N×768-dimensional feature matrix by a preset BERT model, and the preset BERT model includes 24 coding layers, that is to say, the BERT Large model is used, The number of Transformer blocks in this model is 24; wherein, the text to be incremented includes N characters, and N is a positive integer.

特征矩阵中的每一行对应着待增量文本的一个外文字符(或一个中文字),显然特征矩阵可以反映待增量文本的语义特征。Each row in the feature matrix corresponds to a foreign character (or a Chinese character) of the text to be incremented. Obviously, the feature matrix can reflect the semantic features of the text to be incremented.

例如,待增量文本为“我爱我的祖国!”,包括标点符号的中文字的字数为7,不包括标点符号的中文字的字数为6。For example, the text to be incremented is "I love my motherland!", the word count of Chinese characters including punctuation marks is 7, and the word count of Chinese characters excluding punctuation marks is 6.

另一示例性地,采用包括12层编码层的BERT模型,即BERT Base模型,该模型中Transformer块的个数为12个。In another example, a BERT model including 12 coding layers, that is, a BERT Base model, is adopted, and the number of Transformer blocks in this model is 12.

作为本申请另一非限制性示例,如图3所示,步骤S202包括步骤S2021至步骤S2023。As another non-limiting example of the present application, as shown in FIG. 3 , step S202 includes steps S2021 to S2023.

S2021,获取所述待增量文本的关键词。S2021, acquiring the keywords of the text to be incremented.

其中,针对所述待增量文本,先进行分词和词性标注,然后根据预设的停用词词典去除停用词,并且根据分词后的词语的词性,去掉介词、方位词和语气词等非特征词,得到待增量文本的关键词集合。Among them, for the text to be incremented, firstly perform word segmentation and part-of-speech tagging, and then remove stop words according to a preset stop word dictionary, and remove non-prepositions, orientation words and modal particles according to the part of speech of the word after word segmentation. Feature words, get the keyword set of the text to be incremented.

步骤S2021通过获取待增量文本的关键词,过滤了一些噪音数据,保证结果精度的同时,也适当的减少了数据量,提高了处理效率,减少了系统资源占用,降低了算力成本。Step S2021 filters some noisy data by acquiring the keywords of the text to be incremented, so as to ensure the accuracy of the results, and also appropriately reduce the amount of data, improve the processing efficiency, reduce the occupation of system resources, and reduce the cost of computing power.

S2022,获取每个所述关键词对应的特征向量。S2022: Obtain a feature vector corresponding to each of the keywords.

其中,终端设备预存有关键词与特征向量的对应关系,通过查找关键词与特征向量的对应关系,获取每个关键词对应的特征向量。The terminal device pre-stores the corresponding relationship between the keywords and the feature vectors, and obtains the feature vector corresponding to each keyword by searching for the corresponding relationship between the keywords and the feature vectors.

需要说明的是,在步骤S2022之前,预先建立关键词与特征向量的对应关系,对应关系的建立方法如下:It should be noted that, before step S2022, the corresponding relationship between the keyword and the feature vector is established in advance, and the method for establishing the corresponding relationship is as follows:

首先,通过网络爬虫技术爬取各种渠道的语料整理成为文档集合。First, the corpus crawled from various channels is organized into a document collection through web crawling technology.

然后,运用开源的分词工具,对每篇文档进行分词和词性标注,然后根据预设的停用词词典去除停用词,并且根据分词后的词语的词性,去掉介词、方位词和语气词等非特征词,得到关键词集合。Then, use the open source word segmentation tool to perform word segmentation and part-of-speech tagging on each document, and then remove stop words according to the preset stop word dictionary, and remove prepositions, orientation words and modal particles according to the part of speech of the word after segmentation. Non-feature words, get a keyword set.

最后,利用开源的词向量训练工具Word2Vec,训练上述关键词集合,得到不同的关键词对应的特征向量,将关键词与特征向量的对应关系进行存储,存储于词向量数据库。示例性的,每个特征向量都具有相同的维度,利用N维(N为正整数)的词向量,每个词向量的数值均在0至1,或-1至1之间。Finally, the open source word vector training tool Word2Vec is used to train the above keyword sets to obtain feature vectors corresponding to different keywords, and the correspondence between keywords and feature vectors is stored in the word vector database. Exemplarily, each feature vector has the same dimension, and an N-dimensional (N is a positive integer) word vector is used, and the value of each word vector is between 0 and 1, or -1 and 1.

通过上述方法建立好了关键词与特征向量的对应关系。通过查找对应关系,就可以获取到关键词对应的特征向量,从而将每个关键词转化成特征向量。Through the above method, the corresponding relationship between keywords and feature vectors is established. By looking up the corresponding relationship, the feature vector corresponding to the keyword can be obtained, so that each keyword can be converted into a feature vector.

S2023,将所有所述关键词对应的所述特征向量进行组合,生成特征矩阵。S2023, combine the feature vectors corresponding to all the keywords to generate a feature matrix.

其中,将所有关键词对应的特征向量进行组合,是将所有关键词的特征向量进行拼接,以生成特征矩阵。Among them, combining the feature vectors corresponding to all the keywords is to splicing the feature vectors of all the keywords to generate a feature matrix.

例如,当特征向量为1×N维,预设数量为M(M为正整数)时,M个1×N维的特征向量组合得到的特征矩阵可以为M×N维,也可以为1×(M+N)维。For example, when the feature vector is 1×N-dimensional and the preset number is M (M is a positive integer), the feature matrix obtained by combining M 1×N-dimensional feature vectors can be M×N-dimensional or 1× (M+N) dimension.

在本申请一些实施例中,利用深度学习网络模型对待增量文本进行特征提取,获得与待增量文本对应的特征矩阵。In some embodiments of the present application, a deep learning network model is used to perform feature extraction on the text to be incremented, and a feature matrix corresponding to the text to be incremented is obtained.

深度学习网络模型用于提取待增量文本的特征。当待增量文本输入深度学习网络模型,深度学习网络模型输出待增量文本对应的特征矩阵。深度学习网络模型可以为以机器学习技术为基础的深度学习网络模型,包括但不限于深度卷积神经网络模型,和深度残差卷积神经网络模型(Res Net)等。其中,深度卷积神经网络模型包括但不限于AlexNet,VGG-Net,和DenseNet等。The deep learning network model is used to extract the features of the text to be incremented. When the text to be incremented is input into the deep learning network model, the deep learning network model outputs the feature matrix corresponding to the text to be incremented. The deep learning network model may be a deep learning network model based on machine learning technology, including but not limited to a deep convolutional neural network model, a deep residual convolutional neural network model (Res Net), and the like. Among them, deep convolutional neural network models include but are not limited to AlexNet, VGG-Net, and DenseNet.

可以理解的是,在利用深度学习网络模型之前,需要完成对深度学习网络模型的训练。在训练深度学习网络模型的过程中,采用的损失函数可以为0-1损失函数,绝对值损失函数,对数损失函数,指数损失函数和铰链损失函数中的一种或者至少两者的组合。It is understandable that, before utilizing the deep learning network model, the training of the deep learning network model needs to be completed. In the process of training a deep learning network model, the loss function used may be one of a 0-1 loss function, an absolute value loss function, a logarithmic loss function, an exponential loss function and a hinge loss function, or at least a combination of the two.

需要说明的是,训练模型的过程,包括训练深度学习网络模型和训练词向量模型的过程,可以在终端设备实现,也可以在与终端设备进行通信连接的其他终端设备上实现。当终端设备将训练好的模型存储好,或者其他终端设备将训练好的模型推送至终端设备后,从而实现在终端设备对获取到的待增量文本进行特征提取。需要说明的是,终端设备在文本增量过程中获得的待增量文本还可以用以增加训练模型的样本数据库的数据,在终端设备或其他终端设备端执行模型的进一步优化,终端设备或其他终端设备再将进一步优化的模型存储到终端设备中以替换之前的模型。通过这种方式优化模型,提高了模型的数据广度,从而提高了本申请方案的适用范围。It should be noted that the process of training the model, including the process of training the deep learning network model and the training word vector model, can be implemented on a terminal device, or can be implemented on other terminal devices that are communicatively connected to the terminal device. When the terminal device stores the trained model, or other terminal devices push the trained model to the terminal device, the terminal device can perform feature extraction on the acquired text to be incremented. It should be noted that the text to be incremented obtained by the terminal device during the text increment process can also be used to increase the data in the sample database of the training model, and perform further model optimization on the terminal device or other terminal devices. The terminal device then stores the further optimized model in the terminal device to replace the previous model. In this way, the model is optimized, the data breadth of the model is improved, and the applicable scope of the solution of the present application is improved.

S203,确定所述待增量文本的文本主题。S203: Determine the text topic of the text to be incremented.

在步骤203中,确定待增量文本的文本主题,从而在后续的步骤S204中通过与文本主题对应的变分自编码器(Variational Autoencoder,VAE)实现对特征矩阵的增量。In step 203, the text subject of the text to be incremented is determined, so that in the subsequent step S204, the feature matrix is incremented by a variational autoencoder (VAE) corresponding to the text subject.

在本申请一些实施例中,利用文档主题生成模型(Latent DirichletAllocation,LDA)识别所述待增量文本的文本主题。LDA是一种非监督机器学习技术,可以用来识别大规模文档集(document collection)或语料库(corpus)中潜藏的主题信息。In some embodiments of the present application, a document topic generation model (Latent Dirichlet Allocation, LDA) is used to identify the text topic of the text to be incremented. LDA is an unsupervised machine learning technique that can be used to identify hidden topic information in large-scale document collections or corpus.

可以理解的是,此处仅为示例性说明,不能解释为对本申请的具体限制。所有能实现确定待增量文本的文本主题的方式都适用于本申请。It can be understood that, this is only an exemplary description, and should not be construed as a specific limitation to the present application. All ways of achieving the textual subject matter of the text to be incremented are applicable to this application.

需要说明的是,虽然步骤S202和步骤S203在描述上有前后之分,标号也有大小之分,但是描述上的前后之分和标号的大小之分都不代表具体限制了步骤的先后时序关系。在本申请实施例中,步骤S202可以在步骤S203之前执行,还可以在步骤S203之后执行,还可以与步骤S203同时执行,本申请不具体限定步骤S202和S203之间的时序关系。It should be noted that, although step S202 and step S203 are divided into front and back in the description, and the labels are also divided into size, but the difference between the front and rear in the description and the size of the label do not mean that the sequence relationship between the steps is specifically limited. In this embodiment of the present application, step S202 may be performed before step S203, may be performed after step S203, or may be performed simultaneously with step S203, and the present application does not specifically limit the timing relationship between steps S202 and S203.

S204,将所述特征矩阵输入与所述文本主题对应的变分自编码器VAE,获得所述待增量文本的增量文本。S204: Input the feature matrix into a variational autoencoder VAE corresponding to the text topic to obtain the incremental text of the text to be incremented.

在本申请实施例中,终端设备预存有多个VAE,每个VAE对应一种文本主题。在步骤203确定待增量文本的文本主题后,从预存的多个VAE中确定出待增量文本的文本主题对应的VAE,从而基于确定出的VAE对待增量文本进行增量。In the embodiment of the present application, the terminal device pre-stores multiple VAEs, and each VAE corresponds to a text topic. After determining the text subject of the text to be incremented in step 203, a VAE corresponding to the text subject of the text to be incremented is determined from a plurality of pre-stored VAEs, so that the text to be incremented is incremented based on the determined VAE.

将特征矩阵输入文本主题对应的VAE,获得待增量文本的增量文本。基于与待增量文本的文本主题对应的VAE进行文本增量,大大提高了增量文本与待增量文本的相关程度,大幅提升了文本生成的准确度。Input the feature matrix into the VAE corresponding to the text topic to obtain the incremental text of the text to be incremented. The text increment is performed based on the VAE corresponding to the text topic of the text to be incremented, which greatly improves the correlation between the incremented text and the to-be- incremented text, and greatly improves the accuracy of text generation.

如图4所示,VAE由两部分构成,包括编码器与解码器。VAE的编码器不直接输出编码,而是认为所有的编码都符合一个正态分布,编码器的均值和方差计算模块计算出正态分布的均值与方差,基于均值与方差可以确定一个正态分布,从确定出的正态分布中进行采样获得一个采样编码,之后将这个采样编码输入到解码器的生成器中生成增量文本数据。也就是说,在本申请实施例中,可以认为每个待增量文本都对应着正态分布中的一个编码,先通过已有的训练数据估计出这个正态分布,之后只需要从正态分布中采样就可以获得新的编码来生成增量文本数据。As shown in Figure 4, VAE consists of two parts, including encoder and decoder. The encoder of VAE does not directly output the code, but considers that all codes conform to a normal distribution. The mean and variance calculation module of the encoder calculates the mean and variance of the normal distribution, and a normal distribution can be determined based on the mean and variance. , sample from the determined normal distribution to obtain a sample code, and then input this sample code into the generator of the decoder to generate incremental text data. That is to say, in the embodiment of the present application, it can be considered that each text to be incremented corresponds to a code in the normal distribution, and the normal distribution is estimated first through the existing training data, and then only the normal distribution needs to be estimated from the normal distribution. By sampling from the distribution, new encodings can be obtained to generate incremental text data.

作为本申请一非限制性示例,使用一个较为简单的循环神经网络(RecurrentNeural Network,RNN)作为编码器和解码器。该编码器会接收特征矩阵作为输入,输出方差和均值,解码器基于方差和均值确定正态分布,在正态分布中进行采样获得采样编码。将从正态分布中采样得到的采样编码向量在解码器的RNN的每一个时间步进行输入,这样每一个时间步的输出在接入一个全连接层和softmax函数后生成每个词在该位置出现的概率,我们选择概率最大的词作为出现在这个时间步的词。需要说明的是,若生成的文本长度实际没有那么多个时间步,则超出长度的部分均会生成一个预设字符代表填充。As a non-limiting example of the present application, a relatively simple Recurrent Neural Network (RNN) is used as the encoder and decoder. The encoder receives the feature matrix as input, and outputs the variance and mean. The decoder determines the normal distribution based on the variance and mean, and performs sampling in the normal distribution to obtain the sampling code. The sampled encoding vector sampled from the normal distribution is input at each time step of the RNN of the decoder, so that the output of each time step is connected to a fully connected layer and softmax function to generate each word at that position The probability of occurrence, we choose the word with the highest probability as the word that appears at this time step. It should be noted that if the length of the generated text does not actually have that many time steps, a preset character will be generated for the part exceeding the length to represent padding.

示例性地,上文所提到BERT Large模型输出的N×768维的特征矩阵,编码器接收这个特征矩阵后返回一个维度为1×256的向量;这个向量之后分别接入两个全连接层,两个全连接层分别输出两个大小为1×256的向量,这两个输出就是均值和方差。基于均值和方差确定一个正态分布,在正态分布进行采样,获得采样编码,将采样编码加上一个方差后输入到解码器中,解码器会逐字符的生成增量文本。需要说明的是,本申请实施例能够生成增量文本,是因为对采样编码加上了方差,所以不会生成完全一样的增量文本。Exemplarily, for the N×768-dimensional feature matrix output by the BERT Large model mentioned above, the encoder returns a vector with a dimension of 1×256 after receiving this feature matrix; this vector is then connected to two fully connected layers respectively. , the two fully connected layers output two vectors of size 1×256 respectively, and these two outputs are the mean and variance. Determine a normal distribution based on the mean and variance, sample the normal distribution, obtain the sample code, add a variance to the sample code and input it into the decoder, and the decoder will generate incremental text character by character. It should be noted that, the embodiment of the present application can generate incremental text because variance is added to the sampling code, so the exact same incremental text will not be generated.

在上述示例中,一方面,使用BERT模型输出的高维文本向量蕴含了极为丰富的信息量,非常适合于VAE的编码器将其加工为语义编码,另一方面,VAE计算出的分布依赖于输入的变量,所有对这个分布的采样都会生成与输入相似或相关的输出,其本身可以帮助生成文本时实现确定性,因而通过BERT模型和VAE结合的双重作用避免了生成文本时的随机性,大大提高了增量文本与待增量文本的相关度,从而可以大幅提升文本生成的质量。In the above example, on the one hand, the high-dimensional text vector output by the BERT model contains extremely rich information, which is very suitable for the encoder of VAE to process it into semantic encoding. On the other hand, the distribution calculated by VAE depends on For the input variable, all sampling of this distribution will generate an output similar or related to the input, which itself can help achieve determinism when generating text, thus avoiding the randomness when generating text through the dual role of the BERT model and VAE combination, The correlation between the incremental text and the text to be incremented is greatly improved, so that the quality of text generation can be greatly improved.

可以理解的是,在利用VAE进行文本增量之前,需要完成对VAE的训练。It is understandable that the training of the VAE needs to be completed before utilizing the VAE for text increment.

在本申请一非限制性示例中,获取到用于训练模型的大规模语料集后,先对语料集中的语料进行文本主题分类,再针对每个类别的语料,分别训练一个VAE,从而得到多个对应不同文本主题的VAE。In a non-limiting example of the present application, after obtaining a large-scale corpus for training the model, first classify the text topics on the corpus in the corpus, and then train a VAE for each category of corpus, so as to obtain multiple VAEs corresponding to different text topics.

在本申请另一非限制性示例中,获取到用于训练模型的大规模语料集后,先基于语料集中的语料训练一个基础VAE;然后,在对语料集中的语料进行文本主题分类的基础上,针对每个类别的语料,基于基础VAE进行再训练,得到一个VAE,从而得到多个对应不同文本主题的VAE。In another non-limiting example of the present application, after obtaining a large-scale corpus for training the model, a basic VAE is first trained based on the corpus in the corpus; then, on the basis of text topic classification on the corpus in the corpus , for each category of corpus, retrain based on the basic VAE to obtain a VAE, thereby obtaining multiple VAEs corresponding to different text topics.

可以理解的是,在上述两个非限制性示例中,为了提高VAE文本增量结果的准确度,针对每种文本主题,语料集中都有对应的大规模语料。It can be understood that, in the above two non-limiting examples, in order to improve the accuracy of the VAE text incremental results, for each text topic, there is a corresponding large-scale corpus in the corpus.

本申请实施例通过先提取待增量文本的特征矩阵,并确定待增量文本的文本主题,再结合与文本主题对应的VAE生成增量文本。一方面,利用与文本主题对应的VAE生成增量文本,不同的主题设置一个不同的VAE;另一方面,由于VAE计算出的分布依赖于输入的变量,所有对这个分布的采样都会生成与输入相似或相关的输出,其本身可以帮助生成文本时实现确定性,因而通过这两方面的双重作用就避免了生成文本时的完全随机性,提高了增量文本与待增量文本的相关度,从而可以大幅提升文本生成的质量。In this embodiment of the present application, the feature matrix of the text to be incremented is first extracted, the text subject of the text to be incremented is determined, and then the incremented text is generated in combination with the VAE corresponding to the text subject. On the one hand, the incremental text is generated using the VAE corresponding to the text topic, and a different VAE is set for different topics; on the other hand, since the distribution calculated by the VAE depends on the input variables, all sampling of this distribution will generate the same value as the input Similar or related outputs can help to achieve certainty when generating text. Therefore, through the dual effects of these two aspects, the complete randomness when generating text is avoided, and the correlation between the incremental text and the text to be incremented is improved. This can greatly improve the quality of text generation.

应理解,上述实施例中各步骤的序号的大小并不意味着执行顺序的先后,各过程的执行顺序应以其功能和内在逻辑确定,而不应对本申请实施例的实施过程构成任何限定。It should be understood that the size of the sequence numbers of the steps in the above embodiments does not mean the sequence of execution, and the execution sequence of each process should be determined by its function and internal logic, and should not constitute any limitation to the implementation process of the embodiments of the present application.

对应于上文实施例所述的文本的增量方法,图5示出了本申请实施例提供的文本的增量装置的结构框图,为了便于说明,仅示出了与本申请实施例相关的部分。Corresponding to the text increment method described in the above embodiment, FIG. 5 shows a structural block diagram of the text increment apparatus provided by the embodiment of the present application. part.

参照图5,该装置包括:Referring to Figure 5, the device includes:

获取模块51,用于获取待增量文本;an acquisition module 51, for acquiring the text to be incremented;

提取模块52,用于对所述待增量文本进行特征提取,获得所述待增量文本对应的特征矩阵;an extraction module 52, configured to perform feature extraction on the text to be incremented, and obtain a feature matrix corresponding to the text to be incremented;

确定模块53,用于确定所述待增量文本的文本主题;A determination module 53, configured to determine the text topic of the text to be incremented;

增量模块54,用于将所述特征矩阵输入与所述文本主题对应的变分自编码器,获得所述待增量文本的增量文本。The increment module 54 is configured to input the feature matrix into a variational autoencoder corresponding to the text topic to obtain the increment text of the text to be incremented.

其中,所述提取模块52,具体用于:Wherein, the extraction module 52 is specifically used for:

通过预设的词向量模型将所述待增量文本转换成特征矩阵。The text to be incremented is converted into a feature matrix through a preset word vector model.

其中,所述提取模块52,具体用于:Wherein, the extraction module 52 is specifically used for:

通过预设的BERT模型对所述待增量文本进行特征提取,获得所述待增量文本对应的特征矩阵。Feature extraction is performed on the text to be incremented by using a preset BERT model, and a feature matrix corresponding to the text to be incremented is obtained.

其中,所述提取模块52,具体用于:Wherein, the extraction module 52 is specifically used for:

通过预设的BERT模型将所述待增量文本转换为N×768维的特征矩阵,预设的所述BERT模型包括24层编码层;其中,所述待增量文本包括N个字符,N为正整数。The text to be incremented is converted into an N×768-dimensional feature matrix by a preset BERT model, and the preset BERT model includes 24 coding layers; wherein the text to be incremented includes N characters, N is a positive integer.

其中,所述提取模块52,具体用于:Wherein, the extraction module 52 is specifically used for:

获取所述待增量文本的关键词;Obtain the keywords of the text to be incremented;

获取每个所述关键词对应的特征向量;obtaining a feature vector corresponding to each of the keywords;

将所有所述关键词对应的所述特征向量进行组合,生成特征矩阵。The feature vectors corresponding to all the keywords are combined to generate a feature matrix.

其中,所述增量模块54,具体用于:Wherein, the increment module 54 is specifically used for:

将所述特征矩阵输入与所述文本主题对应的变分自编码器的编码器,得到所述特征矩阵的均值和方差;Inputting the feature matrix into an encoder of a variational autoencoder corresponding to the text topic, to obtain the mean and variance of the feature matrix;

根据所述均值和所述方差确定正态分布,从所述正态分布中进行采样获得采样编码;Determine a normal distribution according to the mean value and the variance, and perform sampling from the normal distribution to obtain a sampling code;

将所述采样编码输入到变分自编码器的解码器中生成所述待增量文本的增量文本。The sample code is input into the decoder of the variational autoencoder to generate the incremental text of the text to be incremented.

需要说明的是,上述模块/单元之间的信息交互、执行过程等内容,由于与本申请方法实施例基于同一构思,其具体功能及带来的技术效果,具体可参见方法实施例部分,此处不再赘述。It should be noted that the information exchange, execution process and other contents between the above modules/units are based on the same concept as the method embodiments of the present application. For specific functions and technical effects, please refer to the method embodiments section. It is not repeated here.

所属领域的技术人员可以清楚地了解到,为了描述的方便和简洁,仅以上述各功能单元、模块的划分进行举例说明,实际应用中,可以根据需要而将上述功能分配由不同的功能单元、模块完成,即将所述装置的内部结构划分成不同的功能单元或模块,以完成以上描述的全部或者部分功能。实施例中的各功能单元、模块可以集成在一个处理单元中,也可以是各个单元单独物理存在,也可以两个或两个以上单元集成在一个单元中,上述集成的单元既可以采用硬件的形式实现,也可以采用软件功能单元的形式实现。另外,各功能单元、模块的具体名称也只是为了便于相互区分,并不用于限制本申请的保护范围。上述系统中单元、模块的具体工作过程,可以参考前述方法实施例中的对应过程,在此不再赘述。Those skilled in the art can clearly understand that, for the convenience and simplicity of description, only the division of the above-mentioned functional units and modules is used as an example. Module completion, that is, dividing the internal structure of the device into different functional units or modules to complete all or part of the functions described above. Each functional unit and module in the embodiment may be integrated in one processing unit, or each unit may exist physically alone, or two or more units may be integrated in one unit, and the above-mentioned integrated units may adopt hardware. It can also be realized in the form of software functional units. In addition, the specific names of the functional units and modules are only for the convenience of distinguishing from each other, and are not used to limit the protection scope of the present application. For the specific working processes of the units and modules in the above-mentioned system, reference may be made to the corresponding processes in the foregoing method embodiments, which will not be repeated here.

图6为本申请一实施例提供的终端设备的结构示意图。如图6所示,该实施例的终端设备6包括:至少一个处理器60(图6中仅示出一个处理器)、存储器61以及存储在所述存储器61中并可在所述至少一个处理器60上运行的计算机程序62,所述处理器60执行所述计算机程序62时实现上述各个方法实施例中的步骤。FIG. 6 is a schematic structural diagram of a terminal device provided by an embodiment of the present application. As shown in FIG. 6 , the terminal device 6 in this embodiment includes: at least one processor 60 (only one processor is shown in FIG. 6 ), a memory 61 , and a memory 61 that is stored in the memory 61 and can be processed in the at least one processor A computer program 62 running on the processor 60, the processor 60 implements the steps in each of the above method embodiments when the computer program 62 is executed.

本申请实施例还提供了一种计算机可读存储介质,所述计算机可读存储介质存储有计算机程序,所述计算机程序被处理器执行时实现可实现上述各个方法实施例中的步骤。Embodiments of the present application further provide a computer-readable storage medium, where a computer program is stored in the computer-readable storage medium, and when the computer program is executed by a processor, the steps in the foregoing method embodiments can be implemented.

本申请实施例提供了一种计算机程序产品,当计算机程序产品在移动终端上运行时,使得移动终端执行时实现可实现上述各个方法实施例中的步骤。The embodiments of the present application provide a computer program product, when the computer program product runs on a mobile terminal, the steps in the foregoing method embodiments can be implemented when the mobile terminal executes the computer program product.

所述集成的单元如果以软件功能单元的形式实现并作为独立的产品销售或使用时,可以存储在一个计算机可读取存储介质中。基于这样的理解,本申请实现上述实施例方法中的全部或部分流程,可以通过计算机程序来指令相关的硬件来完成,所述的计算机程序可存储于一计算机可读存储介质中,该计算机程序在被处理器执行时,可实现上述各个方法实施例的步骤。其中,所述计算机程序包括计算机程序代码,所述计算机程序代码可以为源代码形式、对象代码形式、可执行文件或某些中间形式等。所述计算机可读介质至少可以包括:能够将计算机程序代码携带到拍照装置/终端设备的任何实体或装置、记录介质、计算机存储器、只读存储器(Read-Only Memory,ROM)、随机存取存储器(Random AccessMemory,RAM)、电载波信号、电信信号以及软件分发介质。例如U盘、移动硬盘、磁碟或者光盘等。在某些司法管辖区,根据立法和专利实践,计算机可读介质不可以是电载波信号和电信信号。The integrated unit, if implemented in the form of a software functional unit and sold or used as an independent product, may be stored in a computer-readable storage medium. Based on this understanding, the present application realizes all or part of the processes in the methods of the above embodiments, which can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a computer-readable storage medium. When executed by a processor, the steps of each of the above method embodiments can be implemented. Wherein, the computer program includes computer program code, and the computer program code may be in the form of source code, object code, executable file or some intermediate form, and the like. The computer-readable medium may include at least: any entity or device capable of carrying computer program codes to the photographing device/terminal device, recording medium, computer memory, read-only memory (ROM), random access memory (Random Access Memory, RAM), electrical carrier signals, telecommunication signals, and software distribution media. For example, U disk, mobile hard disk, disk or CD, etc. In some jurisdictions, under legislation and patent practice, computer readable media may not be electrical carrier signals and telecommunications signals.

在上述实施例中,对各个实施例的描述都各有侧重,某个实施例中没有详述或记载的部分,可以参见其它实施例的相关描述。In the foregoing embodiments, the description of each embodiment has its own emphasis. For parts that are not described or described in detail in a certain embodiment, reference may be made to the relevant descriptions of other embodiments.

本领域普通技术人员可以意识到,结合本文中所公开的实施例描述的各示例的单元及算法步骤,能够以电子硬件、或者计算机软件和电子硬件的结合来实现。这些功能究竟以硬件还是软件方式来执行,取决于技术方案的特定应用和设计约束条件。专业技术人员可以对每个特定的应用来使用不同方法来实现所描述的功能,但是这种实现不应认为超出本申请的范围。Those of ordinary skill in the art can realize that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Skilled artisans may implement the described functionality using different methods for each particular application, but such implementations should not be considered beyond the scope of this application.

在本申请所提供的实施例中,应该理解到,所揭露的装置/网络设备和方法,可以通过其它的方式实现。例如,以上所描述的装置/网络设备实施例仅仅是示意性的,例如,所述模块或单元的划分,仅仅为一种逻辑功能划分,实际实现时可以有另外的划分方式,例如多个单元或组件可以结合或者可以集成到另一个系统,或一些特征可以忽略,或不执行。另一点,所显示或讨论的相互之间的耦合或直接耦合或通讯连接可以是通过一些接口,装置或单元的间接耦合或通讯连接,可以是电性,机械或其它的形式。In the embodiments provided in this application, it should be understood that the disclosed apparatus/network device and method may be implemented in other manners. For example, the apparatus/network device embodiments described above are only illustrative. For example, the division of the modules or units is only a logical function division. In actual implementation, there may be other division methods, such as multiple units. Or components may be combined or may be integrated into another system, or some features may be omitted, or not implemented. On the other hand, the shown or discussed mutual coupling or direct coupling or communication connection may be through some interfaces, indirect coupling or communication connection of devices or units, and may be in electrical, mechanical or other forms.

所述作为分离部件说明的单元可以是或者也可以不是物理上分开的,作为单元显示的部件可以是或者也可以不是物理单元,即可以位于一个地方,或者也可以分布到多个网络单元上。可以根据实际的需要选择其中的部分或者全部单元来实现本实施例方案的目的。The units described as separate components may or may not be physically separated, and components displayed as units 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 units may be selected according to actual needs to achieve the purpose of the solution in this embodiment.

以上所述实施例仅用以说明本申请的技术方案,而非对其限制;尽管参照前述实施例对本申请进行了详细的说明,本领域的普通技术人员应当理解:其依然可以对前述各实施例所记载的技术方案进行修改,或者对其中部分技术特征进行等同替换;而这些修改或者替换,并不使相应技术方案的本质脱离本申请各实施例技术方案的精神和范围,均应包含在本申请的保护范围之内。The above-mentioned embodiments are only used to illustrate the technical solutions of the present application, but not to limit them; although the present application has been described in detail with reference to the above-mentioned embodiments, those of ordinary skill in the art should understand that: it can still be used for the above-mentioned implementations. The technical solutions described in the examples are modified, or some technical features thereof are equivalently replaced; and these modifications or replacements do not make the essence of the corresponding technical solutions deviate from the spirit and scope of the technical solutions in the embodiments of the application, and should be included in the within the scope of protection of this application.

Claims (10)

1.一种文本增量方法,其特征在于,包括:1. a text increment method, is characterized in that, comprises: 获取待增量文本;Get the text to be incremented; 对所述待增量文本进行特征提取,获得所述待增量文本对应的特征矩阵;Perform feature extraction on the text to be incremented to obtain a feature matrix corresponding to the text to be incremented; 确定所述待增量文本的文本主题;determining the text topic of the text to be incremented; 将所述特征矩阵输入与所述文本主题对应的变分自编码器,获得所述待增量文本的增量文本。Inputting the feature matrix into a variational autoencoder corresponding to the text topic to obtain the incremental text of the text to be incremented. 2.如权利要求1所述的文本增量方法,其特征在于,对所述待增量文本进行特征提取,获得所述待增量文本对应的特征矩阵,包括:2. The text increment method according to claim 1, characterized in that, performing feature extraction on the text to be incremented to obtain a feature matrix corresponding to the text to be incremented, comprising: 通过预设的词向量模型将所述待增量文本转换成特征矩阵。The text to be incremented is converted into a feature matrix through a preset word vector model. 3.如权利要求2所述的文本增量方法,其特征在于,所述通过预设的词向量模型将所述待增量文本转换成特征矩阵,包括:3. The text increment method as claimed in claim 2, wherein, converting the text to be incremented into a feature matrix by a preset word vector model, comprising: 通过预设的BERT模型对所述待增量文本进行特征提取,获得所述待增量文本对应的特征矩阵。Feature extraction is performed on the text to be incremented by using a preset BERT model, and a feature matrix corresponding to the text to be incremented is obtained. 4.如权利要求3所述的文本增量方法,其特征在于,所述通过预设的BERT模型对所述待增量文本进行特征提取,获得所述待增量文本对应的特征矩阵,包括:4. The text increment method according to claim 3, wherein the feature extraction is performed on the text to be incremented by a preset BERT model, and a feature matrix corresponding to the text to be incremented is obtained, comprising: : 通过预设的BERT模型将所述待增量文本转换为N×768维的特征矩阵,预设的所述BERT模型包括24层编码层;其中,所述待增量文本包括N个字符,N为正整数。The text to be incremented is converted into an N×768-dimensional feature matrix by a preset BERT model, and the preset BERT model includes 24 coding layers; wherein the text to be incremented includes N characters, N is a positive integer. 5.如权利要求2所述的文本增量方法,其特征在于,通过预设的词向量模型将所述待增量文本转换成特征矩阵,包括:5. The text increment method according to claim 2, wherein the text to be incremented is converted into a feature matrix by a preset word vector model, comprising: 获取所述待增量文本的关键词;Obtain the keywords of the text to be incremented; 获取每个所述关键词对应的特征向量;obtaining a feature vector corresponding to each of the keywords; 将所有所述关键词对应的所述特征向量进行组合,生成特征矩阵。The feature vectors corresponding to all the keywords are combined to generate a feature matrix. 6.如权利要求1所述的文本增量方法,其特征在于,所述将所述特征矩阵输入与所述文本主题对应的变分自编码器,获得所述待增量文本的增量文本,包括:6. The text increment method according to claim 1, wherein the feature matrix is input into a variational autoencoder corresponding to the text topic to obtain the increment text of the text to be incremented ,include: 将所述特征矩阵输入与所述文本主题对应的变分自编码器的编码器,得到所述特征矩阵的均值和方差;Inputting the feature matrix into an encoder of a variational autoencoder corresponding to the text topic, to obtain the mean and variance of the feature matrix; 根据所述均值和所述方差确定正态分布,从所述正态分布中进行采样获得采样编码;Determine a normal distribution according to the mean value and the variance, and perform sampling from the normal distribution to obtain a sampling code; 将所述采样编码输入到变分自编码器的解码器中生成所述待增量文本的增量文本。The sample code is input into the decoder of the variational autoencoder to generate the incremental text of the text to be incremented. 7.一种文本增量装置,其特征在于,包括:7. A text increment device, characterized in that, comprising: 获取模块,用于获取待增量文本;Get module, used to get the text to be incremented; 提取模块,用于对所述待增量文本进行特征提取,获得所述待增量文本对应的特征矩阵;an extraction module, configured to perform feature extraction on the text to be incremented to obtain a feature matrix corresponding to the text to be incremented; 确定模块,用于确定所述待增量文本的文本主题;a determining module, used for determining the text topic of the text to be incremented; 增量模块,用于将所述特征矩阵输入与所述文本主题对应的变分自编码器,获得所述待增量文本的增量文本。an increment module, configured to input the feature matrix into a variational autoencoder corresponding to the text topic to obtain an increment text of the text to be incremented. 8.如权利要求7所述的文本增量装置,其特征在于,所述提取模块,具体用于:8. The text increment device according to claim 7, wherein the extraction module is specifically used for: 通过预设的BERT模型对所述待增量文本进行特征提取,获得所述待增量文本对应的特征矩阵。Feature extraction is performed on the text to be incremented by using a preset BERT model, and a feature matrix corresponding to the text to be incremented is obtained. 9.一种终端设备,包括存储器、处理器以及存储在所述存储器中并可在所述处理器上运行的计算机程序,其特征在于,所述处理器执行所述计算机程序时实现如权利要求1至6任一项所述的文本增量方法。9. A terminal device, comprising a memory, a processor and a computer program stored in the memory and running on the processor, wherein the processor implements the computer program as claimed in the claims when executing the computer program The text increment method described in any one of 1 to 6. 10.一种计算机可读存储介质,所述计算机可读存储介质存储有计算机程序,其特征在于,所述计算机程序被处理器执行时实现如权利要求1至6任一项所述的文本增量方法。10. A computer-readable storage medium storing a computer program, characterized in that, when the computer program is executed by a processor, the text extension according to any one of claims 1 to 6 is implemented. quantitative method.
CN202010019294.8A 2020-01-08 2020-01-08 Text increment method, device and terminal equipment Active CN111241815B (en)

Priority Applications (2)

Application Number Priority Date Filing Date Title
CN202010019294.8A CN111241815B (en) 2020-01-08 2020-01-08 Text increment method, device and terminal equipment
PCT/CN2020/136069 WO2021139486A1 (en) 2020-01-08 2020-12-14 Text incrementation method and apparatus, and terminal device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010019294.8A CN111241815B (en) 2020-01-08 2020-01-08 Text increment method, device and terminal equipment

Publications (2)

Publication Number Publication Date
CN111241815A true CN111241815A (en) 2020-06-05
CN111241815B CN111241815B (en) 2025-06-17

Family

ID=70872435

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010019294.8A Active CN111241815B (en) 2020-01-08 2020-01-08 Text increment method, device and terminal equipment

Country Status (2)

Country Link
CN (1) CN111241815B (en)
WO (1) WO2021139486A1 (en)

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112527969A (en) * 2020-12-22 2021-03-19 上海浦东发展银行股份有限公司 Incremental intention clustering method, device, equipment and storage medium
WO2021139486A1 (en) * 2020-01-08 2021-07-15 平安科技(深圳)有限公司 Text incrementation method and apparatus, and terminal device
CN116894436A (en) * 2023-09-06 2023-10-17 神州医疗科技股份有限公司 Data enhancement method and system based on medical named entity recognition

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108984524A (en) * 2018-07-05 2018-12-11 北京理工大学 A kind of title generation method based on variation neural network topic model
CN109582952A (en) * 2018-10-31 2019-04-05 腾讯科技(深圳)有限公司 Poem generation method, device, computer equipment and medium

Family Cites Families (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108763284B (en) * 2018-04-13 2021-07-20 华南理工大学 A Question Answering System Implementation Method Based on Deep Learning and Topic Model
CN109886388B (en) * 2019-01-09 2024-03-22 平安科技(深圳)有限公司 Training sample data expansion method and device based on variation self-encoder
CN109918477B (en) * 2019-02-18 2021-02-12 华南理工大学 Distributed retrieval resource library selection method based on variational self-encoder
CN110196930B (en) * 2019-05-22 2021-08-24 山东大学 A kind of multimodal customer service automatic reply method and system
CN110516055A (en) * 2019-08-16 2019-11-29 西北工业大学 A cross-platform intelligent question answering method for teaching tasks combined with BERT
CN111241815B (en) * 2020-01-08 2025-06-17 平安科技(深圳)有限公司 Text increment method, device and terminal equipment

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108984524A (en) * 2018-07-05 2018-12-11 北京理工大学 A kind of title generation method based on variation neural network topic model
CN109582952A (en) * 2018-10-31 2019-04-05 腾讯科技(深圳)有限公司 Poem generation method, device, computer equipment and medium

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
付雨蛟: "基于融合主题信息的深度VAE算法的蒙古文短文本语义相似度计算", 中国优秀硕士学位论文全文数据库信息科技辑, no. 01, 15 January 2019 (2019-01-15), pages 138 - 5381 *

Cited By (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2021139486A1 (en) * 2020-01-08 2021-07-15 平安科技(深圳)有限公司 Text incrementation method and apparatus, and terminal device
CN112527969A (en) * 2020-12-22 2021-03-19 上海浦东发展银行股份有限公司 Incremental intention clustering method, device, equipment and storage medium
CN112527969B (en) * 2020-12-22 2022-11-15 上海浦东发展银行股份有限公司 Incremental intention clustering method, device, equipment and storage medium
CN116894436A (en) * 2023-09-06 2023-10-17 神州医疗科技股份有限公司 Data enhancement method and system based on medical named entity recognition
CN116894436B (en) * 2023-09-06 2023-12-15 神州医疗科技股份有限公司 Data enhancement method and system based on medical named entity recognition

Also Published As

Publication number Publication date
WO2021139486A1 (en) 2021-07-15
CN111241815B (en) 2025-06-17

Similar Documents

Publication Publication Date Title
CN113378556B (en) Method and device for extracting text keywords
CN107943860B (en) Model training method, text intention recognition method and text intention recognition device
CN109783798A (en) Method, apparatus, terminal and the storage medium of text information addition picture
CN111125523B (en) Searching method, searching device, terminal equipment and storage medium
CN110209784B (en) Message interaction method, computer device and storage medium
WO2021159877A1 (en) Question answering method and apparatus
CN111177180A (en) Data query method and device and electronic equipment
CN113220848B (en) Automatic question-answering method, device and intelligent device for human-computer interaction
CN112214605B (en) A text classification method and related device
CN111597804B (en) Method and related device for training entity recognition model
CN108334196B (en) File processing method and mobile terminal
CN109815363A (en) Generation method, device, terminal and the storage medium of lyrics content
WO2024036616A1 (en) Terminal-based question and answer method and apparatus
CN111241815A (en) Text increment method and device and terminal equipment
CN112685578A (en) Multimedia information content providing method and device
CN112488157B (en) Dialogue state tracking method and device, electronic equipment and storage medium
CN110826098A (en) Information processing method and electronic equipment
CN112328783B (en) A method for determining a summary and a related device
CN112307198B (en) Method and related device for determining abstract of single text
WO2021073434A1 (en) Object behavior recognition method and apparatus, and terminal device
CN114328908A (en) Question and answer sentence quality inspection method and device and related products
CN113569043B (en) A text category determination method and related device
CN111353422B (en) Information extraction method, device and electronic equipment
CN115116434A (en) Application realization method, device, storage medium and electronic device
CN113535926B (en) Active dialogue method and device and voice terminal

Legal Events

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