Character string expression generation method and device, training method and device, equipment and medium

By performing word segmentation, encoding and feature extraction on text data, generating hidden state information of target input and decoding to generate target string expressions, the problems of low development efficiency and high error risk caused by the complexity of cron expressions are solved, and efficient periodic task orchestration is achieved.

CN119720949AActive Publication Date: 2025-03-28富盛科技股份有限公司
View PDF 7 Cites 0 Cited by

Patent Information

Application Number
CN202411661770.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-11-20
Publication Date
2025-03-28
Estimated Expiration
2044-11-20

AI Technical Summary

Technical Problem

Cron expressions are used to implement cyclical tasks in program development, but their complexity causes developers to face time and precision problems when writing expressions, increasing the risk of errors during the development process and affecting development efficiency.

Method used

By obtaining the text data submitted by the target object, word segmentation processing and encoding, word vector data is extracted, feature extraction is performed to generate the target input hidden state information, and the target string expression is generated through the decoder.

Benefits of technology

This method greatly improves the decoder's decoding efficiency, reduces the complexity and error risks of developers when writing cron expressions, and improves development efficiency, so that developers can achieve periodic tasks without manually editing complex cron expression code.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119720949A_ABST
    Figure CN119720949A_ABST
Patent Text Reader

Abstract

The character string expression generation method and device, the model training method and device, the equipment and the medium provided by the embodiment of the invention comprise the steps that text data submitted by a target object is acquired, word segmentation processing is carried out on the text data, and then multiple pieces of word data are obtained, and the word data comprise description data and character string data; encoding the word data to obtain word vector data, one word vector data corresponding to one sequence identifier; feature extraction is conducted on the word vector data, target input hidden state information is obtained, and the target input hidden state information comprises input hidden state information corresponding to the word vector data; and decoding the target input hidden state information to obtain a target character string expression. And the development efficiency of developers is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] Embodiments of the present disclosure relate to the fields of computer technology and related technologies, and in particular, to a method for generating a string expression, a training method, an apparatus, a device, and a medium. Background Art

[0002] A cron expression is a string used to define a schedule. It is usually used for Unix-style scheduled task scheduling. It mainly consists of six or seven fields, representing seconds, minutes, hours, days, months, weeks, and (optional) years. It is often used to execute periodic tasks in program development. Based on the characteristics of cron expressions, developers usually add cron expressions during the development process to implement periodic tasks.

[0003] However, since cron expressions are relatively complex, it takes a certain amount of time for developers to add cron expressions during the development process, and it becomes a challenge for developers to write expressions accurately. This complexity not only increases the risk of errors during the development process, but also greatly affects development efficiency. Summary of the invention

[0004] The embodiments described in this article provide a string expression generation method, model training method, device, equipment and medium to solve the problems existing in the prior art.

[0005] According to a first aspect of the present disclosure, a method for generating a string expression is provided, comprising:

[0006] Acquire text data submitted by the target object and perform word segmentation on the text data to obtain a plurality of word data, wherein the word data includes description data and character string data;

[0007] Encoding the word data to obtain word vector data, wherein one word vector data corresponds to one sequence identifier;

[0008] Performing feature extraction on the word vector data to obtain target input hidden state information, wherein the target input hidden state information includes input hidden state information corresponding to each word vector data;

[0009] The target input hidden state information is decoded to obtain a target string expression.

[0010] In some embodiments of the present disclosure, the step of extracting features from the word vector data to obtain target input hidden state information includes:

[0011] Determine the input hidden state information corresponding to each time step according to the sequence identifier corresponding to each of the word vector data;

[0012] When the time step meets a preset threshold, the input hidden state information corresponding to the time step is the target input hidden state information.

[0013] In some embodiments of the present disclosure, determining the input hidden state information corresponding to each time step according to the sequence identifier corresponding to each word vector data includes:

[0014] Determining the word vector data input at each time step according to the sequence identifier corresponding to each of the word vector data;

[0015] Determine the input hidden state information corresponding to the word vector data input at each time step.

[0016] In some embodiments of the present disclosure, the step of determining the input hidden state information corresponding to the word vector data input at each time step includes:

[0017] Obtaining a first weight matrix and a first bias of an update gate in a gated recurrent unit of the encoder, and a second weight matrix and a second bias of a reset gate in the gated recurrent unit;

[0018] Determine the update gate state information at the i-th time step according to the word vector data corresponding to the i-th time step, the input hidden state information corresponding to the i-1-th time step, the first weight matrix and the first bias;

[0019] Determine the bias gate state information of the i-th time step according to the word vector data corresponding to the i-th time step, the input hidden state information corresponding to the i-1-th time step, the second weight matrix and the second bias;

[0020] Determine candidate state information corresponding to the i-th time step according to the bias gate state information of the i-th time step and the input hidden state information corresponding to the i-1-th time step;

[0021] Determine the input hidden state information corresponding to the i-th time step according to the candidate state information corresponding to the i-th time step, the input hidden state information corresponding to the i-1-th time step, and the update gate state information of the i-th time step.

[0022] In some embodiments of the present disclosure, decoding the target input hidden state information to obtain a target string expression includes:

[0023] Decoding the target input hidden state information at a target time step to obtain output hidden state information corresponding to different time steps;

[0024] The output hidden state information corresponding to each time step is mapped into a dictionary to obtain the target string expression.

[0025] In some embodiments of the present disclosure, decoding the target input hidden state information at a target time step to obtain output hidden state information corresponding to different time steps includes:

[0026] Inputting the target input hidden state information into the gated recurrent unit of the decoder to obtain output hidden state information corresponding to the first time step;

[0027] Taking the output hidden state information corresponding to the i-th time step as input, obtain the output hidden state information corresponding to the i+1-th time step;

[0028] When the output hidden state information corresponding to the (i+1)th time step is an end tag identifier, the gated recurrent unit of the decoder is controlled to stop decoding the output hidden state information and output the end tag identifier again.

[0029] According to a second aspect of the present disclosure, a method for training a string expression generation model is provided, comprising:

[0030] Acquire a training sample set, wherein the training sample set includes text data and a target character string expression corresponding to the text data;

[0031] Inputting the text data of the training sample set into a string expression generation model to obtain a test string expression corresponding to the text data of the training sample set;

[0032] According to the target string expression and the test string expression, the first weight matrix of the update gate and the second weight matrix of the reset gate are adjusted until the loss value of the string expression generation model meets the preset loss value, thereby obtaining the target string expression generation model.

[0033] According to a third aspect of the present disclosure, there is provided a device for generating a string expression, comprising:

[0034] A word data processing module, used to obtain text data submitted by a target object and perform word segmentation on the text data to obtain a plurality of word data, wherein the word data includes description data and character string data;

[0035] A word vector data determination module, used for encoding the word data to obtain word vector data, wherein one word vector data corresponds to one sequence identifier;

[0036] A target input hidden state information determination module is used to perform feature extraction on the word vector data to obtain target input hidden state information, wherein the target input hidden state information includes input hidden state information corresponding to each word vector data;

[0037] The target string expression generation module is used to decode the target input hidden state information to obtain the target string expression.

[0038] According to a fourth aspect of the present disclosure, there is provided a computer device, comprising:

[0039] one or more processors;

[0040] a storage device for storing one or more programs,

[0041] When the one or more programs are executed by the one or more processors, the one or more processors implement the method as described in any one of the first aspect or the second aspect.

[0042] According to a fifth aspect of the present disclosure, a computer-readable storage medium is provided, on which a computer program is stored. When the program is executed by a processor, the method described in any one of the first aspect or the second aspect is implemented.

[0043] The string expression generation method, model training method, device, equipment and medium provided by the embodiments of the present disclosure first obtain the text data submitted by the target object and obtain multiple word data after word segmentation processing on the text data; then encode the word data to obtain word vector data; and perform feature extraction on the word vector data to obtain target input hidden state information; finally, decode the target input hidden state information to obtain the target string expression. Since the hidden state information of the i-th time step includes the candidate state information of the current time step and the hidden state information of the i-1-th time step, and the hidden state information of the i-1-th time step includes the candidate state information of the current time step and the hidden state information of the i-2-th time step, and so on, it can be seen that when the time step corresponding to the hidden state information meets the preset threshold, the obtained target input hidden state information includes the hidden state information of the 1st time step, the hidden state information of the 2nd time step, ..., and the hidden state information of the i-1-th time step and the candidate state information of the i-th time step, therefore, the output to the decoder includes only one target input hidden state information, which greatly improves the decoding efficiency of the decoder compared to the prior art that requires the input of multiple target input hidden state information. In addition, after obtaining the output hidden state information corresponding to different time steps, multiple target string expressions are obtained by dictionary mapping the output hidden state information output by the gated recurrent unit of the decoder. The multiple target string expressions constitute the target string expression, that is, periodic tasks can be performed based on the target string expression in the application, without the need for developers to edit complex cron expression codes to implement periodic tasks, thereby improving developer development efficiency. BRIEF DESCRIPTION OF THE DRAWINGS

[0044] In order to more clearly illustrate the technical solutions of the embodiments of the present disclosure, the drawings of the embodiments will be briefly described below. It should be noted that the drawings described below only relate to some embodiments of the present disclosure, but are not intended to limit the present disclosure, wherein:

[0045] Figure 1 It is a flowchart of a method for generating a string expression provided by an embodiment of the present disclosure;

[0046] Figure 2 It is a flowchart of a method for training a string expression generation model provided by an embodiment of the present disclosure;

[0047] Figure 3 It is a structural diagram of a string expression generating device provided by an embodiment of the present disclosure;

[0048] Figure 4 It is a structural diagram of a computer device provided in an embodiment of the present disclosure. DETAILED DESCRIPTION

[0049] In order to make the purpose, technical solution and advantages of the embodiments of the present disclosure clearer, the technical solution of the embodiments of the present disclosure will be clearly and completely described below in conjunction with the accompanying drawings. Obviously, the described embodiments are part of the embodiments of the present disclosure, rather than all of the embodiments. Based on the described embodiments of the present disclosure, all other embodiments obtained by those skilled in the art without creative work also fall within the scope of protection of the present disclosure.

[0050] Unless otherwise defined, all terms (including technical and scientific terms) used herein have the same meaning as commonly understood by a person skilled in the art to which the subject matter of the present disclosure belongs. It will be further understood that terms such as those defined in commonly used dictionaries should be interpreted as having a meaning consistent with their meaning in the context of the specification and the relevant art, and will not be interpreted in an idealized or overly formal form unless otherwise explicitly defined herein. As used herein, a statement that two or more parts are "connected" or "coupled" together shall mean that the parts are joined together directly or through one or more intermediate components.

[0051] In all embodiments of the present disclosure, terms such as “first” and “second” are used only to distinguish one component (or a part of a component) from another component (or another part of a component).

[0052] Unless the context clearly indicates otherwise, the singular form of the words used herein and in the appended claims includes the plural and vice versa. Thus, when referring to the singular, the plural form of the corresponding term is generally included. Similarly, the words "comprise" and "include" are to be interpreted as inclusive rather than exclusive. Likewise, the terms "include" and "or" should be interpreted as inclusive unless such interpretation is expressly prohibited herein. Where the term "example" is used herein, particularly when it is located after a group of terms, the "example" is merely exemplary and illustrative and should not be considered exclusive or comprehensive.

[0053] Based on the problems existing in the prior art, the present disclosure provides a method for generating a string expression. Figure 1 is a flow chart of a method for generating a string expression provided by an embodiment of the present disclosure, such as Figure 1 As shown, the string expression generation method includes:

[0054] S110, obtaining text data submitted by the target object and performing word segmentation on the text data to obtain a plurality of word data, wherein the word data includes description data and character string data.

[0055] In order to extract character string data from text data submitted by a target object, in the character string expression generation method provided in the embodiment of the present disclosure, the text data submitted by the target object is first obtained, and a plurality of word data are obtained by classifying the text data.

[0056] Among them, the process of word segmentation of file data is implemented based on the word segmenter.

[0057] For example, if the text data submitted by the target object is "start executing at 0:45:37 every day", the word data obtained after word segmentation by the word segmenter are: every day, 0, point, 45, minute, 37, second, start, execute, and different word data are separated by separators.

[0058] In the above embodiment, the word data: every day, point, minute, second, start, execute are description data, and 0, 45, 37 are character string data.

[0059] S120, encode the word data to obtain word vector data.

[0060] Among them, one word vector data corresponds to a sequence identifier.

[0061] After word data is segmented to obtain word data in step S110, each word data is encoded by an encoder to obtain word vector data, and an association relationship between the word vector data and the sequence identifier is constructed, that is, one word vector data corresponds to one sequence identifier. Through the sequence identifier corresponding to the word vector data, the time step corresponding to each word vector data can be determined when feature extraction is performed on the word vector data.

[0062] S130, extract features from word vector data to obtain target input hidden state information.

[0063] Among them, the target input hidden state information includes the input hidden state information corresponding to each word vector data.

[0064] As a specific implementation method, in order to extract string data from text data, the main implementation steps of the embodiment of the present disclosure are to perform feature extraction on the word vector data formed after word segmentation and encoding, and then input the extracted target input hidden state information into the decoder for decoding to obtain the target string expression.

[0065] Feature extraction is performed on the word vector feature data to obtain target input hidden state information including input hidden state information corresponding to each word vector data. Therefore, only one target input hidden state information is output to the decoder, which can improve the decoding efficiency of the decoder.

[0066] In a specific implementation, feature extraction is performed on word vector data to obtain target input hidden state information, including: determining the input hidden state information corresponding to each time step based on the sequence identifier corresponding to each word vector data; when the time step meets a preset threshold, the input hidden state information corresponding to the time step is the target input hidden state information.

[0067] It should be noted that, in the above embodiment, the preset threshold is the same as the number of word vector data.

[0068] Specifically, according to the sequence identifier corresponding to each word vector data, the input hidden state information corresponding to each time step is determined, including: according to the sequence identifier corresponding to each word vector data, the word vector data input at each time step is determined; and the input hidden state information corresponding to the word vector data input at each time step is determined.

[0069] Determine the input hidden state information corresponding to the word vector data input at each time step, including: obtaining a first weight matrix and a first bias of an update gate in a gated cyclic unit of an encoder, and a second weight matrix and a second bias of a reset gate in the gated cyclic unit; determine the update gate state information at the i-th time step according to the word vector data corresponding to the i-th time step, the input hidden state information corresponding to the i-1-th time step, the first weight matrix and the first bias; determine the update gate state information at the i-th time step according to the word vector data corresponding to the i-th time step, the input hidden state information corresponding to the i-1-th time step, the first weight matrix and the first bias. The bias gate state information of the ith time step is determined based on the input hidden state information corresponding to the ith time step, the second weight matrix and the second bias; the candidate state information corresponding to the ith time step is determined based on the bias gate state information of the ith time step and the input hidden state information corresponding to the (i-1) time step; the input hidden state information corresponding to the ith time step is determined based on the candidate state information corresponding to the ith time step, the input hidden state information corresponding to the (i-1) time step and the update gate state information of the ith time step.

[0070] In a specific implementation, first, the word vector data input at each time step is determined according to the sequence identifier corresponding to each word vector data, and then the input hidden state information corresponding to the word vector data input at each time step is determined.

[0071] Exemplarily, the word vector data corresponding to the word data "every day" is word vector data 1, the word vector data corresponding to the word data "0" is word vector data 2, the word vector data corresponding to the word data "point" is word vector data 3, the word vector data corresponding to the word data "45" is word vector data 4, the word vector data corresponding to the word data "minute" is word vector data 5, the word vector data corresponding to the word data "37" is word vector data 6, the word vector data corresponding to the word data "second" is word vector data 7, the word vector data corresponding to the word data "start" is word vector data 8, the word vector data corresponding to the word data "execute" is word vector data 9, the sequence identifier corresponding to word vector data 1 is identifier 1, the sequence identifier corresponding to word vector data 2 is identifier 2, the sequence identifier corresponding to word vector data 3 is identifier 3, the sequence identifier corresponding to word vector data 4 is identifier 4, the sequence identifier corresponding to word vector data 5 is identifier 5, the sequence identifier corresponding to word vector data 6 is identifier 6, the sequence identifier corresponding to word vector data 7 is identifier 7, the sequence identifier corresponding to word vector data 8 is identifier 8, and the sequence identifier corresponding to word vector data 9 is identifier 9.

[0072] When word vector data 1 is input at the first time step, the gated recurrent unit outputs the candidate state information corresponding to the first time step. According to the candidate state information corresponding to the first time step and the input hidden state information corresponding to the 0th time step (which is a pre-set fixed value), the input hidden state information of the first time step can be determined; when word vector data 2 is input at the second time step, the gated recurrent unit outputs the candidate state information corresponding to the second time step. According to the candidate state information corresponding to the second time step and the input hidden state information corresponding to the first time step, the input hidden state information of the second time step can be determined. ...; at the ninth time step, word vector data 9 is input, and the gated recurrent unit outputs candidate state information corresponding to the ninth time step. According to the candidate state information corresponding to the ninth time step and the input hidden state information corresponding to the eighth time step, the input hidden state information corresponding to the ninth time step can be determined. After obtaining the input hidden state information corresponding to the ninth time step, since the number of time steps and word vector data is the same, it can be determined that the input hidden state information corresponding to the ninth time step is the target input hidden state information.

[0073] In a specific implementation process, an exemplary implementation process of determining the input hidden state information corresponding to the i-th time step according to the candidate state information corresponding to the i-th time step and the input hidden state information corresponding to the i-1-th time step is:

[0074] vi=embedding(xi)

[0075] Among them, xi represents the word data corresponding to the i-th sequence identifier, vi represents the word vector sequence corresponding to the i-th sequence identifier, and the value of i is the number of word data.

[0076] zi=sigmoid(Wz*vi+Uz*hi-1+bz)

[0077] Among them, zi represents the update gate state information at the i-th time step, Wz and Uz are the first weight matrices of the update gate, bz is the first bias of the update gate, and the dimension of the update gate state information at the i-th time step is consistent with the dimension of the input hidden state information hi-1 corresponding to the i-1-th time step.

[0078] ri=sigmoid(Wr*vi+Ur*hi-1+br)

[0079] Among them, ri represents the reset gate state information at the i-th time step, Wr and Ur are the second weight matrices of the reset gate, br are the second biases of the reset gate, and the dimension of the reset gate state information at the i-th time step is consistent with the dimension of the input hidden state information hi-1 corresponding to the i-1-th time step.

[0080] h'i =tanh(Wr*vi+Ur*(ri⊙hi-1)+br)

[0081] Among them, h' i represents the candidate state information corresponding to the i-th time step, Wr and Ur are the second weight matrices of the reset gate, br are the second biases of the reset gate, and ⊙ represents element-by-element multiplication.

[0082] hi=(1-zi)⊙hi-1+zi⊙h' i

[0083] Among them, hi represents the input hidden state information corresponding to the i-th time step, (1-zi) and zi respectively represent how much hidden state information of the previous time step and the candidate state information of the current time step are retained.

[0084] Through the above implementation process, it can be seen that the hidden state information of the i-th time step includes the candidate state information of the current time step and the hidden state information of the i-1-th time step, and the hidden state information of the i-1-th time step includes the candidate state information of the current time step and the hidden state information of the i-2-th time step, and so on. It can be seen that when the time step corresponding to the hidden state information meets the preset threshold, the obtained target input hidden state information includes the hidden state information of the 1st time step, the hidden state information of the 2nd time step, ..., and the hidden state information of the i-1-th time step and the candidate state information of the i-th time step. Therefore, the output to the decoder only includes one target input hidden state information. Compared with the prior art that requires the input of multiple target input hidden state information, the decoding efficiency of the decoder is greatly improved.

[0085] S140. Decode the target input hidden state information to obtain a target string expression.

[0086] After the target input hidden state information is obtained in step S130, the target input hidden state information is input into a decoder, and the decoder decodes the target input hidden state information to obtain a target character string expression.

[0087] In the specific implementation process, the target input hidden state information is decoded to obtain the target string expression, including: decoding the target input hidden state information at the target time step to obtain the output hidden state information corresponding to different time steps; dictionary mapping the output hidden state information corresponding to each time step to obtain the target string expression.

[0088] Specifically, the target input hidden state information is decoded at a target time step to obtain output hidden state information corresponding to different time steps, including: inputting the target input hidden state information into a gated recurrent unit of a decoder to obtain output hidden state information corresponding to a first time step; taking the output hidden state information corresponding to the i-th time step as input to obtain output hidden state information corresponding to the i+1-th time step; when the output hidden state information corresponding to the i+1-th time step is an end tag identifier, controlling the gated recurrent unit of the decoder to stop decoding the output hidden state information and output the end tag identifier again.

[0089] As a specific implementation process, the target input hidden state information is first input into the gated recurrent unit of the decoder to obtain the output hidden state information corresponding to the first time step, and then the output hidden state information corresponding to the first time step is used as the input of the gated recurrent unit of the decoder to obtain the output hidden state information corresponding to the second time step, and then the output hidden state information corresponding to the second time step is used as the input of the gated recurrent unit of the decoder to obtain the output hidden state information corresponding to the third time step. When the output hidden state information output by the gated recurrent unit of the decoder at a certain time step is an end label identifier, the end label identifier is input into the gated recurrent unit of the decoder to control the gated recurrent unit to stop decoding the state information and output the second end label identifier.

[0090] After obtaining the output hidden state information corresponding to different time steps, multiple target string expressions are obtained by dictionary mapping the output hidden state information output by the gated recurrent unit of the decoder. The multiple target string expressions constitute the target string expression, that is, periodic tasks can be performed based on the target string expression in the application, without the need for developers to edit complex cron expression codes to implement periodic tasks, thereby improving developer development efficiency.

[0091] In the specific implementation process, combined with the above embodiment, if the text data submitted by the target object is "start execution at 0:45:37 every day", the target string expression obtained by dictionary mapping the output hidden state information corresponding to each time step is: "37450***?*", if the text data submitted by the target object is "start execution every 2 hours", the target string expression obtained by dictionary mapping the output hidden state information corresponding to each time step is: "0** / 2**?*" If the text data submitted by the target object is "start execution every 2 minutes", the target string expression obtained by dictionary mapping the output hidden state information corresponding to each time step is: "0* / 2***?*", if the text data submitted by the target object is "start execution every 2 seconds", the target string expression obtained by dictionary mapping the output hidden state information corresponding to each time step is: "0 / 2****?*".

[0092] The string expression generation method provided by the embodiment of the present disclosure first obtains the text data submitted by the target object and obtains multiple word data after word segmentation processing on the text data; then encodes the word data to obtain word vector data; and performs feature extraction on the word vector data to obtain target input hidden state information; finally, the target input hidden state information is decoded to obtain the target string expression. Since the hidden state information of the i-th time step includes the candidate state information of the current time step and the hidden state information of the i-1-th time step, and the hidden state information of the i-1-th time step includes the candidate state information of the current time step and the hidden state information of the i-2-th time step, and so on, it can be seen that when the time step corresponding to the hidden state information meets the preset threshold, the obtained target input hidden state information includes the hidden state information of the 1st time step, the hidden state information of the 2nd time step, ..., and the hidden state information of the i-1-th time step and the candidate state information of the i-th time step, therefore, the output to the decoder includes only one target input hidden state information, which greatly improves the decoding efficiency of the decoder compared to the prior art that requires the input of multiple target input hidden state information. In addition, after obtaining the output hidden state information corresponding to different time steps, multiple target string expressions are obtained by dictionary mapping the output hidden state information output by the gated recurrent unit of the decoder. The multiple target string expressions constitute the target string expression, that is, periodic tasks can be performed based on the target string expression in the application, without the need for developers to edit complex cron expression codes to implement periodic tasks, thereby improving developer development efficiency.

[0093] Based on the above embodiments, the present disclosure also provides a method for training a string expression generation model. Figure 2is a flow chart of a method for training a string expression generation model provided by an embodiment of the present disclosure, such as Figure 2 As shown, the string expression generation model training method includes:

[0094] S210: Obtain a training sample set.

[0095] The training sample set includes text data and a target string expression corresponding to the text data.

[0096] S320: Input the text data of the training sample set into a character string expression generation model to obtain a test character string expression corresponding to the text data of the training sample set.

[0097] S330. According to the target string expression and the test string expression, adjust the first weight matrix of the update gate and the second weight matrix of the reset gate until the loss value of the string expression generation model meets the preset loss value, and obtain the target string expression generation model.

[0098] As a specific implementation method, the text data of the training sample set is input into the initial string expression generation model, the Adam optimizer is used to guide the training of the model, the cross entropy loss function is used as the evaluation index of the model performance, and the training is terminated after the loss value is less than the set preset loss value to obtain the target string expression generation model; wherein, in the process of using the Adam optimizer to guide the model training, the learning rate of the Adam optimizer is 0.0001, and the threshold of the loss value is 0.

[0099] Based on the above embodiments, Figure 3 is a structural diagram of a string expression generating device provided by an embodiment of the present disclosure, such as Figure 3 As shown, the string expression generating device includes:

[0100] The word data processing module 310 is used to obtain the text data submitted by the target object and perform word segmentation on the text data to obtain a plurality of word data, wherein the word data includes description data and character string data;

[0101] A word vector data determination module 320, used to encode the word data to obtain word vector data, wherein one word vector data corresponds to one sequence identifier;

[0102] A target input hidden state information determination module 330 is used to perform feature extraction on the word vector data to obtain target input hidden state information, wherein the target input hidden state information includes input hidden state information corresponding to each word vector data;

[0103] The target string expression generation module 340 is used to decode the target input hidden state information to obtain the target string expression.

[0104] The string expression generating device provided by the embodiment of the present disclosure first obtains the text data submitted by the target object and obtains a plurality of word data after performing word segmentation processing on the text data; then encodes the word data to obtain word vector data; and performs feature extraction on the word vector data to obtain target input hidden state information; finally, the target input hidden state information is decoded to obtain the target string expression. Since the hidden state information of the i-th time step includes the candidate state information of the current time step and the hidden state information of the i-1-th time step, and the hidden state information of the i-1-th time step includes the candidate state information of the current time step and the hidden state information of the i-2-th time step, and so on, it can be seen that when the time step corresponding to the hidden state information meets the preset threshold, the obtained target input hidden state information includes the hidden state information of the 1st time step, the hidden state information of the 2nd time step, ..., and the hidden state information of the i-1-th time step and the candidate state information of the i-th time step, therefore, the output to the decoder includes only one target input hidden state information, which greatly improves the decoding efficiency of the decoder compared to the prior art that requires the input of multiple target input hidden state information. In addition, after obtaining the output hidden state information corresponding to different time steps, multiple target string expressions are obtained by dictionary mapping the output hidden state information output by the gated recurrent unit of the decoder. The multiple target string expressions constitute the target string expression, that is, periodic tasks can be performed based on the target string expression in the application, without the need for developers to edit complex cron expression codes to implement periodic tasks, thereby improving developer development efficiency.

[0105] In a specific implementation, the feature extraction of the word vector data to obtain target input hidden state information includes:

[0106] Determine the input hidden state information corresponding to each time step according to the sequence identifier corresponding to each of the word vector data;

[0107] When the time step meets a preset threshold, the input hidden state information corresponding to the time step is the target input hidden state information.

[0108] In a specific implementation, determining the input hidden state information corresponding to each time step according to the sequence identifier corresponding to each word vector data includes:

[0109] Determining the word vector data input at each time step according to the sequence identifier corresponding to each of the word vector data;

[0110] Determine the input hidden state information corresponding to the word vector data input at each time step.

[0111] In a specific implementation, the step of determining the input hidden state information corresponding to the word vector data input at each time step includes:

[0112] Obtaining a first weight matrix and a first bias of an update gate in a gated recurrent unit of the encoder, and a second weight matrix and a second bias of a reset gate in the gated recurrent unit;

[0113] Determine the update gate state information at the i-th time step according to the word vector data corresponding to the i-th time step, the input hidden state information corresponding to the i-1-th time step, the first weight matrix and the first bias;

[0114] Determine the bias gate state information of the i-th time step according to the word vector data corresponding to the i-th time step, the input hidden state information corresponding to the i-1-th time step, the second weight matrix and the second bias;

[0115] Determine candidate state information corresponding to the i-th time step according to the bias gate state information of the i-th time step and the input hidden state information corresponding to the i-1-th time step;

[0116] Determine the input hidden state information corresponding to the i-th time step according to the candidate state information corresponding to the i-th time step, the input hidden state information corresponding to the i-1-th time step, and the update gate state information of the i-th time step.

[0117] In a specific implementation, decoding the target input hidden state information to obtain a target string expression includes:

[0118] Decoding the target input hidden state information at a target time step to obtain output hidden state information corresponding to different time steps;

[0119] The output hidden state information corresponding to each time step is mapped into a dictionary to obtain the target string expression.

[0120] In a specific implementation, the decoding of the target input hidden state information at a target time step to obtain output hidden state information corresponding to different time steps includes:

[0121] Inputting the target input hidden state information into the gated recurrent unit of the decoder to obtain output hidden state information corresponding to the first time step;

[0122] Taking the output hidden state information corresponding to the i-th time step as input, obtain the output hidden state information corresponding to the i+1-th time step;

[0123] When the output hidden state information corresponding to the (i+1)th time step is an end tag identifier, the gated recurrent unit of the decoder is controlled to stop decoding the output hidden state information and output the end tag identifier again.

[0124] The present application also provides a computer device. Figure 4 , Figure 4 This is a basic structural block diagram of the computer device in this embodiment.

[0125] The computer device includes a memory 510 and a processor 520 that are connected to each other through a system bus. It should be noted that the figure only shows a computer device with components 510-520, but it should be understood that it is not required to implement all the components shown, and more or fewer components can be implemented instead. Among them, those skilled in the art can understand that the computer device here is a device that can automatically perform numerical calculations and / or information processing according to pre-set or stored instructions, and its hardware includes but is not limited to microprocessors, application specific integrated circuits (Application Specific Integrated Circuit, ASIC), programmable gate arrays (Field-Programmable Gate Array, FPGA), digital processors (Digital Signal Processor, DSP), embedded devices, etc.

[0126] Computer devices can be computing devices such as desktop computers, notebooks, PDAs, and cloud servers. Computer devices can interact with users through keyboards, mice, remote controls, touch pads, or voice control devices.

[0127] The memory 510 includes at least one type of readable storage medium, and the readable storage medium includes a non-volatile memory or a volatile memory, for example, a flash memory, a hard disk, a multimedia card, a card-type memory (for example, an SD or DX memory, etc.), a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM), an electrically erasable programmable read-only memory (EEPROM), a programmable read-only memory (PROM), a magnetic memory, a magnetic disk, an optical disk, etc., and the RAM may include a static RAM or a dynamic RAM. In some embodiments, the memory 510 may be an internal storage unit of a computer device, for example, a hard disk or a memory of the computer device. In other embodiments, the memory 510 may also be an external storage device of the computer device, such as a plug-in hard disk, a smart media card (SMC), a secure digital (SD) card, or a flash card (FlashCard) equipped on the computer device. Of course, the memory 510 may also include both the internal storage unit of the computer device and its external storage device. In this embodiment, the memory 510 is generally used to store the operating system and various application software installed on the computer device, such as the program code of the above method. In addition, the memory 510 may also be used to temporarily store various data that have been output or are to be output.

[0128] The processor 520 is generally used to perform the overall operation of the computer device. In this embodiment, the memory 510 is used to store program codes or instructions, the program code includes computer operation instructions, and the processor 520 is used to execute the program codes or instructions stored in the memory 510 or process data, such as running the program code of the above method.

[0129] In this article, the bus can be an Industry Standard Architecture (ISA) bus, a Peripheral Component Interconnect (PCI) bus, or an Extended Industry Standard Architecture (EISA) bus, etc. The bus system can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, only one thick line is used in the figure, but it does not mean that there is only one bus or one type of bus.

[0130] Another embodiment of the present application also provides a computer-readable medium, which may be a computer-readable signal medium or a computer-readable medium. A processor in a computer reads a computer-readable program code stored in the computer-readable medium, so that the processor can execute the functional actions specified in each step or a combination of steps in the above method; and generate a device for implementing the functional actions specified in each block or a combination of blocks in the block diagram.

[0131] Computer-readable media include but are not limited to electronic, magnetic, optical, electromagnetic, infrared memory or semiconductor systems, devices or apparatuses, or any appropriate combination of the foregoing, the memory is used to store program codes or instructions, the program codes include computer operating instructions, and the processor is used to execute the program codes or instructions of the above methods stored in the memory.

[0132] For the definitions of memory and processor, please refer to the description of the aforementioned computer device embodiment and will not be repeated here.

[0133] In the several embodiments provided in the present application, it should be understood that the disclosed systems, devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic, for example, the division of modules or units is only a logical function division, and there may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.

[0134] Each functional unit or module in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.

[0135] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application is essentially or the part that contributes to the prior art or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including a number of instructions to enable a computer device (which can be a personal computer, server, or network device, etc.) or a processor (processor) to perform all or part of the steps of each embodiment method of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (Read-Only Memory, ROM), random access memory (Random Access Memory, RAM), disk or optical disk and other media that can store program code.

[0136] Unless the context clearly indicates otherwise, the singular form of the words used herein and in the appended claims includes the plural and vice versa. Thus, when referring to the singular, the plural form of the corresponding term is generally included. Similarly, the words "comprise" and "include" are to be interpreted as inclusive rather than exclusive. Likewise, the terms "include" and "or" should be interpreted as inclusive unless such interpretation is expressly prohibited herein. Where the term "example" is used herein, particularly when it is located after a group of terms, the "example" is merely exemplary and illustrative and should not be considered exclusive or comprehensive.

[0137] Further aspects and scopes of adaptability become apparent from the description provided herein. It should be understood that various aspects of the present application can be implemented individually or in combination with one or more other aspects. It should also be understood that the description and specific embodiments herein are intended for purposes of illustration only and are not intended to limit the scope of the present application.

[0138] Several embodiments of the present disclosure are described in detail above, but it is obvious that those skilled in the art can make various modifications and variations to the embodiments of the present disclosure without departing from the spirit and scope of the present disclosure. The protection scope of the present disclosure is defined by the attached claims.

Claims

1. A method for generating a string expression, characterized in that: include: Acquire text data submitted by the target object and perform word segmentation on the text data to obtain a plurality of word data, wherein the word data includes description data and character string data; Encoding the word data to obtain word vector data, wherein one word vector data corresponds to one sequence identifier; Performing feature extraction on the word vector data to obtain target input hidden state information, wherein the target input hidden state information includes input hidden state information corresponding to each word vector data; The target input hidden state information is decoded to obtain a target string expression.

2. The method according to claim 1, characterized in that The feature extraction of the word vector data to obtain target input hidden state information includes: Determine the input hidden state information corresponding to each time step according to the sequence identifier corresponding to each of the word vector data; When the time step meets a preset threshold, the input hidden state information corresponding to the time step is the target input hidden state information.

3. The method according to claim 2, characterized in that Determining the input hidden state information corresponding to each time step according to the sequence identifier corresponding to each word vector data includes: Determining the word vector data input at each time step according to the sequence identifier corresponding to each of the word vector data; Determine the input hidden state information corresponding to the word vector data input at each time step.

4. The method according to claim 3, characterized in that The step of determining the input hidden state information corresponding to the word vector data input at each time step includes: Obtaining a first weight matrix and a first bias of an update gate in a gated recurrent unit of the encoder, and a second weight matrix and a second bias of a reset gate in the gated recurrent unit; Determine the update gate state information at the i-th time step according to the word vector data corresponding to the i-th time step, the input hidden state information corresponding to the i-1-th time step, the first weight matrix and the first bias; Determine the bias gate state information of the i-th time step according to the word vector data corresponding to the i-th time step, the input hidden state information corresponding to the i-1-th time step, the second weight matrix and the second bias; Determine candidate state information corresponding to the i-th time step according to the bias gate state information of the i-th time step and the input hidden state information corresponding to the i-1-th time step; Determine the input hidden state information corresponding to the i-th time step according to the candidate state information corresponding to the i-th time step, the input hidden state information corresponding to the i-1-th time step, and the update gate state information of the i-th time step.

5. The method according to claim 1, characterized in that The step of decoding the target input hidden state information to obtain a target string expression includes: Decoding the target input hidden state information at a target time step to obtain output hidden state information corresponding to different time steps; The output hidden state information corresponding to each time step is mapped into a dictionary to obtain the target string expression.

6. The method according to claim 5, characterized in that The decoding of the target input hidden state information at a target time step to obtain output hidden state information corresponding to different time steps includes: Inputting the target input hidden state information into the gated recurrent unit of the decoder to obtain output hidden state information corresponding to the first time step; Taking the output hidden state information corresponding to the i-th time step as input, obtain the output hidden state information corresponding to the i+1-th time step; When the output hidden state information corresponding to the (i+1)th time step is an end tag identifier, the gated recurrent unit of the decoder is controlled to stop decoding the output hidden state information and output the end tag identifier again.

7. A method for training a string expression generation model, characterized in that: include: Acquire a training sample set, wherein the training sample set includes text data and a target character string expression corresponding to the text data; Inputting the text data of the training sample set into a string expression generation model to obtain a test string expression corresponding to the text data of the training sample set; According to the target string expression and the test string expression, the first weight matrix of the update gate and the second weight matrix of the reset gate are adjusted until the loss value of the string expression generation model meets the preset loss value, thereby obtaining the target string expression generation model.

8. A device for generating a character string expression, characterized in that: include: A word data processing module, used to obtain text data submitted by a target object and perform word segmentation on the text data to obtain a plurality of word data, wherein the word data includes description data and character string data; A word vector data determination module, used for encoding the word data to obtain word vector data, wherein one word vector data corresponds to one sequence identifier; A target input hidden state information determination module is used to perform feature extraction on the word vector data to obtain target input hidden state information, wherein the target input hidden state information includes input hidden state information corresponding to each word vector data; The target string expression generation module is used to decode the target input hidden state information to obtain the target string expression.

9. A computer device, characterized in that: include: one or more processors; a storage device for storing one or more programs, When the one or more programs are executed by the one or more processors, the one or more processors implement the method according to any one of claims 1 to 6 and the method according to claim 7.

10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the method according to any one of claims 1 to 6 and the method according to claim 7 are implemented.

Citation Information

Patent Citations

  • Method and device for generating front-end code generation model

    CN111562915A

  • Candidate character string processing method and device, electronic equipment and storage medium

    CN111665955A

  • Natural language information hiding method based on sequence-to-steganography sequence

    CN113657107A

  • Word vector processing method and device, storage medium and electronic equipment

    CN116562232A

  • Character string expression detection method, electronic equipment and storage medium

    CN118886413A