Model training and text generation method and device, equipment and storage medium
By introducing interest-point knowledge embedding vectors into the generation of travel route copy, the problem of existing technologies being unable to reflect the correlation between multiple interest points is solved, resulting in more accurate copy generation and improved user experience.
Patent Information
- Application Number
- CN202310234214.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-03-09
- Publication Date
- 2026-11-24
- Estimated Expiration
- 2043-03-09
AI Technical Summary
Existing technologies cannot effectively reflect the correlation between multiple points of interest in generating travel route copy, resulting in low accuracy of generated copy words and a poor user experience.
By introducing embedded vectors of interest-point knowledge and combining knowledge representation models and copywriting generation models, more comprehensive and accurate copywriting terms are generated.
By characterizing the semantic relationships between entities of interest, more precise copywriting terms can be generated, thereby improving the user experience.
Smart Images

Figure CN116227482B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of computer technology, and in particular to a method, apparatus, device, and storage medium for model training and text generation. Background Technology
[0002] In the tourism business, there is a need to generate corresponding copywriting words or sentences for tour routes to attract tourists' interest and increase the click-through rate of the routes. Currently, copywriting generation mainly relies on manual searching of information streams on the Internet, which is time-consuming and labor-intensive. By applying Natural Language Generation (NLG) algorithms, specific types of text can be generated, thereby saving manpower.
[0003] Therefore, how to generate accurate copy is a topic that is widely considered in the industry.
[0004] It should be noted that the information disclosed in the background section above is only used to enhance the understanding of the background of the present invention, and therefore may include information that does not constitute prior art known to those skilled in the art. Summary of the Invention
[0005] In view of the problems in the prior art, the purpose of this invention is to provide a method, apparatus, device and storage medium for model training and copywriting generation, which overcomes the difficulties of the prior art and can improve the accuracy of the generated copywriting.
[0006] This disclosure provides a model training method, which includes: Retrieve knowledge information of all point-of-interest entities in the training tourism route from the point-of-interest entity table. The knowledge information includes the point-of-interest entities and the relationship information between them. Train the knowledge representation model using knowledge information until the first training stopping condition is met; The copywriting generation model is trained using the knowledge embedding vectors of interest point entities output by the trained knowledge representation model and the text titles corresponding to the interest point entities, until the second training stopping condition is met.
[0007] Optionally, a copywriting generation model is trained using the knowledge embedding vectors of interest point entities output by the trained knowledge representation model and the text titles corresponding to the interest point entities, including: The corresponding knowledge embedding vector is copied a certain number of times based on the text length of the interest point entity; The text title is encoded to obtain a text representation vector. The copied knowledge embedding vector is linearly added to the vector of the corresponding interest point entity in the text representation vector to obtain the final embedding vector. The final embedding vector is then input into the copy generation model and the model is trained until the second training stopping condition is met.
[0008] Optionally, the associated information includes one or both of the location information and type information of the point of interest entity.
[0009] This disclosure also provides a text generation method, which includes: Knowledge information of multiple points of interest entities is extracted from tourism route data. The knowledge information of multiple points of interest entities is input into a knowledge representation model, and the knowledge embedding vector of each point of interest entity is output. The knowledge information includes the point of interest entity and the association information between the point of interest entities. Input the knowledge embedding vector and the text title corresponding to the travel route data into the copywriting generation model, and output the copywriting corresponding to the travel route data.
[0010] Optionally, the associated information includes one or both of the location information and type information of the point of interest entity.
[0011] Optionally, the knowledge embedding vector and the text titles corresponding to the travel route data are input into the copywriting generation model, and the copywriting corresponding to the travel route data is output, including: The corresponding knowledge embedding vector is copied a certain number of times based on the text length of the interest point entity; The text title is encoded to obtain a text representation vector. The copied knowledge embedding vector is linearly added to the vector of the corresponding interest point entity in the text representation vector to obtain the final embedding vector. The final embedded vector is input into the copy generation model, which outputs the copy corresponding to the travel route data.
[0012] This disclosure also provides a model training apparatus, which includes: The acquisition module retrieves knowledge information of all point-of-interest entities in the training tourism route from the point-of-interest entity table. The knowledge information includes the point-of-interest entities and the association information between them. The first training module uses knowledge information to train the knowledge representation model until the first training stopping condition is met. The second training module uses the knowledge embedding vectors of interest point entities output by the trained knowledge representation model and the text titles corresponding to the interest point entities to train the copywriting generation model until the second training stopping condition is met.
[0013] This disclosure also provides a document generation apparatus, which includes: The knowledge representation module extracts knowledge information of multiple point-of-interest entities from tourism route data, inputs the knowledge information of multiple point-of-interest entities into the knowledge representation model, and outputs the knowledge embedding vector of each point-of-interest entity. The knowledge information includes the point-of-interest entities and the association information between them. The copy generation module takes the knowledge embedding vector and the text titles corresponding to the travel route data as input into the copy generation model, and outputs the copy corresponding to the travel route data.
[0014] Embodiments of the present invention also provide an electronic device, comprising: processor; Memory, which stores the processor's executable instructions; The processor is configured to execute the steps of the aforementioned model training method or copy generation method by executing executable instructions.
[0015] Embodiments of the present invention also provide a computer-readable storage medium for storing a program that, when executed, implements the steps of the above-described model training method or text generation method.
[0016] The model training and copywriting generation method, apparatus, device, and storage medium of this invention extract knowledge information of multiple point-of-interest (POI) entities from tourism route data, input this knowledge information into a knowledge representation model, and output a knowledge embedding vector for each POI entity. The knowledge information includes the POI entity and the association information between them. The knowledge embedding vector and the text title corresponding to the tourism route data are input into a copywriting generation model, and the copywriting corresponding to the tourism route data is output. In this embodiment, the knowledge embedding vector provides connection information between different POI entities. Therefore, the knowledge embedding vector can characterize the semantic relationships between POI entities. This allows the copywriting generation model to combine the association information between POI entities to generate more comprehensive and accurate copywriting, providing users with a better user experience. Attached Figure Description
[0017] Other features, objects, and advantages of the present invention will become more apparent from the following detailed description of non-limiting embodiments with reference to the accompanying drawings.
[0018] Figure 1 This is a flowchart of the text generation method according to an embodiment of this disclosure.
[0019] Figure 2 A schematic diagram illustrating the principle of the text generation model in this disclosure embodiment.
[0020] Figure 3 A flowchart illustrating the model training method of an embodiment of this disclosure.
[0021] Figure 4This is a schematic diagram of the structure of the model training device according to an embodiment of the present disclosure.
[0022] Figure 5 This is a schematic diagram of the structure of the text generation device according to an embodiment of the present disclosure.
[0023] Figure 6 This is a schematic diagram of the electronic device of the present invention.
[0024] Figure 7 This is a schematic diagram of the structure of a computer-readable storage medium according to an embodiment of the present invention. Detailed Implementation
[0025] The following specific examples illustrate the implementation methods of this application. Those skilled in the art can easily understand the other advantages and effects of this application from the content disclosed herein. This application can also be implemented or applied through other different specific embodiments, and various details in this application can be modified or changed according to different viewpoints and application systems without departing from the spirit of this application. It should be noted that, unless otherwise specified, the embodiments and features in the embodiments of this application can be combined with each other.
[0026] The embodiments of this application will now be described in detail with reference to the accompanying drawings, so that those skilled in the art can easily implement the application. This application may be embodied in many different forms and is not limited to the embodiments described herein.
[0027] Existing NLG methods primarily generate text through pre-trained language models, which can be applied to word generation for travel itineraries. However, in the context of travel itinerary word generation, since a single itinerary may contain one or more points of interest (POIs), the word generation methods obtained using these techniques cannot reflect the correlation between the corresponding POIs within the itinerary. In other words, the word generation solutions using these techniques have low accuracy and result in a poor user experience.
[0028] This disclosure fully considers that, in order for the generated copy to reflect the potential connections between multiple Points of Interest (POIs) along the route, POI knowledge embedding vectors are introduced into the NLG model input. Knowledge provides connection information between different entity nodes; therefore, knowledge embedding can characterize the semantic connections between entity nodes, helping the model learn the association information of POIs and generate more comprehensive copy.
[0029] Figure 1 This is a flowchart of the text word generation method according to an embodiment of this disclosure, such as... Figure 1 As shown in the figure, this disclosure provides a method for generating copywriting keywords, including the following steps: Step 110: Extract knowledge information of multiple point-of-interest entities from the tourism route data, input the knowledge information of multiple point-of-interest entities into the knowledge representation model, and output the knowledge embedding vector of each point-of-interest entity. The knowledge information includes the point-of-interest entity and the association information between point-of-interest entities. Step 120: Input the knowledge embedding vector and the text title corresponding to the travel route data into the copywriting generation model, and output the copywriting corresponding to the travel route data.
[0030] In this embodiment of the disclosure, the knowledge embedding vector provides connection information between different interest point entities. Therefore, the knowledge embedding vector can characterize the semantic association between interest point entities. In this way, the copywriting generation model can combine the association information between interest point entities to generate more comprehensive and accurate copywriting words, bringing users a better user experience.
[0031] In this embodiment of the disclosure, the knowledge representation model selected is the TransE (translating embedding) model, which is used to encode interest point entities and their associated information to obtain knowledge embedding vectors.
[0032] In this embodiment, knowledge extraction is performed on Points of Interest (POIs) using a triple (head, relation, tail), where head is the head entity (POI in this case), tail is the tail entity, and relation is the association information between two POI entities. This association information includes one or more of location, type, and time relationships. For example, (Wuzhen, location, Hangzhou) or (Wuzhen, type, ancient town).
[0033] This knowledge and information can all be extracted from travel route data. For example, all Points of Interest (POIs) can be extracted from travel route data. Based on POI information, location information can be obtained from the POI data table, and type information can be extracted from the POI's description and reviews.
[0034] In this embodiment of the disclosure, the input of the copywriting generation model includes knowledge embedding vectors and text titles corresponding to travel route data. The copywriting generation model that integrates POI knowledge can generate text on the potential connections between POIs in the travel route. The text can be copywriting words or copywriting sentences.
[0035] Specifically, in the copywriting generation model, the knowledge embedding vector and the text title are first fused to obtain the input vector, and then the fused input vector is used to predict the corresponding copywriting.
[0036] For example, Table 1 below shows the knowledge embedding vectors represented by multiple interest point entities:
[0037] As shown above, the knowledge embedding vector for the point of interest entity Wuzhen is [0.1, 0.2, 0.3, 0.5]. Other point of interest entities are shown in Table 1.
[0038] Since interest point entities are represented using vectors, and the text length of an interest point entity may contain two or more characters, when fusing knowledge embedding vectors with text titles, for each interest point entity, the corresponding knowledge embedding vector is copied a certain number of times according to its text length, and then linearly added to the vector of the corresponding interest point entity in the text title to obtain the input vector of the final copy generation model, which is then input into the copy generation model.
[0039] like Figure 2 As shown, the text title is "Wuzhen is a small Xitang". The text length of "Wuzhen" is two Chinese characters. Therefore, the knowledge embedding vector of "Wuzhen" is copied twice and then linearly added to the text embedding vector of "Wuzhen" in the text title.
[0040] In this embodiment of the disclosure, both the knowledge representation model and the copywriting generation model are trained. Please refer to [the relevant documentation]. Figure 3 The flowchart shown illustrates the model training method, which includes: Step 310: Obtain knowledge information of all point of interest entities in the training tourism route from the point of interest entity table. The knowledge information includes the point of interest entities and the association information between them. Step 320: Train the knowledge representation model using the knowledge information until the first training stopping condition is met; Step 330: Use the knowledge embedding vectors of interest point entities output by the trained knowledge representation model and the text titles corresponding to the interest point entities to train the copywriting generation model until the second training stopping condition is met.
[0041] In this embodiment of the disclosure, Figure 1 The knowledge representation model shown is using Figure 3 The method shown can be used to train the vector, but other methods can also be used. Therefore, it can be used to encode interest point entities and their associated information to generate knowledge embedding vectors. Figure 1 The text generation model shown uses Figure 3 The method shown can be used to train the text, but other methods can also be used to train it, so it can be used for copywriting generation.
[0042] Specifically, in one embodiment, knowledge information is obtained by constructing POI location relationship triples, that is, by obtaining the names and locations of all POIs in the tourist route from the POI table and constructing (POI, LOC, location) triples; In another embodiment, knowledge information is obtained by constructing POI type relation triples. Descriptions and reviews of all POIs in the travel route are retrieved from the POI table. The review data is deduplicated, and the top-ranked reviews are selected. The POI descriptions and reviews are then segmented, part-of-speech tagging is performed, and named entity recognition is used to extract the type from the text, constructing (POI, TYPE, type) triples. Using the obtained triples (h,l,t) as input to the knowledge representation model TransE, the model is trained iteratively through gradient descent, with the loss function being:
[0043] Where S is a triplet, and S' is a negatively sampled triplet, i.e., the first or last entity in the triplet is randomly replaced. d(h+l,t) represents the distance between two h+l and t, which can be expressed using the L1 or L2 norm. This refers to the interval distance.
[0044] The fundamental principle of TransE is to ensure that h + l ≈ t, where h, t, and l represent the head entity, tail entity, and the relationship between them, respectively. The model is iteratively trained using gradient descent with a margin-based optimization objective. The goal of the TransE model is to obtain the knowledge embedding vector (KG Embedding) of POI entities, which preserves the potential association information of the knowledge.
[0045] The copywriting generation model chosen is GPT-2, which can be roughly divided into an Input layer, an Embedding layer, and a Decoder layer. The Tokenizer model adopts the configuration of the BERT model. The training process is described below in conjunction with the structure of the copywriting generation model.
[0046] 1) Input Layer. The input text includes the travelogue titles for all Points of Interest (POIs) in the current travel route, as well as the text tags for that route. These are connected by the special symbol [SEP]. Here, the input text is converted into a corresponding token sequence using a tokenizer.
[0047] 2) Token Embedding Layer. Token Embedding is the Embedding layer in GPT-2, essentially a V... The linear transformation layer of length D, where V is the vocabulary size and D is the configurable output dimension, typically set to 768 here. The input token sequence of length L is transformed into L after passing through the embedding layer. The token embedding vector of D.
[0048] 3) Embedding Transformation Addition Layer. After modeling through TransE, a 1-dimensional representation of each POI entity can be obtained. A 768-dimensional KGEmbedding vector X is obtained by copying the vector Xi of each POI in the input text Ni times along its length dimension. The KG Embedding vector of D is given by the token embedding vector, where Ni is the text length of the i-th POI. The KG Embedding vector and the token embedding vector are linearly added together to form the final embedding vector L of the NLG model. D.
[0049] 4) Position Layer. The resulting embedding vector is used as the original input vector. To encode the position information of the input vector, an L layer of the same length as the original input is added. The D-dimensional position vectors are linearly added together to form the final input vector.
[0050] 5) Decoder layer. The Decoder layer is the decoding layer of GPT-2, which is composed of M-layer Decoder Blocks connected in series. The main structure of the Decoder Block consists of a Masked Attention layer and a Feed Forward layer.
[0051] 6) Calculate the loss. The loss is calculated using the LM method, as shown in the formula below. The loss of the i-th word is calculated based on the words in (1, i-1), and the loss function of each input word is calculated in parallel.
[0052]
[0053] 7) Parameter initialization. To obtain a better model and faster training speed, the parameters of the pre-trained Chinese model are selected to initialize the built NLG model.
[0054] 8) Model Training. Model training involves feeding all input data into the built model and calculating the loss value. The training objective is to minimize the loss value. The network parameters are iteratively changed until a fixed number of iterations is reached. The network parameter values at this point are the trained model parameters.
[0055] Further, model testing will continue, with the following specific steps: (1) Obtain the travel routes for which the text to be generated, and parse out all the points of interest (POIs); (2) Obtain the triplet knowledge of all POIs and input it into the trained TransE model to generate the corresponding KGEmbedding vector; (3) Obtain the travelogue titles of all POIs and perform preprocessing; (4) Input (2) and (3) into the trained NLG model; (5) Use Beam Search to decode and generate the required number of texts.
[0056] Figure 4 This is a schematic diagram of the model training device of the present invention. Figure 4 As shown, the model training device 400 of the present invention includes: The acquisition module 410 retrieves knowledge information of all point-of-interest entities in the training tourism route from the point-of-interest entity table. The knowledge information includes the point-of-interest entities and the association information between them. The first training module 420 uses knowledge information to train the knowledge representation model until the first training stopping condition is met. The second training module 430 uses the knowledge embedding vectors of interest point entities output by the trained knowledge representation model and the text titles corresponding to the interest point entities to train the copywriting generation model until the second training stopping condition is met.
[0057] In an optional embodiment, the second training module 430 is specifically used for: The corresponding knowledge embedding vector is copied a certain number of times based on the text length of the interest point entity; The text title is encoded to obtain a text representation vector. The copied knowledge embedding vector is linearly added to the vector of the corresponding interest point entity in the text representation vector to obtain the final embedding vector. The final embedding vector is then input into the copy generation model and the model is trained until the second training stopping condition is met.
[0058] In an optional embodiment, the associated information includes one or both of the location information of the point of interest entity and the type information of the point of interest entity.
[0059] Figure 5 This is a schematic diagram of the document generation device of the present invention. Figure 5 As shown, the document generation apparatus 500 of the present invention includes: The knowledge representation module 510 extracts knowledge information of multiple point-of-interest entities from the tourism route data, inputs the knowledge information of multiple point-of-interest entities into the knowledge representation model, and outputs the knowledge embedding vector of each point-of-interest entity. The knowledge information includes the point-of-interest entities and the association information between them. The copywriting generation module 520 takes the knowledge embedding vector and the text title corresponding to the travel route data as input into the copywriting generation model, and outputs the copywriting corresponding to the travel route data.
[0060] In an optional embodiment, the associated information includes one or both of the location information of the point of interest entity and the type information of the point of interest entity.
[0061] In an optional embodiment, the copy generation module 520 is specifically used for: The corresponding knowledge embedding vector is copied a certain number of times based on the text length of the interest point entity; The text title is encoded to obtain a text representation vector. The copied knowledge embedding vector is linearly added to the vector of the corresponding interest point entity in the text representation vector to obtain the final embedding vector. The final embedded vector is input into the copy generation model, which outputs the copy corresponding to the travel route data.
[0062] The copy generation apparatus of this disclosure uses knowledge embedding vectors to provide connection information between entities of different points of interest. Therefore, knowledge embedding vectors can characterize the semantic relationships between entities of interest. In this way, the copy generation model can combine the relationship information between entities of interest to generate more comprehensive and accurate copy words, bringing a good user experience.
[0063] This invention also provides an electronic device, including a processor and a memory storing executable instructions of the processor. The processor is configured to execute steps of a model training method or a text generation method via the executable instructions.
[0064] As described above, the electronic device of the present invention can extract knowledge information of multiple point-of-interest (POI) entities from travel route data, input the knowledge information of multiple POI entities into a knowledge representation model, and output a knowledge embedding vector for each POI entity. The knowledge information includes the POI entity and the association information between POI entities. The knowledge embedding vector and the text title corresponding to the travel route data are input into a copywriting generation model, and the copywriting corresponding to the travel route data is output. In this embodiment, the knowledge embedding vector provides connection information between different POI entities. Therefore, the knowledge embedding vector can characterize the semantic relationships between POI entities. This allows the copywriting generation model to combine the association information between POI entities to generate more comprehensive and accurate copywriting, providing users with a better user experience.
[0065] Those skilled in the art will understand that various aspects of the present invention can be implemented as systems, methods, or program products. Therefore, various aspects of the present invention can be specifically implemented in the following forms: a completely hardware implementation, a completely software implementation (including firmware, microcode, etc.), or a combination of hardware and software aspects, collectively referred to herein as a "circuit," "module," or "platform."
[0066] Figure 6This is a schematic diagram of the electronic device of the present invention. See below for reference. Figure 6 To describe an electronic device 600 according to this embodiment of the present invention. Figure 6 The electronic device 600 shown is merely an example and should not impose any limitations on the functionality and scope of use of the embodiments of the present invention.
[0067] like Figure 6 As shown, the electronic device 600 is presented in the form of a general-purpose computing device. The components of the electronic device 600 may include, but are not limited to: at least one processing unit 610, at least one storage unit 620, a bus 630 connecting different platform components (including storage unit 620 and processing unit 610), a display unit 640, etc.
[0068] The storage unit stores program code, which can be executed by the processing unit 610 to perform the steps described in the model training method or text generation method section of this specification, according to various exemplary embodiments of the present invention. For example, the processing unit 610 can perform, for example... Figure 1 Or the steps shown in 3.
[0069] Storage unit 620 may include readable media in the form of volatile storage units, such as random access memory (RAM) 621 and / or cache memory 622, and may further include read-only memory (ROM) 623.
[0070] Storage unit 620 may also include a program / utility 624 having a set (at least one) of program modules 625, including but not limited to: an operating system, one or more application programs, other program modules, and program data, each or some combination of these examples may include an implementation of a network environment.
[0071] Bus 630 can represent one or more of several types of bus structures, including a memory cell bus or memory cell controller, a peripheral bus, a graphics acceleration port, a processing unit, or a local bus using any of the various bus structures.
[0072] Electronic device 600 can also communicate with one or more external devices 60 (e.g., keyboard, pointing device, Bluetooth device, etc.), and with one or more devices that enable a user to interact with electronic device 600, and / or with any device that enables electronic device 600 to communicate with one or more other computing devices (e.g., router, modem, etc.). This communication can be performed via input / output (I / O) interface 650. Furthermore, electronic device 600 can also communicate with one or more networks (e.g., local area network (LAN), wide area network (WAN), and / or public networks, such as the Internet) via network adapter 660. Network adapter 660 can communicate with other modules of electronic device 600 via bus 630. It should be understood that, although not shown in the figures, other hardware and / or software modules can be used in conjunction with electronic device 600, including but not limited to: microcode, device drivers, redundant processing units, external disk drive arrays, RAID systems, tape drives, and data backup storage platforms.
[0073] This invention also provides a computer-readable storage medium for storing a program, which, when executed, implements the steps of a model training method or a text generation method. In some possible implementations, various aspects of this invention can also be implemented as a program product comprising program code that, when run on a terminal device, causes the terminal device to perform the steps described in the above-described model training method or text generation method sections of this specification according to various exemplary embodiments of the invention.
[0074] As shown above, when the program of the computer-readable storage medium of this embodiment is executed, it can extract knowledge information of multiple point-of-interest entities from tourism route data, input the knowledge information of multiple point-of-interest entities into a knowledge representation model, and output a knowledge embedding vector for each point-of-interest entity. The knowledge information includes the point-of-interest entity and the association information between point-of-interest entities. The knowledge embedding vector and the text title corresponding to the tourism route data are input into a copywriting generation model, and the copywriting corresponding to the tourism route data is output. In this embodiment of the disclosure, the knowledge embedding vector provides connection information between different point-of-interest entities. Therefore, the knowledge embedding vector can characterize the semantic association between point-of-interest entities. In this way, the copywriting generation model can combine the association information between point-of-interest entities to generate more comprehensive and accurate copywriting words, bringing a better user experience.
[0075] Figure 7 This is a schematic diagram of the structure of the computer-readable storage medium of the present invention. (Reference) Figure 7As shown, a program product 700 for implementing the above-described method according to an embodiment of the present invention is described. It may employ a portable compact disc read-only memory (CD-ROM) and include program code, and may run on a terminal device, such as a personal computer. However, the program product of the present invention is not limited thereto. In this document, the readable storage medium may be any tangible medium containing or storing a program that may be used by or in conjunction with an instruction execution system, apparatus, or device.
[0076] The program product may employ any combination of one or more readable media. A readable medium may be a readable signal medium or a readable storage medium. A readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination thereof. More specific examples of readable storage media (a non-exhaustive list) include: electrical connections having one or more wires, portable disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination thereof.
[0077] Computer-readable storage media may include data signals propagated in baseband or as part of a carrier wave, carrying readable program code. Such propagated data signals may take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination thereof. A readable storage medium may also be any readable medium other than a readable storage medium that can transmit, propagate, or transfer a program for use by or in connection with an instruction execution system, apparatus, or device. The program code contained on the readable storage medium may be transmitted using any suitable medium, including but not limited to wireless, wired, optical fiber, RF, etc., or any suitable combination thereof.
[0078] Program code for performing the operations of this invention can be written in any combination of one or more programming languages, including object-oriented programming languages such as Java and C++, and conventional procedural programming languages such as C or similar languages. The program code can execute entirely on the user's computing device, partially on the user's device, as a standalone software package, partially on the user's computing device and partially on a remote computing device, or entirely on a remote computing device or server. In cases involving remote computing devices, the remote computing device can be connected to the user's computing device via any type of network, including a local area network (LAN) or a wide area network (WAN), or it can be connected to an external computing device (e.g., via the Internet using an Internet service provider).
[0079] In summary, the model training method, copywriting generation method, apparatus, device, and storage medium of the present invention can extract knowledge information of multiple point-of-interest (POI) entities from tourism route data, input the knowledge information of multiple POI entities into a knowledge representation model, and output a knowledge embedding vector for each POI entity. The knowledge information includes the POI entity and the association information between POI entities. The knowledge embedding vector and the text title corresponding to the tourism route data are input into a copywriting generation model, and the copywriting corresponding to the tourism route data is output. In the embodiments of this disclosure, the knowledge embedding vector provides connection information between different POI entities. Therefore, the knowledge embedding vector can characterize the semantic relationships between POI entities. This allows the copywriting generation model to combine the association information between POI entities to generate more comprehensive and accurate copywriting terms, providing users with a better user experience.
[0080] The above description, in conjunction with specific preferred embodiments, provides a further detailed explanation of the present invention. It should not be construed that the specific implementation of the present invention is limited to these descriptions. For those skilled in the art, various simple deductions or substitutions can be made without departing from the concept of the present invention, and all such modifications and substitutions should be considered within the scope of protection of the present invention.
Claims
1. A model training method, characterized in that, include: Retrieve knowledge information of all point-of-interest entities in the training tourism route from the point-of-interest entity table. The knowledge information includes point-of-interest entities and the association information between point-of-interest entities. The knowledge representation model is trained using the knowledge information until the first training stopping condition is met. The knowledge representation model is a TransE model. The copywriting generation model is trained using the knowledge embedding vector of the interest point entity output by the trained knowledge representation model and the text title corresponding to the interest point entity until the second training stopping condition is met. The copywriting generation model is GPT-2. The step of training a copywriting generation model using the knowledge embedding vectors of interest point entities output by the trained knowledge representation model and the text titles corresponding to the interest point entities includes: The corresponding knowledge embedding vector is copied a certain number of times based on the text length of the interest point entity; The text title is encoded to obtain a text representation vector. The copied knowledge embedding vector is linearly added to the vector corresponding to the interest point entity in the text representation vector to obtain the final embedding vector. The final embedding vector is input into the copy generation model and the copy generation model is trained until the second training stopping condition is met.
2. The model training method of claim 1, wherein, The associated information includes one or both of the location information of the point of interest entity and the type information of the point of interest entity.
3. A method for generating a script, characterized by, include: Knowledge information of multiple points of interest entities is extracted from tourism route data. The knowledge information of the multiple points of interest entities is input into a knowledge representation model, and the knowledge embedding vector of each point of interest entity is output. The knowledge information includes the point of interest entities and the association information between them. The knowledge representation model is the TransE model. The knowledge embedding vector and the text title corresponding to the tourism route data are input into the copywriting generation model, and the copywriting corresponding to the tourism route data is output. The copywriting generation model is GPT-2. The step of inputting the knowledge embedding vector and the text title corresponding to the travel route data into the copywriting generation model, and outputting the copywriting corresponding to the travel route data, includes: The corresponding knowledge embedding vector is copied a certain number of times based on the text length of the interest point entity; The text title is encoded to obtain a text representation vector. The copied knowledge embedding vector is linearly added to the vector corresponding to the interest point entity in the text representation vector to obtain the final embedding vector. The final embedding vector is input into the copy generation model, which outputs the copy corresponding to the travel route data.
4. The copywriting generation method according to claim 3, characterized in that, The associated information includes one or both of the location information and type information of the point of interest entity.
5. A model training device, characterized in that, include: The acquisition module retrieves knowledge information of all point-of-interest entities in the training tourism route from the point-of-interest entity table. The knowledge information includes point-of-interest entities and the association information between point-of-interest entities. The first training module uses the knowledge information to train a knowledge representation model until a first training stopping condition is met. The knowledge representation model is a TransE model. The second training module uses the knowledge embedding vectors of interest point entities output by the trained knowledge representation model and the text titles corresponding to the interest point entities to train the copywriting generation model until the second training stopping condition is met. The copywriting generation model is GPT-2. The second training module is specifically used for: The corresponding knowledge embedding vector is copied a certain number of times based on the text length of the interest point entity; The text title is encoded to obtain a text representation vector. The copied knowledge embedding vector is linearly added to the vector corresponding to the interest point entity in the text representation vector to obtain the final embedding vector. The final embedding vector is input into the copy generation model and the copy generation model is trained until the second training stopping condition is met.
6. A copywriting generation device, characterized in that, include: The knowledge representation module extracts knowledge information of multiple point-of-interest entities from tourism route data, inputs the knowledge information of the multiple point-of-interest entities into the knowledge representation model, and outputs the knowledge embedding vector of each point-of-interest entity. The knowledge information includes the point-of-interest entities and the association information between them. The knowledge representation model is the TransE model. The copywriting generation module inputs the knowledge embedding vector and the text title corresponding to the travel route data into the copywriting generation model and outputs the copywriting corresponding to the travel route data. The copywriting generation model is GPT-2. The copywriting generation module is specifically used for: The corresponding knowledge embedding vector is copied a certain number of times based on the text length of the interest point entity; The text title is encoded to obtain a text representation vector. The copied knowledge embedding vector is linearly added to the vector corresponding to the interest point entity in the text representation vector to obtain the final embedding vector. The final embedding vector is input into the copy generation model, which outputs the copy corresponding to the travel route data.
7. An electronic device, characterized in that, include: processor; A memory in which executable instructions of the processor are stored; The processor is configured to execute the steps of the model training method of claim 1 or 2, or the steps of the text generation method of claim 3 or 4, by executing the executable instructions.
8. A computer-readable storage medium for storing a program, characterized in that, When the program is executed, it implements the steps of the model training method of claim 1 or 2, or the steps of the text generation method of claim 3 or 4.
Citation Information
Patent Citations
Copywriting generation method and device, electronic equipment and storage medium
CN112883725A
Natural language processing model training method, text processing method and device
CN114330281A
Cboth case generation method and device, model training method and device, equipment and storage medium
CN114997131A
