Itinerary planning method, system, device, product and medium based on natural language
Through the combination of a two-layer large language model based on natural language and the interest point data set, clustering, sorting, inversion exchange and cross-cluster replacement technologies are adopted, and the problem of difficulty in formulating multi-day itineraries and meeting user preferences in the existing technology is solved, and efficient and personalized itinerary planning is achieved.
Patent Information
- Application Number
- CN202510104793.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-01-23
- Publication Date
- 2025-05-02
- Estimated Expiration
- 2045-01-23
AI Technical Summary
The prior art is difficult to formulate a multi-day itinerary for users within a reasonable time frame, and cannot effectively meet the specific planning constraints and preferences of users.
The itinerary planning method based on natural language is adopted, and the user input text is analyzed through a two-layer large language model, and the interest point data set is combined for clustering and sorting. The target candidate list is generated using inversion exchange and cross-cluster replacement techniques, and the itinerary planning is finally determined through comprehensive itinerary scores.
It realizes a highly personalized, efficient and multi-day itinerary planning for users based on natural language input, which improves the quality and computing efficiency of itinerary planning.
Smart Images

Figure CN119539450B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of data mining technology, and in particular to a natural language-based itinerary planning method, system, device, product and medium. Background Art
[0002] In the process of tourists planning their trips, although various travel assistant applications provide rich points of interest data, when quickly making a comprehensive and personalized travel plan, the itinerary needs to be optimized according to the user's individual conditions and personal preferences. Therefore, it becomes crucial to develop automated algorithms that can accurately identify different and specific user preferences. Traditionally, this problem is conceptualized as a travel route design problem, which is a complex problem that is usually decomposed into two distinct but interrelated parts: the orientation problem and the group orientation problem. Both problems have received widespread attention and in-depth research. These algorithms usually involve designing optimization objectives to meet user or system requirements and seeking local optimal solutions using integer programming or metaheuristic methods. However, finding local optimal solutions significantly prolongs the solution process; secondly, a large number of constraints are manually set by the main users, which limits their practical application.
[0003] In recent years, large language models have made significant progress and have shown great potential in understanding user needs and reasoning. Therefore, many recent studies have focused on using large language models for planning tasks. Although large language models incorporate a large amount of knowledge, their planning results often fail to meet specific planning constraints and user preferences, which limits their practical application. In addition, existing methods often ignore the necessity of planning multi-day itineraries within a reasonable time frame, and the importance of understanding and meeting users' daily needs, such as prioritizing users' preferred points of interest, catering to time preferences and dining habits. Summary of the invention
[0004] The present invention aims to solve at least one of the technical problems existing in the related art. To this end, the present invention provides a natural language-based itinerary planning method, system, device, product and medium to provide users with travel itinerary planning based on natural language.
[0005] The present invention provides a natural language-based itinerary planning method, comprising:
[0006] S1: Obtaining point of interest information of a point of interest, and constructing a point of interest data set through the point of interest information;
[0007] S2: obtaining a user input text and a two-layer large language model including a first prediction layer and a second prediction layer, wherein the first prediction layer parses the user input text to obtain initial user demand parameters and user preferences, and the second prediction layer fine-tunes the initial user demand parameters according to the user preferences to obtain user demand parameters;
[0008] S3: clustering the points of interest through the point of interest data set to obtain an initial candidate list, calculating the cosine similarity of the point of interest information in the initial candidate list, calculating the point of interest scores of the points of interest in the candidate list through the cosine similarity, and sorting the initial candidate list according to the point of interest scores and the user demand parameters to obtain an intermediate candidate list;
[0009] S4: performing multiple inversion exchanges on the intermediate candidate list to obtain multiple inversion candidate lists, calculating the local optimal score of each of the inversion candidate lists, and performing cross-cluster replacement on the inversion candidate list with the highest local optimal score to obtain a target candidate list;
[0010] S5: Repeat S2 to S4 to generate a plurality of target candidate lists, and calculate the comprehensive itinerary score of each target candidate list, take the target candidate list with the highest comprehensive itinerary score as the itinerary list, and obtain the itinerary plan through the itinerary list.
[0011] According to the natural language based itinerary planning method provided by the present invention, step S1 further comprises:
[0012] S11: selecting a target software, and obtaining initial point of interest information of the point of interest in the target software;
[0013] S12: extracting and normalizing the initial interest point information to obtain interest point information, and constructing an interest point data set through the interest point information.
[0014] According to the natural language based itinerary planning method provided by the present invention, step S2 further comprises:
[0015] S21: setting an input prompt, the user inputs a natural language text according to the input prompt, and the natural language text is used as the user input text; obtaining a two-layer large language model, the two-layer large language model including a first prediction layer and a second prediction layer;
[0016] S22: The first prediction layer parses the user input text to obtain the initial user demand parameters and the user preferences including daily start time, daily maximum travel time, and visit duration compactness parameters;
[0017] S23: The second prediction layer fine-tunes the daily start time, daily maximum travel time and visit duration compactness parameters in the initial user demand parameters according to the user preferences to obtain the user demand parameters.
[0018] According to the natural language based itinerary planning method provided by the present invention, step S3 further comprises:
[0019] S31: clustering the points of interest according to the geographic information of the points of interest in the point of interest data set to obtain point of interest clusters, and selecting the point of interest clusters using a greedy time strategy to obtain an initial candidate list;
[0020] S32: calculating an embedded representation of the interest point information in the initial candidate list through the interest point data set, calculating the cosine similarity of the interest point information through the embedded representation, and calculating the interest point score of the interest point in the candidate list according to the cosine similarity;
[0021] S33: Sort the initial candidate list according to the interest point scores to obtain a sorted list, construct constraint conditions, and select from the sorted list according to the constraint conditions and the user demand parameters to obtain the intermediate candidate list.
[0022] According to the natural language based itinerary planning method provided by the present invention, step S4 further comprises:
[0023] S41: performing multiple inversion exchanges on the adjacent interest points in the intermediate candidate list to obtain multiple inversion candidate lists;
[0024] S42: Obtain the total travel time of the inversion candidate list, obtain the waiting time, the number of time-matching interest points and the number of time-unmatching interest points through the interest point data set, and calculate the local optimal score of each of the inversion candidate lists according to the waiting time, the number of time-matching interest points and the number of time-unmatching interest points;
[0025] S43: Obtain similar interest points in the set of interest points outside the cluster, use the similar interest points to replace the non-priority interest points in the inversion candidate list with the highest local optimal score, and calculate the local optimal score of the inversion candidate list. When the local optimal score is improved, retain the interest point replacement to obtain the target candidate list.
[0026] According to the natural language based itinerary planning method provided by the present invention, in step S5, after obtaining the itinerary list, a navigation software is selected and a travel path is generated using the navigation software, and the itinerary planning is obtained through the POI data set and the travel path.
[0027] The present invention also provides a natural language based itinerary planning system, comprising:
[0028] Point of interest data set module; used to obtain point of interest information of points of interest, and construct a point of interest data set through the point of interest information;
[0029] A two-layer large language model module is used to obtain a user input text and a two-layer large language model including a first prediction layer and a second prediction layer. The first prediction layer parses the user input text to obtain initial user demand parameters and user preferences. The second prediction layer fine-tunes the initial user demand parameters according to the user preferences to obtain user demand parameters.
[0030] An intermediate candidate list module is used to cluster the points of interest using the point of interest data set to obtain an initial candidate list, calculate the cosine similarity of the point of interest information in the initial candidate list, calculate the point of interest scores of the points of interest in the candidate list using the cosine similarity, and sort the initial candidate list according to the point of interest scores and the user demand parameters to obtain an intermediate candidate list;
[0031] The target candidate list module is used to perform multiple inversion exchanges on the intermediate candidate list to obtain multiple inversion candidate lists, calculate the local optimal score of each of the inversion candidate lists, and perform cross-cluster replacement on the inversion candidate list with the highest local optimal score to obtain a target candidate list;
[0032] Itinerary planning module: used to repeat S2 to S4 to generate multiple target candidate lists, calculate the comprehensive itinerary score of each target candidate list, take the target candidate list with the highest comprehensive itinerary score as the itinerary list, and obtain the itinerary plan through the itinerary list.
[0033] The present invention also provides an electronic device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the computer program, the steps of any of the above-mentioned natural language-based itinerary planning methods are implemented.
[0034] The present invention also provides a non-transitory computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the steps of any of the natural language-based itinerary planning methods described above.
[0035] The present invention also provides a computer program product, which includes a computer program stored on a non-transitory computer-readable storage medium, and the computer program includes program instructions. When the program instructions are executed by a computer, the computer can execute the steps of any of the natural language-based itinerary planning methods described above.
[0036] The above one or more technical solutions in the embodiments of the present invention have at least one of the following technical effects:
[0037] The present invention provides a natural language-based itinerary planning method, system, device, product and medium. By introducing a two-layer large language model, it can accurately and flexibly capture user needs and generate a highly controllable itinerary plan. And it can fully understand the itinerary preferences expressed by users in natural language to ensure that the itinerary is highly consistent with the user preferences. The points of interest in the itinerary planning are selected by comprehensively considering factors such as the score of the point of interest, the geographical location and the queuing time. Other points of interest that may be of interest are also introduced into the itinerary planning through cross-cluster replacement, and finally the itinerary planning with the highest comprehensive itinerary score is obtained. The present invention has significantly improved the itinerary planning quality and computational efficiency, and can provide users with a more personalized, efficient and demand-oriented multi-day city travel itinerary planning experience.
[0038] Additional aspects and advantages of the present invention will be given in part in the following description and in part will be obvious from the following description, or will be learned through practice of the present invention. BRIEF DESCRIPTION OF THE DRAWINGS
[0039] In order to more clearly illustrate the technical solutions in the present invention or the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0040] Figure 1 It is a flowchart of the natural language-based itinerary planning method provided by the present invention.
[0041] Figure 2 It is a structural schematic diagram of the natural language-based itinerary planning system provided by the present invention.
[0042] Figure 3 It is a structural schematic diagram of the natural language-based itinerary planning device provided by the present invention.
[0043] Reference numerals:
[0044] 100. Point of interest data set module; 200. Double-layer large language model module; 300. Intermediate candidate list module; 400. Target candidate list module; 500. Itinerary planning module; 810. Processor; 820. Communication interface; 830. Memory; 840. Communication bus. DETAILED DESCRIPTION
[0045] In order to make the purpose, technical scheme and advantages of the present invention clearer, the technical scheme in the present invention will be clearly and completely described below. Obviously, the described embodiments are part of the embodiments of the present invention, rather than all the embodiments. Based on the embodiments in the present invention, all other embodiments obtained by ordinary technicians in the field without creative work are within the scope of protection of the present invention. The following embodiments are used to illustrate the present invention, but cannot be used to limit the scope of the present invention.
[0046] In the description of the embodiments of the present invention, it should be noted that the terms “first”, “second” and “third” are only used for descriptive purposes and cannot be understood as indicating or implying relative importance.
[0047] In the description of the embodiments of the present invention, it should be noted that, unless otherwise clearly specified and limited, the terms "connected" and "connection" should be understood in a broad sense, for example, it can be a fixed connection, a detachable connection, or an integral connection; it can be a mechanical connection or an electrical connection; it can be a direct connection or an indirect connection through an intermediate medium. For ordinary technicians in this field, the specific meanings of the above terms in the embodiments of the present invention can be understood according to specific circumstances.
[0048] In the description of this specification, the description with reference to the terms "one embodiment", "some embodiments", "example", "specific example", or "some examples" etc. means that the specific features, structures, materials or characteristics described in conjunction with the embodiment or example are included in at least one embodiment or example of the embodiment of the present invention. In this specification, the schematic representations of the above terms do not necessarily refer to the same embodiment or example. Moreover, the specific features, structures, materials or characteristics described may be combined in any one or more embodiments or examples in a suitable manner. In addition, those skilled in the art may combine and combine the different embodiments or examples described in this specification and the features of the different embodiments or examples, without contradiction.
[0049] Combine the following Figures 1 to 3 Describing embodiments of the present invention:
[0050] Figure 1 This is a flow chart of the itinerary planning method based on natural language. Here, first, a data set of points of interest is constructed, then the user input text is obtained and parsed through the first prediction layer and the second prediction layer, then clustered to obtain an initial candidate list, sorted to obtain an intermediate candidate list, and reversed and exchanged to obtain a reversed exchange list. Then, the local optimal score is calculated and replaced across clusters to obtain a target candidate list, and finally the comprehensive itinerary score is calculated to obtain the itinerary plan.
[0051] The present invention provides a natural language-based itinerary planning method, comprising:
[0052] S1: Obtaining point of interest information of a point of interest, and constructing a point of interest data set through the point of interest information;
[0053] Furthermore, the purpose of this stage is to collect and obtain POI information from various social software and map software, and obtain POI information after extraction, sorting and normalization, and then obtain POI data set. Step S1 further includes:
[0054] S11: selecting a target software, and obtaining initial point of interest information of the point of interest in the target software;
[0055] S12: extracting and normalizing the initial interest point information to obtain interest point information, and constructing an interest point data set through the interest point information.
[0056] With respect to the above steps, the specific implementation methods in this embodiment are as follows:
[0057] First, the target software is selected, which may include map navigation software, such as Google Maps, Amap, etc., as well as travel information websites, specific sections or topics of social media applications, etc. After the target software is determined, the POIs and initial POI information related to the POIs can be obtained from the target software using crawlers or other methods.
[0058] Next, since the information included in the initial POI information is relatively messy and not all information can help itinerary planning, the initial POI information is first extracted and normalized, that is, the useful information in the initial POI information is extracted, and the useful information is arranged in a certain order according to the category of the useful information to complete the normalization, thereby obtaining the POI information. The POI information includes the name, type, description, geographic coordinate location, recommended visit time, business hours window, rating and rating number, user evaluation, recommended play time, POI features, etc. of the POI. All POI information in an area is taken as the POI dataset.
[0059] S2: obtaining a user input text and a two-layer large language model including a first prediction layer and a second prediction layer, wherein the first prediction layer parses the user input text to obtain initial user demand parameters and user preferences, and the second prediction layer fine-tunes the initial user demand parameters according to the user preferences to obtain user demand parameters;
[0060] Furthermore, the purpose of this stage is to understand the user input text written in natural language by the user including user demand parameters and user preferences through the two-layer large language model, so as to obtain the initial user demand parameters and fine-tune them to obtain the user demand parameters. Among them, step S2 further includes:
[0061] S21: setting an input prompt, the user inputs a natural language text according to the input prompt, and the natural language text is used as the user input text; obtaining a two-layer large language model, the two-layer large language model including a first prediction layer and a second prediction layer;
[0062] S22: The first prediction layer parses the user input text to obtain the initial user demand parameters and the user preferences including daily start time, daily maximum travel time, and visit duration compactness parameters;
[0063] S23: The second prediction layer fine-tunes the daily start time, daily maximum travel time and visit duration compactness parameters in the initial user demand parameters according to the user preferences to obtain the user demand parameters.
[0064] With respect to the above steps, the specific implementation methods in this embodiment are as follows:
[0065] First, an input prompt is set. The input prompt can be a piece of prompting text to tell the user what content needs to be included in the natural language text input. The user enters a natural language text written in natural language according to the input prompt to describe the user's desired itinerary planning requirements in days, and uses the natural language text as the user input text. Then, a two-layer large language model is obtained, which includes a first prediction layer and a second prediction layer.
[0066] Then the user input text first enters the first prediction layer, which parses the user input text, thereby splitting the user's needs and preferences in units of days to obtain initial user demand parameters and user preferences, where the initial user demand parameters include daily priority points of interest, daily start time, daily maximum travel time, visit duration compactness parameters, dining preferences, etc. Here, the priority points of interest are the points of interest that the user explicitly wishes to visit, and the dining preferences include the minimum number of dining points of interest per day, the maximum number of dining points of interest per day that the user wishes to include in the itinerary planning, taste preferences and taboos, etc.
[0067] Subsequently, the second prediction layer summarizes the user preferences. In this embodiment, the summarized user preferences include fast pace, normal pace, slow pace, leisure time, high intensity time and special forces style, a total of six user preferences. Then, according to the user preferences, the time-related parameters such as the daily start time, the daily maximum travel time and the visit duration compactness parameter in the initial user demand parameters are fine-tuned to obtain the user demand parameters.
[0068] S3: clustering the points of interest through the point of interest data set to obtain an initial candidate list, calculating the cosine similarity of the point of interest information in the initial candidate list, calculating the point of interest scores of the points of interest in the candidate list through the cosine similarity, and sorting the initial candidate list according to the point of interest scores and the user demand parameters to obtain an intermediate candidate list;
[0069] Furthermore, the purpose of this stage is to cluster the interest points to obtain an initial candidate list, calculate the interest point scores of the interest points, and then select the initial candidate list to obtain an intermediate candidate list. Among them, step S3 further includes:
[0070] S31: clustering the points of interest according to the geographic information of the points of interest in the point of interest data set to obtain point of interest clusters, and selecting the point of interest clusters using a greedy time strategy and according to the user demand parameters to obtain an initial candidate list;
[0071] S32: calculating an embedded representation of the interest point information in the initial candidate list through the interest point data set, calculating the cosine similarity of the interest point information through the embedded representation, and calculating the interest point score of the interest point in the candidate list according to the cosine similarity;
[0072] S33: Sort the initial candidate list according to the interest point scores to obtain a sorted list, construct constraint conditions, and select from the sorted list according to the constraint conditions and the user demand parameters to obtain the intermediate candidate list.
[0073] With respect to the above steps, the specific implementation methods in this embodiment are as follows:
[0074] First, considering that users usually choose to visit points of interest in a certain area during a day's trip, the geographic information of the points of interest in the point of interest dataset is used to determine the area based on the geographic information of the priority points of interest. The points of interest in the same area are clustered using the K-means method to obtain the point of interest clusters. Then, the greedy time strategy is used, that is, the points of interest with the shortest travel time are given priority, and the priority points of interest included in the user demand parameters need to be retained. The point of interest clusters are selected so that the point of interest clusters can fill the maximum daily travel time in the user demand parameters, thereby obtaining the initial candidate list.
[0075] Next, since the POI dataset includes descriptions of POIs and their names, we first calculate the POI embedding representations of the POIs in the initial candidate list: :
[0076]
[0077] in, Indicates the name of the point of interest, A description of the point of interest. Indicates that the embedding representation of the content within the brackets is generated by a large language model.
[0078] Then calculate the user embedding representation of user u, that is, the user to which the present invention is directed :
[0079]
[0080] in, It represents the embedding representation of the description of the mth point of interest among the priority points of interest by user u in the user input text, and Average() represents the average of the contents in the brackets.
[0081] Then we can calculate the cosine similarity of the user u's interest point information to the pth interest point in the initial candidate list: :
[0082]
[0083] in, represents the modulus of the interest point embedding representation, Indicates the modulus of the user embedding representation.
[0084] Then calculate the interest score of user u for the pth interest point in the initial candidate list :
[0085]
[0086] in, is the score of the pth point of interest in the point of interest information, Indicates the number of ratings received by the pth point of interest. Finally, the initial candidate sequence is sorted from high to low according to the points of interest scores to obtain a sorted list, and then constraints are constructed, and selection is performed based on the constraints and user demand parameters to obtain an intermediate candidate list. In this application, the constraints and the selection based on user demand parameters are as follows:
[0087] When the user's requirements for the minimum number of daily dining points of interest, taste preferences and taboos, and priority points of interest are not met, other irrelevant points of interest will not be selected;
[0088] The sum of the visiting time of all selected POIs does not exceed the maximum daily travel time: If the selected POIs other than the priority POIs will not make the visiting time exceed the maximum travel time of the day, evaluate whether there are multiple available time windows for their visiting time. When there are multiple available time windows, select the window with the shortest waiting time, or select the window with no similar POIs scheduled before or after the window;
[0089] The sorting list cannot be empty. When the sorting list is empty and there are no other points of interest to be selected, the clustering range is expanded and clustering is performed again to obtain a sorting list again and select it;
[0090] If the sorted list is still empty after being obtained again, it is considered that the user demand parameters contained in the user input text entered by the user cannot be met. At this time, all points of interest in the point of interest cluster are added to the sorted list. However, the requirements for the minimum number of dining points of interest per day and taste preferences and taboos still need to be met.
[0091] In the process of constructing the intermediate candidate list, the points of interest that are relatively front in the sorted list may be preferentially selected.
[0092] S4: performing multiple inversion exchanges on the intermediate candidate list to obtain multiple inversion candidate lists, calculating the local optimal score of each of the inversion candidate lists, and performing cross-cluster replacement on the inversion candidate list with the highest local optimal score to obtain a target candidate list;
[0093] Furthermore, the purpose of this stage is to obtain a reverse candidate list and calculate its local optimal score, and finally obtain a target candidate list through cross-cluster replacement. Step S4 further includes:
[0094] S41: performing multiple inversion exchanges on the adjacent interest points in the intermediate candidate list to obtain multiple inversion candidate lists;
[0095] S42: Obtain the total travel time of the inversion candidate list, obtain the waiting time, the number of time-matching interest points and the number of time-unmatching interest points through the interest point data set, and calculate the local optimal score of each of the inversion candidate lists according to the waiting time, the number of time-matching interest points and the number of time-unmatching interest points;
[0096] S43: Obtain similar interest points in the set of interest points outside the cluster, use the similar interest points to replace the non-priority interest points in the inversion candidate list with the highest local optimal score, and calculate the local optimal score of the inversion candidate list. When the local optimal score is improved, retain the interest point replacement to obtain the target candidate list.
[0097] With respect to the above steps, the specific implementation methods in this embodiment are as follows:
[0098] First, the positions of two adjacent points of interest in the intermediate candidate list are swapped to complete a reverse swap, and each reverse swap can obtain a reverse candidate list. Multiple reverse swaps are performed on adjacent points of interest in the intermediate candidate list to obtain multiple reverse candidate lists. Here, the reverse swap is because for the same point of interest, different tour orders will also have a greater impact on the user's tour experience, so swapping the order of visiting points of interest can find the tour order that gives the best user experience.
[0099] Next, in each reversal candidate list, the total travel time of the reversal candidate list is obtained by estimating the travel time between the points of interest according to the estimated tour time of each point of interest included in the point of interest dataset and the traffic conditions in the area where the points of interest cluster are located. Then, the local optimal score of each reversal candidate list is calculated. :
[0100]
[0101] in, is the waiting time of all POIs in the inverted candidate list obtained from the POI dataset. The waiting time is the queue time, waiting entry time, etc. of all POIs; The normalized value representing the standard deviation of the waiting time of all points of interest, which is used to penalize the fluctuation of the waiting time between points of interest; is an empirically determined correction hyperparameter with a value between 0 and 1 that adjusts the total waiting time relative to the total travel time. The relative importance of , a smaller correction hyperparameter means more emphasis on total travel time, and a larger correction hyperparameter means more emphasis on waiting time; To reverse the number of POIs in the candidate list whose access time does not match the optimal time window, here, the optimal time window can be obtained from the POI dataset, and the optimal time window is the optimal time to visit the POI. For example, for POIs with night view as the main selling point, the optimal access window is at night, and for POIs with sunrise as the main selling point, the optimal access window is at sunrise; is the number of points of interest in the inversion candidate list whose visit time matches the best time window. The negative sign in the local optimal score is to ensure that when the local optimal score is larger, the corresponding inversion candidate list can bring better sightseeing experience to tourists, which is in line with the intuition of most people.
[0102] Subsequently, a set of interest points outside the cluster is determined, that is, a set of interest points that are not in the interest point cluster, and interest points of the same type as those in the inversion candidate list are selected as similar interest points. The non-priority interest points in the inversion candidate list with the highest local optimal score, that is, the interest points that are not priority interest points, are replaced with interest points of the same type. Here, the interest point replacement needs to ensure that the replaced inversion candidate list still meets the user's demand parameters and constraints, and the total travel time of the inversion candidate list after the interest point replacement can be reduced, and the total travel time saved is higher than the time saving threshold set according to experience. The local optimal score of the inversion candidate list after the interest point replacement is calculated, and when the local optimal score is improved, the interest point replacement is retained to obtain the target candidate list.
[0103] S5: Repeat S2 to S4 to generate a plurality of target candidate lists, and calculate the comprehensive itinerary score of each target candidate list, take the target candidate list with the highest comprehensive itinerary score as the itinerary list, and obtain the itinerary plan through the itinerary list.
[0104] Furthermore, the purpose of this stage is to generate multiple candidate target lists and calculate their comprehensive itinerary scores, so as to select an itinerary list from the multiple candidate target lists and obtain an itinerary plan. Specifically, since the user demand parameters output by the prediction layer of the large language model during each analysis are not necessarily the same, and different clustering ranges will also affect the results of the candidate target list, S2 to S4 are repeated, and the user input text is parsed multiple times using a two-layer large language model, and the clustering parameters and ranges are changed to generate multiple target candidate lists. Then, the navigation software is used to generate the paths between the various points of interest in each target candidate list and calculate the comprehensive itinerary score for each target candidate list. :
[0105]
[0106] in, Indicates the number of constraints that are satisfied and the limits in the user demand parameters (such as the maximum number of dining points of interest per day), represents the total number of restrictions in the constraints and user requirement parameters, represents the interest point score of the i-th interest point in the target candidate list, I represents all interest points in the target candidate list, is a binary decision variable. When the i-th POI is located on the path between the POIs in the itinerary planning or target candidate list for the k-th day of the itinerary planning, is 1, otherwise it is 0, and K represents all days that have completed itinerary planning or are in the process of itinerary planning. Binary decision variables can try to avoid users from making a special trip to a distant non-priority point of interest, thereby reducing user experience.
[0107] Calculate the comprehensive itinerary score of all target candidate lists, and use the target candidate list with the highest comprehensive itinerary score as the itinerary list. Use navigation software and the comprehensive point of interest data set to calculate the travel time, transportation method, arrival time and departure time between each point of interest, so as to complete the generation of the travel route. Combined with the user's requirements in terms of time and catering, the itinerary planning can be completed.
[0108] The present invention also verifies the effectiveness of the itinerary planning method based on natural language. Here, city A and city B are selected from major cities in China as the objects of itinerary planning, data are collected on various tourism websites and navigation software to construct a data set of points of interest for these two cities, and a large language model is used to generate user input text according to input prompts for itinerary planning by various methods, and the number of days of travel is not satisfied with the degree of travel. , average total trip score The H parameter obtained by the Kruskal-Wallis test is used to measure the effect of each method. Table 1 is a comparison table of the itinerary planning results of the present invention and the one using only the large language model:
[0109] Table 1 Comparison of the effects of the trip planning method using the present invention and using only the large language model
[0110]
[0111] Among them, the large language model uses GLM-4-Air, H 1 , H 2、 H 3、 H 4、 H 5 They represent the H parameters of the itinerary planning for the first, second, third, fourth and fifth days respectively. The degree of dissatisfaction with the number of travel days represents the probability that the number of days in the given itinerary planning does not match the number of travel days desired by the user. The average total itinerary score is the average of the comprehensive itinerary scores for each day of the itinerary. An upward arrow indicates that the larger the value, the better, and a downward arrow indicates that the smaller the value, the better.
[0112] Next, the proposed method is compared with the LLM-FGRASP method and its variants, and the total travel distance is used as the , Repeated trip distance , Number of turns on the route , Multi-day itinerary overlapping area , average total trip score and iteration time As a measurement indicator. Here, iteration represents the number of times the target candidate list is generated. An upward arrow indicates that the larger the value, the better. A downward arrow indicates that the smaller the value, the better. Table 2 is a schematic table of the experimental results:
[0113] Table 2 Comparison of the trip planning effects of the present invention and the LLM-FGRASP method and its variants
[0114]
[0115] Among them, the bold indicates that the value obtained by the method is the optimal value obtained by each method on this parameter in the itinerary planning of the city, and the underlined value indicates that the value obtained by the method is the suboptimal value obtained by each method on this parameter in the itinerary planning of the city. It can be seen from Table 1 and Table 2 that the method proposed by the present invention has made significant progress in all aspects.
[0116] The natural language based itinerary planning device provided by the present invention is described below. The natural language based itinerary planning device described below and the natural language based itinerary planning method described above can refer to each other.
[0117] Figure 2 The following is a schematic diagram of the structure of a natural language based itinerary planning system. Figure 2 As shown, the method for executing the natural language based itinerary planning as described above includes:
[0118] The point of interest data set module 100 is used to obtain the point of interest information of the point of interest and construct the point of interest data set through the point of interest information;
[0119] The dual-layer large language model module 200 is used to obtain a user input text and a dual-layer large language model including a first prediction layer and a second prediction layer, wherein the first prediction layer parses the user input text to obtain initial user demand parameters and user preferences, and the second prediction layer fine-tunes the initial user demand parameters according to the user preferences to obtain user demand parameters;
[0120] The intermediate candidate list module 300 is used to cluster the interest points through the interest point data set to obtain an initial candidate list, calculate the cosine similarity of the interest point information in the initial candidate list, calculate the interest point scores of the interest points in the candidate list through the cosine similarity, and sort the initial candidate list according to the interest point scores and the user demand parameters to obtain an intermediate candidate list;
[0121] The target candidate list module 400 is used to perform multiple inversion exchanges on the intermediate candidate list to obtain multiple inversion candidate lists, calculate the local optimal score of each of the inversion candidate lists, and perform cross-cluster replacement on the inversion candidate list with the highest local optimal score to obtain a target candidate list;
[0122] Itinerary planning module 500: used to repeat S2 to S4 to generate multiple target candidate lists, calculate the comprehensive itinerary score of each target candidate list, take the target candidate list with the highest comprehensive itinerary score as the itinerary list, and obtain itinerary planning through the itinerary list.
[0123] on the other hand, Figure 3 An example of a physical structure diagram of an electronic device is shown in FIG. Figure 3 As shown, the electronic device may include: a processor 810, a communication interface 820, a memory 830 and a communication bus 840, wherein the processor 810, the communication interface 820, and the memory 830 communicate with each other through the communication bus 840. The processor 810 may call the logic instructions in the memory 830 to execute the natural language-based itinerary planning method, which includes:
[0124] S1: Obtaining point of interest information of a point of interest, and constructing a point of interest data set through the point of interest information;
[0125] S2: obtaining a user input text and a two-layer large language model including a first prediction layer and a second prediction layer, wherein the first prediction layer parses the user input text to obtain initial user demand parameters and user preferences, and the second prediction layer fine-tunes the initial user demand parameters according to the user preferences to obtain user demand parameters;
[0126] S3: clustering the points of interest through the point of interest data set to obtain an initial candidate list, calculating the cosine similarity of the point of interest information in the initial candidate list, calculating the point of interest scores of the points of interest in the candidate list through the cosine similarity, and sorting the initial candidate list according to the point of interest scores and the user demand parameters to obtain an intermediate candidate list;
[0127] S4: performing multiple inversion exchanges on the intermediate candidate list to obtain multiple inversion candidate lists, calculating the local optimal score of each of the inversion candidate lists, and performing cross-cluster replacement on the inversion candidate list with the highest local optimal score to obtain a target candidate list;
[0128] S5: Repeat S2 to S4 to generate a plurality of target candidate lists, and calculate the comprehensive itinerary score of each target candidate list, take the target candidate list with the highest comprehensive itinerary score as the itinerary list, and obtain the itinerary plan through the itinerary list.
[0129] In addition, the logic instructions in the above-mentioned memory 830 can be implemented in the form of a software functional unit and can be stored in a computer-readable storage medium when it is sold or used as an independent product. Based on this understanding, the technical solution of the present invention is essentially or the part that contributes to the prior art or the part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including a number of instructions to enable a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present invention. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk and other media that can store program codes.
[0130] On the other hand, the present invention further provides a computer program product, the computer program product comprising a computer program stored on a non-transitory computer-readable storage medium, the computer program comprising program instructions, when the program instructions are executed by a computer, the computer can execute the natural language-based itinerary planning method provided by the above methods, the method comprising:
[0131] S1: Obtaining point of interest information of a point of interest, and constructing a point of interest data set through the point of interest information;
[0132] S2: obtaining a user input text and a two-layer large language model including a first prediction layer and a second prediction layer, wherein the first prediction layer parses the user input text to obtain initial user demand parameters and user preferences, and the second prediction layer fine-tunes the initial user demand parameters according to the user preferences to obtain user demand parameters;
[0133] S3: clustering the points of interest through the point of interest data set to obtain an initial candidate list, calculating the cosine similarity of the point of interest information in the initial candidate list, calculating the point of interest scores of the points of interest in the candidate list through the cosine similarity, and sorting the initial candidate list according to the point of interest scores and the user demand parameters to obtain an intermediate candidate list;
[0134] S4: performing multiple inversion exchanges on the intermediate candidate list to obtain multiple inversion candidate lists, calculating the local optimal score of each of the inversion candidate lists, and performing cross-cluster replacement on the inversion candidate list with the highest local optimal score to obtain a target candidate list;
[0135] S5: Repeat S2 to S4 to generate a plurality of target candidate lists, and calculate the comprehensive itinerary score of each target candidate list, take the target candidate list with the highest comprehensive itinerary score as the itinerary list, and obtain the itinerary plan through the itinerary list.
[0136] In another aspect, the present invention further provides a non-transitory computer-readable storage medium having a computer program stored thereon, which is implemented when the computer program is executed by a processor to execute the natural language-based itinerary planning method provided by the above methods, the method comprising:
[0137] S1: Obtaining point of interest information of a point of interest, and constructing a point of interest data set through the point of interest information;
[0138] S2: obtaining a user input text and a two-layer large language model including a first prediction layer and a second prediction layer, wherein the first prediction layer parses the user input text to obtain initial user demand parameters and user preferences, and the second prediction layer fine-tunes the initial user demand parameters according to the user preferences to obtain user demand parameters;
[0139] S3: clustering the points of interest through the point of interest data set to obtain an initial candidate list, calculating the cosine similarity of the point of interest information in the initial candidate list, calculating the point of interest scores of the points of interest in the candidate list through the cosine similarity, and sorting the initial candidate list according to the point of interest scores and the user demand parameters to obtain an intermediate candidate list;
[0140] S4: performing multiple inversion exchanges on the intermediate candidate list to obtain multiple inversion candidate lists, calculating the local optimal score of each of the inversion candidate lists, and performing cross-cluster replacement on the inversion candidate list with the highest local optimal score to obtain a target candidate list;
[0141] S5: Repeat S2 to S4 to generate a plurality of target candidate lists, and calculate the comprehensive itinerary score of each target candidate list, take the target candidate list with the highest comprehensive itinerary score as the itinerary list, and obtain the itinerary plan through the itinerary list.
[0142] The device embodiments described above are merely illustrative, wherein the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the scheme of this embodiment. Ordinary technicians in this field can understand and implement it without paying creative labor.
[0143] Through the description of the above implementation methods, those skilled in the art can clearly understand that each implementation method can be implemented by means of software plus a necessary general hardware platform, and of course, can also be implemented by hardware. Based on this understanding, the above technical solution is essentially or the part that contributes to the prior art can be embodied in the form of a software product, and the computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, a disk, an optical disk, etc., including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods described in each embodiment or some parts of the embodiments.
[0144] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present invention.
Claims
1. A natural language based itinerary planning method, characterized in that: include: S1: Obtaining point of interest information of a point of interest, and constructing a point of interest data set through the point of interest information; S2: obtaining a user input text and a two-layer large language model including a first prediction layer and a second prediction layer, wherein the first prediction layer parses the user input text to obtain initial user demand parameters and user preferences, and the second prediction layer fine-tunes the initial user demand parameters according to the user preferences to obtain user demand parameters; S3: clustering the points of interest through the point of interest data set to obtain an initial candidate list, calculating the cosine similarity of the point of interest information in the initial candidate list, calculating the point of interest scores of the points of interest in the candidate list through the cosine similarity, and sorting the initial candidate list according to the point of interest scores and the user demand parameters to obtain an intermediate candidate list; wherein step S3 further includes: S31: clustering the points of interest according to the geographic information of the points of interest in the point of interest data set to obtain point of interest clusters, and selecting the point of interest clusters using a greedy time strategy and according to the user demand parameters to obtain an initial candidate list; S32: calculating an embedded representation of the interest point information in the initial candidate list through the interest point data set, calculating the cosine similarity of the interest point information through the embedded representation, and calculating the interest point score of the interest point in the candidate list according to the cosine similarity; The cosine similarity is calculated by calculating the cosine similarity of the user u's interest point information to the pth interest point in the initial candidate list. : in, represents the modulus of the interest point embedding representation, represents the modulus of the user embedding representation; S33: sorting the initial candidate list according to the interest point scores to obtain a sorted list, constructing constraint conditions, and selecting from the sorted list according to the constraint conditions and the user requirement parameters to obtain the intermediate candidate list; S4: performing multiple inversion exchanges on the intermediate candidate list to obtain multiple inversion candidate lists, calculating the local optimal score of each of the inversion candidate lists, and performing cross-cluster replacement on the inversion candidate list with the highest local optimal score to obtain a target candidate list; wherein step S4 further includes: S41: performing multiple inversion exchanges on the adjacent interest points in the intermediate candidate list to obtain multiple inversion candidate lists; S42: Obtain the total travel time of the inversion candidate list, obtain the waiting time, the number of time-matching interest points and the number of time-unmatching interest points through the interest point data set, and calculate the local optimal score of each of the inversion candidate lists according to the waiting time, the number of time-matching interest points and the number of time-unmatching interest points; S43: obtaining similar interest points in the set of interest points outside the cluster, using the similar interest points to replace the non-priority interest points in the inversion candidate list with the highest local optimal score, and calculating the local optimal score of the inversion candidate list, and retaining the interest point replacement when the local optimal score is improved to obtain a target candidate list; S5: Repeat S2 to S4 to generate a plurality of target candidate lists, and calculate the comprehensive itinerary score of each target candidate list, take the target candidate list with the highest comprehensive itinerary score as the itinerary list, and obtain the itinerary plan through the itinerary list.
2. The natural language based itinerary planning method according to claim 1, characterized in that: Step S1 further comprises: S11: selecting a target software, and obtaining initial point of interest information of the point of interest in the target software; S12: extracting and normalizing the initial interest point information to obtain interest point information, and constructing an interest point data set through the interest point information.
3. The natural language based itinerary planning method according to claim 1, characterized in that: Step S2 further comprises: S21: setting an input prompt, the user inputs a natural language text according to the input prompt, and the natural language text is used as the user input text; obtaining a two-layer large language model, the two-layer large language model including a first prediction layer and a second prediction layer; S22: The first prediction layer parses the user input text to obtain the initial user demand parameters and the user preferences including daily start time, daily maximum travel time, and visit duration compactness parameters; S23: The second prediction layer fine-tunes the daily start time, daily maximum travel time and visit duration compactness parameters in the initial user demand parameters according to the user preferences to obtain the user demand parameters.
4. The natural language based itinerary planning method according to claim 1, characterized in that: In step S5, after obtaining the itinerary list, a navigation software is selected and a travel path is generated using the navigation software, and an itinerary plan is obtained through the POI data set and the travel path.
5. A natural language based itinerary planning system, used to execute the natural language based itinerary planning method according to any one of claims 1 to 4, characterized in that: include: Point of interest dataset module; Used to obtain the point of interest information of the point of interest, and construct a point of interest data set through the point of interest information; A two-layer large language model module is used to obtain a user input text and a two-layer large language model including a first prediction layer and a second prediction layer. The first prediction layer parses the user input text to obtain initial user demand parameters and user preferences. The second prediction layer fine-tunes the initial user demand parameters according to the user preferences to obtain user demand parameters. An intermediate candidate list module is used to cluster the points of interest using the point of interest data set to obtain an initial candidate list, calculate the cosine similarity of the point of interest information in the initial candidate list, calculate the point of interest scores of the points of interest in the candidate list using the cosine similarity, and sort the initial candidate list according to the point of interest scores and the user demand parameters to obtain an intermediate candidate list; The target candidate list module is used to perform multiple inversion exchanges on the intermediate candidate list to obtain multiple inversion candidate lists, calculate the local optimal score of each of the inversion candidate lists, and perform cross-cluster replacement on the inversion candidate list with the highest local optimal score to obtain a target candidate list; Itinerary planning module: used to generate multiple target candidate lists, calculate the comprehensive itinerary score of each target candidate list, take the target candidate list with the highest comprehensive itinerary score as the itinerary list, and obtain the itinerary plan through the itinerary list.
6. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the computer program, the steps of the natural language-based itinerary planning method according to any one of claims 1 to 4 are implemented.
7. A non-transitory computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the natural language-based itinerary planning method according to any one of claims 1 to 4 are implemented.
8. A computer program product, the computer program product comprising a computer program stored on a non-transitory computer-readable storage medium, the computer program comprising program instructions, characterized in that: When the program instructions are executed by a computer, the computer can perform the steps of the natural language-based itinerary planning method as described in any one of claims 1 to 4.
Citation Information
Patent Citations
Spatial correlation interest point recommendation method, system, equipment, product and medium
CN119149807A
Systems and Methods for Providing Near Best Itinerary Planning for Touring Locations Based on User Interests.
US20180285784A1