Method and device for extracting figure major event year table in text
By training and generating text by using large language models, automatically extract the character's annual table of the characters in the text, solve the problem of low efficiency in the existing technology, and achieve efficient automated extraction process.
Patent Information
- Application Number
- CN202411344472.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-25
- Publication Date
- 2025-01-21
AI Technical Summary
In the prior art, it is inefficient to extract the chronology of the characters in the text, and it requires manual reading of the text and manually extracting information, which is time-consuming and labor-intensive, and is especially suitable for long texts.
By calling a large language model to obtain training data, including training text and the chronology of major characters, these data are used to train the initial generation model to obtain the target generation model. Then, the target text to be recognized is input into the target generation model to generate a chronology of major events of the main characters in the target text.
The annual table of the characters in the characters in the automation extract, which significantly improves the extraction efficiency and reduces the time and energy of manual operation.
Smart Images

Figure CN119337859A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of neural network technology, and in particular to a method and device for extracting a chronology of important events of a person in a text. Background Art
[0002] In the process of text creation and review, the character chronology plays a vital role. The character chronology refers to listing the important events and action trajectories experienced by the characters in the text in chronological order. It can give the creator and the audience a clear and comprehensive understanding of the characters in the text. For text creation, by extracting the character chronology in the text, the creator can more clearly understand the character's growth and change process, so as to better adjust the text structure and shape a full character image; for text reading, the character chronology can allow readers to quickly and intuitively understand the character's growth process, saving a lot of time reading the entire text, greatly improving reading efficiency.
[0003] Currently, extracting a chronology of important events in a text mainly relies on manual operations, which requires people to read through the entire text and manually extract and organize the important events and action trajectories of the characters. Reading through the text and manually extracting information requires a lot of time and effort, especially for long texts. This process may take hours or even days, and the efficiency of generating a chronology is low. Summary of the invention
[0004] In order to solve the above technical problem or at least partially solve the above technical problem, the present application provides a method and device for extracting a chronology of important events of characters in a text.
[0005] In a first aspect, the present application provides a method for extracting a chronology of major events of characters in a text, the method comprising: calling a large language model to obtain training data, wherein the training data comprises a training text and a chronology of major events of major characters in the training text, the chronology being used to list the important events and action trajectories experienced by the characters in the entire text in chronological order; using the training text and the chronology of major events corresponding to the training text to train an initial generation model to obtain a target generation model, so that the target generation model learns the ability to extract a chronology of major events from a text; inputting a target text to be identified into the target generation model to obtain a chronology of major events of major characters in the target text output by the target generation model, wherein the target text has the same text category as the training text.
[0006] Optionally, calling a large language model to obtain training data includes: calling the large language model to extract major characters in a setting text, wherein the setting text includes a plurality of sequentially arranged chapter texts; calling the large language model to extract the phased goals of the major characters in the chapter texts, and generating a phased chronology of major events for the chapter texts, wherein the phased goals represent specific tasks of the major characters in each plot stage, and the phased chronology of major events is used to record the events and achievements of the major characters in each stage in chronological order; calling the large language model to integrate a plurality of the phased chronologies of major events to obtain a complete chronology of major events for the setting text; using the setting text as the training text, and using the complete chronology of major events for the setting text as the chronology corresponding to the training text.
[0007] Optionally, calling the large language model to extract the phased goals of the main characters in the chapter text and generating a phased chronology of major events in the chapter text includes: inputting the chapter text and preset prompt words into the large language model to obtain the phased goals of the main characters in the set text output by the large language model; inputting the phased goals of the main characters into the large language model to obtain at least one sub-event; merging related sub-events into a main event; and sorting the main events in order from early to late to obtain a phased chronology of major events in the chapter text.
[0008] Optionally, calling the large language model to integrate multiple phased chronologies to obtain a complete chronology of major events for the set text includes: calling the large language model to collect phased chronologies of major events in all chapters in the set text; sorting the main events in the multiple phased chronologies in chronological order from early to late; merging the related main events into one major event; and generating a complete chronology of major events for the set text based on the merged major events.
[0009] Optionally, after obtaining the complete chronology of major events in the setting text, the method further includes: inputting the complete chronology of major events into the large language model to obtain the ultimate goal of the main character in the setting text output by the large language model, wherein the ultimate goal is the ultimate purpose pursued by the main character in the entire story line; after merging the related sub-events into a main event, the method further includes: grading the importance of the main event according to the degree of influence of the main event on the phased goal; after merging the related main events into a major event, the method further includes: grading the importance of the major event according to the degree of influence of the major event on the ultimate goal.
[0010] Optionally, the method further includes: using the set text as a training text, and using the complete chronology of major events, the ultimate goals of the main characters in the set text, and the importance levels of the major events as annotation information to train a target generation model; inputting the target text into the target generation model to obtain the ultimate goals and chronology of major characters in the target text, as well as the importance levels of the major events in the chronology, output by the target generation model.
[0011] Optionally, the method further includes: inputting the target text and preset characters in the target text into the target generation model, and obtaining a chronology of major events of the preset characters output by the target generation model, wherein the chronology of major events of the preset characters includes event details of each major event.
[0012] In a second aspect, a device for extracting a chronology of major events of characters in a text is provided, the device comprising: a calling module, used to call a large language model to obtain training data, wherein the training data comprises a training text and a chronology of major events of major characters in the training text, the chronology being used to list the important events and action trajectories experienced by the characters in the entire text in chronological order; a training module, used to train an initial generation model using the training text and the chronology of major events corresponding to the training text to obtain a target generation model, so that the target generation model learns the ability to extract a chronology of major events from a text; an input-output module, used to input a target text to be identified into the target generation model, and obtain a chronology of major events of major characters in the target text output by the target generation model, wherein the target text has the same text category as the training text.
[0013] According to a third aspect, an electronic device is provided, comprising 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; the memory is used to store computer programs; and the processor is used to implement any of the steps of the method for extracting a chronology of important events of people in a text when executing the program stored in the memory.
[0014] In a fourth aspect, a computer-readable storage medium is provided, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the computer program implements any of the steps of the method for extracting a chronology of important events of people in a text.
[0015] The above technical solution provided by the embodiment of the present application has the following advantages compared with the prior art:
[0016] The method provided in the embodiment of the present application obtains a training text and a chronology of major characters in the training text through a large language model, and performs model training based on the data. During the use of the model, only the target text needs to be input, and the model can output a chronology of major characters. Compared with the prior art of manually reading the text and manually extracting the chronology of major characters, the present application automatically extracts the chronology through a model, thereby improving the extraction efficiency of the chronology. BRIEF DESCRIPTION OF THE DRAWINGS
[0017] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the invention and, together with the description, serve to explain the principles of the invention.
[0018] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, for ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative labor.
[0019] Figure 1 A schematic diagram of the hardware environment of a method for extracting a chronology of events of characters in a text provided in an embodiment of the present application;
[0020] Figure 2 A flowchart of a method for extracting a chronology of important events in a text provided by an embodiment of the present application;
[0021] Figure 3 A flowchart of a method for calling a large language model to obtain training data provided in an embodiment of the present application;
[0022] Figure 4 A system block diagram for extracting a chronology of important events in a text provided by an embodiment of the present application;
[0023] Figure 5 A schematic diagram of the structure of a device for extracting a chronology of events of characters in a text provided in an embodiment of the present application;
[0024] Figure 6 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0025] In order to make the purpose, technical solution and advantages of the embodiments of the present application clearer, the technical solution 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 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 making creative work are within the scope of protection of this application.
[0026] In the subsequent description, the suffixes such as "module", "component" or "unit" used to represent elements are only used to facilitate the description of the present application and have no specific meaning. Therefore, "module" and "component" can be used interchangeably.
[0027] In order to solve the problem mentioned in the background technology, according to one aspect of the embodiments of the present application, an embodiment of a method for extracting a chronology of important events of characters in a text is provided.
[0028] Optionally, in the embodiment of the present application, the above method for extracting a chronology of events of characters in a text can be applied to: Figure 1 In the hardware environment composed of the terminal 101 and the server 103 shown in FIG. Figure 1 As shown, the server 103 is connected to the terminal 101 via a network, and can be used to provide services for the terminal or a client installed on the terminal. A database 105 can be set on the server or independently of the server to provide data storage services for the server 103. The above-mentioned network includes but is not limited to: a wide area network, a metropolitan area network or a local area network, and the terminal 101 includes but is not limited to a PC, a mobile phone, a tablet computer, etc.
[0029] The embodiment of the present application provides a method for extracting a chronology of important events of people in a text, which can be applied to a server to improve the efficiency of extracting a chronology of important events of people in a text.
[0030] The following will be combined with specific implementation methods to provide a method for extracting a chronology of events in a text provided by the present application. Figure 2 As shown, the specific steps are as follows:
[0031] Step 201: calling a large language model to obtain training data, wherein the training data includes a training text and a chronology of major events of major characters in the training text, wherein the chronology is used to list the important events and action trajectories experienced by the characters in the entire text in chronological order;
[0032] Step 202: training the initial generation model using the training text and the chronology of major events corresponding to the training text to obtain a target generation model, so that the target generation model learns the ability to extract the chronology of major events from the text;
[0033] Step 203: input the target text to be recognized into the target generation model, and obtain a chronology of major events of major characters in the target text output by the target generation model, wherein the target text has the same text category as the training text.
[0034] The present application obtains a training text and a chronology of major characters in the training text through a large language model, and performs model training based on the data. During the use of the model, only the target text needs to be input, and the model can output a chronology of major characters. Compared with the prior art of manually reading the text and manually extracting the chronology of major characters, the present application automatically extracts the chronology through a model, thereby improving the efficiency of extracting the chronology.
[0035] Optionally, the text in the embodiment of the present application may be a script, a biography, a novel, a history book, etc.
[0036] For readers, automated extraction of a chronology can improve the efficiency of text review and evaluation. For example, if the text is a script, for producers, directors, and investors, the chronology of major events automatically generated by the model can quickly allow them to understand the core content and character development of the script without having to read the entire script. This greatly improves the efficiency of script review and enables decision makers to evaluate script quality more quickly.
[0037] For creators, automated extraction of chronologies can assist in text creation, analysis, and modification. For example, if the text is a script, by providing clear character growth trajectories and key events, the chronology of characters automatically generated by the model provides scriptwriters with an objective and comprehensive perspective to examine their works, which helps to discover deficiencies in character creation, such as incoherent personality development and unclear motivations.
[0038] As an optional implementation, Figure 3 As shown, calling a large language model to obtain training data includes the following steps.
[0039] Step 301: calling a large language model to extract main characters in a setting text, wherein the setting text includes a plurality of sequentially arranged chapter texts;
[0040] Step 302: calling a large language model to extract the phased goals of the main characters in the chapter text, and generating a phased chronology of major events in the chapter text, wherein the phased goals represent the specific tasks of the main characters in each plot stage, and the phased chronology of major events is used to record the events and achievements of the main characters in each stage in chronological order;
[0041] Step 303: Call a large language model to integrate multiple phased chronologies to obtain a complete chronology of the set text.
[0042] Step 304: Use the set text as the training text, and use the completeness chronology of the set text as the chronology of the training text.
[0043] In step 301, the user inputs the entire set text into a large language model through a terminal. The large language model may adopt the GPT series, the BERT series, etc. The large language model adopts NLP (Natural Language Processing) technology for named entity recognition, extracts all character names, and counts the actual frequency of each character appearing in the script, and determines the characters with a higher frequency than the set frequency as the main characters, for example, the characters ranked in the top 3 in frequency or accounting for 80% of the total number of character appearances are the main characters.
[0044] Among them, the user inputs the set text or chapter text through the terminal, including but not limited to picture input, scan input or document input. Picture input is to extract the text in the picture by using image processing technology, and perform text recognition and conversion; scan input is to use high-resolution scanners or smart phones to use optical character recognition technology to recognize the scanned image and extract the text, which is suitable for paper books; document input is that the user uploads electronic documents in PDF, Word, TXT and other formats, and the document parsing tool automatically extracts the text content in the document.
[0045] Optionally, the set text includes multiple chapter texts. If the set text is a script, then the chapter text is each episode of the script; if the set text is a novel, then the chapter text is each chapter of the novel.
[0046] In step 302, the server inputs the chapter texts into the large language model in sequence, and uses prompt words to let the large language model extract the phased goals of the main characters from each chapter text, for example, the prompt word is "Please analyze the main goals and needs of character xx in this episode". The phased goals are the specific tasks of the main characters in each plot stage, which depend on the development trajectory of the characters in the plot. The phased goals of the characters are generally related to the ultimate goals of the characters. Then, the large language model generates a detailed phased chronology for each chapter based on the identified phased goals. The phased chronology records the important events and achievements of the characters at different stages, helping to fully understand their growth and change process.
[0047] Step 302 generates a chronology of major events in the chapter text, including the following contents:
[0048] Step 3021: input the chapter text and the preset prompt words into the large language model to obtain the phased goals of the main characters in the set text output by the large language model;
[0049] Step 3022: Input the phased goal of the main character into the large language model to obtain at least one sub-event;
[0050] Step 3023: Merge the associated sub-events into a main event;
[0051] Step 3024: Sort the main events in chronological order from earliest to latest to obtain a chronological table of major events in the chapter text.
[0052] The user inputs each chapter text and preset prompt words (for example, "Please analyze the main goals and needs of character xx in this episode") into the large language model. The large language model identifies the goals and needs of the main characters in the set text at different stages, that is, the stage goals of each chapter text. These goals depend on the development trajectory of the characters in the plot.
[0053] The server inputs the main character's phased goals into a large language model to further identify sub-events related to the phased goals. Sub-events are specific actions or events to achieve the phased goals. Through the output of the model, at least one sub-event related to the phased goal is obtained, and these sub-events will serve as the basis for merging subsequent events.
[0054] The server merges the related sub-events to form a main event. Some sub-events are insignificant, while some are related but distributed in different time periods. Multiple sub-events will make the content look very confusing, so they need to be merged. This step ensures the coherence and logic of the events in the chronology. Each main event has a corresponding detailed description, including the specific content of the event, its impact, and its relationship with the stage goals, which helps to fully understand the actions and changes of the characters at different stages.
[0055] The server sorts the main events in order from earliest to latest to form a chronology of major events in the chapter text. This step ensures the time consistency and integrity of the chronology of major events. The chronology of major events is marked with the time node of each main event to facilitate the subsequent timeline drawing and analysis to ensure the accuracy and consistency of time.
[0056] For example, suppose there is a script that contains multiple chapters. The following steps can be used to generate a chronology of major events for the main characters: 1. Input prompt words: Use carefully designed prompt words to input the chapter text and prompt words together into a large language model. 2. Extract phased goals: Based on the results output by the model, extract the phased goals of the main characters at different stages. 3. Extract sub-events: Input the phased goals into a large language model to extract related sub-events. 4. Merge sub-events into main events: Merge related sub-events to form a main event and describe its content in detail. 5. Time sorting and annotation: Sort the main events in chronological order and mark specific time nodes in the chronology.
[0057] The above steps can effectively generate a chronology of major events in the setting text for the main characters, helping to better understand and shape the character image.
[0058] In step 303, the server integrates the phased chronologies of the multiple chapter texts to form a complete chronology of the set text. This step ensures the coherence and integrity of the entire story line. During the integration process, the chronologies of different chapters need to be checked for consistency to ensure that there are no conflicts or contradictions in the timeline and event logic.
[0059] The complete chronology of the set text includes the following:
[0060] Step 3031: Collect the chronology of major events in all chapters of the set text through a large language model;
[0061] Step 3032: sorting the main events in the multiple phased event chronologies in order from earliest to latest;
[0062] Step 3033: merge the associated main events into one large event;
[0063] Step 3034: Generate a complete chronology of major events in the set text based on the merged major events.
[0064] The large language model collects the phased chronology of all chapters in the setting text, thereby extracting the main events of the main characters from each chapter text, and then sorting the main events in multiple phased chronologies in order from early to late to ensure that the time sequence of each event is accurate. During the sorting process, it is necessary to check the consistency of the chronologies of different chapters to ensure that there are no conflicts and contradictions in the timeline and event logic. Then merge the related main events to form a major event. Since a major event may be distributed in different chapters, the main events in adjacent chapters are actually one event, so the events need to be merged. Each major event has a corresponding detailed description, including the specific content, impact and relationship with the phased goals of the event, which helps to fully understand the overall development trajectory and plot changes of the setting text. Finally, based on the merged major events, a complete chronology of the setting text is generated to ensure the coherence and integrity of the entire story line. In addition, the complete chronology can be normalized, including unified format, marking time nodes and other operations, to facilitate subsequent analysis and display.
[0065] For example, there is a script that contains multiple chapters of text. The following steps can be used to generate a complete chronology of the setting text:
[0066] 1. Extracting the chronology of major events: The large language model collects the chronology of major events of the main characters at different stages. 2. Sorting and merging main events: Sort the main events in the chronology of major events in the stage in chronological order, and merge the related main events into one major event. 3. Generate a complete chronology of major events: Based on the merged major events, generate a complete chronology of major events for the set text, and perform data normalization.
[0067] The above steps can effectively generate a complete chronology of major events in the setting text, helping to better understand and shape the character image.
[0068] As an optional embodiment, after obtaining a complete chronology of major events in the set text, the method also includes: inputting the complete chronology of major events into a large language model to obtain the ultimate goal of the main characters in the set text output by the large language model; after merging related sub-events into a main event, the method also includes: grading the importance of the main events according to the degree of influence of the main events on the phased goals; after merging the related main events into a major event, the method also includes: grading the importance of the major events according to the degree of influence of the major events on the ultimate goal.
[0069] After step 303, the server can also input the integrated character chronology into the large language model, using prompt words such as "Based on the above chronology, analyze what the ultimate goal of character xx is", so as to obtain the ultimate goal output by the large language model. The ultimate goal is the goal that the main character ultimately hopes to achieve in the development of the entire plot. The ultimate goal allows reviewers and creators to observe whether the entire story line is in line with the character's ultimate goal and whether there are any unreasonable plots, so as to make improvements and adjustments.
[0070] In addition, whether a main event or a major event is generated, it is necessary to rank the importance of each event. Specifically, if the main event exists in the chronology of stage-by-stage events, then the main event needs to be ranked in importance according to the degree of influence of the main event on the stage-by-stage goals in the chronology of stage-by-stage events; if the major event exists in the complete chronology of major events, then it is necessary to rank the importance of the major event according to the degree of influence of the major event on the ultimate goals in the complete chronology of major events. Through the importance ranking, the events on which the character's growth and changes are based can be more clearly defined, thereby paying more attention to the event. For example, the creator can shape the character's image by describing the event in more detail, or the director can devote more energy to the event in the script.
[0071] As an optional implementation method, the goal generation model can be trained not only by using training text and a complete chronology, but also by incorporating the ultimate goals of major characters and the importance levels of major events. In this way, the subsequent goal generation module can simultaneously output the ultimate goals of the main characters and the chronology, as well as the importance levels of major events in the chronology, making the output content more detailed and providing reviewers and creators with more detailed information without having to figure it out on their own, saving time and cost, and also helping them to have a deeper understanding of the deeper meaning of the text.
[0072] The process of training the target generation model is as follows: using the set text as the training text, and using the complete chronology of major events, the ultimate goals of the main characters in the set text, and the importance levels of major events as annotation information to train the target generation model; inputting the target text into the target generation model to obtain the ultimate goals and chronology of major events in the target text, as well as the importance levels of major events in the chronology, as output by the target generation model.
[0073] Among them, in the process of building the target generation model, it is necessary to first set the initial parameters of the model, which include but are not limited to the structural configuration of the model (such as the number of layers, the number of neurons), the learning rate, the batch size, etc. In addition, it is also necessary to define the loss function (such as the cross entropy loss function) and the evaluation index (ROUGE score), which will affect the training process and final performance of the model. The embodiment of the present application uses the Transformers library of Hugging Face and performs fine-tuning training based on the Qwen-32B model, and the training process is implemented using the PyTorch framework.
[0074] Next, the initial generative model is trained using the prepared sample dataset. The sample dataset contains training texts, and the annotations include a complete chronology of major events, the ultimate goals of the main characters in the set text, and the importance levels of major events. By learning these annotated data, the model learns how to correctly output a complete chronology of major events, as well as the ultimate goals of the main characters and the importance levels of major events. During the training process, the model will output a series of annotation results. If these annotation results are inconsistent with the actual annotation content in the sample dataset, the model parameters need to be adjusted so that the model can gradually approach the correct annotation results. This process is iterated repeatedly until the annotation results output by the model are consistent with the annotation content in the sample dataset.
[0075] Once the model training is completed, the model needs to be evaluated using a test data set. During the evaluation process, the ROUGE score metric can be used to measure the similarity between the ad placement results generated by the model and the standard answer. The ROUGE score is mainly used in text generation tasks. It evaluates the performance of the model by calculating the ratio of n-grams that overlap between the text generated by the model and the reference text. If the evaluation index meets the preset requirements, it means that the model has achieved the expected effect. At this time, the final target generation model is obtained, and the target generation model is used to deploy the local model. If the evaluation index fails to meet the preset requirements, it is necessary to further adjust the model parameters or change the training strategy until the performance of the model meets expectations. Based on the pre-trained model, this application uses specific task data for fine-tuning to improve the performance of the model on specific tasks.
[0076] The attention mechanism plays an important role in this process. In model training and use, the attention mechanism helps the model allocate resources more intelligently when processing input data. Specifically, when processing text data, the attention mechanism allows the model to focus on the most relevant parts. For example, in the task of generating a chronology of major events, the model can pay more attention to the events most relevant to the chronology, thereby improving the accuracy and comprehensiveness of the chronology.
[0077] Large language models are commercial models. This application solves the data security issues that may arise from using commercial model APIs by training local models, which is particularly suitable for processing sensitive text content. In the early stage, commercial models are used for rapid startup, and later local models are used to reduce operating costs, achieving the best balance between effect and cost. In addition, the system can continuously learn from new scripts and manual feedback, continuously improve model performance, and adapt to changing advertising needs and script styles.
[0078] As an optional implementation, the method also includes: inputting the target text and preset characters in the target text into a target generation model to obtain a chronology of major events of the preset characters output by the target generation model, wherein the chronology of major events of the preset characters includes event details of each major event.
[0079] During the use of the model, if the user does not restrict the characters, the model will automatically output the chronology of the main characters. If the user wants to obtain the chronology of the preset characters, then the name of the preset character must be input into the target generation model at the same time as the target text. In this way, the chronology of a certain character can be obtained in a targeted manner, and the objects to which the chronology belongs are more flexible. In addition, the chronology also includes the event details of each major event, which makes it easier for reviewers and creators to understand the details of each event without flipping through the text, saving time.
[0080] The embodiment of the present application also provides an overall step of extracting a chronology of important events of characters in a text, including the following contents.
[0081] Step 1: Extract the main characters in the entire setting text.
[0082] The entire setting text is input into a large language model, and named entity recognition is performed using NLP technology to extract all character names, count the frequency of each character appearing in the script, and determine the main characters based on preset thresholds (such as the top 5 in frequency of appearance or 80% of the total number of character appearances).
[0083] Step 2: Extract the phased goals of the main characters in the chapter text.
[0084] Input the chapter text and preset prompt words (such as "Please analyze the main goals and needs of character xx in this episode") into the large language model to obtain the phased goals of character xx output by the large language model.
[0085] Step 3: Generate a chronology of major events in the chapter text.
[0086] The phased goals and chapter texts are input into a large language model to extract main events and sub-events. Related sub-events are merged into a main event, the main events are sorted in chronological order, and the importance levels of the main events are marked to obtain a phased chronology of major events in the chapter text.
[0087] Step 4: Generate a complete chronology of the setting text.
[0088] The large-scale language model collects the chronology of major events in each stage, sorts the main events in multiple chronologies of major events in chronological order, merges the related main events into one major event, and generates a complete chronology of major events with set texts based on the major events.
[0089] Step 5: Extract the ultimate goal of the main character.
[0090] The complete chronology of major events and prompt words are input into a large language model, which outputs the ultimate goals of the main characters and readjusts the importance levels of major events based on the ultimate goals.
[0091] Step 6: The output of the large language model is used to train the local model.
[0092] Collect training data (output results of about 20 large commercial models), use Qwen-32B or other open source models as the basic model, design fine-tuning strategies suitable for the task (such as LoRA, P-tuning, etc.), fine-tune the model, and optimize the performance of the model on specific tasks.
[0093] Step 7: Local model deployment.
[0094] Select appropriate server hardware (consider GPU, memory, etc. requirements), use model deployment frameworks (such as TensorRT, ONNX Runtime, etc.) to optimize model inference speed, design and implement API interfaces, and support script input and result output.
[0095] Step 8: Use the local model to extract the chronology of important events and display the results.
[0096] Design a user-friendly interface that supports text uploading and character selection, calls the local model API, obtains the extraction results, and displays the results in a visual way, including timeline, event details, importance, etc., and provides filtering and query functions to facilitate users to quickly locate information of interest.
[0097] This application uses the powerful natural language understanding and generation capabilities of large language models, takes text as input, and guides the model to output a chronology of important events that meets the requirements through carefully designed prompts. Figure 4 As shown, the whole system includes the following main modules:
[0098] 1. Data preprocessing module: responsible for preprocessing the input text, including segmentation, removal of irrelevant information, etc.
[0099] 2. Character extraction module: extracts the main characters based on the preprocessed text.
[0100] 3. Goal demand extraction module: extract the character’s phased goals based on chapters.
[0101] 4. Chronology extraction module: extract the chronology of major events of a character in chapters.
[0102] 5. Chronology integration module: Integrate the chronology of major events in each chapter into a complete chronology of major events of the characters.
[0103] 6. Ultimate goal extraction module: Extract the ultimate goal of the character based on the integrated chronology of major events.
[0104] 7. Model training module: used to train locally deployed self-developed models.
[0105] 8. Model deployment module: deploy the trained model to the local server.
[0106] 9. Result display module: displays the extraction results in a user-friendly manner.
[0107] Texts usually contain a lot of dialogue, scene descriptions, inner monologues, etc. By using the powerful text understanding and generation capabilities of large language models, we can achieve automatic extraction of character chronology and greatly improve extraction efficiency. By using the powerful semantic understanding capabilities of large language models, we can ensure the comprehensiveness and accuracy of the extraction results and reduce human omissions and errors. By setting a unified output format and rules, we can ensure the consistency and standardization of the extraction results.
[0108] Based on the same technical concept, the embodiment of the present application also provides a device for extracting a chronology of important events in a text, such as Figure 5 As shown, the device comprises:
[0109] A calling module 501 is used to call a large language model to obtain training data, wherein the training data includes a training text and a chronology of major events of major characters in the training text, wherein the chronology is used to list the important events and action trajectories experienced by the characters in the entire text in chronological order;
[0110] A training module 502 is used to train the initial generation model using the training text and the chronology of major events corresponding to the training text to obtain a target generation model, so that the target generation model learns the ability to extract the chronology of major events from the text;
[0111] The input-output module 503 is used to input the target text to be recognized into the target generation model, and obtain a chronology of major events of the main characters in the target text output by the target generation model, wherein the text category of the target text is the same as that of the training text.
[0112] Optionally, the calling module 501 is used to:
[0113] Calling a large language model to extract main characters in a setting text, wherein the setting text includes a plurality of sequentially arranged chapter texts;
[0114] Call a large language model to extract the phased goals of the main characters in the chapter text and generate a phased chronology of major events in the chapter text. The phased goals represent the specific tasks of the main characters in each plot stage, and the phased chronology is used to record the events and achievements of the main characters in each stage in chronological order.
[0115] Use a large language model to integrate multiple phased chronologies to obtain a complete chronology of events for the set text;
[0116] The set text is used as the training text, and the complete chronology of events in the set text is used as the chronology of events corresponding to the training text.
[0117] Optionally, the calling module 501 is used to:
[0118] Input the chapter text and preset prompt words into the large language model to obtain the phased goals of the main characters in the set text output by the large language model;
[0119] Input the main character's phased goals into a large language model to obtain at least one sub-event;
[0120] Merge related sub-events into one main event;
[0121] The main events are sorted in chronological order from earliest to latest to obtain a chronological list of major events in the chapter text.
[0122] Optionally, the calling module 501 is used to:
[0123] Use a large language model to collect a chronology of major events in all chapters of the set text;
[0124] Sort the main events in multiple phased chronologies in order from earliest to latest;
[0125] Merge related main events into one big event;
[0126] Generate a complete chronology of events for the set text based on the merged major events.
[0127] Optionally, the device is also used for:
[0128] After obtaining the complete chronology of the setting text, the complete chronology is input into the large language model to obtain the ultimate goal of the main character in the setting text output by the large language model, where the ultimate goal is the ultimate goal pursued by the main character in the entire story line;
[0129] After the associated sub-events are merged into a main event, the main event is graded in importance according to its impact on the phased goals;
[0130] After combining the related main events into one major event, the major events are ranked in importance according to their impact on the ultimate goal.
[0131] Optionally, the device is also used for:
[0132] The target generation model is trained using the set text as the training text, the complete chronology of major events, the ultimate goals of the main characters in the set text, and the importance level of major events as the annotation information;
[0133] The target text is input into the target generation model, and the ultimate goals and chronology of major events in the target text, as well as the importance levels of major events in the chronology, are output by the target generation model.
[0134] Optionally, the device is also used for:
[0135] The target text and the preset characters in the target text are input into the target generation model, and a chronology of major events of the preset characters output by the target generation model is obtained, wherein the chronology of major events of the preset characters includes event details of each major event.
[0136] Based on the same technical concept, an embodiment of the present invention further provides an electronic device, such as Figure 6 As shown, it includes a processor 601, a communication interface 602, a memory 603 and a communication bus 604, wherein the processor 601, the communication interface 602, and the memory 603 communicate with each other through the communication bus 604.
[0137] Memory 603, used for storing computer programs;
[0138] The processor 601 is used to implement the above steps when executing the program stored in the memory 603.
[0139] The communication bus mentioned in the above electronic device 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.
[0140] The communication interface is used for communication between the above electronic device and other devices.
[0141] The memory may include a random access memory (RAM) or a non-volatile memory (NVM), such as at least one disk memory. Optionally, the memory may also be at least one storage device located away from the aforementioned processor.
[0142] 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.
[0143] In another embodiment of the present invention, a computer-readable storage medium is provided, in which a computer program is stored. When the computer program is executed by a processor, the steps of any of the above methods are implemented, including the following contents.
[0144] A large language model is called to obtain training data, wherein the training data includes a training text and a chronology of major events of major characters in the training text, wherein the chronology is used to list the important events and action trajectories experienced by the characters in the entire text in chronological order; the initial generation model is trained using the training text and the chronology of major events corresponding to the training text to obtain a target generation model, so that the target generation model learns the ability to extract a chronology of major events from the text; the target text to be identified is input into the target generation model, and a chronology of major events of major characters in the target text output by the target generation model is obtained, wherein the text category of the target text is the same as that of the training text.
[0145] Optionally, calling a large language model to obtain training data includes: calling a large language model to extract major characters in a setting text, wherein the setting text includes a plurality of sequentially arranged chapter texts; calling a large language model to extract phased goals of the major characters in the chapter texts, and generating a phased chronology of major events for the chapter texts, wherein the phased goals represent specific tasks of the major characters in each plot stage, and the phased chronology of major events is used to record the events and achievements of the major characters in each stage in chronological order; calling a large language model to integrate a plurality of phased chronologies of major events to obtain a complete chronology of major events for the setting text; using the setting text as a training text, and using the complete chronology of major events for the setting text as the chronology corresponding to the training text.
[0146] Optionally, calling a large language model to extract the phased goals of the main characters in the chapter text and generating a phased chronology of major events in the chapter text includes: inputting the chapter text and preset prompt words into the large language model to obtain the phased goals of the main characters in the set text output by the large language model; inputting the phased goals of the main characters into the large language model to obtain at least one sub-event; merging related sub-events into a main event; and sorting the main events in chronological order from early to late to obtain a phased chronology of major events in the chapter text.
[0147] Optionally, calling a large language model to integrate multiple phased chronologies to obtain a complete chronology of major events for the set text includes: calling a large language model to collect phased chronologies of major events in all chapters in the set text; sorting the main events in multiple phased chronologies in chronological order from early to late; merging related main events into one major event; and generating a complete chronology of major events for the set text based on the merged major events.
[0148] Optionally, after obtaining a complete chronology of major events in the setting text, the method further includes: inputting the complete chronology of major events into a large language model to obtain the ultimate goal of the main characters in the setting text output by the large language model, wherein the ultimate goal is the ultimate purpose pursued by the main characters in the entire story line; after merging related sub-events into a main event, the method further includes: grading the importance of the main events according to the degree of influence of the main events on the phased goals; after merging related main events into a major event, the method further includes: grading the importance of the major events according to the degree of influence of the major events on the ultimate goal.
[0149] Optionally, the method also includes: using the set text as the training text, and using the complete chronology of major events, the ultimate goals of the main characters in the set text, and the importance levels of major events as annotation information to train a target generation model; inputting the target text into the target generation model to obtain the ultimate goals and chronology of major events of the main characters in the target text, as well as the importance levels of major events in the chronology, which are output by the target generation model.
[0150] Optionally, the method further includes: inputting the target text and preset characters in the target text into a target generation model to obtain a chronology of major events of the preset characters output by the target generation model, wherein the chronology of major events of the preset characters includes event details of each major event.
[0151] In another embodiment of the present invention, a computer program product including instructions is provided, which enables the computer to execute any one of the methods in the above embodiments when the computer program product is executed on the computer.
[0152] In the above embodiments, it can be implemented in whole or in part by software, hardware, firmware or any combination thereof. When implemented by 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 invention is generated in whole or in part. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions can 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 can be transmitted from a website site, computer, server or data center to another 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.). The computer-readable storage medium can 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 can 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 hard disk Solid State Disk (SSD)), etc.
[0153] It should be noted that, in this article, relational terms such as "first" and "second" are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the existence of other identical elements in the process, method, article or device including the elements.
[0154] The foregoing is merely a specific embodiment of the present invention, which enables those skilled in the art to understand or implement the present invention. Various modifications to these embodiments will be apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the present invention. Therefore, the present invention will not be limited to the embodiments shown herein, but rather to the widest scope consistent with the principles and novel features claimed herein.
Claims
1. A method for extracting a chronology of important events in a text, characterized in that: The method comprises: Calling a large language model to obtain training data, wherein the training data includes a training text and a chronology of major events of major characters in the training text, wherein the chronology is used to list the important events and action trajectories experienced by the characters in the entire text in chronological order; The initial generation model is trained using the training text and the chronology of major events corresponding to the training text to obtain a target generation model, so that the target generation model learns the ability to extract the chronology of major events from the text; The target text to be recognized is input into the target generation model, and a chronology of major events of major characters in the target text is obtained as output by the target generation model, wherein the text category of the target text is the same as that of the training text.
2. The method according to claim 1, characterized in that Calling a large language model to obtain training data includes: Calling the large language model to extract main characters in a setting text, wherein the setting text includes a plurality of sequentially arranged chapter texts; Calling the large language model to extract the phased goals of the main characters in the chapter text, and generating a phased chronology of major events in the chapter text, wherein the phased goals represent the specific tasks of the main characters in each plot stage, and the phased chronology of major events is used to record the events and achievements of the main characters in each stage in chronological order; Calling the large language model to integrate the multiple phased chronologies to obtain a complete chronology of the set text; The set text is used as the training text, and the completeness chronology of the set text is used as the chronology of the training text.
3. The method according to claim 2, characterized in that Calling the large language model to extract the phased goals of the main characters in the chapter text and generating a phased chronology of major events in the chapter text includes: Inputting the chapter text and the preset prompt words into the large language model to obtain the phased goals of the main characters in the set text output by the large language model; Inputting the phased goal of the main character into the large language model to obtain at least one sub-event; Merge related sub-events into one main event; The main events are sorted in order from earliest to latest to obtain a chronological list of major events in the chapter text.
4. The method according to claim 2, characterized in that: The large language model is called to integrate the multiple phased chronologies to obtain a complete chronology of the set text, including: Calling the large language model to collect a chronology of major events in all chapters of the setting text; Sorting the main events in the multiple chronological tables of major events in order from earliest to latest; Merging the associated main events into one large event; A complete chronology of events for the setting text is generated based on the merged major events.
5. The method according to claim 3, characterized in that: After obtaining the complete chronology of the setting text, the method further includes: inputting the complete chronology of the setting text into the large language model to obtain the ultimate goal of the main character in the setting text output by the large language model, wherein the ultimate goal is the final goal pursued by the main character in the entire story line; After merging the associated sub-events into a main event, the method further includes: grading the main event in terms of importance according to the degree of influence of the main event on the phased goal; After merging the associated main events into one major event, the method further includes: grading the importance of the major event according to the impact of the major event on the ultimate goal.
6. The method according to claim 5, characterized in that The method further comprises: The setting text is used as a training text, and the completeness chronology, the ultimate goals of the main characters in the setting text, and the importance levels of the major events are used as annotation information to train a target generation model; The target text is input into the target generation model, and the ultimate goals and chronology of major events in the target text, as well as the importance levels of major events in the chronology, are output by the target generation model.
7. The method according to claim 6, characterized in that The method further comprises: The target text and the preset characters in the target text are input into the target generation model to obtain a chronology of major events of the preset characters output by the target generation model, wherein the chronology of major events of the preset characters includes event details of each major event.
8. A device for extracting a chronology of important events in a text, characterized in that: The device comprises: A calling module, used for calling a large language model to obtain training data, wherein the training data includes a training text and a chronology of major events of major characters in the training text, wherein the chronology is used for listing important events and action trajectories experienced by the characters in the entire text in chronological order; A training module, used to train an initial generation model using the training text and the chronology of major events corresponding to the training text to obtain a target generation model, so that the target generation model learns the ability to extract the chronology of major events from the text; The input-output module is used to input the target text to be recognized into the target generation model to obtain a chronology of major events of the main characters in the target text output by the target generation model, wherein the text category of the target text is the same as that of the training text.
9. An electronic device, characterized in that: It includes a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory communicate with each other through the communication bus; Memory, used to store computer programs; A processor, for implementing the method steps described in any one of claims 1 to 7 when executing a program stored in a memory.
10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the method steps described in any one of claims 1 to 7 are implemented.