Method and device for generating poem conversion page and readable storage medium

By extracting poetry texts from the target page and matching them, and generating background images based on translation content and style information, the problems of low efficiency and professional dependence in the existing technology are solved, and efficient and automatic poetry page generation is achieved.

CN119862857APending Publication Date: 2025-04-22GUANGZHOU SHIYUAN ELECTRONICS CO LTD +1
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202311346390.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2023-10-17
Publication Date
2025-04-22

AI Technical Summary

Technical Problem

The existing methods of generating poem pages rely too much on teachers' professionalism, low generation efficiency, and poor generalization.

Method used

By reading the target page, extracting the poetry text, and matching it in the preset poetry collection, we will determine whether the target poetry is included. If the match is successful, obtain the translation content and style information of the target poem, generate the background image, and finally generate the poetry conversion page.

Benefits of technology

It improves the efficiency of the generation of poetry pages, reduces the dependence on teachers' professionalism, and has strong generalizability, and can automatically identify and process poetry content.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119862857A_ABST
    Figure CN119862857A_ABST
Patent Text Reader

Abstract

The invention discloses a poem conversion page generation method and device and a readable storage medium, and the method comprises the steps: reading a target page, and extracting a poem text in the target page; matching the extracted poem text in a preset poem set, and judging whether the poem text contains a target poem or not based on a matching result; if the poem text contains the target poem, obtaining translation content of the target poem, and generating a background image based on the translation content and style information of the translation content; and generating a poem conversion page corresponding to the target page according to the target poem and the background image, and displaying the poem conversion page. According to the technical scheme provided by the invention, the poem page can be automatically generated, so that the generation efficiency of the poem page is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of image processing technology, and in particular to a method and device for generating a poetry conversion page and a readable storage medium. Background Art

[0002] At present, in the process of courseware production, experienced teachers are usually required to produce it manually. In the process of making Chinese courseware, the production of poetry content may be involved. However, in actual applications, the poetry content may be included in the overall text content. Teachers first need to identify the poetry content from the text content, and then create pages based on the poetry content.

[0003] Obviously, the existing method of generating poetry pages relies too much on the professionalism of teachers, has low generation efficiency, and poor versatility. Summary of the invention

[0004] In view of this, the embodiments of the present invention provide a method, device and readable storage medium for generating a poetry conversion page, which can automatically generate a poetry page, thereby improving the generation efficiency of the poetry page.

[0005] On one hand, the present invention provides a method for generating a poetry conversion page, the method comprising:

[0006] Reading a target page and extracting the poem text in the target page;

[0007] Matching the extracted poem text in a preset poem set, and judging whether the poem text contains a target poem based on the matching result;

[0008] If the target poem is included in the poem text, obtaining the translation content of the target poem, and generating a background image based on the translation content and the style information of the translation content;

[0009] Based on the target poem and the background image, a poem conversion page corresponding to the target page is generated, and the poem conversion page is displayed.

[0010] In one embodiment, the preset poetry set is generated in the following manner:

[0011] Traversing the poet identifiers in the database, and creating a corresponding poetry subset for each of the poet identifiers;

[0012] Acquire the poetry content and the translation of the poetry content from the database, and write the poetry content and the translation of the poetry content into a corresponding poetry subset according to a preset format according to the poet identifier to which the poetry content belongs;

[0013] The combination of each of the poetry subsets is used as the generated preset poetry set.

[0014] In one embodiment, after reading the target page, the method further includes:

[0015] Converting the target page into page data of a specified format, and traversing text lines in the page data to extract text data from the page data;

[0016] Inputting the text data into a poetry recognition model to determine whether there is poetry text in the text data through the poetry recognition model;

[0017] Among them, if it is determined that there is poetry text in the text data, the poetry text in the text data is output through the poetry recognition model.

[0018] In one embodiment, after extracting the poem text in the target page, the method further includes:

[0019] The number of Chinese characters in the poem text is identified, and only when the number of Chinese characters is greater than or equal to a specified number threshold value, the extracted poem text is matched in a preset poem set.

[0020] In one embodiment, matching the extracted poetry text in a preset poetry set includes:

[0021] Traversing the poet identifiers contained in the preset poetry set, if any target poet identifier among the traversed poet identifiers exists in the poetry text, obtaining a poetry subset corresponding to the target poet identifier from the preset poetry set;

[0022] Traversing the poetry identifiers contained in the poetry subset, if any target poetry identifier among the traversed poetry identifiers exists in the poetry text, obtaining the poetry content corresponding to the target poetry identifier from the poetry subset;

[0023] If all the verses in the poem content exist in the poem text, a matching result representing a successful match is generated.

[0024] In one embodiment, the method further comprises:

[0025] If none of the traversed poet identifiers exist in the poem text, or none of the traversed poem identifiers exist in the poem text, or any verse in the poem content does not exist in the poem text, a matching result representing a failed match is generated.

[0026] In one embodiment, generating a background image based on the translation content and the style information of the translation content includes:

[0027] Constructing a description text including the translation content and style information of the translation content;

[0028] Generate an initial feature index, and use the text features of the description text as a priori conditions to predict the predicted values ​​of each discrete feature in the initial feature index to generate a predicted feature index corresponding to the initial feature index;

[0029] A background image corresponding to the description text is generated according to the predicted feature index.

[0030] In one embodiment, the step of predicting the predicted value of each discrete feature in the initial feature index is implemented by completing a trained image conversion model, and the image conversion model is trained in the following manner:

[0031] Acquire a background image training sample, generate a text description sample of the background image training sample, and extract text features of the text description sample;

[0032] Using the background image training sample to train the encoder, encoding directory and decoder in the image conversion model;

[0033] Based on the trained encoder and the encoding directory, generating a standard feature index of the background image training sample;

[0034] The text features of the text description sample are used as prior conditions to drive the converter in the image conversion model to generate a predicted feature index, and the converter in the image conversion model is trained by comparing the predicted feature index with the standard feature index.

[0035] In one embodiment, training the encoder, the encoding directory, and the decoder in the image conversion model using the background image training sample includes:

[0036] Extracting sample features of the background image training sample using an encoder, and generating a sample feature index corresponding to the sample feature based on a coding directory;

[0037] Decoding the sample feature index using a decoder to generate a decoded image corresponding to the sample feature index;

[0038] It is determined whether the decoded image is a true image, and an error function is generated based on the determination result, so as to correct the encoder, the encoding directory and the decoder through the error function.

[0039] Another aspect of the present invention provides a device for generating a poetry conversion page, the device comprising:

[0040] A text extraction unit, used to read a target page and extract the poem text in the target page;

[0041] A poetry recognition unit, used for matching the extracted poetry text with a preset poetry set, and judging whether the poetry text contains a target poem based on the matching result;

[0042] A background image generating unit, configured to obtain the translation content of the target poem if the poem text contains the target poem, and generate a background image based on the translation content and style information of the translation content;

[0043] A poetry conversion unit is used to generate a poetry conversion page corresponding to the target page according to the target poetry and the background image, and display the poetry conversion page.

[0044] On the other hand, the present invention also provides a device for generating a poetry conversion page, which includes a processor and a memory, wherein the memory is used to store a computer program, and when the computer program is executed by the processor, the above-mentioned method for generating a poetry conversion page is implemented.

[0045] On the other hand, the present invention also provides a computer-readable storage medium, which is used to store a computer program. When the computer program is executed by a processor, the above-mentioned method for generating a poetry conversion page is implemented.

[0046] The technical solution provided by one or more embodiments of the present invention can obtain a standardized target poem by matching the poem text in the target page with a preset poem set. Subsequently, a matching background image can be generated by identifying the style information of the target poem. According to the target poem and the background image, a page of the courseware can be automatically generated, thereby greatly improving the generation efficiency of the poem page. At the same time, the recognition process of the target poem does not require professional knowledge and can be completed by text recognition. The solution has strong versatility. BRIEF DESCRIPTION OF THE DRAWINGS

[0047] The features and advantages of the present invention will be more clearly understood by referring to the accompanying drawings, which are schematic and should not be construed as limiting the present invention in any way. In the accompanying drawings:

[0048] Figure 1 A flow chart showing a method for generating a poetry conversion page in one embodiment of the present invention;

[0049] Figure 2A schematic diagram of the training process of an image conversion model in one embodiment of the present invention is shown;

[0050] Figure 3 A schematic diagram of functional modules of a device for generating a poetry conversion page in one embodiment of the present invention is shown;

[0051] Figure 4 A schematic diagram of the structure of a device for generating a poetry conversion page in one embodiment of the present invention is shown. DETAILED DESCRIPTION

[0052] In order to make the purpose, technical solutions and advantages of the embodiments of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative work are within the scope of protection of the present invention.

[0053] In actual applications, after completing the production of courseware, teachers sometimes need to extract the ancient poetry content contained in the courseware separately and make it into an independent courseware page. At present, it usually relies on the professional knowledge of teachers to identify the ancient poetry content from the text of the courseware, and then the teachers manually make an independent poetry page.

[0054] Taking into account that the content of ancient poetry usually has a standardized genre, and the emotions and content expressed in ancient poetry can be determined by the translation content of ancient poetry, in view of this, based on the large language model and content matching technology, the ancient poetry in the text can be automatically identified, and the poetry page can be automatically generated based on the recognition results.

[0055] See also Figure 1 An embodiment of the present invention provides a method for generating a poetry conversion page, which includes the following steps.

[0056] S1: Read a target page and extract the poem text in the target page.

[0057] In this embodiment, the target page can be a completed courseware page, or any page containing text information. For example, the target page can be a page in a Chinese textbook, or any page in a completed PPT.

[0058] For target pages of different forms, different methods can be used to extract the poetry text in the target page. For example, if the target page is in the form of an image, the poetry text in the image can be identified by OCR (Optical Character Recognition) technology. For another example, if the target page is a courseware page in XML format, the courseware page in XML format can be converted into a specified format that is convenient for text recognition. For example, the courseware page in XML format can be converted into page data in json format. Of course, in actual applications, the entire courseware can be converted into data in json format, and then by performing text recognition on the data in json format, the poetry text in each page in the courseware can be extracted.

[0059] Generally speaking, not every page contains poetry text, so it is usually necessary to extract the text data in the target page first, and then determine whether the poetry text exists in the text data. Specifically, after reading the target page, the target page can be converted into page data of a specified format. Among them, the specified format can be the above-mentioned json format. After converting the page data of the specified format, the text lines (textline) in the page data can be traversed, so that the text data can be extracted from the page data. Of course, depending on the form of the target page, other technologies such as OCR can also be used to extract text data from the target page.

[0060] In this embodiment, after extracting text data from the target page, the text data can be input into a poetry recognition model to determine whether there is poetry text in the text data through the poetry recognition model. If the poetry recognition model determines that there is poetry text in the text data, the poetry text in the text data can be output through the poetry recognition model.

[0061] In practical applications, the poetry recognition model can be implemented through a large language model. Among them, the large prediction model can be implemented based on the transformer architecture. For example, in a specific application example, multiple transformers can be stacked to form a BERT structure, which can be used as a feature extraction module in a large language model. Before using the BERT structure to process text data, the text data can be segmented according to a certain granularity, and each phrase obtained by the segmentation can be sent to the BERT structure to output the phrase features. Subsequently, according to different needs, an additional output layer can be added after the BERT structure, and the phrase features can be processed through the output layer to obtain the output result of the large language model.

[0062] Specifically, identifying poetry text from text data can be a sentence-level recognition task. Therefore, the classification token (CLS) in the phrase feature can be input into an additional output layer, so that sentence-level natural language inference can be performed through the output layer to obtain an inference result that characterizes whether there is poetry content.

[0063] Of course, in practical applications, there are more ways to implement the large language model. This application is not limited to the transformer and BERT structures. The above only uses the transformer and BERT structures as examples to describe the processing process of the large language model on the input text data.

[0064] The extracted text data is processed by a large language model. If there is poetry in the text data, the large language model can output the corresponding poetry, thereby eliminating the influence of other texts on subsequent matching and improving the accuracy of poetry conversion.

[0065] S2: Match the extracted poetry text in a preset poetry set, and determine whether the poetry text contains the target poem based on the matching result.

[0066] In this embodiment, in order to facilitate matching, a large amount of poetry content can be processed in advance according to certain rules to generate a preset poetry set. Usually, standard poetry content is stored in a database, and the poetry content in the database is often stored in the form of a table. This storage method is not conducive to quickly matching the poetry content. In view of this, in one embodiment, the poetry content in the database can be processed in the following manner to generate a preset poetry set:

[0067] S21: Traverse the poet identifiers in the database, and create a corresponding poetry subset for each of the poet identifiers.

[0068] First, you can create a blank poetry collection, then you can traverse all the poet identifiers in the database (for example, the poet's name), and create a corresponding poetry subset for each poet identifier, such as {'Li Bai':[],'Du Fu':[],...}. The [] may contain the poetry subset corresponding to the poet identifier.

[0069] S22: Obtain the poetry content and the translation content of the poetry content from the database, and write the poetry content and the translation content of the poetry content into a corresponding poetry subset according to a preset format based on the poet identifier to which the poetry content belongs.

[0070] Specifically, all the poetry contents and corresponding translation contents in the database are traversed, and the poetry contents and corresponding translation contents are placed in the subset of the poets to whom they belong. For example, the following can be obtained:

[0071] {'Li Bai':[{'Quiet Night Thoughts':{'Text content':'The moonlight shines brightly before my bed...','Ancient Poetry ID':1,'Ancient Poetry Translation':'The moonlight on the ground...'}},...],'Du Fu':[{'Quatrain':{'Text content':'Two orioles sing in the green willows...','Ancient Poetry ID':2,'Ancient Poetry Translation':'Two orioles call for spring among the newly green willow branches'}},...],...}

[0072] The contents in the above-mentioned poetry subset are partially simplified in description, which is only used as an example to explain a recording form of poetry content and translation content, and is not used to limit the scope of protection of this application.

[0073] It can be seen that in actual applications, in addition to the poem content and translation content, each poem content can also correspond to an independent poem identifier (ancient poem id), and the poem identifier can also be recorded in the subset of the poet to which it belongs.

[0074] S23: The combination of each of the poetry subsets is used as the generated preset poetry set.

[0075] The combination of various poetry subsets can eventually form a preset poetry collection.

[0076] Through the above method, the poetry data stored in the original form can be converted into an information set of the poetry content, laying the foundation for the subsequent matching process.

[0077] In this embodiment, after extracting the poem text, the number of Chinese characters in the poem text can be verified first. Since ancient poems generally have no less than 16 characters, if the number of Chinese characters is too small, the extracted poem text can be filtered out and no subsequent processing is performed.

[0078] Specifically, the number of Chinese characters in the poem text can be identified, and the extracted poem text is matched in a preset poem set only when the number of Chinese characters is greater than or equal to a specified number threshold, wherein the specified number threshold can be 16, for example.

[0079] In one embodiment, when the number of Chinese characters meets the requirement, the extracted poetry text can be matched in a preset poetry set. Specifically, the poet identifiers contained in the preset poetry set can be traversed. If any target poet identifier among the traversed poet identifiers exists in the poetry text, the poetry subset corresponding to the target poet identifier is obtained from the preset poetry set. Then, the poetry identifiers contained in the poetry subset can be traversed. If any target poetry identifier among the traversed poetry identifiers exists in the poetry text, the poetry content corresponding to the target poetry identifier is obtained from the poetry subset. Finally, if each verse in the poetry content exists in the poetry text, a matching result representing a successful match is generated.

[0080] At the same time, if the traversed poet identifiers do not exist in the poem text, or the traversed poem identifiers do not exist in the poem text, or any verse in the poem content does not exist in the poem text, a matching result representing a matching failure can be generated.

[0081] In a specific application example, a preset poetry collection can be traversed to obtain the poet's name and its corresponding sub-collection. If the poet's name appears in the extracted poetry text, the corresponding sub-collection is further determined.

[0082] Then, the sub-collection corresponding to the poet's name can be traversed to obtain the name of the ancient poem corresponding to the poet and its corresponding content. If the name of the ancient poem appears in the extracted poem text, the matching of the ancient poem content will continue.

[0083] Specifically, all text contents of the ancient poem can be traversed, and if every sentence is in the extracted poem text, it is considered that the ancient poem exists in the target page.

[0084] In the above process, if any stage of matching fails, a matching result indicating the matching failure will be directly generated, and the matching process of the subsequent stages will not continue.

[0085] S3: If the target poem is included in the poem text, obtain the translation content of the target poem, and generate a background image based on the translation content and style information of the translation content.

[0086] In this embodiment, when it is determined that the target poem is included in the poem text, the translation content of the target poem can be obtained from the preset poem set. The translation content is usually a text that conforms to the natural language specification. By parsing the translation content, the style information of the translation content can be determined. Among them, the style information can represent the emotion of the translation content. Combining the translation content and the style information, a background image that matches the content and emotion expressed by the target poem can be determined.

[0087] In one embodiment, a training set describing the mapping relationship between text and background image can be constructed through discretization coding and transformer, and a satisfactory image conversion model can be obtained by training based on the training set. Subsequently, by inputting the translation content into the image conversion model, the corresponding background image can be output.

[0088] See also Figure 2 In a specific application example, the image conversion model to be trained may include an encoder, a codebook, a decoder, and a transformer. The image conversion model can be trained through the following steps.

[0089] S31: Acquire a background image training sample, generate a text description sample of the background image training sample, and extract text features of the text description sample.

[0090] S32: Using the background image training samples to train the encoder, encoding directory and decoder in the image conversion model.

[0091] S33: Based on the trained encoder and encoding directory, a standard feature index of the background image training sample is generated.

[0092] S34: Using the text features of the text description sample as a priori conditions, driving the converter in the image conversion model to generate a predicted feature index, and training the converter in the image conversion model by comparing the predicted feature index with the standard feature index.

[0093] In this embodiment, the background image training sample may be a pre-generated background image, which may correspond to the translation content of a certain ancient poem and the style information of the translation content. By combining the translation content and style information corresponding to the background image training sample, a text description sample of the background image training sample may be generated. After the text description sample is generated, the text feature of the text description sample may be extracted. Specifically, the text feature may be a CLIP feature (Text CLIP), which may be used to train the transformer in the image conversion model later.

[0094] See also Figure 2 In this embodiment, the encoder in the image conversion model can extract sample features of the background image training sample. In practical applications, the sample features can be regarded as a three-dimensional matrix of M*L*K (in Figure 2K is not shown in the figure), where K represents the number of feature extraction channels of the encoder, and M*L represents the feature dimension extracted by each channel. Figure 2 In , both M and L can be 3, and the features extracted by each channel are 3*3 matrices. After extracting the sample features, each discrete feature in the sample features can be quantized into a feature index based on the codebook.

[0095] Specifically, the encoding directory may include a mapping relationship between feature indexes and discrete features. Figure 2 For example, the serial numbers from 0 to N-1 in front can be used as feature indexes, and the color block after each serial number can represent discrete features. When quantizing the discrete features in the sample features into feature indexes, the similarity between the discrete features in the sample features and the discrete features in the coding directory can be calculated, and the feature index corresponding to the most similar discrete feature in the coding directory can be used as the feature index of the discrete feature in the sample features. Through the above method, each discrete feature in the sample features can be matched one by one in the coding directory, so that each discrete feature in the sample features can be quantified to obtain the sample feature index corresponding to the sample feature. Figure 2 In the example, the 3*3 matrix consisting of 9 numbers such as 5, 3, and 21 can be used as the quantized sample feature index.

[0096] In this embodiment, after obtaining the sample feature index, the sample feature index can be decoded by a decoder, so as to restore the sample feature index to an image, and thus a decoded image corresponding to the sample feature index can be generated. Then, it can be determined whether the decoded image is a real image, and the determination process can be to calculate the error between the decoded image and the input background image training sample, and when the error is higher than a specified threshold, it is considered that the decoded image is not a real image, and if the error is lower than the specified threshold, it is considered that the decoded image is a real image.

[0097] In the above process, in the process of converting from sample features to quantized sample feature indexes, since similarity calculation is involved, there is a certain error between the sample features and the sample feature indexes, and the error can be represented by a feature quantization error function. In addition, there will also be an error between the decoded image and the background image training sample, and the error can be represented by a network adversarial loss function. In this way, based on the judgment result of whether the decoded image is a real image, an error function can be generated, and the error function can be the above-mentioned feature quantization error function and network adversarial loss function, so that the encoder, encoding directory and decoder are corrected by the error function.

[0098] In this embodiment, after the training of the encoder, the encoding directory and the decoder is completed, the training of the converter in the image conversion model can be continued. The text features of the text description samples of the background image training samples can be used as a priori conditions to drive the converter in the image conversion model to generate a predicted feature index. Specifically, the converter can be a cyclic iterative process. First, based on the text features, a first index prediction value (for example, Figure 2 5), then based on the text features and the first index prediction value, the second index prediction value can be generated, and so on, until all index prediction values ​​are generated ( Figure 2 There are 9 index prediction values ​​in it). In this way, each index prediction value can constitute a predicted feature index. To determine whether the predicted feature index generated by the converter is correct, a reference object needs to be provided. The reference object can be generated by an encoder and a coding directory that have completed training. Specifically, after the encoder and the coding directory have completed training, the encoder can extract sample features of the background image training sample again, and then convert the sample features into standard feature indexes based on the coding directory. Since the encoder and the coding directory have completed training, the standard feature index obtained by conversion can be regarded as an accurate reference. By comparing the predicted feature index and the standard feature index, the converter in the image conversion model can be trained based on the comparison result. In this process, the converter can be trained in an autoregressive manner.

[0099] After completing the training phase of the image conversion model, the image conversion model can be used to process the text description information to generate a corresponding background image.

[0100] Specifically, in one implementation, similar to the training process, the step of generating a background image based on the translation content and the style information of the translation content may include the following steps.

[0101] S301: constructing a description text including the translation content and style information of the translation content;

[0102] S302: Generate an initial feature index, and use the text features of the description text as a priori conditions to predict the predicted values ​​of each discrete feature in the initial feature index to generate a predicted feature index corresponding to the initial feature index;

[0103] S303 generates a background image corresponding to the description text according to the predicted feature index.

[0104] In this embodiment, the translation content and style information of the target poem can be combined to generate a corresponding description text. The description text can be processed by the trained image conversion model to be converted into a corresponding background image. Specifically, each numerical value in the initial feature index adopted by the image conversion model can be randomly generated, and the randomly generated initial feature index can gradually generate an accurate prediction feature index under the guidance of the text features of the description text. Subsequently, similar to the training process, the prediction feature index can be processed to generate a corresponding background image.

[0105] S4: Generate a poem conversion page corresponding to the target page based on the target poem and the background image, and display the poem conversion page.

[0106] In this embodiment, after the target poem is extracted and a background image matching the translation content and style information of the target poem is generated, a new poem conversion page can be created. In the poem conversion page, the background image can be used as the background, and the content of the target poem is displayed on the background image. In this way, by intelligently identifying the courseware, the poem in the courseware can be automatically extracted and a poem conversion page matching the style can be formed.

[0107] The technical solution provided by one or more embodiments of the present invention can obtain a standardized target poem by matching the poem text in the target page with a preset poem set. Subsequently, a matching background image can be generated by identifying the style information of the target poem. According to the target poem and the background image, a page of the courseware can be automatically generated, thereby greatly improving the generation efficiency of the poem page. At the same time, the recognition process of the target poem does not require professional knowledge and can be completed by text recognition. The solution has strong versatility.

[0108] See also Figure 3 One embodiment of the present invention further provides a device for generating a poetry conversion page, the device comprising:

[0109] A text extraction unit, used to read a target page and extract the poem text in the target page;

[0110] A poetry recognition unit, used for matching the extracted poetry text with a preset poetry set, and judging whether the poetry text contains a target poem based on the matching result;

[0111] A background image generating unit, configured to obtain the translation content of the target poem if the poem text contains the target poem, and generate a background image based on the translation content and style information of the translation content;

[0112] A poetry conversion unit is used to generate a poetry conversion page corresponding to the target page according to the target poetry and the background image, and display the poetry conversion page.

[0113] See also Figure 4 On the other hand, the present invention also provides a device for generating a poetry conversion page, the device comprising a processor and a memory, the memory being used to store a computer program, and when the computer program is executed by the processor, the above-mentioned method for generating a poetry conversion page is implemented.

[0114] On the other hand, the present invention also provides a computer-readable storage medium, which is used to store a computer program. When the computer program is executed by a processor, the above-mentioned method for generating a poetry conversion page is implemented.

[0115] The processor may be a central processing unit (CPU). The processor may also be other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, or a combination of the above chips.

[0116] As a non-transitory computer-readable storage medium, the memory can be used to store non-transitory software programs, non-transitory computer executable programs and modules, such as program instructions / modules corresponding to the method in the embodiment of the present invention. The processor executes various functional applications and data processing of the processor by running the non-transitory software programs, instructions and modules stored in the memory, that is, implementing the method in the above method embodiment.

[0117] The memory may include a program storage area and a data storage area, wherein the program storage area may store an operating system, an application required for at least one function; the data storage area may store data created by the processor, etc. In addition, the memory may include a high-speed random access memory, and may also include a non-transitory memory, such as at least one disk storage device, a flash memory device, or other non-transitory solid-state storage device. In some embodiments, the memory may optionally include a memory remotely disposed relative to the processor, and these remote memories may be connected to the processor via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.

[0118] Those skilled in the art can understand that all or part of the processes in the above-mentioned implementation methods can be implemented by instructing related hardware through a computer program, and the program can be stored in a computer-readable storage medium. When the program is executed, it can include the processes of the implementation methods of the above-mentioned methods. Among them, the storage medium can be a disk, an optical disk, a read-only memory (ROM), a random access memory (RAM), a flash memory, a hard disk drive (HDD) or a solid-state drive (SSD), etc.; the storage medium can also include a combination of the above-mentioned types of memory.

[0119] Although the embodiments of the present invention have been described in conjunction with the accompanying drawings, those skilled in the art may make various modifications and variations without departing from the spirit and scope of the present invention, and such modifications and variations are all within the scope defined by the appended claims.

Claims

1. A method for generating a poetry conversion page, characterized in that: The method comprises: Reading a target page and extracting the poem text in the target page; Matching the extracted poem text in a preset poem set, and judging whether the poem text contains a target poem based on the matching result; If the target poem is included in the poem text, obtaining the translation content of the target poem, and generating a background image based on the translation content and the style information of the translation content; Based on the target poem and the background image, a poem conversion page corresponding to the target page is generated, and the poem conversion page is displayed.

2. The method according to claim 1, characterized in that The preset poetry collection is generated in the following manner: Traversing the poet identifiers in the database, and creating a corresponding poetry subset for each of the poet identifiers; Acquire the poetry content and the translation of the poetry content from the database, and write the poetry content and the translation of the poetry content into a corresponding poetry subset according to a preset format according to the poet identifier to which the poetry content belongs; The combination of each of the poetry subsets is used as the generated preset poetry set.

3. The method according to claim 1, characterized in that After reading the target page, the method further includes: Converting the target page into page data of a specified format, and traversing text lines in the page data to extract text data from the page data; Inputting the text data into a poetry recognition model to determine whether there is poetry text in the text data through the poetry recognition model; Among them, if it is determined that there is poetry text in the text data, the poetry text in the text data is output through the poetry recognition model.

4. The method according to claim 1 or 3, characterized in that: After extracting the poetry text in the target page, the method further includes: The number of Chinese characters in the poem text is identified, and only when the number of Chinese characters is greater than or equal to a specified number threshold value, the extracted poem text is matched in a preset poem set.

5. The method according to claim 1, characterized in that Matching the extracted poetry text in a preset poetry set includes: Traversing the poet identifiers contained in the preset poetry set, if any target poet identifier among the traversed poet identifiers exists in the poetry text, obtaining a poetry subset corresponding to the target poet identifier from the preset poetry set; Traversing the poetry identifiers contained in the poetry subset, if any target poetry identifier among the traversed poetry identifiers exists in the poetry text, obtaining the poetry content corresponding to the target poetry identifier from the poetry subset; If all the verses in the poem content exist in the poem text, a matching result representing a successful match is generated.

6. The method according to claim 5, characterized in that The method further comprises: If none of the traversed poet identifiers exist in the poem text, or none of the traversed poem identifiers exist in the poem text, or any verse in the poem content does not exist in the poem text, a matching result representing a failed match is generated.

7. The method according to claim 1, characterized in that Generating a background image based on the translation content and the style information of the translation content includes: Constructing a description text including the translation content and style information of the translation content; Generate an initial feature index, and use the text features of the description text as a priori conditions to predict the predicted values ​​of each discrete feature in the initial feature index to generate a predicted feature index corresponding to the initial feature index; A background image corresponding to the description text is generated according to the predicted feature index.

8. The method according to claim 7, characterized in that The step of predicting the predicted value of each discrete feature in the initial feature index is implemented by completing the trained image conversion model, and the image conversion model is trained in the following manner: Acquire a background image training sample, generate a text description sample of the background image training sample, and extract text features of the text description sample; Using the background image training sample to train the encoder, encoding directory and decoder in the image conversion model; Based on the trained encoder and the encoding directory, generating a standard feature index of the background image training sample; The text features of the text description sample are used as prior conditions to drive the converter in the image conversion model to generate a predicted feature index, and the converter in the image conversion model is trained by comparing the predicted feature index with the standard feature index.

9. The method according to claim 8, characterized in that Using the background image training sample to train the encoder, the encoding directory and the decoder in the image conversion model includes: Extracting sample features of the background image training sample using an encoder, and generating a sample feature index corresponding to the sample feature based on a coding directory; Decoding the sample feature index using a decoder to generate a decoded image corresponding to the sample feature index; It is determined whether the decoded image is a true image, and an error function is generated based on the determination result, so as to correct the encoder, the encoding directory and the decoder through the error function.

10. A device for generating a poetry conversion page, characterized in that: The device comprises: A text extraction unit, used to read a target page and extract the poem text in the target page; A poetry recognition unit, used for matching the extracted poetry text with a preset poetry set, and judging whether the poetry text contains a target poem based on the matching result; A background image generating unit, configured to obtain the translation content of the target poem if the poem text contains the target poem, and generate a background image based on the translation content and style information of the translation content; A poetry conversion unit is used to generate a poetry conversion page corresponding to the target page according to the target poetry and the background image, and display the poetry conversion page.

11. A device for generating a poetry conversion page, characterized in that: The device for generating the poetry conversion page includes a processor and a memory, wherein the memory is used to store a computer program, and when the computer program is executed by the processor, it implements the method described in any one of claims 1 to 9.

12. A computer-readable storage medium, characterized in that: The computer-readable storage medium is used to store a computer program, and when the computer program is executed by a processor, the method according to any one of claims 1 to 9 is implemented.