Disclosure of Invention
The embodiment of the application provides a title generation method, a computer and a readable storage medium, which can improve the generation efficiency of text titles.
In one aspect, an embodiment of the present application provides a method for generating a title, where the method includes:
performing word segmentation processing on the target text data to obtain at least two target text word segmentation phrases forming the target text data;
acquiring target text keywords in target text data according to the importance degree of target word groups of at least two target text word groups, and acquiring target word group characteristics of the target text keywords;
inputting the target phrase characteristics into a title generation model, carrying out characteristic prediction on the target phrase characteristics based on the title generation model to obtain a prediction statement set, and taking a prediction statement with the maximum first prediction probability value in the prediction statement set as a target text title of target text data;
pushing the target text data carrying the target text title.
Wherein, the method further comprises:
determining the target phrase frequency tf of the ith target text word phrase in the target text data according to at least two target text word phrasesi The method comprises the steps of carrying out a first treatment on the surface of the i is a positive integer, and i is less than or equal to the total number of at least two target text word segmentation phrases;
Obtaining a reverse file frequency set, and obtaining a target reverse file frequency idf of an ith target text word segmentation phrase from the reverse file frequency seti ;
Acquiring a target domain weight corresponding to the ith target text word segmentation phrase in the target text dataAccording to the frequency tf of the target phrasei Target reverse file frequency idfi And determining the importance of the target phrase of the ith target text word-segmentation phrase.
According to at least two target text word segmentation phrases, determining target phrase frequency tf of the ith target text word segmentation phrase in target text datai Comprising:
counting the number of target phrases of each target text word segmentation phrase in the target text data;
determining the ratio of the number of target phrases of the ith target text word segmentation phrase to the sum of the number of target phrases of each target text word segmentation phrase as the target phrase frequency tf of the ith target text word segmentation phrase in the target text datai 。
Wherein the method further comprises:
acquiring at least two text data included in a corpus, and performing word segmentation processing on each text data to obtain text word segmentation phrases corresponding to the at least two text data;
Determining the number of text data associated with the text word group as the association Wen Benshu of the text word group;
acquiring the total number of texts of at least two text data, and determining the reverse file frequency of the text word segmentation phrase according to the total number of texts and the association Wen Benshu of the text word segmentation phrase;
and adding the reverse file frequency of the text word segmentation phrase into a reverse file frequency set.
The method for obtaining the target domain weight corresponding to the ith target text word segmentation phrase in the target text data comprises the following steps:
acquiring a text region to which an ith target text word segmentation phrase belongs in target text data;
if the text region is the first text region, determining the first domain weight corresponding to the first text region as the target domain weight corresponding to the ith target text word segmentation phrase in the target text data;
if the text region is a second text region, determining a second domain weight corresponding to the second text region as a target domain weight corresponding to the ith target text word segmentation phrase in the target text data; the second domain weight is less than the first domain weight.
The method for obtaining the target phrase characteristics of the target text keywords comprises the following steps:
acquiring a word vector matrix and a target vector position of a target text keyword in the word vector matrix;
And determining a target position matrix of the target text keywords according to the target vector positions, and determining target phrase characteristics of the target text keywords according to the word vector matrix and the target position matrix.
The method for predicting the characteristics of the target phrase comprises the steps of inputting the characteristics of the target phrase into a title generation model, and predicting the characteristics of the target phrase based on the title generation model to obtain a prediction statement set, and comprises the following steps:
inputting the target phrase characteristics into a title generation model, and predicting the target phrase characteristics based on the title generation model to obtain at least two predicted character strings;
performing word order adjustment on at least two predicted character strings to generate at least two predicted sentences; at least two predictive sentences constitute a set of predictive sentences, each predictive sentence carrying a first predictive probability value, each predictive sentence comprising a target text keyword.
The method for pushing the target text data carrying the target text title comprises the following steps:
acquiring a text reading tag of a user terminal, and determining the target user terminal according to the target text keywords and the text reading tag;
and pushing the target text data carrying the target text title to the target user terminal.
Wherein the method further comprises:
generating a push link of the target text data according to the target text title;
The push link is added to the recommended data stream and the recommended data stream is displayed.
Wherein the method further comprises:
acquiring a first keyword sample and a first title sample corresponding to the first keyword sample, and generating first sample characteristics according to the first keyword sample and the first title sample;
training the initial generation pre-training model based on the first sample characteristics to generate a title generation model.
Wherein the method further comprises:
acquiring at least two text data to be determined, and acquiring reading behavior data and text label information of each text data to be determined;
acquiring text data samples from at least two text data to be determined; the text label information of the text data sample belongs to a legal label set, and the reading behavior data meets the reading acquisition condition;
the method for obtaining the first keyword sample and the first title sample corresponding to the first keyword sample comprises the following steps:
and taking the text keywords in the text data samples as first keyword samples, and taking the text titles of the text data samples as first title samples corresponding to the first keyword samples.
Wherein generating a first sample feature from the first keyword sample and the first header sample comprises:
Splicing the first keyword sample and the first title sample into a first input sample, and acquiring a sample position of the first input sample in a word vector matrix;
determining a sample position matrix of the first input sample according to the sample position;
acquiring a character sample forming a first input sample, acquiring character position information of the character sample in the first input sample, and acquiring a character position vector corresponding to the character position information;
and generating a first sample characteristic according to the sample position matrix, the word vector matrix and the character position vector.
Training the initial generation pre-training model based on the first sample characteristics to generate a title generation model, wherein the method comprises the following steps:
inputting the first sample characteristics into an initial generation pre-training model, carrying out characteristic hiding on the characteristics to be predicted in the first sample characteristics based on the initial generation pre-training model, and carrying out characteristic prediction on the first sample characteristics after hiding; the feature to be predicted belongs to the feature of the first title sample;
and adjusting the initial pre-training model to generate a title generation model according to the second prediction probability value corresponding to the feature to be predicted in the initial pre-training model.
Training the initial generation pre-training model based on the first sample characteristics to generate a title generation model, wherein the method comprises the following steps:
Inputting the first sample characteristics into an initial generation pre-training model for pre-training, and generating a pre-training model;
acquiring a second keyword sample and a second title sample corresponding to the second keyword sample, generating a second sample feature according to the second keyword sample, and generating a sample label according to the second title sample corresponding to the second keyword sample;
and adjusting the pre-training model according to the second sample characteristics and the sample labels to generate a title generation model.
In one aspect, an embodiment of the present application provides a title generating apparatus, including:
the text word segmentation module is used for carrying out word segmentation processing on the target text data to obtain at least two target text word segmentation phrases forming the target text data;
the feature extraction module is used for acquiring target text keywords in the target text data according to the target phrase importance of at least two target text word segmentation phrases and acquiring target phrase features of the target text keywords;
the title prediction module is used for inputting the target phrase characteristics into a title generation model, carrying out characteristic prediction on the target phrase characteristics based on the title generation model to obtain a prediction statement set, and taking a prediction statement with the maximum first prediction probability value in the prediction statement set as a target text title of target text data;
And the data pushing module is used for pushing the target text data carrying the target text title.
Wherein, this device still includes:
the phrase frequency determining module is used for determining the target phrase frequency tf of the ith target text word segmentation phrase in the target text data according to at least two target text word segmentation phrasesi The method comprises the steps of carrying out a first treatment on the surface of the i is a positive integer, and i is less than or equal to the total number of at least two target text word segmentation phrases;
the reverse file frequency acquisition module is used for acquiring a reverse file frequency set, and acquiring a target reverse file frequency idf of the ith target text word segmentation phrase from the reverse file frequency seti ;
The importance degree determining module is used for acquiring the corresponding target domain weight of the ith target text word segmentation phrase in the target text data and according to the target phrase frequency tfi Target reverse file frequency idfi And determining the importance of the target phrase of the ith target text word-segmentation phrase.
Wherein, this phrase frequency confirms the module, include:
the phrase counting unit is used for counting the number of target phrases of each target text word segmentation phrase in the target text data;
the word frequency determining unit is used for determining the ratio of the number of target word groups of the ith target text word group to the sum of the number of target word groups of each target text word group as the target word group frequency tf of the ith target text word group in the target text datai 。
Wherein the apparatus further comprises:
the word group acquisition module is used for acquiring at least two text data included in the corpus, and performing word segmentation processing on each text data to obtain text word groups corresponding to the at least two text data;
the association statistics module is used for determining the number of text data associated with the text word segmentation phrase as association Wen Benshu of the text word segmentation phrase;
the reverse file frequency determining module is used for obtaining the total number of texts of at least two text data and determining the reverse file frequency of the text word-group according to the total number of texts and the association Wen Benshu of the text word-group;
and the set updating module is used for adding the reverse file frequency of the text word segmentation phrase into the reverse file frequency set.
The importance determining module includes:
the region determining unit is used for obtaining a text region to which the ith target text word segmentation phrase belongs in the target text data;
the weight acquisition unit is used for determining the first domain weight corresponding to the first text region as the target domain weight corresponding to the ith target text word segmentation phrase in the target text data if the text region is the first text region;
The weight obtaining unit is further configured to determine, if the text region is a second text region, a second domain weight corresponding to the second text region as a target domain weight corresponding to the i-th target text word segmentation phrase in the target text data; the second domain weight is less than the first domain weight.
In the aspect of acquiring the target phrase characteristics of the target text keywords, the characteristic extraction module comprises:
the vector acquisition unit is used for acquiring a word vector matrix and a target vector position of the target text keyword in the word vector matrix;
and the feature determining unit is used for determining a target position matrix of the target text keyword according to the target vector position and determining the target phrase feature of the target text keyword according to the word vector matrix and the target position matrix.
In the aspect of inputting the target phrase features into a title generation model, carrying out feature prediction on the target phrase features based on the title generation model to obtain a prediction statement set, the title prediction module comprises:
the character prediction unit is used for inputting the target phrase characteristics into the title generation model, and predicting the target phrase characteristics based on the title generation model to obtain at least two predicted character strings;
The prediction adjustment unit is used for performing word sequence adjustment on at least two prediction character strings to generate at least two prediction sentences; at least two predictive sentences constitute a set of predictive sentences, each predictive sentence carrying a first predictive probability value, each predictive sentence comprising a target text keyword.
The data pushing module comprises:
the terminal determining unit is used for acquiring the text reading tag of the user terminal and determining the target user terminal according to the target text keyword and the text reading tag;
and the data pushing unit is used for pushing the target text data carrying the target text title to the target user terminal.
Wherein the apparatus further comprises:
the link generation module is used for generating a push link of the target text data according to the target text title;
and the data display module is used for adding the push link to the recommended data stream and displaying the recommended data stream.
Wherein the apparatus further comprises:
the sample acquisition module is used for acquiring a first keyword sample and a first title sample corresponding to the first keyword sample, and generating first sample characteristics according to the first keyword sample and the first title sample;
and the model training module is used for training the initial generation pre-training model based on the first sample characteristics to generate a title generation model.
Wherein the apparatus further comprises:
the text acquisition module is used for acquiring at least two text data to be determined and acquiring reading behavior data and text label information of each text data to be determined;
the sample selection module is used for acquiring text data samples from at least two text data to be determined; the text label information of the text data sample belongs to a legal label set, and the reading behavior data meets the reading acquisition condition;
in the aspect of acquiring the first keyword sample and the first title sample corresponding to the first keyword sample, the sample acquiring module is specifically configured to:
and taking the text keywords in the text data samples as first keyword samples, and taking the text titles of the text data samples as first title samples corresponding to the first keyword samples.
Wherein, in generating a first sample feature according to a first keyword sample and a first title sample, the sample acquisition module includes:
the input acquisition unit is used for splicing the first keyword sample and the first title sample into a first input sample and acquiring the sample position of the first input sample in the word vector matrix;
a matrix determining unit for determining a sample position matrix of the first input sample according to the sample position;
The position vector determining unit is used for obtaining character samples forming the first input sample, obtaining character position information of the character samples in the first input sample and obtaining a character position vector corresponding to the character position information;
and the sample feature generating unit is used for generating a first sample feature according to the sample position matrix, the word vector matrix and the character position vector.
Wherein, this model training module includes:
the feature hiding unit is used for inputting the first sample features into an initial generation pre-training model, carrying out feature hiding on the features to be predicted in the first sample features based on the initial generation pre-training model, and carrying out feature prediction on the hidden first sample features; the feature to be predicted belongs to the feature of the first title sample;
and the model adjusting unit is used for adjusting the initial pre-training model to generate a title generating model according to the second prediction probability value corresponding to the feature to be predicted in the initial pre-training model.
Wherein, this model training module includes:
the first training unit is used for inputting the first sample characteristics into an initial generation pre-training model for pre-training to generate a pre-training model;
the sample acquisition unit is used for acquiring a second keyword sample and a second title sample corresponding to the second keyword sample, generating second sample characteristics according to the second keyword sample, and generating a sample label according to the second title sample corresponding to the second keyword sample;
And the second training unit is used for adjusting the pre-training model according to the second sample characteristics and the sample labels to generate a title generation model.
In one aspect, the embodiment of the application provides a computer device, which comprises a processor, a memory and an input/output interface;
the processor is respectively connected with the memory and the input/output interface, wherein the input/output interface is used for receiving data and outputting data, the memory is used for storing program codes, and the processor is used for calling the program codes so as to execute the title generation method in one aspect of the embodiment of the application.
An aspect of an embodiment of the present application provides a computer-readable storage medium storing a computer program, the computer program including program instructions that, when executed by a processor, perform a title generation method in an aspect of an embodiment of the present application.
In one aspect, embodiments of the present application provide a computer program product or computer program comprising computer instructions stored in a computer-readable storage medium. The computer instructions are read from the computer-readable storage medium by a processor of a computer device, and executed by the processor, cause the computer device to perform the methods provided in the various alternatives in an aspect of the embodiments of the application.
The implementation of the embodiment of the application has the following beneficial effects:
according to the embodiment of the application, the target text data is subjected to word segmentation processing to obtain at least two target text word segmentation phrases forming the target text data; acquiring target text keywords in target text data according to the importance degree of target word groups of at least two target text word groups, and acquiring target word group characteristics of the target text keywords; inputting the target phrase characteristics into a title generation model, carrying out characteristic prediction on the target phrase characteristics based on the title generation model to obtain a prediction statement set, and taking a prediction statement with the maximum first prediction probability value in the prediction statement set as a target text title of target text data; pushing the target text data carrying the target text title. And the target text data is automatically analyzed and processed through the model to obtain the target text title of the target text data, so that the labor cost is reduced, and the generation efficiency of the text title is improved.
Detailed Description
The following description of the embodiments of the present application will be made clearly and completely with reference to the accompanying drawings, in which it is apparent that the embodiments described are only some embodiments of the present application, but not all embodiments. All other embodiments, which can be made by those skilled in the art based on the embodiments of the application without making any inventive effort, are intended to be within the scope of the application.
The scheme provided by the embodiment of the application relates to the technologies of machine learning and the like in the field of artificial intelligence, realizes the feature extraction of keywords in text data, and performs feature prediction on the text data based on the keywords so as to generate a text title of the text data.
Among these, artificial intelligence (Artificial Intelligence, AI) is the theory, method, technique and application system that uses a digital computer or a digital computer-controlled machine to simulate, extend and extend human intelligence, sense the environment, acquire knowledge and use knowledge to obtain optimal results. In other words, artificial intelligence is an integrated technology of computer science that attempts to understand the essence of intelligence and to produce a new intelligent machine that can react in a similar way to human intelligence. Artificial intelligence, i.e. research on design principles and implementation methods of various intelligent machines, enables the machines to have functions of sensing, reasoning and decision.
The artificial intelligence technology is a comprehensive subject, and relates to the technology with wide fields, namely the technology with a hardware level and the technology with a software level. Artificial intelligence infrastructure technologies generally include technologies such as sensors, dedicated artificial intelligence chips, cloud computing, distributed storage, big data processing technologies, operation/interaction systems, mechatronics, and the like. The artificial intelligence software technology mainly comprises a computer vision technology, a voice processing technology, a natural language processing technology, machine learning/deep learning and other directions.
Among them, machine Learning (ML) is a multi-domain interdisciplinary, and involves multiple disciplines such as probability theory, statistics, approximation theory, convex analysis, algorithm complexity theory, etc. It is specially studied how a computer simulates or implements learning behavior of a human to acquire new knowledge or skills, and reorganizes existing knowledge structures to continuously improve own performance. Machine learning is the core of artificial intelligence, a fundamental approach to letting computers have intelligence, which is applied throughout various areas of artificial intelligence. Machine learning and deep learning typically include techniques such as artificial neural networks, confidence networks, reinforcement learning, transfer learning, induction learning, teaching learning, and the like.
With research and advancement of artificial intelligence technology, research and application of artificial intelligence technology is being developed in various fields, such as common smart home, smart wearable devices, virtual assistants, smart speakers, smart marketing, unmanned, automatic driving, unmanned aerial vehicles, robots, smart medical treatment, smart customer service, etc., and it is believed that with the development of technology, artificial intelligence technology will be applied in more fields and with increasing importance value.
The scheme provided by the embodiment of the application relates to the technology of machine learning and the like in the field of artificial intelligence, and is specifically described by the following embodiments:
Specifically, referring to fig. 1, fig. 1 is a diagram of a title generation network structure provided in an embodiment of the present application, where the embodiment of the present application may be implemented by a computer device, where the computer device may be composed of a server and a terminal device; the computer device may also be a server or a terminal device, without limitation. The method and the device are applicable to various applications for issuing science popularization articles, wherein the applications for issuing science popularization articles are applications for pushing professional science popularization articles to users, such as medical science popularization applications, agricultural science popularization applications, economic science popularization applications or physical science popularization applications, and the like, and are not limited herein.
The professional can upload text data through the user equipment, the text data refers to the text content of a popular science article, the computer equipment acquires the text data sent by the user equipment, and a text title of the text data is generated. The computer device 101 may interact with user terminals (including but not limited to, the user terminal 102a, the user terminal 102b, and the user terminal 102c, etc.) for obtaining text data submitted by a professional, or presenting a push text to a user, where the push text refers to text data carrying a text title. For example, the user terminal 102a corresponds to a professional, the user terminal 102B corresponds to the user a, the user terminal 102c corresponds to the user B, the computer device 101 extracts a text keyword in the text data after obtaining the text data sent by the user terminal 102a, inputs the text keyword into the title generation model for prediction, obtains a text title of the text data, and pushes the text data carrying the text title. The user a may obtain the text data carrying the text title through the user terminal 102B used by the user a, and the user B may obtain the text data carrying the text title through the user terminal 102c used by the user B. Alternatively, the professional may submit the text data directly in the computer device 101, without limitation. The text data is analyzed and processed through the title generation model, so that intelligent processing is performed on the text data, the text title of the text data is automatically generated, the labor cost is reduced, and the generation efficiency of the text title is improved.
It is understood that the computer device or the user device mentioned in the embodiments of the present application includes, but is not limited to, a terminal device or a server. In other words, the computer device or the user device may be a server or a terminal device, or may be a system formed by the server and the terminal device. The above-mentioned terminal device may be an electronic device, including but not limited to a mobile phone, a tablet computer, a desktop computer, a notebook computer, a palm computer, an augmented Reality/Virtual Reality (AR/VR) device, a head mounted display, a wearable device, a smart speaker, and other mobile internet devices (mobile internet device, MID) with network access capability, etc.
Further, referring to fig. 2, fig. 2 is a schematic diagram of a title generation scene according to an embodiment of the present application. As shown in fig. 2, the computer device obtains the target text data 201, performs word segmentation processing on the target text data 201 to obtain at least two target text word groups 202 forming the target text data 201, and obtains a target text keyword 203 from the at least two target text word groups 202 according to the importance of the target word group of each target text word group. The target text keyword 203 is input into a title generation model 204, the title generation model 204 performs feature extraction analysis on the target text keyword 203 to obtain a prediction sentence set 205, the prediction sentence set 205 includes a prediction sentence 1 and a first prediction probability value of the prediction sentence 1, a prediction sentence 2 and a first prediction probability value of the prediction sentence 2, a prediction sentence 3 and a first prediction probability value of the prediction sentence 3, …, and a prediction sentence n and a first prediction probability value of the prediction sentence n, where n is a positive integer, and n is the number of prediction sentences included in the prediction sentence set 205. Assuming that the first prediction probability value of the prediction sentence 1 is greater than the first prediction probability value of the prediction sentence 2, the first prediction probability value of the prediction sentence 2 is greater than the first prediction probability value of the prediction sentence 3, …, the first prediction probability value of the prediction sentence (n-1) is greater than the first prediction probability value of the prediction sentence n, the computer device acquires the prediction sentence with the largest first prediction probability value in the prediction sentence set 205, that is, the prediction sentence 1, takes the prediction sentence 1 as the target text title of the target text data 201, generates the push text 206 according to the target text title and the target text data 201, and pushes the push text 206. And feature extraction and prediction are carried out on the target text keywords through the title generation model, so that automatic and intelligent generation of the text titles is realized, and the generation efficiency of the text titles is improved.
Further, referring to fig. 3, fig. 3 is a flowchart of a title generation method according to an embodiment of the present application. As shown in fig. 3, the title generation process includes the steps of:
step S301, word segmentation processing is carried out on the target text data, and at least two target text word segmentation phrases forming the target text data are obtained.
Specifically, the computer equipment acquires target text data, and performs word segmentation processing on the target text data through a word segmentation tool, a word segmentation model or a word segmentation algorithm and the like to obtain at least two target text word groups forming the target text data. Wherein the word segmentation tool can include, but is not limited to, a bargain word (jieba), a han language processing package (Han Language Processing, hanLP) or a natural language processing package with emotion analysis (Snow Natural Language Processing, snowNLP) and the like; the word segmentation algorithm may include, but is not limited to, dictionary-based methods (e.g., string matching or mechanical word segmentation methods, etc.), statistical-based word segmentation methods (i.e., dictionary-free word segmentation), rule-based word segmentation methods (semantic-based), or word-labeling-based Chinese word segmentation methods, etc. In other words, the method used in the word segmentation processing of the target text data in the present application is not limited herein.
The dictionary-based method can be divided into forward matching and reverse matching according to different scanning directions of text data; dictionary-based methods can be classified into maximum matches and minimum matches according to the text length of text data. The word segmentation method based on statistics may be implemented based on a statistical model, such as an N-gram model (N-gram) or a hidden markov model (Hidden Markov Model, HMM), which is not limited herein.
Step S302, obtaining target text keywords in target text data according to the target phrase importance of at least two target text word segmentation phrases, and obtaining target phrase characteristics of the target text keywords.
Specifically, the computer device may obtain the importance of the target phrase of each target text word-segmentation phrase, sort at least two target text word-segmentation phrases based on the importance of the target phrase of each target text word-segmentation phrase, obtain the target text keyword in the target text data from the at least two target text word-segmentation phrases according to the sorting result, and obtain the target phrase feature of the target text keyword.
Optionally, the number of keywords of the target text keywords may be preset, or may be determined according to the target text length of the target text data. For example, the number of keywords may be preset, and the computer device obtains the number of keywords, and obtains the target text keywords in the target text data from the at least two target text word groups based on the number of keywords and the target word group importance of the at least two target text word groups. Or, assuming that there are a first text length range (short), a second text length range (middle and long) and a third text length range (long), the computer device may acquire a target text length of the target text data, acquire a target text length range to which the target text length belongs, and if the target text length range is the first text length range, determine that the number of keywords is a first number of keywords corresponding to the first text length range; if the target text length range is a second text length range, determining that the number of keywords is a second number of keywords corresponding to the second text length range; if the target text length range is a third text length range, determining that the number of keywords is a third number of keywords corresponding to the third text length range; the computer equipment obtains target text keywords in the target text data from at least two target text word groups based on the keyword number and the target word group importance of the at least two target text word groups.
For example, assuming that the number of keywords is 2, the computer device acquires, from at least two target text word-segmentation phrases, two target text word-segmentation phrases with the maximum importance of the target word-phrase as target text keywords in the target text data. Specifically, assuming that at least two target text word-segmentation phrases are ordered according to the importance degree of the target phrases from large to small, the computer equipment can acquire the first two target text word-segmentation phrases from the ordered at least two target text word-segmentation phrases as target text keywords in the target text data.
Further, the computer device may determine a target phrase frequency tf of the ith target text word phrase in the target text data based on the at least two target text word phrasesi The method comprises the steps of carrying out a first treatment on the surface of the i is a positive integer, and i is less than or equal to the total number of at least two target text word-segmentation phrases. Obtaining a reverse file frequency set, and obtaining a target reverse file frequency idf of an ith target text word segmentation phrase from the reverse file frequency seti . Acquiring the corresponding target domain weight of the ith target text word segmentation phrase in the target text data, and according to the target phrase frequency tfi Target reverse file frequency idfi I-th target text word segmentation wordAnd determining the importance of the target phrase of the ith target text word segmentation phrase according to the target domain weight of the group. Wherein, the frequency tf of the target phrasei Can be used for representing the proportion of the ith target text word segmentation phrase in the target text data and the target reverse file frequency idfi May be used to characterize the difference of the ith target text word phrase in the different text data. The importance of the target word group of the target text word group is proportional to the Frequency of the target text word group in the target text data, and inversely proportional to the Frequency of the target text word group in the corpus, because when the Frequency of the word group of the target text word group in the target text data (Term Frequency, TF) is large and the Frequency of the word group of the target text word group in other text data is small, the target text word group can be considered to be important for the target text data, and can be distinguished from other text data, namely, the target text word group can represent the target text data. Wherein the frequency of occurrence of the target text word group in other text data can be represented by a reverse document frequency (Inverse Document Frequency, IDF).
The language materials which are actually appeared in the actual use of the language are stored in the corpus, and the language materials are basic resources for bearing language knowledge by taking an electronic computer as a carrier.
Wherein, determining the target phrase frequency tf of the ith target text word phrase in the target text data according to at least two target text word phrasesi When the method is used, the computer equipment counts the number of target word groups of each target text word group in the target text data; determining the ratio of the number of target phrases of the ith target text word segmentation phrase to the sum of the number of target phrases of each target text word segmentation phrase as the target phrase frequency tf of the ith target text word segmentation phrase in the target text datai . Wherein the target phrase frequency tfi The acquisition of (c) can be found in equation (1):
wherein n isi The number of target word groups of the ith target text word group is represented in the target text data; k is a positive integer, k is less than or equal to the total number of at least two target text word-segmentation phrases, and sigmak nk For representing the sum of the number of target phrases for each target text word phrase in the target text data.
Further, the computer equipment acquires at least two text data included in the corpus, performs word segmentation processing on each text data, and obtains text word segmentation phrases corresponding to the at least two text data. And determining the number of text data associated with the text word group as the associated text number of the text word group. And acquiring the total number of texts of at least two text data, and determining the reverse file frequency of the text word segmentation phrase according to the total number of texts and the association Wen Benshu of the text word segmentation phrase. And adding the reverse file frequency of the text word segmentation phrase into a reverse file frequency set. The text word groups corresponding to the at least two text data comprise all text word groups forming each text data. If the text word group appears in one text data, the text word group is considered to be associated with the text data, namely the associated text number is used for representing the number of the text data where the corresponding text word group is located. Specifically, the computer equipment obtains the target reverse file frequency idf of the ith target text word segmentation phrasei When the target reverse file frequency idf is obtained directly from the reverse file frequency seti See equation (2) for generation:
wherein |d| is used to represent the number of at least two text data included in the corpus; j is a positive integer, j is less than or equal to the number of at least two text data, ti Represents the ith target text word group, dj For representing j-th text data, ti ∈dj Indicating that the ith target text word phrase exists in the jth text data, |{ j: t is ti ∈dj The } |is used for representing the association Wen Benshu of the ith target text word group, namely traversing at least two text data in turn, and counting the number of the text data with the ith target text word group as the associated text number of the ith target text word group. For example, 10 text data exist in the corpus, wherein the 1 st text data, the 3 rd text data and the 5 th text data have text word phrase "healthy", and the association Wen Benshu of the text word phrase "healthy" is determined to be 3, and the reverse file frequency of the text word phrase "healthy" is
When the computer equipment obtains the corresponding target domain weight of the ith target text word group in the target text data, the computer equipment obtains the text region of the ith target text word group in the target text data. If the text region is the first text region, determining the first domain weight corresponding to the first text region as the target domain weight corresponding to the ith target text word segmentation phrase in the target text data; if the text region is a second text region, determining a second domain weight corresponding to the second text region as a target domain weight corresponding to the ith target text word segmentation phrase in the target text data; the second domain weight is less than the first domain weight. The first text area may be a header area of the text data, and the second text area may be a body area of the text data. The generation formula of the importance degree of the target phrase of the ith target text word segmentation phrase can be shown in formula (3):
Si =FieldWi *tfi *idfi ③
Wherein, the field Wi The target domain weight is used for representing the ith target text word segmentation phrase.
Specifically, referring to fig. 4, fig. 4 is a schematic view of an acquisition scene of a target text keyword according to an embodiment of the present application. As shown in fig. 4, a computer device obtains target text data 401, performs word segmentation processing on the target text data 401 to obtain at least two target text word groups 402 forming the target text data 401, counts the number of target word groups of each target text word group to obtain target word group frequencies of each target text word group, including word group frequency 1 of the target text word group 4021, word group frequencies 2 and … of the target text word group 4022, and word group frequency m of the target text word group 402m, where m is a positive integer, and m is the number of target text word groups included in the at least two target text word groups 402. The method comprises the steps of obtaining a reverse file frequency set 403, and obtaining target reverse file frequencies of target text word-segmentation phrases from the reverse file frequency set 403, wherein the target reverse file frequencies comprise reverse file frequency 1 of target text word-segmentation phrase 4021, reverse file frequencies 2 and … of target text word-segmentation phrase 4022 and reverse file frequency m of target text word-segmentation phrase 402 m. And determining the importance degree of the target word group of each target text word group according to the frequency of the target word group of each target text word group and the frequency of the target reverse file, wherein the importance degree of the target word group of each target text word group comprises the importance degree 1 of the target text word group 4021, the importance degrees 2 and … of the target text word group 4022 and the importance degree m of the target text word group 402 m. The target text keywords of the target text data 401 are determined according to the target phrase importance of each target text word segmentation phrase.
Further, the computer device may obtain a word vector matrix, and a target vector position of the target text keyword in the word vector matrix; and determining a target position matrix of the target text keywords according to the target vector positions, and determining target phrase characteristics of the target text keywords according to the word vector matrix and the target position matrix. Alternatively, the target phrase feature of the target text keyword can be extracted directly through a word vector conversion tool or a word vector conversion model and the like.
Step S303, inputting the target phrase feature into a title generation model, carrying out feature prediction on the target phrase feature based on the title generation model to obtain a prediction statement set, and taking the prediction statement with the maximum first prediction probability value in the prediction statement set as a target text title of target text data.
Specifically, the target phrase features are input into a title generation model, and the target phrase features are predicted based on the title generation model to obtain at least two predicted character strings. Performing word order adjustment on at least two predicted character strings to generate at least two predicted sentences; at least two predictive sentences constitute a set of predictive sentences, each predictive sentence carrying a first predictive probability value, each predictive sentence comprising a target text keyword.
For example, please refer to fig. 5, fig. 5 is a schematic diagram of a push text generation scenario provided in an embodiment of the present application. As shown in fig. 5, the computer device obtains the target text keyword 501 of the target text data as "child, psychological", and obtains the target phrase feature 502 corresponding to the target text keyword "child, psychological", where when the target phrase vector corresponding to "child, psychological" is smaller than the input feature size of the title generation model, a preset filling value (e.g. 0) may be added to the target phrase vector, so as to obtain the target phrase feature 502 corresponding to "child, psychological". The target phrase feature 502 is input into a title generation model 503, the title generation model 503 can predict and adjust the feature of the target phrase feature 502 a plurality of times, and output a prediction sentence set 504, wherein the prediction sentence set 504 includes a prediction sentence 5041 and a first prediction probability value 1, a prediction sentence 5042 and first prediction probability values 2 and …, and a prediction sentence 504n and a first prediction probability value n. Assuming that the first predictive probability value 3 is maximum, the computer apparatus determines the predictive statement 5043 corresponding to the first predictive probability value 3 as the target text heading. If the target text title is "the mental health of children needs to be emphasized by parents", a push text 505 is generated according to the target text data and the target text title, and the push text 505 is pushed to the user terminal 506, so that the user terminal 506 can display the push text 505. The pushing process of the pushed text 505 may specifically refer to step S304.
Step S304, pushing target text data carrying target text titles.
Specifically, the computer device may obtain a text reading tag of the user terminal, and determine the target user terminal according to the target text keyword and the text reading tag. And pushing the target text data carrying the target text title to the target user terminal. The text reading tag can be generated based on historical reading data of the corresponding user terminal, or can be added by a user using the user terminal, and the text reading tag can represent the text type which the corresponding user terminal wants to receive. When the text reading tag is generated based on the historical reading data of the corresponding user terminal, the computer equipment can count the historical reading data of the user terminal, acquire the historical text keyword corresponding to the historical reading data, and take the historical text keyword as the text reading tag of the user terminal.
For example, referring to fig. 6, fig. 6 is a schematic diagram of a text push scene according to an embodiment of the present application. As shown in fig. 6, the computer device 601 generates a push text 602, and knowing that the target text keyword 603 of the push text 602 is "child, psychological", the computer device 601 obtains the user terminal associated with the computer device 601 and the text reading tag of the user terminal, assuming that the text reading tag of the user terminal 6041 is "child, psychological", the text reading tag of the user terminal 6042 is "oral", and the text reading tag of the user terminal 6043 is "psychological, allergic". The computer device 601 obtains text reading tags associated with the target text keywords 603, including text reading tags "children, psychology" and text reading tags "psychology and allergy", determines the user terminal 6041 corresponding to the text reading tags "children, psychology" and the user terminal 6043 corresponding to the text reading tags "psychology and allergy" as target user terminals, that is, if a tag matching any one of the target text keywords exists in the text reading tags, the user terminal corresponding to the text reading tag can be considered as the target user terminal. The computer device pushes the push text 602 to the user terminal 6041 and the user terminal 6043, and the user terminal 6041 or the user terminal 6043 may display the push text 602 in the text display page 605.
The computer equipment can generate a push link of the target text data according to the target text title; the push link is added to the recommended data stream and the recommended data stream is displayed.
Optionally, referring to fig. 6, the computer device 601 may further generate a push link of the target text data according to the target text title, add the push link to the recommended data stream, push the recommended data stream to the target user terminal, and the target user terminal may display the recommended data stream in the text display page 605, and display the push text 602 associated with the recommended link in the text display page 605 in response to a trigger operation for the push link in the recommended data stream. Optionally, the computer device 601 may further push the push text 602 to a target user terminal, and the target user terminal may obtain a pushable text of the target user terminal according to a text reading tag corresponding to the target user terminal, generate a recommended data stream according to the pushable text, and display the recommended data stream.
The training process of the topic generation model in the embodiment of the application is as follows:
the method comprises the steps that computer equipment obtains a first keyword sample and a first title sample corresponding to the first keyword sample, and first sample characteristics are generated according to the first keyword sample and the first title sample; training the initial generation pre-training model based on the first sample characteristics to generate a title generation model. Referring to fig. 7, fig. 7 is a schematic diagram of a model architecture according to an embodiment of the present application. As shown in FIG. 7, the initially generated pre-training model comprises a multi-layer structure, each layer structure comprising a hidden self-attention layer, a standard layer, a feedforward layer, a standard layer, and the like. The computer equipment can input the first sample characteristics into an initial generation pre-training model, the initial generation pre-training model is used for hiding the characteristics to be predicted, which need to be predicted, by hiding a self-attention layer, the characteristics to be predicted belong to the characteristics corresponding to the first title sample, then the hidden characteristics are subjected to characteristic fusion with the first sample characteristics, a standard layer is input, the characteristics output by the standard layer are input into a feedforward layer, the characteristics output by the standard layer are subjected to characteristic fusion with the characteristics output by the feedforward layer, then the next standard layer is input, training of a layer structure is completed, through the process, the first sample characteristics are iterated for a plurality of times in the multi-layer structure in the initial generation pre-training model, and the initial generation pre-training model is adjusted according to iteration results so as to generate the title generation model.
Optionally, feature adjustment can be performed on the features received by the standard layer based on the standard layer, the feature adjustment is performed based on natural language standards, it is guaranteed that the prediction statement output by the generated title generation model accords with the natural language standards, namely, the structure of the prediction statement accords with the reading habit of a user, and therefore the readability of the prediction statement is higher. Optionally, the present application may also perform feature adjustment on the obtained features through other layers in the initial pre-training model, which is not limited herein.
Further, at least two text data to be determined can be obtained, and reading behavior data and text label information of each text data to be determined can be obtained. Acquiring text data samples from at least two text data to be determined; the text label information of the text data sample belongs to a legal label set, and the reading behavior data meets the reading acquisition condition. The text label information can represent an identity information label of an author of a corresponding text data sample, and the legal label set is used for guaranteeing authority of the obtained text data sample, so that legal labels included in the legal label set can be labels corresponding to authorities and labels corresponding to authority titles of professionals; the reading behavior data are used for representing the corresponding reading quantity, collection quantity, click quantity and the like of the text data to be determined, and when the reading behavior data meet the reading collection conditions, the text data to be determined can be considered to be strong in reading performance and attractive. Taking medical science popularization articles as an example, the legal tag set can comprise legal institution tags corresponding to three hospitals and more than three hospitals, and also can comprise tags corresponding to authority titles of national certification, such as national XX medical specialists. The computer device may acquire at least two text data to be determined, and acquire an identity information tag and reading behavior data of an author of each text data to be determined, where the identity information tag may be regarded as text tag information of the corresponding text data to be determined.
At this time, the computer device may use the text keyword in the text data sample as the first keyword sample, and use the text title of the text data sample as the first title sample corresponding to the first keyword sample. The method for extracting the text keywords of the text data sample is the same as the method for extracting the target text keywords of the target text data, and specifically, refer to the descriptions shown in step S301 and step S302 in fig. 3, and will not be described in detail herein. Alternatively, the text data samples may constitute a corpus, where the generation of the reverse document frequency set described in step S302 may be performed.
Further, when the first sample feature is generated according to the first keyword sample and the first title sample, the computer device may splice the first keyword sample and the first title sample into a first input sample, and obtain a sample position of the first input sample in the word vector matrix; determining a sample position matrix of the first input sample according to the sample position; acquiring a character sample forming a first input sample, acquiring character position information of the character sample in the first input sample, and acquiring a character position vector corresponding to the character position information; and generating a first sample characteristic according to the sample position matrix, the word vector matrix and the character position vector. Specifically, the generation formula of the first sample feature may be shown in formula (4):
h0 =UWe +Wp ④
Wherein h is0 For the first sample feature, U represents a sample position matrix corresponding to the first input sample, where u= { U1 ,u2 ,…,uq And q is the length of the first input sample, U may be a matrix with a pos dimension, where pos is used to represent the length of the sentence with the largest number of characters included in the text data sample, for example, the longest sentence in the text data sample includes 10 characters, that is, the number of characters included in the sentence in the text data sample is less than or equal to 10, and pos is 10.W (W)e The term vector matrix is a term vector matrix, where voc is the size of a vocabulary, that is, the number of term vectors included in the term vector matrix, and dim is the dimension of a term vector, for example, after "transforming" into a term vector, a term vector matrix with dim dimension can be obtained. W (W)p The vector representing the character position may be a pos dim dimensional matrix. Wherein when generating the sample position matrix or character position vector, if there is a position without corresponding value, a preset filling value is added at the position, for example, the preset filling value is 0, and the matrix is obtained according to the first input sampleAdding preset filling value to the matrix to obtain sample position matrix +. >The matrix is merely an example, and does not represent a matrix in practical applications.
Further, the computer device may input the first sample feature into an initial generation pre-training model, perform feature masking on the feature to be predicted in the first sample feature based on the initial generation pre-training model, and perform feature prediction on the masked first sample feature; wherein the feature to be predicted belongs to a feature of the first header sample; and adjusting the initial pre-training model to generate a title generation model according to the second prediction probability value corresponding to the feature to be predicted in the initial pre-training model. The second prediction probability value is used for representing the probability of the output prediction result when the initial generation pre-training model is trained based on the first sample characteristics.
Optionally, when the initial generation pre-training model is adjusted, parameters of the initial generation pre-training model need to be continuously adjusted to ensure that a value of an error function in the initial generation pre-training model is minimum, or a probability of predicting a feature to be predicted is maximum, optionally, model adjustment can be performed through a likelihood function, where the likelihood function can be shown in a formula (5):
L1 (U)=∑i log P(ui |ui-k ,…,ui-1 ;θ) ⑤
Wherein L is1 (U) is used to represent likelihood functions when training the initially generated pre-training model based on the first input samples. P (u)i |ui-k ,…,ui-1 The method comprises the steps of carrying out a first treatment on the surface of the θ) represents a given parameter θ, according to the characteristic { u }i-k ,…,ui-1 Obtaining feature ui Probability values of (2); Σ is used to represent the accumulation, which is derived from logab=loga+logb. The initial generation of the pre-training model may be continuously adjusted to maximize the value of the likelihood function, so that the probability of being output as the first topic sample is maximized given the first keyword sample.
Wherein the first sample feature h0 The initial generation model is input for iteration, and the iteration formula can be shown by a formula (6):
hl =transformer_block(hl-1 ),l∈[1,t] ⑥
wherein t is the number of layers of the multi-layer structure included in the initial generation of the pre-training model.
Further, after t layers of iteration are carried out on the initial generation pre-training model, h is generatedt According to the ht The probability of predicting the next word can be expressed by equation (7):
the softmax function refers to a normalized exponential function, and values obtained after the softmax function is processed or values in a matrix all belong to 0-1.
And (3) adjusting the initial generation pre-training model through the formula (5) and the formula (7) so as to maximize the likelihood function and the value of the formula (7) to generate the title generation model.
Optionally, the computer device may further input the first sample feature into an initial generation pre-training model for pre-training to generate the pre-training model. Obtaining the obtainedAnd taking a second keyword sample and a second title sample corresponding to the second keyword sample, generating a second sample characteristic according to the second keyword sample, and generating a sample label according to the second title sample corresponding to the second keyword sample. And adjusting the pre-training model according to the second sample characteristics and the sample labels to generate a title generation model. Wherein the sample label is denoted as y, and the second sample feature is denoted as (x1 ,x2 ,…,xr ) The error function used to adjust the pre-training model according to the second sample feature and the sample label can be shown in equation (8):
L2 (C)=∑(x,y) log P(y|x1 ,x2 ,…,xr ) ⑧
wherein, C is used for representing a second keyword sample carrying a second caption sample, at this time, when the pretrained model is adjusted by pretraining the initial generation pretrained model to generate the caption generation model, an error function in the whole process can be shown by referring to formula (9):
L3 (C)=L2 (C)+λL1 (C) ⑨
where λ is only one probability parameter in mathematics. At this time, when the L3 (C) And when the value of the model is maximum, determining that training of the initial generation pre-training model is completed, and obtaining the title generation model.
According to the embodiment of the application, the target text data is subjected to word segmentation processing to obtain at least two target text word segmentation phrases forming the target text data; acquiring target text keywords in target text data according to the importance degree of target word groups of at least two target text word groups, and acquiring target word group characteristics of the target text keywords; inputting the target phrase characteristics into a title generation model, carrying out characteristic prediction on the target phrase characteristics based on the title generation model to obtain a prediction statement set, and taking a prediction statement with the maximum first prediction probability value in the prediction statement set as a target text title of target text data; pushing the target text data carrying the target text title. And the target text data is automatically analyzed and processed through the model to obtain the target text title of the target text data, so that the labor cost is reduced, and the generation efficiency of the text title is improved. Meanwhile, feature constraint is carried out on the title generation model based on text keywords, so that the accuracy of text title generation is improved, and samples with authority and high reading behavior data are selected when the samples for training the model are acquired, so that the readability and the credibility of target text titles predicted by the title generation model are improved.
Further, referring to fig. 8, fig. 8 is a schematic diagram of a title generating apparatus according to an embodiment of the present application. The title generating means may be a computer program (comprising program code) running in a computer device, for example the title generating means is an application software; the device can be used for executing corresponding steps in the method provided by the embodiment of the application. As shown in fig. 8, the title generating apparatus 800 may be used in the computer device in the embodiment corresponding to fig. 3, and specifically, the apparatus may include: the system comprises a text word segmentation module 11, a feature extraction module 12, a title prediction module 13 and a data pushing module 14.
The text word segmentation module 11 is used for performing word segmentation processing on the target text data to obtain at least two target text word segmentation phrases forming the target text data;
the feature extraction module 12 is configured to obtain a target text keyword in the target text data according to the target phrase importance of at least two target text word segmentation phrases, and obtain a target phrase feature of the target text keyword;
the title prediction module 13 is configured to input the target phrase feature into a title generation model, perform feature prediction on the target phrase feature based on the title generation model, obtain a prediction statement set, and use a prediction statement with the largest first prediction probability value in the prediction statement set as a target text title of the target text data;
The data pushing module 14 is configured to push target text data carrying a target text title.
Wherein, this device 800 still includes:
phrase frequency determining module 15 for determining phrase frequency according to at least two of the phrasesDetermining the target phrase frequency tf of the ith target text word phrase in the target text datai The method comprises the steps of carrying out a first treatment on the surface of the i is a positive integer, and i is less than or equal to the total number of at least two target text word segmentation phrases;
a reverse document frequency obtaining module 16, configured to obtain a reverse document frequency set, and obtain a target reverse document frequency idf of the ith target text word segmentation phrase from the reverse document frequency seti ;
The importance degree determining module 17 is configured to obtain a target domain weight corresponding to the ith target text word segmentation phrase in the target text data, and according to the target phrase frequency tfi Target reverse file frequency idfi And determining the importance of the target phrase of the ith target text word-segmentation phrase.
Wherein, the phrase frequency determining module 15 includes:
a phrase statistics unit 151, configured to count the number of target phrases of each target text word segmentation phrase in the target text data;
word frequency determining unit 152 for determining a ratio of a target phrase number of the ith target text word phrase to a sum of target phrase numbers of each target text word phrase as a target phrase frequency tf of the ith target text word phrase in the target text datai 。
Wherein the apparatus 800 further comprises:
the phrase obtaining module 18 is configured to obtain at least two text data included in the corpus, and perform word segmentation processing on each text data to obtain text word phrases corresponding to the at least two text data;
the association statistics module 19 is configured to determine the number of text data associated with the text word and phrase as an association Wen Benshu of the text word and phrase;
the reverse file frequency determining module 20 is configured to obtain a total number of texts of at least two text data, and determine a reverse file frequency of the text word group according to the total number of texts and the association Wen Benshu of the text word group;
the collection updating module 21 is configured to add the reverse document frequency of the text word segmentation phrase to the reverse document frequency collection.
Wherein, in terms of acquiring the target domain weight corresponding to the ith target text word segmentation phrase in the target text data, the importance determining module 17 includes:
a region determining unit 171, configured to obtain a text region to which the ith target text word segmentation phrase belongs in the target text data;
the weight obtaining unit 172 is configured to determine, if the text region is the first text region, a first domain weight corresponding to the first text region as a target domain weight corresponding to the i-th target text word group in the target text data;
The weight obtaining unit 173 is further configured to determine, if the text region is a second text region, a second domain weight corresponding to the second text region as a target domain weight corresponding to the i-th target text word segmentation phrase in the target text data; the second domain weight is less than the first domain weight.
Wherein, in terms of obtaining the target phrase feature of the target text keyword, the feature extraction module 12 includes:
a vector obtaining unit 121, configured to obtain a word vector matrix and a target vector position of a target text keyword in the word vector matrix;
the feature determining unit 122 is configured to determine a target position matrix of the target text keyword according to the target vector position, and determine a target phrase feature of the target text keyword according to the word vector matrix and the target position matrix.
Wherein, in inputting the target phrase feature into the title generation model, and performing feature prediction on the target phrase feature based on the title generation model to obtain a prediction statement set, the title prediction module 13 comprises:
the character prediction unit 131 is configured to input the target phrase feature into a title generation model, predict the target phrase feature based on the title generation model, and obtain at least two predicted character strings;
A prediction adjustment unit 132, configured to perform word order adjustment on at least two prediction strings, and generate at least two prediction sentences; at least two predictive sentences constitute a set of predictive sentences, each predictive sentence carrying a first predictive probability value, each predictive sentence comprising a target text keyword.
Wherein the data pushing module 14 comprises:
a terminal determining unit 141, configured to obtain a text reading tag of a user terminal, and determine a target user terminal according to a target text keyword and the text reading tag;
the data pushing unit 142 is configured to push, to the target user terminal, target text data carrying a target text title.
Wherein the apparatus 800 further comprises:
the link generation module 22 is configured to generate a push link of the target text data according to the target text title;
the data display module 23 is configured to add a push link to the recommended data stream and display the recommended data stream.
Wherein the apparatus 800 further comprises:
the sample acquiring module 24 is configured to acquire a first keyword sample and a first title sample corresponding to the first keyword sample, and generate a first sample feature according to the first keyword sample and the first title sample;
model training module 25 is configured to train the initially generated pre-training model based on the first sample feature to generate the title generation model.
Wherein the apparatus 800 further comprises:
the text acquisition module 26 is configured to acquire at least two text data to be determined, and acquire reading behavior data and text tag information of each text data to be determined;
a sample selection module 27, configured to obtain a text data sample from at least two text data to be determined; the text label information of the text data sample belongs to a legal label set, and the reading behavior data meets the reading acquisition condition;
in acquiring the first keyword sample and the first title sample corresponding to the first keyword sample, the sample acquiring module 24 is specifically configured to:
and taking the text keywords in the text data samples as first keyword samples, and taking the text titles of the text data samples as first title samples corresponding to the first keyword samples.
Wherein, in generating the first sample feature from the first keyword sample and the first header sample, the sample acquisition module 24 includes:
an input obtaining unit 241, configured to splice the first keyword sample and the first header sample into a first input sample, and obtain a sample position of the first input sample in the word vector matrix;
a matrix determining unit 242 for determining a sample position matrix of the first input sample from the sample positions;
A position vector determining unit 243, configured to obtain a character sample that forms a first input sample, obtain character position information of the character sample in the first input sample, and obtain a character position vector corresponding to the character position information;
the sample feature generating unit 244 is configured to generate a first sample feature according to the sample position matrix, the word vector matrix, and the character position vector.
Wherein the model training module 25 comprises:
a feature hiding unit 251, configured to input the first sample feature into an initial generation pre-training model, perform feature hiding on the feature to be predicted in the first sample feature based on the initial generation pre-training model, and perform feature prediction on the hidden first sample feature; the feature to be predicted belongs to the feature of the first title sample;
the model adjustment unit 252 is configured to adjust the initially generated pre-training model according to the second prediction probability value corresponding to the feature to be predicted in the initially generated pre-training model, so as to generate the title generation model.
Wherein the model training module 25 comprises:
the first training unit 253 is configured to input the first sample feature into an initial pre-training model for pre-training, and generate a pre-training model;
The sample obtaining unit 254 is configured to obtain a second keyword sample and a second title sample corresponding to the second keyword sample, generate a second sample feature according to the second keyword sample, and generate a sample tag according to the second title sample corresponding to the second keyword sample;
and the second training unit 255 is configured to adjust the pre-training model according to the second sample feature and the sample label, and generate a title generation model.
The embodiment of the application provides a title generation device, which obtains at least two target text word segmentation phrases forming target text data by carrying out word segmentation processing on the target text data; acquiring target text keywords in target text data according to the importance degree of target word groups of at least two target text word groups, and acquiring target word group characteristics of the target text keywords; inputting the target phrase characteristics into a title generation model, carrying out characteristic prediction on the target phrase characteristics based on the title generation model to obtain a prediction statement set, and taking a prediction statement with the maximum first prediction probability value in the prediction statement set as a target text title of target text data; pushing the target text data carrying the target text title. And the target text data is automatically analyzed and processed through the model to obtain the target text title of the target text data, so that the labor cost is reduced, and the generation efficiency of the text title is improved. Meanwhile, feature constraint is carried out on the title generation model based on text keywords, so that the accuracy of text title generation is improved, and samples with authority and high reading behavior data are selected when the samples for training the model are acquired, so that the readability and the credibility of target text titles predicted by the title generation model are improved.
Referring to fig. 9, fig. 9 is a schematic structural diagram of a computer device according to an embodiment of the present application. As shown in fig. 9, the computer device in the embodiment of the present application may include: one or more processors 901, memory 902, and input-output interfaces 903. The processor 901, memory 902, and input-output interface 903 are connected via a bus 904. The memory 902 is configured to store a computer program, where the computer program includes program instructions, and the input/output interface 903 is configured to receive data and output data, and implement data interaction between each conference participant terminal, and data interaction between each conference participant terminal and a conference computer device; the processor 901 is configured to execute program instructions stored in the memory 902, and perform the following operations:
performing word segmentation processing on the target text data to obtain at least two target text word segmentation phrases forming the target text data;
acquiring target text keywords in target text data according to the importance degree of target word groups of at least two target text word groups, and acquiring target word group characteristics of the target text keywords;
inputting the target phrase characteristics into a title generation model, carrying out characteristic prediction on the target phrase characteristics based on the title generation model to obtain a prediction statement set, and taking a prediction statement with the maximum first prediction probability value in the prediction statement set as a target text title of target text data;
Pushing the target text data carrying the target text title.
In some possible implementations, the processor 901 may be a central processing unit (central processing unit, CPU), which may also be other general purpose processors, digital signal processors (digital signal processor, DSP), application specific integrated circuits (application specific integrated circuit, ASIC), off-the-shelf programmable gate arrays (field-programmable gate array, FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, or the like. A general purpose processor may be a microprocessor or the processor may be any conventional processor or the like.
The memory 902 may include read only memory and random access memory and provides instructions and data to the processor 901 and the input output interface 903. A portion of the memory 902 may also include non-volatile random access memory. For example, the memory 902 may also store information of device type.
In a specific implementation, the computer device may execute, through each functional module built in the computer device, an implementation manner provided by each step in fig. 3, and specifically, the implementation manner provided by each step in fig. 3 may be referred to, which is not described herein.
An embodiment of the present application provides a computer device, including: the processor, the input/output interface and the memory acquire the computer instructions in the memory through the processor, execute the steps of the method shown in fig. 3, and perform the title generation operation. The embodiment of the application realizes word segmentation processing on the target text data to obtain at least two target text word segmentation phrases forming the target text data; acquiring target text keywords in target text data according to the importance degree of target word groups of at least two target text word groups, and acquiring target word group characteristics of the target text keywords; inputting the target phrase characteristics into a title generation model, carrying out characteristic prediction on the target phrase characteristics based on the title generation model to obtain a prediction statement set, and taking a prediction statement with the maximum first prediction probability value in the prediction statement set as a target text title of target text data; pushing the target text data carrying the target text title. And the target text data is automatically analyzed and processed through the model to obtain the target text title of the target text data, so that the labor cost is reduced, and the generation efficiency of the text title is improved. Meanwhile, feature constraint is carried out on the title generation model based on text keywords, so that the accuracy of text title generation is improved, and samples with authority and high reading behavior data are selected when the samples for training the model are acquired, so that the readability and the credibility of target text titles predicted by the title generation model are improved.
The embodiment of the present application further provides a computer readable storage medium, where the computer readable storage medium stores a computer program, where the computer program includes program instructions, when the program instructions are executed by the processor, can implement the title generation method provided by each step in fig. 3, and specifically refer to the implementation manner provided by each step in fig. 3, which is not repeated herein. In addition, the description of the beneficial effects of the same method is omitted. For technical details not disclosed in the embodiments of the computer-readable storage medium according to the present application, please refer to the description of the method embodiments of the present application. As an example, the program instructions may be deployed to be executed on one computer device or on multiple computer devices at one site or distributed across multiple sites and interconnected by a communication network.
The computer readable storage medium may be the title generating apparatus provided in any of the foregoing embodiments or an internal storage unit of the computer device, for example, a hard disk or a memory of the computer device. The computer readable storage medium may also be an external storage device of the computer device, such as a plug-in hard disk, a Smart Media Card (SMC), a Secure Digital (SD) card, a flash card (flash card) or the like, which are provided on the computer device. Further, the computer-readable storage medium may also include both internal storage units and external storage devices of the computer device. The computer-readable storage medium is used to store the computer program and other programs and data required by the computer device. The computer-readable storage medium may also be used to temporarily store data that has been output or is to be output.
Embodiments of the present application also provide a computer program product or computer program comprising computer instructions stored in a computer readable storage medium. The processor of the computer device reads the computer instructions from the computer readable storage medium, and the processor executes the computer instructions, so that the computer device executes the methods provided in the various optional modes in fig. 3, and predicts the target text title of the target text data through the title generation model, so that the generation of the text title can be automatically performed, and the generation efficiency of the text title is improved.
The term "comprising" and any variations thereof in the description of embodiments of the application and in the claims and drawings is intended to cover a non-exclusive inclusion. For example, a process, method, apparatus, article, or device that comprises a list of steps or elements is not limited to the list of steps or modules but may, in the alternative, include other steps or modules not listed or inherent to such process, method, apparatus, article, or device.
Those of ordinary skill in the art will appreciate that the elements and algorithm steps described in connection with the embodiments disclosed herein may be embodied in electronic hardware, in computer software, or in a combination of the two, and that the elements and steps of the examples have been generally described in terms of function in this description to clearly illustrate the interchangeability of hardware and software. Whether such functionality is implemented as hardware or software depends upon the particular application and design constraints imposed on the solution. 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.
The method and related apparatus provided in the embodiments of the present application are described with reference to the flowchart and/or schematic structural diagrams of the method provided in the embodiments of the present application, and each flow and/or block of the flowchart and/or schematic structural diagrams of the method may be implemented by computer program instructions, and combinations of flows and/or blocks in the flowchart and/or block diagrams. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks. These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instruction means which implement the function specified in the flowchart flow or flows and/or structural diagram block or blocks. These computer program instructions may also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart flow or flows and/or structures.
The foregoing disclosure is illustrative of the present application and is not to be construed as limiting the scope of the application, which is defined by the appended claims.