Role analysis method and device, electronic equipment and storage medium

By performing block analysis and model input on the text in the script, combined with user feedback, the problem of low character characteristics analysis in casting of film and television actors is solved, and efficient and accurate character characteristics extraction is achieved.

CN119106678APending Publication Date: 2024-12-10BEIJING IQIYI TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411122941.2
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-08-15
Publication Date
2024-12-10

AI Technical Summary

Technical Problem

In casting of actors such as film and television dramas, the director team needs to read the characteristics of a large number of characters in the script for analysis, resulting in huge manual workload and subjective colors, which is inefficient.

Method used

By determining the roles to be analyzed in the target text, it is divided into multiple text blocks, and these text blocks are analyzed in sequence based on the predetermined model, and the feature information of the target role is determined based on the analysis results, and the feature information is corrected and the model is adjusted through user feedback.

Benefits of technology

It reduces the workload of manual reading and character feature analysis of long-term scripts, reduces the impact of subjective colors, improves the accuracy and efficiency of character feature analysis, and avoids the difficulty of processing the model when processing huge texts.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119106678A_ABST
    Figure CN119106678A_ABST
Patent Text Reader

Abstract

The invention discloses a role analysis method and device, electronic equipment and a storage medium, and belongs to the technical field of text processing. The method comprises the steps of determining a to-be-analyzed target role in a target text; dividing the target text into a plurality of text blocks; sequentially analyzing the plurality of text blocks based on a predetermined model; and determining feature information of the target role based on the analysis results corresponding to the plurality of text blocks. Thus, the character features in the text are analyzed through the model, the workload and subjective colors of confirming a large number of character features by manually reading the text are reduced, and the situation that processing cannot be carried out due to input models such as huge scripts can be avoided through sequential analysis after partitioning.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of text processing technology, and in particular to a role analysis method, device, electronic device and storage medium. Background Art

[0002] Currently, the casting of actors for film and television dramas often requires the director team to read the script and analyze and screen the characteristics of a large number of characters in the script, which generates a huge amount of manual work and is often subjective, which is a waste of time. Summary of the invention

[0003] The embodiments of the present application provide a character analysis method, device, electronic device and storage medium to solve the technical problem of low efficiency in analyzing the characteristics of characters in a script.

[0004] According to one aspect of an embodiment of the present application, a role analysis method is provided, including: determining a target role to be analyzed in a target text; dividing the target text into multiple text blocks; analyzing the multiple text blocks in sequence based on a predetermined model; and determining feature information of the target role based on analysis results corresponding to the multiple text blocks.

[0005] Furthermore, analyzing the multiple text blocks in sequence based on a predetermined model includes: inputting the multiple text blocks into the predetermined model in sequence for analysis according to arrangement positions of the multiple text blocks in the target text.

[0006] Further, in response to the current text block not being in the first position in the target text, the multiple text blocks are sequentially input into a predetermined model for analysis, including: obtaining a first analysis result output by the predetermined model based on a previous text block; and inputting the current text block and the first analysis result into the predetermined model for analysis to obtain a second analysis result.

[0007] Further, the determining of the characteristic information of the target character based on the analysis results corresponding to the multiple text blocks includes: obtaining multiple analysis results output by the predetermined model based on the multiple text blocks; the analysis results include at least: first characteristic information of the target character and confidence corresponding to the first characteristic information; based on the confidence, fusing multiple first characteristic information to obtain second characteristic information of the target character.

[0008] Furthermore, dividing the target text into a plurality of text blocks includes: determining at least one content node based on the content of the target text; and dividing the target text into a plurality of text blocks based on the content node.

[0009] Further, after determining the characteristic information of the target character based on the analysis results corresponding to the multiple text blocks, the method also includes: outputting the target character and the characteristic information; obtaining user feedback information regarding the characteristic information; correcting the characteristic information based on the feedback information, and / or adjusting the predetermined model based on the feedback information.

[0010] Furthermore, before determining the target role to be analyzed in the target text, the method further includes: constructing a training data set based on the training text and feature information of the role in the training text; and training the predetermined model based on the training data set.

[0011] According to another aspect of an embodiment of the present application, a role analysis device is also provided, including: a determination module for determining a target role to be analyzed in a target text; a division module for dividing the target text into multiple text blocks; an analysis module for analyzing the multiple text blocks in sequence based on a predetermined model; and a processing module for determining feature information of the target role based on analysis results corresponding to the multiple text blocks.

[0012] Furthermore, the analysis module is specifically used to: input the multiple text blocks into a predetermined model in sequence for analysis according to the arrangement positions of the multiple text blocks in the target text.

[0013] Furthermore, the analysis module is specifically used to: in response to the current text block not being in the first position in the target text, obtain a first analysis result output by the predetermined model based on a previous text block; input the current text block and the first analysis result into the predetermined model for analysis to obtain a second analysis result.

[0014] Furthermore, the processing module is specifically used to: obtain multiple analysis results output by the predetermined model based on the multiple text blocks; the analysis results include at least: first feature information of the target character and confidence corresponding to the first feature information; based on the confidence, multiple first feature information are fused to obtain second feature information of the target character.

[0015] Furthermore, the division module is specifically used to: determine at least one content node based on the content of the target text; and divide the target text into a plurality of text blocks based on the content node.

[0016] Furthermore, the processing module is also used to: after determining the characteristic information of the target character based on the analysis results corresponding to the multiple text blocks, output the target character and the characteristic information; obtain user feedback information regarding the characteristic information; correct the characteristic information based on the feedback information, and / or adjust the predetermined model based on the feedback information.

[0017] Furthermore, the processing module is also used to: before determining the target role to be analyzed in the target text, construct a training data set based on the training text and the feature information of the role in the training text; and train the predetermined model based on the training data set.

[0018] According to another aspect of an embodiment of the present application, a storage medium is further provided, which includes a stored program, and the steps in the above method are executed when the program is run.

[0019] According to another aspect of an embodiment of the present application, there is also provided an electronic device, including a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory communicate with each other via the communication bus; wherein: the memory is used to store computer programs; and the processor is used to execute the steps in the above method by running the program stored in the memory.

[0020] The embodiment of the present application also provides a computer program product including instructions, which, when executed on a computer, enables the computer to execute the steps in the above method.

[0021] The embodiments of the present application propose a method, device, electronic device and storage medium for character analysis. The method determines a target character to be analyzed in a target text; divides the target text into multiple text blocks; analyzes the multiple text blocks in sequence based on a predetermined model; and determines the characteristic information of the target character based on the analysis results corresponding to the multiple text blocks. In this way, for scripts with longer lengths and richer characters, there is no need to manually read the entire text and analyze the characteristics of the characters, which reduces the workload and the influence of subjective color. In addition, by inputting the text into blocks, the problem that the model cannot handle huge texts can be avoided. BRIEF DESCRIPTION OF THE DRAWINGS

[0022] The drawings described herein are used to provide a further understanding of the present application and constitute a part of the present application. The illustrative embodiments of the present application and their descriptions are used to explain the present application and do not constitute an improper limitation on the present application. In the drawings:

[0023] Figure 1 is a hardware structure block diagram of a computer according to an embodiment of the present application;

[0024] Figure 2 is a flow chart of a role analysis method according to an embodiment of the present application;

[0025] Figure 3 is a flow chart of a role analysis method according to an embodiment of the present application;

[0026] Figure 4 is a flow chart of a role analysis method according to an embodiment of the present application;

[0027] Figure 5 is a structural block diagram of a role analysis device according to an embodiment of the present application;

[0028] Figure 6 It is a structural diagram of an electronic device according to an embodiment of the present application. DETAILED DESCRIPTION

[0029] In order to enable those skilled in the art to better understand the present application, the technical solutions in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only embodiments of a part of the present application, not all embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in the field without creative work should fall within the scope of protection of the present application. It should be noted that the embodiments in the present application and the features in the embodiments can be combined with each other without conflict.

[0030] It should be noted that the terms "first", "second", etc. in the specification and claims of the present application and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchangeable where appropriate, so that the embodiments of the present application described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any of their variations are intended to cover non-exclusive inclusions, for example, a process, method, product or device comprising a series of steps or units is not necessarily limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.

[0031] The method embodiment provided in the first embodiment of the present application can be executed in a mobile phone, a computer, a tablet or a similar computing device. Taking running on a computer as an example, Figure 1 is a hardware structure block diagram of a computer in an embodiment of the present application. Figure 1 As shown, the computer may include one or more ( Figure 1 Only one is shown in the figure) a processor 102 (the processor 102 may include but is not limited to a processing device such as a microprocessor MCU or a programmable logic device FPGA) and a memory 104 for storing data. Optionally, the computer may also include a transmission device 106 and an input / output device 108 for communication functions. It can be understood by those skilled in the art that Figure 1 The structure shown is only for illustration and does not limit the structure of the above-mentioned computer. Figure 1 More or fewer components as shown, or with Figure 1 Different configurations are shown.

[0032] The memory 104 can be used to store computer programs, for example, software programs and modules of application software, such as a computer program corresponding to a role analysis method in an embodiment of the present application. The processor 102 executes various functional applications and data processing by running the computer program stored in the memory 104, that is, to implement the above method. The memory 104 may include a high-speed random access memory, and may also include a non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some instances, the memory 104 may further include a memory remotely arranged relative to the processor 102, and these remote memories may be connected to the computer 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.

[0033] The transmission device 106 is used to receive or send data via a network. The specific example of the above network may include a wireless network provided by a communication provider of the computer. In one example, the transmission device 106 includes a network adapter (Network Interface Controller, referred to as NIC), which can be connected to other network devices through a base station so as to communicate with the Internet. In one example, the transmission device 106 can be a radio frequency (RF) module, which is used to communicate with the Internet wirelessly.

[0034] In this embodiment, a role analysis method is provided. Figure 2 is a flow chart of a role analysis method according to an embodiment of the present application, such as Figure 2 As shown, the process includes the following steps:

[0035] S10: Determine the target role to be analyzed in the target text.

[0036] In this embodiment, the target text may be various types of texts to be analyzed, such as scripts, articles, novels, essays, chat contents, etc. The target text may contain at least one target character, which may include a person, an animal, or other types of characters.

[0037] In one embodiment, determining the target role to be analyzed in the target text may include: determining the target role to be analyzed based on the content of the target text, wherein the content of the target text may include but is not limited to at least one of the following: title, directory, and body.

[0038] In one embodiment, determining the target role to be analyzed in the target text may include: determining one or more target roles to be analyzed in the target text, such as the protagonist, the supporting role, and the passerby. Optionally, the determined target role may be recorded in a role list or a role database.

[0039] In one embodiment, determining the target role to be analyzed in the target text may include: determining the target role to be analyzed based on the subject and object forms and the frequency of occurrence in the content of the target text. For example, determining the role whose frequency of occurrence in the name as the subject and object form is greater than a preset value as the target role.

[0040] In one embodiment, step S10 may include: in response to the feature analysis instruction, determining in the target text a target role corresponding to the feature analysis instruction, for example, determining one or more target roles corresponding to the feature analysis instruction.

[0041] Here, the target role corresponding to the feature analysis instruction may refer to the target role whose features need to be analyzed as indicated by the feature analysis instruction.

[0042] S20: Divide the target text into a plurality of text blocks.

[0043] In one embodiment, dividing the target text into a plurality of text blocks may refer to dividing the target text into a plurality of text blocks according to the content of the target text. For example, the target text may be divided according to the content such as the directory, chapters or paragraphs, or the target text may be divided according to the content such as the directory, chapters or paragraphs and a preset word count threshold. Exemplarily, the target text may be divided into chapters according to combinations that do not exceed the preset word count threshold, with chapters 1 to 3 being the first text block, chapters 4 to 6 being the second text block, etc.

[0044] In one embodiment, dividing the target text into a plurality of text blocks may include: determining at least one content node based on the content of the target text; and dividing the target text into a plurality of text blocks based on the content node. Here, the content node may refer to a plot node determined according to the content, and the content and plot of the target text may be segmented based on the plot node.

[0045] In one embodiment, dividing the target text into a plurality of text blocks may include: dividing the target text into a plurality of text blocks based on the target text content corresponding to the target role. For example, at least one content node may be determined based on the content of the target text; and the target text may be divided into a plurality of text blocks based on the content node corresponding to the target role. In this way, the divided text blocks may have sufficient associations with different plots and roles, respectively, and the analysis results of each text block may also be more accurate.

[0046] In one embodiment, two adjacent text blocks may have a higher content relevance. For example, the content relevance may refer to plot relevance.

[0047] S30: Analyze multiple text blocks in sequence based on a predetermined model.

[0048] In one embodiment, analyzing multiple text blocks in sequence based on a predetermined model may refer to inputting the multiple text blocks obtained by division into the predetermined model in sequence, and the predetermined model may output analysis results corresponding to each text block in sequence.

[0049] In one embodiment, analyzing the plurality of text blocks sequentially based on a predetermined model may include: inputting the plurality of text blocks sequentially into the predetermined model for analysis according to the arrangement positions of the plurality of text blocks in the target text. Here, the arrangement positions may represent the order of the plurality of text blocks in the target text.

[0050] In one embodiment, the multiple text blocks are sequentially input into a predetermined model for analysis according to their arrangement positions in the target text, which may refer to sequentially inputting the multiple text blocks into a predetermined model for analysis from front to back in the order corresponding to the arrangement positions.

[0051] In one embodiment, the multiple text blocks are sequentially input into a predetermined model for analysis according to their arrangement positions in the target text, which may include: for a text block that is in the first arrangement position, the text block is input into a predetermined model for analysis, and an analysis result is obtained; for a text block that is not in the first arrangement position, the text block and the analysis result of the previous text block are input into a predetermined model for analysis.

[0052] For example, the text block n1 that is in the first arrangement position is input into the predetermined model to obtain the analysis result m1; the text block n2 that is in the second arrangement position is input into the predetermined model together with m1 to obtain the analysis result m2; the text block n3 that is in the third arrangement position is input into the predetermined model together with m2 to obtain the analysis result m3... and so on.

[0053] In one embodiment, analyzing the multiple text blocks in sequence based on a predetermined model may include: analyzing at least one text block associated with the target role in sequence based on the predetermined model. For example, analyzing at least one text block related to a content node corresponding to the target role in sequence based on the predetermined model. Here, the at least one text block related to a content node corresponding to the target role may refer to text blocks connected to and from the content node corresponding to the target role.

[0054] In one embodiment, at least one target text block associated with the target role is determined; and according to the arrangement position of the target text block in the target text, the at least one target text block is sequentially input into a predetermined model for analysis.

[0055] In one embodiment, multiple text blocks are analyzed sequentially based on a predetermined model, and the analysis results obtained from analyzing each text block may include first feature information of a target character determined based on the text block. Correspondingly, determining the feature information of the target character based on the analysis results corresponding to the multiple text blocks may refer to fusing multiple first feature information corresponding to the multiple text blocks to obtain the feature information of the target character.

[0056] In one embodiment, the first characteristic information may include at least one of the target character's personality, gender, nationality, appearance, age, identity, occupation, etc. Correspondingly, the second characteristic information may also include at least one of the target character's personality, gender, nationality, appearance, age, identity, occupation, etc.

[0057] In one embodiment, the multiple text blocks are analyzed sequentially based on a predetermined model, wherein the multiple text blocks can be sequentially input into the predetermined model for analysis according to their arrangement positions in the target text, and one or more text blocks can be input each time.

[0058] For example, the number of text blocks input each time can be determined based on the number of words in the text block, the content relevance, and the maximum number of words allowed by the model, thereby reducing the number of model analyses and further improving analysis efficiency without affecting content continuity.

[0059] In one embodiment, when the text block does not contain content related to the target role, the analysis result output based on the text block may be a null value. When multiple text blocks are input to the predetermined model at one time, the output analysis result may correspond to multiple text blocks.

[0060] S40: Determine feature information of the target character based on analysis results corresponding to the multiple text blocks.

[0061] In one embodiment, each text block may correspond to one analysis result, or multiple text blocks may correspond to one analysis result. The analysis result may include first feature information of the target role determined based on the one or more text blocks, and may also include confidence corresponding to the first feature information.

[0062] In one embodiment, determining the characteristic information of the target character based on the analysis results corresponding to the multiple text blocks may include fusing the multiple analysis results corresponding to the multiple text blocks to obtain the characteristic information of the target character. For example, fusing the multiple first characteristic information corresponding to the multiple text blocks to obtain the second characteristic information of the target character.

[0063] In one embodiment, based on the confidence corresponding to the first feature information, multiple first feature information corresponding to multiple text blocks are fused to obtain the second feature information of the target character. For example, the weight of the first feature information is determined based on the confidence, and the multiple first feature information corresponding to the multiple text blocks are weighted based on the weight to obtain the second feature information of the target character.

[0064] In one embodiment, based on the confidence corresponding to the first feature information, multiple first feature information corresponding to multiple text blocks are fused to obtain the second feature information of the target character, which may refer to selecting the first feature information with the highest confidence as the second feature information of the target character.

[0065] For example, the first feature information corresponding to text block n1 indicates that the character is male with a gentle personality, and the confidence is 10; the first feature information corresponding to text block n2 indicates that the character is female with a violent personality, and the confidence is 1. Based on the confidence fusion, it can be determined that the second feature information of the character is male with a gentle personality.

[0066] In one embodiment, when the first feature information includes multiple features, the confidence corresponding to the first feature information may include a sub-confidence corresponding to each feature. Based on the confidence corresponding to the first feature information, multiple first feature information corresponding to multiple text blocks are merged to obtain the second feature information of the target character, which may include: based on the sub-confidence corresponding to each feature in the first feature information, multiple first feature information corresponding to multiple text blocks are merged to obtain the second feature information of the target character.

[0067] For example, it may refer to determining the feature with the highest sub-confidence as the target feature based on the sub-confidence corresponding to each feature in the first feature information, and combining multiple target features into the second feature information.

[0068] For example, the first feature information corresponding to text block n1 includes: gender male, sub-confidence of 10; age 25, sub-confidence of 3; gentle personality, sub-confidence of 20. The first feature information corresponding to text block n2 includes: gender female, sub-confidence of 40; age 35, sub-confidence of 10; violent personality, sub-confidence of 1. After fusing the first feature information based on confidence, the second feature information of the target character can be determined as: gender female, age 35, gentle personality.

[0069] In this way, when character analysis is needed for a long script with rich characters, there is no need to manually read the entire text and analyze the character characteristics, which reduces the workload and the influence of subjective color. In addition, by inputting the text into the model in blocks, the problem of the model being unable to handle huge texts can be avoided.

[0070] In some embodiments, step S30 may include:

[0071] According to the arrangement positions of the multiple text blocks in the target text, the multiple text blocks are sequentially input into a predetermined model for analysis. Here, the arrangement position may represent the order of the multiple text blocks in the target text.

[0072] In one embodiment, the multiple text blocks are sequentially input into a predetermined model for analysis according to their arrangement positions in the target text, which may refer to sequentially inputting the multiple text blocks into a predetermined model for analysis from front to back in the order corresponding to the arrangement positions.

[0073] In one embodiment, in response to the current text block not being arranged in the first position in the target text, sequentially inputting the multiple text blocks into a predetermined model for analysis includes:

[0074] Obtaining a first analysis result output by the predetermined model based on a previous text block;

[0075] The current text block and the first analysis result are input into the predetermined model for analysis to obtain a second analysis result.

[0076] Here, the previous text block is a previous text block whose arrangement position is adjacent to the current text block. For example, if the current text block is arranged in the third position, the previous text block is arranged in the second position.

[0077] For example, for a text block that is arranged in the first position, the text block is input into a predetermined model for analysis and the analysis result is obtained; for a text block that is not arranged in the first position, the analysis result of the text block and the previous text block are input into the predetermined model for analysis.

[0078] For example, the text block n1 that is in the first arrangement position is input into the predetermined model to obtain the analysis result m1; the text block n2 that is in the second arrangement position is input into the predetermined model together with m1 to obtain the analysis result m2; the text block n3 that is in the third arrangement position is input into the predetermined model together with m2 to obtain the analysis result m3... and so on.

[0079] In this way, by jointly inputting the analysis results of the current text block and the previous text block, the context content is comprehensively considered when analyzing the features, avoiding the large model from obtaining locally contradictory results on different text blocks, and improving the accuracy of feature analysis.

[0080] In one embodiment, inputting the multiple text blocks into a predetermined model for analysis in sequence according to their arrangement positions in the target text may include: determining at least one target text block associated with a target role; and inputting at least one target text block into a predetermined model for analysis in sequence according to their arrangement positions in the target text.

[0081] In one embodiment, the multiple text blocks are sequentially input into a predetermined model for analysis according to their arrangement positions in the target text, wherein one or more text blocks may be input each time.

[0082] For example, the number of text blocks input each time can be determined based on the number of words in the text block, the content relevance, and the maximum number of words allowed by the model, thereby reducing the number of model analyses and further improving analysis efficiency without affecting content continuity.

[0083] In this way, by inputting the divided text in sequence for analysis, we can avoid the model being unable to process long texts of huge lengths at one time. We can also take the context into consideration when analyzing features based on the joint input of the text block and the analysis results of the previous text block, thereby avoiding the large model from obtaining partially contradictory results on different text blocks, and further improving the accuracy of feature analysis.

[0084] In some embodiments, the step S40 may include:

[0085] Acquire multiple analysis results output by the predetermined model based on the multiple text blocks; the analysis results at least include: first feature information of the target character and confidence level corresponding to the first feature information;

[0086] Based on the confidence level, multiple pieces of the first feature information are fused to obtain second feature information of the target character.

[0087] In one embodiment, fusing multiple first feature information based on the confidence to obtain the second feature information of the target character may include: determining the weight of the first feature information based on the confidence, and performing weighted calculation on multiple first feature information corresponding to multiple text blocks based on the weight to obtain the second feature information of the target character.

[0088] In one embodiment, fusing multiple first feature information based on the confidence to obtain the second feature information of the target character may refer to selecting the first feature information with the highest confidence as the second feature information of the target character.

[0089] In one embodiment, when the first feature information includes multiple features, the confidence corresponding to the first feature information may include a sub-confidence corresponding to each feature. Then, fusing multiple first feature information based on the confidence to obtain the second feature information of the target character may include: fusing multiple first feature information corresponding to multiple text blocks based on the sub-confidence corresponding to each feature in the first feature information to obtain the second feature information of the target character.

[0090] For example, it may refer to determining the feature with the highest sub-confidence as the target feature based on the sub-confidence corresponding to each feature in the first feature information, and combining multiple target features into the second feature information.

[0091] In this way, after the corresponding analysis results are output based on each text block, the confidence level can be combined to more accurately measure the accuracy of the character feature information determined by the content of each text block, so that the fused feature information can be more accurate.

[0092] In some embodiments, step S20 may include:

[0093] Determine at least one content node based on the content of the target text;

[0094] The target text is divided into a plurality of text blocks based on the content nodes.

[0095] Here, the content node may represent a plot change point of the text content, for example, it may be a plot node determined according to the content, and the content and plot of the target text may be segmented based on the plot node.

[0096] In one embodiment, determining at least one content node based on the content of the target text may include: determining at least one content node based on the content of the target text and the received division instruction. The division instruction may indicate one or more target nodes determined by the user. Based on the target node, a corresponding content node may be determined. For example, the target node may represent a node of the overall content architecture determined by the user, and a content node representing the plot of the chapter content may be determined based on the target node.

[0097] In one embodiment, dividing the target text into a plurality of text blocks may include: dividing the target text into a plurality of text blocks based on the target text content corresponding to the target role. For example, at least one content node may be determined based on the content of the target text; and dividing the target text into a plurality of text blocks based on the content node corresponding to the target role.

[0098] In this way, the divided text blocks can have sufficient relevance to different plots and characters respectively, and the feature analysis results based on each text block can also be more accurate.

[0099] In this embodiment, a role analysis method is provided. Figure 3 is a flow chart of a role analysis method according to an embodiment of the present application, such as Figure 3 As shown, the process includes the following steps:

[0100] S11: Determine the target role to be analyzed in the target text;

[0101] S21: dividing the target text into multiple text blocks;

[0102] S31: analyzing multiple text blocks in sequence based on a predetermined model;

[0103] S41: determining feature information of the target character based on analysis results corresponding to the plurality of text blocks;

[0104] S51: Output the target role and feature information;

[0105] S61: Obtaining user feedback information regarding feature information;

[0106] S71: Modify the feature information based on the feedback information, and / or adjust the predetermined model based on the feedback information.

[0107] In this embodiment, the specific implementation methods and related embodiments of steps S11-S41 can refer to the specific implementation methods and related embodiments of the aforementioned steps S10-S40, which will not be repeated here.

[0108] In one embodiment, step S51 may include: outputting the target role and feature information on a display interface. The feature information may be second feature information determined based on the analysis result. The display interface may be a display interface for a user to input a target text, etc.

[0109] In one embodiment, step S51 may further include: outputting the target role and feature information, and outputting prompt information on whether to confirm or modify.

[0110] In one embodiment, the user's feedback information on the feature information may include confirmation information on the feature information, or modification information on the feature information. For example, the confirmation information may indicate that the user agrees with the feature information, and the modification information may indicate the content of the user's modification to the feature information.

[0111] In one embodiment, when the feedback information is the above-mentioned modification information, the feature information can be modified based on the feedback information, and / or the predetermined model can be adjusted based on the feedback information. For example, the modification information can include the feature information modified by the user. The feedback information is input into the predetermined model, or the predetermined model is trained based on the feedback information to adjust the predetermined model.

[0112] Exemplarily, the feature information modified by the user indicated by the feedback information and the target text are used as training data to train a predetermined model.

[0113] In this way, the feedback mechanism allows users to correct and provide feedback on the analysis results of the model to further improve the accuracy of judgment of role characteristics and continuously optimize the accuracy and reliability of the model.

[0114] In some embodiments, before step S10 or step S11, the method may further include:

[0115] Constructing a training data set based on the training text and the feature information of the characters in the training text;

[0116] The predetermined model is trained based on the training data set.

[0117] In one embodiment, constructing the training data set may include sequentially constructing multiple training sub-data sets for multiple features included in the feature information, and training the predetermined model based on each training sub-data set. The training text may be one or more text blocks, or the entire text.

[0118] For example, taking gender features as an example, the gender features of a specific character in a training text are annotated to obtain a training data set and train a large language model. Specifically, the following may be included:

[0119] Build the system instruction system_prompt: indicates the task that needs to be completed by the large language model; build the text instruction question_prompt, which contains the text content to be analyzed; build the output instruction summary:groundtruth, which indicates the result you want the model to output. Use system_prompt, question_prompt, and summary to build training data pairs and fine-tune the large language model. The predetermined model, i.e. the base model, can use a self-trained or open-source large language model. The fine-tuned predetermined model has the ability to analyze and determine the gender of the target person in a specific text content.

[0120] Similarly, the predetermined models can be trained sequentially based on the multiple features that need to be analyzed.

[0121] In one embodiment, the training of the predetermined model can adopt a lightweight fine-tuning (Low-Rank Adaptation, Lora) method to train a Lora model for each feature. In the analysis stage, we adopt the method of dynamically loading the Lora model. For example, the predetermined model can include multiple Lora models corresponding to multiple features. Analyzing the multiple text blocks in sequence based on the predetermined model can include: inputting the multiple text blocks into the multiple Lora models corresponding to the multiple features in sequence to obtain the analysis results. This can greatly reduce the amount of resources occupied.

[0122] In this way, by training the predetermined model based on the training text and the characteristic information of the characters in the training text, a predetermined model with characteristic analysis capability can be obtained, thereby improving the accuracy of characteristic analysis of the target character.

[0123] As a possible implementation method, a script character analysis method is provided. The main idea is: by fine-tuning the large language model, the large language model has the ability to extract the character's gender, personality, appearance, age, identity skills and personality characteristics.

[0124] However, since the trained large model is limited by the length of the context and the script being processed is very long, it is not possible to directly use the large model to analyze the entire script.

[0125] Therefore, the script content is first intelligently divided into blocks to maintain the continuity of the plot in each block. Then the divided text blocks are sent to the large model for analysis. In this step, the analysis results of the above text need to be sent to the large model together, so that the large model can use contextual information to improve the accuracy of the analysis results. After that, the results of each block are fused to extract the final attribute characteristics of each dimension of the character. A user feedback mechanism is introduced at the application level to allow users to correct and feedback the analysis results of the model to continuously optimize the accuracy and reliability of the model.

[0126] As a possible implementation method, a script role analysis method is provided, and the main steps are as follows:

[0127] 1. Model training:

[0128] For example, the large language model is trained for the six attributes of gender, personality, appearance, age, identity skills and personality characteristics. The following takes gender as an example to illustrate the specific training process.

[0129] Gender data labeling, labeling target: given the script content of a specific segment, label the gender of the target character in the script segment.

[0130] Build system instructions system_prompt: Clearly state the tasks that require a large language model to complete.

[0131] Construct question_prompt: the script content to be analyzed.

[0132] Construct summary: groundtruth, which is the result you want the model to output.

[0133] Use system_prompt, question_prompt, and summary to build training data pairs and fine-tune the large language model. The base model can use a self-trained or open-source large language model. The fine-tuned gender large language model has the ability to extract the gender of the target character in a specific script content.

[0134] As above, train the large language model of the five attributes in sequence.

[0135] The Lora method can also be used to train large models. A Lora model is trained for each attribute, and the Lora method is dynamically loaded during the inference phase, which can greatly reduce resource usage.

[0136] 2. Analysis process

[0137] Since the training model is limited by the length of the context, the entire script cannot be sent to the model at the same time. Even if the script can be sent to the long character (token) model, the extraction effect will be greatly reduced. Therefore, the script is processed by intelligent segmentation. Figure 4 As shown, the analysis process is as follows:

[0138] Extract the script role list based on the script content. The role list is the role that needs to be extracted from the attributes.

[0139] The script text is divided into blocks according to the plot points. The division method adopted is to divide according to the plot points, and the continuity of the plot must be ensured in each block, so that the accuracy of subsequent attribute extraction is higher.

[0140] For each script block, extract the character, gender, appearance, age, identity, occupation, and personality characteristics of a specific role. The analysis result result_previous of the previous script and the content of the current script need to be sent to the big model at the same time, so that the big model can refer to the results of the previous script block for comprehensive analysis while using the current script content, taking into account the context information. Avoid the big model from obtaining locally contradictory results on different text blocks. In this step, the confidence of the current result should also be output to measure the accuracy of the current information extraction.

[0141] Summarize and fuse the extraction results of each text block. The results extracted from different text blocks are fused and summarized. When summarizing, the results and confidence of the block extraction should be comprehensively considered, and a comprehensive result is given by the big model.

[0142] During the application process, an interactive feedback mechanism and a user feedback mechanism are introduced to allow users to correct and provide feedback on the analysis results of the model in order to continuously optimize the accuracy and reliability of the model.

[0143] Through the description of the above implementation methods, those skilled in the art can clearly understand that the method according to the above embodiment can be implemented by means of software plus a necessary general hardware platform, and of course can also be implemented by hardware, but in many cases the former is a better implementation method. Based on such an understanding, the technical solution of the present invention, or the part that contributes to the prior art, can be embodied in the form of a software product, which is stored in a storage medium (such as ROM / RAM, a magnetic disk, or an optical disk), and includes a number of instructions for enabling a terminal device (which can be a mobile phone, a computer, a server, or a network device, etc.) to execute the methods described in each embodiment of the present invention.

[0144] In this embodiment, a role analysis device is also provided to implement the above-mentioned embodiments and preferred implementation modes, which have been described and will not be repeated here. As used below, the term "module" can be a combination of software and / or hardware that implements a predetermined function. Although the devices described in the following embodiments are preferably implemented in software, the implementation of hardware, or a combination of software and hardware, is also possible and conceivable.

[0145] Figure 5 is a structural block diagram of a role analysis device according to an embodiment of the present application, such as Figure 5 As shown, the device includes: a determination module 100, used to determine a target role to be analyzed in a target text; a division module 200, used to divide the target text into multiple text blocks; an analysis module 300, used to analyze the multiple text blocks in sequence based on a predetermined model; and a processing module 400, used to determine feature information of the target role based on analysis results corresponding to the multiple text blocks.

[0146] Furthermore, the analysis module 300 is specifically used to: input the multiple text blocks into a predetermined model in sequence for analysis according to the arrangement positions of the multiple text blocks in the target text.

[0147] Furthermore, the analysis module 300 is specifically used to: in response to the current text block not being in the first position in the target text, obtain a first analysis result output by the predetermined model based on a previous text block; input the current text block and the first analysis result into the predetermined model for analysis to obtain a second analysis result.

[0148] Furthermore, the processing module 400 is specifically used to: obtain multiple analysis results output by the predetermined model based on the multiple text blocks; the analysis results include at least: first feature information of the target character and confidence corresponding to the first feature information; based on the confidence, multiple first feature information are fused to obtain second feature information of the target character.

[0149] Furthermore, the division module 200 is specifically used to: determine at least one content node based on the content of the target text; and divide the target text into a plurality of text blocks based on the content node.

[0150] Furthermore, the processing module 400 is also used to: after determining the characteristic information of the target character based on the analysis results corresponding to the multiple text blocks, output the target character and the characteristic information; obtain user feedback information regarding the characteristic information; correct the characteristic information based on the feedback information, and / or adjust the predetermined model based on the feedback information.

[0151] Furthermore, the processing module 400 is also used to: before determining the target role to be analyzed in the target text, construct a training data set based on the training text and the feature information of the role in the training text; and train the predetermined model based on the training data set.

[0152] It should be noted that the above modules can be implemented by software or hardware. For the latter, it can be implemented in the following ways, but not limited to: the above modules are all located in the same processor; or the above modules are located in different processors in any combination.

[0153] The embodiment of the present application also provides an electronic device, Figure 6 is a structural diagram of an electronic device according to an embodiment of the present application, such as Figure 6 As shown, it includes a processor 41, a communication interface 42, a memory 43 and a communication bus 44, wherein the processor 41, the communication interface 42 and the memory 43 communicate with each other through the communication bus 44, and the memory 43 is used to store computer programs; the processor 41 is used to execute the program stored in the memory 43 to implement the following steps: determine the target role to be analyzed in the target text; divide the target text into multiple text blocks; analyze the multiple text blocks in sequence based on a predetermined model; and determine the characteristic information of the target role based on the analysis results corresponding to the multiple text blocks.

[0154] Furthermore, analyzing the multiple text blocks in sequence based on a predetermined model includes: inputting the multiple text blocks into the predetermined model in sequence for analysis according to arrangement positions of the multiple text blocks in the target text.

[0155] Further, in response to the current text block not being in the first position in the target text, the multiple text blocks are sequentially input into a predetermined model for analysis, including: obtaining a first analysis result output by the predetermined model based on a previous text block; and inputting the current text block and the first analysis result into the predetermined model for analysis to obtain a second analysis result.

[0156] Further, the determining of the characteristic information of the target character based on the analysis results corresponding to the multiple text blocks includes: obtaining multiple analysis results output by the predetermined model based on the multiple text blocks; the analysis results include at least: first characteristic information of the target character and confidence corresponding to the first characteristic information; based on the confidence, fusing multiple first characteristic information to obtain second characteristic information of the target character.

[0157] Furthermore, dividing the target text into a plurality of text blocks includes: determining at least one content node based on the content of the target text; and dividing the target text into a plurality of text blocks based on the content node.

[0158] Further, after determining the characteristic information of the target character based on the analysis results corresponding to the multiple text blocks, the method also includes: outputting the target character and the characteristic information; obtaining user feedback information regarding the characteristic information; correcting the characteristic information based on the feedback information, and / or adjusting the predetermined model based on the feedback information.

[0159] Furthermore, before determining the target role to be analyzed in the target text, the method further includes: constructing a training data set based on the training text and feature information of the role in the training text; and training the predetermined model based on the training data set.

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

[0161] The communication interface is used for communication between the above terminal and other devices.

[0162] The memory may include a random access memory (RAM) or a non-volatile memory, such as at least one disk memory. Optionally, the memory may also be at least one storage device located away from the aforementioned processor.

[0163] The above-mentioned processor can be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; it can also be a digital signal processor (DSP), an application specific integrated circuit (ASIC), a field programmable gate array (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components.

[0164] In another embodiment provided in the present application, a computer-readable storage medium is provided, in which instructions are stored. When the computer-readable storage medium is run on a computer, the computer executes the role analysis method described in any one of the above embodiments.

[0165] In another embodiment provided by the present application, a computer program product including instructions is also provided, which, when executed on a computer, enables the computer to execute the role analysis method described in any one of the above embodiments.

[0166] In the above embodiments, it can be implemented in whole or in part by software, hardware, firmware or any combination thereof. When implemented using software, it can be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, the process or function described in the embodiment of the present application is generated in whole or in part. The computer may be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions may be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium, for example, the computer instructions may be transmitted from a website site, computer, server or data center by wired (e.g., coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) mode to another website site, computer, server or data center. The computer-readable storage medium may be any available medium that a computer can access or a data storage device such as a server or data center that includes one or more available media integrated. The available medium may be a magnetic medium, (e.g., a floppy disk, a hard disk, a tape), an optical medium (e.g., a DVD), or a semiconductor medium (e.g., a solid-state drive Solid State Disk (SSD)), etc.

[0167] The above description is only a preferred embodiment of the present application and is not intended to limit the protection scope of the present application. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application are included in the protection scope of the present application.

[0168] The above description is only a specific implementation of the present application, so that those skilled in the art can understand or implement the present application. Various modifications to these embodiments will be apparent to those skilled in the art, and the general principles defined herein can be implemented in other embodiments without departing from the spirit or scope of the present application. Therefore, the present application will not be limited to the embodiments shown herein, but will conform to the widest range consistent with the principles and novel features applied for herein.

Claims

1. A role analysis method, It is characterized in that include: Identify the target characters to be analyzed in the target text; Dividing the target text into a plurality of text blocks; Analyze the multiple text blocks in sequence based on a predetermined model; The characteristic information of the target character is determined based on the analysis results corresponding to the multiple text blocks.

2. The role analysis method according to claim 1, It is characterized in that The analyzing the plurality of text blocks in sequence based on a predetermined model comprises: According to the arrangement positions of the multiple text blocks in the target text, the multiple text blocks are sequentially input into a predetermined model for analysis.

3. The role analysis method according to claim 2, It is characterized in that In response to the current text block not being arranged in the first position in the target text, the step of sequentially inputting the plurality of text blocks into a predetermined model for analysis includes: Obtaining a first analysis result output by the predetermined model based on a previous text block; The current text block and the first analysis result are input into the predetermined model for analysis to obtain a second analysis result.

4. The role analysis method according to any one of claims 1 to 3, It is characterized in that The determining the characteristic information of the target character based on the analysis results corresponding to the multiple text blocks includes: Acquire multiple analysis results output by the predetermined model based on the multiple text blocks; the analysis results at least include: first feature information of the target character and confidence level corresponding to the first feature information; Based on the confidence level, multiple pieces of the first feature information are fused to obtain second feature information of the target character.

5. The role analysis method according to claim 1, It is characterized in that The step of dividing the target text into a plurality of text blocks comprises: Determine at least one content node based on the content of the target text; The target text is divided into a plurality of text blocks based on the content nodes.

6. The role analysis method according to claim 1, It is characterized in that After determining the characteristic information of the target character based on the analysis results corresponding to the multiple text blocks, the method further includes: Outputting the target role and the feature information; Obtaining user feedback information regarding the feature information; The feature information is modified based on the feedback information, and / or the predetermined model is adjusted based on the feedback information.

7. The role analysis method according to claim 1, It is characterized in that Before determining the target role to be analyzed in the target text, the method further includes: Constructing a training data set based on the training text and the feature information of the characters in the training text; The predetermined model is trained based on the training data set.

8. A role analysis device, It is characterized in that include: A determination module, used to determine the target role to be analyzed in the target text; A division module, used for dividing the target text into a plurality of text blocks; An analysis module, configured to analyze the plurality of text blocks in sequence based on a predetermined model; A processing module is used to determine the characteristic information of the target character based on the analysis results corresponding to the multiple text blocks.

9. An electronic device, It is characterized in that The electronic device includes a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the computer program implements the steps of the role analysis method according to any one of claims 1 to 7 when executed by the processor.

10. A storage medium, It is characterized in that The storage medium stores a computer program, which, when executed by a processor, implements the steps of the role analysis method according to any one of claims 1 to 7.