Scenic spot retrieval method based on large language model, storage medium and equipment

By constructing the knowledge map and community reports based on large language models, the problems of fragmentation and query difficulties in the existing tourist attractions query method have been solved, and efficient and accurate attractions information query and integration is achieved.

CN119377383APending Publication Date: 2025-01-28CHINA UNIV OF GEOSCIENCES (WUHAN)

Patent Information

Application Number
CN202411471780.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-10-22
Publication Date
2025-01-28

AI Technical Summary

Technical Problem

The existing tourist attraction query methods have problems such as fragmentation of information, difficulty in user querying, and untimely update of information.

Method used

Adopt a large -language model retrieval method, to obtain attractions related documents, build a list of physical types, build attractions knowledge maps, cluster attractions communities, generate community reports, and realize multi -level integration and query of attractions information.

Benefits of technology

It reduces the difficulty of user inquiries, integrates fragmented travel information, and improves the efficiency of information update and the accuracy of query.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119377383A_ABST
    Figure CN119377383A_ABST
Patent Text Reader

Abstract

The invention discloses a scenic spot retrieval method based on a large language model, a storage medium and equipment, and relates to the technical field of big data, the method comprises the following steps: setting a context window, and segmenting a scenic spot related document to obtain a document vector database; the method comprises the following steps: extracting entities from a document by using a large language model, dividing different types of entities into three levels, and constructing an entity vector database; the entities of the third layer are aggregated into different aggregates according to the entities of the second layer, the different aggregates and the entities of the first layer are subjected to relation connection according to the document vector database, and a scenic spot knowledge graph is constructed; the scenic spot communities are clustered, and a scenic spot community report is constructed by using a large language model; and the big language model extracts the query entity, queries the entity with the most similar semantic similarity to the query entity in the entity vector database, and generates an answer according to the community report and the knowledge graph. According to the method provided by the invention, the fragmented tourism information is integrated, and the query difficulty is reduced.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of big data technology, and in particular to a scenic spot retrieval method, storage medium and device based on a large language model. Background Art

[0002] Tourism statistics show that tourists' needs are showing a multi-layered trend of being younger, more diverse, more personalized and of higher quality. Tourism market segments continue to emerge, driving the innovative development of tourism scenarios. In view of this situation, it is particularly important to update the tourist attraction database based on the Internet in a timely manner, analyze the most popular tourism hot topics at present, and accurately query relevant information about tourist attractions based on young people's travel preferences.

[0003] There are three existing methods for searching tourist attractions. The first is to search on online travel platforms and travel applications. Users can filter attractions according to their needs and view information such as attraction introductions, ticket prices, opening hours, and visitor reviews. Although these platforms provide rich information, they also lead to excessive and complex information, and users need to spend a lot of time to filter.

[0004] The second way to search is to search on social platforms such as WeChat, Douyin, Xiaohongshu and Weibo. On these platforms, there are many travel bloggers and experts who share their travel experiences and recommendations for attractions. Users can follow some bloggers they are interested in and get information about the attractions they recommend. However, the information on social media is relatively scattered and fragmented. Users need to spend a lot of time searching and sorting out relevant information about attractions, and it is difficult to form a systematic and complete understanding of the attractions.

[0005] The third way to search is through travel agencies and tourism consulting agencies. Users can go to local travel agencies or tourism consulting agencies and consult with the staff to obtain information about tourist attractions. Travel agencies usually recommend various tourist routes and attractions, and the staff can provide professional advice and information based on the needs of tourists. Travel agencies and tourism consulting agencies often recommend attractions and tourist routes based on their own interests, and may ignore some less popular but valuable attractions, or exaggerate the advantages of some attractions, resulting in the information obtained by users being less objective.

[0006] In summary, the existing scenic spot query methods have problems such as fragmented tourism information, difficulty in user query, and untimely information update. Summary of the invention

[0007] The purpose of the present invention is to solve the problem of fragmented scenic spot query information and difficulty in user query, and to propose a scenic spot retrieval method based on a large language model, comprising the following steps:

[0008] S1, obtain documents related to scenic spots, set windows with common paragraphs with contextual connection, segment the documents, and obtain a document vector database;

[0009] S2. Build an entity type list, use a large language model to extract different types of entities from the document, divide different types of entities into different levels, the first level is the scenic spot, the second level is the classification of supporting facilities included in the scenic spot, and the third level is the specific supporting facilities, and build an entity vector database;

[0010] S3, aggregate the specific supporting facilities of the third layer according to the classification of the supporting facilities of the second layer to form aggregates of different supporting facility types, and connect the aggregates of different supporting facility types with the scenic spot entities of the first layer according to the document vector database to construct a scenic spot knowledge graph;

[0011] S4. All entities at the third level connected to an entity at the first level constitute a scenic spot community of the entity at the first level. The scenic spot communities are clustered to obtain different types of scenic spot communities, and a scenic spot community report is constructed using a large language model.

[0012] S5. The large language model extracts query entities from the query conditions, and searches the entity vector database for entity data with the closest semantic similarity to the query entity. The large language model generates answers based on community reports and knowledge graphs.

[0013] Furthermore, S1 is specifically:

[0014] S11. Collect original documents related to attractions, including travel guides, attraction introductions, historical background, and user reviews;

[0015] S12, pre-processing the original document data, including: word segmentation, removal of stop words, part-of-speech tagging, obtaining the required scenic spot related documents, setting windows with common paragraphs with contextual connection, and segmenting the scenic spot related documents;

[0016] S13. Vectorize the segmented document segments, convert the text into vector representation, select a suitable vector database, store the vectorized document vectors, and obtain a document vector database.

[0017] Furthermore, the categories of items included in the scenic spot include: accommodation, food, and recreational facilities.

[0018] Furthermore, the following formula is used to cluster the scenic spot communities:

[0019]

[0020] Among them, H represents modularity, m represents the total number of edges in the scenic spot community, and e crepresents the actual number of edges in community c, γ represents the resolution parameter, and K c represents the sum of the degrees of all nodes in community c.

[0021] Furthermore, the community report includes: an introduction to the scenic spot and an introduction to the supporting facilities in the scenic spot community.

[0022] Furthermore, S5 is specifically:

[0023] S51, the large language model extracts the query entity from the query condition and vectorizes the query entity;

[0024] S52, using cosine similarity to calculate the similarity between the vectorized query entity and the entity vector in the entity vector database;

[0025]

[0026] Among them, Sim(q i ,c j ) indicates q i and c j The similarity, q i represents the i-th vectorized query entity, c j represents the j-th entity vector in the entity vector database, || || represents the modulus of the vector;

[0027] S53, applying a greedy matching strategy, selecting an entity vector in the entity vector database that is most similar to the query entity as the best match, while considering importance factors, determining the influence of specific words on the semantics of the overall query, calculating a matching score, and returning the best match item;

[0028]

[0029] in, express and c i The matching score of for q i The best match for i Indicates q i The importance factor of TotalScore(Q,C) represents the overall matching score, Q = {q1,q2,...,q n} represents the set of all vectorized query entities, C = {c1, c2, ..., c n} represents the collection of entity vectors in the entity vector database.

[0030] The present invention also provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the above-mentioned scenic spot retrieval method based on a large language model is implemented.

[0031] The present invention also proposes an electronic device, comprising a processor and a memory, wherein the processor and the memory are interconnected, wherein the memory is used to store a computer program, the computer program comprises computer-readable instructions, and the processor is configured to call the computer-readable instructions to execute the above-mentioned scenic spot retrieval method based on a large language model.

[0032] The beneficial effects brought by the technical solution provided by the present invention are:

[0033] The present invention has built a knowledge graph automatic construction pipeline based on a large language model, built a knowledge graph of scenic spots from documents related to scenic spots, converted a large amount of unstructured text into a multi-level knowledge graph, generated communities and community reports of scenic spots, integrated fragmented tourism information, used the multi-level knowledge graph as a retrieval source, and the large language model searched from top to bottom in different levels according to the needs in the query, thus reducing the difficulty of the query. BRIEF DESCRIPTION OF THE DRAWINGS

[0034] Figure 1 is a flow chart of a scenic spot retrieval method based on a large language model according to an embodiment of the present invention;

[0035] Figure 2 is an exemplary scenic spot knowledge graph of an embodiment of the present invention;

[0036] Figure 3 It is a block diagram of an electronic device in an exemplary embodiment of the present invention. DETAILED DESCRIPTION

[0037] To make the objectives, technical solutions and advantages of the present invention more clear, the embodiments of the present invention will be further described below with reference to the accompanying drawings.

[0038] The scenic spot retrieval method based on a large language model in the embodiment of the present invention first needs to build a knowledge graph based on a large language model. Knowledge graph is a technology that uses a graph structure to represent knowledge and information, allowing intelligent systems to acquire the ability to solve complex tasks. The knowledge graph consists of nodes and edges, where nodes represent entities and edges represent information between entities. In this way, the knowledge graph can clearly show the complex relationships between different entities and form a structured knowledge network. This structured representation enables efficient query and reasoning.

[0039] The flowchart of the scenic spot retrieval method based on a large language model according to an embodiment of the present invention is as follows: Figure 1 , specifically including the following steps:

[0040] S1. Obtain documents related to scenic spots, set windows of common paragraphs with contextual connections, segment the documents, and obtain a document vector database.

[0041] S11. Collect original document materials related to attractions, including travel guides, attraction introductions, historical backgrounds, and user reviews.

[0042] S12. Documents related to tourism often exist in the form of long documents, and the entities mentioned in the context are usually cross-paragraph and closely related. In order to effectively segment documents and retain the complete information of each document block as much as possible. The original document data is preprocessed, including: word segmentation, removal of stop words, part-of-speech tagging, to obtain the required scenic spot-related documents, set up windows with common paragraphs with contextual connection, and segment the scenic spot-related documents, effectively improving the large language model's ability to recognize the same entities in different paragraphs. Set up windows with common paragraphs with contextual connection, for example, segment a document including ABC paragraphs (or sentences) into two documents: AB and BC, and the two documents contain the same paragraph (or sentence) B for contextual connection.

[0043] S13. Vectorize the segmented document fragments and convert the text into a vector representation. The result of vectorization is a vector in a high-dimensional space that can capture the semantic information of the text. Select a suitable vector database, such as Milvus, VectorDB, etc., to store the vectorized document vectors and obtain a document vector database.

[0044] S2. There are many types of entities related to tourism, so it is necessary to build a list of entity types and use a large language model to extract different types of entities from documents. In an embodiment of the present invention, a pre-trained large language model can be selected, such as BERT, GPT, RoBERTa, etc. These models have been pre-trained on a large amount of text and can capture rich language features. Fine-tune the pre-trained model using labeled data, such as the label of a scenic spot is a scenic spot and a restaurant is a delicacy. Input the text into the fine-tuned model, and the model will output the entity label for each word or phrase. The large language model will read the context of the entity and search the document vector database based on the entity to generate a summary description of the entity.

[0045] In the process of constructing the tourism knowledge graph, due to the richness of entity types, combining these entities into a large knowledge graph is a huge and complex project, and too many graph nodes in the same level will bring certain challenges to the retrieval process of the large language model. When the user's query needs are limited to attractions, if a single level that aggregates all tourism-related information is searched, it may cause hallucinations. Construct a multi-level tourism knowledge graph and divide different types of graph nodes into different levels. The large language model will search from top to bottom in different levels according to the queries issued by the user and the needs in the query.

[0046] Different types of entities are divided into different levels. The first level is the entity composition of the scenic spot. The second level is the entity composition of the classification of supporting facilities included in the scenic spot. The classification of supporting facilities included in the scenic spot includes: accommodation, food, and entertainment facilities. The third level is the entity composition of specific supporting facilities, such as the name of specific accommodation, and an entity vector database is constructed.

[0047] S3. Aggregate the specific supporting facilities of the third layer according to the classification of the supporting facilities of the second layer to form aggregates of different supporting facility types. According to the document vector database, connect the aggregates of different supporting facility types with the scenic spot entities of the first layer to construct a scenic spot knowledge graph. Figure 2 , Figure 2 It is an exemplary scenic spot knowledge graph of an embodiment of the present invention, in which a certain scenic spot is the first level, accommodation, food, and recreational facilities are the second level, and a certain restaurant, a certain hotel, and People's Park are the third level.

[0048] Calculate the degree of two connected entities. The degree is the number of edges connecting the entities. After counting the degrees of the two connected entities, create a new variable "rank". This data is calculated by adding the degrees of the two connected entities. The purpose is to understand the total degree of the two entities connected by each edge. The purpose of the total degree is to measure the importance or influence of the nodes connected by each edge in the network. It can help analyze the strength of the connection, perform community detection, edge prediction, and even rank the importance of the edges in the network to find the most critical connections.

[0049] S4. All entities at the third level connected to an entity at the first level constitute the scenic spot community of an entity at the first level. The scenic spot communities are clustered. The following formula is used to cluster the scenic spot communities:

[0050]

[0051] Among them, H represents modularity, an indicator to measure the quality of community division. It reflects whether the community structure is more closely connected than the random edge. The larger the value, the more reasonable the community division. m represents the total number of edges in the network, that is, the number of all edges in the network. is to normalize the number of edges in the community; e c represents the actual number of edges in community c, that is, the actual number of edges connected within the community; γ represents the resolution parameter, which is used to adjust the granularity of community division. A larger γ value will lead to more community divisions (more and smaller communities), and a smaller γ value will produce fewer communities; K c represents the sum of the degrees of all nodes in community c, that is, the sum of the degrees of all nodes in the community (the number of edges of each node); represents the expected number of edges in community c in a random network. This term estimates how many edges there may be in community c in a network with the same node degree distribution as the real network but with random edges.

[0052] The algorithm is used to generate a hierarchical structure of entity communities and cluster the constructed entities, providing a method for navigating knowledge at different levels of granularity. Different types of scenic spot communities are obtained and summarized using a large language model. The large language model reads the relevant information of the nodes in each community and uses the large language model to build a scenic spot community report. The content involved in the report includes a general introduction to the scenic spot and a brief introduction to the main supporting facilities in the scenic spot community, such as hotels, restaurants, and recreational facilities.

[0053] S5. The large language model extracts query entities from the query conditions, and searches the entity vector database for entity data with the closest semantic similarity to the query entity. The large language model generates answers based on community reports and knowledge graphs.

[0054] S51. The large language model extracts query entities from the query conditions and vectorizes the query entities.

[0055] S52. Calculate the similarity between the vectorized query entity and the entity vector in the entity vector database.

[0056]

[0057] Among them, Sim(q i ,c j ) indicates q i and c j The similarity is calculated by cosine similarity, q i represents the i-th vectorized query entity, c j represents the j-th entity vector in the entity vector database, and || || represents the modulus of the vector.

[0058] S53. Apply a greedy matching strategy to select the most similar matching items, while considering the importance factor to determine the semantic impact of specific words on the overall query, and finally calculate the matching score and return the most matching item.

[0059]

[0060]

[0061] in, express and c i The matching score of for q i The best match for i Indicates qi The importance factor indicates the influence of the word on the overall query. TotalScore(Q,C) indicates the overall matching score. Q = {q1,q2,...,q n} represents the set of all vectorized query entities, C = {c1, c2, ..., c n} represents the collection of entity vectors in the entity vector database.

[0062] S54. Based on the most matching items, the large language model generates answers based on community reports and knowledge graphs.

[0063] In an exemplary embodiment, a computer-readable storage medium is included, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the above-mentioned scenic spot retrieval method based on a large language model is implemented.

[0064] See also Figure 3 In an exemplary embodiment, an electronic device is also included, including at least one processor, at least one memory, and at least one communication bus.

[0065] The memory stores a computer program, which includes computer-readable instructions. The processor calls the computer-readable instructions stored in the memory through a communication bus to execute the above-mentioned scenic spot retrieval method based on a large language model.

[0066] The above description of the disclosed embodiments enables one skilled in the art to implement or use the present invention. Various modifications to these embodiments will be apparent to one skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the present invention. Therefore, the present invention will not be limited to the embodiments shown herein, but rather to the widest scope consistent with the principles and novel features disclosed herein.

Claims

1. A scenic spot retrieval method based on a large language model, characterized in that: The following steps are involved: S1, obtain documents related to scenic spots, set windows with common paragraphs with contextual connection, segment the documents, and obtain a document vector database; S2. Build an entity type list, use a large language model to extract different types of entities from the document, divide different types of entities into different levels, the first level is the scenic spot, the second level is the classification of supporting facilities included in the scenic spot, and the third level is the specific supporting facilities, and build an entity vector database; S3, aggregate the specific supporting facilities of the third layer according to the classification of the supporting facilities of the second layer to form aggregates of different supporting facility types, and connect the aggregates of different supporting facility types with the scenic spot entities of the first layer according to the document vector database to construct a scenic spot knowledge graph; S4. All entities at the third level connected to an entity at the first level constitute a scenic spot community of the entity at the first level. The scenic spot communities are clustered to obtain different types of scenic spot communities, and a scenic spot community report is constructed using a large language model. S5. The large language model extracts query entities from the query conditions, and searches the entity vector database for entity data with the closest semantic similarity to the query entity. The large language model generates answers based on community reports and knowledge graphs.

2. The scenic spot retrieval method based on a large language model according to claim 1, characterized in that: S1 is specifically: S11. Collect original documents related to attractions, including travel guides, attraction introductions, historical background, and user reviews; S12, pre-processing the original document data, including: word segmentation, removal of stop words, part-of-speech tagging, obtaining the required scenic spot related documents, setting windows with common paragraphs with contextual connection, and segmenting the scenic spot related documents; S13. Vectorize the segmented document segments, convert the text into vector representation, select a suitable vector database, store the vectorized document vectors, and obtain a document vector database.

3. The scenic spot retrieval method based on a large language model according to claim 1, characterized in that: The items included in the scenic spot are classified into: accommodation, food, and recreational facilities.

4. The scenic spot retrieval method based on a large language model according to claim 1, characterized in that: The attraction communities are clustered using the following formula: Among them, H represents modularity, m represents the total number of edges in the scenic spot community, and e c represents the actual number of edges in community c, γ represents the resolution parameter, and K c represents the sum of the degrees of all nodes in community c.

5. The scenic spot retrieval method based on a large language model according to claim 1, characterized in that: The community report includes: an introduction to the scenic spot and an introduction to the supporting facilities in the scenic spot community.

6. The scenic spot retrieval method based on a large language model according to claim 1, characterized in that: S5 is as follows: S51, the large language model extracts the query entity from the query condition and vectorizes the query entity; S52, using cosine similarity to calculate the similarity between the vectorized query entity and the entity vector in the entity vector database; Among them, Sim(q i ,c j ) indicates q i and c j The similarity, q i represents the i-th vectorized query entity, c j represents the j-th entity vector in the entity vector database, || || represents the modulus of the vector; S53, applying a greedy matching strategy, selecting an entity vector in the entity vector database that is most similar to the query entity as the best match, while considering importance factors, determining the influence of specific words on the semantics of the overall query, calculating a matching score, and returning the best match item; in, express and c i The matching score of Q i The best match for i Indicates q i The importance factor of TotalScore(Q,C) represents the overall matching score, Q = {q1,q2,...,q n } represents the set of all vectorized query entities, C = {c1, c2, ..., c n } represents the set of entity vectors in the entity vector database; S54. Based on the most matching items, the large language model generates answers based on community reports and knowledge graphs.

7. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the method according to any one of claims 1 to 6 is implemented.

8. An electronic device, characterized in that: The method comprises a processor and a memory, wherein the processor and the memory are interconnected, wherein the memory is used to store a computer program, the computer program comprises computer-readable instructions, and the processor is configured to call the computer-readable instructions to execute the method according to any one of claims 1 to 6.

Citation Information

Patent Citations

  • Government affair service field multi-strategy fusion dialogue method based on knowledge graph

    CN116628172A

  • Intelligent question and answer model construction method based on knowledge graph vectorization representation

    CN118210907A

  • Construction industry safety question and answer method and equipment based on large language model technology

    CN118332092A

  • Knowledge management question-answering system construction method and device

    CN118446296A

  • Construction method of RAG system based on Graph

    CN118503407A

Cited By

  • Multi-document intelligent question and answer method, device and equipment based on multi-agent cooperation

    CN119719318A