Search-enhanced sentence refinement method, apparatus, medium, and computing device

By segmenting and identifying the words to be modified in the sentences to be polished, and combining a pre-set modifier database and a text polishing model, more accurate modified sentences are generated, which solves the problem of unreasonable modification in existing models and improves the text polishing effect.

CN116881478BActive Publication Date: 2026-03-31BEIJING LIXIN INTELLIGENT TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-07-17
Publication Date
2026-03-31

AI Technical Summary

Technical Problem

Existing text editing models cannot effectively analyze the rationality of modifiers and modified words, resulting in poor text editing effects.

Method used

By segmenting and identifying the sentences to be polished, the words to be polished are determined, and candidate words are obtained from a pre-set modifier database. Combined with the input of the preceding and following sentences, a pre-trained text polishing model is used to generate the polished sentences using an encoder and decoder.

Benefits of technology

It improves the effect of text polishing, ensures the accuracy of modifiers and unmodified words, and enhances the quality of sentence polishing.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116881478B_ABST
    Figure CN116881478B_ABST
Patent Text Reader

Abstract

Embodiments of the present application provide a retrieval-enhanced sentence polishing method, device, medium and computing device. The method comprises: identifying a to-be-polished sentence to obtain a to-be-modified word in the to-be-polished sentence; obtaining a candidate modified word matched with the to-be-modified word from a preset modified word database; obtaining a previous sentence and a next sentence of the to-be-polished sentence; inputting the candidate modified word, the previous sentence, the to-be-polished sentence and the next sentence into a pre-trained text polishing model to obtain a modified sentence corresponding to the to-be-polished sentence. The modified sentence obtained by the present application modifies the to-be-modified word in the to-be-polished sentence, thereby improving the effect of text polishing.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The embodiments of the present invention relate to the field of text processing technology, and more specifically, the embodiments of the present invention relate to a method, apparatus, medium and computing device for retrieval-enhanced sentence polishing. Background Technology

[0002] This section is intended to provide background or context for embodiments of the invention as set forth in the claims. The description herein is not an admission that it is prior art simply because it is included in this section.

[0003] Text polishing is a crucial step in content creation and writing assistance, enhancing the literary quality and creativity of descriptive texts and possessing significant research and exploratory value. To support human creation and improve writing skills, designing models for automated text polishing is essential.

[0004] In recent years, many text editing models based on language models have emerged. However, in practice, it has been found that existing text editing models usually only obtain modifiers that match the words to be edited from a pre-set database, without analyzing whether the modifiers can reasonably modify the words to be edited, resulting in poor text editing effects. Summary of the Invention

[0005] In this context, embodiments of the present invention aim to provide a search-enhanced sentence polishing method, apparatus, medium, and computing device.

[0006] In a first aspect of the present invention, a retrieval-enhanced sentence polishing method is provided, comprising:

[0007] The sentence to be polished is identified to obtain the words to be modified in the sentence to be polished.

[0008] Retrieve candidate modifiers that match the word to be modified from a preset modifier database;

[0009] Obtain the preceding and following statements of the statement to be polished;

[0010] The candidate modifiers, the preceding statement, the statement to be polished, and the following statement are input into a pre-trained text polishing model to obtain the polished statement corresponding to the statement to be polished.

[0011] In one embodiment of this implementation, the step of identifying the sentence to be polished and obtaining the words to be modified in the sentence to be polished includes:

[0012] The statement to be polished is segmented to obtain multiple clauses corresponding to the statement to be polished.

[0013] Identify at least one clause to be polished from the plurality of clauses;

[0014] Each clause to be polished is identified to obtain the words to be modified.

[0015] In one embodiment of this implementation, determining at least one clause to be polished from the plurality of clauses includes:

[0016] Determine the first number of modified words and the second number of current modified words contained in each clause;

[0017] Clauses whose first quantity is greater than the second quantity are identified as clauses to be polished.

[0018] In one embodiment of this implementation, the step of identifying a clause to be polished to obtain the word to be modified includes:

[0019] Identify a clause to be polished and determine the target modified word modified by the current modifier in the clause to be polished;

[0020] The target modified word is deleted from the modified words contained in the clause to be polished, and the remaining modified words are determined as the words to be polished corresponding to the clause to be polished.

[0021] In one embodiment of this implementation, the sentence to be polished includes at least one word to be modified, and one word to be modified matches at least one candidate modifier; the text polishing model includes an encoder and a decoder;

[0022] The step of inputting the candidate modifiers, the preceding statement, the statement to be polished, and the following statement into a pre-trained text polishing model to obtain the polished statement corresponding to the statement to be polished includes:

[0023] Based on the candidate modifiers and the sentences to be polished, sentences are concatenated to obtain multiple concatenated sentences; wherein, the candidate modifiers are used to modify the sentences to be modified that match the candidate modifiers; the content of any two concatenated sentences is different;

[0024] Based on the preceding statement, the following statement, and multiple concatenated statements, multiple enhanced statements to be retrieved are obtained; wherein, each enhanced statement to be retrieved includes a concatenated statement, and any two enhanced statements to be retrieved are different.

[0025] Based on the multiple enhanced statements to be retrieved and the encoder, the encoding information matrix corresponding to each enhanced statement to be retrieved is obtained;

[0026] The encoded information matrix is ​​input into the decoder to obtain the modified statement corresponding to the statement to be polished.

[0027] In one embodiment of this implementation, obtaining the encoding information matrix corresponding to each of the multiple enhanced search statements and the encoder includes:

[0028] Word vectors are extracted from each of the statements to be retrieved and enhanced, resulting in multiple sets of word vectors; wherein, one statement to be retrieved and enhanced corresponds to one set of word vectors; each set of word vectors includes multiple word vectors; each word vector includes vocabulary information and the position information of the vocabulary information in the statement to be retrieved and enhanced.

[0029] Each of the aforementioned word vector sets is input into the encoder to obtain the encoding information matrix corresponding to each of the enhanced statements to be retrieved.

[0030] In one embodiment of this implementation, the step of inputting the encoded information matrix into the decoder to obtain the modified statement corresponding to the statement to be modified includes:

[0031] The encoded information matrix is ​​input into the decoder to obtain the first predicted vocabulary;

[0032] Construct a prediction statement based on the first predicted vocabulary;

[0033] The encoded information matrix and the predicted statement are input into the decoder to obtain the second predicted vocabulary;

[0034] If the second predicted word is not the end identifier, then the predicted statement is updated according to the second predicted word, and the step of inputting the encoded information matrix and the predicted statement into the decoder to obtain the second predicted word is executed.

[0035] If the second predicted word is an end marker, then the predicted statement is determined to be the modified statement corresponding to the statement to be polished.

[0036] In one embodiment of this implementation, the training method of the text polishing model is specifically as follows:

[0037] The training books are identified to obtain multiple training sentences;

[0038] Each training statement is broken down into its preceding training clause, current training clause, and following training clause.

[0039] The current training clause is identified to obtain the training modifiers in the current training clause;

[0040] The training modifiers are added to a pre-built modifier database, and the training modifiers are removed from the current training clause to obtain the target training clause;

[0041] The text polishing model is trained based on the modifier database, the previous training clause, the target training clause, and the next training clause until the loss between the predicted statement output by the text polishing model and the current training clause is less than a preset threshold.

[0042] In a second aspect of the present invention, a retrieval-enhanced sentence polishing apparatus is provided, comprising:

[0043] The identification unit is used to identify the sentence to be polished and obtain the words to be modified in the sentence to be polished;

[0044] The first acquisition unit is used to acquire candidate modifiers that match the word to be modified from a preset modifier database;

[0045] The second acquisition unit is used to acquire the preceding and following statements of the statement to be polished;

[0046] The input unit is used to input the candidate modifier, the previous statement, the statement to be polished, and the next statement into a pre-trained text polishing model to obtain the polished statement corresponding to the statement to be polished.

[0047] In a third aspect of the present invention, a computing device is provided, the computing device comprising: at least one processor, a memory, and an input / output unit; wherein the memory is used to store a computer program, and the processor is used to invoke the computer program stored in the memory to execute the method described in any one aspect.

[0048] In a fourth aspect of the present invention, a computer-readable storage medium is provided, comprising instructions which, when executed on a computer, cause the computer to perform the method described in any one of the first aspects.

[0049] According to the retrieval-enhanced sentence polishing method, apparatus, medium, and computing device of the present invention, it is able to identify words to be modified from the sentence to be polished, and can obtain candidate modifiers matching the words to be modified from a preset modifier database. All obtained candidate modifiers can modify the words to be modified. The obtained candidate modifiers are all obtained from a preset modifier library, which is based on a standard natural sentence data set, meaning the preset modifier library includes very reasonable modifier combinations. Furthermore, the preceding and following sentences of the sentence to be polished, along with the candidate modifiers, can be input into a pre-trained text polishing model, so that the text polishing model outputs a polished sentence corresponding to the sentence to be polished. That is, the obtained polished sentences all modify the words to be modified in the sentence to be polished. Therefore, the target modifiers in the polished sentences obtained by the embodiments of the present invention are not merely relatively random words obtained by the text polishing model from the lexicon based on the semantics of the sentence to be polished, but rather words that are more accurately modified by combining the guidance of candidate modifiers, thereby improving the effect of text polishing. Attached Figure Description

[0050] The above and other objects, features, and advantages of exemplary embodiments of the present invention will become readily apparent from the following detailed description taken in conjunction with the accompanying drawings. Several embodiments of the invention are illustrated in the drawings by way of example and not limitation, wherein:

[0051] Figure 1 This is a flowchart illustrating a retrieval-enhanced sentence polishing method according to an embodiment of the present invention.

[0052] Figure 2 This is a flowchart illustrating a method for identifying words to be modified according to an embodiment of the present invention.

[0053] Figure 3 This is a flowchart illustrating a method for obtaining modified statements according to an embodiment of the present invention;

[0054] Figure 4 This is a schematic diagram of the structure of a search-enhanced sentence polishing device according to an embodiment of the present invention;

[0055] Figure 5 This is a schematic diagram of the structure of a medium provided in an embodiment of the present invention;

[0056] Figure 6 This is a schematic diagram of the structure of a computing device provided in an embodiment of the present invention.

[0057] In the accompanying drawings, the same or corresponding reference numerals indicate the same or corresponding parts. Detailed Implementation

[0058] The principles and spirit of the invention will now be described with reference to several exemplary embodiments. It should be understood that these embodiments are given merely to enable those skilled in the art to better understand and implement the invention, and are not intended to limit the scope of the invention in any way. Rather, these embodiments are provided to make this disclosure more thorough and complete, and to fully convey the scope of this disclosure to those skilled in the art.

[0059] Those skilled in the art will recognize that embodiments of the present invention can be implemented as a system, apparatus, device, method, or computer program product. Therefore, this disclosure can be specifically implemented in the following forms: entirely hardware, entirely software (including firmware, resident software, microcode, etc.), or a combination of hardware and software.

[0060] According to embodiments of the present invention, a method, apparatus, medium, and computing device for retrieving enhanced statements are proposed.

[0061] It should be noted that the number of any elements in the accompanying drawings is for illustrative purposes only and not as a limitation, and any naming is for distinction only and has no limiting meaning.

[0062] The principles and spirit of the present invention will be explained in detail below with reference to several representative embodiments.

[0063] Exemplary methods

[0064] The following is for reference. Figure 1 , Figure 1 This is a flowchart illustrating a search-enhanced sentence polishing method according to an embodiment of the present invention. It should be noted that the embodiments of the present invention can be applied to any applicable scenario.

[0065] Figure 1 The flowchart of a retrieval-enhanced sentence polishing method provided in an embodiment of the present invention, shown below, includes:

[0066] Step S101: Identify the sentence to be polished to obtain the words to be modified in the sentence to be polished.

[0067] In this embodiment of the invention, the word to be modified can be a noun or verb contained in the sentence to be polished. First, all words contained in the sentence to be polished can be identified, and each word can be identified by its part of speech to obtain its part of speech. The part of speech can be a noun, verb, adjective, numeral, quantifier, pronoun, adverb, or preposition, etc., and this embodiment of the invention does not limit this. Then, based on the identified part of speech, both verbs and nouns can be determined as words to be modified.

[0068] In another embodiment of the present invention, in order to improve the efficiency of determining the words to be modified in the sentence to be polished, at least one clause to be polished can be determined from the sentence to be polished, and the words to be modified can be determined from the clause to be polished, such as... Figure 2 As shown, step S101 above is replaced by steps S201 to S203:

[0069] Step S201: Segment the statement to be polished to obtain multiple clauses corresponding to the statement to be polished.

[0070] In this embodiment of the invention, the statement to be polished may naturally contain one or more clauses separated by punctuation marks, and therefore the clauses can be separated by punctuation marks. It is evident that the statement to be polished can be segmented using punctuation marks.

[0071] For example, the sentence to be polished could be: The campus in autumn is still bright and pleasant. The trees are still so green. The flowers seem unaware that late autumn has arrived, and they still bloom with fragrance, attracting bees with their aroma. The butterflies still dance gracefully in the campus, attracting the students' attention with their beautiful figures.

[0072] By segmenting the clauses to be polished according to punctuation marks, we can obtain the following multiple clauses:

[0073] <1> The campus remains beautiful and charming in autumn;

[0074] <2> The trees are still so green;

[0075] <3> The flowers seemed unaware that late autumn had arrived;

[0076] <4> It still blooms with a sweet fragrance;

[0077] <5> It still attracts bees with its fragrance;

[0078] <6> The butterflies are still fluttering around the campus;

[0079] <7> It still attracts the students' attention with its beautiful appearance.

[0080] Specifically, the method of segmenting the sentences to be polished using punctuation marks can be as follows:

[0081] The punctuation marks in the sentence to be polished are identified to obtain the punctuation mark information of the sentence to be polished; wherein, the punctuation mark information may include the symbol type and the number of punctuation marks; the symbol type may include the marking type and the pause type;

[0082] If the number of punctuation marks corresponding to the pause type is 1, then it is assumed that there is only one sentence in the sentence to be polished, and there is no need to segment the sentence to be polished.

[0083] If the number of punctuation marks corresponding to a pause type is greater than 1, then the sentence to be polished is divided according to the position of the punctuation marks of the pause type in the sentence to be polished, resulting in multiple clauses corresponding to the sentence to be polished; wherein the number of clauses obtained is the same as the number of punctuation marks corresponding to the pause type.

[0084] This method allows the sentence to be polished to be divided into one or more clauses based on the punctuation marks of the pause type, so that each clause can express a complete meaning, thereby making the polishing of the clauses more accurate.

[0085] In this embodiment of the invention, the punctuation marks indicating the type can be: quotation marks (“”'’), parentheses [()[]{}], dash (——), ellipsis (……), emphasis mark (.), book title marks (《》〈〉), interpunct (·), hyphen (—), proper noun mark (____), separator ( / ), etc.; the punctuation marks indicating pauses can be: period (。), question mark (?), exclamation mark (!), comma (,), pause mark (、), semicolon (;), colon (:), etc.

[0086] Furthermore, the sentences to be polished may contain long sentences, which are often difficult to understand. Therefore, long sentences can be further segmented. Specifically, the number of characters in the segmented clauses can be identified. If a clause has a character count greater than a preset threshold, it can be identified as a long sentence. In this case, the last modified word in the long sentence can be used as the sentence end to segment the long sentence, obtaining the corresponding clauses. This also ensures the semantic integrity of the segmented sentences.

[0087] Step S202: Determine at least one clause to be polished from the plurality of clauses.

[0088] In this embodiment of the invention, if every word that can be modified in a clause is modified by a modifier, then the clause does not need to be polished; if there are unmodified words in a clause, then the clause can be identified as a clause to be polished.

[0089] As an optional implementation, step S202, which determines at least one clause to be polished from the plurality of clauses, can specifically be as follows:

[0090] Determine the first number of modified words and the second number of current modified words contained in each clause;

[0091] Clauses whose first quantity is greater than the second quantity are identified as clauses to be polished.

[0092] In this implementation method, the clauses to be polished in each clause can be determined based on the first number of modified words and the second number of current modifiers. Generally speaking, one modifier in a clause can modify one modified word, that is, the number of modifiers in a clause is the same as the number of modified words. Therefore, if the first number of modified words in a clause is greater than the second number of current modifiers, it can be considered that there are unmodified modified words in the clause, and the clause can be identified as a clause to be polished. In this way, each clause to be polished can be identified more accurately from multiple clauses.

[0093] Step S203: Identify each clause to be polished to obtain the words to be modified.

[0094] As an optional implementation, step S203 identifies a clause to be polished, and the specific method for obtaining the word to be modified can be as follows:

[0095] Identify a clause to be polished and determine the target modified word modified by the current modifier in the clause to be polished;

[0096] The target modified word is deleted from the modified words contained in the clause to be polished, and the remaining modified words are determined as the words to be polished corresponding to the clause to be polished.

[0097] In this implementation method, the target modified word in the clause to be polished that has been modified by the current modifier can be identified first. Then, the target modified word is deleted from all the modified words in the clause to be polished. The remaining unmodified words are the unmodified words in the clause to be polished. In this way, the unmodified words in the clause to be polished can be accurately obtained.

[0098] At this point, deleting the target modified word is only to obtain the unmodified word in the clause to be polished; therefore, when performing subsequent sentence polishing, that is, when inputting the clause to be polished into the text polishing model, the input is the complete sentence containing the target modified word, not the sentence with the target modified word deleted.

[0099] By implementing steps S201 to S203, the sentence to be polished can be divided into multiple clauses, and at least one clause to be polished can be identified from the multiple clauses. This eliminates the need to identify the words to be modified in each clause, thus improving the efficiency of identifying the words to be modified in the sentence to be polished.

[0100] Step S102: Obtain candidate modifiers that match the word to be modified from a preset modifier database.

[0101] In this embodiment of the invention, the preset modifier database can be constructed from the beautiful words identified from training books. That is, text information can be identified from training books using optical character recognition (OCR) technology; and the identified text information can be analyzed to obtain modifier phrases; these modifier phrases can consist of a modified word and a modifier, with the modifier modifying the modified word.

[0102] Step S103: Obtain the preceding and following statements of the statement to be polished.

[0103] In this embodiment of the invention, the statement before and the statement after the statement to be polished are both adjacent to the statement to be polished, and both the statement before and the statement after the statement to be polished can be empty.

[0104] Step S104: Input the candidate modifier, the previous sentence, the sentence to be polished, and the next sentence into a pre-trained text polishing model to obtain the polished sentence corresponding to the sentence to be polished.

[0105] In this embodiment of the invention, the sentence to be polished includes at least one word to be modified, and one word to be modified matches at least one candidate modifier; the text polishing model includes an encoder and a decoder.

[0106] In this embodiment of the invention, the pre-trained text polishing model can be trained using beautiful sentences obtained from training books. The specific training method for the text polishing model is as follows:

[0107] The training books are identified to obtain multiple training sentences;

[0108] Each training statement is broken down into its preceding training clause, current training clause, and following training clause.

[0109] The current training clause is identified to obtain the training modifiers in the current training clause;

[0110] The training modifiers are added to a pre-built modifier database, and the training modifiers are removed from the current training clause to obtain the target training clause;

[0111] The text polishing model is trained based on the modifier database, the previous training clause, the target training clause, and the next training clause until the loss between the predicted statement output by the text polishing model and the current training clause is less than a preset threshold.

[0112] For example, a massive amount of training sentences can be identified from training books using OCR technology. Three consecutive training clauses can be obtained from these sentences: the previous training clause M, the current training clause T, and the next training clause N. Then, training modifiers in T are identified. These modifiers are incrementally updated to a pre-built modifier database. T with the modifier removed is used as the target training clause S. S, along with M and N, are input into a text polishing model to output a predicted sentence. The predicted sentence is then compared with T to obtain the corresponding loss. The text polishing model is trained based on this loss until the loss is less than a preset threshold; at this point, the text polishing model is considered successfully trained.

[0113] In another embodiment of the present invention, in order to improve the polishing effect of the sentence to be polished, the encoder and decoder included in the text polishing model can be used to analyze each concatenated sentence, the sentence before and the sentence after the sentence to be polished, to obtain the polished sentence corresponding to the sentence to be polished, such as... Figure 3 As shown, step S104 above is replaced by steps S301 to S304:

[0114] Step S301: Based on the candidate modifiers and the sentences to be polished, the sentences are concatenated to obtain multiple concatenated sentences.

[0115] In this embodiment of the invention, the candidate modifier is used to modify the word to be modified in the concatenated statement that matches the candidate modifier; the contents of any two concatenated statements are different.

[0116] In this embodiment of the invention, there may be multiple candidate modifiers corresponding to the modified word in the sentence to be polished, and each modified word in a concatenated sentence has one and only one candidate modifier. The candidate modifier should be concatenated to the position in the sentence to be polished corresponding to the modified word.

[0117] Step S302: Based on the previous statement, the next statement, and multiple concatenated statements, multiple enhanced statements to be retrieved are obtained.

[0118] In this embodiment of the invention, a search enhancement statement includes a concatenated statement, and any two search enhancement statements are different.

[0119] Step S303: Based on the multiple enhanced statements to be retrieved and the encoder, obtain the encoding information matrix corresponding to each enhanced statement to be retrieved.

[0120] As an optional implementation, step S303, which obtains the encoding information matrix corresponding to each of the multiple enhanced statements to be retrieved and the encoder, can specifically be as follows:

[0121] Word vectors are extracted from each of the statements to be retrieved and enhanced, resulting in multiple sets of word vectors; wherein, one statement to be retrieved and enhanced corresponds to one set of word vectors; each set of word vectors includes multiple word vectors; each word vector includes vocabulary information and the position information of the vocabulary information in the statement to be retrieved and enhanced.

[0122] Each of the aforementioned word vector sets is input into the encoder to obtain the encoding information matrix corresponding to each of the enhanced statements to be retrieved.

[0123] This implementation method allows for the extraction of word vectors for each retrieval enhancement statement, resulting in word vectors for each word in the statement. These word vectors can then be used to associate vocabulary information with the position of the word within the retrieval enhancement statement, thus enabling the word vector set to reflect the relationship between vocabulary information and position for each word. Furthermore, by inputting the word vector set into the encoder, the resulting encoding information matrix for each retrieval enhancement statement more clearly demonstrates the relationship between the meaning and position of words in each statement, thereby more accurately conveying the intended meaning of each retrieval enhancement statement.

[0124] Step S304: Input the encoded information matrix into the decoder to obtain the modified statement corresponding to the statement to be polished.

[0125] As an optional implementation, step S304, which inputs the encoded information matrix into the decoder to obtain the modified statement corresponding to the statement to be polished, can specifically be as follows:

[0126] The encoded information matrix is ​​input into the decoder to obtain the first predicted vocabulary;

[0127] Construct a prediction statement based on the first predicted vocabulary;

[0128] The encoded information matrix and the predicted statement are input into the decoder to obtain the second predicted vocabulary;

[0129] If the second predicted word is not the end identifier, then the predicted statement is updated according to the second predicted word, and the step of inputting the encoded information matrix and the predicted statement into the decoder to obtain the second predicted word is executed.

[0130] If the second predicted word is an end marker, then the predicted statement is determined to be the modified statement corresponding to the statement to be polished.

[0131] In this implementation, the encoded information matrix is ​​input into the decoder to obtain the first predicted word; the encoded information matrix and the first predicted word are then input into the decoder again to obtain the second predicted word; and the steps of inputting the encoded information matrix, the first predicted word, and the second predicted word into the decoder to obtain the second predicted word are repeated until the decoder obtains the end marker, at which point the complete modified sentence predicted by the decoder can be obtained. In this way, each word in the modified sentence output by the decoder can be predicted sequentially, that is, the encoder can encode all the input information of the sentence to be polished containing candidate modifiers, and the resulting encoded information matrix can be affected by the sentence to be polished containing candidate modifiers; and the decoder can make predictions based on the encoded information matrix to obtain prediction information; at this time, the decoder can also make the subsequent predicted words more accurate based on the predicted information already obtained, thereby improving the accuracy of the final output modified sentence.

[0132] By implementing steps S301 to S304 above, candidate modifiers can be concatenated with the sentences to be polished to obtain concatenated sentences corresponding to each modifier. Furthermore, the encoder and decoder included in the text polishing model can be used to analyze each concatenated sentence, the sentence before and the sentence after the sentence to be polished, to obtain the polished sentence corresponding to the sentence to be polished. That is, by simultaneously analyzing the sentence to be polished with added candidate modifiers and the context of the sentence to be polished, the polished sentence with the best polishing effect can be obtained, thus improving the polishing effect of the sentence to be polished.

[0133] For example, the sentence to be polished could be: "The campus in autumn is still beautiful and pleasant. The trees are still so green. The flowers seem unaware that late autumn has arrived, and they still bloom with fragrance, attracting bees with their aroma. The butterflies still dance gracefully in the campus, attracting the students' attention with their beautiful figures."

[0134] 1. The sentence to be polished can be divided into multiple clauses:

[0135] <1> The campus is still beautiful and charming in autumn.

[0136] <2> The trees are still so green

[0137] <3> The flowers seem unaware that late autumn has arrived.

[0138] <4> The fragrance still lingers in the air.

[0139] <5> It still attracts bees with its fragrance.

[0140] <6> The butterflies are still fluttering around the campus.

[0141] <7> It still attracts the students' attention with its beautiful appearance.

[0142] 2. By analyzing the number of current modifiers and modified words in the clauses, determine the clauses that need polishing:

[0143] <2> The trees are still so green

[0144] <3> The flowers seem unaware that late autumn has arrived.

[0145] <5> It still attracts bees with its fragrance.

[0146] <6> The butterflies are still fluttering around the campus.

[0147] <7> It still attracts the students' attention with its beautiful appearance.

[0148] 3. From the clauses to be polished, we can identify the words to be modified: tree, flower, bee, butterfly, classmate, and gaze;

[0149] 4. Can retrieve candidate modifiers that match the word to be modified from the preset modifier database: lush, verdant, beautiful, in full bloom, hardworking, cute, pretty, lively, dreamy, etc.

[0150] 5. Candidate modifiers and sentences to be polished can be concatenated to obtain multiple concatenated sentences:

[0151] The lush trees are still so green;

[0152] The lush green trees remain just as green;

[0153] The beautiful flowers seemed unaware that late autumn had arrived;

[0154] The blooming flowers seem unaware that late autumn has arrived;

[0155] It still attracts hardworking bees with its fragrance;

[0156] It still attracts lovely bees with its fragrance;

[0157] Beautiful butterflies still flutter around the campus;

[0158] It still attracts the dazed gazes of the lively students with its beautiful figure;

[0159] 6. It can obtain the preceding and following sentences of the sentence to be polished. The preceding sentence is "Autumn has arrived. Walking into the empty campus, a cold wind blows, making people feel a chill." The following sentence is "A few yellow leaves that have fallen from the trees are lying in the flower beds on campus, and people's breath condenses into milky white steam in the air."

[0160] 7. Based on the preceding statement, the following statement, and multiple concatenated statements, several enhanced statements to be retrieved can be obtained:

[0161] <1> Autumn has arrived. Stepping into the empty campus, a cold wind blows, bringing a chill. The autumn campus is still beautiful and pleasant. The lush trees are still so green, and the beautiful flowers seem unaware that late autumn has arrived, still blooming fragrantly, still attracting busy bees with their aroma; pretty butterflies still dance gracefully in the campus, still attracting the dazed eyes of lively students with their beautiful figures. A few yellow leaves have fallen from the trees and landed in the flower beds. People's breath condenses into milky white steam in the air.

[0162] <2> Autumn has arrived. Stepping into the empty campus, a cold wind blows, bringing a chill. The autumn campus is still beautiful and pleasant. The lush trees are still so green, and the beautiful flowers seem unaware that late autumn has arrived, still blooming fragrantly, still attracting lovely bees with their aroma; pretty butterflies still dance gracefully in the campus, still attracting the dazed eyes of the lively students with their beautiful figures. A few yellow leaves have fallen from the trees and landed in the flower beds. People's breath condenses into milky white steam in the air.

[0163] <3> Autumn has arrived. Stepping into the empty campus, a cold wind blows, bringing a chill. The autumn campus is still beautiful and pleasant. The lush green trees remain so green, and the beautiful flowers seem unaware that late autumn has arrived, still blooming fragrantly, still attracting lovely bees with their aroma. Pretty butterflies still dance gracefully in the campus, still attracting the dazed eyes of the lively students with their beautiful figures. A few yellow leaves have fallen from the trees and landed in the flower beds. People's breath condenses into milky white steam in the air.

[0164] In addition to the three search enhancement statements mentioned above, other search enhancement statements can be obtained, which will not be listed here.

[0165] 8. By inputting multiple search terms into the encoder, the encoded information matrix corresponding to each search term can be obtained;

[0166] 9. Multiple encoded information matrices can be input into the decoder to obtain "lush and verdant"; a prediction statement can be constructed based on "lush and verdant", at which point the prediction statement is "lush and verdant"; multiple encoded information matrices and the prediction statement can be input into the decoder to obtain "of"; "of" can be added to the prediction statement, at which point the prediction statement is "lush and verdant of"; the operation of inputting multiple encoded information matrices and the prediction statement into the decoder can be repeated until the end marker is obtained; at this point, the prediction statement "The lush and verdant trees are still so green, the blooming flowers seem unaware that late autumn has arrived; they still attract hardworking bees with their fragrance; the beautiful butterflies still dance in the campus" can be obtained.

[0167] The modified sentences obtained by this invention all modify the words to be modified in the sentences to be polished, thereby improving the text polishing effect. Furthermore, this invention can more accurately identify each clause to be polished from multiple clauses. Furthermore, this invention can accurately obtain the words to be modified that are currently not modified in the clauses to be polished. Furthermore, this invention can improve the efficiency of identifying words to be modified in the sentences to be polished. Furthermore, this invention can more accurately obtain the meaning that each sentence to be retrieved and enhanced intends to express. Furthermore, this invention can improve the accuracy of the final output modified sentences. Furthermore, this invention can improve the polishing effect on the sentences to be polished.

[0168] Exemplary device

[0169] After introducing the method of exemplary embodiments of the present invention, the following references are made. Figure 4 An exemplary embodiment of the present invention will be described, comprising:

[0170] The identification unit 401 is used to identify the sentence to be polished and obtain the words to be modified in the sentence to be polished;

[0171] The first acquisition unit 402 is used to acquire candidate modifiers that match the word to be modified obtained by the recognition unit 401 from a preset modifier database;

[0172] The second acquisition unit 403 is used to acquire the preceding and following statements of the statement to be polished;

[0173] The input unit 404 is used to input the candidate modifiers obtained by the first acquisition unit 402, the previous sentence obtained by the second acquisition unit 403, the sentence to be polished, and the next sentence into a pre-trained text polishing model to obtain the polished sentence corresponding to the sentence to be polished.

[0174] As an optional implementation method, the text polishing model is trained as follows:

[0175] The training books are identified to obtain multiple training sentences;

[0176] Each training statement is broken down into its preceding training clause, current training clause, and following training clause.

[0177] The current training clause is identified to obtain the training modifiers in the current training clause;

[0178] The training modifiers are added to a pre-built modifier database, and the training modifiers are removed from the current training clause to obtain the target training clause;

[0179] The text polishing model is trained based on the modifier database, the previous training clause, the target training clause, and the next training clause until the loss between the predicted statement output by the text polishing model and the current training clause is less than a preset threshold.

[0180] As an optional implementation, the identification unit 401 identifies the sentence to be polished and obtains the words to be modified in the sentence in the following specific ways:

[0181] The statement to be polished is segmented to obtain multiple clauses corresponding to the statement to be polished.

[0182] Identify at least one clause to be polished from the plurality of clauses;

[0183] Each clause to be polished is identified to obtain the words to be modified.

[0184] This implementation method allows the statement to be polished to be divided into multiple clauses, and at least one clause to be polished can be identified from these multiple clauses. This eliminates the need to identify the words to be modified in each clause, thus improving the efficiency of identifying the words to be modified in the statement to be polished.

[0185] As an optional implementation, the identification unit 401 may determine at least one clause to be polished from the plurality of clauses in the following specific manner:

[0186] Determine the first number of modified words and the second number of current modified words contained in each clause;

[0187] Clauses whose first quantity is greater than the second quantity are identified as clauses to be polished.

[0188] In this implementation method, the clauses to be polished in each clause can be determined based on the first number of modified words and the second number of current modifiers. Generally speaking, one modifier in a clause can modify one modified word, that is, the number of modifiers in a clause is the same as the number of modified words. Therefore, if the first number of modified words in a clause is greater than the second number of current modifiers, it can be considered that there are unmodified modified words in the clause, and the clause can be identified as a clause to be polished. In this way, each clause to be polished can be identified more accurately from multiple clauses.

[0189] As an optional implementation, the identification unit 401 identifies a clause to be polished, and the specific method for obtaining the word to be modified can be as follows:

[0190] Identify a clause to be polished and determine the target modified word modified by the current modifier in the clause to be polished;

[0191] The target modified word is deleted from the modified words contained in the clause to be polished, and the remaining modified words are determined as the words to be polished corresponding to the clause to be polished.

[0192] In this implementation method, the target modified word in the clause to be polished that has been modified by the current modifier can be identified first. Then, the target modified word is deleted from all the modified words in the clause to be polished. The remaining unmodified words are the unmodified words in the clause to be polished. In this way, the unmodified words in the clause to be polished can be accurately obtained.

[0193] As an optional implementation, the sentence to be polished includes at least one word to be modified, and each word to be modified matches at least one candidate modifier; the text polishing model includes an encoder and a decoder;

[0194] The input unit 404 inputs the candidate modifiers, the preceding statement, the statement to be polished, and the following statement into a pre-trained text polishing model to obtain the polished statement corresponding to the statement to be polished. Specifically, this can be achieved by:

[0195] Based on the candidate modifiers and the sentences to be polished, sentences are concatenated to obtain multiple concatenated sentences; wherein, the candidate modifiers are used to modify the sentences to be modified that match the candidate modifiers; the content of any two concatenated sentences is different;

[0196] Based on the preceding statement, the following statement, and multiple concatenated statements, multiple enhanced statements to be retrieved are obtained; wherein, each enhanced statement to be retrieved includes a concatenated statement, and any two enhanced statements to be retrieved are different.

[0197] Based on the multiple enhanced statements to be retrieved and the encoder, the encoding information matrix corresponding to each enhanced statement to be retrieved is obtained;

[0198] The encoded information matrix is ​​input into the decoder to obtain the modified statement corresponding to the statement to be polished.

[0199] This implementation method involves concatenating candidate modifiers with the sentences to be polished, resulting in concatenated sentences corresponding to each modifier. Furthermore, the encoder and decoder within the text polishing model analyze each concatenated sentence, the preceding sentence, and the following sentence of the sentence to be polished, to obtain the polished sentence. In other words, by simultaneously analyzing the sentence to be polished with added candidate modifiers and its context, the best polished sentence can be obtained, thus improving the polishing effect on the sentences to be polished.

[0200] As an optional implementation, the input unit 404 obtains the encoding information matrix corresponding to each of the multiple enhanced statements to be retrieved and the encoder in the following specific ways:

[0201] Word vectors are extracted from each of the statements to be retrieved and enhanced, resulting in multiple sets of word vectors; wherein, one statement to be retrieved and enhanced corresponds to one set of word vectors; each set of word vectors includes multiple word vectors; each word vector includes vocabulary information and the position information of the vocabulary information in the statement to be retrieved and enhanced.

[0202] Each of the aforementioned word vector sets is input into the encoder to obtain the encoding information matrix corresponding to each of the enhanced statements to be retrieved.

[0203] This implementation method allows for the extraction of word vectors for each retrieval enhancement statement, resulting in word vectors for each word in the statement. These word vectors can then be used to associate vocabulary information with the position of the word within the retrieval enhancement statement, thus enabling the word vector set to reflect the relationship between vocabulary information and position for each word. Furthermore, by inputting the word vector set into the encoder, the resulting encoding information matrix for each retrieval enhancement statement more clearly demonstrates the relationship between the meaning and position of words in each statement, thereby more accurately conveying the intended meaning of each retrieval enhancement statement.

[0204] As an optional implementation, the input unit 404 inputs the encoded information matrix into the decoder to obtain the modified statement corresponding to the statement to be polished. Specifically, this can be achieved by:

[0205] The encoded information matrix is ​​input into the decoder to obtain the first predicted vocabulary;

[0206] Construct a prediction statement based on the first predicted vocabulary;

[0207] The encoded information matrix and the predicted statement are input into the decoder to obtain the second predicted vocabulary;

[0208] If the second predicted word is not the end identifier, then the predicted statement is updated according to the second predicted word, and the step of inputting the encoded information matrix and the predicted statement into the decoder to obtain the second predicted word is executed.

[0209] If the second predicted word is an end marker, then the predicted statement is determined to be the modified statement corresponding to the statement to be polished.

[0210] In this implementation, the encoded information matrix is ​​input into the decoder to obtain the first predicted word; the encoded information matrix and the first predicted word are then input into the decoder again to obtain the second predicted word; and the steps of inputting the encoded information matrix, the first predicted word, and the second predicted word into the decoder to obtain the second predicted word are repeated until the decoder obtains the end marker, at which point the complete modified sentence predicted by the decoder can be obtained. In this way, each word in the modified sentence output by the decoder can be predicted sequentially. That is, based on the encoded information matrix of all input information obtained by the encoder and the prediction information already predicted by the decoder, the subsequent words predicted by the decoder can be more accurate, thereby improving the accuracy of the final output modified sentence.

[0211] The modified sentences obtained by this invention all modify the words to be modified in the sentences to be polished, thereby improving the text polishing effect. Furthermore, this invention can more accurately identify each clause to be polished from multiple clauses. Furthermore, this invention can accurately obtain the words to be modified that are currently not modified in the clauses to be polished. Furthermore, this invention can improve the efficiency of identifying words to be modified in the sentences to be polished. Furthermore, this invention can more accurately obtain the meaning that each sentence to be retrieved and enhanced intends to express. Furthermore, this invention can improve the accuracy of the final output modified sentences. Furthermore, this invention can improve the polishing effect on the sentences to be polished.

[0212] Exemplary media

[0213] After introducing the methods and apparatus of exemplary embodiments of the present invention, the following references are made. Figure 5 A computer-readable storage medium according to exemplary embodiments of the present invention will be described, please refer to... Figure 5 The computer-readable storage medium shown is an optical disc 50, on which a computer program (i.e., a program product) is stored. When the computer program is run by a processor, it implements the steps described in the above method implementation, such as: identifying the sentence to be polished to obtain the word to be modified in the sentence to be polished; obtaining candidate modifiers that match the word to be modified from a preset modifier database; obtaining the preceding and following sentences of the sentence to be polished; inputting the candidate modifiers, the preceding sentence, the sentence to be polished, and the following sentence into a pre-trained text polishing model to obtain the polished sentence corresponding to the sentence to be polished; the specific implementation of each step will not be repeated here.

[0214] It should be noted that examples of the computer-readable storage medium may also include, but are not limited to, phase-change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other optical and magnetic storage media, which will not be elaborated here.

[0215] Exemplary computing device

[0216] After introducing the methods, apparatus, and media of exemplary embodiments of the present invention, the following references are made. Figure 6 A computing device for retrieval-enhanced sentence polishing according to an exemplary embodiment of the present invention.

[0217] Figure 6 A block diagram is shown of an exemplary computing device 60 suitable for implementing embodiments of the present invention, which may be a computer system or a server. Figure 6 The computing device 60 shown is merely an example and should not impose any limitation on the functionality and scope of use of the embodiments of the present invention.

[0218] like Figure 6 As shown, the components of computing device 60 may include, but are not limited to: one or more processors or processing units 601, system memory 602, and bus 603 connecting different system components (including system memory 602 and processing unit 601).

[0219] The computing device 60 typically includes a variety of computer system readable media. These media can be any available media that can be accessed by the computing device 60, including volatile and non-volatile media, removable and non-removable media.

[0220] System memory 602 may include computer system readable media in the form of volatile memory, such as random access memory (RAM) 6021 and / or cache memory 6022. Computing device 60 may further include other removable / non-removable, volatile / non-volatile computer system storage media. By way of example only, ROM 6023 may be used to read and write non-removable, non-volatile magnetic media (…). Figure 6 Not shown in the image (usually referred to as a "hard drive"). Although not shown in Figure 6 The diagram illustrates that disk drives for reading and writing to removable non-volatile disks (e.g., "floppy disks") and optical disc drives for reading and writing to removable non-volatile optical discs (e.g., CD-ROMs, DVD-ROMs, or other optical media) can be provided. In these cases, each drive can be connected to bus 603 via one or more data media interfaces. System memory 602 may include at least one program product having a set (e.g., at least one) of program modules configured to perform the functions of the embodiments of the present invention.

[0221] A program / utility 6025 having a set (at least one) of program modules 6024 may be stored, for example, in system memory 602, and such program modules 6024 include, but are not limited to, an operating system, one or more application programs, other program modules, and program data, each or some combination of these examples may include an implementation of a network environment. Program modules 6024 typically perform the functions and / or methods described in the embodiments of the present invention.

[0222] The computing device 60 can also communicate with one or more external devices 604 (such as a keyboard, pointing device, display, etc.). This communication can be performed via the input / output (I / O) interface 605. Furthermore, the computing device 60 can also communicate with one or more networks (e.g., local area networks (LANs), wide area networks (WANs), and / or public networks, such as the Internet) via a network adapter 606. Figure 6 As shown, network adapter 606 communicates with other modules of computing device 60 (such as processing unit 601) via bus 603. It should be understood that, although... Figure 6 Other hardware and / or software modules may be used in conjunction with computing device 60, as not shown in the diagram.

[0223] The processing unit 601 executes various functional applications and data processing by running programs stored in the system memory 602. For example, it identifies the sentence to be polished to obtain the words to be modified; retrieves candidate modifiers matching the words to be modified from a preset modifier database; obtains the preceding and following sentences of the sentence to be polished; and inputs the candidate modifiers, the preceding sentence, the sentence to be polished, and the following sentence into a pre-trained text polishing model to obtain the polished sentence corresponding to the sentence to be polished. The specific implementation methods of each step will not be repeated here. It should be noted that although several units / modules or sub-units / sub-modules of the retrieval-enhanced sentence polishing device are mentioned in the detailed description above, this division is merely exemplary and not mandatory. In fact, according to embodiments of the present invention, the features and functions of two or more units / modules described above can be embodied in one unit / module. Conversely, the features and functions of one unit / module described above can be further divided into multiple units / modules for embodiment.

[0224] In the description of this invention, it should be noted that the terms "first," "second," and "third" are used for descriptive purposes only and should not be construed as indicating or implying relative importance.

[0225] Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the specific working processes of the systems, devices, and units described above can be referred to the corresponding processes in the foregoing method embodiments, and will not be repeated here.

[0226] In the several embodiments provided by this invention, it should be understood that the disclosed systems, apparatuses, and methods can be implemented in other ways. The apparatus embodiments described above are merely illustrative. For example, the division of units is only a logical functional division, and in actual implementation, there may be other division methods. Furthermore, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Additionally, the coupling or direct coupling or communication connection shown or discussed may be through some communication interfaces; the indirect coupling or communication connection between devices or units may be electrical, mechanical, or other forms.

[0227] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.

[0228] In addition, the functional units in the various embodiments of the present invention can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit.

[0229] If the aforementioned functions are implemented as software functional units and sold or used as independent products, they can be stored in a processor-executable, non-volatile, computer-readable storage medium. Based on this understanding, the technical solution of this invention, essentially, or the part that contributes to the prior art, or a portion of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of this invention. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.

[0230] Finally, it should be noted that the above-described embodiments are merely specific implementations of the present invention, used to illustrate the technical solutions of the present invention, and not to limit it. The scope of protection of the present invention is not limited thereto. Although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that any person skilled in the art can still modify or easily conceive of changes to the technical solutions described in the foregoing embodiments within the technical scope disclosed in the present invention, or make equivalent substitutions for some of the technical features; and these modifications, changes, or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present invention, and should all be covered within the scope of protection of the present invention. Therefore, the scope of protection of the present invention should be determined by the scope of the claims.

[0231] Furthermore, although the operations of the method of the present invention are described in a specific order in the accompanying drawings, this does not require or imply that these operations must be performed in that specific order, or that all the operations shown must be performed to achieve the desired result. Additionally or alternatively, certain steps may be omitted, multiple steps may be combined into one step, and / or one step may be broken down into multiple steps.

[0232] Based on the above description, the embodiments of this application provide at least the following technical solutions:

[0233] 1. A retrieval-enhanced sentence polishing method, comprising:

[0234] The sentence to be polished is identified to obtain the words to be modified in the sentence to be polished.

[0235] Retrieve candidate modifiers that match the word to be modified from a preset modifier database;

[0236] Obtain the preceding and following statements of the statement to be polished;

[0237] The candidate modifiers, the preceding statement, the statement to be polished, and the following statement are input into a pre-trained text polishing model to obtain the polished statement corresponding to the statement to be polished.

[0238] 2. According to the retrieval-enhanced sentence polishing method described in technical solution 1, the step of identifying the sentence to be polished and obtaining the words to be modified in the sentence to be polished includes:

[0239] The statement to be polished is segmented to obtain multiple clauses corresponding to the statement to be polished.

[0240] Identify at least one clause to be polished from the plurality of clauses;

[0241] Each clause to be polished is identified to obtain the words to be modified.

[0242] 3. The retrieval-enhanced sentence polishing method according to technical solution 1 or 2, wherein determining at least one clause to be polished from the plurality of clauses includes:

[0243] Determine the first number of modified words and the second number of current modified words contained in each clause;

[0244] Clauses whose first quantity is greater than the second quantity are identified as clauses to be polished.

[0245] 4. According to the retrieval-enhanced sentence polishing method described in any one of technical solutions 1-3, a clause to be polished is identified to obtain the words to be modified, including:

[0246] Identify a clause to be polished and determine the target modified word modified by the current modifier in the clause to be polished;

[0247] The target modified word is deleted from the modified words contained in the clause to be polished, and the remaining modified words are determined as the words to be polished corresponding to the clause to be polished.

[0248] 5. The retrieval-enhanced sentence polishing method according to any one of technical solutions 1 to 4, wherein the sentence to be polished includes at least one word to be modified, and one word to be modified matches at least one candidate modifier; the text polishing model includes an encoder and a decoder;

[0249] The step of inputting the candidate modifiers, the preceding statement, the statement to be polished, and the following statement into a pre-trained text polishing model to obtain the polished statement corresponding to the statement to be polished includes:

[0250] Based on the candidate modifiers and the sentences to be polished, sentences are concatenated to obtain multiple concatenated sentences; wherein, the candidate modifiers are used to modify the sentences to be modified that match the candidate modifiers; the content of any two concatenated sentences is different;

[0251] Based on the preceding statement, the following statement, and multiple concatenated statements, multiple enhanced statements to be retrieved are obtained; wherein, each enhanced statement to be retrieved includes a concatenated statement, and any two enhanced statements to be retrieved are different.

[0252] Based on the multiple enhanced statements to be retrieved and the encoder, the encoding information matrix corresponding to each enhanced statement to be retrieved is obtained;

[0253] The encoded information matrix is ​​input into the decoder to obtain the modified statement corresponding to the statement to be polished.

[0254] 6. The retrieval-enhanced sentence polishing method according to any one of technical solutions 1-5, wherein obtaining the encoding information matrix corresponding to each of the retrieval-enhanced sentences based on the plurality of sentences to be enhanced and the encoder includes:

[0255] Word vectors are extracted from each of the statements to be retrieved and enhanced, resulting in multiple sets of word vectors; wherein, one statement to be retrieved and enhanced corresponds to one set of word vectors; each set of word vectors includes multiple word vectors; each word vector includes vocabulary information and the position information of the vocabulary information in the statement to be retrieved and enhanced.

[0256] Each of the aforementioned word vector sets is input into the encoder to obtain the encoding information matrix corresponding to each of the enhanced statements to be retrieved.

[0257] 7. The retrieval-enhanced sentence polishing method according to any one of technical solutions 1-6, wherein inputting the encoded information matrix into the decoder to obtain the polished sentence corresponding to the sentence to be polished includes:

[0258] The encoded information matrix is ​​input into the decoder to obtain the first predicted vocabulary;

[0259] Construct a prediction statement based on the first predicted vocabulary;

[0260] The encoded information matrix and the predicted statement are input into the decoder to obtain the second predicted vocabulary;

[0261] If the second predicted word is not an end marker, then the predicted statement is updated according to the second predicted word, and the step of inputting the encoded information matrix and the predicted statement into the decoder to obtain the second predicted word is executed.

[0262] If the second predicted word is an end marker, then the predicted statement is determined to be the modified statement corresponding to the statement to be polished.

[0263] 8. According to any one of technical solutions 1-7, the text polishing model is trained as follows:

[0264] The training books are identified to obtain multiple training sentences;

[0265] Each training statement is broken down into its preceding training clause, current training clause, and following training clause.

[0266] The current training clause is identified to obtain the training modifiers in the current training clause;

[0267] The training modifiers are added to a pre-built modifier database, and the training modifiers are removed from the current training clause to obtain the target training clause;

[0268] The text polishing model is trained based on the modifier database, the previous training clause, the target training clause, and the next training clause until the loss between the predicted statement output by the text polishing model and the current training clause is less than a preset threshold.

[0269] 9. A retrieval-enhanced sentence polishing device, comprising:

[0270] The identification unit is used to identify the sentence to be polished and obtain the words to be modified in the sentence to be polished;

[0271] The first acquisition unit is used to acquire candidate modifiers that match the word to be modified from a preset modifier database;

[0272] The second acquisition unit is used to acquire the preceding and following statements of the statement to be polished;

[0273] The input unit is used to input the candidate modifier, the previous statement, the statement to be polished, and the next statement into a pre-trained text polishing model to obtain the polished statement corresponding to the statement to be polished.

[0274] 10. A computing device, the computing device comprising:

[0275] At least one processor, memory, and input / output unit;

[0276] The memory is used to store computer programs, and the processor is used to call the computer programs stored in the memory to execute the method as described in any one of technical solutions 1 to 8.

[0277] 11. A computer-readable storage medium comprising instructions that, when executed on a computer, cause the computer to perform the method as described in any one of claims 1 to 8.

Claims

1. A sentence polishing method based on retrieval enhancement, comprising: identifying a to-be-polished sentence to obtain a to-be-modified word in the to-be-polished sentence; obtaining a candidate modifier matching the to-be-modified word from a pre-set modifier database; obtaining a previous sentence and a next sentence of the to-be-polished sentence; inputting the candidate modifier, the previous sentence, the to-be-polished sentence, and the next sentence into a pre-trained text polishing model to obtain a modified sentence corresponding to the to-be-polished sentence; wherein the to-be-polished sentence includes at least one to-be-modified word, and one to-be-modified word matches at least one candidate modifier; the text polishing model includes an encoder and a decoder; the inputting the candidate modifier, the previous sentence, the to-be-polished sentence, and the next sentence into the pre-trained text polishing model to obtain the modified sentence corresponding to the to-be-polished sentence, comprising: performing sentence splicing based on the candidate modifier and the to-be-polished sentence to obtain a plurality of spliced sentences; wherein the candidate modifier is used to modify a to-be-modified word in the spliced sentence matching the candidate modifier; the content of any two spliced sentences is different; obtaining a plurality of to-be-retrieved enhancement sentences according to the previous sentence, the next sentence, and the plurality of spliced sentences; wherein one to-be-retrieved enhancement sentence includes one spliced sentence, and any two to-be-retrieved enhancement sentences are different; obtaining an encoding information matrix corresponding to each to-be-retrieved enhancement sentence according to the plurality of to-be-retrieved enhancement sentences and the encoder; inputting the encoding information matrix into the decoder to obtain the modified sentence corresponding to the to-be-polished sentence. 2.The sentence polishing method based on retrieval enhancement according to claim 1, wherein the identifying the to-be-polished sentence to obtain a to-be-modified word in the to-be-polished sentence comprises: performing sentence segmentation on the to-be-polished sentence to obtain a plurality of clauses corresponding to the to-be-polished sentence; determining at least one to-be-polished clause from the plurality of clauses; identifying each to-be-polished clause to obtain a to-be-modified word. 3.The sentence polishing method based on retrieval enhancement according to claim 2, wherein the determining at least one to-be-polished clause from the plurality of clauses comprises: determining a first number of modified words and a second number of current modifiers included in each clause; determining a to-be-polished clause as a clause in which the first number is greater than the second number. 4.The sentence polishing method based on retrieval enhancement according to claim 3, wherein the identifying one to-be-polished clause to obtain a to-be-modified word comprises: identifying one to-be-polished clause to determine a target modified word modified by a current modifier included in the to-be-polished clause; deleting the target modified word from modified words included in the to-be-polished clause, and determining remaining modified words as to-be-modified words corresponding to the to-be-polished clause. 5.The sentence polishing method based on retrieval enhancement according to claim 1, wherein the obtaining an encoding information matrix corresponding to each to-be-retrieved enhancement sentence according to the plurality of to-be-retrieved enhancement sentences and the encoder comprises: extract word vectors from each of the to-be-retrieved enhanced sentences, to obtain a plurality of word vector sets; wherein one to-be-retrieved enhanced sentence corresponds to one word vector set; one word vector set includes a plurality of word vectors; each word vector includes vocabulary information and position information of the vocabulary information in the to-be-retrieved enhanced sentence in which the word vector is located; input each of the word vector sets into the encoder, to obtain an encoding information matrix corresponding to each of the to-be-retrieved enhanced sentences.

6. The retrieval-enhanced sentence polishing method according to claim 1, wherein inputting the encoding information matrix into the decoder to obtain a modified sentence corresponding to the to-be-polished sentence comprises: inputting the encoding information matrix into the decoder to obtain a first predicted vocabulary; constructing a predicted sentence according to the first predicted vocabulary; inputting the encoding information matrix and the predicted sentence into the decoder to obtain a second predicted vocabulary; if the second predicted vocabulary is not an end identifier, updating the predicted sentence according to the second predicted vocabulary, and performing the step of inputting the encoding information matrix and the predicted sentence into the decoder to obtain a second predicted vocabulary; if the second predicted vocabulary is an end identifier, determining the predicted sentence as the modified sentence corresponding to the to-be-polished sentence.

7. A retrieval-enhanced sentence polishing device, comprising: an identification unit configured to identify a to-be-polished sentence to obtain a to-be-modified word in the to-be-polished sentence; a first acquisition unit configured to acquire a candidate modified word matching the to-be-modified word from a pre-set modified word database; a second acquisition unit configured to acquire a previous sentence and a next sentence of the to-be-polished sentence; an input unit configured to input the candidate modified word, the previous sentence, the to-be-polished sentence, and the next sentence into a pre-trained text polishing model to obtain a modified sentence corresponding to the to-be-polished sentence; the to-be-polished sentence includes at least one to-be-modified word, and one to-be-modified word matches at least one candidate modified word; the text polishing model includes an encoder and a decoder; the input unit is configured to input the candidate modified word, the previous sentence, the to-be-polished sentence, and the next sentence into the pre-trained text polishing model, and the text polishing model is configured to obtain the modified sentence corresponding to the to-be-polished sentence based on the following manner: performing sentence splicing based on the candidate modified word and the to-be-polished sentence to obtain a plurality of spliced sentences; wherein the candidate modified word is used to modify a to-be-modified word matching the candidate modified word in the spliced sentence; the contents of any two spliced sentences are different; obtaining a plurality of to-be-retrieved enhanced sentences according to the previous sentence, the next sentence, and the plurality of spliced sentences; wherein one to-be-retrieved enhanced sentence includes one spliced sentence, and any two to-be-retrieved enhanced sentences are different; obtaining an encoding information matrix corresponding to each of the to-be-retrieved enhanced sentences based on the to-be-retrieved enhanced sentences and the encoder; inputting the encoding information matrix into the decoder to obtain a modified sentence corresponding to the to-be-polished sentence.

8. A computing device comprising: at least one processor, a memory, and an input-output unit; wherein the memory is configured to store a computer program, and the processor is configured to invoke the computer program stored in the memory to perform the method of any one of claims 1-6.

9. A computer-readable storage medium comprising instructions which, when executed on a computer, cause the computer to perform the method of any one of claims 1-6.

Citation Information

Patent Citations

  • Sentence display method and device

    CN105718543A

  • Text processing method, computer equipment and storage medium

    CN114298031A