A hybrid knowledge retrieval enhancement method and device suitable for public transportation scenarios
Patent Information
- Application Number
- CN202610988201.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-07-03
- Publication Date
- 2026-11-10
Smart Images

Figure CN123068464A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of artificial intelligence technology, and more particularly to the field of intelligent transportation technology, specifically to a hybrid knowledge retrieval enhancement method and device suitable for public transportation scenarios. Background Technology
[0002] With the development of Retrieval-Augmented Generation (RAG) technology, enterprises have begun to adopt RAG architecture to inject proprietary knowledge into large language models. Currently, RAG knowledge retrieval mainly employs the following technical solutions: (1) Single vector retrieval scheme: After vectorizing the document, it is stored in the vector database. When users query, they can retrieve relevant documents by semantic similarity. However, single vector retrieval is not good for professional terms and exact matching. (2) Keyword retrieval scheme: The traditional search engine technology such as BM25 and Elasticsearch is used to retrieve relevant documents by keyword matching. This scheme is good for exact matching, but has weak semantic understanding ability. (3) Hybrid retrieval scheme: The combination of vector retrieval and keyword retrieval is used to improve the retrieval accuracy by combining the two results. However, it often uses a simple weighted average to fuse the retrieval results. It lacks multi-dimensional evaluation of document quality, timeliness, authority, etc., and cannot optimize the re-ranking weight for the public transportation scenario. (4) Knowledge graph enhanced retrieval scheme: The knowledge graph technology is introduced to enhance the retrieval effect through entity relationship reasoning. However, the traditional RAG system knowledge base update relies on manual import of documents and cannot perceive changes in public transportation operation data in real time, such as route adjustments and timetable changes. In other words, the lack of knowledge version management may lead to the retrieval being based on outdated knowledge.
[0003] There is currently no effective solution to the above problems. Therefore, there is an urgent need to propose a new hybrid knowledge retrieval enhancement method. Summary of the Invention
[0004] To address at least one of the technical problems raised in the background section, this application provides a hybrid knowledge retrieval enhancement method and apparatus suitable for public transportation scenarios, which can achieve accurate retrieval of knowledge from public transportation companies.
[0005] In a first aspect, embodiments of the present invention provide a hybrid knowledge retrieval enhancement method suitable for public transportation scenarios, comprising: Receive initial query data input by the user on the terminal, and perform preprocessing operations on the initial query data to obtain candidate query data; The candidate query data is subjected to a three-way retrieval operation in parallel to obtain a candidate knowledge set, wherein the candidate knowledge set includes multiple candidate documents; Determine the comprehensive score of each candidate document, and based on the comprehensive score of each candidate document, determine the target retrieval result from the candidate knowledge set; Based on the target retrieval results, a total prompt term is constructed, and an answer is generated based on the total prompt term and a pre-trained artificial intelligence model.
[0006] In some optional embodiments of this example, the preprocessing operation on the initial query data to obtain candidate query data includes: The initial query data is segmented into words to obtain multiple words; Based on a pre-trained bus entity recognition model, multiple bus entities are identified from the multiple word segments; Based on the public transportation domain dictionary, the synonyms of each segmented word are expanded to obtain the synonym expansion results of each segmented word; The initial query data is vectorized to obtain a query vector; wherein, the multiple word segments, the synonym expansion results of each word segment, the multiple bus entities, and the query vector constitute the candidate query data.
[0007] In some optional embodiments of this example, the parallel execution of three-way retrieval operations on the candidate query data to obtain a candidate knowledge set includes: Based on the query vector, perform a vector retrieval operation to obtain the vector retrieval results; Based on the multiple word segments and the synonym expansion results of each word segment, a keyword retrieval operation is performed to obtain the keyword retrieval results; Based on the multiple bus entities, a graph retrieval operation is performed to obtain the graph retrieval results; The vector retrieval results, the keyword retrieval results, and the graph retrieval results are merged and deduplicated to obtain the candidate knowledge set.
[0008] In some optional embodiments of this example, determining the overall score for each candidate document includes: Extract multi-dimensional features from each candidate document, wherein the multi-dimensional features include semantic similarity, keyword matching degree, graph correlation degree, document quality score, timeliness score, and authority score; Based on the semantic similarity, keyword matching degree, graph correlation degree, document quality score, timeliness score, authority score, and the feature weights corresponding to each dimension, the comprehensive score of each candidate document is determined.
[0009] In some optional embodiments of this example, based on the target retrieval results, a total prompt term is constructed, including: The target retrieval results are processed in a structured manner to obtain a structured context, wherein the structured context includes multiple knowledge fragments, and each knowledge fragment includes knowledge content, knowledge source, update time and relevance information; Based on the structured context, pre-set system prompts, and the initial query data, a total prompt is constructed.
[0010] In some optional embodiments of this example, the following are also included: Real-time monitoring of knowledge validity to determine whether knowledge update conditions have been triggered: If triggered, identify the changed document and update the vector representation, keyword index, and knowledge graph based on the changed document.
[0011] Secondly, embodiments of the present invention also provide a hybrid knowledge retrieval enhancement device suitable for public transportation scenarios, comprising: The query preprocessing module is configured to receive initial query data input by the user on the terminal and perform preprocessing operations on the initial query data to obtain candidate query data; The multi-way retrieval module is configured to perform three-way retrieval operations in parallel on the candidate query data to obtain a candidate knowledge set, wherein the candidate knowledge set includes multiple candidate documents; The target retrieval result determination module is configured to determine the comprehensive score of each candidate document and, based on the comprehensive score of each candidate document, determine the target retrieval result from the candidate knowledge set; The answer generation module is configured to construct a total prompt word based on the target retrieval results, and generate an answer based on the total prompt word and a pre-trained artificial intelligence model.
[0012] Thirdly, this application also provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement the steps of the hybrid knowledge retrieval enhancement method for public transportation scenarios described in the first aspect.
[0013] Fourthly, this application also provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the steps of the hybrid knowledge retrieval enhancement method for public transportation scenarios described in the first aspect.
[0014] Fifthly, this application also provides a computer program product, including a computer program / instructions that, when executed by a processor, implement the steps of the hybrid knowledge retrieval enhancement method for public transportation scenarios described in the first aspect.
[0015] This invention provides a hybrid knowledge retrieval enhancement method and apparatus suitable for public transportation scenarios. The method involves preprocessing the initial query data input by the user at the terminal to obtain candidate query data; performing three-way retrieval operations in parallel on the candidate query data to obtain a candidate knowledge set; determining the comprehensive score of each candidate document; and based on the comprehensive score of each candidate document, determining the target retrieval result from the candidate knowledge set; constructing a general prompt term based on the target retrieval result; and generating an answer based on the general prompt term and a pre-trained artificial intelligence model. This enables accurate retrieval of knowledge related to public transportation companies. Attached Figure Description
[0016] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort. In the drawings: Figure 1 One of the flowcharts for a hybrid knowledge retrieval enhancement method applicable to public transportation scenarios provided in this application embodiment; Figure 2 The second flowchart illustrates the hybrid knowledge retrieval enhancement method applicable to public transportation scenarios provided in this application embodiment. Figure 3 The third flowchart illustrates the hybrid knowledge retrieval enhancement method applicable to public transportation scenarios provided in this application embodiment. Figure 4 The fourth flowchart illustrates the hybrid knowledge retrieval enhancement method applicable to public transportation scenarios provided in this application embodiment. Figure 5 Fifth flowchart illustrating the hybrid knowledge retrieval enhancement method applicable to public transportation scenarios provided in this application embodiment; Figure 6 A schematic diagram of the structure of the hybrid knowledge retrieval enhancement device for public transportation scenarios provided in the embodiments of this application; Figure 7 This is a block diagram of an electronic device used to implement embodiments of this application. Detailed Implementation
[0017] To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, the embodiments of the present invention will be further described in detail below with reference to the accompanying drawings. Here, the illustrative embodiments of the present invention and their descriptions are used to explain the present invention, but are not intended to limit the present invention.
[0018] The information collected in the technical solution of this application is information and data authorized by the user or fully authorized by all parties. The collection, storage, use, processing, transmission, provision, disclosure and application of the relevant data all comply with the relevant laws, regulations and standards of the relevant countries and regions, necessary confidentiality measures have been taken, and they do not violate public order and good morals. Corresponding operation portals are provided for users to choose to authorize or refuse.
[0019] The acquisition, transmission, storage, use, and processing of data in this application comply with relevant national laws and regulations. It should be noted that certain software, components, models, and other existing industry solutions may be mentioned in the embodiments of this application. These should be considered exemplary, intended only to illustrate the feasibility of implementing the technical solution of this application, and do not imply that the applicant has already used or necessarily used such solutions.
[0020] After in-depth analysis of existing technologies, the following six core defects were found in the current RAG knowledge retrieval system: (1) The retrieval method is single and lacks multi-path retrieval fusion. Specifically, single vector retrieval is poor in terms of professional terms and precise matching; single keyword retrieval lacks semantic understanding ability; and there is a lack of three-way fusion of vector retrieval, keyword retrieval and graph retrieval. (2) The re-ranking strategy is simple and lacks multi-dimensional comprehensive evaluation. Specifically, existing solutions mostly adopt simple weighted average fusion of retrieval results and lack multi-dimensional evaluation of document quality, timeliness, authority, etc., and cannot optimize the re-ranking weight for public transportation scenarios. (3) Knowledge updates are lagging and lack a real-time perception mechanism. Specifically, the traditional RAG system knowledge base updates rely on manual document import; and it cannot perceive changes in public transportation operation data (such as route adjustments and timetable changes) in real time. The lack of knowledge version management may lead to retrieval based on outdated knowledge; (4) poor adaptability to public transportation scenarios and lack of domain-specific optimization. Specifically, the general RAG framework is not optimized for the characteristics of public transportation business, lacks a public transportation-specific domain dictionary and terminology recognition, and cannot understand public transportation industry terms (such as express buses, interval buses, and cross-line scheduling); (5) simple context construction and lack of source and timeliness information. Specifically, the retrieved documents are directly spliced into the Prompt and lack structured organization; key information such as knowledge source, update time and relevance is not injected; the model cannot judge the reliability and timeliness of knowledge; (6) the retrieval effect cannot be quantitatively evaluated. Specifically, there is a lack of continuous optimization mechanism, lack of automatic evaluation of retrieval accuracy, user feedback is not used to optimize retrieval strategies, and retrieval weight parameters cannot be automatically adjusted according to business data.
[0021] In view of this, in order to address at least one of the aforementioned deficiencies, embodiments of this application provide a hybrid knowledge retrieval enhancement method suitable for public transportation scenarios, such as... Figure 1 As shown, the method includes: Step S1: Receive the initial query data input by the user on the terminal, and perform preprocessing operations on the initial query data to obtain candidate query data; Step S2: Perform three-way retrieval operations in parallel on the candidate query data to obtain a candidate knowledge set, wherein the candidate knowledge set includes multiple candidate documents; Step S3: Determine the comprehensive score of each candidate document, and based on the comprehensive score of each candidate document, determine the target retrieval result from the candidate knowledge set; Step S4: Based on the target retrieval results, construct the total prompt words, and generate the answer based on the total prompt words and the pre-trained artificial intelligence model.
[0022] This invention provides a hybrid knowledge retrieval enhancement method suitable for public transportation scenarios. It performs three-way parallel retrieval on candidate query data to improve recall rate; determines target retrieval results from the candidate knowledge set based on the comprehensive score of each candidate document; constructs general prompt words based on the target retrieval results; and generates answers based on the general prompt words and a pre-trained artificial intelligence model, thereby achieving accurate retrieval of knowledge about public transportation companies.
[0023] The following is a detailed description of steps S1-S4: Step S1: Receive the initial query data input by the user on the terminal, and perform preprocessing operations on the initial query data to obtain candidate query data.
[0024] In this embodiment, the user inputs initial query data on the terminal. The initial query data is in natural language. For example, the user inputs "Which stops does bus route 101 pass through?" or "What bus routes are there from People's Square to the train station? Which one is the fastest? How much is the fare?". The preprocessing operations include word segmentation, bus entity recognition, synonym expansion, and vectorization.
[0025] In some optional embodiments of this example, such as Figure 2 As shown, step S1 further includes: Step S11: Perform word segmentation on the initial query data to obtain multiple words.
[0026] In this embodiment, the initial query data is segmented into words to obtain multiple words. For example, if the input initial query data is "Which stops does bus route 101 pass through?", the word segmentation result is ["Route 101", "bus", "passes through", "which", "stops"]; if the input initial query data is "From People's Square to the train station, what bus routes are there? Which one is the fastest? How much is the fare?", the word segmentation result is ["from", "People's Square", "to", "train station", "which", "bus routes", "fastest", "fare"].
[0027] Step S12: Based on the pre-trained bus entity recognition model, determine multiple bus entities from the multiple word segments.
[0028] In this embodiment, a pre-trained bus entity recognition model can identify bus entities from multiple word segments. The types of bus entities include route entities, station entities, and time entities. For example, route entities include "Route 101" and "Line 1"; station entities include "People's Square" and "Railway Station"; and time entities include "morning rush hour" and "last bus".
[0029] For example, based on the bus entity recognition model, recognizing the word segmentation result Words = ["Route 101", "bus", "passes through", "which", "stops"] can yield Entities (a list of recognized entities) = [{type: "route", value: "Route 101"}]; recognizing the word segmentation result Words = ["from", "People's Square", "to", "train station", "which", "bus route", "fastest", "fare"] can yield the bus entity recognition result Entities = [{type: "stops", value: "People's Square"}, {type: "stops", value: "train station"}].
[0030] Step S13: Based on the public transportation domain dictionary, perform synonym expansion on each of the segmented words to obtain the synonym expansion results for each of the segmented words.
[0031] In this embodiment, a public transportation domain dictionary is used as a reference to expand the synonyms of each word segment to obtain the synonym expansion results of each word segment. For example, the synonym expansion results of "express bus" are ["express bus", "express bus route", "express bus"]; the synonym expansion results of "section bus" are ["section bus", "section route", "short-distance bus"].
[0032] In the aforementioned example, by performing synonym expansion on the word segmentation result Words = ["Route 101", "bus", "passing through", "which", "stations"], we can obtain Synonyms = ["Route 101", "Route 101 bus", "Route 101 bus"; by performing synonym expansion on the word segmentation result Words = ["from", "People's Square", "to", "train station", "which", "bus route", "fastest", "ticket price"], we can obtain Synonyms = ["People's Square", "square", "train station", "high-speed rail station", "railway station"].
[0033] Step S14: Vectorize the initial query data to obtain a query vector; wherein, the multiple word segments, the synonym expansion results of each word segment, the multiple bus entities, and the query vector constitute the candidate query data.
[0034] In this embodiment, the initial query data is vectorized (embedding) to obtain a multi-dimensional query vector, such as 1024-dimensional.
[0035] Thus, by performing the above preprocessing operations on the initial query data, candidate query data consisting of word segmentation results (Words), identified entity list (Entities), synonym expansion results (Synonyms), and query vector (Q_embedding) can be obtained, providing data conditions for subsequent parallel three-way retrieval.
[0036] Step S2: Perform three-way retrieval operations in parallel on the candidate query data to obtain a candidate knowledge set, wherein the candidate knowledge set includes multiple candidate documents.
[0037] In this embodiment, the three-way retrieval operation includes a semantic matching vector retrieval operation, a precise matching keyword retrieval operation, and a relational reasoning graph retrieval operation. Specifically, vector retrieval retrieves relevant documents based on semantic similarity; keyword retrieval uses the BM25 algorithm and a public transportation domain dictionary for precise matching; and graph retrieval retrieves related knowledge based on entity relation reasoning from a knowledge graph. The results of the three retrieval operations are merged to obtain a candidate knowledge set, effectively improving recall and retrieval accuracy.
[0038] Specifically, such as Figure 3 As shown, step S2 further includes: Step S21: Based on the query vector, perform a vector retrieval operation to obtain the vector retrieval result.
[0039] In this embodiment, the query vector database includes multiple vectorized documents. The cosine similarity between the query vector and each vectorized document in the database is calculated, and the documents are sorted in descending order of cosine similarity. The vectorized documents with the highest cosine similarity are selected as the vector retrieval results, represented as follows: K_vector (vector retrieval results) = [{doc_id: "doc_001", content: "...", similarity: 0.92, source: "Route Manual"},{doc_id: "doc_002", content: "...", similarity: 0.88, source: "Timetable"}. For example, the top-5 vector retrieval results are as follows: doc_001: "Route 101 runs from People's Square to the Railway Station, passing through 20 stops..." (similarity: 0.92); doc_002: "List of stops for Route 101: People's Square, Municipal Departments, Railway Station..." (similarity: 0.89); doc_003: "Route 101 Operation Information: First bus at 6:00, last bus at 22:00..." (similarity: 0.85); doc_004: "Route 101 Fare: 2 yuan for the entire journey, 1.6 yuan with a card..." (similarity: 0.78); doc_005: "Route 101 departs every 5 minutes during peak hours..." (similarity: 0.75).
[0040] Step S22: Based on the multiple word segments and the synonym expansion results of each word segment, perform a keyword retrieval operation to obtain the keyword retrieval results.
[0041] In this embodiment, based on the aforementioned determined word segmentation results and synonym expansion results, query keywords are constructed. Based on a pre-configured keyword search engine, the query keywords are calculated, and their BM25 scores are assigned to each document. The documents with the highest scores (ranked in descending order) are then selected as the keyword retrieval results, represented as follows: K_keyword (keyword retrieval results) = [{doc_id: "doc_003", content: "...", bm25_score: 12.5, source: "Ticket Price Rules"},{doc_id: "doc_001", content: "...", bm25_score: 11.8, source: "Route Manual"},...]. For example, the top-5 keyword retrieval results are as follows: doc_001: "List of stops for Route 101..." (bm25: 15.2); doc_002: "Detailed explanation of stops along Route 101..." (bm25: 14.8); doc_003: "Notice of adjustments to Route 101..." (bm25: 12.5); doc_004: "Operating hours of Route 101..." (bm25: 11.2); doc_005: "Fare information for Route 101..." (bm25: 10.8).
[0042] Step S23: Based on the multiple bus entities, perform a graph retrieval operation to obtain the graph retrieval results.
[0043] In this embodiment, based on the aforementioned determined list of bus entity identifications and the pre-set indicator graph, entity association retrieval is first performed, such as querying nodes directly associated with an entity or querying nodes second-degree related to an entity; secondly, path reasoning is performed, such as querying the path relationship between entities, for example, "Route 101" → "passes through" → "People's Square" → "adjacent stops" → "Railway Station"; further, subgraph matching is performed, for example, querying subgraphs related to entities, for example, the route-stop-timetable subgraph; the graph retrieval result is represented as follows: K_graph (graph retrieval result) = [{doc_id: "graph_001", content: "Route 101 passes through People's Square and the Railway Station", graph_score: 0.95, source:"Knowledge Graph"},{doc_id: "graph_002", content: "People's Square Station's adjacent stops are the Railway Station and municipal functional departments", graph_score: 0.88, source: "Knowledge Graph"},...], for example, the graph retrieval result is as follows: graph_001: "Route 101 → Passes through → People's Square" (graph_score: 0.95); graph_002: "Route 101 → Passes through → Municipal functional departments" (graph_score: 0.95); graph_003: "Route 101 → Passes through → Railway Station" (graph_score: 0.95); graph_004: "People's Square → Adjacent → Municipal functional departments" (graph_score: 0.88); graph_005: "Municipal functional departments → Adjacent → Railway Station" (graph_score: 0.88).
[0044] Step S24: Merge and deduplicate the vector retrieval results, the keyword retrieval results, and the graph retrieval results to obtain the candidate knowledge set.
[0045] In this embodiment, firstly, a union strategy is adopted to deduplicate and merge the three search results. Specifically, a union operation is performed on the candidate document set K_vector from vector retrieval, the candidate document set K_keyword from keyword retrieval, and the candidate document set K_graph from graph retrieval to obtain a unified candidate knowledge set K_candidate = K_vector. K_keyword K_graph ensures that the same document will not appear repeatedly in the candidate set.
[0046] Secondly, during the merging process, the system retains the original relevance score assigned to each candidate document by each retrieval path. Specifically, the semantic similarity score contributed by vector retrieval is recorded as the similarity field, the BM25 relevance score contributed by keyword retrieval is recorded as the bm25_score field, and the structured matching score contributed by graph retrieval is recorded as the graph_score field. Each score field is stored independently without overwriting others, in order to preserve complementary information between different retrieval signals and provide a basis for subsequent comprehensive scoring and re-ranking.
[0047] In addition, the system records the retrieval source information for each candidate document. Based on which retrieval paths a document was recalled by, its source is labeled as a single path or a combination of multiple paths. The labeling method is as follows: documents recalled only by vector retrieval are labeled [vector]; documents recalled by both vector retrieval and keyword retrieval are labeled [vector, keyword]; documents recalled by all three retrieval paths are labeled [vector, keyword, graph]. Recording the source information provides an interpretable basis for subsequent retrieval quality analysis; for example, the effectiveness of the fusion strategy can be inferred by analyzing the co-occurrence of multiple retrieval paths.
[0048] Finally, each candidate document in the candidate knowledge set K_candidate is output as a structured entry, containing a document identifier, the original score field, and a list of search sources. An example of the output format is as follows: Document doc_001 is retrieved by both vector search and keyword search, and its entry is {doc_id: "doc_001", sources: ["vector", "keyword"], similarity: 0.85, bm25_score: 12.6, ...}; Document doc_002 is retrieved only by vector search, and its entry is {doc_id: "doc_002", sources: ["vector"], similarity: 0.78,...}. The combined result constitutes the candidate knowledge set, which serves as input data for subsequent re-ranking or answer generation.
[0049] Step S3: Determine the comprehensive score of each candidate document, and based on the comprehensive score of each candidate document, determine the target retrieval result from the candidate knowledge set.
[0050] In some optional embodiments of this example, step S3, determining the comprehensive score of each candidate document, such as... Figure 4 As shown, it includes: Step S31: Extract multi-dimensional features of each candidate document, wherein the multi-dimensional features include semantic similarity, keyword matching degree, graph correlation degree, document quality score, timeliness score and authority score.
[0051] Step S32: Based on the semantic similarity, keyword matching degree, graph correlation degree, document quality score, timeliness score, authority score, and the feature weights corresponding to each dimension, determine the comprehensive score of each candidate document.
[0052] Specifically, in a hybrid retrieval system, the core step in ensuring the quality of the final retrieval is to refine the candidate knowledge set. This stage takes the candidate knowledge set K_candidate and the user's original query Q (i.e., the initial query data) as input, and through three sub-steps—six-dimensional feature extraction, comprehensive weighted scoring, and dynamic sorting and truncation—selects the final retrieval results that best match the current query requirements and have the highest overall quality from multi-source heterogeneous candidate documents.
[0053] First, for each candidate document D_i in the candidate knowledge set, quantitative features are extracted from the following six dimensions to comprehensively characterize the degree of matching between the document and the query and its own quality attributes.
[0054] Semantic Similarity (S_semantic): This feature measures the semantic similarity between candidate documents and user queries. The system encodes the user query and candidate documents into dense vectors Q_embedding and Di_i_embedding respectively using an embedding model, and calculates the cosine similarity between them. The closer this value is to 1, the more semantically relevant the document is to the query.
[0055] Keyword matching score (S_keyword): This feature reflects the degree of literal matching between candidate documents and user queries at the keyword level. The BM25 algorithm is used to calculate the relevance score between the query and the document, and the original score is normalized and mapped to the [0, 1] interval to make it comparable to other features.
[0056] Graph Relevance (S_graph): This feature measures the strength of the association between the candidate document and the entities and relational structures in the public transportation knowledge graph. If the current candidate document originates from the graph retrieval path, its original matching score in the graph retrieval is directly used as this feature value; if the document is not retrieved by the graph retrieval, this feature value is set to 0.
[0057] Document Quality Score (S_quality): This feature comprehensively evaluates the document's content quality, independent of query information, and reflects the document's information richness and readability. The quality score is a weighted composite of three sub-features: Document length (Q_length): Documents of moderate length score the highest. Too short a document may lack sufficient information, while too long a document may contain redundant information. The ideal length range is dynamically set according to the document type. Structural integrity (Q_structure): Documents that include structural elements such as headings, paragraph divisions, and lists score higher. Documents with clear structures are easier to search and read. Language fluency (Q_fluency): Documents with correct grammar, no typos, and fluent expression score higher.
[0058] For example, after the three sub-features are normalized to the [0, 1] interval, they are weighted and combined to form a document quality score according to the following weights: S_quality=0.4×Q_length+0.3×Q_structure+0.3×Q_fluency.
[0059] Timeliness Score (S_freshness): This feature measures the freshness of document information, and is particularly suitable for time-sensitive knowledge such as route adjustments and timetable changes in public transportation scenarios. The system calculates the timeliness score using an exponential decay function based on the difference in days between the document's update time and the current date, ensuring that recently updated documents receive higher scores. A document from one year ago has a timeliness score of approximately 0.37, and the score approaches 0 as the document becomes older.
[0060] Feature 6: Authority Score (S_authority): This feature assesses the credibility of the document source and is an important dimension for ensuring the reliability of search results. The system categorizes and quantifies documents based on their source type: Official documents (e.g., departmental releases, company policies): highest authority, assigned a value of 1.0; Internal documents (e.g., departmental manuals, operating guidelines): relatively high authority, assigned a value of 0.8; Reference materials (e.g., training materials, FAQs): medium authority, assigned a value of 0.6; User-generated content (e.g., user feedback, suggestions): low authority, assigned a value of 0.4.
[0061] Thus, the six dimensions of features characterize the degree of matching between candidate documents and queries, as well as the quality attributes of the documents themselves, from different perspectives. To obtain a unified comprehensive score, the system uses a weighted linear weighted summation method to fuse the scores of each dimension.
[0062] For the characteristics of the public transportation scenario, the weights of each feature dimension are configured as follows: Semantic similarity reflects the semantic relationship between the query and the document, and is the core guarantee of retrieval quality, assigned the highest weight of 0.30; Keyword matching degree, as a supplementary signal to exact matching, helps to capture precise information such as entity names and route numbers, assigned a weight of 0.20; Knowledge graph correlation degree can provide structured entity relationship knowledge in the public transportation scenario, which is of great significance to the three-way retrieval strategy based on knowledge graph, assigned a weight of 0.15; Document quality score reflects the structure and readability of the document itself, ensuring the information integrity of the retrieval results, assigned a weight of 0.15; Timeliness score is particularly critical in the public transportation scenario, as recently updated route information and timetables have higher reference value than outdated data, assigned a weight of 0.10; Authority score ensures the security and reliability of retrieval results from the perspective of source credibility, assigned a weight of 0.10. The above weight values can be dynamically adjusted according to actual business needs and feedback after launch.
[0063] The overall score Score_i of candidate document D_ is calculated by weighted summation of the above six features, with a value range of [0, 1]. A higher score indicates that the document has a better overall match and quality under the current query. Score_i = w1×S_semantic + w2×S_keyword + w3×S_graph +W4×S_quality+ w5×S_freshness + w6×S_authority For example, w1=0.30, w2=0.20, w3=0.15, w4=0.15, w5=0.10, w6=0.10.
[0064] Here's a concrete example to illustrate the calculation process of the comprehensive score: Assume the six feature values of candidate document D_i are S_semantic=0.92, S_keyword=0.85, S_graph=0.95, S_quality=0.80, S_freshness=0.90, and S_authority=1.0, then its comprehensive score is calculated as follows: Score_i= 0.30×0.92+0.20×0.85+0.15×0.95+0.15×0.80+0.10×0.90+0.10×1.0=0.8985.
[0065] After scoring all candidate documents using the above method, the candidate knowledge set K_candidate is sorted according to the comprehensive score, and the Top-N documents are dynamically selected as the final retrieval results according to the task complexity, thus achieving a balance between retrieval quality and computational resource consumption in subsequent generation stages.
[0066] Specifically, the system sorts all documents in the candidate knowledge set in descending order based on the comprehensive score Score_i, with the document with the highest score ranked first. This indicates that the document performs best in six dimensions: semantic matching, keyword matching, graph relevance, document quality, timeliness, and authority, and best meets the knowledge requirements of the current query. After sorting, the system determines the number of documents to extract, N, based on the complexity of the current task. For simple tasks (such as factual question answering and single-point information queries), the knowledge requirements are clear, and a small number of high-quality reference documents can support accurate answer generation, so N=3. For medium tasks (such as route planning suggestions and multi-condition filtering queries), multiple information sources need to be considered, so N=5. For complex tasks (such as comprehensive analysis and cross-regional travel plan planning), a wide range of multi-dimensional knowledge needs to be covered, so N=10, forming the final target retrieval result set K_final. The documents in the target retrieval results contain metadata such as document identifiers, document content, comprehensive score, source type, and update time, providing structured input data for subsequent prompt word construction and answer generation modules. After the above three steps of six-dimensional feature extraction, comprehensive weighted scoring, and dynamic sorting and truncation, the system selects the final search results that are most relevant to the current query and of the highest quality from a large number of candidate documents recalled by multi-way retrieval, providing a reliable knowledge foundation for subsequent prompt word construction and answer generation.
[0067] Step S4: Based on the target retrieval results, construct the total prompt words, and generate the answer based on the total prompt words and the pre-trained artificial intelligence model.
[0068] In some optional embodiments of this example, such as Figure 5As shown, based on the target retrieval results, the specific scheme for constructing the overall suggestion keywords is as follows: Step S41: Perform structured processing on the target retrieval results to obtain a structured context, wherein the structured context includes multiple knowledge fragments, and each knowledge fragment includes knowledge content, knowledge source, update time and relevance information.
[0069] Step S42: Construct the overall prompt words based on the structured context, the pre-set system prompt words, and the initial query data.
[0070] Specifically, the candidate documents in the final target retrieval result set K_final are sorted in descending order of their comprehensive scores to ensure that the most relevant knowledge fragments are presented first in the context. Subsequently, the system converts each candidate document into a knowledge fragment in a uniform format. Each fragment contains the following fields: knowledge number (labeled sequentially in the format of [knowledge 1], [knowledge 2], etc., for easy reference when generating answers), source information (recording the document source type, such as "route manual", "timetable", etc.), update time (recording the document's update timestamp so that the model can perceive the timeliness of the knowledge), relevance score (recording the comprehensive score, retained to four decimal places, quantitatively reflecting the degree of matching between the knowledge fragment and the current query), and knowledge content (extracting the core content summary of the document).
[0071] After all the knowledge fragments are combined in sequence, they are embedded into a preset structured context template to form a complete context. In addition to containing the aforementioned knowledge fragments, this template also includes guiding instructions that require the model to explicitly explain and provide common-sense-based reference suggestions when its knowledge is insufficient to answer the question, thereby effectively mitigating the illusion phenomenon of large models.
[0072] Based on the structured organization of the context, a complete set of input prompts for the large model is constructed. The overall prompts adopt a three-part structure, consisting of a pre-set system prompt (SystemPrompt), a structured context (Context), and a user query (UserQuery) concatenated sequentially.
[0073] The system instruction section clearly defines the model's role and behavioral constraints. Its core content includes: setting the model as a smart assistant for public transportation companies, requiring it to prioritize answers based on provided knowledge, indicating the source of the answer in the answer (such as "according to the route manual"), clearly explaining and providing reference suggestions when knowledge is insufficient, and using public transportation professional terminology to ensure the accuracy and professionalism of the answers.
[0074] The structured context part is the aforementioned generated Context, which serves as the factual basis for the model's answer. The user query part is the user's initial query data Q (initial query data), which serves as the specific question that the model needs to answer.
[0075] Taking a typical query in a public transportation scenario as an example, when a user asks "What time does bus route 101 depart?", the system combines the system instructions, the context including knowledge fragments such as route manuals and timetables, and the user's question into a complete prompt, and submits it to the large model for processing.
[0076] For example, the general prompt words are as follows: "You are the intelligent assistant for the public transportation company. Please answer user questions based on the knowledge you provide about the public transportation company."
[0077] Answer requirements: 1. Prioritize answers based on provided knowledge; 2. Indicate the source of the answer (e.g., "according to the route manual"); 3. If knowledge is insufficient, clearly state the reason and provide suggestions; 4. Use public transportation terminology to maintain accuracy in the answer.
[0078] Answer the questions based on the following knowledge of public transportation companies:
[0079] [Knowledge 1] (Source: Route Manual, Updated: 2026-05-20, Relevance: 0.8985); Bus route 101 runs from People's Square to the train station, covering a distance of 15 kilometers and passing through 20 stops.
[0080] First bus departure time: 6:00 AM, last bus departure time: 10:00 PM.
[0081] During peak hours (7:00-9:00, 17:00-19:00), buses depart every 5 minutes, and during off-peak hours, they depart every 10 minutes.
[0082] [Knowledge 2] (Source: Timetable, Updated: 2026-06-01, Relevance: 0.8652); Route 101 real-time arrival information: There are currently 3 buses in operation, 2 stops, 5 stops, and 8 stops away from People's Square Station respectively. The next bus is expected to arrive at People's Square Station in 3 minutes.
[0083] Based on the above knowledge and the actual situation of public transportation services, please answer the user's questions.
[0084] If your knowledge is insufficient to answer the question, please specify clearly and provide common-sense suggestions.
[0085] User question: What time does bus route 101 depart?
[0086] After the prompt words are constructed, the system calls the large model for inference generation. First, the model routing module dynamically selects the optimal model version from the Qwen series models based on the task's complexity and resource consumption requirements—for medium-complexity public transport query tasks, the Qwen-Plus model is usually chosen to balance inference quality and response speed. After selecting the model, the system sends the complete prompt words to the model server via API. The model infers based on the provided context knowledge and generates the original answer. After obtaining the answer returned by the model, the system performs three post-processing checks: checking whether the answer references the provided knowledge fragments, rather than relying entirely on the model's own parameterized knowledge; checking whether the referenced knowledge in the answer is specifically sourced; and checking whether the use of public transport terminology in the answer is accurate and standardized.
[0087] For example, when a user asks, "Which stops does bus route 101 pass through?", the answer would be, "According to the route manual, bus route 101 runs from People's Square to the train station, a distance of 15 kilometers, passing through 20 stops. Major stops include: People's Square, municipal government departments, the train station, the science park, and the airport. The first bus departs at 6:00 AM, and the last bus departs at 10:00 PM."
[0088] To further quantify answer quality, the system calculates three evaluation indicators: knowledge citation rate, which measures the proportion of knowledge cited in the answer, with a target value of over 80%; source attribution rate, which measures the proportion of sources cited in the answer, with a target value of over 90%; and terminology accuracy rate, which measures the accuracy of the use of public transportation terminology, with a target value of over 95%. These indicators are continuously monitored during system operation, providing data support for iterative optimization of the retrieval module, scoring weights, and prompt word templates.
[0089] Through three sub-steps—structured organization, prompt word construction, and large-scale model reasoning—the system transforms the knowledge fragments retrieved through multi-path retrieval into accurate, traceable answers that conform to public transportation business standards and returns them to the user, completing a closed-loop process from user query input to answer generation.
[0090] Furthermore, some optional embodiments of this example also include: Real-time monitoring of knowledge validity to determine whether knowledge update conditions have been triggered: If triggered, identify the changed document and update the vector representation, keyword index, and knowledge graph based on the changed document.
[0091] Specifically, it should be understood that the timeliness and accuracy of the knowledge base directly determine the quality of the system's responses. Public transportation business knowledge is characterized by frequent changes—route adjustments, timetable updates, fare changes, and other dynamic information require the system to have timely and efficient knowledge update capabilities. To this end, the system has designed a complete knowledge update mechanism, covering three core aspects: change detection, incremental update process, and version management and rollback, ensuring that the knowledge base always remains synchronized with real-world business operations.
[0092] Change detection is responsible for continuously monitoring changes in the knowledge base's state and automatically triggering the update process when preset conditions are met. Change awareness is performed from the following four dimensions: Condition 1: Document Change Detection. All files in the knowledge document directory are continuously monitored. The system determines whether a document has undergone substantial changes by comparing its modification timestamp with its content hash value (using MD5 or SHA256 algorithms). When a file's modification time changes, or its content hash value differs from a previous record, the system determines that the document has been changed and triggers an update process.
[0093] Condition 2: Low user feedback triggers the system. While returning answers to users, the system collects user feedback on the quality of the answers. When an answer is explicitly marked as "inaccurate" or "outdated" by a user, or when its satisfaction rating is below 3 points (on a 5-point scale), the system will automatically locate the knowledge fragment referenced by that answer and trigger a re-retrieval, verification, and update of the relevant knowledge fragment, forming a feedback-driven closed-loop optimization.
[0094] Condition 3: Regular full updates. A full knowledge update task is performed weekly, involving re-parsing, reconstructing vectorized representations, and rebuilding keyword indexes for all knowledge documents. Full updates, as a supplement to incremental updates, can correct cumulative deviations or omissions that may occur during incremental updates, ensuring the overall consistency of the knowledge base.
[0095] Condition 4: Business Rule Change Notification. When systemic changes occur at the public transportation business level, the upstream business system sends a change notification to the knowledge management system via a message push mechanism, triggering an immediate update. Such changes include, but are not limited to: adding or adjusting routes, changing timetables, adjusting fares or discount rules, and adjusting operational strategies such as adding express buses or short-distance buses. Business rule change notifications have the highest priority, ensuring that critical business changes are reflected in the knowledge retrieval results in the shortest possible time.
[0096] The four detection mechanisms mentioned above work together to form a comprehensive change awareness network covering the document level, feedback level, cycle level, and business level, ensuring that knowledge updates can be triggered in a timely and accurate manner.
[0097] Furthermore, once a knowledge document requiring an update is identified, an incremental update process is initiated to reprocess the changed document and synchronously update the three types of knowledge indexes. For updates triggered by low scores from user feedback, the source tracing mechanism is first used to locate the original document to which the knowledge fragment referenced by the low-scoring answer belongs. This document is then added to the list of changed documents, and subsequently, the same incremental update process as for document changes is executed. The entire update process comprises seven sequentially executed steps: Step 1: Identify the changed documents and obtain a list of changed documents (ChangedDocs) as input for this update process.
[0098] Step Two: Re-parse and Knowledge Extraction. Each document in the changed document list is traversed, and the corresponding parser is called to extract the full-text text based on its file type (PDF, Word, Excel, etc.). The extracted text is then divided into blocks of a fixed size (default 512 characters) to generate a set of semantically coherent text fragments. Based on this, entity recognition is performed on each text fragment to extract key entities (such as bus routes, station names, fare information, etc.), and the relationships between entities are extracted to form structured knowledge triples for use in updating the knowledge graph.
[0099] Step 3: Update the vector representation. Input each text fragment generated in Step 2 into the Embedding model (such as text-embedding-v3) to generate the corresponding dense vector representation. Then, update the mapping relationship between the text fragment identifier and its vector representation to the vector database to replace the original old vector entries of the document.
[0100] Step 4: Update the keyword index. Extract keywords from each text segment, combine them with a public transportation-specific dictionary to extract business-representative keywords, and then update the keyword entries corresponding to the document in the inverted index to ensure that the keyword retrieval path reflects the latest content of the document.
[0101] Step 5: Update the knowledge graph by incorporating the entity and relation triples extracted in Step 2 into the knowledge graph. Perform operations such as creating new entities, updating relations, and cleaning up old entity relations to enable the graph retrieval path to be aware of the latest changes in document content.
[0102] Step Six: Version Management Records. This step generates version record entries for this update, detailing the document's identifier, old version number, new version number, change time, and change type. Simultaneously, the old version content is archived and stored, preserving a complete historical version chain to provide a data foundation for subsequent rollback operations.
[0103] Step 7: Notify relevant components and clear the cache. Broadcast a notification message to each agent component that the knowledge base has been updated to ensure that subsequent retrieval operations are performed based on the latest version of the knowledge. At the same time, clear the cache entries related to this document in the retrieval cache to prevent outdated data from affecting the accuracy of the retrieval results.
[0104] The incremental update process described above is executed automatically after change detection is triggered, and the completion time is typically between a few seconds and a few minutes, depending on the number and size of the changed documents. In full update mode, all documents are considered changed documents, and the above process is executed sequentially for all documents.
[0105] In addition, to prevent the quality of system responses from deteriorating due to incorrect knowledge updates or the import of erroneous content, this application embodiment also establishes a complete version management and rollback mechanism.
[0106] Each document in the knowledge base maintains an independent version history, with version numbers using a semantic format (e.g., v1.0, v1.1, v2.0, etc.). The version number automatically increments each time a document is modified. The version record details the timestamp of each change, the change type (add, modify, delete), and the person who performed the change (or the trigger source if it is an automatic system update), forming a complete document change audit trail.
[0107] When a document's latest version is found to contain errors or have business logic issues, a one-click rollback to any historical version is supported. The rollback process is as follows: First, the complete version history list of the specified document is queried, and the operations and maintenance personnel or system administrator selects the target version number; then, the document content of that version is restored from the archive storage and set as the current valid version; next, the complete index update process (including vectorization update, keyword index update, and knowledge graph update) is re-executed for the document to ensure that all search paths point to the rolled-back version content; finally, the system updates the version record, appending a rollback operation record to the history, marking the change type as "rollback" and the target version number for subsequent auditing and traceability.
[0108] For example: If a knowledge error is found in version 2.0 of document doc_001, the operations and maintenance personnel can execute the Rollback(doc_id="doc_001", target_version="v1.0") operation to restore the system's index and references to the v1.0 version state, while fully preserving the history of version 2.0 for problem analysis.
[0109] By closely coordinating change detection, incremental update processes, and version management rollback, a knowledge update assurance system that combines timeliness, reliability, and recoverability has been built. This ensures that the knowledge base remains up-to-date while effectively reducing the operational risks caused by erroneous updates.
[0110] To summarize the aforementioned solutions, this application adopts a four-stage architecture design: "multi-path retrieval - re-ranking - context building - knowledge update". In the multi-path retrieval stage, vector retrieval, keyword retrieval, and graph retrieval are executed in parallel. In the re-ranking stage, six-dimensional feature extraction, comprehensive scoring, and ranking are performed. In the context building stage, knowledge is structured, prompts are injected, and answers are generated. In the knowledge update stage, change detection, re-indexing, version management, and feedback-driven processes are implemented.
[0111] Therefore, compared with the prior art, this application has the following improvements and technical effects: (1) Significantly improved retrieval accuracy. Specifically, a three-way parallel fusion architecture of vector retrieval, keyword retrieval, and knowledge graph retrieval is adopted. Through the cross-complementary retrieval signals from different sources, the recall coverage is significantly improved. Combined with a six-dimensional comprehensive re-ranking mechanism, candidate documents are evaluated from the perspectives of semantics, keywords, graph, quality, timeliness, and authority to ensure that the most relevant knowledge fragments are presented first. (2) Effective guarantee of knowledge timeliness. Specifically, a multi-dimensional change detection mechanism is established, covering document change monitoring, user feedback triggering, regular full updates, and business rule notifications to ensure timely capture of knowledge changes. A supporting version management and rollback mechanism is provided to support one-click rollback to any historical version, effectively reducing the risk of accidental updates. (3) Enhanced scenario adaptability. Specifically, a domain-specific dictionary, entity recognition model, and synonym expansion mechanism are built for the public transportation scenario to achieve accurate terminology understanding. The retrieval results are structured and then injected with source and timeliness information, and the answers can be traced back to specific knowledge documents, enhancing credibility. (4) Establish a user feedback collection system, associate low-score feedback with the corresponding search results and optimize the ranking weight accordingly, so that the search strategy can continuously approach the global optimum as data accumulates and the system has the ability to evolve over a long period of time.
[0112] In summary, this application achieves significant technological advancements in retrieval accuracy, timeliness, system performance, and evolutionary capabilities through the synergistic effects of multi-path fusion retrieval, refined re-ranking, real-time updates, scenario adaptation, and self-optimization mechanisms, providing a complete and efficient technical solution for intelligent question answering in public transportation scenarios.
[0113] This invention also provides a hybrid knowledge retrieval enhancement device suitable for public transportation scenarios, as described in the following embodiments. Since the principle by which this device solves the problem is similar to that of the hybrid knowledge retrieval enhancement method suitable for public transportation scenarios, the implementation of this device can refer to the implementation of the hybrid knowledge retrieval enhancement method suitable for public transportation scenarios; repeated details will not be elaborated further.
[0114] like Figure 6 As shown, the hybrid knowledge retrieval enhancement device suitable for public transportation scenarios includes: The query preprocessing module 10 is configured to receive initial query data input by the user on the terminal and perform preprocessing operations on the initial query data to obtain candidate query data. The multi-way retrieval module 20 is configured to perform three-way retrieval operations in parallel on the candidate query data to obtain a candidate knowledge set, wherein the candidate knowledge set includes multiple candidate documents; The target retrieval result determination module 30 is configured to determine the comprehensive score of each of the candidate documents, and determine the target retrieval result from the candidate knowledge set based on the comprehensive score of each of the candidate documents; The answer generation module 40 is configured to construct a total prompt word based on the target retrieval results, and generate an answer based on the total prompt word and a pre-trained artificial intelligence model.
[0115] In some optional embodiments of this example, the preprocessing operation on the initial query data to obtain candidate query data includes: The initial query data is segmented into words to obtain multiple words; Based on a pre-trained bus entity recognition model, multiple bus entities are identified from the multiple word segments; Based on the public transportation domain dictionary, the synonyms of each segmented word are expanded to obtain the synonym expansion results of each segmented word; The initial query data is vectorized to obtain a query vector; wherein, the multiple word segments, the synonym expansion results of each word segment, the multiple bus entities, and the query vector constitute the candidate query data.
[0116] In some optional embodiments of this example, the parallel execution of three-way retrieval operations on the candidate query data to obtain a candidate knowledge set includes: Based on the query vector, perform a vector retrieval operation to obtain the vector retrieval results; Based on the multiple word segments and the synonym expansion results of each word segment, a keyword retrieval operation is performed to obtain the keyword retrieval results; Based on the multiple bus entities, a graph retrieval operation is performed to obtain the graph retrieval results; The vector retrieval results, the keyword retrieval results, and the graph retrieval results are merged and deduplicated to obtain the candidate knowledge set.
[0117] In some optional embodiments of this example, determining the overall score for each candidate document includes: Extract multi-dimensional features from each candidate document, wherein the multi-dimensional features include semantic similarity, keyword matching degree, graph correlation degree, document quality score, timeliness score, and authority score; Based on the semantic similarity, keyword matching degree, graph correlation degree, document quality score, timeliness score, authority score, and the feature weights corresponding to each dimension, the comprehensive score of each candidate document is determined.
[0118] In some optional embodiments of this example, based on the target retrieval results, a total prompt term is constructed, including: The target retrieval results are processed in a structured manner to obtain a structured context, wherein the structured context includes multiple knowledge fragments, and each knowledge fragment includes knowledge content, knowledge source, update time and relevance information; Based on the structured context, pre-set system prompts, and the initial query data, a total prompt is constructed.
[0119] In some optional embodiments of this example, the following are also included: Real-time monitoring of knowledge validity to determine whether knowledge update conditions have been triggered: If triggered, identify the changed document and update the vector representation, keyword index, and knowledge graph based on the changed document.
[0120] One embodiment of this application also provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, it implements the steps of the hybrid knowledge retrieval enhancement method for public transportation scenarios described in the foregoing embodiments.
[0121] An embodiment of this application also provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the steps of the hybrid knowledge retrieval enhancement method for public transportation scenarios described in the foregoing embodiments.
[0122] An embodiment of this application also provides a computer program product, including a computer program / instructions that, when executed by a processor, implement the steps of the hybrid knowledge retrieval enhancement method for a public transportation scenario described in the foregoing embodiments.
[0123] Figure 7A schematic block diagram of an example electronic device 900 that can be used to implement embodiments of the present disclosure is shown. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device may also represent various forms of mobile devices, such as personal digital processors, cellular phones, smartphones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely illustrative and are not intended to limit the implementation of the present disclosure described and / or claimed herein.
[0124] like Figure 7 As shown, device 900 includes a computing unit 901, which can perform various appropriate actions and processes based on a computer program stored in read-only memory (ROM) 902 or a computer program loaded from storage unit 908 into random access memory (RAM) 903. RAM 903 may also store various programs and data required for the operation of device 900. The computing unit 901, ROM 902, and RAM 903 are interconnected via bus 904. Input / output (I / O) interface 905 is also connected to bus 904.
[0125] Multiple components in device 900 are connected to I / O interface 905, including: input unit 906, such as keyboard, mouse, etc.; output unit 907, such as various types of monitors, speakers, etc.; storage unit 908, such as disk, optical disk, etc.; and communication unit 909, such as network card, modem, wireless transceiver, etc. Communication unit 909 allows device 900 to exchange information / data with other devices through computer networks such as the Internet and / or various telecommunications networks.
[0126] The computing unit 901 can be a variety of general-purpose and / or special-purpose processing components with processing and computing capabilities. Some examples of the computing unit 901 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various special-purpose artificial intelligence (AI) computing chips, various computing units running machine learning model algorithms, a digital signal processor (DSP), and any suitable processor, controller, microcontroller, etc. The computing unit 901 performs the various methods and processes described above, such as a hybrid knowledge retrieval enhancement method suitable for a public transportation scenario.
[0127] For example, in some embodiments, a hybrid knowledge retrieval enhancement method suitable for public transportation scenarios can be implemented as a computer software program tangibly contained in a machine-readable medium, such as storage unit 908. In some embodiments, part or all of the computer program can be loaded and / or installed on device 900 via ROM 902 and / or communication unit 909. When the computer program is loaded into RAM 903 and executed by computing unit 901, one or more steps of the hybrid knowledge retrieval enhancement method for public transportation scenarios described above can be performed. Alternatively, in other embodiments, computing unit 901 can be configured to perform a hybrid knowledge retrieval enhancement method for public transportation scenarios by any other suitable means (e.g., by means of firmware).
[0128] Various embodiments of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field-programmable gate arrays (FPGAs), application-specific integrated circuits (ASICs), application-specific standard products (ASSPs), systems-on-a-chip (SoCs), payload-programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various embodiments may include implementations in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which may be a dedicated or general-purpose programmable processor, capable of receiving data and instructions from a storage system, at least one input device, and at least one output device, and transmitting data and instructions to the storage system, the at least one input device, and the at least one output device.
[0129] The program code used to implement the methods of this disclosure may be written in any combination of one or more programming languages. This program code may be provided to a processor or controller of a general-purpose computer, special-purpose computer, or other programmable data processing apparatus, such that when executed by the processor or controller, the program code causes the functions / operations specified in the flowcharts and / or block diagrams to be implemented. The program code may be executed entirely on a machine, partially on a machine, as a standalone software package partially on a machine and partially on a remote machine, or entirely on a remote machine or server.
[0130] In the context of this disclosure, a machine-readable medium can be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, apparatus, or device. A machine-readable medium can be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium can be, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatus, or devices, or any suitable combination of the foregoing. More specific examples of machine-readable storage media include electrical connections based on one or more wires, portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination of the foregoing.
[0131] To provide interaction with a user, the systems and techniques described herein can be implemented on a computer having: a display device for displaying information to the user (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor); and a keyboard and pointing device (e.g., a mouse or trackball) through which the user provides input to the computer. Other types of devices can also be used to provide interaction with the user; for example, feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including sound input, voice input, or tactile input).
[0132] The systems and technologies described herein can be implemented in computing systems that include backend components (e.g., as a data server), or computing systems that include middleware components (e.g., an application server), or computing systems that include frontend components (e.g., a user computer with a graphical user interface or web browser through which a user can interact with implementations of the systems and technologies described herein), or any combination of such backend, middleware, or frontend components. The components of the system can be interconnected via digital data communication of any form or medium (e.g., a communication network). Examples of communication networks include local area networks (LANs), wide area networks (WANs), and the Internet.
[0133] Computer systems can include clients and servers. Clients and servers are generally located far apart and typically interact via communication networks. Client-server relationships are created by computer programs running on the respective computers and having a client-server relationship with each other. Servers can be cloud servers, servers in distributed systems, or servers incorporating blockchain technology.
[0134] It should be understood that the various forms of processes shown above can be used to rearrange, add, or delete steps. For example, the steps described in this disclosure can be executed in parallel, sequentially, or in different orders, as long as the desired result of the technical solution of this disclosure can be achieved, and this is not limited herein.
[0135] It should be noted that in the description of this application, relational terms such as "first" and "second" are used only to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitations, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes said element.
[0136] In the embodiments of this application, the singular forms "a," "the," etc., including the plural forms, should be broadly understood as "a kind" or "a class" rather than limited to the meaning of "an." Furthermore, the term "the" should be understood to include both the singular and plural forms, unless the context explicitly indicates otherwise. Additionally, the term "according to" should be understood as "at least partially based on…," and the term "based on" should be understood as "at least partially based on…," unless the context explicitly indicates otherwise.
[0137] It should be understood that the various forms of processes shown above can be used to rearrange, add, or delete steps. For example, the steps described in this disclosure can be executed in parallel, sequentially, or in different orders, as long as the desired result of the technical solution of this disclosure can be achieved, and this is not limited herein.
[0138] The specific embodiments described above further illustrate the purpose, technical solution, and beneficial effects of the present invention. It should be understood that the above descriptions are merely specific embodiments of the present invention and are not intended to limit the scope of protection of the present invention. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the present invention should be included within the scope of protection of the present invention.
Claims
1. A hybrid knowledge retrieval enhancement method suitable for public transportation scenarios, characterized in that, include: Receive initial query data input by the user on the terminal, and perform preprocessing operations on the initial query data to obtain candidate query data; The candidate query data is subjected to a three-way retrieval operation in parallel to obtain a candidate knowledge set, wherein the candidate knowledge set includes multiple candidate documents; Determine the comprehensive score of each candidate document, and based on the comprehensive score of each candidate document, determine the target retrieval result from the candidate knowledge set; Based on the target retrieval results, a total prompt term is constructed, and an answer is generated based on the total prompt term and a pre-trained artificial intelligence model.
2. The method according to claim 1, characterized in that, The preprocessing operation performed on the initial query data to obtain candidate query data includes: The initial query data is segmented into words to obtain multiple words; Based on a pre-trained bus entity recognition model, multiple bus entities are identified from the multiple word segments; Based on the public transportation domain dictionary, the synonyms of each segmented word are expanded to obtain the synonym expansion results of each segmented word; The initial query data is vectorized to obtain a query vector; wherein, the multiple word segments, the synonym expansion results of each word segment, the multiple bus entities, and the query vector constitute the candidate query data.
3. The method according to claim 2, characterized in that, The process of performing three-way retrieval operations in parallel on the candidate query data yields a candidate knowledge set, including: Based on the query vector, perform a vector retrieval operation to obtain the vector retrieval results; Based on the multiple word segments and the synonym expansion results of each word segment, a keyword retrieval operation is performed to obtain the keyword retrieval results; Based on the multiple bus entities, a graph retrieval operation is performed to obtain the graph retrieval results; The vector retrieval results, the keyword retrieval results, and the graph retrieval results are merged and deduplicated to obtain the candidate knowledge set.
4. The method according to claim 1, characterized in that, The determination of the comprehensive score for each of the candidate documents includes: Extract multi-dimensional features from each candidate document, wherein the multi-dimensional features include semantic similarity, keyword matching degree, graph correlation degree, document quality score, timeliness score, and authority score; Based on the semantic similarity, keyword matching degree, graph correlation degree, document quality score, timeliness score, authority score, and the feature weights corresponding to each dimension, the comprehensive score of each candidate document is determined.
5. The method according to claim 1, characterized in that, Based on the target retrieval results, a general suggestion keyword is constructed, including: The target retrieval results are processed in a structured manner to obtain a structured context, wherein the structured context includes multiple knowledge fragments, and each knowledge fragment includes knowledge content, knowledge source, update time and relevance information; Based on the structured context, pre-set system prompts, and the initial query data, a total prompt is constructed.
6. The method according to claim 1, characterized in that, Also includes: Real-time monitoring of knowledge validity to determine whether knowledge update conditions have been triggered: If triggered, identify the changed document and update the vector representation, keyword index, and knowledge graph based on the changed document.
7. A hybrid knowledge retrieval enhancement device suitable for public transportation scenarios, characterized in that, include: The query preprocessing module is configured to receive initial query data input by the user on the terminal and perform preprocessing operations on the initial query data to obtain candidate query data; A multi-way retrieval module is configured to perform three-way retrieval operations in parallel on the candidate query data to obtain a candidate knowledge set, wherein the candidate knowledge set includes multiple candidate documents; The target retrieval result determination module is configured to determine the comprehensive score of each candidate document and, based on the comprehensive score of each candidate document, determine the target retrieval result from the candidate knowledge set; The answer generation module is configured to construct a total prompt word based on the target retrieval results, and generate an answer based on the total prompt word and a pre-trained artificial intelligence model.
8. 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, it implements the steps of the hybrid knowledge retrieval enhancement method for public transportation scenarios as described in any one of claims 1 to 6.
9. A computer-readable storage medium having a computer program stored thereon, characterized in that, When executed by a processor, the computer program implements the steps of the hybrid knowledge retrieval enhancement method for public transportation scenarios as described in any one of claims 1 to 6.
10. A computer program product comprising a computer program / instructions, characterized in that, When the computer program / instruction is executed by the processor, it implements the steps of the hybrid knowledge retrieval enhancement method for public transportation scenarios as described in any one of claims 1 to 6.
