Tourism information query method and system
By constructing a tourism knowledge graph and establishing a dual query index, combining user intention matching degree and tourism resource characteristics, introducing attention mechanisms and strengthening learning, the efficiency and accuracy of traditional tourism information query methods are solved, and personalized and efficient tourism information query services are realized.
Patent Information
- Application Number
- CN202411825831.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-12
- Publication Date
- 2025-04-04
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
Traditional tourism information query methods have problems such as massive and messy results, lagging updates, doubtful accuracy, and difficulty in intelligent recommendation based on user personalized preferences.
By constructing a tourism knowledge graph, establishing a double query index, extracting user keyword paths, filtering and clustering based on user intention matching degree, introducing attention mechanisms, and optimizing the model through reinforcement learning.
It has achieved efficient integration and utilization of multi-source heterogeneous tourism data, provided highly personalized and accurate tourism information query results, and improved user experience and service quality.
Smart Images

Figure CN119760153A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of tourism industry informatization, and in particular to a tourism information query method and system. Background Art
[0002] As living standards improve, the tourism market is booming, the number of travelers continues to grow, and tourists have higher expectations for travel experience. They pursue accurate, rich and personalized travel information covering attractions, hotels, food, transportation and other aspects, aiming to create a unique travel experience.
[0003] However, traditional ways of searching for tourism information have significant problems. The search results of ordinary search engines are massive and messy, and screening is time-consuming and laborious. The information on tourism websites is updated late, the accuracy is questionable, and the data is scattered and not integrated, making it difficult to present a complete picture. In addition, traditional methods are difficult to make intelligent recommendations based on user personalized preferences and historical behaviors, and are difficult to meet diverse and personalized needs.
[0004] A tourism information query method and system, which deeply integrates and analyzes data through steps such as building a tourism knowledge graph, intelligent indexing, precise screening and personalized model construction, efficiently meets user needs, and helps the tourism industry to create an efficient, intelligent and user-friendly information data query method and system, thereby improving service quality and user satisfaction. Summary of the invention
[0005] The purpose of the present invention is to provide a tourist information query method and system.
[0006] To achieve the above object, the present invention is implemented according to the following technical solutions:
[0007] The first aspect of the present invention provides a method for querying tourism information, comprising:
[0008] Constructing a tourism information database; the tourism information database includes text, numerical and multimedia data;
[0009] Extracting relationships from the tourism information database to generate a tourism information knowledge graph, and establishing a dual query index based on the data types in the tourism information knowledge graph through classification and regression tree algorithms;
[0010] Extract keywords of the user query statement, and use the dual query index to obtain a keyword path set from the tourism information knowledge graph;
[0011] The keyword path set is screened according to the user intention matching degree, the screened keyword paths are clustered according to the tourism resource characteristics, and a representative path is selected from each cluster;
[0012] Generate query results from the tourism information knowledge graph based on the representative path, and introduce an attention mechanism based on the query results to build a tourism information query model;
[0013] The interaction records are continuously monitored, and the tourism information query model is optimized through reinforcement learning.
[0014] As a further method, the method of extracting relationships from the tourism information database to generate a tourism information knowledge graph includes:
[0015] Clean the data in the tourism information database to remove redundant, erroneous and incomplete information, extract text data containing entity pairs from the cleaned database, and convert the text into word sequences;
[0016] Use the word vector model to map each word in the word sequence into a low-dimensional vector representation as the input matrix;
[0017] The input matrix is input into the pre-trained deep learning relation extraction model for relation extraction, with entities as nodes in the knowledge graph, relationships between entities as edges, and numerical values and multimedia data corresponding to the entities as attributes of the nodes.
[0018] As a further method, the method of establishing a dual query index based on the data type in the tourism information knowledge graph through a classification and regression tree algorithm includes:
[0019] The feature with the largest information gain ratio is selected as the optimal partition feature, where the information gain ratio is calculated as follows:
[0020]
[0021] Among them, A is the feature in the knowledge graph, F is the set of all possible features, D is the data set of feature A, H(D) is the empirical entropy of D, E is the number of different values of feature A, and D e is the subset of the e-th value of feature A in D, H(D e ) is D e The empirical entropy of Represents subset D e The proportion of data set D;
[0022] Based on the optimal partitioning features, a classification index is constructed using a classification tree to group the nodes in the knowledge graph;
[0023] In each group, a regression index is created based on the regression tree, and the regression index is applied to the numerical data and multimedia data in the node attributes in the knowledge graph to obtain a dual query index.
[0024] As a further method, the method of extracting keywords of the user query statement and obtaining a keyword path set from the tourism information knowledge graph using the dual query index includes:
[0025] Receive the user's query request, extract the original keywords in the query request, and use the large language model LLM to generate auxiliary query words that are semantically related to the original keywords;
[0026] The classification information of the auxiliary query words is determined as the preliminary positioning condition, and the matching node groups are located in the classification index. In each node group, the nodes in the group are further located through the regression index according to the numerical conditions in the auxiliary query words to obtain a candidate node set;
[0027] The candidate node set is traversed again in combination with the original keyword to obtain the path from the original keyword-related node to the filtered candidate node to form a keyword path set.
[0028] As a further method, the method of screening the keyword path set according to the user intention matching degree includes:
[0029] A user intent vector model is constructed based on a neural network algorithm to parse user query statements. The calculation formula for the user intent vector is:
[0030]
[0031] Where n is the total number of words contained in the user's query statement, w i and w j Respectively represent the i-th word and the j-th word in the user's query sentence, and The word w i and word w j The initial word vector representation obtained through the word embedding layer, α i For word w i The weight coefficient, β is the adjustment parameter for controlling the interaction between word vectors, and γ ij For word w i and word w j The semantic relevance coefficient of
[0032] Extract the attributes of the nodes on the keyword path and convert them into vectors to obtain the keyword path vector. Calculate the cosine similarity between the user intent vector and each keyword path vector, and normalize them as the user intent matching degree.
[0033] Remove keyword paths whose user intent match is lower than the preset threshold.
[0034] As a further method, the method of clustering the filtered keyword paths according to the characteristics of tourism resources and selecting a representative path from each cluster includes:
[0035] For the filtered keyword paths, the characteristic dimensions of the attributes of each entity node in the knowledge graph are determined as the characteristic dimensions of tourism resources, and the characteristic vector is constructed;
[0036] The number of clusters is determined by the goodness of fit of different numbers of Gaussian distributions to the distribution of tourism resource heat. The expression for calculating the posterior probability that each keyword path belongs to each Gaussian distribution cluster is:
[0037]
[0038] in, For a given feature vector In the case of , the posterior probability of the keyword path belonging to the kth cluster, d is the feature vector The dimension, ∑ k and∑ i are the covariance matrices of the kth and ith Gaussian distribution clusters, respectively. and are the mean vectors of the kth and ith Gaussian distribution clusters respectively, T represents the transposition operation, N k and N i are the number of keyword paths in the kth and ith Gaussian distribution clusters, respectively, and ψ is the number of Gaussian distribution clusters;
[0039] According to the posterior probability, each keyword path is assigned to the Gaussian distribution cluster with the highest probability, and the keyword path with the best user evaluation is selected as the representative path in each Gaussian distribution cluster.
[0040] As a further method, the method for generating a query result from the tourism information knowledge graph based on the representative path includes:
[0041] For each representative path, traverse the nodes and edges in the tourism knowledge graph along the path;
[0042] The extracted information is integrated in a logical order through a pre-trained sequence-to-sequence model to generate a complete tourism query result text, and the multimedia data is combined with the text to generate a multimedia tourism information display page;
[0043] Generate map visualization query results based on the geographical location information of tourism resources involved in representative routes;
[0044] The multimedia tourism information display page and the map visualization query result are combined as the query result.
[0045] As a further method, the method of introducing an attention mechanism based on query results to construct a tourism information query model includes:
[0046] The Transformer architecture is selected to build a tourism information query model. An attention mechanism is added to the multi-head attention layer of the Transformer to focus on user intent. The expression of the model output is:
[0047]
[0048] Among them, FFN represents feedforward neural network, Dropout represents the operation to prevent overfitting, LayerNorm represents the layer normalization operation, h represents the number of multi-head attention layers, head k is the attention output of the kth head, W is the weight matrix integrating the multi-head output, X pos is the input tourism information sequence, ξ is the importance coefficient of balancing user intention in the final output, u is the user intention vector, q i is the query vector corresponding to the i-th element in the input tourism information sequence, sim(u,q i ) is u and q i The cosine similarity of i is the value vector of the i-th element in the input tourism information sequence;
[0049] Taking the current query result as the positive sample, the adversarial network architecture is designed to replace and perturb the tourism resource information in the positive sample to generate negative samples, where the distribution probability of the negative sample is expressed as:
[0050]
[0051] Among them, p(h j ,r,t j |{(h i ,r,t i )}) is expressed as i ,r,t i ) under the condition that the negative sample (h j ,r,t j ) probability distribution, h j and h i are the tourism resource characteristics in negative samples and positive samples respectively, r is the relationship between tourism resource characteristics, t j and t i are the temporal features in negative and positive samples respectively, ξ is the importance coefficient of balancing user intention in the final output, and f r (h j ,t j ) and f r (h i,t i ) are the correlation functions of tourism resource characteristics and time characteristics in negative samples and positive samples respectively, when r is satisfied;
[0052] The generated negative and positive samples are used to train the tourism information query model.
[0053] As a further method, the method of continuously monitoring the interaction records and optimizing the tourism information query model through reinforcement learning includes:
[0054] Set a reward function based on the user's continuous interaction record. Specifically, if the user clicks on the query result and stays for more than the preset time, collects it, or gives a good review, a positive reward will be given; if the user quickly skips or gives a bad feedback, a negative reward will be given.
[0055] Using the policy gradient method, the model parameters are updated after each interaction according to the set reward function, where the expression for parameter update is:
[0056]
[0057] Among them, θ t+1 is the model parameter of the t+1th interaction, θ t is the model parameter of the tth interaction, φ is the learning rate, s is the state sequence, a is the action sequence, ρ θ (s, a) is the probability distribution of the state-action pair (s, a) under the strategy based on the model parameters θ, T is the total number of steps in an interaction sequence, γ is the discount factor, γ t is the discount factor for the t-th interaction, is the gradient of the model parameter θ, π θ (a|s) is the probability of taking action a in state s based on the policy of model parameters θ, r(s t ,a t ) is in the state s at the tth interaction t When the model takes action a t The reward value obtained.
[0058] The second aspect of the present invention provides a tourism information query system, comprising:
[0059] A database construction module is used to construct a tourism information database containing text, numerical and multimedia data;
[0060] A knowledge graph generation module is used to extract relationships from the tourism information database, generate a tourism information knowledge graph, and establish a dual query index based on the data type in the tourism information knowledge graph through classification and regression tree algorithms;
[0061] A keyword path collection module, used to extract keywords of a user query statement, and obtain a keyword path collection from the tourism information knowledge graph using the dual query index;
[0062] A path screening and clustering module is used to screen the keyword path set according to the user intention matching degree, cluster the screened keyword paths according to the characteristics of tourism resources, and select a representative path from each cluster;
[0063] A query model building module, used to generate query results from the tourism information knowledge graph based on the representative path, and introduce an attention mechanism based on the query results to build a tourism information query model;
[0064] The model continuous optimization module is used to continuously monitor the interaction records and optimize the tourism information query model through reinforcement learning.
[0065] Compared with the prior art, the embodiments of the present invention have at least the following advantages or beneficial effects:
[0066] (1) The present invention constructs a knowledge graph by extracting relationships from the tourism information database and establishes a dual query index, which not only realizes the effective integration of multi-source heterogeneous data, but also enables the complex relationships between data to be clearly presented and efficiently utilized, thereby improving the efficiency of data management and retrieval.
[0067] (2) The present invention screens the keyword path set by user intention matching, and combines tourism resource feature clustering and selects representative paths, which not only ensures that the query results are highly consistent with the actual needs of users, but also enhances the pertinence and practicality of the query results, so that users can quickly obtain valuable tourism information.
[0068] (3) The present invention continuously monitors interaction records and uses reinforcement learning to optimize the model. The model can adjust model parameters based on the user's actual usage behavior feedback, continuously adapt to the diverse needs and preferences of different users, improve user experience, and provide intelligent and personalized tourism information query services. BRIEF DESCRIPTION OF THE DRAWINGS
[0069] Figure 1 The present invention is a flowchart of a method for querying tourist information according to an embodiment of the present invention.
[0070] Figure 2 The figure is a logical schematic diagram of a tourism information query system in an embodiment of the present invention. DETAILED DESCRIPTION
[0071] The technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, rather than all the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of the present invention.
[0072] Reference Figure 1 As shown, the present invention provides a tourism information query method, comprising:
[0073] S100 builds a tourism information database;
[0074] In the actual evaluation, data resources from major tourism platforms, official websites of tourism bureaus, and some tourism magazines and blogs were integrated. The database contains about 100,000 text data, covering detailed introductions of more than 8,000 tourist attractions around the world, information on more than 3,000 hotels, more than 5,000 travel route plans, and descriptions of more than 2,000 tourist activities. In addition, there are more than 50,000 pictures of attractions, more than 3,000 videos of attractions, and multimedia data of pictures of hotel exteriors and internal facilities.
[0075] S200 extracts relations from the tourism information database to generate a tourism information knowledge graph, and establishes a dual query index based on the data types in the tourism information knowledge graph through classification and regression tree algorithms;
[0076] In the actual evaluation, during the data cleaning phase, about 2,000 duplicate or obviously erroneous data records were removed, including incomplete addresses or incorrect price data formats in hotel information. After cleaning, there were 7,400 valid scenic spot information and 2,870 hotel information. About 15,000 entity pairs were extracted from these data, and the corresponding texts were converted into word sequences. The GloVe word vector model was used to map the words in the word sequence into 200-dimensional vectors. The LSTM-based deep learning relationship extraction model was used to determine multiple relationship types including "attractions-belonging cities", "hotels-locations", and "tourist routes-included attractions". Taking "Eiffel Tower-Paris" as an example, in the knowledge graph, "Eiffel Tower" is a node and "Paris" is another node. They are connected by the "belonging city" relationship edge. At the same time, the attributes of the Eiffel Tower node include numerical data such as its height and construction year, as well as associated pictures and video multimedia data.
[0077] In the actual evaluation, it was found through calculation that the information gain ratio of the "tourism resource category" feature was the largest, so it was determined to be the optimal partitioning feature. A classification index was constructed based on the "tourism resource category", and the nodes in the knowledge graph were divided into different groups such as attractions, hotels, tourist routes, and tourist activities. All attraction nodes were grouped into one group, and hotel nodes were grouped into another group. Within each group, regression indexes were created for different types of attributes: in the attraction group, regression indexes were constructed for numerical data such as the altitude and area of the attraction; in the hotel group, regression indexes were constructed for numerical data such as the hotel's price and star rating.
[0078] S300 extracts keywords of the user query statement, and uses the dual query index to obtain a keyword path set from the tourism information knowledge graph;
[0079] What needs to be explained is that extracting keywords can accurately grasp the core demands of users. The keyword path set obtained from the knowledge graph connects the scattered tourism elements in a logically clear and hierarchical way, which is convenient for their in-depth understanding and decision-making.
[0080] In the actual evaluation, the user inputs the query request "Beach hotels in Phuket", extracts the original keywords "Phuket" and "Beach hotels", and generates auxiliary query words, including Phuket seaside resort hotels" and "Phuket beachside hotels". The classification information "hotel" of the auxiliary query word is used as the preliminary positioning condition, and the hotel node group is found in the classification index. Within the group, the nodes in the group are further located based on the geographical location condition of "Phuket" in the auxiliary query word and the user's potential requirements for the distance to the beach, and a node set containing 30 candidate hotels is obtained. The candidate node set is traversed again in combination with the original keyword "Phuket" to obtain the path from the "Phuket" related node to the filtered candidate hotel node, including "Phuket-located-Thailand-owns-Karon Beach Hotel" and other paths, forming a keyword path set.
[0081] S400: filtering the keyword path set according to the user intention matching degree, clustering the filtered keyword paths according to tourism resource characteristics, and selecting a representative path from each cluster;
[0082] It needs to be explained that by filtering keyword paths according to the matching degree of user intention, ensuring that information highly consistent with user needs is left, reducing irrelevant interference, clustering tourism resources according to their characteristics, grouping similar resources together, and selecting representative paths from each cluster, it is possible to refine information and provide users with tourism information in a more accurate, efficient and representative way, optimize the presentation of query results, and improve decision-making efficiency;
[0083] In the actual evaluation, a user intent vector model was constructed based on a neural network algorithm. For the user query sentence "beach hotels in Phuket", the initial word vector representation of each word was obtained through the word embedding layer. The initial word vector of "Phuket" was [0.34, -0.23, 0.12], and the initial word vector of "beach" was [-0.11, 0.56, -0.34]. The user intent vector was calculated; the attributes of the nodes on the keyword path were extracted and converted into vectors to obtain the keyword path vector. For the path "Phuket-located-in-Thailand-with-Karon Beach Hotel", the attributes of the hotel node (stars, price, distance from the beach, etc.) were extracted and converted into vectors. The cosine similarity between the user intent vector and each keyword path vector was calculated, and normalized as the user intent matching degree. The matching degree of this path was calculated to be 0.92, and the preset threshold was 0.7, so the keyword path was retained. After screening, a total of 20 keyword paths remained;
[0084] In the actual evaluation, for the filtered keyword paths, the characteristic dimensions of the attributes of each entity node in the knowledge graph are determined as the characteristic dimensions of tourism resources. For the hotel nodes, the hotel's star rating, price, distance from the beach, whether there is a sea view room, etc. are included to construct a feature vector. The hotel feature vector corresponding to one path is [5 stars, 1,788 yuan per night, 200 meters from the beach, and sea view rooms]. The number of clusters is determined by the goodness of fit of different numbers of Gaussian distributions to the heat distribution of tourism resources. After analysis, it is determined that 4 Gaussian distribution clusters can better fit the heat distribution of the hotel. The posterior probability that each keyword path belongs to each Gaussian distribution cluster is calculated, and the keyword path with the best user evaluation in each Gaussian distribution cluster is selected as the representative path, specifically: "Phuket-owns-Kata Noi Beach-located-Katasani Coast Hotel", "Phuket-located-Thailand-owns-Karon Beach Hotel", "Phuket-includes-Nai Harn Beach-overlooking-Nairn Hotel" and "Phuket-includes-Patong Beach-located-Amari Hotel Resort Phuket".
[0085] S500 generates a query result from the tourism information knowledge graph based on the representative path, and introduces an attention mechanism based on the query result to construct a tourism information query model;
[0086] In the actual evaluation, for each representative path, the nodes and edges in the tourism knowledge graph are traversed along the path. For the representative path of "Phuket-located-Thailand-has-Karon Beach Hotel", the Phuket node and its attributes (area, population, tourist season, etc.), the Karon Beach Hotel node and its attributes (stars, price, room type, hotel facilities, etc.) and the relationship between them are traversed, and the extracted information is integrated in a logical order through the pre-trained BART sequence-to-sequence model to generate a complete tourism query result text, specifically "Phuket is located in Thailand and is a famous tourist destination. Karon Beach Hotel is located here, the hotel It is a 5-star hotel with a price of about 1,500 yuan per night. It is only 200 meters away from Karon Beach. It has beautiful sea view rooms, provides a variety of luxurious facilities and considerate services, and is a great choice for you to enjoy a beach vacation in Phuket. "At the same time, multimedia data such as the hotel's exterior pictures, beach scenery pictures, and hotel internal facilities pictures are combined with text to generate a multimedia tourism information display page; based on the geographical location information of tourism resources involved in the representative path (including the coordinates of Phuket and Karon Beach Hotel), a map visualization query result is generated, and the location of Phuket, Karon Beach and the hotel are clearly marked on the map, and surrounding transportation route information is provided.
[0087] S600 continuously monitors the interaction records and optimizes the tourism information query model through reinforcement learning.
[0088] In the actual evaluation, the reward function is set according to the user's continuous interaction records. In one interaction, in the monitoring of 500 user query interaction records, 330 users clicked on the query results and stayed for more than the preset timer, collected them, or gave good reviews, and they were given positive rewards; among the other 170 users, 100 users skipped quickly and 70 users gave poor feedback, and they were given negative rewards. The policy gradient method is used to update the model parameters after each interaction according to the set reward function.
[0089] In this embodiment, the method of extracting relationships from the tourism information database to generate a tourism information knowledge graph includes:
[0090] Clean the data in the tourism information database to remove redundant, erroneous and incomplete information, extract text data containing entity pairs from the cleaned database, and convert the text into word sequences;
[0091] Use the word vector model to map each word in the word sequence into a low-dimensional vector representation as the input matrix;
[0092] The input matrix is input into the pre-trained deep learning relation extraction model for relation extraction, with entities as nodes in the knowledge graph, relationships between entities as edges, and numerical values and multimedia data corresponding to the entities as attributes of the nodes.
[0093] In this embodiment, the method of establishing a dual query index based on the data type in the tourism information knowledge graph through a classification and regression tree algorithm includes:
[0094] The feature with the largest information gain ratio is selected as the optimal partition feature, where the information gain ratio is calculated as follows:
[0095]
[0096] Among them, A is the feature in the knowledge graph, F is the set of all possible features, D is the data set of feature A, H(D) is the empirical entropy of D, E is the number of different values of feature A, and D e is the subset of the e-th value of feature A in D, H(D e ) is D e The empirical entropy of Represents subset D e The proportion of data set D;
[0097] Based on the optimal partitioning features, a classification index is constructed using a classification tree to group the nodes in the knowledge graph;
[0098] In each group, a regression index is created based on the regression tree, and the regression index is applied to the numerical data and multimedia data in the node attributes in the knowledge graph to obtain a dual query index.
[0099] In this embodiment, the method of extracting keywords of the user query statement and obtaining a keyword path set from the tourism information knowledge graph using the dual query index includes:
[0100] Receive the user's query request, extract the original keywords in the query request, and use the large language model LLM to generate auxiliary query words that are semantically related to the original keywords;
[0101] The classification information of the auxiliary query words is determined as the preliminary positioning condition, and the matching node groups are located in the classification index. In each node group, the nodes in the group are further located through the regression index according to the numerical conditions in the auxiliary query words to obtain a candidate node set;
[0102] The candidate node set is traversed again in combination with the original keyword to obtain the path from the original keyword-related node to the filtered candidate node to form a keyword path set.
[0103] In this embodiment, the method for screening the keyword path set according to the user intention matching degree includes:
[0104] A user intent vector model is constructed based on a neural network algorithm to parse user query statements. The calculation formula for the user intent vector is:
[0105]
[0106] Where n is the total number of words contained in the user's query statement, w i and w j Respectively represent the i-th word and the j-th word in the user's query sentence, and The word w i and word w j The initial word vector representation obtained through the word embedding layer, α i For word w i The weight coefficient, β is the adjustment parameter for controlling the interaction between word vectors, and γ ij For word w i and word w j The semantic relevance coefficient of
[0107] Extract the attributes of the nodes on the keyword path and convert them into vectors to obtain the keyword path vector. Calculate the cosine similarity between the user intent vector and each keyword path vector, and normalize them as the user intent matching degree.
[0108] Remove keyword paths whose user intent match is lower than the preset threshold.
[0109] In this embodiment, the method of clustering the filtered keyword paths according to the tourism resource characteristics and selecting a representative path from each cluster includes:
[0110] For the filtered keyword paths, the characteristic dimensions of the attributes of each entity node in the knowledge graph are determined as the characteristic dimensions of tourism resources, and the characteristic vector is constructed;
[0111] The number of clusters is determined by the goodness of fit of different numbers of Gaussian distributions to the distribution of tourism resource heat. The expression for calculating the posterior probability that each keyword path belongs to each Gaussian distribution cluster is:
[0112]
[0113] in, For a given feature vector In the case of , the posterior probability of the keyword path belonging to the kth cluster, d is the feature vector The dimension, ∑ k and∑ iare the covariance matrices of the kth and ith Gaussian distribution clusters, respectively. and are the mean vectors of the kth and ith Gaussian distribution clusters respectively, T represents the transposition operation, N k and N i are the number of keyword paths in the kth and ith Gaussian distribution clusters, respectively, and ψ is the number of Gaussian distribution clusters;
[0114] According to the posterior probability, each keyword path is assigned to the Gaussian distribution cluster with the highest probability, and the keyword path with the best user evaluation is selected as the representative path in each Gaussian distribution cluster.
[0115] In this embodiment, the method for generating a query result from the tourism information knowledge graph based on the representative path includes:
[0116] For each representative path, traverse the nodes and edges in the tourism knowledge graph along the path;
[0117] The extracted information is integrated in a logical order through a pre-trained sequence-to-sequence model to generate a complete tourism query result text, and the multimedia data is combined with the text to generate a multimedia tourism information display page;
[0118] Generate map visualization query results based on the geographical location information of tourism resources involved in representative routes;
[0119] The multimedia tourism information display page and the map visualization query result are combined as the query result.
[0120] In this embodiment, the method of introducing an attention mechanism based on query results to construct a tourism information query model includes:
[0121] The Transformer architecture is selected to build a tourism information query model. An attention mechanism is added to the multi-head attention layer of the Transformer to focus on user intent. The expression of the model output is:
[0122]
[0123] Among them, FFN represents feedforward neural network, Dropout represents the operation to prevent overfitting, LayerNorm represents the layer normalization operation, h represents the number of multi-head attention layers, head k is the attention output of the kth head, W is the weight matrix integrating the multi-head output, X pos is the input tourism information sequence, ξ is the importance coefficient of balancing user intention in the final output, u is the user intention vector, q iis the query vector corresponding to the i-th element in the input tourism information sequence, sim(u,q i ) is u and q i The cosine similarity of i is the value vector of the i-th element in the input tourism information sequence;
[0124] Taking the current query result as the positive sample, the adversarial network architecture is designed to replace and perturb the tourism resource information in the positive sample to generate negative samples, where the distribution probability of the negative sample is expressed as:
[0125]
[0126] Among them, p(h j ,r,t j |{(h i ,r,t i )}) is expressed as i ,r,t i ) under the condition that the negative sample (h j ,r,t j ) probability distribution, h j and h i are the tourism resource characteristics in negative samples and positive samples respectively, r is the relationship between tourism resource characteristics, t j and t i are the temporal features in negative and positive samples respectively, ξ is the importance coefficient of balancing user intention in the final output, and f r (h j ,t j ) and f r (h i ,t i ) are the correlation functions of tourism resource characteristics and time characteristics in negative samples and positive samples respectively, when r is satisfied;
[0127] The generated negative and positive samples are used to train the tourism information query model.
[0128] In this embodiment, the method of continuously monitoring the interaction records and optimizing the tourism information query model through reinforcement learning includes:
[0129] Set a reward function based on the user's continuous interaction record. Specifically, if the user clicks on the query result and stays for more than the preset time, collects it, or gives a good review, a positive reward will be given; if the user quickly skips or gives a bad feedback, a negative reward will be given.
[0130] Using the policy gradient method, the model parameters are updated after each interaction according to the set reward function, where the expression for parameter update is:
[0131]
[0132] Among them, θ t+1 is the model parameter of the t+1th interaction, θ t is the model parameter of the tth interaction, φ is the learning rate, s is the state sequence, a is the action sequence, ρ θ (s, a) is the probability distribution of the state-action pair (s, a) under the strategy based on the model parameters θ, T is the total number of steps in an interaction sequence, γ is the discount factor, γ t is the discount factor for the t-th interaction, is the gradient of the model parameter θ, π θ (a|s) is the probability of taking action a in state s based on the policy of model parameters θ, r(s t ,a t ) is in the state s at the tth interaction t When the model takes action a t The reward value obtained.
[0133] The second aspect of the present invention also provides a tourism information query system, comprising:
[0134] A database construction module is used to construct a tourism information database containing text, numerical and multimedia data;
[0135] A knowledge graph generation module is used to extract relationships from the tourism information database, generate a tourism information knowledge graph, and establish a dual query index based on the data type in the tourism information knowledge graph through classification and regression tree algorithms;
[0136] A keyword path collection module, used to extract keywords of a user query statement, and obtain a keyword path collection from the tourism information knowledge graph using the dual query index;
[0137] A path screening and clustering module is used to screen the keyword path set according to the user intention matching degree, cluster the screened keyword paths according to the characteristics of tourism resources, and select a representative path from each cluster;
[0138] A query model building module, used to generate query results from the tourism information knowledge graph based on the representative path, and introduce an attention mechanism based on the query results to build a tourism information query model;
[0139] The model continuous optimization module is used to continuously monitor the interaction records and optimize the tourism information query model through reinforcement learning.
[0140] The above contents are merely examples and explanations of the structure of the present invention. The technicians in this technical field may make various modifications or additions to the specific embodiments described or replace them in a similar manner. As long as they do not deviate from the structure of the invention or exceed the scope defined by the claims, they should all fall within the protection scope of the present invention.
Claims
1. A method for querying tourism information, characterized in that: The following steps are involved: Constructing a tourism information database; the tourism information database includes text, numerical and multimedia data; Extracting relationships from the tourism information database to generate a tourism information knowledge graph, and establishing a dual query index based on the data types in the tourism information knowledge graph through classification and regression tree algorithms; Extract keywords of the user query statement, and use the dual query index to obtain a keyword path set from the tourism information knowledge graph; The keyword path set is screened according to the user intention matching degree, the screened keyword paths are clustered according to the tourism resource characteristics, and a representative path is selected from each cluster; Generate query results from the tourism information knowledge graph based on the representative path, and introduce an attention mechanism based on the query results to build a tourism information query model; The interaction records are continuously monitored, and the tourism information query model is optimized through reinforcement learning.
2. A tourist information query method according to claim 1, characterized in that: The method of extracting relations from the tourism information database to generate a tourism information knowledge graph comprises: Clean the data in the tourism information database to remove redundant, erroneous and incomplete information, extract text data containing entity pairs from the cleaned database, and convert the text into word sequences; Use the word vector model to map each word in the word sequence into a low-dimensional vector representation as the input matrix; The input matrix is input into the pre-trained deep learning relation extraction model for relation extraction, with entities as nodes in the knowledge graph, relationships between entities as edges, and numerical values and multimedia data corresponding to the entities as attributes of the nodes.
3. A tourist information query method according to claim 1, characterized in that: The method for establishing a dual query index based on the data type in the tourism information knowledge graph through a classification and regression tree algorithm includes: The feature with the largest information gain ratio is selected as the optimal partition feature, where the information gain ratio is calculated as follows: Among them, A is the feature in the knowledge graph, F is the set of all possible features, D is the data set of feature A, H(D) is the empirical entropy of D, E is the number of different values of feature A, and D e is the subset of the e-th value of feature A in D, H(D e ) is D e The empirical entropy of Represents subset D e The proportion of data set D; Based on the optimal partitioning features, a classification index is constructed using a classification tree to group the nodes in the knowledge graph; In each group, a regression index is created based on the regression tree, and the regression index is applied to the numerical data and multimedia data in the node attributes in the knowledge graph to obtain a dual query index.
4. A tourist information query method according to claim 1, characterized in that: The method of extracting keywords of the user query statement and obtaining a keyword path set from the tourism information knowledge graph using the dual query index includes: Receive the user's query request, extract the original keywords in the query request, and use the large language model LLM to generate auxiliary query words that are semantically related to the original keywords; The classification information of the auxiliary query words is determined as the preliminary positioning condition, and the matching node groups are located in the classification index. In each node group, the nodes in the group are further located through the regression index according to the numerical conditions in the auxiliary query words to obtain a candidate node set; The candidate node set is traversed again in combination with the original keyword to obtain the path from the original keyword-related node to the filtered candidate node to form a keyword path set.
5. A tourist information query method according to claim 1, characterized in that: The method for screening the keyword path set according to the user intention matching degree includes: A user intent vector model is constructed based on a neural network algorithm to parse user query statements. The calculation formula for the user intent vector is: Where n is the total number of words contained in the user's query statement, w i and w j Respectively represent the i-th word and the j-th word in the user's query sentence, and The word w i and word w j The initial word vector representation obtained through the word embedding layer, α i For word w i The weight coefficient, β is the adjustment parameter for controlling the interaction between word vectors, and γ ij For word w i and word w j The semantic relevance coefficient of Extract the attributes of the nodes on the keyword path and convert them into vectors to obtain the keyword path vector. Calculate the cosine similarity between the user intent vector and each keyword path vector, and normalize them as the user intent matching degree. Remove keyword paths whose user intent match is lower than the preset threshold.
6. A method for querying tourism information according to claim 1, characterized in that: The method of clustering the filtered keyword paths according to the tourism resource characteristics and selecting a representative path from each cluster includes: For the filtered keyword paths, the characteristic dimensions of the attributes of each entity node in the knowledge graph are determined as the characteristic dimensions of tourism resources, and the characteristic vector is constructed; The number of clusters is determined by the goodness of fit of different numbers of Gaussian distributions to the distribution of tourism resource heat. The expression for calculating the posterior probability that each keyword path belongs to each Gaussian distribution cluster is: in, For a given feature vector In the case of , the posterior probability of the keyword path belonging to the kth cluster, d is the feature vector The dimension, ∑ k and∑ i are the covariance matrices of the kth and ith Gaussian distribution clusters, respectively. and are the mean vectors of the kth and ith Gaussian distribution clusters respectively, T represents the transposition operation, N k and N i are the number of keyword paths in the kth and ith Gaussian distribution clusters, respectively, and ψ is the number of Gaussian distribution clusters; According to the posterior probability, each keyword path is assigned to the Gaussian distribution cluster with the highest probability, and the keyword path with the best user evaluation is selected as the representative path in each Gaussian distribution cluster.
7. A tourist information query method according to claim 1, characterized in that: The method for generating a query result from the tourism information knowledge graph based on the representative path includes: For each representative path, traverse the nodes and edges in the tourism knowledge graph along the path; The extracted information is integrated in a logical order through a pre-trained sequence-to-sequence model to generate a complete tourism query result text, and the multimedia data is combined with the text to generate a multimedia tourism information display page; Generate map visualization query results based on the geographical location information of tourism resources involved in representative routes; The multimedia tourism information display page and the map visualization query result are combined as the query result.
8. A method for querying tourism information according to claim 1, characterized in that: The method for constructing a tourism information query model based on query results by introducing an attention mechanism comprises: The Transformer architecture is selected to build a tourism information query model. An attention mechanism is added to the multi-head attention layer of the Transformer to focus on user intent. The expression of the model output is: Among them, FFN represents feedforward neural network, Dropout represents the operation to prevent overfitting, LayerNorm represents the layer normalization operation, h represents the number of multi-head attention layers, head k is the attention output of the kth head, W is the weight matrix integrating the multi-head output, X pos is the input tourism information sequence, ξ is the importance coefficient of balancing user intention in the final output, u is the user intention vector, q i is the query vector corresponding to the i-th element in the input tourism information sequence, sim(u,q i ) is u and q i The cosine similarity of i is the value vector of the i-th element in the input tourism information sequence; Taking the current query result as the positive sample, the adversarial network architecture is designed to replace and perturb the tourism resource information in the positive sample to generate negative samples, where the distribution probability of the negative sample is expressed as: Among them, p(h j ,r,t j |{(h i ,r,t i )}) is expressed as i ,r,t i ) under the condition that the negative sample (h j ,r,t j ) probability distribution, h j and h i are the tourism resource characteristics in negative samples and positive samples respectively, r is the relationship between tourism resource characteristics, t j and t i are the temporal features in negative and positive samples respectively, ξ is the importance coefficient of balancing user intention in the final output, and f r (h j ,t j ) and f r (h i ,t i ) are the correlation functions of tourism resource characteristics and time characteristics in negative samples and positive samples respectively, when r is satisfied; The generated negative and positive samples are used to train the tourism information query model.
9. A method for querying tourism information according to claim 1, characterized in that: The method of continuously monitoring the interaction records and optimizing the tourism information query model through reinforcement learning includes: Set a reward function based on the user's continuous interaction record. Specifically, if the user clicks on the query result and stays for more than the preset time, collects it, or gives a good review, a positive reward will be given; if the user quickly skips or gives a bad feedback, a negative reward will be given. Using the policy gradient method, the model parameters are updated after each interaction according to the set reward function, where the expression for parameter update is: Among them, θ t+1 is the model parameter of the t+1th interaction, θ t is the model parameter of the tth interaction, φ is the learning rate, s is the state sequence, a is the action sequence, ρ θ (s, a) is the probability distribution of the state-action pair (s, a) under the strategy based on the model parameters θ, T is the total number of steps in an interaction sequence, γ is the discount factor, γ t is the discount factor for the t-th interaction, is the gradient of the model parameter θ, π θ (a|s) is the probability of taking action a in state s based on the policy of model parameters θ, r(s t ,a t ) is in the state s at the tth interaction t When the model takes action a t The reward value obtained.
10. A tourism information query system, used to execute a tourism information query method according to any one of claims 1 to 9, characterized in that: The system comprises: A database construction module is used to construct a tourism information database containing text, numerical and multimedia data; A knowledge graph generation module is used to extract relationships from the tourism information database, generate a tourism information knowledge graph, and establish a dual query index based on the data type in the tourism information knowledge graph through classification and regression tree algorithms; A keyword path collection module, used to extract keywords of a user query statement, and obtain a keyword path collection from the tourism information knowledge graph using the dual query index; A path screening and clustering module is used to screen the keyword path set according to the user intention matching degree, cluster the screened keyword paths according to the characteristics of tourism resources, and select a representative path from each cluster; A query model building module, used to generate query results from the tourism information knowledge graph based on the representative path, and introduce an attention mechanism based on the query results to build a tourism information query model; The model continuous optimization module is used to continuously monitor the interaction records and optimize the tourism information query model through reinforcement learning.
Citation Information
Cited By
Electric power scientific research information text retrieval optimization method and system
CN120508607A
Teacher lesson preparation assisting method and related device based on knowledge graph and large language model
CN120561272A