[go: up one dir, main page]
More Web Proxy on the site http://driver.im/

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.)
Pending
Application number
CN202010019294.8A
Other languages
Chinese (zh)
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/CN111241815A/en
Publication of CN111241815A publication Critical patent/CN111241815A/en
Priority to PCT/CN2020/136069 priority patent/WO2021139486A1/en
Pending legal-status Critical Current

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 or dialogue systems

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)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
  • Machine Translation (AREA)

Abstract

The application is applicable to the technical field of natural language processing, and provides a text increment method, which comprises the following steps: acquiring a text to be incremented; extracting features of the text to be incremented to obtain a feature matrix corresponding to the text to be incremented; determining a text subject of the text to be increased; and inputting the feature matrix into a variational self-encoder corresponding to the text theme to obtain the incremental text of the text to be incremented. The method and the device improve the relevancy of the incremental text and the text to be incremented, thereby greatly improving the accuracy of text generation.

Description

Text increment method and device and terminal equipment
Technical Field
The present application belongs to the technical field of natural language processing, and in particular, to a text increment method, apparatus, terminal device, and computer-readable storage medium.
Background
Currently, in many artificial intelligence fields such as question-answering systems, machine translation, etc., there is a need to generate other text data from original text data. For example, in a human-machine question-and-answer system, when a user asks a robot, the answer of the robot needs to be related to the question of the user, 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 traditional text generation model has the challenge that the generated text is too random, so that a new text incremental scheme needs to be provided.
Disclosure of Invention
The embodiment of the application provides a text increment method, a text increment device, terminal equipment and a computer readable storage medium, provides a new text increment scheme, and improves the correlation degree of an increment text and a text to be incremented.
In a first aspect, an embodiment of the present application provides a text increment method, including:
acquiring a text to be incremented;
extracting features of the text to be incremented to obtain a feature matrix corresponding to the text to be incremented;
determining a text subject of the text to be increased;
and inputting the feature matrix into a variational self-encoder corresponding to the text theme 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 apparatus, including:
the acquisition module is used for acquiring the text to be incremented;
the extraction module is used for extracting the features of the text to be incremented to obtain a feature matrix corresponding to the text to be incremented;
the determining module is used for determining the text theme of the text to be increased;
and the increment module is used for inputting the feature matrix into a variational self-encoder corresponding to the text theme to obtain the 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, the processor implementing the text augmentation method according to the first aspect when executing the computer program.
In a fourth aspect, the present application provides a computer-readable storage medium, which stores a computer program, and when the computer program is executed by a processor, the computer program implements the text incremental method according to the first aspect.
In a fifth aspect, the present application provides a computer program product, which when run on a terminal device, causes the terminal device to execute the text increment method according to the first aspect.
In the embodiment of the application, the text theme of the text to be incremented is determined by extracting the feature matrix of the text to be incremented, and then the incremental text is generated by combining the VAE corresponding to the text theme. On one hand, an incremental text is generated by utilizing the VAE corresponding to the text theme, and different VAEs are set for different themes; on the other hand, the distribution calculated by the VAE depends on the input variable, all samples of the distribution generate output similar to or related to the input, and the output can help to realize certainty when generating the text, so that the complete randomness when generating the text is avoided through the double effects of the two aspects, the correlation degree of the incremental text and the text to be incremented is improved, and the quality of text generation can be greatly improved.
Drawings
In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings needed to be used in the embodiments or the prior art descriptions will be briefly described below, and it is obvious that the drawings in the following description are only some embodiments of the present application, and it is obvious for those skilled in the art to obtain other drawings based on these drawings without inventive exercise.
Fig. 1 is a schematic structural diagram of a mobile phone to which a text increment method provided in an embodiment of the present application is applied;
FIG. 2 is a flowchart illustrating a text increment method according to an embodiment of the present application;
FIG. 3 is a flowchart illustrating step 202 of a text increment method according to an embodiment of the present application;
FIG. 4 is a schematic structural diagram of a VAE in a text increment method according to an embodiment of the present application;
FIG. 5 is a schematic structural diagram of a text increment apparatus according to an embodiment of the present application;
fig. 6 is a schematic structural diagram of a terminal device to which the text increment method provided in an embodiment of the present application is applied.
Detailed Description
In the following description, for purposes of explanation and not limitation, specific details are set forth, such as particular system structures, techniques, etc. in order to provide a thorough understanding of the embodiments of the present application.
In order to make the technical solutions better understood by those skilled in the art, the technical solutions in the embodiments of the present application will be described below in detail and completely with reference to the drawings in the embodiments of the present application, and it is obvious that the described embodiments are only some embodiments of the present application, but not all embodiments. All other embodiments obtained by a person of ordinary skill in the art based on the embodiments in the present application shall fall within the protection scope of the present application without any creative effort. It should be noted that the embodiments and features of the embodiments in the present application may be combined with each other without conflict.
In the following description, for purposes of explanation and not limitation, specific details are set forth, such as particular system structures, techniques, etc. in order to provide a thorough understanding of the embodiments of the present application. It will be apparent, however, to one skilled in the art that the present application may be practiced in other embodiments that depart from 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 will be understood that the terms "comprises" and/or "comprising," when used in this specification and the appended claims, specify the presence of stated features, integers, steps, operations, elements, and/or components, but do not preclude the presence or addition of one or more other features, integers, steps, operations, elements, components, and/or groups thereof.
It should also be understood that the term "and/or" as used in this specification and the appended claims refers to and includes any and all possible combinations of one or more of the associated listed items.
As used in this specification and the appended claims, the term "if" may be interpreted contextually as "when", "upon" or "in response to" determining "or" in response to detecting ". Similarly, the phrase "if it is determined" or "if a [ described condition or event ] is detected" may be interpreted contextually to mean "upon determining" or "in response to determining" or "upon detecting [ described condition or event ]" or "in response to detecting [ described condition or event ]".
Furthermore, in the description of the present application and the appended claims, the terms "first," "second," "third," and the like are used for distinguishing between descriptions and not necessarily for describing or implying relative importance.
Reference throughout this specification to "one embodiment" or "some embodiments," or the like, means 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," or the like, in various places throughout this specification are not necessarily all referring to the same embodiment, but rather "one or more but not all embodiments" unless specifically stated otherwise. The terms "comprising," "including," "having," and variations thereof mean "including, but not limited to," unless expressly specified otherwise.
The text increment method provided by the embodiment of the application can be applied to terminal devices such as a mobile phone, a tablet personal computer, a wearable device, a vehicle-mounted device, an Augmented Reality (AR)/Virtual Reality (VR) device, a notebook computer, an ultra-mobile personal computer (UMPC), a netbook, a Personal Digital Assistant (PDA), or a server, and the specific type of the terminal device is not limited at all. The server includes, but is not limited to, an independent server, a cloud server, a distributed server, a server cluster, and the like.
For example, the end devices may be Stations (ST) in a WLAN, such as cellular phones, cordless phones, Session Initiation Protocol (SIP) phones, Wireless Local Loop (WLL) stations, PDAs, handheld devices with wireless communication capabilities, computing devices or other processing devices connected to wireless modems, vehicle mounted devices, vehicle networking terminals, computers, laptops, handheld communication devices, handheld computing devices, satellite radios, wireless modem cards, Set Top Boxes (STBs), Customer Premises Equipment (CPE), and/or other devices for communicating over a wireless system as well as next generation communication systems, for example, a Mobile terminal in a 5G Network or a Mobile terminal in a Public Land Mobile Network (PLMN) Network for future evolution, etc.
By way of example and not limitation, when the terminal device is a wearable device, the wearable device may also be a generic term for intelligently designing daily wearing by applying wearable technology, developing wearable devices, such as glasses, gloves, watches, clothing, shoes, and the like. A wearable device is a portable device that is worn directly on the body or integrated into the clothing or accessories of the user. The wearable device is not only a hardware device, but also realizes powerful functions through software support, data interaction and cloud interaction. The generalized wearable intelligent device has the advantages that the generalized wearable intelligent device is complete in function and large in size, can realize complete or partial functions without depending on a smart phone, such as a smart watch or smart glasses, and only is concentrated on a certain application function, and needs to be matched with other devices such as the smart phone for use, such as various smart bracelets for monitoring physical signs, smart jewelry and the like.
Take the terminal device as a mobile phone as an example. Fig. 1 is a block diagram illustrating a partial structure of a mobile phone according to an embodiment of the present disclosure. Referring to fig. 1, the cellular 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, a processor 180, and a power supply 190. Those skilled in the art will appreciate that the handset configuration shown in fig. 1 is not intended to be limiting and may include more or fewer components than those shown, or some components may be combined, or a different arrangement of components.
The following describes each component of the mobile phone in detail with reference to fig. 1:
the RF circuit 110 may be used for receiving and transmitting signals during information transmission and reception or during a call, and in particular, receives downlink information of a base station and then processes the received downlink information to the processor 180; in addition, the data for designing uplink is transmitted to the base station. Typically, the RF circuitry 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 communications. The wireless communication may use any communication standard or protocol, including but not limited to global system for Mobile communications (GSM), General Packet Radio Service (GPRS), Code Division Multiple Access (CDMA), Wideband Code Division Multiple Access (WCDMA), Long Term Evolution (LTE), email, and Short Messaging Service (SMS).
The memory 120 may be used to store software programs and modules, and the processor 180 executes various functional applications and data processing of the mobile phone by operating the software programs and modules stored in the memory 120. The memory 120 may mainly include a storage program area and a storage data area, wherein the storage program area may store an operating system, an application program (such as a sound playing function, an image playing function, etc.) required by at least one function, a Boot Loader (Boot Loader), and the like; the storage data area may store data (such as audio data, a phonebook, etc.) created according to the use of the cellular phone, and the like. Further, the 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 is understood that, in the embodiment of the present application, the memory 120 stores a program for text increment.
The input unit 130 may be used to receive input numeric or character information and generate key signal inputs related to user settings and function control of the cellular 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, may collect touch operations of a user on or near the touch panel 131 (e.g., operations of the user on or near the touch panel 131 using any suitable object or accessory such as a finger or a stylus pen), and drive the corresponding connection device according to a preset program. Alternatively, the touch panel 131 may include two parts, i.e., a touch detection device and a touch controller. The touch detection device detects the touch direction of a user, detects a signal brought by touch operation and transmits the signal to the touch controller; the touch controller receives touch information from the touch sensing device, converts the touch information into touch point coordinates, sends the touch point coordinates to the processor 180, and can receive and execute commands sent by the processor 180. In addition, the touch panel 131 may be implemented by various types such as a resistive type, a capacitive type, an infrared ray, and a surface acoustic wave. The input unit 130 may include other input devices 132 in addition to the touch panel 131. In particular, other input devices 132 may include, but are not limited to, one or more of a physical keyboard, function keys (such as volume control keys, switch keys, etc.), a trackball, a mouse, a joystick, and the like.
The display unit 140 may be used to display information input by a 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 (LCD), an Organic Light-Emitting Diode (OLED), or the like. Further, the touch panel 131 can cover the display panel 141, and when the touch panel 131 detects a touch operation on or near the touch panel 131, the touch operation is transmitted to the processor 180 to determine the type of the touch event, and then the processor 180 provides a corresponding visual output on the display panel 141 according to the type of the touch event. Although the touch panel 131 and the display panel 141 are shown as two separate components in fig. 1 to implement the input and output functions of the mobile phone, in some embodiments, the touch panel 131 and the display panel 141 may be integrated to implement the input and output functions of the mobile phone.
The handset 100 may also include at least one sensor 150, such as a light sensor, motion sensor, and other sensors. Specifically, the light sensor may include an ambient light sensor that adjusts the brightness of the display panel 141 according to the brightness of ambient light, and a proximity sensor that turns off the display panel 141 and/or the backlight when the mobile phone is moved to the ear. As one of the motion sensors, the accelerometer sensor can detect the magnitude of acceleration in each direction (generally, three axes), can detect the magnitude and direction of gravity when stationary, and can be used for applications of recognizing the posture of a mobile phone (such as horizontal and vertical screen switching, related games, magnetometer posture calibration), vibration recognition related functions (such as pedometer and tapping), and the like; as for other sensors such as a gyroscope, a barometer, a hygrometer, a thermometer, and an infrared sensor, which can be configured on the mobile phone, further description is omitted here.
Audio circuitry 160, speaker 161, microphone 162 may provide an audio interface between the user and the handset. The audio circuit 160 may transmit the electrical signal converted from the received audio data to the speaker 161, and convert the electrical signal into a sound signal for output by the speaker 161; on the other hand, the microphone 162 converts the collected sound signal into an electrical signal, which is received by the audio circuit 160 and converted into audio data, which is then processed by the audio data output processor 180 and then transmitted to, for example, another cellular phone via the RF circuit 110, or the audio data is output to the memory 120 for further processing.
WiFi belongs to short-distance wireless transmission technology, and the mobile phone can help a user to receive and send e-mails, browse webpages, access streaming media and the like through the WiFi module 170, and provides wireless broadband Internet access for the user. Although fig. 1 shows the WiFi module 170, it is understood that it does not belong to the essential constitution of the handset 100, and can be omitted entirely as needed within the scope not changing the essence of the invention.
The processor 180 is a control center of the mobile phone, connects various parts of the entire mobile phone by using various interfaces and lines, and performs various functions of the mobile phone and processes data by operating or executing software programs and/or modules stored in the memory 120 and calling data stored in the memory 120, thereby integrally monitoring the mobile phone. Alternatively, processor 180 may include one or more processing units; preferably, the processor 180 may integrate an application processor, which mainly handles operating systems, user interfaces, application programs, etc., and a modem processor, which mainly handles wireless communications. It will be appreciated that the modem processor described above may not be integrated into the processor 180. It is understood that, in the embodiment of the present application, a program for text increment is stored in the memory 120, and the processor 180 may be configured to call and execute the program for text increment stored in the memory 120, so as to implement the text increment method of the embodiment of the present application.
The handset 100 also includes a power supply 190 (e.g., a battery) for powering the various components, which may preferably be logically connected to the processor 180 via a power management system, such that the power management system may be used to manage charging, discharging, and power consumption.
Although not shown, the handset 100 may also include a camera. Optionally, the position of the camera on the mobile phone 100 may be front-located, rear-located, or built-in (the camera body may be extended when in use), which is not limited in this embodiment of the present application.
Optionally, the mobile phone 100 may include a single camera, a dual camera, or a triple camera, which is not limited in this embodiment. Cameras include, but are not limited to, wide angle cameras, tele cameras, or depth cameras, among others.
For example, the cell phone 100 may include three cameras, one being a main camera, one being a wide camera, and one being a tele camera.
Optionally, when the mobile phone 100 includes a plurality of cameras, the plurality of cameras may be all front-mounted, all rear-mounted, all built-in, at least partially front-mounted, at least partially rear-mounted, at least partially built-in, and the like, which is not limited in this embodiment of the application.
In addition, although not shown, the mobile phone 100 may further include a bluetooth module or the like, which is not described herein.
Fig. 2 shows a flowchart of an implementation of a text increment method according to an embodiment of the present application. The text increment method is applied to terminal equipment. By way of example and not limitation, the text increment method may be applied to a handset 100 having the hardware structure described above. The text increment method comprises steps S201 to S204, and the specific implementation principle of each step is as follows.
S201, obtaining a text to be increased.
In the embodiment of the present application, the text to be incremented is an object for performing text incrementing, such as a sentence text.
The text to be added can be a text which is instantly input by a user through an input unit of the terminal equipment; the voice data can be acquired by the user through an audio acquisition unit of the terminal equipment; the method can also be used for instantly shooting pictures including texts by a user through a camera of the terminal equipment; the picture containing the text can be instantly scanned by the user through a scanning device of the terminal equipment; but also text that has been originally stored in the terminal device; and even texts acquired by the terminal device from other terminal devices through a wired or wireless network, and the like.
It should be noted that, for a picture including a text, the text in the picture needs to be extracted as a text to be incremented by activating a picture identification function of the terminal device; for voice data, a text in the voice data needs to be recognized as a text to be incremented by starting an audio-to-text function of the terminal device.
In a non-limiting use scenario of the application, after a user acquires a piece of voice data input by the user through an audio acquisition unit of the terminal device, an audio-to-text function is enabled to acquire a text input by the user, at this time, if the user wants to perform text increment, the user can enable a text increment function of the terminal device by clicking a specific physical key or a specific virtual key of the terminal device, and in this mode, the terminal device automatically processes the text input by the user according to the processes from step S202 to step S204 to obtain an increment text. It should be noted here that the order of inputting text by the user and clicking the key may be exchanged, that is, the key may be clicked first, then the text input by the user is acquired, and finally the text input by the user is automatically processed according to the processes from step S202 to step S204.
In another non-limiting usage scenario of the present application, when a user wants to increment a text that is already stored in a terminal device, a text increment function of the terminal device may be enabled by clicking a specific physical key or a virtual key, and a text to be incremented is selected, and then the terminal device may automatically process the selected text to be incremented according to the processes of step S202 to step S204 to obtain an increment text. It should be noted here that the order of clicking the key and selecting the text may be interchanged, that is, the text may be selected first and then the text increment function of the terminal device may be enabled.
S202, extracting the features of the text to be incremented to obtain a feature matrix corresponding to the text to be incremented.
Step S202 is a step of extracting features of the text to be incremented, and a feature matrix corresponding to the text to be incremented is obtained, so that the text is represented by a low-dimensional matrix.
In some embodiments of the present application, feature extraction may be performed on a text to be incremented through a word vector model, so as 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 by the word vector model.
Word vector models include, but are not limited to, word2vec (word to vector), ELMo, and BERT (bidirectional Encoder replication from transformations). In the embodiment of the present application, in step S202, the text in the real-world abstraction is converted into a vector or a matrix capable of performing mathematical formula operations by using the word vector model. The data is processed into data that can be processed by a machine, enabling the application.
It should be noted that before the word vector model is utilized, training of the word vector model needs to be completed, and pre-training is performed to generate a word vector. In addition, in the training process of the word vector model, in order to obtain a more accurate feature extraction result, punctuation marks in the text to be augmented can be reserved, and feature extraction is performed on the complete text to be augmented.
Illustratively, in order to enable unsupervised pre-training on a huge data set during the training process of the BERT model, 15% of the words in the training sentences used for training are randomly selected as the words to be masked during the training process. The covering design is used for enabling the BERT model to fill in the covered position and realize unsupervised training.
As a non-limiting example of the present application, step S202 includes: and performing feature extraction on the text to be incremented through a preset BERT model to obtain a feature matrix corresponding to the text to be incremented.
Exemplarily, the text to be incremented is converted into a feature matrix of nx768 dimensions by a preset BERT model, wherein the preset BERT model comprises 24 coding layers, that is, a BERT Large model is adopted, and the number of transform blocks in the model is 24; the text to be incremented comprises 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, and obviously, the feature matrix can reflect the semantic features of the text to be incremented.
For example, the text to be incremented is "I love my country! ", the number of words of a Chinese character including a punctuation mark is 7, and the number of words of a Chinese character not including a punctuation mark is 6.
Another exemplary, a BERT model including 12 coding layers, i.e., BERT Base model, in which the number of transform blocks is 12, is adopted.
As another non-limiting example of the present application, as shown in fig. 3, step S202 includes step S2021 to step S2023.
S2021, obtaining the keywords of the text to be increased.
And according to the part of speech of the word after word segmentation, removing non-characteristic words such as prepositions, orientation words, word vigor words and the like to obtain a keyword set of the text to be incremented.
In the step S2021, by obtaining the keywords of the text to be incremented, some noise data are filtered, so that the result accuracy is ensured, and meanwhile, the data amount is also appropriately reduced, the processing efficiency is improved, the system resource occupation is reduced, and the computational cost is reduced.
S2022, obtaining a feature vector corresponding to each keyword.
The terminal device prestores corresponding relations between the keywords and the feature vectors, and obtains the feature vectors corresponding to the keywords by searching the corresponding relations between the keywords and the feature vectors.
Before step S2022, a corresponding relationship between the keyword and the feature vector is established in advance, and the method for establishing the corresponding relationship is as follows:
firstly, the corpus of various channels is crawled through a web crawler technology and is arranged into a document set.
Then, performing word segmentation and part-of-speech tagging on each document by using an open-source word segmentation tool, then removing stop words according to a preset stop word dictionary, and removing non-characteristic words such as prepositions, direction words, inflight words and the like according to the part-of-speech of the segmented words to obtain a keyword set.
And finally, training the keyword set by using an open-source Word vector training tool Word2Vec to obtain feature vectors corresponding to different keywords, storing the corresponding relation between the keywords and the feature vectors, and storing the corresponding relation in a Word vector database. Illustratively, each feature vector has the same dimensions, and with N-dimensional (N being a positive integer) word vectors, each word vector has a value between 0 and 1, or-1 and 1.
The corresponding relation between the keywords and the characteristic vectors is established by the method. By searching the corresponding relation, the feature vector corresponding to the keyword can be obtained, so that each keyword is converted into the feature vector.
S2023, combining the feature vectors corresponding to all the keywords to generate a feature matrix.
Combining the feature vectors corresponding to all the keywords, namely splicing the feature vectors of all the keywords to generate a feature matrix.
For example, when the feature vector has dimensions of 1 × N and the predetermined number is M (M is a positive integer), the feature matrix obtained by combining M feature vectors having dimensions of 1 × N may have dimensions of M × N or may have dimensions of 1 × (M + N).
In some embodiments of the application, a deep learning network model is used for feature extraction of a text to be incremented, and a feature matrix corresponding to the text to be incremented is obtained.
The deep learning network model is used for extracting the characteristics of the text to be increased. And when the text to be incremented is input into the deep learning network model, the deep learning network model outputs a characteristic matrix corresponding to the text to be incremented. The deep learning network model can be a deep learning network model based on machine learning techniques, including but not limited to a deep convolutional neural network model, a deep residual convolutional neural network model (Res Net), and the like. The deep convolutional neural network model includes, but is not limited to, AlexNet, VGG-Net, DenseNet, and the like.
It can be appreciated that training of the deep learning network model needs to be completed before the deep learning network model is utilized. In the process of training the deep learning network model, the loss function adopted can 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 a combination of at least two 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 process of training the word vector model, may be implemented on the terminal device, or may be implemented on another terminal device in communication connection with the terminal device. And when the terminal equipment stores the trained model or other terminal equipment pushes the trained model to the terminal equipment, the terminal equipment extracts the characteristics of the acquired text to be augmented. It should be noted that the text to be incremented obtained by the terminal device in the text incrementing process may also be used to increase data of a sample database of the training model, further optimization of the model is performed at the terminal device or other terminal device, and the terminal device or other terminal device stores the further optimized model in the terminal device to replace the previous model. By optimizing the model in this way, the data breadth of the model is improved, and therefore the application range of the scheme is widened.
S203, determining the text theme of the text to be increased.
In step 203, a text topic of the text to be incremented is determined, so that in subsequent step S204, the feature matrix is incremented by a Variational Auto Encoder (VAE) corresponding to the text topic.
In some embodiments of the present application, a document topic generation model (LDA) is used to identify a text topic of the text to be augmented. LDA is an unsupervised machine learning technique that can be used to identify underlying topic information in large-scale document collections (document collections) or corpora (corpus).
It is to be understood that this is by way of illustration only and is not to be construed as a specific limitation on the present application. All ways of determining the text topic of the text to be augmented are applicable to the present application.
It should be noted that, although step S202 and step S203 are described before and after, and the reference numerals are also described with reference to the size, neither the before and after and the size of the reference numerals in the description represent specific limitations on the chronological relationship of the steps. In the embodiment of the present application, step S202 may be performed before step S203, may also be performed after step S203, and may also be performed simultaneously with step S203, and the present application does not specifically limit the timing relationship between steps S202 and S203.
And S204, inputting the feature matrix into a variational self-encoder VAE corresponding to the text theme to obtain the incremental text of the text to be incremented.
In the embodiment of the application, the terminal device is prestored with a plurality of VAEs, and each VAE corresponds to one text theme. After the text theme of the text to be incremented is determined in step 203, a VAE corresponding to the text theme of the text to be incremented is determined from the pre-stored VAEs, so that the text to be incremented is incremented based on the determined VAE.
Inputting the feature matrix into the VAE corresponding to the text theme to obtain the incremental text of the text to be incremented. Text increment is carried out based on the VAE corresponding to the text theme of the text to be incremented, the correlation degree of the incremental text and the text to be incremented is greatly improved, and the text generation accuracy is greatly improved.
As shown in fig. 4, the VAE is composed of two parts, including an encoder and a decoder. The encoder of the VAE does not directly output codes, but considers that all the codes conform to a normal distribution, a mean and variance calculation module of the encoder calculates the mean and variance of the normal distribution, a normal distribution can be determined based on the mean and variance, a sampling code is obtained by sampling from the determined normal distribution, and then the sampling code is input into a generator of a decoder to generate incremental text data. That is to say, in the embodiment of the present application, it may be considered that each text to be incremented corresponds to one code in the normal distribution, and the normal distribution is estimated through the existing training data, and then the new code may be obtained by sampling from the normal distribution to generate the incremental text data.
As a non-limiting example of the present application, a simpler Recurrent Neural Network (RNN) is used as the encoder and decoder. The encoder receives the feature matrix as input, outputs variance and mean, and the decoder determines normal distribution based on the variance and mean, and samples in the normal distribution to obtain sampling codes. And inputting a sampling coding vector sampled from the normal distribution at each time step of the RNN of the decoder, so that the output of each time step generates the probability of each word appearing at the position after a full connection layer and a softmax function are accessed, and the word with the highest probability is selected as the word appearing at the time step. It should be noted that, if the length of the generated text is not as long as a plurality of time steps, a preset character representing filling is generated in the portion beyond the length.
Illustratively, the above-mentioned BERT Large model outputs an N × 768-dimensional feature matrix, and the encoder returns a vector with 1 × 256 dimensions after receiving the feature matrix; the vector is then respectively connected to two fully-connected layers, which respectively output two vectors of 1 × 256 size, which are the mean and the variance. And determining a normal distribution based on the mean value and the variance, sampling the normal distribution to obtain a sampling code, adding a variance to the sampling code, and inputting the sampling code into a decoder, wherein the decoder generates an incremental text character by character. It should be noted that the embodiment of the present application can generate the incremental text because the variance is added to the sampling code, and therefore, the exactly same incremental text is not generated.
In the above example, on one hand, the high-dimensional text vector output by using the BERT model contains a very rich information amount, and is very suitable for the encoder of the VAE to process the high-dimensional text vector into semantic code, and on the other hand, the distribution calculated by the VAE depends on the input variable, and all samples of the distribution generate output similar to or related to the input, and the output can help to realize certainty when generating the text, so that the randomness when generating the text is avoided through the dual action of combining the BERT model and the VAE, the correlation between the incremental text and the text to be incremented is greatly improved, and the quality of text generation can be greatly improved.
It will be appreciated that training of the VAE needs to be completed before text augmentation with the VAE.
In a non-limiting example of the present application, after a large-scale corpus for training a model is obtained, text topic classification is performed on the corpus in the corpus, and then a VAE is trained for each category of corpus, so as to obtain a plurality of VAEs corresponding to different text topics.
In another non-limiting example of the present application, after a large-scale corpus set for training a model is obtained, a basic VAE is trained based on the corpus in the corpus set; then, on the basis of text theme classification of the corpora in the corpus, retraining is performed on the corpora of each category based on the basic VAE to obtain one VAE, so that a plurality of VAEs corresponding to different text themes are obtained.
It will be appreciated that in both of the above non-limiting examples, to improve the accuracy of the VAE text incremental results, there is a corresponding large-scale corpus in the corpus for each text topic.
According to the embodiment of the application, the feature matrix of the text to be incremented is extracted, the text theme of the text to be incremented is determined, and then the incremental text is generated by combining the VAE corresponding to the text theme. On one hand, an incremental text is generated by utilizing the VAE corresponding to the text theme, and different VAEs are set for different themes; on the other hand, the distribution calculated by the VAE depends on the input variable, all samples of the distribution generate output similar to or related to the input, and the output can help to realize certainty when generating the text, so that the complete randomness when generating the text is avoided through the double effects of the two aspects, the correlation degree of the incremental text and the text to be incremented is improved, and the quality of text generation can be greatly improved.
It should be understood that, the sequence numbers of the steps in the foregoing embodiments do not imply an execution sequence, and the execution sequence of each process should be determined by its function and inherent logic, and should not constitute any limitation to the implementation process of the embodiments of the present application.
Corresponding to the text increment method described in the above embodiments, fig. 5 shows a structural block diagram of a text increment device provided in the embodiments of the present application, and for convenience of explanation, only the parts related to the embodiments of the present application are shown.
Referring to fig. 5, the apparatus includes:
an obtaining module 51, configured to obtain a text to be incremented;
the extracting module 52 is 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 53, configured to determine a text topic of the text to be incremented;
and the increment module 54 is configured to input the feature matrix into a variational self-encoder corresponding to the text theme, and obtain an increment text of the text to be incremented.
The extracting module 52 is specifically configured to:
and converting the text to be incremented into a feature matrix through a preset word vector model.
The extracting module 52 is specifically configured to:
and performing feature extraction on the text to be incremented through a preset BERT model to obtain a feature matrix corresponding to the text to be incremented.
The extracting module 52 is specifically configured to:
converting the text to be incremented into a characteristic matrix of Nx 768 dimensions by a preset BERT model, wherein the preset BERT model comprises 24 coding layers; the text to be incremented comprises N characters, and N is a positive integer.
The extracting module 52 is specifically configured to:
acquiring keywords of the text to be incremented;
acquiring a feature vector corresponding to each keyword;
and combining the feature vectors corresponding to all the keywords to generate a feature matrix.
The increment module 54 is specifically configured to:
inputting the feature matrix into an encoder of a variational self-encoder corresponding to the text theme to obtain a mean value and a variance of the feature matrix;
determining normal distribution according to the mean value and the variance, and sampling from the normal distribution to obtain sampling codes;
and inputting the sampling code into a decoder of a variational self-encoder to generate the incremental text of the text to be incremented.
It should be noted that, because the contents of information interaction, execution process, and the like between the modules/units are based on the same concept as that of the method embodiment of the present application, specific functions and technical effects thereof may be referred to specifically in the method embodiment section, and are not described herein again.
It will be apparent to those skilled in the art that, for convenience and brevity of description, only the above-mentioned division of the functional units and modules is illustrated, and in practical applications, the above-mentioned function distribution may be performed by different functional units and modules according to needs, that is, the internal structure of the apparatus is divided into different functional units or modules to perform all or part of the above-mentioned functions. Each functional unit and module in the embodiments may be integrated in one processing unit, or each unit may exist alone physically, or two or more units are integrated in one unit, and the integrated unit may be implemented in a form of hardware, or in a form of software functional unit. In addition, specific names of the functional units and modules are only for convenience of distinguishing from each other, and are not used for limiting the protection scope of the present application. The specific working processes of the units and modules in the system may refer to the corresponding processes in the foregoing method embodiments, and are not described herein again.
Fig. 6 is a schematic structural diagram of a terminal device according to an embodiment of the present application. As shown in fig. 6, the terminal device 6 of this embodiment includes: at least one processor 60 (only one processor is shown in fig. 6), a memory 61, and a computer program 62 stored in the memory 61 and executable on the at least one processor 60, the steps in the various method embodiments described above being implemented when the computer program 62 is executed by the processor 60.
The embodiments of the present application further provide a computer-readable storage medium, where a computer program is stored, and when the computer program is executed by a processor, the computer program implements the steps in the above-mentioned method embodiments.
The embodiments of the present application provide a computer program product, which when running on a mobile terminal, enables the mobile terminal to implement the steps in the above method embodiments when executed.
The integrated unit, if implemented in the form of a software functional unit and sold or used as a stand-alone product, may be stored in a computer readable storage medium. Based on such understanding, all or part of the processes in the methods of the embodiments described above can be implemented by a computer program, which can be stored in a computer-readable storage medium and can implement the steps of the embodiments of the methods described above when the computer program is executed by a processor. Wherein the computer program comprises computer program code, which may be in the form of source code, object code, an executable file or some intermediate form, etc. The computer readable medium may include at least: any entity or device capable of carrying computer program code to a photographing apparatus/terminal apparatus, a recording medium, computer Memory, Read-Only Memory (ROM), Random Access Memory (RAM), electrical carrier wave signal, telecommunication signal, and software distribution medium. Such as a usb-disk, a removable hard disk, a magnetic or optical disk, etc. In certain jurisdictions, computer-readable media may not be an electrical carrier signal or a telecommunications signal in accordance with legislative and patent practice.
In the above embodiments, the descriptions of the respective embodiments have respective emphasis, and reference may be made to the related descriptions of other embodiments for parts that are not described or illustrated in a certain embodiment.
Those of ordinary skill in the art will appreciate that the various illustrative elements and algorithm steps described in connection with the embodiments disclosed herein may be implemented as electronic hardware or combinations of computer software and electronic hardware. Whether such functionality is implemented as hardware or software depends upon the particular application and design constraints imposed on the implementation. Skilled artisans may implement the described functionality in varying ways for each particular application, but such implementation decisions should not be interpreted as causing a departure from the scope of the present application.
In the embodiments provided in the present application, it should be understood that the disclosed apparatus/network device and method may be implemented in other ways. For example, the above-described apparatus/network device embodiments are merely illustrative, and for example, the division of the modules or units is only one logical division, and there may be other divisions when actually implementing, for example, a plurality of units or components may be combined or integrated into another system, or some features may be omitted, or not implemented. In addition, the shown or discussed mutual coupling or direct coupling or communication connection may be an indirect coupling or communication connection through some interfaces, devices or units, and may be in an electrical, mechanical or other form.
The units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of the embodiment.
The above-mentioned embodiments are only used for illustrating the technical solutions of the present application, and not for limiting the same; although the present application has been described in detail with reference to the foregoing embodiments, it should be understood by those of ordinary skill in the art that: the technical solutions described in the foregoing embodiments may still be modified, or some technical features may be equivalently replaced; such modifications and substitutions do not substantially depart from the spirit and scope of the embodiments of the present application and are intended to be included within the scope of the present application.

Claims (10)

1. A text incrementing method, comprising:
acquiring a text to be incremented;
extracting features of the text to be incremented to obtain a feature matrix corresponding to the text to be incremented;
determining a text subject of the text to be increased;
and inputting the feature matrix into a variational self-encoder corresponding to the text theme to obtain the incremental text of the text to be incremented.
2. The text increment method of claim 1, wherein the feature extraction of the text to be incremented to obtain a feature matrix corresponding to the text to be incremented comprises:
and converting the text to be incremented into a feature matrix through a preset word vector model.
3. The text increment method according to claim 2, wherein the converting the text to be incremented into a feature matrix through a preset word vector model comprises:
and performing feature extraction on the text to be incremented through a preset BERT model to obtain a feature matrix corresponding to the text to be incremented.
4. The text increment method according to claim 3, wherein the step of performing feature extraction on the text to be incremented through a preset BERT model to obtain a feature matrix corresponding to the text to be incremented comprises the steps of:
converting the text to be incremented into a characteristic matrix of Nx 768 dimensions by a preset BERT model, wherein the preset BERT model comprises 24 coding layers; the text to be incremented comprises N characters, and N is a positive integer.
5. The text increment method of claim 2, wherein converting the text to be incremented into a feature matrix through a preset word vector model comprises:
acquiring keywords of the text to be incremented;
acquiring a feature vector corresponding to each keyword;
and combining the feature vectors corresponding to all the keywords to generate a feature matrix.
6. The text increment method of claim 1, wherein the inputting the feature matrix into a variational self-encoder corresponding to the text theme to obtain the increment text of the text to be incremented comprises:
inputting the feature matrix into an encoder of a variational self-encoder corresponding to the text theme to obtain a mean value and a variance of the feature matrix;
determining normal distribution according to the mean value and the variance, and sampling from the normal distribution to obtain sampling codes;
and inputting the sampling code into a decoder of a variational self-encoder to generate the incremental text of the text to be incremented.
7. A text incrementing device, comprising:
the acquisition module is used for acquiring the text to be incremented;
the extraction module is used for extracting the features of the text to be incremented to obtain a feature matrix corresponding to the text to be incremented;
the determining module is used for determining the text theme of the text to be increased;
and the increment module is used for inputting the feature matrix into a variational self-encoder corresponding to the text theme to obtain the increment text of the text to be incremented.
8. The text augmentation apparatus of claim 7, wherein the extraction module is specifically configured to:
and performing feature extraction on the text to be incremented through a preset BERT model to obtain a feature matrix corresponding to the text to be incremented.
9. A terminal device comprising a memory, a processor and a computer program stored in the memory and executable on the processor, characterized in that the processor implements the text incrementing method according to any one of claims 1 to 6 when executing the computer program.
10. A computer-readable storage medium, in which a computer program is stored which, when being executed by a processor, carries out a text incremental method as claimed in any one of claims 1 to 6.
CN202010019294.8A 2020-01-08 2020-01-08 Text increment method and device and terminal equipment Pending CN111241815A (en)

Priority Applications (2)

Application Number Priority Date Filing Date Title
CN202010019294.8A CN111241815A (en) 2020-01-08 2020-01-08 Text increment method and 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 CN111241815A (en) 2020-01-08 2020-01-08 Text increment method and device and terminal equipment

Publications (1)

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

Family

ID=70872435

Family Applications (1)

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

Country Status (2)

Country Link
CN (1) CN111241815A (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

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 华南理工大学 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 山东大学 Multi-mode customer service automatic reply method and system
CN110516055A (en) * 2019-08-16 2019-11-29 西北工业大学 A kind of cross-platform intelligent answer implementation method for teaching task of combination BERT
CN111241815A (en) * 2020-01-08 2020-06-05 平安科技(深圳)有限公司 Text increment method and device and terminal equipment

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

Similar Documents

Publication Publication Date Title
CN109783798A (en) Method, apparatus, terminal and the storage medium of text information addition picture
CN113378556A (en) Method and device for extracting text keywords
CN110162770A (en) A kind of word extended method, device, equipment and medium
CN110209784B (en) Message interaction method, computer device and storage medium
CN111209423B (en) Image management method and device based on electronic album and storage medium
CN113268572A (en) Question answering method and device
CN112820299B (en) Voiceprint recognition model training method and device and related equipment
CN111177180A (en) Data query method and device and electronic equipment
CN108334196B (en) File processing method and mobile terminal
CN113821589B (en) Text label determining method and device, computer equipment and storage medium
CN113220848B (en) Automatic question and answer method and device for man-machine interaction and intelligent equipment
CN111241815A (en) Text increment method and device and terminal equipment
CN112214605A (en) Text classification method and related device
CN112749252A (en) Text matching method based on artificial intelligence and related device
CN112685578B (en) Method and device for providing multimedia information content
CN111639209A (en) Book content searching method, terminal device and storage medium
CN112488157B (en) Dialogue state tracking method and device, electronic equipment and storage medium
CN112328783B (en) Abstract determining method and related device
CN112307198B (en) Method and related device for determining abstract of single text
CN114428842A (en) Method and device for expanding question-answer library, electronic equipment and readable storage medium
CN110866114B (en) Object behavior identification method and device and terminal equipment
CN110990549B (en) Method, device, electronic equipment and storage medium for obtaining answer
CN116860913A (en) Voice interaction method, device, equipment and storage medium
CN111597823B (en) Method, device, equipment and storage medium for extracting center word
CN116955677A (en) Method, device, equipment and storage medium for generating pictures based on characters

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