Text conversion method and related apparatus
By processing the novel text in parallel using logic A and logic B, identifying speaker identifiers, scene information, and behavioral information, and automatically constructing script blocks, the problem of low efficiency in converting novels into scripts is solved, achieving highly efficient automated conversion.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- BEIJING HAIMA QINGFAN ENTERTAINMENT TECH CO LTD
- Filing Date
- 2022-11-30
- Publication Date
- 2026-07-24
AI Technical Summary
Current technologies for converting novel texts into screenplay texts are inefficient and lack automated solutions, relying mainly on manual rewriting.
Parallel logic A and logic B are used to process the novel text. Logic A identifies speaker identifiers through a pre-trained model, while logic B identifies scene and behavioral information through multiple models and constructs script blocks based on the identification results.
It enables the automatic and accurate conversion of novel texts into script texts, improving conversion efficiency and reducing manual intervention.
Smart Images

Figure CN115796117B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of data transmission, and in particular to a text conversion method and related apparatus. Background Technology
[0002] Traditional literature exists in two forms: novels and plays. Novel texts have no specific rules, while literary plays are more vivid and evocative. Therefore, converting novel texts into play texts has become a pressing technical problem for researchers in this field. Currently, there is no solution, and the process is generally done manually, which is inefficient. Summary of the Invention
[0003] In view of the above problems, the present invention provides a text conversion method and related apparatus to overcome or at least partially solve the above problems.
[0004] Firstly, a text conversion method includes:
[0005] Obtain the first original text block of the novel, wherein the first original text block comprises multiple segments of the novel text;
[0006] For the first original text block, logic A and logic B are executed in parallel, wherein logic A includes step A100, and logic B includes steps B100, B200, B300, B400, and B500.
[0007] In step A100, if there are N consecutive segments of novel text in the first original text block, each of which is enclosed in double quotes, then for the N consecutive segments of novel text, the pre-trained first model is used to identify the corresponding speaker identifier.
[0008] In step B100, for any segment of the novel text in the first original text block, if the novel text carries speaker information, the speaker identifier corresponding to the novel text is identified based on the speaker information.
[0009] In step B200, if the novel text does not carry speaker information, the novel text and the corresponding context are input into a pre-trained second model, and the speaker identification result of the second model for the novel text that does not carry speaker information is obtained.
[0010] In step B300, if the recognition result is that no speaker identifier is recognized, the text line type of the corresponding novel text is determined, wherein the text line type includes dialogue lines without narration, dialogue lines with narration, and other lines.
[0011] In step B400, if the text line type of the novel text is a dialogue line without narration or a dialogue line with narration, then the speaker identifier of the novel text is identified by executing the corresponding first identification logic.
[0012] In step B500, if the text line type of the novel text is another line, then by executing the corresponding second recognition logic, the scene information or behavior information corresponding to the novel text is recognized.
[0013] Based on the speaker identifiers, scene information, and behavior information identified by logic A and logic B, a script block corresponding to the first original text block is constructed.
[0014] In conjunction with the first aspect, in some alternative implementations, step B300 includes:
[0015] If the identification result is that no speaker identifier is identified and the corresponding entire paragraph of the novel text is enclosed in double quotation marks, then the text line type of the novel text is determined to be a dialogue line without narration.
[0016] If the recognition result is that no speaker identifier is recognized and the corresponding part of the novel text is enclosed in double quotes and the content enclosed in double quotes does not include preset keywords, then the text line type of the novel text is determined to be a dialogue line with narration.
[0017] If the identification result is that no speaker identifier is identified and the corresponding novel text does not contain quotation marks, or if the identification result is that no speaker identifier is identified and the corresponding novel text is partially enclosed in quotation marks and the content enclosed in quotation marks includes preset keywords, then the text line type of the novel text is determined to be other lines.
[0018] In conjunction with the first aspect, in some alternative embodiments, step B400 includes:
[0019] If the text line type of the novel text is the dialogue line without narration, then determine whether the previous and next paragraphs of the novel text are both enclosed in double quotation marks.
[0020] If neither the preceding nor the following paragraph of the novel text is entirely enclosed in quotation marks, then the speaker identifier of the novel text is determined to be a preset identifier.
[0021] If both the preceding and following paragraphs of the novel text are enclosed in quotation marks, then it is determined whether the preceding paragraph of the preceding novel text contains speaker information and whether the following paragraph of the following novel text contains speaker information.
[0022] If the preceding paragraph of the novel text contains speaker information and / or the following paragraph of the novel text contains speaker information, then the speaker identifier of the novel text is determined based on the speaker information.
[0023] If neither the preceding nor the following paragraph of the novel text contains speaker information, then the speaker identifier of the novel text is determined to be the preset identifier.
[0024] If the text line type of the novel text is the dialogue line with narration, then the novel text is input into a pre-trained third model, and the speaker identification result of the third model for the novel text is obtained.
[0025] In conjunction with the previous implementation method, in some optional implementation methods, the step of determining the speaker identifier of the novel text based on the speaker information if the preceding paragraph of the novel text carries speaker information and / or the following paragraph of the novel text carries speaker information includes:
[0026] If the preceding paragraph of the novel text contains speaker information, then the speaker identifier of the novel text is determined based on the speaker information contained in the preceding paragraph of the novel text.
[0027] If the preceding paragraph of the novel text does not contain speaker information but the following paragraph does, then the speaker identifier of the novel text is determined based on the speaker information carried in the following paragraph.
[0028] Optionally, in some optional implementations, if the text line type of the novel text is the dialogue line with narration, then inputting the novel text into a pre-trained third model and obtaining the speaker identification result of the third model for the novel text includes:
[0029] The novel text is then input into a pre-trained third model;
[0030] If the third model identifies the corresponding speaker identifier, then the speaker identifier output by the third model is obtained;
[0031] If the third model fails to identify the corresponding speaker identifier, then the speaker identifier of the novel text is determined to be the preset identifier.
[0032] In conjunction with the first aspect, in some alternative implementations, step B500 includes:
[0033] If the text line type of the novel text is one of the other lines, then the novel text is input into the scene line recognition model;
[0034] If the scene line recognition model determines that the novel text is a scene line, then the scene words in the novel text are identified by the scene word recognition model;
[0035] If the scene word recognition model recognizes a scene word in the novel text, then the scene word is obtained as scene information of the novel text;
[0036] If the scene word recognition model fails to recognize a scene word in the novel text or the scene line recognition model determines that the novel text is not a scene line, then the novel text is input to the behavior recognition model;
[0037] If the behavior recognition model determines that the novel text is a behavior line, then the novel text is segmented according to preset symbols to obtain behavior information.
[0038] In conjunction with the first aspect, in some optional implementations, the step of constructing a script block corresponding to the first original text block based on the speaker identifiers, scene information, and behavior information identified by logic A and logic B includes:
[0039] For any segment of the novel text in the first original text block, if logic A identifies a speaker identifier, then the novel text is modified into a dialogue script according to the script format and the speaker identifier identified by logic A.
[0040] If logic A fails to identify the speaker identifier but logic B does, then the novel text is modified into a dialogue script based on the script format and the speaker identifier identified by logic B.
[0041] If logic B identifies scene information, then the novel text is modified into a scene script based on the script format and the scene information identified by logic B.
[0042] If logic B identifies behavioral information, then the novel text is modified into a behavioral script based on the script format and the behavioral information identified by logic B.
[0043] Secondly, a text conversion device includes: an original text acquisition unit, a text processing unit, and a script construction unit;
[0044] The original text acquisition unit is used to acquire a first original text block of the novel, wherein the first original text block includes multiple segments of novel text;
[0045] The text processing unit is configured to execute logic A and logic B in parallel for the first original text block, wherein logic A includes step A100, and logic B includes steps B100, B200, B300, B400, and B500.
[0046] In step A100, if there are N consecutive segments of novel text in the first original text block, each of which is enclosed in double quotes, then for the N consecutive segments of novel text, the pre-trained first model is used to identify the corresponding speaker identifier.
[0047] In step B100, for any segment of the novel text in the first original text block, if the novel text carries speaker information, the speaker identifier corresponding to the novel text is identified based on the speaker information.
[0048] In step B200, if the novel text does not carry speaker information, the novel text and the corresponding context are input into a pre-trained second model, and the speaker identification result of the second model for the novel text that does not carry speaker information is obtained.
[0049] In step B300, if the recognition result is that no speaker identifier is recognized, the text line type of the corresponding novel text is determined, wherein the text line type includes dialogue lines without narration, dialogue lines with narration, and other lines.
[0050] In step B400, if the text line type of the novel text is a dialogue line without narration or a dialogue line with narration, then the speaker identifier of the novel text is identified by executing the corresponding first identification logic.
[0051] In step B500, if the text line type of the novel text is another line, then by executing the corresponding second recognition logic, the scene information or behavior information corresponding to the novel text is recognized.
[0052] The script construction unit is used to construct a script block corresponding to the first original text block based on the speaker identifiers, scene information and behavior information identified by logic A and logic B.
[0053] Thirdly, a computer-readable storage medium having a program stored thereon, which, when executed by a processor, implements the text conversion method described in any of the preceding claims.
[0054] Fourthly, an electronic device includes at least one processor, at least one memory and a bus connected to the processor; wherein the processor and the memory communicate with each other via the bus; the processor is configured to invoke program instructions in the memory to execute the text conversion method described in any of the preceding claims.
[0055] By means of the above technical solution, the present invention provides a text conversion method and related apparatus, which can obtain a first original text block of a novel, wherein the first original text block includes multiple segments of novel text; for the first original text block, logic A and logic B are executed in parallel, wherein logic A includes step A100, and logic B includes steps B100, B200, B300, B400, and B500; in step A100, if there are N consecutive segments of novel text in the first original text block, each segment is enclosed in double quotation marks, then for the N consecutive segments of novel text, a pre-trained first model is used to identify the corresponding speaker identifier; in step B100, for any segment of novel text in the first original text block, if the novel text carries speaker information, then the speaker identifier corresponding to the novel text is identified according to the speaker information; in step B200, if the novel text does not carry speaker information, then the... The novel text and its corresponding context are input into a pre-trained second model, and the second model obtains the speaker identification result for the novel text that does not carry speaker information. In step B300, if the identification result is that no speaker identification is found, the text line type of the corresponding novel text is determined, wherein the text line type includes dialogue lines without narration, dialogue lines with narration, and other lines. In step B400, if the text line type of the novel text is a dialogue line without narration or a dialogue line with narration, the speaker identification of the novel text is identified by executing the corresponding first identification logic. In step B500, if the text line type of the novel text is another type, the scene information or behavior information corresponding to the novel text is identified by executing the corresponding second identification logic. Based on the speaker identification, scene information, and behavior information identified by logic A and logic B, a script block corresponding to the first original text block is constructed. Therefore, it can be seen that the present invention can automatically and accurately convert novel text into corresponding script blocks without manual intervention, resulting in high efficiency.
[0056] The above description is merely an overview of the technical solution of the present invention. In order to better understand the technical means of the present invention and to implement it in accordance with the contents of the specification, and in order to make the above and other objects, features and advantages of the present invention more apparent and understandable, specific embodiments of the present invention are described below. Attached Figure Description
[0057] Various other advantages and benefits will become apparent to those skilled in the art upon reading the following detailed description of preferred embodiments. The accompanying drawings are for illustrative purposes only and are not intended to limit the invention. Furthermore, the same reference numerals denote the same parts throughout the drawings. In the drawings:
[0058] Figure 1 A flowchart of a text conversion method provided by the present invention is shown;
[0059] Figure 2 A schematic diagram of the structure of a text conversion device provided by the present invention is shown;
[0060] Figure 3 A schematic diagram of the structure of an electronic device provided by the present invention is shown. Detailed Implementation
[0061] Exemplary embodiments of the invention will now be described in more detail with reference to the accompanying drawings. While exemplary embodiments of the invention are shown in the drawings, it should be understood that the invention may be implemented in various forms and should not be limited to the embodiments set forth herein. Rather, these embodiments are provided so that this invention will be thorough and complete, and will fully convey the scope of the invention to those skilled in the art.
[0062] like Figure 1 As shown, the present invention provides a text conversion method, including: S100, S200 and S300;
[0063] S100. Obtain the first original text block of the novel, wherein the first original text block includes multiple segments of novel text;
[0064] Optionally, generally speaking, a novel can be divided into multiple chapters, and a chapter can include multiple segments of the novel text. The first original text block mentioned in this invention can be the segments of the novel text of a chapter.
[0065] S200. For the first original text block, execute logic A and logic B in parallel, wherein logic A includes step A100, and logic B includes steps B100, B200, B300, B400 and B500.
[0066] Optionally, the present invention can convert the first original text block into a corresponding script block. That is, the novel text is converted into script-formatted text. Since the content required by the script format differs from that required by the novel text, the present invention can combine the requirements of the script format to determine the corresponding elements from the novel text and then construct the corresponding script block. The present invention does not limit this.
[0067] Optionally, generally speaking, a script block can include dialogue scripts, action scripts, and scene scripts. A dialogue script refers to the back-and-forth dialogue between multiple characters, typically displayed in the format of "speaker identifier: speech content." A scene script refers to the scene descriptions corresponding to different parts of the script, that is, the scene activities of the characters in different parts, generally displayed by setting scene keywords in the script. When characters engage in dialogue or other scene activities, they can perform corresponding actions; these actions can be understood as action scripts, generally described by content within parentheses.
[0068] The logic A and logic B of this invention are two parallel execution processes. By executing logic A and logic B in parallel, the speaker identification, scene information and behavior information involved in each segment of the novel text of the first original text block are determined from multiple aspects, so as to facilitate the subsequent construction of the corresponding script block according to the script format.
[0069] Optionally, to clearly describe the solution of the present invention, logic A and logic B will be described separately below. As mentioned above, logic A includes step A100.
[0070] In step A100, if there are N consecutive segments of novel text in the first original text block, each of which is enclosed in double quotes, then for the N consecutive segments of novel text, the pre-trained first model is used to identify the corresponding speaker identifier.
[0071] Optionally, for multiple novel texts within the first original text block, this invention can determine whether there are multiple consecutive dialogue texts. In novel texts, dialogue texts are generally enclosed in quotation marks around all the words spoken by the character. For example, there are three dialogue texts:
[0072] Good morning, Lao Li.
[0073] Good morning, Lao Wang. Have you had breakfast yet?
[0074] “I haven’t eaten yet. I was planning to go to the East Market to have a bowl of noodle soup.”
[0075] As described above, the three segments can be understood as three consecutive segments of novel text, each enclosed in quotation marks. For these three segments, the present invention can identify the corresponding speaker identifiers based on the first model. It should be noted that the speaker identifier can be the name of a character in the novel; for example, "Old Li" and "Old Wang" mentioned above can both be understood as speaker identifiers.
[0076] Optionally, the first model in the present invention is not just a single model, but can be multiple models. For example, it can be multiple BERT entity models, and the training sets and training processes based on each BERT entity model are different. Therefore, the results output by each BERT entity model are different. By comprehensively determining the speaker identification of each segment of the novel text based on the results output by each BERT entity model, the accuracy of the present invention can be improved to a certain extent.
[0077] For example, for any segment of the novel text among N consecutive segments of novel text, the present invention can respectively identify the speaker identification of this segment of novel text through two BERT entity models. If the speaker identification output by one BERT entity model is incomplete (for example, only one character "Li"), and the speaker identification output by the other BERT entity model is more complete ("Lao Li"), then "Lao Li" is used as the speaker identification of this segment of novel text. Of course, there are various different situations for the results output by different models of the present invention, and the present invention can set the processing methods for different situations according to actual needs, and the present invention will not list them one by one here.
[0078] For another example, the present invention can also determine the number of speaker identifications of this segment of novel text through a single BERT entity model, that is, determine how many characters' words are included in a segment of novel text. If a segment of novel text corresponds to multiple speaker identifications, the present invention can determine how many speaker identifications have not been recognized by the determined number of speaker identifications and the number of specific speaker identifications recognized by the model, so as to know how many preset identifications need to be set (for example, uniformly set "unknown character" for the novel text for which no specific speaker identification is recognized).
[0079] Optionally, if there is no novel text among N consecutive segments in the first original text block that is entirely enclosed by double quotes, the process of executing logic A for the first original text block ends here.
[0080] Optionally, the above logic A only recognizes the speaker identification for the novel text among N consecutive segments that are entirely enclosed by double quotes. There is also other novel text in the first original text block that needs to be processed accordingly. Therefore, the present invention can execute logic B for each segment of the novel text in the first original text block without any distinction. As described above, the logic B includes step B100, step B200, step B300, step B400, and step B500.
[0081] In step B100, for any segment of the novel text in the first original text block, if the novel text carries speaker information, the speaker identification corresponding to the novel text is recognized according to the speaker information;
[0082] Optionally, the speaker information mentioned in this invention refers to information that can represent a character in the novel, such as the character's name information, and this invention does not limit this.
[0083] Optionally, the present invention does not specifically limit the process of identifying the speaker identifier corresponding to the novel text based on the speaker information. For example, the present invention can use other pre-trained BERT entity models to further identify the novel text and the carried speaker information, thereby identifying the corresponding speaker identifier.
[0084] For example, the first original text block includes the following novel text:
[0085] "Hurry up," Old Li urged from behind.
[0086] "knew.".
[0087] "But I'm almost out of strength," Old Wang said, panting heavily.
[0088] This invention uses a BERT entity model to identify the speaker as "Old Li" for the first paragraph of the novel text and "Old Wang" for the second and third paragraphs. This invention does not limit the specific speaker identification. Alternatively, the BERT entity model can combine the identified speaker identifiers with the corresponding novel text and output a transformed result. For example, the first paragraph could output "Old Li said, 'Run faster.'"; the second paragraph "Old Wang said, 'Okay.'"; and the third paragraph "Old Wang said, 'But I'm running out of energy.'" This invention does not limit the specific speaker identification.
[0089] In step B200, if the novel text does not carry speaker information, the novel text and the corresponding context are input into a pre-trained second model, and the speaker identification result of the second model for the novel text that does not carry speaker information is obtained.
[0090] Optionally, for any given passage of fiction text, if the text does not contain speaker information, it means that the speaker identifier cannot be directly extracted from the content of the text, and further extraction of the implicit information of the text is required. Therefore, this invention can input the fiction text and its context into a second model, so that the second model can extract the implicit information of the fiction text in combination with the context.
[0091] Optionally, the second model may or may not extract the speaker identifier of the novel text, as represented by the recognition result. Optionally, if the second model extracts the speaker identifier of the novel text, it can set the corresponding speaker identifier for the novel text and perform certain transformations on the novel text. If the second model does not extract the speaker identifier of the novel text, it can execute the subsequent step B300 to further process the novel text for which no speaker identifier has been identified.
[0092] Optionally, the context referred to in this invention can refer to the preceding and following paragraphs of a novel text, or it can refer to the preceding M paragraphs and the following M paragraphs of a novel text. M can be set according to actual needs, and this invention does not limit it.
[0093] In step B300, if the recognition result is that no speaker identifier is recognized, the text line type of the corresponding novel text is determined, wherein the text line type includes dialogue lines without narration, dialogue lines with narration, and other lines.
[0094] Optionally, the present invention can perform regular expression classification on novel texts for which speaker identifiers are not identified, thereby determining the text line type of the novel text.
[0095] For example, combining Figure 1 In some optional embodiments, step B300, as shown in the implementation, includes steps B310, B320, and B330.
[0096] Step B310: If the recognition result is that no speaker identifier is recognized and the corresponding entire paragraph of the novel text is enclosed in double quotation marks, then the text line type of the novel text is determined to be a dialogue line without narration.
[0097] For example, if a passage of text in a novel reads "I understand.", then the text line type of that passage is determined to be a dialogue line without narration.
[0098] Step B320: If the recognition result is that no speaker identifier is recognized and the corresponding part of the novel text is enclosed in double quotes and the content enclosed in double quotes does not include preset keywords, then the text line type of the novel text is determined to be a dialogue line with narration.
[0099] For example, if a passage in a novel reads, ““Run faster,” Old Li urged from behind, then the text line type of that passage is determined to be a dialogue line with narration.
[0100] Optionally, the present invention does not impose specific restrictions on the preset keywords, which can be set according to actual needs. The preset keywords may include words such as "bang", "clang", and "squeak".
[0101] Step B330: If the identification result is that no speaker identifier is identified and the corresponding novel text does not contain quotation marks, or if the identification result is that no speaker identifier is identified and the corresponding novel text is partially enclosed in quotation marks and the content enclosed in quotation marks includes preset keywords, then the text line type of the novel text is determined to be other lines.
[0102] For example, if a passage in a novel reads "The water tank shattered with a 'bang'," then the text line type for that passage is determined to be "Other Lines."
[0103] Optionally, after determining the text line type of the obtained novel text, since the corresponding speaker identifier has not yet been identified for these novel texts, the present invention can further process the novel text whose text line type has been determined, as shown in steps B400 and B500.
[0104] In step B400, if the text line type of the novel text is a dialogue line without narration or a dialogue line with narration, then the speaker identifier of the novel text is identified by executing the corresponding first identification logic.
[0105] Optionally, a novel text corresponds to only one type of text line. Therefore, for novel texts without narration dialogue lines or with narration dialogue lines, the present invention can identify the speaker identifier of the novel text by executing the corresponding first identification logic.
[0106] For example, combining Figure 1 In some optional embodiments, step B400, as shown in the implementation, includes steps B410, B420, B430, and B440.
[0107] Step B410: If the text line type of the novel text is the dialogue line without narration, then determine whether the previous and next paragraphs of the novel text are both enclosed in double quotation marks.
[0108] Optionally, for novel text without narration dialogue lines, steps B410, B420, B430, B440, and B450 are performed; for novel text with narration dialogue lines, step B460 is performed. This invention does not limit the scope of the invention.
[0109] Optionally, as mentioned above, the entire content of a novel text without narration dialogue is enclosed in double quotation marks. Therefore, the present invention can determine whether the entire content of the preceding and following paragraphs of a novel text without narration dialogue is also enclosed in double quotation marks.
[0110] Step B420: If the previous and next paragraphs of the novel text are not both enclosed in quotation marks, then the speaker identifier of the novel text is determined to be a preset identifier.
[0111] Optionally, if at least one paragraph of the preceding and following novel text is not enclosed in quotation marks, it indicates that the novel text does not form a continuous dialogue with the context. Therefore, it is temporarily impossible to identify the speaker of the novel text based on the context. Thus, the speaker of the novel text is determined to be a preset identifier (as mentioned above, it can be set to "unknown character").
[0112] Step B430: If both the preceding and following paragraphs of the novel text are enclosed in quotation marks, then determine whether the preceding paragraph of the preceding novel text carries speaker information and whether the following paragraph of the following novel text carries speaker information.
[0113] Optionally, if both the preceding and following paragraphs of the novel are enclosed in quotation marks, it indicates that the paragraphs form a continuous dialogue with the surrounding text, and the speaker identifier of the paragraphs can be further identified by combining the context.
[0114] Optionally, taking the third paragraph of the novel as an example of the novel text without narration dialogue in this article, the second paragraph of the novel text can be understood as the "previous paragraph of the novel text" in this article, the fourth paragraph of the novel text can be understood as the "next paragraph of the novel text" in this article, the first paragraph of the novel text can be understood as the "previous paragraph of the novel text" in this article, and the fifth paragraph of the novel text can be understood as the "later paragraph of the novel text" in this article.
[0115] Step B440: If the preceding paragraph of the novel text carries speaker information and / or the following paragraph of the novel text carries speaker information, then determine the speaker identifier of the novel text based on the speaker information.
[0116] Optionally, if at least one of the preceding and following paragraphs of the novel contains speaker information, the speaker identifier of that paragraph (paragraph 3 in the example above) can be determined based on that speaker information. It should be noted that if both the preceding and following paragraphs contain speaker information, the speaker information in the preceding paragraph shall be used to determine the speaker identifier of the novel.
[0117] For example, in conjunction with the previous embodiment, in some optional embodiments, step B440 includes: step B441 and step B442;
[0118] Step B441: If the preceding paragraph of the novel text contains speaker information, then determine the speaker identifier of the novel text based on the speaker information carried in the preceding paragraph of the novel text.
[0119] Step B442: If the preceding paragraph of the novel text does not carry speaker information but the following paragraph of the novel text does carry speaker information, then determine the speaker identifier of the novel text based on the speaker information carried in the following paragraph of the novel text.
[0120] Step B450: If neither the preceding nor the following paragraph of the novel text contains speaker information, then the speaker identifier of the novel text is determined to be the preset identifier.
[0121] Optionally, if neither the preceding nor the following paragraph of the novel contains speaker information, it means that the speaker identifier of the paragraph cannot be determined by combining the context. Therefore, the speaker identifier of the paragraph can be set as a preset identifier.
[0122] Step B460: If the text line type of the novel text is the dialogue line with narration, then input the novel text into a pre-trained third model and obtain the speaker identification result of the third model for the novel text.
[0123] Optionally, the third model may include multiple models, such as two BERT entity models. One BERT entity model can only identify the speaker identifier of the novel text, while the other BERT entity model can not only identify the speaker identifier of the novel text, but also identify the newline content and deleted content of the novel text. The newline content is understood as the content that needs to be retained in the script, and the deleted content is understood as the content that is not needed in the script and can be deleted.
[0124] Optionally, in some alternative implementations, step B460 includes: step B461, step B462 and step B463;
[0125] Step B461: Input the novel text into a pre-trained third model;
[0126] Step B462: If the third model identifies the corresponding speaker identifier, then the speaker identifier output by the third model is obtained;
[0127] Step B463: If the third model fails to identify the corresponding speaker identifier, then the speaker identifier of the novel text is determined to be the preset identifier.
[0128] Optionally, if the two BERT entity models identify the speaker identifier of the novel text, the present invention can set the corresponding speaker identifier for the novel text; if neither of the two BERT entity models identifies the speaker identifier of the novel text, the present invention can set the corresponding speaker identifier as a preset identifier for the novel text.
[0129] In step B500, if the text line type of the novel text is another line, then by executing the corresponding second recognition logic, the scene information or behavior information corresponding to the novel text is recognized.
[0130] Optionally, the present invention does not limit the process of identifying scene information or behavioral information corresponding to the novel text by executing the corresponding second identification logic. For example, in combination with Figure 1 In some optional embodiments, step B500, as shown in the implementation, includes steps B510, B520, B530, B540, and B550.
[0131] Step B510: If the text line type of the novel text is the other line, then input the novel text into the scene line recognition model;
[0132] Optionally, the present invention does not impose specific limitations on the scene line recognition model, and any feasible method is within the protection scope of the present invention.
[0133] Step B520: If the scene line recognition model determines that the novel text is a scene line, then the scene words in the novel text are identified by the scene word recognition model.
[0134] Optionally, a scene line refers to the content described in the novel text as a novel scene. For scene lines, the present invention can further identify specific scene words and characterize the novel scene through scene words. The present invention does not impose any limitations on this.
[0135] Optionally, the scene word recognition model described in this invention can be a BERT entity model. For a novel text with a scene line, this invention first checks whether the first few paragraphs of the novel text contain scene words. If the first K paragraphs of the novel text do not contain scene words, then the novel text is input into the scene word recognition model to identify the scene words in the novel text; if the first K paragraphs of the novel text contain scene words, it means that there are already relevant descriptions of scene words, which can be directly quoted without further recognition. Therefore, it can be directly determined whether the novel text is a line.
[0136] Step B530: If the scene word recognition model recognizes a scene word in the novel text, then the scene word is obtained as scene information of the novel text;
[0137] Optionally, if the scene recognition model identifies scene words in the novel text and the subsequent line recognition model determines that the novel text is not a line, the present invention can delete the novel text and retain the scene words in the novel text as scene information for output. The present invention does not impose any restrictions on this.
[0138] Step B540: If the scene word recognition model fails to recognize a scene word in the novel text or the scene line recognition model determines that the novel text is not a scene line, then the novel text is input into the behavior recognition model.
[0139] Optionally, if the scene word recognition model fails to identify scene words in the novel text, the present invention can further process the novel text before inputting it into the behavior recognition model. For example, the present invention can first determine whether the novel text is a chapter title (i.e., determine whether the novel text includes "Chapter *", where * represents any one or more characters). If the novel text is not a chapter title, then the novel text is directly input into the behavior recognition model.
[0140] If the current paragraph is a chapter title, determine whether the next paragraph contains scene words. If the next paragraph contains scene words, set it to the scene words included in the next paragraph, and then input the paragraph along with the scene words into the behavior recognition model. If the next paragraph does not contain scene words, directly input the paragraph into the behavior recognition model.
[0141] Step B550: If the behavior recognition model determines that the novel text is a behavior line, then the novel text is segmented according to preset symbols to obtain behavior information.
[0142] Optionally, regardless of whether scene words are obtained in the aforementioned processes, if the behavior recognition model determines that the novel text is a behavior line, the present invention can segment the novel text into sentences according to punctuation marks such as periods, question marks, and commas that have the function of segmenting sentences, and then output them as behavior information.
[0143] If the behavior recognition model determines that the novel text is not a behavior line, the present invention can delete the novel text. Furthermore, if the aforementioned process yields scene words, only the scene words are output as scene information; if the aforementioned process does not yield scene words, it indicates that no scene information or behavior information has been extracted from the novel text.
[0144] S300. Based on the speaker identifiers, scene information and behavior information identified by logic A and logic B, construct a script block corresponding to the first original text block.
[0145] Optionally, as mentioned above, for each segment of the novel text, the present invention may identify speaker identifiers, scene information, or behavioral information. Therefore, the present invention can combine the identified information to construct a script block corresponding to the first original text block.
[0146] For example, combining Figure 1 In some optional embodiments, the illustrated implementation includes steps 3.1, 3.2, 3.3, and 3.4.
[0147] Step 3.1: For any segment of the novel text in the first original text block, if the speaker identifier is identified by logic A, then the novel text is modified into a dialogue script according to the script format and the speaker identifier identified by logic A.
[0148] Step 3.2: If logic A fails to identify the speaker identifier but logic B does, then the novel text is modified into a dialogue script based on the script format and the speaker identifier identified by logic B.
[0149] Step 3.3: If logic B identifies scene information, then according to the script format and the scene information identified by logic B, modify the novel text into a scene script;
[0150] Step 3.4: If logic B identifies behavioral information, then the novel text is modified into a behavioral script based on the script format and the behavioral information identified by logic B.
[0151] Optionally, to further improve the accuracy of the present invention, after performing the aforementioned steps B450 and B463, for novel text with a speaker identifier set to a preset identifier, the present invention can further determine, through a BERT entity model, whether the novel text is a voice-over line, an OS line, or a speaker dialogue line. Here, a voice-over line refers to words not spoken by a novel character; an OS line refers to words thought by a novel character but not actually spoken; and a speaker dialogue line refers to words spoken by a novel character.
[0152] For novel text consisting of voice-over and OS lines, this invention can directly output the corresponding novel text as the corresponding script lines. For novel text consisting of speaker dialogue lines (novel text where the speaker is an "unknown character"), this invention can modify the rules. Each rule is explained with examples below:
[0153] Rule 1: Determine if there are no other speakers besides the third person in the text lines before and after this line (excluding stopped speakers). If yes, replace "unknown character" with "third person" and end the output; otherwise, proceed to the next rule.
[0154] Example text: The first sentence is, "He looked outside and said, 'You should know these things too.'"; the second sentence is, "Don't live in a fantasy."; the third sentence is, "He said, 'Don't do this all day long.'"
[0155] The first and third sentences use the third-person pronoun "he" as the speaker, while the second sentence has no speaker. For the second sentence, there is only one speaker in both the preceding and following lines of text, namely the third-person pronoun "he," and there are no other speakers besides the third-person pronoun. Therefore, "he" is used to replace "unknown role," and the text is output; otherwise, the next rule is applied.
[0156] Rule 2: Determine if neither the lines before nor after this line are dialogue lines, and if there is a third-person speaker (excluding deactivated speakers) and only one speaker other than the third-person speaker. If so, replace "Unknown Character" with "Speaker" and end the output; otherwise, proceed to the next rule.
[0157] Example text: The first sentence is "Li Feng looked outside."; the second sentence is "Don't live in fantasy."; the third sentence is "After saying that, he left."
[0158] The first and third sentences are not dialogue sentences, but they contain the speaker "Li Feng" and "he" (the logic for determining if someone is a speaker is to loop through all the confirmed speakers in the novel and check if they appear in the text). For the second sentence, the lines before and after it are not dialogue lines, and besides the speaker "Li Feng," it is only in the third person. Therefore, "Li Feng" is used to replace "unknown character," and the text is output; otherwise, the next rule is applied. (If the first sentence were changed to "Li Feng looked at Liu Gang," this rule would not apply).
[0159] Rule 3: Determine if there is only one speaker in the preceding and following text lines and if the preceding text line is a dialogue line. If so, add this speaker to the list of disabled speakers. Otherwise, do not process any statements that do not meet this rule.
[0160] Example text: The first sentence is, "Li Feng looked outside and said, 'You should know about these things by now.'"; the second sentence is, "Don't live in a fantasy."; the third sentence is, "He left after saying that." If these three sentences are correct, then "Li Feng" can be added to the list of stopped speakers.
[0161] Rule 4: Does the speaker (excluding disabled speakers) exist in the first 10 lines of text in this line? If it does, get the most recently indexed speaker and replace the unknown role in the dialogue line; if it does not exist, proceed to the next rule.
[0162] For example: If the first 10 sentences in this line contain the characters "Zhang San", "Li Si", "Wang Wu" and "Zhao Liu", in order from the beginning to the end, then the most recent speaker is "Zhao Liu", so replace the "unknown character" with "Zhao Liu".
[0163] Rule 5: Check if a speaker (excluding disabled speakers) exists in the next 10 lines of text. If so, retrieve the most recently indexed speaker and replace the unknown speaker in the dialogue line. If not, simply retain the "unknown speaker" output.
[0164] For example: In the last 10 sentences of this line, there are characters "Zhang San", "Li Si", "Wang Wu" and "Zhao Liu" in order from front to back. The most recent speaker is "Zhao Liu", so "Zhang San" is used to replace the "unknown character".
[0165] It should be noted that the names above are for illustrative purposes only and have no practical significance, and do not refer to any specific natural person in real life.
[0166] like Figure 2 As shown, the present invention provides a text conversion device, including: an original text acquisition unit 100, a text processing unit 200, and a script construction unit 300;
[0167] The original text acquisition unit 100 is used to acquire a first original text block of the novel, wherein the first original text block includes multiple segments of novel text;
[0168] The text processing unit 200 is configured to execute logic A and logic B in parallel for the first original text block, wherein logic A includes step A100, and logic B includes steps B100, B200, B300, B400, and B500.
[0169] In step A100, if there are N consecutive segments of novel text in the first original text block, each of which is enclosed in double quotes, then for the N consecutive segments of novel text, the pre-trained first model is used to identify the corresponding speaker identifier.
[0170] In step B100, for any segment of the novel text in the first original text block, if the novel text carries speaker information, the speaker identifier corresponding to the novel text is identified based on the speaker information.
[0171] In step B200, if the novel text does not carry speaker information, the novel text and the corresponding context are input into a pre-trained second model, and the speaker identification result of the second model for the novel text that does not carry speaker information is obtained.
[0172] In step B300, if the recognition result is that no speaker identifier is recognized, the text line type of the corresponding novel text is determined, wherein the text line type includes dialogue lines without narration, dialogue lines with narration, and other lines.
[0173] In step B400, if the text line type of the novel text is a dialogue line without narration or a dialogue line with narration, then the speaker identifier of the novel text is identified by executing the corresponding first identification logic.
[0174] In step B500, if the text line type of the novel text is another line, then by executing the corresponding second recognition logic, the scene information or behavior information corresponding to the novel text is recognized.
[0175] The script construction unit 300 is used to construct a script block corresponding to the first original text block based on the speaker identifiers, scene information and behavior information identified by logic A and logic B.
[0176] Combination Figure 2In some optional embodiments, when the text processing unit 200 performs step B300, it specifically includes: a first determining subunit, a second determining subunit, and a third determining subunit.
[0177] The first determining subunit is configured to determine that the text line type of the novel text is a dialogue line without narration if the recognition result is that no speaker identifier is recognized and the corresponding entire paragraph of the novel text is enclosed in double quotation marks.
[0178] The second determining subunit is used to determine that the text line type of the novel text is a dialogue line with narration if the recognition result is that no speaker identifier is recognized and the corresponding part of the novel text is enclosed in double quotes and the content enclosed in double quotes does not include preset keywords.
[0179] The third determining subunit is configured to determine the text line type of the novel text as other lines if the identification result is that no speaker identifier is identified and the corresponding novel text does not carry quotation marks, or if the identification result is that no speaker identifier is identified and the corresponding novel text is partially enclosed in quotation marks and the content enclosed in quotation marks includes preset keywords.
[0180] Combination Figure 2 In some optional embodiments, when the text processing unit 200 performs step B400, it specifically includes: a fourth determining subunit, a fifth determining subunit, a sixth determining subunit, a seventh determining subunit, an eighth determining subunit, and a first result obtaining subunit.
[0181] The fourth determining subunit is used to determine whether the previous and next paragraphs of the novel text are both enclosed in double quotes if the text line type of the novel text is the dialogue line without narration.
[0182] The fifth determining subunit is used to determine the speaker identifier of the novel text as a preset identifier if the previous and next paragraphs of the novel text are not both enclosed in quotation marks.
[0183] The sixth determining subunit is used to determine whether the preceding paragraph of the preceding novel text carries speaker information and whether the following paragraph of the next novel text carries speaker information if both the preceding and following paragraphs of the novel text are enclosed in double quotation marks.
[0184] The seventh determining subunit is used to determine the speaker identifier of the novel text based on the speaker information if the preceding novel text carries speaker information and / or the following novel text carries speaker information.
[0185] The eighth determining subunit is used to determine the speaker identifier of the novel text as the preset identifier if neither the preceding nor the following novel text contains speaker information.
[0186] The first result obtaining subunit is used to input the novel text into a pre-trained third model if the text line type of the novel text is the dialogue line with narration, and obtain the speaker identification result of the third model for the novel text.
[0187] In conjunction with the previous implementation, in some optional implementations, the seventh determining subunit includes: a ninth determining subunit and a tenth determining subunit;
[0188] The ninth determining subunit is used to determine the speaker identifier of the novel text based on the speaker information carried in the preceding novel text if the preceding novel text carries speaker information.
[0189] The tenth determining subunit is used to determine the speaker identifier of the novel text based on the speaker information carried in the latter novel text if the former novel text does not carry speaker information and the latter novel text does carry speaker information.
[0190] Optionally, in some alternative implementations, the first result obtaining subunit includes: a first input subunit, a first identifier obtaining subunit, and a first identifier determining subunit;
[0191] The first input subunit is used to input the novel text into a third model that is pre-trained;
[0192] The first identifier acquisition subunit is used to obtain the speaker identifier output by the third model if the third model identifies the corresponding speaker identifier;
[0193] The first identifier determination subunit is used to determine the speaker identifier of the novel text as the preset identifier if the third model fails to identify the corresponding speaker identifier.
[0194] Combination Figure 2In some optional embodiments, when the text processing unit 200 performs step B500, it specifically includes: a second input subunit, a first scene word subunit, a first scene information subunit, a third input subunit, and a first segmentation subunit.
[0195] The second input subunit is used to input the novel text into the scene line recognition model if the text line type of the novel text is the other line.
[0196] The first scene word subunit is used to identify scene words in the novel text through the scene word recognition model if the scene line recognition model determines that the novel text is a scene line;
[0197] The first scene information subunit is used to obtain the scene word as scene information of the novel text if the scene word recognition model recognizes the scene word of the novel text;
[0198] The third input subunit is used to input the novel text into the behavior recognition model if the scene word recognition model fails to recognize a scene word in the novel text or the scene line recognition model determines that the novel text is not a scene line.
[0199] The first segmentation subunit is used to segment the novel text according to preset symbols if the behavior recognition model determines that the novel text is a behavior line, thereby obtaining behavior information.
[0200] Combination Figure 2 In some optional embodiments, the script construction unit 300, as shown in the implementation, includes: a first modification subunit, a second modification subunit, a third modification subunit, and a fourth modification subunit.
[0201] The first modification subunit is used to modify any segment of the novel text in the first original text block into a dialogue script if the speaker identifier is identified by logic A.
[0202] The second modification subunit is used to modify the novel text into a dialogue script according to the script format and the speaker identifier identified by the logic B if the logic A fails to identify the speaker identifier and the logic B identifies the speaker identifier.
[0203] The third modification subunit is used to modify the novel text into a scene script according to the script format and the scene information identified by the logic B if the logic B identifies scene information;
[0204] The fourth modification subunit is used to modify the novel text into an action script based on the script format and the action information identified by the logic B if the logic B identifies action information.
[0205] The present invention provides a computer-readable storage medium having a program stored thereon, which, when executed by a processor, implements the text conversion method described in any of the preceding claims.
[0206] like Figure 3 As shown, the present invention provides an electronic device 70, which includes at least one processor 701, at least one memory 702 and a bus 703 connected to the processor 701; wherein the processor 701 and the memory 702 communicate with each other through the bus 703; the processor 701 is used to call program instructions in the memory 702 to execute the text conversion method described above.
[0207] In this invention, relational terms such as "first" and "second" are used merely to distinguish one entity or operation from another, without necessarily requiring or implying any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes said element.
[0208] The various embodiments in this specification are described in a related manner. Similar or identical parts between embodiments can be referred to mutually. Each embodiment focuses on describing the differences from other embodiments. In particular, the system embodiments are basically similar to the method embodiments, so the description is relatively simple; relevant parts can be referred to the descriptions of the method embodiments.
[0209] The above description of the disclosed embodiments enables those skilled in the art to make or use the invention. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the general principles defined in this invention may be implemented in other embodiments without departing from the spirit or scope of the invention. Therefore, the invention is not to be limited to the embodiments shown herein, but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.
[0210] The above description is merely a preferred embodiment of the present invention and is not intended to limit the scope of protection of the present invention. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the present invention are included within the scope of protection of the present invention.
Claims
1. A text conversion method, characterized in that, include: Obtain the first original text block of the novel, wherein the first original text block comprises multiple segments of the novel text; For the first original text block, logic A and logic B are executed in parallel, wherein logic A includes step A100, and logic B includes steps B100, B200, B300, B400, and B500. In step A100, if there are N consecutive segments of novel text in the first original text block, each of which is enclosed in double quotes, then for the N consecutive segments of novel text, the pre-trained first model is used to identify the corresponding speaker identifier. In step B100, for any segment of the novel text in the first original text block, if the novel text carries speaker information, the speaker identifier corresponding to the novel text is identified based on the speaker information. In step B200, if the novel text does not carry speaker information, the novel text and the corresponding context are input into a pre-trained second model, and the speaker identification result of the second model for the novel text that does not carry speaker information is obtained. In step B300, if the recognition result is that no speaker identifier is recognized, the text line type of the corresponding novel text is determined, wherein the text line type includes dialogue lines without narration, dialogue lines with narration, and other lines. In step B400, if the text line type of the novel text is a dialogue line without narration or a dialogue line with narration, then the speaker identifier of the novel text is identified by executing the corresponding first identification logic. In step B500, if the text line type of the novel text is another line, then by executing the corresponding second recognition logic, the scene information or behavior information corresponding to the novel text is recognized. Based on the speaker identifiers, scene information, and behavior information identified by logic A and logic B, a script block corresponding to the first original text block is constructed. The step of constructing a script block corresponding to the first original text block based on the speaker identifiers, scene information, and behavior information identified by logic A and logic B includes: For any segment of the novel text in the first original text block, if logic A identifies a speaker identifier, then the novel text is modified into a dialogue script according to the script format and the speaker identifier identified by logic A. If logic A fails to identify the speaker identifier but logic B does, then the novel text is modified into a dialogue script based on the script format and the speaker identifier identified by logic B. If logic B identifies scene information, then the novel text is modified into a scene script based on the script format and the scene information identified by logic B. If logic B identifies behavioral information, then the novel text is modified into a behavioral script based on the script format and the behavioral information identified by logic B.
2. The method according to claim 1, characterized in that, Step B300 includes: If the identification result is that no speaker identifier is identified and the corresponding entire paragraph of the novel text is enclosed in double quotation marks, then the text line type of the novel text is determined to be a dialogue line without narration. If the recognition result is that no speaker identifier is recognized and the corresponding part of the novel text is enclosed in double quotes and the content enclosed in double quotes does not include preset keywords, then the text line type of the novel text is determined to be a dialogue line with narration. If the identification result is that no speaker identifier is identified and the corresponding novel text does not contain quotation marks, or if the identification result is that no speaker identifier is identified and the corresponding novel text is partially enclosed in quotation marks and the content enclosed in quotation marks includes preset keywords, then the text line type of the novel text is determined to be other lines.
3. The method according to claim 1, characterized in that, Step B400 includes: If the text line type of the novel text is the dialogue line without narration, then determine whether the previous and next paragraphs of the novel text are both enclosed in double quotation marks. If neither the preceding nor the following paragraph of the novel text is entirely enclosed in quotation marks, then the speaker identifier of the novel text is determined to be a preset identifier. If both the preceding and following paragraphs of the novel text are enclosed in quotation marks, then it is determined whether the preceding paragraph of the preceding novel text contains speaker information and whether the following paragraph of the following novel text contains speaker information. If the preceding paragraph of the novel text contains speaker information and / or the following paragraph of the novel text contains speaker information, then the speaker identifier of the novel text is determined based on the speaker information. If neither the preceding nor the following paragraph of the novel text contains speaker information, then the speaker identifier of the novel text is determined to be the preset identifier. If the text line type of the novel text is the dialogue line with narration, then the novel text is input into a pre-trained third model, and the speaker identification result of the third model for the novel text is obtained.
4. The method according to claim 3, characterized in that, If the preceding paragraph of the novel text carries speaker information and / or the following paragraph of the novel text carries speaker information, then determining the speaker identifier of the novel text based on the speaker information includes: If the preceding paragraph of the novel text contains speaker information, then the speaker identifier of the novel text is determined based on the speaker information contained in the preceding paragraph of the novel text. If the preceding paragraph of the novel text does not contain speaker information but the following paragraph does, then the speaker identifier of the novel text is determined based on the speaker information carried in the following paragraph.
5. The method according to claim 3, characterized in that, If the text line type of the novel text is the dialogue line with narration, then the novel text is input into a pre-trained third model, and the speaker identification result of the third model for the novel text is obtained, including: The novel text is then input into a pre-trained third model; If the third model identifies the corresponding speaker identifier, then the speaker identifier output by the third model is obtained; If the third model fails to identify the corresponding speaker identifier, then the speaker identifier of the novel text is determined to be the preset identifier.
6. The method according to claim 1, characterized in that, Step B500 includes: If the text line type of the novel text is one of the other lines, then the novel text is input into the scene line recognition model; If the scene line recognition model determines that the novel text is a scene line, then the scene words in the novel text are identified by the scene word recognition model; If the scene word recognition model recognizes a scene word in the novel text, then the scene word is obtained as scene information of the novel text; If the scene word recognition model fails to recognize a scene word in the novel text or the scene line recognition model determines that the novel text is not a scene line, then the novel text is input to the behavior recognition model; If the behavior recognition model determines that the novel text is a behavior line, then the novel text is segmented according to preset symbols to obtain behavior information.
7. A text conversion device, characterized in that, include: The unit consists of three components: raw text acquisition, text processing, and script construction. The original text acquisition unit is used to acquire a first original text block of the novel, wherein the first original text block includes multiple segments of novel text; The text processing unit is configured to execute logic A and logic B in parallel for the first original text block, wherein logic A includes step A100, and logic B includes steps B100, B200, B300, B400, and B500. In step A100, if there are N consecutive segments of novel text in the first original text block, each of which is enclosed in double quotes, then for the N consecutive segments of novel text, the pre-trained first model is used to identify the corresponding speaker identifier. In step B100, for any segment of the novel text in the first original text block, if the novel text carries speaker information, the speaker identifier corresponding to the novel text is identified based on the speaker information. In step B200, if the novel text does not carry speaker information, the novel text and the corresponding context are input into a pre-trained second model, and the speaker identification result of the second model for the novel text that does not carry speaker information is obtained. In step B300, if the recognition result is that no speaker identifier is recognized, the text line type of the corresponding novel text is determined, wherein the text line type includes dialogue lines without narration, dialogue lines with narration, and other lines. In step B400, if the text line type of the novel text is a dialogue line without narration or a dialogue line with narration, then the speaker identifier of the novel text is identified by executing the corresponding first identification logic. In step B500, if the text line type of the novel text is another line, then by executing the corresponding second recognition logic, the scene information or behavior information corresponding to the novel text is recognized. The script construction unit is used to construct a script block corresponding to the first original text block based on the speaker identifiers, scene information and behavior information identified by logic A and logic B. The script construction unit includes: a first modification subunit, a second modification subunit, a third modification subunit, and a fourth modification subunit; The first modification subunit is used to modify any segment of the novel text in the first original text block into a dialogue script if the speaker identifier is identified by logic A. The second modification subunit is used to modify the novel text into a dialogue script according to the script format and the speaker identifier identified by the logic B if the logic A fails to identify the speaker identifier and the logic B identifies the speaker identifier. The third modification subunit is used to modify the novel text into a scene script according to the script format and the scene information identified by the logic B if the logic B identifies scene information; The fourth modification subunit is used to modify the novel text into an action script based on the script format and the action information identified by the logic B if the logic B identifies action information.
8. A computer-readable storage medium having a program stored thereon, characterized in that, When the program is executed by the processor, it implements the text conversion method as described in any one of claims 1 to 6.
9. An electronic device, characterized in that, The electronic device includes at least one processor, and at least one memory and a bus connected to the processor; wherein the processor and the memory communicate with each other through the bus; the processor is used to call program instructions in the memory to execute the text conversion method as described in any one of claims 1 to 6.