An intelligent script generation and tour guidance system based on the characteristics of urban culture and tourism

Through the intelligent script generation and tour guidance system, the problem of the existing system ignoring the cultural relationship between attractions is solved, and a deeper cultural experience and optimized tour path is achieved, which enhances tourists' immersion and interactivity.

CN119311969BActive Publication Date: 2025-04-01NANJING UNIV OF INFORMATION SCI & TECH
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202411847520.6
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-12-16
Publication Date
2025-04-01
Estimated Expiration
2044-12-16

AI Technical Summary

Technical Problem

The existing tourist route planning system ignores the cultural background and historical relationships between attractions and cannot effectively enhance tourists' immersive experience.

Method used

Design an intelligent script generation and tour guidance system, providing interactive script guidance by establishing a knowledge graph, generating worldview and protagonist settings, generating scenic spot scripts, evaluating script fluency, path selection based on NSGA-II algorithm and LLM script interpretation.

Benefits of technology

It improves the experience of tourists, and provides a coherent historical and cultural context by identifying the cultural relevance between attractions; optimizes the tour path, combines cultural background and tourists' interests, and achieves multi-objective path optimization; enhances the interactiveness and fun of the tour process, and adapts to tourists' real-time behavior through dynamic script interpretation.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119311969B_ABST
    Figure CN119311969B_ABST
Patent Text Reader

Abstract

The present invention provides an intelligent script generation and tour guidance system based on the characteristics of urban cultural tourism, including: a database establishment module for establishing a database containing scenic spot data; a data generation module for generating a world view and a protagonist setting; a scenic spot script generation module for generating a scenic spot script; a fluency evaluation module for evaluating the fluency of the script; a path selection module for path selection based on an NSGA‑II algorithm; and a script interpretation module for performing LLM script interpretation. The present invention realizes multi-objective path optimization based not only on geographical distance, but also on cultural background and tourist interests. Tourists can visit the most relevant and culturally valuable scenic spots in the shortest time.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to an intelligent script generation and tour guidance system based on the cultural and tourism characteristics of a city. Background Art

[0002] Existing travel route planning mostly focuses on the shortest path or the most convenient mode of transportation, ignoring the deep connection between attractions in terms of cultural background, historical connections, etc. Modern tourists not only pursue efficient tour experience, but also hope to enhance the tour experience through deeper cultural interpretation. However, current travel recommendation systems are mostly based on geographic location or user historical preferences, lacking in-depth consideration of the relevance and cultural factors between attractions. In addition, existing systems rarely provide interactive script guidance, which cannot effectively enhance tourists' immersive experience. Summary of the invention

[0003] Purpose of the invention: The technical problem to be solved by the present invention is to provide an intelligent script generation and tour guidance system based on the characteristics of urban cultural tourism, in view of the shortcomings of the prior art, including:

[0004] A database establishment module is used to establish a database containing scenic spot data;

[0005] Data generation module, used to generate world view and protagonist settings;

[0006] The scenic spot script generation module is used to generate scenic spot scripts;

[0007] Fluency Assessment Module, used to assess script fluency;

[0008] Path selection module, used for path selection based on NSGA-II algorithm;

[0009] The script interpretation module is used for LLM script interpretation.

[0010] The establishment of a database containing scenic spot data specifically includes: before planning a tour route, first construct a knowledge graph containing scenic spots, first collect the characteristics of each scenic spot, define the i-th scenic spot Features include historical background , Cultural Characteristics 、Scenic area facilities and geographic location ,in , represents the i-th scenic spot The longitude, represents the i-th scenic spot The latitude, represents the recommended visiting time for the i-th scenic spot, the i-th scenic spot Represented as a multidimensional vector:

[0011]

[0012] By building a knowledge graph, the background information of scenic spots and attractions is structured and stored in the database.

[0013] The database establishment module is also used to: set the knowledge graph to consist of a node set and edge set , where each edge Indicates the i-th scenic spot With the jth attraction The relationship between, n represents the total number of nodes; each node in the knowledge graph Indicates a scenic spot, side Indicates the connection between attractions.

[0014] The generation of the world view and the setting of the protagonist specifically includes: using the RAG retrieval enhancement generation technology, combining the information retrieved from the knowledge graph, using the prompt word prompt for the LLM large language model, generating a unified world view, and setting the generation of the world view to be generated by a global knowledge base It includes comprehensive background information on all cities and attractions:

[0015]

[0016] Identify the protagonist of the story ,main character The settings include identity ,character and background story , forming a vector containing the features:

[0017] .

[0018] The generating of the scenic spot script specifically includes: using RAG search enhancement generation technology to search for each scenic spot Based on the retrieved background information, for each scenic spot ,generate A collection of different scripts , Indicates the kth script; the script has a unified protagonist As the center, ensure the coherence of the plot and the consistency of the background. It is expressed as:

[0019]

[0020] in represents the kth script The plot; represents the kth script dialogue; represents the kth script The time is calculated as:

[0021]

[0022] Among them, the number of characters is the total number of characters in the kth script text, Indicates average reading speed.

[0023] The evaluation of script fluency specifically includes: randomly selecting attractions , list the attractions A collection of all the optional scripts , select ; Retrieve the current attractions through the knowledge graph All adjacent candidate attractions , set the i-th With the jth attraction Connect to get the jth attraction The set of all possible scripts ; According to the current script and the hth scenario selected from the candidate scenario , using LLM technology, generate connection scripts based on prompt words , that is, combining the possible scripts of the current attraction with the possible scripts of the next attraction to form a complete story chain;

[0024] To evaluate the connection script The cohesion effect needs to calculate the fluency score , Indicates the number of points from the i-th scenic spot The kth script to the jth attraction The coherence between the h-th scripts is given by:

[0025] ,

[0026] in Plot coherence score , Role Interaction Rating , spatiotemporal coherence score and immersion score The weight of .

[0027] The path selection based on the NSGA-II algorithm specifically includes:

[0028] Step 1, initialize the population: First initialize the population, set each path to contain scenic spots, and each individual path is composed of selected scenic spots. Given a path ,in is the mth scenic spot on the path, and the total length of the path is ;

[0029] Step 2, for each individual path, calculate the following objective function:

[0030] Fluency ,in It is the i-th attraction and the i+1th attraction Fluency scores between;

[0031] Time target ,in It is the i-th attraction Go to the i+1th attraction The travel time, is at the i-th attraction The duration of the script;

[0032] Script time ratio target ;

[0033] Step 3: Compare non-dominated sorting and congestion degree: First, perform non-dominated sorting on all paths to obtain more than two dominance levels; set the initialized path and path , if the path Non-inferior to the path on all objectives , that is, the path Fluency Greater than , time target Less than , script time ratio target Greater than , and strictly outperforms the path in at least one objective , that is, the path Fluency Much greater than or time target Much smaller than Or script time ratio target Much greater than , then determine the path Non-dominated other paths ; For each individual path in the dominance level, calculate the congestion degree, for the i-th path and the jth path The mth target , the i-th path The congestion The calculation formula is:

[0034]

[0035] in and are the i-th path in the m-th target The maximum and minimum values ​​of and is the i+1th path after path sorting The target value and the i-1th path Target value of

[0036] Step 4, Crossover operation: Select two parent paths and Perform a crossover operation to generate two subpaths and ; Then in the path and In the random selection of cross-points , c takes the value of 1~m, and the scenic spot after the exchange intersection is:

[0037] ,

[0038] ,

[0039] Mutation operation: The mutation operation will randomly change the attractions or the script of the attractions in the path, select an attraction and mutate it;

[0040] For the path after mutation operation , the path will be recalculated The objective function of

[0041] Elite retention strategy: retain the best top paths and ensure the best forward The paths are not lost in the next generation; assuming that there are Optimal solution ,in represents the Nth optimal solution, Representing the elite population, The optimal solution will directly enter the next generation;

[0042] Update the population: When updating the population, merge the paths of the parent and child generations, perform non-dominated sorting, and select the top M optimal paths. The update rule is:

[0043]

[0044] in Representing the new generation population, represents the parent population, represents the offspring population, It is an elite retention strategy operation; It is a non-dominated sorting operation;

[0045] Final solution selection: Choose a path that meets user needs , the path And the final script script_final is saved.

[0046] The LLM script interpretation specifically includes: designing prompts for the LLM, setting director agents, actor agents and player agents;

[0047] The director agent generates a plot outline and script based on predefined plot goals, assigns the order in which the characters speak, instructs the actor agent to generate dialogue content that meets the plot goals, and checks whether the current plot has achieved the established goals;

[0048] The director's agent will be based on the current attractions The script _ Set story goals ,in Indicates the nth target and sets the script _ Converted to multi-round dialogue script format , where the kth round of dialogue , t, including roles and the role Expected content of speech ; When generating a dialogue script, the director agent will obtain the basic information of all the characters in the scene to ensure that the generated plot conforms to the character's personalized information; the script generated by the director agent , only as a plot summary, the actual speech content The generation of is completed by the actor agent; to ensure that the generated content meets the plot objectives , the Director Agent provides instructions to the Actor Agent , including scripts _ , Overview of the roles that will be speaking and keywords :

[0049]

[0050] After each round of dialogue, the director agent queries the actual dialogue history To determine the current plot goal Is it completed? Indicates the content of the pth dialogue; if completed, move on to the next plot goal ; If not completed, continue generating the current plot goal;

[0051] The actor agent is used to generate the actual dialogue content. Each actor agent has an independent role profile, memory database and role relationship database; the role profile contains the basic information of the role; the memory database records the past events and perceptions of the role; the role relationship database records the relationship between the roles; the dialogue log The format of narrative dialogue is adopted; when the content of the dialogue log reaches a threshold, the early dialogue will be summarized as key points and re-added to the top of the log L; when generating the role response content a, the actor agent retrieves relevant documents from the role archive, memory database and role relationship database, and combines the instructions of the director agent, the script background and the dialogue history to generate the response content.

[0052] The present invention also provides an electronic device, comprising a processor and a memory, wherein the memory stores program code, and when the program code is executed by the processor, the processor runs the system.

[0053] The present invention also provides a storage medium storing a computer program or instruction. When the computer program or instruction is executed on a computer, the system is executed.

[0054] The present invention has the following beneficial effects: 1. Improving the tourist experience: By constructing a knowledge graph and LLM technology, the cultural relevance between scenic spots is identified, so that tourists can feel a more coherent historical and cultural context during the tour, rather than just a simple visit to the scenic spot.

[0055] 2. Path optimization: This invention not only combines geographical distance, but also cultural background and tourists’ interests to achieve multi-objective path optimization. Tourists can visit the most relevant and culturally valuable attractions in the shortest time.

[0056] 3. Interactive Guidance: Automatically generated scripts provide in-depth cultural interpretations of each attraction, enhancing visitors’ sense of immersion. The scripts can be dynamically adjusted based on visitors’ real-time behavior, increasing interactivity and fun during the tour.

[0057] 4. Dynamic script interpretation: Through the collaborative work of director agents, actor agents and player agents, the script content is dynamically generated and adjusted to adapt to the real-time behavior and choices of tourists, further enhancing the interactivity and personalized experience of the tour. BRIEF DESCRIPTION OF THE DRAWINGS

[0058] Figure 1It is a flow chart of the method of the present invention. DETAILED DESCRIPTION

[0059] The present invention will be further described in detail below in conjunction with the accompanying drawings and specific embodiments, and the above and / or other advantages of the present invention will become more clear.

[0060] like Figure 1 As shown, the embodiment of the present invention provides an intelligent script generation and tour guidance system based on the characteristics of urban culture and tourism, including:

[0061] A database establishment module is used to establish a database containing scenic spot data;

[0062] Before planning a tour route, we need to build a knowledge graph containing attractions. First, we collect the characteristics of each attraction and define the i-th attraction. characteristics, including historical background , Cultural Characteristics 、Scenic area facilities and geographic location ,in , represents the i-th scenic spot The longitude, represents the i-th scenic spot The latitude, represents the recommended visiting time for the i-th scenic spot, the i-th scenic spot Represented as a multidimensional vector:

[0063]

[0064] By building a knowledge graph, the background information of scenic spots and attractions is structured and stored in the database.

[0065] Set the knowledge graph to consist of a set of nodes and edge set , where each edge Indicates the i-th scenic spot With the jth attraction The relationship between nodes (such as adjacent, historical association, etc.), n represents the total number of nodes. Each node in the knowledge graph Indicates a scenic spot, side Indicates the connection between attractions.

[0066] Data generation module, used to generate world view and protagonist settings;

[0067] Using RAG (Retrieval-Augmented Generation) technology, combined with the information retrieved from the knowledge graph, the LLM (Large Language Model) uses the prompt word prompt to generate a unified world view. The generation of the world view is assumed to be based on a global knowledge base. It includes comprehensive background information on all cities and attractions:

[0068]

[0069] Identify the protagonist of the story ,main character The settings include identity ,character and background story , forming a vector containing multiple features:

[0070]

[0071] main character The setting will affect the direction of subsequent plot generation and the selection of attractions.

[0072] The scenic spot script generation module is used to generate scenic spot scripts;

[0073] To ensure the accuracy of the script for each attraction in terms of history, culture, geography and plot, we first used RAG technology to search for each attraction. Based on the retrieved background information, for each scenic spot ,generate A collection of different scripts , represents the kth script; these scripts have a unified protagonist As the center, ensure the coherence of the plot and the consistency of the background. It is expressed as:

[0074]

[0075] in represents the kth script Plot: Describes the main storyline, including the protagonist's actions in the attraction, the conflicts encountered and the solutions. The plot will be designed based on the historical background, cultural elements and geographical features of the attraction, and ensure that it conforms to the atmosphere and historical authenticity of the attraction.

[0076] represents the kth script Dialogue: The dialogue between the protagonist and other virtual characters or attraction elements further promotes the plot. The dialogue content will be generated based on historical figures, local dialects, cultural characteristics and other factors, making tourists feel more real and immersive.

[0077] represents the kth script Time: The duration of each script, that is, the time required to perform the script, in minutes, calculated using the formula:

[0078]

[0079] Among them, the number of characters is the total number of characters in the kth script text, Indicates the average reading speed, which is usually 300 to 400 characters per minute.

[0080] Fluency Assessment Module, used to assess script fluency;

[0081] Randomly select attractions , list the attractions A collection of all the optional scripts , select ; Retrieve the current attractions through the knowledge graph All adjacent candidate attractions , set the i-th With the jth attraction Connect to get the jth attraction The set of all possible scripts According to the current script and the hth scenario selected from the candidate scenario , using LLM technology to generate connection scripts based on prompt words , that is, combining the possible scripts of the current attraction with the possible scripts of the next attraction to form a complete story chain. In this way, there will be a logical transition between the two scripts, allowing tourists to have a seamless experience when moving from one attraction to another.

[0082] To evaluate the connection script The cohesion effect needs to calculate the fluency score , Indicates the number of points from the i-th scenic spot The kth script to the jth attraction The coherence between the hth scripts of the story is measured. The fluency score reflects whether the transition between the two scripts is natural and whether the plot, characters and interactions are connected smoothly. The calculation is completed using LLM technology, which uses LLM to complete the questionnaire scoring, involving the plot coherence score , Role Interaction Rating , spatiotemporal coherence score , immersion score The four dimensions have a full score of 5 points, and the average value of the corresponding dimension questions is taken. The formula is:

[0083] ,

[0084] in Plot coherence score , Role Interaction Rating , spatiotemporal coherence score and immersion score The weight can be adjusted according to actual needs to meet .

[0085] Path selection module, used for path selection based on NSGA-II (Non-dominated Sorting Genetic Algorithm-II) algorithm;

[0086] The path selection based on the NSGA-II algorithm specifically includes:

[0087] Initialize the population: First initialize the population, set each path to contain a number of scenic spots, each individual (path) is composed of selected scenic spots, given a path ,in is the mth scenic spot on the path, and the total length of the path is ,in ;

[0088] For each individual path, the following objective function needs to be calculated:

[0089] Fluency ,in It is the i-th attraction and the i+1th attraction Fluency score between attractions; Evaluate the connectivity and coherence between all attractions in the path, based on the script fluency score of each attraction;

[0090] Time target ,in It is the i-th attraction Go to the i+1th attraction The travel time, is at the i-th attraction The duration of the script;

[0091] Script time ratio target .

[0092] Then, non-dominated sorting and crowding comparison are performed: First, non-dominated sorting is performed on all paths to obtain multiple "Pareto Fronts". Set the path obtained by initialization Dominant Path , if the path Non-inferior to the path on all objectives , that is, the path Fluency Greater than , time target Less than , script time ratio target Greater than , and strictly outperforms the path in at least one objective , that is, the path Fluency Much greater than or time target Much smaller than Or script time ratio target Much greater than (In this example, if it is more than 2 times, it is considered to be much greater than). For each individual path in the dominance level, the crowding degree is calculated. The crowding degree refers to the degree to which the path is "squeezed" by other individuals in the target space, which is used to guide diversity maintenance. For the i-th path and the jth path The mth target , the i-th path The congestion The calculation formula is:

[0093]

[0094] in and are the i-th path in the m-th target The maximum and minimum values ​​of and is the i+1th path after path sorting The target value and the i-1th path Target value of

[0095] Intersection operation: Select two parent paths and Perform a crossover operation to generate two subpaths and ; Then in the path and In the random selection of cross-points , c takes the value of 1~m, and the scenic spot after the exchange intersection is:

[0096]

[0097]

[0098] Mutation operation: The mutation operation will randomly change the attractions in the path. Select an attraction and mutate it, for example: select two attractions and , swap their positions and randomly select a scenic spot to delete, or insert a new one in the path;

[0099] For the path after mutation operation , the path will be recalculated The objective function of .

[0100] Elite retention strategy: retain the best top paths and ensure the best forward The paths are not lost in the next generation; assuming that there are Optimal solution ,in represents the Nth optimal solution, Represents the Elite Population. The optimal solution will directly enter the next generation.

[0101] Update the population: When updating the population, merge the paths of the parent and child generations, perform non-dominated sorting, and select the top M optimal paths. The update rule is:

[0102]

[0103] in Represents the Next Generation Population, represents the parent population, represents the offspring population, It is an elite retention strategy operation, which ensures that in each generation, the best individuals (i.e., elite solutions) will be retained and directly enter the next generation; It is a non-dominated sorting operation.

[0104] Final solution selection: Finally, a path that meets user needs is selected, usually the path with the best fluency in the objective function and the closest time to the target. This path can be selected from the final Pareto front solution set. And the final script script_final is saved.

[0105] Script interpretation module, used for LLM script interpretation;

[0106] Artificially design prompts for LLM, and set director agents (Director Agent), actor agents (ActorAgent) and player agents (Player Agent).

[0107] The main responsibilities of the Director Agent are to generate plot outlines and scripts based on predefined plot objectives, assign roles to speak in order, instruct the Actor Agent to generate dialogue content that meets the plot objectives, and check whether the current plot has achieved the established objectives. The script _ Set story goals ,in Indicates the nth target and sets the script _ Converted to multi-round dialogue script format , where the kth round of dialogue , t, including roles and the role Expected content of speech When generating a dialogue script, the director agent will obtain the basic information of all the characters in the scene (including character descriptions, character relationships, impressions, memories related to the current plot goals, etc.) to ensure that the generated plot conforms to the character's personalized information. , only as a plot summary, the actual speech content The generation of is done by the actor agent. To ensure that the generated content meets the plot objectives , the Director Agent provides instructions to the Actor Agent , including scripts _ , Overview of the roles that will be speaking and several keywords :

[0108]

[0109] After each round of dialogue, the director agent queries the actual dialogue history To determine the current plot goal Is it completed? Indicates the content of the pth dialogue. If completed, move to the next plot goal ; If not completed, continue generating the current plot goal.

[0110] Actor agents are used to generate actual dialogue content. Each actor agent has an independent character profile, memory database, and character relationship database. The character profile contains basic information about the character (such as name, description); the memory database records the character's past events and perceptions; and the character relationship database records the relationships between characters. In order to enhance the character's performance, the actor agent interprets this information from the character's perspective in a first-person "monologue", and updates the character impressions and relationships in the memory database as the plot develops. Dialogue log The format of narrative dialogue is adopted. The actor agent obtains environmental events, character speeches and other descriptive information from the log. When the content of the dialogue log reaches p=50, the early dialogue Will be summarized into key points , and rejoin the first position of log L, where Indicates point 5; when generating role response content a, the actor agent retrieves relevant documents from the role archive, memory database, and role relationship database, and generates response content in combination with the director agent's instructions, script background, and dialogue history.

[0111] The player agent allows human users to freely insert dialogue into the plot, while the director agent dynamically adjusts the plot based on the player's behavior to keep the story moving forward.

[0112] In a specific embodiment of the present invention, a smart script generation and tour guidance system based on the city's cultural and tourism characteristics is provided, comprising the following steps:

[0113] Step 1: The historical background, cultural characteristics, geographical location and other information of Nanjing’s Sun Yat-sen Mausoleum, Confucius Temple, Presidential Palace and other scenic spots are stored in a structured manner in the database to form a knowledge graph;

[0114] Step 2, get the script world view and character settings that are easy to connect the entire Nanjing attractions, such as "At the intersection of modern technology and ancient wisdom, there is a secret organization - "Time Guardians". This organization is composed of a group of guardians who can travel through different historical periods and protect historical and cultural heritage. They have a special ability to enter a parallel world called "Historical Fantasy", where the most glorious cultural heritage and the most moving stories in history are preserved...";

[0115] Step 3, obtaining several story scripts centered around the protagonist in various scenic spots;

[0116] Step 4: Get the connection script generated by matching the scripts between different scenic spots and the fluency between the two scripts, which provides a quantitative indicator for the subsequent path selection;

[0117] Step 5, get a set of optional travel routes, for example, if you want a 5-hour tour route, the route of "Sun Yat-sen Mausoleum - Presidential Palace" will be recommended, and the script of visiting these two attractions will be saved;

[0118] Step 6. Follow the guidance of the plot, have conversations with the characters, and immerse yourself in the historical and cultural characteristics of the scenic spot.

[0119] The present invention provides an intelligent script generation and tour guidance system based on the characteristics of urban cultural tourism. There are many methods and ways to implement the technical solution. The above is only a preferred embodiment of the present invention. It should be pointed out that for ordinary technicians in this technical field, without departing from the principle of the present invention, several improvements and modifications can be made, and these improvements and modifications should also be regarded as the protection scope of the present invention. All components not specified in this embodiment can be implemented by existing technologies.

Claims

1. An intelligent script generation and tour guidance system based on the characteristics of urban culture and tourism, characterized in that: include: A database establishment module is used to establish a database containing scenic spot data; Data generation module, used to generate world view and protagonist settings; The scenic spot script generation module is used to generate scenic spot scripts; Fluency Assessment Module, used to assess script fluency; Path selection module, used for path selection based on NSGA-II algorithm; Script interpretation module, used for LLM script interpretation; The establishment of a database containing scenic spot data specifically includes: before planning a tour route, a knowledge graph containing scenic spots is first constructed, first the characteristics of each scenic spot are collected, and the i-th scenic spot S is defined. i The characteristics include historical background H i 、Cultural characteristics i 、Scenic spot facilities F i and geographical location i , where L i =(x i ,y i ), x i represents the i-th scenic spot S i Longitude, y i represents the i-th scenic spot S i Latitude, T i represents the recommended visiting time of the i-th scenic spot, and the i-th scenic spot S i Represented as a multidimensional vector: S i =(H i ,C i ,F i ,L i ,T i ) By building a knowledge graph, the background information of scenic spots and attractions is structured and stored in the database; The database establishment module is also used to: set the knowledge graph to consist of a node set G = {S1, S2, ..., S n } and edge set E = {e ij }, where each edge e ij represents the i-th scenic spot S i With the jth attraction S j The relationship between n and n represents the total number of nodes; each node S in the knowledge graph i Represents a scenic spot, edge e ij Indicates the connection between attractions; The generation of the world view and the setting of the protagonist specifically includes: using the RAG retrieval enhancement generation technology, combining the information retrieved from the knowledge graph, using the prompt word prompt for the LLM large language model, generating a unified world view, and setting the generation of the world view to be represented by a global knowledge base W, which includes the comprehensive background information of all cities and attractions: W={S1,S2,...,S n } Determine the protagonist A of the story. The setting of protagonist A includes identity I A 、Character C A and background story B A , forming a vector containing the features: A=(I A ,C A ,B A ); The generating of the scenic spot script specifically includes: using the RAG search enhancement generation technology to search for each scenic spot S i Based on the retrieved background information, for each scenic spot S i , generate k different script sets B i = {b i1 ,b i2 ,...,b ik }, b ik represents the kth script; the script is centered on the unified protagonist A to ensure the coherence of the plot and the consistency of the background. Each script b ik It is expressed as: b ik =(P ik ,D ik ,T ik ) Where P ik represents the kth script b ik The plot; D ik represents the kth script b ik Dialogue; T ik represents the kth script b ik The time is calculated as: Among them, the number of characters T1 is the total number of characters in the k-th script text, and T2 represents the average reading speed; The evaluation of the script fluency specifically includes: randomly selecting a scenic spot S i , list the attractions S i All optional scripts set B i = {b i1 ,b i2 ,...,b ik }, select b ik ; Through the knowledge graph, retrieve the current scenic spot S i All adjacent candidate attractions S next ={S1,S2,...,S n }, set the i-th scenic spot S i With the jth attraction S j Connect to get the jth attraction S j The set B of all possible scripts j = {b j1 ,b j2 ,...,b jk }; According to the current script b ik and the hth scenario b selected from the scenarios of the candidate attractions jh , using LLM technology, generate connection script b according to prompt words ik,jh , that is, combining the possible scripts of the current attraction with the possible scripts of the next attraction to form a complete story chain; To evaluate the connection script b ik,jh The cohesion effect needs to calculate the fluency score L ik,jh , L ik,jh Indicates that from the i-th scenic spot S i The k-th script to the j-th attraction S j The coherence between the h-th scripts is given by: L ik,jh =w P S P +w C S C +w T S T +w I S I , where w P , w C , w T , w I Represents the plot coherence score S P , Role Interaction Rating S C , spatiotemporal coherence score S T and immersion score S I The weight satisfies w P +w C +w T +w I =1; The path selection based on the NSGA-II algorithm specifically includes: Step 1, initialize the population: First initialize the population, set each path to contain scenic spots, each individual path is composed of selected scenic spots, given a path P = {S1, S2, ..., S m }, where S m is the mth scenic spot on the path, and the total length of the path is m; Step 2, for each individual path, calculate the following objective function: Fluency Where L i,i+1 is the i-th attraction S i and the i+1th attraction S i+1 Fluency scores between; Time target where t i,i+1 is the i-th attraction S i Go to the i+1th attraction S i+1 The travel time, is at the i-th attraction S i The duration of the script; Script time ratio target Step 3, perform non-dominated sorting and crowding comparison: First, perform non-dominated sorting on all paths to obtain multiple dominance levels; set the initialized paths P1 and P2, if path P1 is not inferior to path P2 in all goals, that is, the fluency F1 of path P1 is greater than P2, the time goal F2 is less than P2, the script time ratio goal F3 is greater than P2, and is strictly superior to path P2 in at least one goal, that is, the fluency F1 of path P1 is greater than P2 or the time goal F2 is less than P2 or the script time ratio goal F3 is greater than P2, then it is determined that path P1 does not dominate other paths P2; for individual paths in each dominance level, calculate the crowding, for the i-th path P i and the jth path P j The mth target F m , the i-th path P i The congestion degree d i The calculation formula is: in and are the i-th path P in the m-th target i The maximum and minimum values ​​of F m,i+1 and F m,i-1 is the i+1th path P after path sorting i+1 The target value and the i-1th path P i-1 Target value of Step 4, crossover operation: select two parent paths P1 and P2 for crossover operation to generate two child paths P1 ′ and P2 ′ ; Then, in paths P1 and P2, randomly select intersection attractions S c , c takes the value of 1 to m, and the scenic spot after the exchange intersection is: P′1={S1,S2,...,S c ,S c+1 ,...,S m }, P′2={S1,S2,...,S c ,S c+1 ,...,S m }, Mutation operation: The mutation operation randomly changes the attractions in the path, selects an attraction and mutates it; For the path P after the mutation operation mutated , the path P will be recalculated mutated The objective function of Elite retention strategy: retain the best top N paths in the population and ensure that the best top N paths are not lost in the next generation; assume that there are N optimal solutions P in the population elite = {P1,P2,...,P N }, where P N represents the Nth optimal solution, P elite Representing the elite population, the N best solutions will directly enter the next generation; Update the population: When updating the population, merge the paths of the parent and child generations, perform non-dominated sorting, and select the top M optimal paths. The update rule is: P new =elitism(P elite )+non_dominated_sorting(P parent ∪P offspring ) Where P new represents the new generation population, P parent represents the parent population, P offspring Represents the offspring population, elitism is the elite retention strategy operation; non_dominated_sorting is the non-dominated sorting operation; Final solution selection: Choose a path P that meets user needs final , the path P final And the final script script_final is saved; The LLM script interpretation specifically includes: designing prompts for the LLM, setting director agents, actor agents and player agents; The director agent generates a plot outline and script based on predefined plot goals, assigns the order in which the characters speak, instructs the actor agent to generate dialogue content that meets the plot goals, and checks whether the current plot has achieved the established goals; The director agent will determine the current attractions S i Script script_S i Set the plot objective obective_S i ={O1,O2,...,O n }, where O n Indicates the nth target and sets the script script_S i Converted to multi-round dialogue script format The kth round of dialogue D k =(r i ,u i ), 1≤k≤t, including the role r i And the role i Expected content of speech i ; When generating a dialogue script, the director agent will obtain the basic information of all the characters in the scene to ensure that the generated plot conforms to the character's personalized information; the script generated by the director agent It is only used as a plot summary. The actual speech content u is generated by the actor agent. To ensure that the generated content meets the plot objective obective_S i , the director agent provides instructions I to the actor agent, including script script_S i , Synopsis(u) and Keywords of the role to be spoken: I=Instruction(script_S i ,Synopsis(u),Keywords) After each round of dialogue, the director agent queries the actual dialogue history {U1,U2,...,U p } to determine the current plot goal O i Is it completed? p Indicates the content of the pth dialogue; if completed, turn to the next plot goal O i+1 ; If not completed, continue generating the current plot goal; The actor agent is used to generate the actual dialogue content. Each actor agent has an independent role profile, memory database and role relationship database; the role profile contains the basic information of the role; the memory database records the past events and perceptions of the role; the role relationship database records the relationship between the roles; the dialogue log L = {U1,U2,...,U p }A narrative dialogue format is adopted; when the dialogue log content reaches a threshold, the early dialogue will be summarized as key points and re-added to the top of the log L; when generating the role response content a, the actor agent retrieves relevant documents from the role archive, memory database and role relationship database, and combines the director agent's instructions, script background and dialogue history to generate the response content.

2. An electronic device, characterized in that: The system comprises a processor and a memory, wherein the memory stores program codes, and when the program codes are executed by the processor, the processor runs the system as claimed in claim 1.

3. A storage medium, characterized in that: A computer program or instruction is stored, and when the computer program or instruction is executed on a computer, the system as claimed in claim 1 is executed.

Citation Information

Patent Citations

  • Scenario generation method and device based on affair graph, equipment and storage medium

    CN117993493A