Method for processing narrative text data, program product, and electronic device

By constructing a target personality detection model and using behaviors, comments and language texts to extract the personality characteristics of characters in narrative texts, the problem of insufficient accuracy in character recognition in narrative texts in the existing technology is solved, and the accuracy of narrative text data processing is improved. sex.

CN118734859APending Publication Date: 2024-10-01NANJING UNIV
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410716822.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-06-04
Publication Date
2024-10-01

AI Technical Summary

Technical Problem

It is difficult to accurately identify characters' personalities in narrative texts with the existing technology, resulting in insufficient accuracy in narrative text data processing.

Method used

By obtaining a model framework based on reference text data training, behavioral texts, comment texts and language texts are extracted to build a target personality detection model. Using supervised training and semantic space distance calculation, the character's scores on each dimension of personality are output to represent personality characteristics.

Benefits of technology

It improves the accuracy of narrative text data processing, can accurately output the personality characteristics of characters, and enhances the understanding of character behavior, comments and language in narrative texts.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118734859A_ABST
    Figure CN118734859A_ABST
Patent Text Reader

Abstract

The invention discloses a narrative text data processing method, a program product and electronic equipment, and the method comprises the steps: obtaining a target personality detection model obtained by training a pre-constructed model framework based on reference text data, the reference text data being a text of a predetermined text type associated with a reference character, the predetermined text type comprises at least one of a behavior text, a comment text and a language text; obtaining a target narrative text, and extracting a text of the predetermined text type associated with a target person from the target narrative text; and inputting a text of the predetermined text type associated with the target person into the target personality detection model, so that the target personality detection model outputs personality scores of the target person on the personalities of all dimensions, and the personality scores are used for representing personality features of the target person on the personalities of the corresponding dimensions. According to the technical scheme, the accuracy of narrative text data processing can be improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application belongs to the technical field of computer and text data processing, and in particular, relates to a narrative text data processing method, program product and electronic device. Background Art

[0002] Narrative texts in the humanities are based on characters and events, with strong structural integrity and plot coherence. Narrative texts can usually record and reflect the cultural and historical phenomena of contemporary society, and therefore have strong exploration value and analyzability. Their natural form provides an excellent soil for the intervention and growth of digital humanities. Under the traditional research paradigm of the humanities, the personality and emotions of characters in narrative texts have always been an important part of the appreciation of works.

[0003] At present, the introduction of digital technology in narrative texts is still in its infancy, and the processing of narrative text data is still immature. With the development of artificial intelligence, how to use artificial intelligence to identify the personality of characters in narrative texts and improve the accuracy of narrative text data processing is a technical problem that needs to be solved urgently. Summary of the invention

[0004] The embodiments of the present application provide a narrative text data processing method, a program product, and an electronic device, thereby improving the accuracy of narrative text data processing.

[0005] Other features and advantages of the present application will become apparent from the following detailed description, or may be learned in part by the practice of the present application.

[0006] According to a first aspect of an embodiment of the present application, a narrative text data processing method is provided, the method comprising: obtaining a target personality detection model obtained by training a pre-constructed model framework based on reference text data, the reference text data being text of a predetermined text type associated with a reference character, the predetermined text type comprising at least one of a behavioral text, a commentary text, and a language text; obtaining a target narrative text, and extracting text of the predetermined text type associated with a target character from the target narrative text; inputting the text of the predetermined text type associated with the target character into the target personality detection model, so that the target personality detection model outputs a personality score of the target character in each dimension of personality, the personality score being used to characterize the personality characteristics of the target character in the corresponding dimension of personality.

[0007] In some embodiments of the present application, based on the aforementioned scheme, the method of obtaining a target personality detection model obtained by training a pre-constructed model framework based on reference text data includes: obtaining a reference narrative text, and extracting behavioral texts, commentary texts, and language texts associated with each reference character from the reference narrative text; selecting texts of at least one type of text from the behavioral texts, commentary texts, and language texts associated with each reference character in different collection forms to obtain text collections of each reference character in different collection forms; obtaining personality scores of each reference character in each dimension of personality in the reference narrative text as reference personality scores; for each collection form, based on the text collections of each reference character in each collection form and the reference personality scores of each reference character, performing supervised training on the pre-constructed model framework to obtain personality detection models corresponding to different collection forms; and selecting a personality detection model from the personality detection models corresponding to the different collection forms as the target personality detection model.

[0008] In some embodiments of the present application, based on the aforementioned scheme, obtaining the personality score of each reference character in the reference narrative text in each dimension of personality includes: obtaining the personality description text of each reference character in the reference narrative text as the reference personality description text; obtaining the personality description label text at two extremes of each dimension of personality; calculating the semantic space distance between the reference personality description text and the personality description label text, and determining the personality score of each reference character in the reference narrative text in each dimension of personality based on the semantic space distance.

[0009] In some embodiments of the present application, based on the aforementioned scheme, the supervised training of the pre-constructed model framework based on the text collection of each reference character in each set form and the reference personality score of each reference character includes: determining a reference character who does not participate in the model training in the reference narrative text as a target reference character; inputting the text collection of the target reference character in each set form into the pre-constructed model framework so that the model framework learns the personality characteristics of the target reference character and outputs the personality score of the target reference character; based on the error between the output personality score of the target reference character and the reference personality score of the target reference character, reversely adjusting the model parameters in the model framework to update the model framework; returning to execute the step of determining a reference character who does not participate in the model training in the reference narrative text until a preset condition is met to obtain a personality detection model corresponding to each set form.

[0010] In some embodiments of the present application, based on the aforementioned scheme, selecting a personality detection model from the personality detection models corresponding to the different set forms as a target personality detection model includes: obtaining a learning error of the personality detection model corresponding to each set form during a training process; and selecting a personality detection model having the smallest learning error from the personality detection models corresponding to the different set forms as the target personality detection model.

[0011] In some embodiments of the present application, based on the aforementioned scheme, the predetermined text types include behavioral text, commentary text, and language text.

[0012] According to a second aspect of an embodiment of the present application, a narrative text data processing method is provided, the method comprising: obtaining a first narrative text; taking the first narrative text as the target narrative text as described in the first aspect above, taking each character in the first narrative text as the target character as described in the first aspect above, and determining the personality score of each character in the first narrative text in each dimension of personality by executing the method as described in the first aspect above; and determining the personality difference data between the characters based on the personality score of each character in the first narrative text in each dimension of personality.

[0013] According to a third aspect of an embodiment of the present application, a narrative text data processing method is provided, the method comprising: obtaining a second narrative text, the second narrative text comprising a plurality of chapter texts distributed in chronological order; taking each of the chapter texts as a target narrative text as described in the first aspect above, taking any one of the characters in the second narrative text as a target character as described in the first aspect above, and determining a personality score of any one of the characters in each of the chapter texts in each dimension of personality by executing the method described in the first aspect above; and determining personality change data of any one of the characters based on the personality score of any one of the characters in each of the chapter texts in each dimension of personality.

[0014] According to a fourth aspect of an embodiment of the present application, a computer program product is provided, which includes computer instructions stored in a computer-readable storage medium and suitable for being read and executed by a processor, so that a computer device having the processor executes the methods described in the first to third aspects above.

[0015] According to the fifth aspect of the embodiments of the present application, an electronic device is provided, comprising one or more processors and one or more memories, wherein at least one program code is stored in the one or more memories, and the at least one program code is loaded and executed by the one or more processors to implement the methods described in the first to third aspects above.

[0016] Based on the technical solution proposed in the present application, by inputting a text of a predetermined text type associated with a target character in a target narrative text into the target personality detection model, the target personality detection model can output a personality score for characterizing the personality characteristics of the target character in various personality dimensions. Since the preset text type includes at least one of a behavioral text, a commentary text, and a language text, the target personality detection model obtained by training a pre-constructed model framework based on the text of the predetermined text type associated with the reference character has the ability to fully learn and mine the personality characteristics of the character in various personality dimensions from the behavioral text and / or commentary text and / or language text associated with the character in the narrative text, and can then accurately output the personality characteristics of the character in the narrative text, thereby improving the accuracy of narrative text data processing.

[0017] It should be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the present application. BRIEF DESCRIPTION OF THE DRAWINGS

[0018] The drawings herein are incorporated into the specification and constitute a part of the specification, showing embodiments consistent with the present application, and together with the specification, are used to explain the principles of the present application. Obviously, the drawings described below are only some embodiments of the present application, and for ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work. In the drawings:

[0019] Figure 1 A flowchart showing a narrative text data processing method in an embodiment of the present application is shown;

[0020] Figure 2 A schematic diagram of a model framework in an embodiment of the present application is shown;

[0021] Figure 3 A schematic diagram of the structure of an electronic device in an embodiment of the present application is shown. DETAILED DESCRIPTION

[0022] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.

[0023] In addition, described feature, structure or characteristic can be combined in one or more embodiments in any suitable manner. In the following description, many specific details are provided to provide a full understanding of the embodiments of the present application. However, those skilled in the art will appreciate that the technical scheme of the present application can be put into practice without one or more of the specific details, or other methods, components, devices, steps, etc. can be adopted. In other cases, known methods, devices, realizations or operations are not shown or described in detail to avoid blurring the various aspects of the application.

[0024] The block diagrams shown in the accompanying drawings are merely functional entities and do not necessarily correspond to physically independent entities. That is, these functional entities may be implemented in software form, or in one or more hardware modules or integrated circuits, or in different networks and / or processor devices and / or microcontroller devices.

[0025] The flowcharts shown in the accompanying drawings are only exemplary and do not necessarily include all the contents and operations / steps, nor must they be executed in the order described. For example, some operations / steps can be decomposed, and some operations / steps can be combined or partially combined, so the actual execution order may change according to actual conditions.

[0026] In the description of this application, it should be understood that the terms "first" and "second" are used for descriptive purposes only and should not be understood as indicating or implying relative importance or implicitly indicating the number of technical features indicated. Thus, a feature defined as "first" or "second" may explicitly or implicitly include one or more of the feature. In the description of this application, unless otherwise specified, "plurality" means two or more.

[0027] The implementation details of the technical solution of the embodiment of the present application are described in detail below:

[0028] Figure 1 The flowchart of the narrative text data processing method in the embodiment of the present application is shown. The narrative text data processing method can be executed by a device with a computing processing function. Figure 1 As shown, the narrative text data processing method at least includes steps 110 to 130, which are described in detail as follows:

[0029] In step 110, a target personality detection model is obtained by training a pre-built model framework based on reference text data, wherein the reference text data is text of a predetermined text type associated with a reference character, and the predetermined text type includes at least one of a behavioral text, a commentary text, and a language text.

[0030] In the present application, a target personality detection model is obtained, wherein the target personality detection model can be obtained by training a pre-constructed model framework using reference text data as training data. The reference text data can be a text of a predetermined text type associated with a reference character in a reference narrative text.

[0031] In the present application, the predetermined text type may include at least one of behavioral text, commentary text, and language text. That is, the predetermined text type may include only behavioral text; may include only commentary text; may include only language text; may include behavioral text and commentary text; may include behavioral text and language text; may include commentary text and language text; may also include behavioral text, commentary text, and language text at the same time.

[0032] In the present application, the above step 110, i.e., obtaining the target personality detection model obtained by training a pre-built model framework based on reference text data, can be performed according to the following steps 111 to 115:

[0033] Step 111 , obtaining a reference narrative text, and extracting behavior text, commentary text, and language text associated with each reference character from the reference narrative text.

[0034] Step 112, respectively, according to different collection forms, select at least one type of text from the behavioral text, commentary text, and language text associated with each reference person to collect texts, so as to obtain text collections of each reference person in different collection forms.

[0035] Step 113, obtaining the personality scores of each reference character in each personality dimension in the reference narrative text as reference personality scores.

[0036] Step 114 , for each set form, based on the text set of each reference person in each set form and the reference personality score of each reference person, supervised training is performed on the pre-constructed model framework to obtain personality detection models corresponding to different set forms.

[0037] Step 115: Select a personality detection model from the personality detection models corresponding to the different set forms as a target personality detection model.

[0038] In the present application, the reference narrative text may be a translation of a classical Chinese novel text (e.g., Romance of the Three Kingdoms, Journey to the West, Dream of the Red Chamber, Water Margin, etc.), or a modern novel text (e.g., Fortress Besieged, The Great Gatsby), or a news report. It is understood that the reference narrative text described in the present application may be a narrative text in any literary form, not limited to those listed above.

[0039] It should be noted that if the reference narrative text is a classical Chinese novel text, it is necessary to translate the classical Chinese novel text and use the obtained translated text as the reference narrative text. In this application, the API interface of the GLM-3 large model can be called to machine translate the original narrative text into a pure vernacular text. For example, for the classical Chinese narrative text of "Romance of the Three Kingdoms", a machine translation prompt can be submitted to the GLM-3 large model in units of paragraphs to guide the model to feedback high-precision translation results.

[0040] After obtaining the reference narrative text, the behavior text, commentary text, and language text associated with each reference character may be extracted from the reference narrative text.

[0041] In the above step 111 of the present application, extracting the behavior text, commentary text, and language text associated with each reference character from the reference narrative text can be implemented as follows:

[0042] First, a character nickname dictionary can be constructed. The proper noun-name component in the text can be identified by named entity recognition, and the person's real name, courtesy name, pseudonym, and other information can be matched and connected. Specifically, the named entity recognition API interface in the natural language processing tool HanLP can be used to identify the proper noun-name component in the text, match and connect the person's real name, courtesy name, pseudonym, and other information to construct a character nickname dictionary.

[0043] Then, the reference narrative text is segmented into paragraph and sentence granularities. The text can be segmented into paragraph and sentence granularities based on punctuation marks such as line breaks and terminal marks. Specifically, the text can be segmented into paragraphs based on line breaks "\n", and then segmented into sentences based on terminal marks such as ".|!|?|...". When extracting the specific speech content of a reference character in the reference narrative text, additional processing of the language symbol ":"|"" can be added.

[0044] After the reference narrative text is segmented into paragraphs and sentences, the text after segmentation and sentence segmentation can be processed by word segmentation, and the named entity dictionary extracted by the named entity recognition method and the manually defined alias dictionary are introduced to correct the word segmentation results. The word segmentation results are tagged with parts of speech, and nouns are selected through part of speech tagging, and a special noun dictionary is constructed for backup; words marked as adjectives are marked as markers for character commentary in subsequent processing.

[0045] The Chinese word segmentation API of HanLP can be called to perform word segmentation on the text after segmentation and sentence division, and the named entity dictionary extracted by the NER method and the manually defined alias dictionary can be introduced to correct the word segmentation results.

[0046] Finally, the narrative text is reconstructed with characters as the center. Based on the semantic role labeling method, the main components such as the agent, the patient, and the predicate in the text can be extracted, and corresponding semantic rules can be formulated to disassemble the reference narrative text; the corresponding text can be divided into corresponding text types (i.e., behavioral text, commentary text, and language text) according to the punctuation and predicate division rules, and the disassembled text knowledge can be re-aggregated with characters as the center; the method of reference dissolution and introduction of the alias dictionary can be used to disambiguate the character names.

[0047] Specifically, the nomination clusters for referential resolution can be aggregated by paragraph (the nomination clusters include multiple references to the same person, such as Cao Cao, Meng De, He, and A Man), and the previously constructed character alias dictionary can be integrated to perform referential resolution on the person names in the cluster. That is, the person names in the cluster are traversed and compared with the previously constructed character alias dictionary. If a person name exists in the character alias dictionary, it is regarded as a standard name, and the other person names in the cluster are replaced with standard names. If all the person names in the cluster do not appear in the character alias dictionary, the part-of-speech tagging results of the paragraph are obtained, and the word in the cluster that best meets the standard name is found according to the priority of NR-PN-NN, and the remaining person names in the cluster are replaced. If neither of the above two situations is met, the cluster will not be processed. The CTB resource library is used to perform part-of-speech tagging on the word segmentation results. Nouns are selected through part-of-speech tagging, including three categories: NR (proper noun), PN (pronoun), and NN (other nouns). NR dictionary and NR-PN-NN dictionary are constructed for backup; words with part-of-speech tagging as VA (adjective) are marked as markers for character commentary in subsequent processing.

[0048] Specifically, semantic role labeling is performed on single sentences, and the single sentences are decomposed into multiple candidate n-tuples, which contain three components: predicate, central role, and subsidiary role. Rules for dividing the three types of text, namely character behavior, commentary, and language, are formulated to divide n-tuples into different text types. For scattered elements, character-centered text aggregation is performed, including element rearrangement and passive behavior processing. In the case where "character A and character B" are used as a semantic role in the candidate n-tuple, the character alias dictionary is introduced again here to decompose the above n-tuple into two independent n-tuples with character A and character B as semantic roles respectively. In the screening process of candidate n-tuples, only the standard that at least one of ARG0 or ARG1 belongs to the NR-PN-NN dictionary is used for filtering and screening, and the other parts of the n-tuple are retained.

[0049] The descriptions of characters in narrative literary texts are divided into three types of texts: character-behavior texts, character-language texts, and character-commentary texts, and the classification standards, extraction rules, and information expression forms of the three types of texts are given. As shown in Table 1, a specific embodiment is provided, and each example presented in Table 1 may contain more than one character or one type of text.

[0050]

[0051] Table 1

[0052] In step 112 of the present application as described above, at least one type of text may be selected from the behavioral texts, commentary texts, and language texts associated with each reference person and collected in different collection forms to obtain text collections of each reference person in different collection forms.

[0053] For example, the behavior text associated with each reference character is A, the commentary text is B, and the language text is C. At least one text type is selected from the behavior text A, the commentary text B, and the language text C to form a collection, and the text collections of each reference character in different collection forms are obtained as follows: [A], [B], [C], [A, B], [B, C], [A, C], [A, B, C].

[0054] It should be noted that the behavioral text A, the commentary text B, and the language text C mentioned above do not refer to a certain text, but to a certain type of text. A certain type of text may include one or more texts of this type.

[0055] In the above step 113 of the present application, that is, obtaining the personality scores of each reference character in the reference narrative text in each personality dimension, can be performed according to the following steps 1131 to 1133:

[0056] Step 1131 , obtaining the personality description text of each reference character in the reference narrative text as the reference personality description text.

[0057] Step 1132, obtaining personality description label texts at two extremes of each dimension of personality.

[0058] Step 1133, calculating the semantic space distance between the reference personality description text and the personality description label text, and determining the personality score of each reference character in the reference narrative text in each personality dimension based on the semantic space distance.

[0059] In the present application, the personality description text is a text used to directly describe the character's personality, for example, "Cao Cao is a suspicious, vicious and cruel person, who only promotes people based on their talents, knows how to appoint people to the right positions, has extraordinary courage and is daring to do anything." In this way, the personality description texts of each reference character in the reference narrative text can be obtained as reference personality description texts.

[0060] The reference personality description text can be manually summarized in advance. It can also be obtained by calling the model interface. For example, the API interface of the GLM-3 large model can be called to obtain the personality description text of each reference character in the reference narrative text. Specifically, the character personality question prompt can be submitted to the large language model to obtain the character personality description sentence.

[0061] In this application, the personality description label texts of each dimension personality at two extremes are obtained, wherein each dimension personality can be introduced into the personality in the Chinese personality big seven model, which includes 7 personalities, and each dimension personality corresponds to two extreme personality description label texts, as shown in Table 2 below.

[0062] Personality Dimensions meaning Two extreme personality description label texts Extraversion An individual's positive attitude and optimistic state. Extroverted and active - Introverted and quiet Kind Individuals’ inherent unique qualities such as honesty, integrity, care, and tolerance towards others. Kind and Friendly - Cold and Indifferent Style Individual attitudes and behaviors Strict self-control-indulgent self-will competence An individual's attitude and ability towards work or tasks Smart and capable - Dull and cowardly Emotional The emotional stability of the individual Passionate and forthright - withdrawn and selfish Relationships Individual's attitude towards interpersonal relationships Gentle and easy-going - irritable and stubborn Attitude Individual life attitude Proactive - Passive

[0063] Table 2

[0064] It should be noted in the present application that, in addition to introducing the personality in the Big Seven Model of Chinese Personality, each dimensional personality can also introduce the personality in other personality models, and the present application does not limit this.

[0065] After obtaining the reference personality description text and the personality description label text, the semantic space distance between the reference personality description text and the personality description label text may be calculated, and based on the semantic space distance, the personality score of each reference character in the reference narrative text in each dimension of personality may be determined.

[0066] Specifically, the 14 extreme personality description label texts of the 7-dimensional personality can be semantically enhanced (the interpretation text of the Chinese knowledge base can be introduced to complete the splicing and semantic enhancement of the personality description labels and their interpretation texts of the Big Seven Model at the corpus level); for the personality description sentences obtained by the GLM-3 large language model API, the Bert model is used to perform vector representation and similarity calculation on the personality description sentences and the personality description label texts, and the character personality is mapped to the multidimensional label to obtain the multidimensional personality score and use it as the personality score of each reference character in the reference narrative text in each dimension of personality.

[0067] For example, for the personality dimension of extroversion, the output will be the reference person's scores for extroversion and introversion, respectively. So the 7-dimensional personality will have 14 scores overall. But in the end, you can do some normalization. For example, if the score for extroversion is 0.3 and the score for introversion is 0.2, it will become 0.6 and 0.4, ensuring that the sum of the two extreme labels on a dimension is 1, and then compare them based on one extreme (such as 0.6 for extroversion).

[0068] In the above step 114 of the present application, that is, the supervised training of the pre-built model framework based on the text collection of each reference character in each collection form and the reference personality score of each reference character can be performed according to the following steps 1141 to 1144:

[0069] Step 1141, determining a reference character who has not participated in the model training in the reference narrative text as a target reference character.

[0070] Step 1142, inputting the text collection of the target reference person in each collection form into the pre-constructed model framework, so that the model framework can learn the personality characteristics of the target reference person and output the personality score of the target reference person.

[0071] Step 1143, based on the error between the output personality score of the target reference person and the reference personality score of the target reference person, reversely adjust the model parameters in the model framework to update the model framework.

[0072] Step 1144, returning to the step of determining a reference character that does not participate in model training in the reference narrative text until a preset condition is met, and obtaining a personality detection model corresponding to each set form.

[0073] In this application, in order to enable those skilled in the art to better understand the model framework pre-built in this application, the following Figure 2 Provide explanation.

[0074] Reference Figure 2 , Figure 2 A schematic diagram of the model framework in the embodiment of the present application is shown. Figure 2 In the model framework, the Longformer-BiLSTM-Attention model is used as the basic framework, and the text collection of each reference character in each set form (i.e., at least one of the behavioral text, commentary text, and language text associated with each reference character) is used as the input data for training the model framework. Specifically, the text in each set form of the text collection is feature transformed to obtain feature vectors of texts of various text types, and the feature vectors of the texts of various text types are combined, and the combined feature vectors are input into the Attention model.

[0075] In the present application, in the process of supervised training of a pre-constructed model framework based on the text collection of each reference character in each set form and the reference personality score of each reference character, after each time the text collection of the reference character in each set form is input into the pre-constructed model framework to train the model framework, the error between the output personality score of the reference character and the reference personality score of the reference character can be recorded.

[0076] In the present application, the preset condition may be training a preset number of reference characters in each set of text sets, i.e., a preset number of cyclic training times. It may also be that the error between the outputted personality score of the reference character and the reference personality score of the reference character satisfies a preset threshold. In this regard, the present application does not make too many restrictions on the preset conditions.

[0077] In the above step 115 of the present application, that is, selecting a personality detection model from the personality detection models corresponding to the different set forms as the target personality detection model, can be performed according to the following steps 1151 to 1152:

[0078] Step 1151, obtaining the learning error of the personality detection model corresponding to each set form during the training process.

[0079] Step 1152: Select a personality detection model with the smallest learning error from the personality detection models corresponding to the different set forms as a target personality detection model.

[0080] In this application, the learning error of the personality detection model corresponding to each set form during the training process is obtained, that is, the average value of the error between the personality score of the reference person recorded and output during the training model framework and the reference personality score of the reference person can be used as the learning error. For example, the errors from the first training to the third training are 0.3, 0.25, and 0.2, respectively, so the learning error is 0.25.

[0081] It can be understood that a learning error can be calculated for each personality detection model corresponding to each set form, and then a personality detection model with the smallest learning error can be selected from the personality detection models corresponding to the different set forms as the target personality detection model.

[0082] In the present application, since the learning error corresponding to the determined target personality detection model is the smallest among the personality detection models corresponding to different set forms, it is shown that the target personality detection model is the personality detection model with the highest personality recognition accuracy. Therefore, the target personality detection model can be used to accurately identify the personality characteristics of the target person in various dimensions of personality in the subsequent process, thereby improving the accuracy of narrative text data processing.

[0083] Continue to refer to Figure 1 In step 120, a target narrative text is obtained, and text of the predetermined text type associated with a target character is extracted from the target narrative text.

[0084] In the present application, the target narrative text may be a translated text of a classical Chinese novel text (e.g., Romance of the Three Kingdoms, Journey to the West, Dream of the Red Chamber, Outlaws of the Marsh, etc.), or a modern novel text (e.g., Fortress Besieged, The Great Gatsby), or a news report. It can be understood that the target narrative text described in the present application may be a narrative text of any literary form, not limited to those listed above.

[0085] It should be noted that if the target narrative text is a classical Chinese novel text, it is necessary to translate the classical Chinese novel text and use the obtained translated text as the target narrative text. In this application, the API interface of the GLM-3 large model can be called to machine translate the original narrative text and convert it into a pure vernacular text. For example, for the classical Chinese narrative text of "Romance of the Three Kingdoms", a machine translation prompt is submitted to the GLM-3 large model in units of paragraphs to guide the model to feedback high-precision translation results.

[0086] After the target narrative text is acquired, text of the predetermined text type associated with the target character may be extracted from the target narrative text.

[0087] In the present application, if the corresponding text set when training the target personality detection model only includes behavior text, the predetermined text type may only include behavior text, and the behavior text associated with the target character is extracted from the target narrative text; if the corresponding text set when training the target personality detection model includes commentary text and language text, the predetermined text type may include commentary text and language text, and the commentary text and language text associated with the target character are extracted from the target narrative text; if the corresponding text set when training the target personality detection model includes behavior text, commentary text, and language text, the predetermined text type may include behavior text, commentary text, and language text, and the behavior text, commentary text, and language text associated with the target character are extracted from the target narrative text.

[0088] In the present application, it can be understood that, in the present application, the method of extracting the text of the predetermined text type associated with the target character from the target narrative text can refer to the above-mentioned method of extracting the behavior text, commentary text, and language text associated with each reference character from the reference narrative text, and the present application will not repeat them here.

[0089] Continue to refer to Figure 1 In step 130, the text of the predetermined text type associated with the target person is input into the target personality detection model, so that the target personality detection model outputs the personality score of the target person in each dimension of personality, and the personality score is used to characterize the personality characteristics of the target person in the corresponding dimension of personality.

[0090] In the present application, after extracting the text of the predetermined text type associated with the target character from the target narrative text, the text of the predetermined text type associated with the target character can be input into the target personality detection model, so that the target personality detection model can output a personality score for characterizing the personality characteristics of the target character in various dimensions of personality.

[0091] In one embodiment of the present application, the predetermined text type may include behavioral text, commentary text, and language text at the same time.

[0092] Based on the technical solution proposed in the present application, by inputting a text of a predetermined text type associated with a target character in a target narrative text into the target personality detection model, the target personality detection model can output a personality score for characterizing the personality characteristics of the target character in various personality dimensions. Since the preset text type includes at least one of a behavioral text, a commentary text, and a language text, the target personality detection model obtained by training a pre-constructed model framework based on the text of the predetermined text type associated with the reference character has the ability to fully learn and mine the personality characteristics of the character in various personality dimensions from the behavioral text and / or commentary text and / or language text associated with the character in the narrative text, and can then accurately output the personality characteristics of the character in the narrative text, thereby improving the accuracy of narrative text data processing.

[0093] In practical applications, this application disassembles and reorganizes narrative text content with characters as the center, and uses techniques such as part-of-speech tagging, reference resolution, and semantic role tagging to reorganize information related to specific characters scattered in the text, obtain information about the characters in the text in terms of behavior, comments, and language, and fully explore the character characteristics expressed in the text, and use this as feature input to construct a personality detection model for the characters. In addition, the personality characteristics of the characters in the narrative text can be accurately output based on the constructed personality detection model, improving the accuracy of narrative text data processing.

[0094] Furthermore, in order to enable those skilled in the art to better understand the application value of the present application, two application scenarios will be introduced below.

[0095] Scenario 1: Determine the personality difference data between characters in a narrative text. Specifically, it includes the following steps 141 to 143:

[0096] Step 141, obtaining a first narrative text.

[0097] Step 142, using the first narrative text as the target narrative text as described in the above narrative text data processing method embodiment, using each character in the first narrative text as the target character as described in the above narrative text data processing method embodiment, and determining the personality score of each character in the first narrative text in each dimension of personality by executing the method described in the above narrative text data processing method embodiment.

[0098] Step 143, based on the personality scores of the characters in the first narrative text in each personality dimension, determine the personality difference data between the characters.

[0099] In this application, after determining the personality scores of each character in each dimension of personality in the first narrative text, the character groups can be divided according to gender (such as male, female) and identity (such as lord, counselor, general) to calculate the mean and extreme difference of the personality tendency of the group, and observe the overall personality tendency of the character group in each dimension; the characters are divided into groups according to gender and identity, the mean of personality tendency of different groups is calculated, and the difference of their indicators is compared. This application scenario can assist artists, cultural research scholars, readers and other text workers in the analysis and research of narrative texts, greatly promote the work efficiency of users, and has significant progress.

[0100] Scenario 2: Determine the personality change data of the same character in each chapter of the narrative text. Specifically, it includes the following steps 151 to 153:

[0101] Step 151 : obtaining a second narrative text, wherein the second narrative text includes a plurality of chapter texts distributed in chronological order.

[0102] Step 152, taking each of the chapter texts as the target narrative text as described in the above narrative text data processing method embodiment, taking any one of the characters in the second narrative text as the target character as described in the above narrative text data processing method embodiment, and determining the personality score of any one of the characters in each of the chapter texts in each dimension of personality by executing the method described in the above narrative text data processing method embodiment.

[0103] Step 153, based on the personality score of any one of the characters in each of the chapter texts in each personality dimension, determine the personality change data of any one of the characters.

[0104] In this application, after determining the personality scores of the same character in each chapter of the narrative text in each dimension of personality, the maximum and average changes in personality of all characters can be calculated, and case analysis can be performed on prominent cases; individual personality change analysis can be performed to examine indicators such as the maximum change range and average change range of individual personality, and the trend line fitting method can be used to longitudinally observe the change trend of the overall personality tendency, and case analysis can be performed on the changes in personality values ​​of individual characters between chapters to explore the underlying causes. This application scenario can also assist artists, cultural research scholars, readers and other text workers in their work in narrative text analysis and research, greatly promoting the work efficiency of users, and has significant progressiveness.

[0105] In the present application, a computer program product is also provided, which includes computer instructions, which are stored in a computer-readable storage medium and are suitable for being read and executed by a processor, so that a computer device having the processor executes the method as described above.

[0106] Based on the same inventive concept, the embodiment of the present application also provides an electronic device. Figure 3 , shows a schematic diagram of the structure of an electronic device in an embodiment of the present application, wherein the electronic device includes one or more memories 304, one or more processors 302, and at least one computer program (program code) stored in the memories 304 and executable on the processors 302, and when the processors 302 execute the computer programs, the methods described above are implemented.

[0107] Among them, Figure 3 In the embodiment of the present invention, a bus architecture (represented by bus 300) is shown, which may include any number of interconnected buses and bridges, and bus 300 links various circuits including one or more processors represented by processor 302 and memory represented by memory 304. Bus 300 may also link various other circuits such as peripherals, voltage regulators, and power management circuits, which are well known in the art and are therefore not further described herein. Bus interface 305 provides an interface between bus 300 and receiver 301 and transmitter 303. Receiver 301 and transmitter 303 may be the same element, namely a transceiver, providing a unit for communicating with various other devices over a transmission medium. Processor 302 is responsible for managing bus 300 and general processing, while memory 304 may be used to store data used by processor 302 when performing operations.

[0108] The functions described herein may be implemented in hardware, software executed by a processor, firmware, or any combination thereof. If implemented in software executed by a processor, the functions may be stored as one or more instructions or codes on a computer-readable medium or transmitted via a computer-readable medium. Other examples and implementations are within the scope and spirit of the present application and the appended claims. For example, due to the nature of software, the functions described above may be implemented using software executed by a processor, hardware, firmware, hard wiring, or a combination of any of these. In addition, each functional unit may be integrated into a processing unit, each unit may exist physically separately, or two or more units may be integrated into one unit.

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

[0110] The units described as separate components may or may not be physically separated, and the components of the control device may or may not be physical units, that is, they may be located in one place or distributed in multiple units. Some or all of the units may be selected according to actual needs to achieve the purpose of the present embodiment.

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

[0112] The above description is only an embodiment of the present application and is not intended to limit the present application. For those skilled in the art, the present application may have various modifications and variations. Any modification, equivalent substitution, improvement, etc. made within the spirit and principle of the present application shall be included in the scope of the claims of the present application.

Claims

1. A narrative text data processing method, characterized in that: The method comprises: Acquire a target personality detection model obtained by training a pre-built model framework based on reference text data, wherein the reference text data is text of a predetermined text type associated with a reference person, and the predetermined text type includes at least one of a behavioral text, a commentary text, and a language text; Acquire a target narrative text, and extract text of the predetermined text type associated with a target character from the target narrative text; The text of the predetermined text type associated with the target person is input into the target personality detection model, so that the target personality detection model outputs the personality score of the target person in each dimension of personality, and the personality score is used to characterize the personality characteristics of the target person in the corresponding dimension of personality.

2. The method according to claim 1, characterized in that The step of obtaining a target personality detection model obtained by training a pre-built model framework based on reference text data includes: Acquire a reference narrative text, and extract behavior texts, commentary texts, and language texts associated with each reference character from the reference narrative text; Selecting at least one text type from the behavioral texts, commentary texts, and language texts associated with each reference person in different collection forms to collect texts, thereby obtaining text collections of each reference person in different collection forms; Obtaining personality scores of each reference character in each personality dimension in the reference narrative text as reference personality scores; For each set form, based on the text set of each reference person in each set form and the reference personality score of each reference person, supervised training is performed on the pre-built model framework to obtain personality detection models corresponding to different set forms; A personality detection model is selected from the personality detection models corresponding to the different set forms as the target personality detection model.

3. The method according to claim 2, characterized in that The step of obtaining the personality scores of each reference character in each personality dimension in the reference narrative text includes: Obtaining personality description texts of each reference character in the reference narrative text as reference personality description texts; Obtain the personality description label texts of each dimension of personality at two extremes; The semantic space distance between the reference personality description text and the personality description label text is calculated, and based on the semantic space distance, the personality score of each reference character in the reference narrative text in each personality dimension is determined.

4. The method according to claim 2, characterized in that: The method of performing supervised training on the pre-built model framework based on the text collection of each reference person in each collection form and the reference personality score of each reference person includes: Determine a reference character that has not participated in model training in the reference narrative text as a target reference character; Inputting the text collection of the target reference person in each collection form into the pre-built model framework, so that the model framework can learn the personality characteristics of the target reference person and output the personality score of the target reference person; Based on the error between the output personality score of the target reference person and the reference personality score of the target reference person, reversely adjusting the model parameters in the model framework to update the model framework; Return to the step of determining a reference character that does not participate in the model training in the reference narrative text until a preset condition is met, and obtain a personality detection model corresponding to each set form.

5. The method according to claim 2, characterized in that: The step of selecting a personality detection model from the personality detection models corresponding to the different set forms as a target personality detection model includes: Obtain the learning error of the personality detection model corresponding to each set form during the training process; A personality detection model with the smallest learning error is selected from the personality detection models corresponding to the different set forms as the target personality detection model.

6. The method according to claim 1, characterized in that The predetermined text types include behavioral text, commentary text, and language text.

7. A narrative text data processing method, characterized in that: The method comprises: Obtaining the first narrative text; Taking the first narrative text as the target narrative text as claimed in claim 1, taking each character in the first narrative text as the target character as claimed in claim 1, and determining the personality score of each character in the first narrative text in each personality dimension by executing the method as claimed in claim 1; Based on the personality scores of the characters in each personality dimension in the first narrative text, personality difference data between the characters are determined.

8. A narrative text data processing method, characterized in that: The method comprises: Acquire a second narrative text, wherein the second narrative text includes a plurality of chapter texts distributed in chronological order; Taking each of the chapter texts as the target narrative text as claimed in claim 1, taking any character in the second narrative text as the target character as claimed in claim 1, and determining the personality score of any character in each of the chapter texts in each personality dimension by executing the method as claimed in claim 1; Based on the personality scores of any one of the characters in each of the chapter texts in each personality dimension, the personality change data of the any one of the characters is determined.

9. A computer program product, characterized in that The computer program product includes computer instructions, which are stored in a computer-readable storage medium and are suitable for being read and executed by a processor, so as to enable a computer device having the processor to perform the method according to any one of claims 1 to 8.

10. An electronic device, characterized in that: The electronic device includes one or more processors and one or more memories, wherein the one or more memories store at least one program code, and the at least one program code is loaded and executed by the one or more processors to implement the method according to any one of claims 1 to 8.