A foreign language article writing assistance method and system

By identifying intentions on the above example sentences and extracting features from the corpus, building the action space of the initial recommendation agent and carrying out reinforcement learning training, the problem of single auxiliary writing recommendation results and high repetition rate in the existing technology is solved, and the improvement is achieved Personalized and efficient writing assistance.

CN119003754BActive Publication Date: 2025-02-18HENAN LANSHI ARTIFICIAL INTELLIGENCE TECHNOLOGY CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202411455844.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-10-18
Publication Date
2025-02-18
Estimated Expiration
2044-10-18

AI Technical Summary

Technical Problem

In the prior art, when assisting writing, the recommendation results are single, the repetition rate is high, and the personalization is insufficient, resulting in a low user experience.

Method used

By identifying intentions in the above example sentences, obtaining intention characteristics, grab the recommended features and constructing features from the corpus, sorting them according to similarity, constructing the action space of the initial recommendation agent, and performing turn-based training through reinforcement learning, obtaining Complete the training recommended agent for real-time writing assistance.

Benefits of technology

It improves user experience and writing efficiency, provides more personalized writing recommendation results, and avoids the singularity and repetition of recommendation results.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119003754B_ABST
    Figure CN119003754B_ABST
Patent Text Reader

Abstract

The present application provides a foreign language article writing assistance method and system, including: performing intent recognition on the above example sentences, obtaining a first intent feature, grabbing n recommendation features from a corpus, and obtaining a first sorting result; using the first intent feature as the input of a pre-trained recommendation word construction model, and obtaining a second sorting result based on the output of the recommendation word construction model; using the first sorting result and the second sorting result as the action space of an initial recommendation agent, using the first intent feature as the current state of the initial recommendation agent, and obtaining the recommendation result with the highest evaluation value from the action space based on the initial recommendation agent; obtaining an instant reward for the initial recommendation agent based on the recommendation result, performing turn-based training on the initial recommendation agent based on the instant reward, obtaining a recommendation agent that has completed the training, and performing real-time writing assistance based on the recommendation agent; the use of the present application can improve the user experience.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of deep learning intelligent writing technology, and in particular to a foreign language article writing assistance method and system. Background Art

[0002] Existing related technologies extract words from the database, perform semantic analysis on the words, and extract similar words and sentences to clarify the word-sentence relationship required for writing text, thereby assisting users in writing. However, this writing assistance method can only provide users with recommendation results in fixed modes or fixed scenarios, resulting in single recommendations under similar semantics, and the words and sentences recommended only based on similarity have a high repetition rate, lack of personalization, and low user experience. Summary of the invention

[0003] The purpose of this application is to address the deficiencies of the above-mentioned prior art and to propose a foreign language article writing assistance method and system that can improve user experience.

[0004] In a first aspect, the present application provides a foreign language article writing assistance method, comprising:

[0005] Perform intent recognition on the above example sentence to obtain a first intent feature, grab n recommended features from the corpus, and sort the n recommended features in order of similarity to the first intent feature to obtain a first sorting result; n is a positive integer;

[0006] Using the first intent feature as an input of a pre-trained recommendation word construction model, obtaining n construction features based on the output of the recommendation word construction model, and sorting the n construction features in order of similarity to the first intent feature to obtain a second sorting result;

[0007] Taking the first sorting result and the second sorting result as the action space of the initial recommendation agent, taking the first intention feature as the current state of the initial recommendation agent, and obtaining the recommendation result with the highest evaluation value from the action space based on the initial recommendation agent;

[0008] According to the recommendation result, an instant reward for the initial recommendation agent is obtained, and according to the instant reward, round-based training is performed on the initial recommendation agent to obtain a recommendation agent that has completed the training, and real-time writing assistance is performed based on the recommendation agent.

[0009] The present application not only extracts recommendation features for commonly used words and phrases from a known corpus based on intent features, but also constructs unknown construction features based on intent features, so that the recommendation agent or the initial recommendation agent can always explore different writing recommendations, and the recommendations are based on the intent features of the above text without being separated from the emotions or intentions of the above text, thereby providing users with more writing recommendation results to improve the user's sense of use and writing efficiency, thereby improving the user's sense of use and user experience; and, by sorting the recommendation features and construction features according to their similarity to the intent features, and measuring the actions in the action space by similarity, the application can adapt to different action spaces, thereby providing users with more personalized auxiliary writing recommendations to improve the user's sense of use and writing efficiency.

[0010] Furthermore, the step of extracting n recommendation features from the corpus includes:

[0011] All corpus features related to the first intent feature are captured from the corpus, and m round-based sampling features are sampled from the corpus. According to the final evaluation value after the end of the corresponding round, the intra-group consistency results of the sampled features are evaluated, and n recommended features are screened out according to the intra-group consistency results; m is a positive integer.

[0012] Furthermore, according to the intra-group consistency result, n recommended features are screened out, including:

[0013] The sampling features whose intra-group consistency results meet the consistency threshold are obtained to obtain n high-dimensional recommendation features, and based on Lasso regression, the n high-dimensional recommendation features are feature compressed to obtain n low-dimensional recommendation features.

[0014] Furthermore, the output of the recommendation word construction model is used to obtain n construction features, including:

[0015] Based on the output of the recommendation word construction model, k candidate construction features are obtained, and the feature differences between the feature vectors of the n recommendation features and the k candidate construction features are obtained in turn. For each candidate construction feature, a maximum feature difference value is selected from the n feature differences, and a total of k maximum feature differences are obtained. The first n maximum feature difference values ​​are selected from the k maximum feature differences as n construction features; k is a positive integer.

[0016] Further, the performing of intent recognition on the above example sentence to obtain the first intent feature includes:

[0017] The characters in the above example sentence are mapped into digital vectors, and the digital vectors are encoded through a pre-trained recurrent neural network to obtain word vectors, and the word vectors are used as input of a pre-trained large language model for intent recognition, and the first intent feature is obtained based on the output of the large language model.

[0018] Furthermore, the first intent feature includes: a positive sample and a negative sample; the first intent feature is obtained based on the output of the large language model, including:

[0019] The output based on the large language model is used as the positive sample, and a random masking operation is performed on the positive sample through a random mask to obtain a negative sample; the positive sample and the negative sample are used to construct a discriminative loss function for the initial recommendation agent, so that round-based training is performed according to the discriminative loss function.

[0020] This application uses the output of the large model as the positive sample, performs a mask operation on the positive sample to obtain the negative sample, and constructs the negative sample to balance the sample categories, which can improve the personalized recommendation of the initial recommendation agent for different users, thereby improving the user experience.

[0021] Furthermore, the instant reward includes: a positive sample instant reward and a negative sample instant reward; and the round-based training of the initial recommendation agent according to the instant reward includes:

[0022] According to the second intention feature of executing the recommendation result, the evaluation value at the next moment is obtained, and according to the positive sample instant reward and the evaluation value at the next moment, and according to the negative sample instant reward and the evaluation value at the next moment, a first time differential error and a second time differential error are obtained respectively, and according to the first time differential error and the second time differential error, a discriminative loss function value is obtained, and according to the discriminative loss function value, round-based training is performed on the initial recommendation agent.

[0023] Furthermore, the discriminative loss function is expressed as:

[0024] L =max( ,0);

[0025] in, and are the first time difference error and the second time difference error respectively; and They are the immediate rewards for positive samples and the immediate rewards for negative samples, is the discount factor; is the evaluation value of the positive sample relative to the negative sample at the next moment, and are the evaluation values ​​of the positive sample and the negative sample at the next moment respectively; is the evaluation value of negative samples relative to positive samples at the next moment; and are the evaluation values ​​of the positive sample and the negative sample at this moment respectively; is a non-negative hyperparameter, To preset hyperparameters; is the two-norm.

[0026] Further, obtaining the recommendation result with the highest value from the action space includes:

[0027] Generate a random probability. If the random probability is less than a threshold, based on the initial recommendation agent, select the ranking feature with the highest evaluation value from the action space as the final recommendation result; otherwise, select the historical recommendation result with the highest frequency from all historical recommendation results of the first intention feature in the current round as the recommendation result; the ranking value includes: the ranking feature corresponding to the first ranking result and the ranking feature corresponding to the second ranking result.

[0028] In a second aspect, the present application provides a foreign language article writing assistance system, including: an intention extraction module, a recommendation word construction module, a decision module, and a training and real-time assistance module; wherein,

[0029] The intention extraction module is used to perform intention recognition on the above example sentence, obtain a first intention feature, capture n recommended features from the corpus, and sort the n recommended features in order of similarity to the first intention feature to obtain a first sorting result; n is a positive integer;

[0030] The recommendation word construction module is used to use the first intention feature as an input of a pre-trained recommendation word construction model, obtain n construction features based on the output of the recommendation word construction model, and sort the n construction features in order of similarity to the first intention feature to obtain a second sorting result;

[0031] The decision module is configured to use the first sorting result and the second sorting result as an action space of an initial recommendation agent, use the first intention feature as a current state of the initial recommendation agent, and obtain a recommendation result with the highest evaluation value from the action space based on the initial recommendation agent;

[0032] The training and real-time assistance module is used to obtain an instant reward for the initial recommendation agent based on the recommendation result, perform round-based training on the initial recommendation agent based on the instant reward to obtain a recommendation agent that has completed the training, and perform real-time writing assistance based on the recommendation agent. BRIEF DESCRIPTION OF THE DRAWINGS

[0033] Figure 1 It is a flowchart of a foreign language article writing assistance method provided by this application;

[0034] Figure 2Schematic diagram I of another foreign language article writing assistance method provided by the present application;

[0035] Figure 3 It is a flowchart II of another foreign language article writing assistance method provided by the present application;

[0036] Figure 4 It is a structural diagram of a foreign language article writing assistance system provided by this application. DETAILED DESCRIPTION

[0037] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.

[0038] See also Figure 1 , is a flowchart of a foreign language article writing assistance method provided by the present application, comprising: steps S11 to S14, specifically:

[0039] Step S11, perform intent recognition on the above example sentence, obtain a first intent feature, grab n recommended features from the corpus, and sort the n recommended features in order of similarity to the first intent feature to obtain a first sorting result; n is a positive integer.

[0040] It is worth noting that the first intent feature is the intent feature of the current example sentence above, and the second intent feature mentioned later is the intent feature identified again after the recommendation result is executed; the first sorting result is the result of sorting the n recommended features from large to small according to their similarity with the first intent feature, and the second sorting result mentioned later is the result of sorting the constructed features from large to small according to their similarity with the first intent feature.

[0041] In some embodiments, intent recognition is performed on the above example sentence to obtain a first intent feature, including: mapping the characters in the above example sentence into digital vectors, encoding the digital vectors through a pre-trained recurrent neural network to obtain word vectors, and using the word vectors as input to a pre-trained large language model for intent recognition, and obtaining a first intent feature based on the output of the large language model.

[0042] In some embodiments, the recurrent neural network may be a bidirectional long short term recurrent neural network (Bi-directional long short term memory, Bi-Lstm).

[0043] In some embodiments, before using the word vector as the input of a pre-trained large language model for intent recognition, it can include: performing dot multiplication of the digital vector and the word vector with a preset reference vector to measure the degree of encoding, respectively obtaining a digital semantic vector and a word semantic vector, and performing Kronecker product on the digital semantic vector and the word semantic vector for semantic fusion to obtain a fusion feature of the intent to be recognized, and using the final fusion feature as the input of the pre-trained large language model for intent recognition.

[0044] In some embodiments, the first intent feature includes: positive samples and negative samples; based on the output of the large language model, the first intent feature is obtained, including: taking the output based on the large language model as a positive sample, performing a random masking operation on the positive sample through a random mask, to obtain a negative sample; the positive samples and the negative samples are used to construct a discriminative loss function for the initial recommendation agent, so as to perform round-based training according to the discriminative loss function.

[0045] It is worth noting that the output of the large model is used as the positive sample, and the masking operation is performed on the positive sample to obtain the negative sample. Since this application does not label the materials in the pre-corpus and adopts an unsupervised recommendation method, if only positive samples are used to train the initial recommendation agent, the sample of the initial recommendation agent will be single, the fitting ability will be higher, but the generalization ability will be lower. Therefore, in order to improve the personalized recommendations of the initial recommendation agent for different users, negative samples are constructed to balance the sample categories.

[0046] In some embodiments, n recommended features are captured from a corpus, including: capturing all corpus features related to the intent features from the corpus, sampling m round-based sampling features from the corpus, and evaluating the intra-group consistency results of the sampled features according to the final evaluation values ​​after the end of the corresponding round-based system, and screening out n recommended features based on the intra-group consistency results; m is a positive integer.

[0047] In some embodiments, n recommended features are screened out based on the intra-group consistency results, including: obtaining sampling features whose intra-group consistency results meet the consistency threshold to obtain n high-dimensional recommended features, and based on Lasso regression, performing feature compression on the n high-dimensional recommended features to obtain n low-dimensional recommended features.

[0048] It is worth noting that the recommendation features have been screened out based on the known corpus. Since these recommendation features already exist, after a limited number of times, the recommendation results will tend to be unified, that is, no matter which user inputs which context, the recommendation agent will recommend the same and repeated results. Therefore, in order to break this unreasonable circular recommendation, the present application provides an unknown construction feature based on the intention feature, so that the recommendation agent or the initial recommendation agent can always explore different writing recommendations, but this writing recommendation is based on the intention feature of the context, and does not deviate from the emotion or intention of the context, so as to provide users with more writing recommendation results to improve the user's writing efficiency, as shown in step S12.

[0049] Step S12: use the first intent feature as the input of a pre-trained recommendation word construction model, obtain n construction features based on the output of the recommendation word construction model, and sort the n construction features in order of similarity to the first intent feature to obtain a second sorting result.

[0050] In some embodiments, based on the output of the recommendation word construction model, n construction features are obtained, including: based on the output of the recommendation word construction model, k candidate construction features are obtained, and feature differences between feature vectors of the n recommendation features and the k candidate construction features are obtained in turn, for each candidate construction feature, the maximum feature difference value is selected from the n feature differences, a total of k maximum feature differences are obtained, and the first n maximum feature difference values ​​are selected from the k maximum feature differences as n construction features; k is a positive integer.

[0051] Step S13: Use the first sorting result and the second sorting result as the action space of the initial recommendation agent, use the first intention feature as the current state of the initial recommendation agent, and obtain the recommendation result with the highest evaluation value from the action space based on the initial recommendation agent.

[0052] It is worth noting that the reason why the first sorting result and the second sorting result use the sorting state as the action space is that the intent features identified each time (including: the first intent feature, the second intent feature or the remaining intent features) are different, and their corresponding action spaces are also different, that is, the action space is always changing, so the initial recommendation agent is always unable to learn a reasonable strategy. In order to solve this problem, the present application sorts these recommended features and construction features respectively according to the degree of similarity with the intent features, so that the initial recommendation agent can learn the strategy of choosing recommended features or construction features, and which recommended features or which construction features to choose.

[0053] Step S14: Based on the recommendation results, an instant reward is obtained for the initial recommendation agent. Based on the instant reward, round-based training is performed on the initial recommendation agent to obtain a recommendation agent that has completed the training, and real-time writing assistance is performed based on the recommendation agent.

[0054] In some embodiments, the instant reward includes: a positive sample instant reward and a negative sample instant reward; based on the instant reward, the initial recommendation agent is trained in a turn-based manner, including: based on the second intention feature of executing the recommendation result, obtaining the evaluation value at the next moment, and based on the positive sample instant reward and the evaluation value at the next moment, and based on the negative sample instant reward and the evaluation value at the next moment, obtaining the first time differential error and the second time differential error respectively, obtaining the discriminative loss function value based on the first time differential error and the second time differential error, and based on the discriminative loss function value, performing turn-based training on the initial recommendation agent.

[0055] In some embodiments, the discriminative loss function is expressed as:

[0056] L =max( ,0);

[0057] in, and are the first time difference error and the second time difference error respectively; and They are the immediate rewards for positive samples and the immediate rewards for negative samples, is the discount factor; is the evaluation value of the positive sample relative to the negative sample at the next moment, and are the evaluation values ​​of the positive sample and the negative sample at the next moment respectively; is the evaluation value of negative samples relative to positive samples at the next moment; and are the evaluation values ​​of the positive sample and the negative sample at this moment respectively; is a non-negative hyperparameter, To preset hyperparameters; is the two-norm.

[0058] In some embodiments, see Figure 2 and Figure 3 , respectively, are flow charts I and II of another foreign language article writing assistance method provided by the present application. Figure 2In , after the intent recognition is performed on the above example sentence, the intent feature is obtained, and the intent feature is used as a positive sample, and a negative sample is constructed based on the positive sample. At this time, the recommended features and the construction features can be obtained according to the positive sample and the negative sample, respectively, that is, the corresponding recommended features and the construction features can be obtained according to the positive sample, and the corresponding recommended features and the construction features can also be obtained according to the negative sample. When sorting, the recommended features of the positive sample, the construction features of the positive sample, the recommended features of the negative sample, and the construction features of the negative sample are sorted respectively, and the first sorting result of the positive sample, the second sorting result of the positive sample, the first sorting result of the negative sample, and the second sorting result of the negative sample can be obtained accordingly, that is, whether the recommended features or the construction features of the positive sample or the negative sample are sorted respectively, the sorting result of the recommended features corresponds to the first sorting result, and the sorting result of the construction features corresponds to the second sorting result. After the recommended features and the construction features of the positive sample are sorted respectively, the first sorting result and the second sorting result of the positive sample are obtained, and the first sorting result and the second sorting result are used as a set of action spaces of the initial recommendation agent. After the recommended features and constructed features of the negative samples are sorted respectively, a first sorting result and a second sorting result of the negative samples are obtained, and the first sorting result and the second sorting result of the negative samples are used as a set of action spaces of the initial recommendation agent.

[0059] exist Figure 3 In , according to the constructed action space, the discriminative loss function value can be obtained, and the parameters of the initial recommendation agent are updated according to the discriminative loss function value. At this time, the positive sample and the negative sample need to be used as the input of the initial recommendation agent respectively, and the recommendation results of the positive sample and the recommendation results of the negative sample are output respectively, and the positive sample immediate reward and the evaluation value of the positive sample are obtained respectively. The evaluation value of the positive sample here is the evaluation value of the recommendation result of the positive sample. Similarly, the evaluation value of the negative sample here is the evaluation value of the recommendation result of the negative sample; and, after the recommendation result of the negative sample is executed, the negative sample of the intention feature at the next moment is obtained, and after the recommendation result of the positive sample is executed, the positive sample of the intention feature at the next moment is obtained, and the evaluation value of the positive sample at the next moment and the evaluation value of the negative sample at the next moment are obtained respectively, so as to obtain the discriminative loss function value according to the positive sample immediate reward, the evaluation value of the positive sample, the negative sample immediate reward, the evaluation value of the negative sample, the evaluation value of the positive sample at the next moment and the evaluation value of the negative sample at the next moment.

[0060] It is worth noting that in Figure 3 The framework of the initial recommendation agent in the paper adopts a framework based on reinforcement learning, which can be said to be a framework based on deep reinforcement learning for unsupervised learning. In particular, positive and negative samples are used to construct a discriminative loss function to balance the sample categories of the initial atlas agent, so as to improve the generalization ability of the initial recommendation agent.

[0061] In some embodiments, real-time writing assistance is performed based on a recommendation agent, including: when a user inputs part of the content, extracting the real-time previous content according to a preset step size, and identifying the intention features of the previous content; then grabbing n recommendation features from the corpus, and sorting the n recommendation features in order of similarity to the intention features of the previous content, to obtain a real-time sorting result based on a known corpus; at the same time, using the intention features of the previous content as the input of a recommendation word construction model, and obtaining n construction features based on the output of the recommendation word construction model, and sorting the n construction features in order of similarity to the intention features of the previous content, to obtain a real-time construction sorting result based on an unknown; then, using the real-time sorting result and the real-time construction sorting result as the action space of the trained recommendation agent, using the intention features of the previous content as the input of the recommendation agent, and based on the output of the recommendation agent, obtaining the action with the highest evaluation value in the action space as the recommendation result, and providing writing assistance to the user based on the recommendation result.

[0062] The present application not only extracts recommendation features for commonly used words and phrases from a known corpus based on intent features, but also constructs unknown construction features based on intent features, so that the recommendation agent or the initial recommendation agent can always explore different writing recommendations, and the recommendations are based on the intent features of the above text without being separated from the emotions or intentions of the above text, thereby providing users with more writing recommendation results to improve the user's sense of use and writing efficiency, thereby improving the user's sense of use and user experience; and, by sorting the recommendation features and construction features according to their similarity to the intent features, and measuring the actions in the action space by similarity, the application can adapt to different action spaces, thereby providing users with more personalized auxiliary writing recommendations to improve the user's sense of use and writing efficiency.

[0063] Example 2

[0064] See also Figure 4 , is a structural diagram of a foreign language article writing assistance system provided by the present application, comprising: an intention extraction module 21, a recommendation word construction module 22, a decision module 23 and a training and real-time assistance module 24.

[0065] In some embodiments, the intention extraction module 21 obtains the intention features of the above example sentences, and sorts the intention features to obtain a first sorting result, and transmits the first sorting result to the decision module 23, and transmits the intention features to the recommendation word construction module 22. After receiving the intention features, the recommendation word construction module 22 obtains the construction features, sorts the construction features, obtains and outputs the second sorting result to the decision module 23; after receiving the first sorting result and the second sorting result, the decision module 23 makes a decision on the optimal recommendation result, outputs the recommendation result, and transmits the recommendation result to the training and real-time assistance module 24; after receiving the recommendation result, the training and real-time assistance module 24 trains the initial recommendation agent to obtain a trained recommendation agent, and performs real-time assistance based on the recommendation agent.

[0066] The intention extraction module 21 is used to identify the intention of the above example sentence, obtain the first intention feature, capture n recommended features from the corpus, and sort the n recommended features in order of similarity to the first intention feature to obtain a first sorting result; n is a positive integer.

[0067] In some embodiments, intent recognition is performed on the above example sentence to obtain a first intent feature, including: mapping the characters in the above example sentence into digital vectors, encoding the digital vectors through a pre-trained recurrent neural network to obtain word vectors, and using the word vectors as input to a pre-trained large language model for intent recognition, and obtaining a first intent feature based on the output of the large language model.

[0068] In some embodiments, the first intent feature includes: positive samples and negative samples; based on the output of the large language model, the first intent feature is obtained, including: taking the output based on the large language model as a positive sample, performing a random masking operation on the positive sample through a random mask, to obtain a negative sample; the positive samples and the negative samples are used to construct a discriminative loss function for the initial recommendation agent, so as to perform round-based training according to the discriminative loss function.

[0069] In some embodiments, n recommended features are captured from a corpus, including: capturing all corpus features related to the intent features from the corpus, sampling m round-based sampling features from the corpus, and evaluating the intra-group consistency results of the sampled features according to the final evaluation values ​​after the end of the corresponding round-based system, and screening out n recommended features based on the intra-group consistency results; m is a positive integer.

[0070] It is worth noting that, since the intent features identified each time have a certain degree of similarity in representation with the corpus-based materials, but are not exactly the same, this application does not directly select features similar to the intent features from the corpus by similarity as recommended features, but instead uses recommended features after multiple rounds of training to sample training rounds, and uses evaluation values ​​to score the sampled features. It is worth noting that this evaluation value is the value calculated by the initial recommendation agent for each training. For example, if the initial recommendation agent uses deep reinforcement learning, the evaluation value is the Q value of the recommended feature after training. The sampled features here are the recommended features after sampling. This application directly uses the final evaluation value given to the recommended features by the initial recommendation agent after each round of training, evaluates the consistency results within the sampled features, retains the sampled features that are not less than the consistency threshold, and completes the capture of the recommended features.

[0071] In some embodiments, n recommended features are screened out based on the intra-group consistency results, including: obtaining sampling features whose intra-group consistency results meet the consistency threshold to obtain n high-dimensional recommended features, and based on Lasso regression, performing feature compression on the n high-dimensional recommended features to obtain n low-dimensional recommended features.

[0072] The recommendation word construction module 22 is used to use the first intention feature as the input of a pre-trained recommendation word construction model, obtain n construction features based on the output of the recommendation word construction model, and sort the n construction features in order of similarity to the first intention feature to obtain a second sorting result.

[0073] In some embodiments, based on the output of the recommendation word construction model, n construction features are obtained, including: based on the output of the recommendation word construction model, k candidate construction features are obtained, and feature differences between feature vectors of the n recommendation features and the k candidate construction features are obtained in turn, for each candidate construction feature, the maximum feature difference value is selected from the n feature differences, a total of k maximum feature differences are obtained, and the first n maximum feature difference values ​​are selected from the k maximum feature differences as n construction features; k is a positive integer.

[0074] The decision module 23 is used to use the first sorting result and the second sorting result as the action space of the initial recommendation agent, use the first intention feature as the current state of the initial recommendation agent, and obtain the recommendation result with the highest evaluation value from the action space based on the initial recommendation agent.

[0075] The training and real-time assistance module 24 is used to obtain an instant reward for the initial recommendation agent based on the recommendation results, conduct round-based training on the initial recommendation agent based on the instant reward, obtain a recommendation agent that has completed the training, and perform real-time writing assistance based on the recommendation agent.

[0076] In some embodiments, the instant reward includes: a positive sample instant reward and a negative sample instant reward; based on the instant reward, the initial recommendation agent is trained in a turn-based manner, including: based on the second intention feature of executing the recommendation result, obtaining the evaluation value at the next moment, and based on the positive sample instant reward and the evaluation value at the next moment, and based on the negative sample instant reward and the evaluation value at the next moment, obtaining the first time differential error and the second time differential error respectively, obtaining the discriminative loss function value based on the first time differential error and the second time differential error, and based on the discriminative loss function value, performing turn-based training on the initial recommendation agent.

[0077] In some embodiments, the discriminative loss function is expressed as:

[0078] L =max( ,0);

[0079] in, and are the first time difference error and the second time difference error respectively; and They are the immediate rewards for positive samples and the immediate rewards for negative samples, is the discount factor; is the evaluation value of the positive sample relative to the negative sample at the next moment, and are the evaluation values ​​of the positive sample and the negative sample at the next moment respectively; is the evaluation value of negative samples relative to positive samples at the next moment; and are the evaluation values ​​of the positive sample and the negative sample at this moment respectively; is a non-negative hyperparameter, To preset hyperparameters; is the two-norm.

[0080] The present application not only extracts recommendation features for commonly used words and phrases from a known corpus based on intent features, but also constructs unknown construction features based on intent features, so that the recommendation agent or the initial recommendation agent can always explore different writing recommendations, and the recommendations are based on the intent features of the above text without being separated from the emotions or intentions of the above text, thereby providing users with more writing recommendation results to improve the user's sense of use and writing efficiency, thereby improving the user's sense of use and user experience; and, by sorting the recommendation features and construction features according to their similarity to the intent features, and measuring the actions in the action space by similarity, the application can adapt to different action spaces, thereby providing users with more personalized auxiliary writing recommendations to improve the user's sense of use and writing efficiency.

[0081] Those skilled in the art will appreciate that the embodiments of the present application may also provide computer program products. Therefore, the present application may adopt the form of complete hardware embodiments, complete software embodiments, or embodiments in combination with software and hardware. Moreover, the present application may adopt the form of computer program products implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) that contain computer-usable program codes.

[0082] The present application is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the embodiments of the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.

[0083] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.

[0084] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process in the computer or other programmable device. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.

[0085] The above is only a preferred implementation of the present application. It should be pointed out that for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the technical principles of the present application. These improvements and modifications should also be regarded as the scope of protection of the present application.

Claims

1. A foreign language article writing assistance method, characterized in that: include: Perform intent recognition on the above example sentence to obtain a first intent feature, grab n recommended features from the corpus, and sort the n recommended features in order of similarity to the first intent feature to obtain a first sorting result; n is a positive integer; Using the first intent feature as an input of a pre-trained recommendation word construction model, obtaining n construction features based on the output of the recommendation word construction model, and sorting the n construction features in order of similarity to the first intent feature to obtain a second sorting result; Taking the first sorting result and the second sorting result as the action space of the initial recommendation agent, taking the first intention feature as the current state of the initial recommendation agent, and obtaining the recommendation result with the highest evaluation value from the action space based on the initial recommendation agent; According to the recommendation result, an instant reward of the initial recommendation agent is obtained, and according to the instant reward, round-based training is performed on the initial recommendation agent to obtain a recommendation agent that has completed the training, and real-time writing assistance is performed based on the recommendation agent; The step of performing intent recognition on the above example sentence to obtain the first intent feature includes: Map the characters in the above example sentence into digital vectors, encode the digital vectors through a pre-trained recurrent neural network to obtain word vectors, and use the word vectors as inputs of a pre-trained large language model for intent recognition, and obtain a first intent feature based on the output of the large language model; The first intent feature includes: a positive sample and a negative sample; the first intent feature is obtained based on the output of the large language model, including: The output based on the large language model is used as the positive sample, and a random masking operation is performed on the positive sample through a random mask to obtain a negative sample; the positive sample and the negative sample are used to construct a discriminative loss function for the initial recommendation agent, so that round-based training is performed according to the discriminative loss function; The instant reward includes: a positive sample instant reward and a negative sample instant reward; and the round-based training of the initial recommendation agent according to the instant reward includes: According to the second intention feature of executing the recommendation result, an evaluation value at the next moment is obtained, and according to the positive sample instant reward and the evaluation value at the next moment, and according to the negative sample instant reward and the evaluation value at the next moment, a first time difference error and a second time difference error are obtained respectively, and a discriminative loss function value is obtained according to the first time difference error and the second time difference error, and according to the discriminative loss function value, round-based training is performed on the initial recommendation agent; The discriminative loss function is expressed as: L =max( ,0); in, and are the first time difference error and the second time difference error respectively; and They are the immediate rewards for positive samples and the immediate rewards for negative samples, is the discount factor; is the evaluation value of the positive sample relative to the negative sample at the next moment, and are the evaluation values ​​of the positive sample and the negative sample at the next moment respectively; is the evaluation value of negative samples relative to positive samples at the next moment; and are the evaluation values ​​of the positive sample and the negative sample at this moment respectively; is a non-negative hyperparameter, To preset hyper parameters; is the two-norm.

2. The foreign language article writing assistance method according to claim 1, characterized in that: The method of extracting n recommended features from the corpus includes: All corpus features related to the first intent feature are captured from the corpus, and m round-based sampling features are sampled from the corpus. According to the final evaluation value after the end of the corresponding round, the intra-group consistency results of the sampled features are evaluated, and n recommended features are screened out according to the intra-group consistency results; m is a positive integer.

3. The foreign language article writing assistance method according to claim 2, characterized in that: According to the intra-group consistency result, n recommended features are screened out, including: The sampling features whose intra-group consistency results meet the consistency threshold are obtained to obtain n high-dimensional recommendation features, and based on Lasso regression, the n high-dimensional recommendation features are feature compressed to obtain n low-dimensional recommendation features.

4. The foreign language article writing assistance method according to claim 1, characterized in that: The output of the recommendation word construction model is used to obtain n construction features, including: Based on the output of the recommendation word construction model, k candidate construction features are obtained, and the feature differences between the feature vectors of the n recommendation features and the k candidate construction features are obtained in turn. For each candidate construction feature, a maximum feature difference value is selected from the n feature differences, and a total of k maximum feature differences are obtained. The first n maximum feature difference values ​​are selected from the k maximum feature differences as n construction features; k is a positive integer.

5. A foreign language article writing assistance system, characterized in that: include: Intention extraction module, recommendation word construction module, decision module and training and real-time auxiliary module; among them, The intention extraction module is used to perform intention recognition on the above example sentence, obtain a first intention feature, capture n recommended features from the corpus, and sort the n recommended features in order of similarity to the first intention feature to obtain a first sorting result; n is a positive integer; The recommendation word construction module is used to use the first intention feature as an input of a pre-trained recommendation word construction model, obtain n construction features based on the output of the recommendation word construction model, and sort the n construction features in order of similarity to the first intention feature to obtain a second sorting result; The decision module is configured to use the first sorting result and the second sorting result as an action space of an initial recommendation agent, use the first intention feature as a current state of the initial recommendation agent, and obtain a recommendation result with the highest evaluation value from the action space based on the initial recommendation agent; The training and real-time assistance module is used to obtain an instant reward for the initial recommendation agent according to the recommendation result, perform round-based training on the initial recommendation agent according to the instant reward, obtain a recommendation agent that has completed the training, and perform real-time writing assistance based on the recommendation agent; The step of performing intent recognition on the above example sentence to obtain the first intent feature includes: Map the characters in the above example sentence into digital vectors, encode the digital vectors through a pre-trained recurrent neural network to obtain word vectors, and use the word vectors as inputs of a pre-trained large language model for intent recognition, and obtain a first intent feature based on the output of the large language model; The first intent feature includes: a positive sample and a negative sample; the first intent feature is obtained based on the output of the large language model, including: The output based on the large language model is used as the positive sample, and a random masking operation is performed on the positive sample through a random mask to obtain a negative sample; the positive sample and the negative sample are used to construct a discriminative loss function for the initial recommendation agent, so that round-based training is performed according to the discriminative loss function; The instant reward includes: a positive sample instant reward and a negative sample instant reward; and the round-based training of the initial recommendation agent according to the instant reward includes: According to the second intention feature of executing the recommendation result, an evaluation value at the next moment is obtained, and according to the positive sample instant reward and the evaluation value at the next moment, and according to the negative sample instant reward and the evaluation value at the next moment, a first time difference error and a second time difference error are obtained respectively, and a discriminative loss function value is obtained according to the first time difference error and the second time difference error, and according to the discriminative loss function value, round-based training is performed on the initial recommendation agent; The discriminative loss function is expressed as: L =max( ,0); in, and are the first time difference error and the second time difference error respectively; and They are the immediate rewards for positive samples and the immediate rewards for negative samples, is the discount factor; is the evaluation value of the positive sample relative to the negative sample at the next moment, and are the evaluation values ​​of the positive sample and the negative sample at the next moment respectively; is the evaluation value of negative samples relative to positive samples at the next moment; and are the evaluation values ​​of the positive sample and the negative sample at this moment respectively; is a non-negative hyperparameter, To preset hyper parameters; is the two-norm.

Citation Information

Patent Citations

  • Intelligent document writing method

    CN114492327A

  • Ultra large language models as ai agent controllers for improved ai agent performance in an environment

    US20220036153A1