Question and answer method and device based on multi-layer photovoltaic knowledge base and text block adaptive completion, equipment and medium
By constructing a multi-layered photovoltaic knowledge base with a hierarchical tagging system, the problem of inaccurate search results in photovoltaic product Q&A was solved, and collaborative retrieval of macro background and fine-grained details was achieved, improving the accuracy and completeness of photovoltaic product-related Q&A.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- ALTENERGY POWER SYST
- Filing Date
- 2026-03-10
- Publication Date
- 2026-06-05
AI Technical Summary
Existing search enhancement generation technologies suffer from inaccurate search results, especially in photovoltaic product-related Q&A scenarios, where it is difficult to achieve collaborative retrieval of macro background and fine-grained details.
A multi-layered photovoltaic knowledge base based on a hierarchical tagging system is constructed. By performing structured segmentation and tag adaptation on photovoltaic product documents, the semantic granularity and logical subordination of text blocks are represented. Furthermore, the accuracy of search results is improved through weighted optimization and adaptive completion techniques.
It ensures the accuracy and completeness of Q&A related to photovoltaic products, guarantees the coordinated retrieval of macro background and fine-grained details of search results, reduces information bias, and improves logical coherence and accuracy of answers.
Smart Images

Figure CN122153000A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of retrieval enhancement generation technology, and in particular to a question-answering method, apparatus, device, and medium based on a multi-layer photovoltaic knowledge base and adaptive text block completion. Background Technology
[0002] Retrieval-Augmented Generation (RAG) is a crucial component of large language model applications and plays a vital role in intelligent customer service. It utilizes assisted retrieval techniques to provide relevant contextual information to the model, reducing illusions, adapting to specific scenarios, and compensating for insufficient real-time data.
[0003] Current search enhancement techniques typically combine different search strategies or information sources (such as inverted indexes and semantic-based search) in an attempt to improve search performance through multi-dimensional search strategies. However, this approach suffers from inaccurate search results. Summary of the Invention
[0004] In view of this, the purpose of this invention is to provide a question-answering method, apparatus, device, and medium based on a multi-layer photovoltaic knowledge base and adaptive text block completion. By constructing a multi-layer photovoltaic knowledge base based on a hierarchical tagging system, it achieves collaborative retrieval of both macroscopic background and fine-grained details, ensuring the accuracy of the retrieval results. The specific solution is as follows:
[0005] Firstly, this application provides a question-answering method based on a multi-layer photovoltaic knowledge base and adaptive text block completion, including:
[0006] Obtain photovoltaic product-related questions sent by the user terminal, and generate target question vectors corresponding to the photovoltaic product-related questions;
[0007] The target question vector is matched with the text block vectors corresponding to each text block in the preset multi-layer photovoltaic knowledge base to obtain an initial list of text blocks; wherein, the preset multi-layer photovoltaic knowledge base is a database constructed based on a hierarchical tag system to perform structured segmentation of photovoltaic product documents and to adapt corresponding tags to each segmented text block; the hierarchical tag system includes tags at different levels used to characterize the semantic granularity and logical subordinate relationship of text blocks.
[0008] Based on the hierarchical relationship of the tags in the hierarchical tagging system, the initial matching degree between each text block in the initial text block list and the photovoltaic product-related issues is weighted and optimized to obtain the corresponding optimized matching degree;
[0009] Based on the complexity of the photovoltaic product-related questions, the text blocks in the candidate text block list are adaptively completed to obtain several target text blocks. The target text blocks and the photovoltaic product-related questions are then used to construct a target hinting project so that a pre-set photovoltaic question-solving model can use the target hinting project to answer the photovoltaic product-related questions. The candidate text block list is a list obtained by filtering the text blocks in the initial text block list using the optimized matching degree.
[0010] Optionally, generating the target question vector corresponding to the photovoltaic product-related issues includes:
[0011] A pre-defined sentiment word removal model is used to remove sentiment words from the photovoltaic product-related questions to obtain the target photovoltaic product-related questions and generate the target question vector corresponding to the target photovoltaic product-related questions.
[0012] Optionally, before matching the target question vector with the text block vectors corresponding to each text block in the preset multi-layer photovoltaic knowledge base, the method further includes:
[0013] Preprocess the preset photovoltaic product documents to obtain the corresponding preprocessed photovoltaic product documents;
[0014] The preprocessed photovoltaic product document is segmented based on the title structure information to obtain several text blocks, and each text block is assigned a corresponding tag based on its semantic information.
[0015] Optionally, before matching the target question vector with the text block vectors corresponding to each text block in the preset multi-layer photovoltaic knowledge base, the method further includes:
[0016] Consecutive text blocks with the same label are concatenated into a single-label integrated block. In each text block, an associated text block with the same label as the single-label integrated block is found. Semantic deduplication and complementary integration operations are performed on each single-label integrated block and the corresponding associated text block to obtain an optimized integrated block.
[0017] The optimized integrated blocks are divided according to the preset segmentation point and the target length range, and the segmented text blocks and their corresponding tags and text block vectors are stored in layers to obtain the preset multi-layer photovoltaic knowledge base.
[0018] Optionally, the step of weighted optimization of the initial matching degree between each text block in the initial text block list and the photovoltaic product-related questions based on the hierarchical association relationship of the tags in the hierarchical tagging system includes:
[0019] Determine the current tag of the current text block in the initial text block list, and obtain the direct child level tag corresponding to the current tag; wherein, the direct child level tag refers to the child level tag directly connected to the current tag;
[0020] Retrieve the sub-level text block corresponding to the direct sub-level tag from the initial text block list, and extract the first matching degree between each sub-level text block and the photovoltaic product-related question;
[0021] The initial matching degree between the current text block and the photovoltaic product-related questions is obtained, and the initial matching degree and the first matching degree are weighted and summed using a preset weight coefficient to optimize the initial matching degree between the current text block and the photovoltaic product-related questions.
[0022] Optionally, the adaptive completion of text blocks in the candidate text block list based on the problem complexity of the photovoltaic product-related issues to obtain several target text blocks includes:
[0023] The complexity of the photovoltaic product-related issues is scored using a pre-defined complexity scoring model to obtain the corresponding issue complexity.
[0024] The text block completion length threshold and the number of tags to be retained are determined based on the problem complexity. The tags corresponding to each text block in the candidate text block list are scored, and the target tag is determined from the tags corresponding to each text block based on the corresponding tag score and the number of tags to be retained.
[0025] The non-target tags and corresponding text blocks in the candidate text block list are deleted to obtain the corresponding filtered text block list. The text blocks in the filtered text block list are then adaptively completed according to the text block completion length threshold to obtain the target text block.
[0026] Optionally, the step of constructing a target prompting project using the target text block and the photovoltaic product-related issues includes:
[0027] The target text blocks are concatenated, and duplicate text content is deleted during the concatenation process to obtain target prompt text. The target prompt text is then used to construct the target prompt project with the photovoltaic product-related issues.
[0028] Secondly, this application provides a question-answering device based on a multi-layer photovoltaic knowledge base and adaptive text block completion, comprising:
[0029] The vector generation module is used to obtain photovoltaic product-related questions sent by the user terminal and generate target question vectors corresponding to the photovoltaic product-related questions;
[0030] The vector matching module is used to match the target question vector with the text block vectors corresponding to each text block in the preset multi-layer photovoltaic knowledge base to obtain an initial list of text blocks; wherein, the preset multi-layer photovoltaic knowledge base is a database constructed based on a hierarchical tag system to perform structured segmentation of photovoltaic product documents and to adapt corresponding tags to each segmented text block; the hierarchical tag system includes tags at different levels used to characterize the semantic granularity and logical subordinate relationship of text blocks;
[0031] The matching degree optimization module is used to perform weighted optimization on the initial matching degree between each text block in the initial text block list and the photovoltaic product-related issues based on the hierarchical association relationship of the tags in the hierarchical tag system, so as to obtain the corresponding optimized matching degree.
[0032] The question-answering module is used to adaptively complete the text blocks in the candidate text block list according to the complexity of the photovoltaic product-related questions to obtain several target text blocks, and to construct a target hint project using the target text blocks and the photovoltaic product-related questions, so that a pre-set photovoltaic question-answering model can use the target hint project to answer the photovoltaic product-related questions; wherein, the candidate text block list is a list obtained by filtering the text blocks in the initial text block list using the optimized matching degree.
[0033] Thirdly, this application provides an electronic device, comprising:
[0034] Memory, used to store computer programs;
[0035] A processor is used to execute the computer program to implement the aforementioned question-answering method based on a multi-layer photovoltaic knowledge base and text block adaptive completion.
[0036] Fourthly, this application provides a computer-readable storage medium for storing a computer program, which, when executed by a processor, implements the aforementioned question-answering method based on a multi-layer photovoltaic knowledge base and text block adaptive completion.
[0037] This application first obtains photovoltaic product-related questions sent by the user and generates target question vectors corresponding to these questions. Then, it matches these target question vectors with text block vectors corresponding to each text block in a pre-defined multi-layered photovoltaic knowledge base to obtain an initial text block list. The pre-defined multi-layered photovoltaic knowledge base is a database constructed based on a hierarchical tagging system for structured segmentation of photovoltaic product documents, adapting corresponding tags to each segmented text block. The hierarchical tagging system includes tags at different levels that characterize the semantic granularity and logical hierarchy of text blocks. Then, based on the hierarchical association of tags in the hierarchical tagging system, the initial matching degree between each text block in the initial text block list and the photovoltaic product-related questions is weighted and optimized to obtain an optimized matching degree. Finally, based on the question complexity of the photovoltaic product-related questions, the text blocks in the candidate text block list are adaptively completed to obtain several target text blocks. The target text blocks and the photovoltaic product-related questions are then used to construct a target hinting project so that a pre-defined photovoltaic question-answering model can use the target hinting project to answer the photovoltaic product-related questions. Therefore, this application achieves structured storage of document semantics and cross-document redundancy removal by constructing a multi-layer photovoltaic knowledge base based on a hierarchical tagging system, reducing information bias from the source; by weighting and optimizing the initial matching degree according to the tag hierarchy, it achieves collaborative retrieval of macro background knowledge and fine-grained details, avoiding the omission of macro information; by adaptively determining the target text block based on the optimized matching degree and problem complexity, it achieves a balance between contextual coherence and resource consumption, and finally constructs a target-hint engineering-guided large model to generate accurate and complete answers. Attached Figure Description
[0038] 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 embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on the provided drawings without creative effort.
[0039] Figure 1 This is a flowchart of a question-answering method based on a multi-layer photovoltaic knowledge base and adaptive text block completion disclosed in this application;
[0040] Figure 2 This is a flowchart illustrating a question-and-answer method disclosed in this application;
[0041] Figure 3 This is a flowchart illustrating the establishment process of a labeling system disclosed in this application;
[0042] Figure 4This is a diagram illustrating the principle of hierarchical weighted retrieval in a knowledge base as disclosed in this application.
[0043] Figure 5 This is a flowchart of a candidate text block processing method disclosed in this application;
[0044] Figure 6 This is a flowchart of a text block completion method disclosed in this application;
[0045] Figure 7 This is a schematic diagram of the question-answering device structure disclosed in this application, which is based on a multi-layer photovoltaic knowledge base and adaptive text block completion.
[0046] Figure 8 This is a structural diagram of an electronic device disclosed in this application. Detailed Implementation
[0047] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0048] Current retrieval enhancement generation techniques suffer from inaccurate retrieval results. To address this, this application provides a question-answering method based on a multi-layer photovoltaic knowledge base and adaptive text block completion. This method can construct a multi-layer photovoltaic knowledge base based on a hierarchical tagging system, enabling collaborative retrieval of both macro-level background and fine-grained details, thus ensuring the accuracy of retrieval results.
[0049] See Figure 1 As shown, this embodiment of the invention discloses a question-answering method based on a multi-layer photovoltaic knowledge base and adaptive text block completion, including:
[0050] Step S11: Obtain photovoltaic product-related questions sent by the user terminal and generate the target question vector corresponding to the photovoltaic product-related questions.
[0051] The core of this embodiment lies in designing a hierarchical tagging system, which can realize the structured organization of product information text, the construction of a multi-layered vector knowledge base, and the precise efficiency improvement of the retrieval and matching process. It effectively makes up for the shortcomings of traditional RAG technology, which relies solely on semantic retrieval and causes information matching bias, and improves the logical coherence and answer accuracy of product-related question-and-answer scenarios.
[0052] The question-and-answer process in this embodiment is as follows: Figure 2As shown, a multi-layered vector knowledge base is first constructed based on a hierarchical tagging system. After the knowledge base is built, user questions are standardized, and relevant text blocks are matched from the knowledge base. These text blocks are then sorted and completed to construct a hint project, and finally, the question answer is generated. The hierarchical tagging system constructed in this embodiment is not a fixed static system, but a dynamic system with self-growing characteristics.
[0053] In this embodiment, the process of generating the target question vector corresponding to photovoltaic product-related issues includes: using a preset sentiment word removal model to remove sentiment words from photovoltaic product-related issues to obtain target photovoltaic product-related issues, and generating the target question vector corresponding to the target photovoltaic product-related issues.
[0054] In other words, when a user raises a product-related question, the user first removes sentiment words from the question using a lightweight large language model (i.e., a pre-set sentiment word removal large model) to retain the core semantic information; then, the user generates a question vector (i.e., a target question vector) using an embedding method consistent with the knowledge base construction stage to ensure that the vector representation standards of the question and the text block are consistent.
[0055] Step S12: Match the target question vector with the text block vectors corresponding to each text block in the preset multi-layer photovoltaic knowledge base to obtain an initial text block list; wherein, the preset multi-layer photovoltaic knowledge base is a database constructed based on a hierarchical tag system to perform structured segmentation of photovoltaic product documents and to adapt corresponding tags to each segmented text block; the hierarchical tag system includes tags at different levels used to characterize the semantic granularity and logical subordinate relationship of text blocks.
[0056] This embodiment constructs a progressive tag hierarchy system by deeply analyzing the semantic granularity features and logical subordinate relationships of product-related document content. The system is characterized by "higher levels encompassing lower levels, and lower levels supporting higher levels." Each tag has clear semantic boundaries and comprehensive coverage, and it maps one-to-one with the storage levels and retrieval weights of subsequent multi-layered knowledge bases. Furthermore, the document's own hierarchical titles can directly serve as core candidates for corresponding tags, achieving a natural fit between tags and the document's native structure and reducing redundant design of manually preset tags.
[0057] High-level tags correspond to macro-level background knowledge and overall framework content (such as product overview, core technology principles, etc.). For example, the document name or first-level heading can be directly used as the core tags to represent the global semantic attributes of the text block and support the rapid matching of macro-level key information during the retrieval process.
[0058] Low-level tags correspond to fine-grained content such as product details, operating steps, and parameter descriptions. For example, key parameter items and indicator names in the second-level or lower-level headings or charts of documents can be directly used as core tags to accurately locate the specific semantic meaning of text blocks and ensure the accurate extraction of detailed information during the retrieval process.
[0059] In this embodiment, before matching the target question vector with the text block vectors corresponding to each text block in the preset multi-layer photovoltaic knowledge base, the method further includes: preprocessing the preset photovoltaic product document to obtain the corresponding preprocessed photovoltaic product document; segmenting the preprocessed photovoltaic product document according to the title structure information in the preprocessed photovoltaic product document to obtain several text blocks, and assigning corresponding tags to each text block according to the semantic information of each text block.
[0060] That is, the document is first preprocessed and structured. Text with formatted information is extracted from product-related documents. The document to be added is then hierarchically segmented according to the title structure information in the text, and the semantic integrity and independence of each text block are ensured.
[0061] Then, the text block labels are adapted: all segmented text blocks are traversed through the large language model, and a unique label is automatically adapted for each text block from the preset hierarchical label system; if a text block can match multiple different labels, the label with the lower level is selected first to ensure that the semantic fine granularity of the text block is accurately matched with the label level and the subsequent knowledge base storage requirements.
[0062] The hierarchical tagging system constructed in this invention is not merely a classification tool, but a core support throughout the entire RAG process. Its specific functions are: 1. To achieve semantic classification management of text blocks, isolating information with different semantic attributes through different tags, reducing irrelevant information interference during subsequent retrieval; 2. To provide a unified classification basis for the integration and deduplication of text blocks, enabling rapid identification of semantic complementarity or repetition between text blocks with the same level and tag, achieving complementary enhancement and redundancy removal; 3. To provide semantic standards for the hierarchical construction of the vector library, ensuring that the storage structure of the vector library is consistent with the semantic hierarchy of the text, improving the efficiency and accuracy of vector matching; 4. To provide core data support for subsequent hierarchical weighted retrieval, matching both macro-background and fine-grained information simultaneously during retrieval through tag hierarchical relationships, ensuring the completeness of retrieval results.
[0063] When new product documents or text data are added, semantic mining is performed on the new data using a large language model. If new semantic dimensions (i.e., potential new tags) that cannot be matched with the existing tag system are found, they are not directly incorporated into the original tag system, but are temporarily stored in the "optional tag library" for management. The optional tag library, acting as a buffer layer for the tag system, needs to record the semantic description of the new tag, the source information of the corresponding new text block, and its semantic features, providing a basis for subsequent screening. Only new tags that are confirmed to have universality, semantic independence, and business value can be included in the hierarchical tag system, and their level is determined according to their semantic granularity, achieving the orderly growth of the tag system.
[0064] The hierarchical tagging system is the core foundation for RAG optimization in this invention. Essentially, it is a manually pre-defined hierarchical tag management system used to accurately characterize the semantic attributes of product information text. Its core objective is to provide a unified and accurate semantic classification standard for subsequent structured management of text blocks, multi-layered knowledge base construction, and hierarchical weighted retrieval, achieving effective differentiation and association between macro-level background knowledge and fine-grained information, thus laying the foundation for the accuracy and completeness of vector library retrieval. The hierarchical tagging system constructed in this embodiment is not a fixed, static system, but a dynamic system with self-growing characteristics. The construction process and core characteristics of this system are as follows: Figure 3 As shown, the steps include document segmentation, document block tag adaptation, semantic mining of new data, and selection of new tags to enter the tag system.
[0065] By constructing a hierarchical tagging system, the limitations of traditional flat tags are overcome. A hierarchical tagging system is built and bound to the knowledge base storage hierarchy, realizing the structured classification and storage of knowledge, and improving retrieval speed and accuracy. The resulting multi-layered product knowledge base has the significant characteristics of high structure, strong knowledge correlation, and excellent retrieval efficiency.
[0066] In addition, in this embodiment, before matching the target question vector with the text block vectors corresponding to each text block in the preset multi-layer photovoltaic knowledge base, the method further includes: concatenating consecutive text blocks with the same label into a unified label block; searching for associated text blocks in each text block that have the same label as each unified label block; and performing semantic deduplication and complementary integration operations on each unified label block and the corresponding associated text blocks to obtain an optimized unified block; dividing each optimized unified block according to a preset segmentation point and a target length range; and storing each segmented text block and its corresponding label and text block vector in a hierarchical manner to obtain the preset multi-layer photovoltaic knowledge base.
[0067] In other words, based on the hierarchical tagging system and the "tag-text block" binding, this embodiment constructs a multi-layered vector knowledge base to achieve structured storage and vectorized representation of product information, providing a high-quality data foundation for subsequent retrieval. This construction process uses tags as the core index to achieve the integration, deduplication, precise segmentation, and hierarchical storage of text blocks. The specific steps are as follows:
[0068] Text block integration with the same tag: Traverse all text blocks with bound tags, and concatenate consecutive text blocks with the same tag into a "text block with the same tag", realizing the initial aggregation of text with the same semantics, laying the foundation for subsequent deduplication and semantic enhancement.
[0069] Cross-document tag deduplication and integration: Using tags as the retrieval index, text blocks with the same tags as the current integration block are searched in the knowledge base to be built. If they exist, they are concatenated with the current integration block, and semantic deduplication and complementary integration are performed through a large language model to generate a new integration block (i.e., the optimized integration block). If they do not exist, the current integration block is directly retained. This step leverages the unified semantic standard provided by the tag system to achieve dynamic optimization and purification of cross-document semantic knowledge, effectively avoiding a large amount of redundancy in similar information in the knowledge base, reducing interference from subsequent vector retrieval, and improving retrieval efficiency.
[0070] The integrated block features precise segmentation and hierarchical storage: Based on product document characteristics, multiple priority segmentation points (i.e., preset segmentation points) are defined according to semantic and title structural importance. Combined with preset target length ranges and overlap ranges, the integrated block is precisely segmented (prioritizing the selection of the highest priority segmentation point within the length range; if no matching segmentation point is found, forced segmentation is performed). Subsequently, each segmented text block undergoes vector embedding processing. The original text, embedded vector, corresponding tag, and segmentation sequence number (representing the text block's position and order within the text set of the same tag) are stored hierarchically in the corresponding level of the knowledge base, ultimately forming a multi-layered structured vector knowledge base. This storage method corresponds one-to-one with the tag hierarchy, enabling subsequent retrieval to quickly locate the target level through tags, significantly improving the efficiency of vector matching.
[0071] It should be noted that this embodiment can also introduce a dynamic segmentation strategy, automatically adjusting the granularity and sliding step size of the segmentation based on the structure of the document content. For example, for document paragraphs with dense content and complex logical structures, a smaller window size is used to ensure semantic integrity; for simple paragraphs or tables, a larger window can be used for segmentation. This improves the flexibility of document segmentation, enabling the system to optimize the segmentation strategy according to the characteristics of the document content, thereby improving the quality of text blocks and the accuracy of subsequent information retrieval.
[0072] Furthermore, in this embodiment, the process of matching the target question vector with the text block vectors corresponding to each text block in the preset multi-layer photovoltaic knowledge base is as follows: the semantic embedding vector of the user question is used to calculate the cosine similarity with the embedding vectors of all text blocks in the pre-built multi-layer knowledge base to obtain the original semantic similarity matching degree corresponding to each text block, and the top k text blocks are selected.
[0073] It should be noted that retrieval strategies based solely on semantic similarity have limitations: they can only prioritize text blocks that are highly semantically matched to the user's question. However, macro-level knowledge that is not entirely consistent with the user's question in terms of semantic expression but plays a key supporting role in understanding the question's background and constructing a complete answer is easily missed due to the low original matching degree, resulting in a lack of macro-level knowledge in the retrieval results.
[0074] Step S13: Based on the hierarchical relationship of the tags in the hierarchical tagging system, perform weighted optimization on the initial matching degree between each text block in the initial text block list and the photovoltaic product-related issues to obtain the corresponding optimized matching degree.
[0075] like Figure 4 As shown, in the text semantic embedding space constructed in this embodiment (the space in the figure is not an objective and real embedding space, because the embedding space is not a three-dimensional space, but more than a thousand dimensions), the nodes in the space correspond to the text block resources stored in the knowledge base. The relative position of each node in the space is represented by its semantic similarity distance with the "user question" node: text block nodes with a high semantic matching degree with the user question are presented in the embedding space as a distribution pattern that is adjacent to the "user question" node.
[0076] The text block corresponding to the gray node in the diagram carries tags that are the direct parent level tags of multiple text block nodes that are close to the "user question". Based on the hierarchical association logic of the tag system, although the text block corresponding to this gray node has a low direct semantic similarity to the "user question" (reflected in its greater distance from the "user question" node in the embedding space), it actually contains background knowledge and a more macroscopic theoretical system related to the user question. This kind of information can provide key support for accurate and comprehensive answers to user questions and plays a crucial role in improving the completeness and depth of the response results.
[0077] Therefore, in this embodiment, it is necessary to perform weighted optimization on the initial matching degree between each text block in the initial text block list and photovoltaic product-related issues based on the hierarchical association relationship of the tags in the hierarchical tagging system. This includes: determining the current tag of the current text block in the initial text block list and obtaining the direct sub-level tag corresponding to the current tag; wherein, the direct sub-level tag refers to the sub-level tag directly connected to the current tag; retrieving the sub-level text block corresponding to the direct sub-level tag in the initial text block list and extracting the first matching degree between each sub-level text block and the photovoltaic product-related issues; obtaining the initial matching degree between the current text block and the photovoltaic product-related issues, and using a preset weight coefficient to perform a weighted summation of the initial matching degree and the first matching degree to perform weighted optimization on the initial matching degree between the current text block and the photovoltaic product-related issues.
[0078] Specifically, based on a tag hierarchy, performing hierarchical weighted optimization on each text block can effectively compensate for the above-mentioned deficiencies, achieving collaborative retrieval of macro-level and fine-grained knowledge. This includes: determining all direct sub-level tags corresponding to the tag to which the current text block belongs. Direct sub-level tags are the tags at the next lower level directly connected to the current tag; retrieving all text blocks belonging to the directly sub-level tags among the top k text blocks, extracting the original semantic similarity matching degree (i.e., the first matching degree) of this type of text block; and pre-setting weight coefficients. The final semantic similarity match score of the current text block is calculated by weighted summation. , is an adjustable empirical parameter. The calculation formula is:
[0079] ;
[0080] Where S represents the final semantic similarity matching degree of the current text block (i.e., the optimized matching degree). This represents the initial semantic similarity match score of the current text block itself, where n represents the total number of text blocks under the direct child level tags of the tag to which the current text block belongs. This represents the original semantic similarity match score of the i-th direct sub-level text block. Indicates the summation symbol;
[0081] If the current text block belongs to a tag with no direct child level, it is skipped, and its final matching score is equal to its original matching score.
[0082] Based on the final semantic similarity matching score calculated above, the top k text blocks are reordered, and the top K text blocks are selected to form a candidate text block list containing fine-grained information and corresponding macro-level information.
[0083] By correlating the final matching degree of macro-level text blocks with the semantic matching degree of their direct sub-level text blocks, the retrieval weight of macro-level knowledge blocks related to user questions is dynamically increased. Even if the macro-level text block itself has a low semantic matching degree with the question, if its subordinate fine-grained text blocks are highly relevant, the ranking can still be improved through weighted optimization, avoiding the omission of macro-level background knowledge. This achieves the synergistic acquisition of fine-grained precise knowledge and macro-level supporting knowledge, significantly improving the hierarchical completeness and semantic comprehensiveness of the search results.
[0084] Step S14: Adaptively complete the text blocks in the candidate text block list according to the complexity of the photovoltaic product-related questions to obtain several target text blocks, and construct a target hint project using the target text blocks and the photovoltaic product-related questions, so that the preset photovoltaic question-solving big model can use the target hint project to answer the photovoltaic product-related questions; wherein, the candidate text block list is a list obtained by filtering the text blocks in the initial text block list using the optimized matching degree.
[0085] In this embodiment, adaptive completion of text blocks in the candidate text block list is performed based on the complexity of photovoltaic product-related issues to obtain several target text blocks. This includes: using a preset complexity scoring model to score the complexity of photovoltaic product-related issues and obtain the corresponding issue complexity; determining a text block completion length threshold and a number of tags to retain based on the issue complexity; scoring the tags corresponding to each text block in the candidate text block list; and determining target tags from the tags corresponding to each text block based on the corresponding tag scores and the number of tags to retain; deleting non-target tags and corresponding text blocks from the candidate text block list to obtain a corresponding filtered text block list; and completing the text blocks in the filtered text block list according to the text block completion length threshold to obtain the target text blocks.
[0086] Specifically, such as Figure 5 As shown, the text blocks in the initial text block list obtained above are sorted and adaptively completed.
[0087] The text blocks in the initial text block list are sorted, primarily based on tags. If tags are the same, the text blocks are sorted according to their order within the text blocks with the same tag to obtain the sorted initial text block list. .
[0088] Because the documents involved in this embodiment contain strong contextual relationships and omissions in wording, some text blocks that play a key role in the context may not be retrieved due to their low relevance ranking, resulting in a lack of key information during the prompting process.
[0089] We will use BERT to build a user question complexity scoring model (i.e., a pre-defined complexity scoring module). BERT (Bidirectional Encoder Representations from Transformers) is a pre-trained language model based on the Transformer architecture that understands text through bidirectional contextual information. Unlike traditional unidirectional language models, BERT can consider the left and right contexts of words simultaneously, thus better capturing semantic information.
[0090] like Figure 6 As shown, the user's question is input into the complexity model built by BERT, and the question complexity score is calculated. (i.e., problem complexity).
[0091] Based on the calculated complexity score Calculate the upper limit L of the text block completion length (i.e., the text block completion length threshold) and the total number of tags N to be retained (i.e., the number of tags to be retained). The calculation formula is as follows: , Among them, X and This represents a manually set parameter.
[0092] Based on the calculated L and N, the sorted candidate text block list The text blocks are filtered and completed.
[0093] calculate The various tags involved are comprehensively scored, and the top N tags with the highest comprehensive scores (i.e., the set corresponding to the target tag) are statistically analyzed. ,Will The tag belonging to the middle is not present. Text blocks (i.e., text blocks that do not correspond to the target tag) are filtered out to obtain a list of filtered text blocks. .
[0094] Traversing the list For each element in the list, perform text block completion. Perform the following operations to obtain the completed list. :
[0095] Determine if i is equal to If yes, proceed to the next step; otherwise, exit the loop directly.
[0096] judge and If they belong to the same label, proceed to the next step; otherwise, proceed directly to the next loop.
[0097] calculate and The difference in their order within their respective labels .
[0098] If the difference is less than or equal to L, then sort the labels in order. and Text block completion between and If the condition is met, proceed directly to the next cycle; otherwise, proceed directly to the next cycle.
[0099] Where i represents the element in the list The index in the array, 0 ≤ i < , where len() represents the length of the list.
[0100] In addition, in this implementation, a target prompting project is constructed using target text blocks and photovoltaic product-related issues. This includes: splicing together each target text block and deleting duplicate text content during the splicing process to obtain target prompting text, and then using the target prompting text and photovoltaic product-related issues to construct a target prompting project.
[0101] That is, to The text blocks are concatenated, and if there is duplicate content between the text blocks, the duplicate content is deleted, resulting in a semantically coherent and non-redundant prompt text (i.e., the target prompt text). A prompt project (i.e., the target prompt project) is generated to guide the large language model in generating the answer. This prompt project contains the user's question and the prompt text. The generated prompt project is then input into the large language model as a guide and basis for generating the answer, enabling the large language model to generate the answer.
[0102] By adjusting the order of text blocks and supplementing context-related text blocks that were missed due to low relevance rankings, while removing redundant content during concatenation, we ensure that the prompt text is concise, coherent, and logically consistent, avoiding interference from missing key information and repetitive content on the large language model. On the other hand, by using the BERT model to score the complexity of the user's question, we dynamically adjust the length of the text block completion and the number of retained tags, which not only avoids resource waste and redundant information accumulation, but also accurately supplements key contextual information, allowing the large language model to obtain more complete prompt content and ultimately generate more accurate and detailed answers.
[0103] Therefore, this application achieves structured storage of document semantics and cross-document redundancy removal by constructing a multi-layer photovoltaic knowledge base based on a hierarchical tagging system, reducing information bias from the source; by weighting and optimizing the initial matching degree according to the tag hierarchy, it achieves collaborative retrieval of macro background knowledge and fine-grained details, avoiding the omission of macro information; by adaptively determining the target text block based on the optimized matching degree and problem complexity, it achieves a balance between contextual coherence and resource consumption, and finally constructs a target-hint engineering-guided large model to generate accurate and complete answers.
[0104] See Figure 7 As shown, this embodiment of the invention discloses a question-answering device based on a multi-layer photovoltaic knowledge base and adaptive text block completion, comprising:
[0105] The vector generation module 11 is used to obtain photovoltaic product-related questions sent by the user terminal and generate target question vectors corresponding to the photovoltaic product-related questions;
[0106] Vector matching module 12 is used to match the target question vector with the text block vectors corresponding to each text block in the preset multi-layer photovoltaic knowledge base to obtain an initial text block list; wherein, the preset multi-layer photovoltaic knowledge base is a database constructed based on a hierarchical tag system to perform structured segmentation of photovoltaic product documents and to adapt corresponding tags to each segmented text block; the hierarchical tag system includes tags at different levels used to characterize the semantic granularity and logical subordinate relationship of text blocks;
[0107] The matching degree optimization module 13 is used to perform weighted optimization on the initial matching degree between each text block in the initial text block list and the photovoltaic product-related issues according to the hierarchical association relationship of the tags in the hierarchical tag system, so as to obtain the corresponding optimized matching degree.
[0108] The question-answering module 14 is used to adaptively complete the text blocks in the candidate text block list according to the complexity of the photovoltaic product-related questions to obtain several target text blocks, and to construct a target hint project using the target text blocks and the photovoltaic product-related questions, so that the preset photovoltaic question-answering big model can use the target hint project to answer the photovoltaic product-related questions; wherein, the candidate text block list is a list obtained by filtering the text blocks in the initial text block list using the optimized matching degree.
[0109] In some specific embodiments, the vector generation module 11 may specifically include:
[0110] The vector generation unit is used to remove sentiment words from the photovoltaic product-related questions using a preset sentiment word removal model, so as to obtain the target photovoltaic product-related questions and generate the target question vector corresponding to the target photovoltaic product-related questions.
[0111] In some specific embodiments, the vector matching module 12 further includes:
[0112] The document preprocessing unit is used to preprocess the preset photovoltaic product documents to obtain the corresponding preprocessed photovoltaic product documents;
[0113] The tag allocation unit is used to segment the preprocessed photovoltaic product document according to the title structure information in the preprocessed photovoltaic product document to obtain several text blocks, and to assign corresponding tags to each text block according to the semantic information of each text block.
[0114] In some specific embodiments, the vector matching module 12 further includes:
[0115] The text block splicing unit is used to splice consecutive text blocks with the same label into a unified block with the same label. It searches for related text blocks in each text block that have the same label as the unified block with the same label. It performs semantic deduplication and complementary integration operations on each unified block with the corresponding related text block to obtain an optimized unified block.
[0116] The data storage unit is used to divide each of the optimized integrated blocks according to the preset division point and the target length range, and to store each of the divided text blocks and the corresponding tags and text block vectors in a hierarchical manner to obtain the preset multi-layer photovoltaic knowledge base.
[0117] In some specific embodiments, the matching degree optimization module 13 may specifically include:
[0118] The tag acquisition unit is used to determine the current tag of the current text block in the initial text block list and acquire the direct sub-level tag corresponding to the current tag; wherein, the direct sub-level tag refers to the sub-level tag directly connected to the current tag;
[0119] The matching degree extraction unit is used to retrieve the sub-level text blocks corresponding to the direct sub-level tags in the initial text block list, and extract the first matching degree between each sub-level text block and the photovoltaic product-related issues;
[0120] The matching degree optimization unit is used to obtain the initial matching degree between the current text block and the photovoltaic product-related questions, and to use a preset weight coefficient to perform a weighted summation of the initial matching degree and the first matching degree to perform weighted optimization of the initial matching degree between the current text block and the photovoltaic product-related questions.
[0121] In some specific embodiments, the question-answering module 14 may specifically include:
[0122] A complexity scoring unit is used to score the complexity of the photovoltaic product-related issues using a preset complexity scoring model, and to obtain the corresponding complexity of the issues.
[0123] The label determination unit is used to determine the text block completion length threshold and the number of labels to be retained based on the complexity of the problem, score the labels corresponding to each text block in the candidate text block list, and determine the target label from the labels corresponding to each text block based on the corresponding label score and the number of labels to be retained.
[0124] The text block completion unit is used to delete non-target tags and corresponding text blocks from the candidate text block list to obtain a corresponding filtered text block list, and to adaptively complete the text blocks in the filtered text block list according to the text block completion length threshold to obtain the target text block.
[0125] In some specific embodiments, the question-answering module 14 may specifically include:
[0126] The prompting project construction unit is used to concatenate the target text blocks and delete duplicate text content during the concatenation process to obtain target prompt text, and to construct the target prompting project using the target prompt text and the photovoltaic product-related issues.
[0127] Furthermore, embodiments of this application also disclose an electronic device, Figure 7 This is a structural diagram of an electronic device 20 according to an exemplary embodiment. The content of the diagram should not be construed as limiting the scope of this application.
[0128] Figure 8 This is a schematic diagram of the structure of an electronic device 20 provided in an embodiment of this application. Specifically, the electronic device 20 may include: at least one processor 21, at least one memory 22, a power supply 23, a communication interface 24, an input / output interface 25, and a communication bus 26. The memory 22 stores a computer program, which is loaded and executed by the processor 21 to implement the relevant steps in the question-answering method based on a multi-layer photovoltaic knowledge base and text block adaptive completion disclosed in any of the foregoing embodiments. Alternatively, the electronic device 20 in this embodiment may specifically be an electronic computer.
[0129] In this embodiment, the power supply 23 is used to provide operating voltage for each hardware device on the electronic device 20; the communication interface 24 can create a data transmission channel between the electronic device 20 and external devices, and the communication protocol it follows can be any communication protocol applicable to the technical solution of this application, and is not specifically limited here; the input / output interface 25 is used to acquire external input data or output data to the outside world, and its specific interface type can be selected according to specific application needs, and is not specifically limited here.
[0130] In addition, the memory 22, as a carrier for resource storage, can be a read-only memory, random access memory, disk or optical disk, etc. The resources stored thereon can include operating system 221, computer program 222, etc., and the storage method can be temporary storage or permanent storage.
[0131] The operating system 221 is used to manage and control the various hardware devices on the electronic device 20 and the computer program 222, which may be Windows Server, Netware, Unix, Linux, etc. In addition to including a computer program capable of performing the question-answering method based on a multi-layer photovoltaic knowledge base and text block adaptive completion disclosed in any of the foregoing embodiments, the computer program 222 may further include computer programs capable of performing other specific tasks.
[0132] Furthermore, this application also discloses a computer-readable storage medium for storing a computer program; wherein, when the computer program is executed by a processor, it implements the aforementioned question-answering method based on a multi-layer photovoltaic knowledge base and adaptive text block completion. Specific steps of this method can be found in the corresponding content disclosed in the foregoing embodiments, and will not be repeated here.
[0133] The various embodiments in this specification are described in a progressive manner, with each embodiment focusing on its differences from other embodiments. Similar or identical parts between embodiments can be referred to interchangeably. For the apparatus disclosed in the embodiments, since it corresponds to the method disclosed in the embodiments, the description is relatively simple; relevant parts can be referred to in the method section.
[0134] Those skilled in the art will further recognize that the units and algorithm steps of the various examples described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of both. To clearly illustrate the interchangeability of hardware and software, the components and steps of the various examples have been generally described in terms of functionality in the foregoing description. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this application.
[0135] The steps of the methods or algorithms described in conjunction with the embodiments disclosed herein can be implemented directly by hardware, a software module executed by a processor, or a combination of both. The software module can be located in random access memory (RAM), main memory, read-only memory (ROM), electrically programmable ROM, electrically erasable programmable ROM, registers, hard disk, removable disk, CD-ROM, or any other form of storage medium known in the art.
[0136] Finally, it should be noted that in this document, 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.
[0137] The technical solutions provided in this application have been described in detail above. Specific examples have been used to illustrate the principles and implementation methods of this application. The descriptions of the above embodiments are only for the purpose of helping to understand the methods and core ideas of this application. At the same time, for those skilled in the art, there will be changes in the specific implementation methods and application scope based on the ideas of this application. Therefore, the content of this specification should not be construed as a limitation of this application.
Claims
1. A question-answering method based on a multi-layer photovoltaic knowledge base and adaptive text block completion, characterized in that, include: Obtain photovoltaic product-related questions sent by the user terminal, and generate target question vectors corresponding to the photovoltaic product-related questions; The target question vector is matched with the text block vectors corresponding to each text block in the preset multi-layer photovoltaic knowledge base to obtain an initial list of text blocks; wherein, the preset multi-layer photovoltaic knowledge base is a database constructed based on a hierarchical tag system to perform structured segmentation of photovoltaic product documents and to adapt corresponding tags to each segmented text block; the hierarchical tag system includes tags at different levels used to characterize the semantic granularity and logical subordinate relationship of text blocks. Based on the hierarchical relationship of the tags in the hierarchical tagging system, the initial matching degree between each text block in the initial text block list and the photovoltaic product-related issues is weighted and optimized to obtain the corresponding optimized matching degree. Based on the complexity of the photovoltaic product-related questions, the text blocks in the candidate text block list are adaptively completed to obtain several target text blocks. The target text blocks and the photovoltaic product-related questions are then used to construct a target hinting project so that a pre-set photovoltaic question-solving model can use the target hinting project to answer the photovoltaic product-related questions. The candidate text block list is a list obtained by filtering the text blocks in the initial text block list using the optimized matching degree.
2. The question-answering method based on a multi-layer photovoltaic knowledge base and adaptive text block completion as described in claim 1, characterized in that, The generation of the target question vector corresponding to the photovoltaic product-related issues includes: A pre-defined sentiment word removal model is used to remove sentiment words from the photovoltaic product-related questions to obtain the target photovoltaic product-related questions and generate the target question vector corresponding to the target photovoltaic product-related questions.
3. The question-answering method based on a multi-layer photovoltaic knowledge base and adaptive text block completion as described in claim 1, characterized in that, Before matching the target question vector with the text block vectors corresponding to each text block in the preset multi-layer photovoltaic knowledge base, the method further includes: Preprocess the preset photovoltaic product documents to obtain the corresponding preprocessed photovoltaic product documents; The preprocessed photovoltaic product document is segmented based on the title structure information to obtain several text blocks, and each text block is assigned a corresponding tag based on its semantic information.
4. The question-answering method based on a multi-layer photovoltaic knowledge base and adaptive text block completion as described in claim 1, characterized in that, Before matching the target question vector with the text block vectors corresponding to each text block in the preset multi-layer photovoltaic knowledge base, the method further includes: Continuous text blocks with the same label are concatenated into a single-label integrated block. In each text block, an associated text block with the same label as the single-label integrated block is found. Semantic deduplication and complementary integration operations are performed on each single-label integrated block and the corresponding associated text block to obtain an optimized integrated block. The optimized integrated blocks are divided according to the preset segmentation point and the target length range, and the segmented text blocks and their corresponding tags and text block vectors are stored in layers to obtain the preset multi-layer photovoltaic knowledge base.
5. The question-answering method based on a multi-layer photovoltaic knowledge base and adaptive text block completion as described in claim 1, characterized in that, The step of weighted optimization of the initial matching degree between each text block in the initial text block list and the photovoltaic product-related questions, based on the hierarchical association relationship of the tags in the hierarchical tagging system, includes: Determine the current tag of the current text block in the initial text block list, and obtain the direct child level tag corresponding to the current tag; wherein, the direct child level tag refers to the child level tag directly connected to the current tag; Retrieve the sub-level text block corresponding to the direct sub-level tag from the initial text block list, and extract the first matching degree between each sub-level text block and the photovoltaic product-related question; The initial matching degree between the current text block and the photovoltaic product-related questions is obtained, and the initial matching degree and the first matching degree are weighted and summed using a preset weight coefficient to optimize the initial matching degree between the current text block and the photovoltaic product-related questions.
6. The question-answering method based on a multi-layer photovoltaic knowledge base and adaptive text block completion as described in claim 1, characterized in that, The adaptive completion of text blocks in the candidate text block list based on the problem complexity of the photovoltaic product-related issues to obtain several target text blocks includes: The complexity of the photovoltaic product-related issues is scored using a pre-defined complexity scoring model to obtain the corresponding issue complexity. The text block completion length threshold and the number of tags to be retained are determined based on the problem complexity. The tags corresponding to each text block in the candidate text block list are scored, and the target tag is determined from the tags corresponding to each text block based on the corresponding tag score and the number of tags to be retained. The non-target tags and corresponding text blocks in the candidate text block list are deleted to obtain the corresponding filtered text block list. The text blocks in the filtered text block list are then adaptively completed according to the text block completion length threshold to obtain the target text block.
7. The question-answering method based on a multi-layer photovoltaic knowledge base and adaptive text block completion according to any one of claims 1 to 6, characterized in that, The process of constructing a target prompting project using the target text block and related questions about photovoltaic products includes: The target text blocks are concatenated, and duplicate text content is deleted during the concatenation process to obtain target prompt text. The target prompt text is then used to construct the target prompt project with the photovoltaic product-related issues.
8. A question-answering device based on a multi-layer photovoltaic knowledge base and adaptive text block completion, characterized in that, include: The vector generation module is used to obtain photovoltaic product-related questions sent by the user terminal and generate target question vectors corresponding to the photovoltaic product-related questions; The vector matching module is used to match the target question vector with the text block vectors corresponding to each text block in the preset multi-layer photovoltaic knowledge base to obtain an initial list of text blocks; wherein, the preset multi-layer photovoltaic knowledge base is a database constructed based on a hierarchical tag system to perform structured segmentation of photovoltaic product documents and to adapt corresponding tags to each segmented text block; the hierarchical tag system includes tags at different levels used to characterize the semantic granularity and logical subordinate relationship of text blocks; The matching degree optimization module is used to perform weighted optimization on the initial matching degree between each text block in the initial text block list and the photovoltaic product-related issues based on the hierarchical association relationship of the tags in the hierarchical tag system, so as to obtain the corresponding optimized matching degree. The question-answering module is used to adaptively complete the text blocks in the candidate text block list according to the complexity of the photovoltaic product-related questions to obtain several target text blocks, and to construct a target hint project using the target text blocks and the photovoltaic product-related questions, so that a pre-set photovoltaic question-answering model can use the target hint project to answer the photovoltaic product-related questions; wherein, the candidate text block list is a list obtained by filtering the text blocks in the initial text block list using the optimized matching degree.
9. An electronic device, characterized in that, include: Memory, used to store computer programs; A processor for executing the computer program to implement the question-answering method based on a multi-layer photovoltaic knowledge base and text block adaptive completion as described in any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that, Used to store computer programs, which, when executed by a processor, implement the question-answering method based on a multi-layer photovoltaic knowledge base and text block adaptive completion as described in any one of claims 1 to 7.