Knowledge retrieval method and device, electronic equipment and storage medium
Through the knowledge search model, the search documents are analyzed intently and constructed knowledge bases, and the initial knowledge representation is corrected using the knowledge graph, which solves the problems of artificial dependence, low efficiency and natural language understanding in the existing technology, and achieves efficient and accurate knowledge retrieval .
Patent Information
- Application Number
- CN202411200854.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-29
- Publication Date
- 2024-12-03
AI Technical Summary
The existing knowledge retrieval methods rely on manual operations, are inefficient and have high labor costs, are complex in building knowledge graphs, cannot understand natural language, and have hallucinations and insufficient explanatory.
The search document is analyzed intently through the knowledge search model, and the initial knowledge representation is corrected based on the standard knowledge representation in the knowledge base, and the knowledge graph is used for entity matching, and a knowledge base is built to store knowledge elements and logical relationships, so as to improve the search accuracy.
It improves the accuracy and efficiency of knowledge retrieval, reduces labor costs, reduces the complexity of knowledge graph construction, and avoids hallucination problems and natural language comprehension problems.
Smart Images

Figure CN119066186A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of natural language processing technology, and in particular to a knowledge retrieval method, device, electronic device and storage medium. Background Art
[0002] Knowledge retrieval refers to obtaining the desired knowledge from massive data based on the search content entered by the user. It is widely used in various fields. For example, in the field of question answering, the search-based question answering system extracts answers from existing documents, while the generative question answering system answers questions by generating new text.
[0003] Currently, most searches are done manually to determine keywords in the search content and to search the knowledge graph based on the keywords. However, this method relies on manual operation and is inefficient. In addition, the knowledge graph is also completely dependent on manual construction, which requires personnel to have corresponding professional knowledge and has high labor costs. Summary of the invention
[0004] The present invention provides a knowledge retrieval method, device, electronic device and storage medium to solve the defects in the prior art.
[0005] The present invention provides a knowledge retrieval method, comprising the following steps: Based on the knowledge retrieval model, the intent of the retrieval document is parsed to obtain the retrieval elements; Based on the search elements, searching the knowledge base in the knowledge search model to obtain search knowledge corresponding to the search document; The knowledge base is used to store knowledge elements of multiple knowledge documents and the logical relationships between the knowledge elements. The knowledge base is obtained by modifying the initial knowledge representation based on the standard knowledge representation. The standard knowledge representation is a knowledge representation obtained after entity matching of the initial knowledge representation in the knowledge graph. The knowledge graph is constructed based on standard knowledge documents. The initial knowledge representation is a knowledge representation extracted from each knowledge document based on the knowledge retrieval model.
[0006] According to a knowledge retrieval method provided by the present invention, the knowledge in the knowledge base is constructed based on the following steps: Based on the knowledge retrieval model, the document content of each knowledge document is applied to search for the standard document associated with each knowledge document, and the initial knowledge representation is extracted from each knowledge document and the standard document associated with each knowledge document; Based on the initial knowledge representation, entity matching is performed in the knowledge graph to determine the standard knowledge representation; Based on the description document corresponding to the standard knowledge representation, the initial knowledge representation is modified to obtain the knowledge elements of multiple knowledge documents in the knowledge base and the logical relationship between the knowledge elements. The description document is used to describe the facts corresponding to the standard knowledge representation.
[0007] According to a knowledge retrieval method provided by the present invention, the document content of each knowledge document is applied to search for standard documents associated with each knowledge document, and the initial knowledge representation is extracted from each knowledge document and the standard documents associated with each knowledge document, including: Based on the document content of each knowledge document, determine the business type to which each knowledge document belongs; Based on the business type described in each knowledge document, search for standard documents associated with each knowledge document; Complete the missing content of each knowledge document based on the standard documents associated with each knowledge document; The initial knowledge representation is extracted from each completed knowledge document.
[0008] According to a knowledge retrieval method provided by the present invention, the extracting the initial knowledge representation from each completed knowledge document comprises: Extract elements from each completed knowledge document; Based on the extracted elements, a corresponding icon is determined from the standard document associated with each knowledge document; Each element is associated with a corresponding icon to obtain the initial knowledge representation.
[0009] According to a knowledge retrieval method provided by the present invention, extracting elements from each completed knowledge document includes: Based on the directory structure of each knowledge document, multiple element levels are determined; At each element level, elements are extracted from each knowledge document, and the elements extracted at the current element level include all the elements extracted at the next element level.
[0010] According to a knowledge retrieval method provided by the present invention, the initial knowledge representation is modified based on the description document corresponding to the standard knowledge representation, including: Generate cloze documents for each knowledge document based on the prompt template; Based on the description document, determining missing entities in the cloze document; Based on the missing entities, the initial knowledge representation is modified.
[0011] According to a knowledge retrieval method provided by the present invention, the knowledge documents include drawing documents and / or specification documents, and the priority of the specification documents corresponding to the initial knowledge representation is higher than the priority of the drawing documents corresponding to the initial knowledge representation.
[0012] The present invention also provides a knowledge retrieval device, comprising the following modules: A parsing unit, used to parse the intent of the retrieval document based on the knowledge retrieval model to obtain retrieval elements; A retrieval unit, configured to search the knowledge base in the knowledge retrieval model based on the retrieval elements to obtain retrieval knowledge corresponding to the retrieval document; The knowledge base is used to store knowledge elements of multiple knowledge documents and the logical relationships between the knowledge elements. The knowledge base is obtained by modifying the initial knowledge representation based on the standard knowledge representation. The standard knowledge representation is a knowledge representation obtained after entity matching of the initial knowledge representation in the knowledge graph. The knowledge graph is constructed based on standard knowledge documents. The initial knowledge representation is a knowledge representation extracted from each knowledge document based on the knowledge retrieval model.
[0013] The present invention also provides an electronic device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the program, any of the above-mentioned knowledge retrieval methods is implemented.
[0014] The present invention also provides a non-transitory computer-readable storage medium having a computer program stored thereon, and when the computer program is executed by a processor, the knowledge retrieval method described in any one of the above is implemented.
[0015] The present invention also provides a computer program product, comprising a computer program, wherein when the computer program is executed by a processor, the computer program implements any of the above-mentioned knowledge retrieval methods.
[0016] The knowledge retrieval method, device, electronic device and storage medium provided by the present invention correct the initial knowledge representation of the knowledge retrieval model based on the standard knowledge representation in the knowledge graph, thereby avoiding the problem of hallucination in the knowledge retrieval model. At the same time, the knowledge retrieval model can accurately understand natural language, thereby avoiding the problem that the knowledge graph cannot understand natural language. In other words, the present invention can improve the accuracy of knowledge retrieval. BRIEF DESCRIPTION OF THE DRAWINGS
[0017] In order to more clearly illustrate the technical solutions in the present invention or the prior art, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0018] Figure 1 This is one of the flow charts of the knowledge retrieval method provided by the present invention.
[0019] Figure 2 This is one of the flow charts of the knowledge base construction method provided by the present invention.
[0020] Figure 3 It is a flowchart of the implementation of step 210 in the knowledge base construction method provided by the present invention.
[0021] Figure 4 This is the second flow chart of the knowledge base construction method provided by the present invention.
[0022] Figure 5 It is a schematic diagram of the editing process provided by the present invention.
[0023] Figure 6 It is a flowchart of the implementation of step 220 in the knowledge base construction method provided by the present invention.
[0024] Figure 7 This is the second flowchart of the knowledge retrieval method provided by the present invention.
[0025] Figure 8 It is a structural schematic diagram of the knowledge retrieval device provided by the present invention.
[0026] Fig. 9 It is a structural schematic diagram of the electronic device provided by the present invention. DETAILED DESCRIPTION
[0027] In order to make the purpose, technical solution and advantages of the present invention clearer, the technical solution of the present invention will be clearly and completely described below in conjunction with the drawings of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0028] At present, knowledge retrieval can be applied to construction projects, for example, the construction drawings of construction projects can be reviewed. When reviewing the construction drawings of construction projects, optical character recognition (OCR) is often used to identify icons, text and other information in the construction drawings. Designers rely on professional knowledge and recognition results to determine the search formula, and use the search formula to search in the knowledge graph. However, this method relies on the professional knowledge of designers for retrieval, which requires high professional ability of designers, and leads to high labor costs for retrieval. In addition, the knowledge in the knowledge graph is also obtained by professionals extracting knowledge from the collected data, which is time-consuming and labor-intensive.
[0029] The knowledge retrieval method provided by the present invention can be applied to various fields, such as question answering, construction, education, etc. In order to facilitate the explanation of the technical solution of the present invention, the following embodiment is described by taking the construction drawing review in the construction field as an example. Figure 1 is one of the flow charts of the knowledge retrieval method provided by the present invention, such as Figure 1 As shown, the method includes step 110 and step 120.
[0030] Step 110: Based on the knowledge retrieval model, perform intent analysis on the retrieval document to obtain retrieval elements.
[0031] Step 120: Based on the search elements, search the knowledge base in the knowledge search model to obtain search knowledge corresponding to the search document; The knowledge base is used to store the knowledge elements of multiple knowledge documents and the logical relationships between the knowledge elements. The knowledge base is obtained by modifying the initial knowledge representation based on the standard knowledge representation. The standard knowledge representation is the knowledge representation obtained after entity matching in the knowledge graph based on the initial knowledge representation. The knowledge graph is constructed based on standard knowledge documents. The initial knowledge representation is the knowledge representation extracted from each knowledge document based on the knowledge retrieval model.
[0032] Specifically, the retrieval document refers to the query content input by the user or the document content to be retrieved. The retrieval document can be a question, command, or description in natural language, or a document containing a large amount of information. For example, the retrieval document can include prompt text (such as prompt text), construction drawings, etc. Among them, the prompt text is used to describe the user's retrieval requirements, such as the prompt text can be "retrieve building specifications that match construction drawings."
[0033] The search elements refer to the keywords extracted from the search document. Taking the above prompt text "Search for building specifications that match construction drawings" as an example, the search elements may be "construction drawings", "building specifications" and "match". The search elements may be entities in the search document, relationships between entities, etc.
[0034] Optionally, based on the knowledge retrieval model, the semantic content of the retrieved document can be analyzed, and the user's retrieval intention can be judged based on the semantic information in the retrieved document, and then the retrieval elements can be determined based on the user's retrieval intention. For example, for the prompt text "retrieve building specifications that match construction drawings", the user's retrieval intention is to find specific building specifications and match construction drawings with building specifications, and then the corresponding retrieval elements can be "construction drawings", "building specifications" and "matching".
[0035] After determining the search elements, you can construct a structured query based on the search elements (such as determining the search fields and query conditions), and pass the constructed query to the search engine of the knowledge base to obtain the corresponding search knowledge. For example, for the prompt text "Search for building specifications that match construction drawings", the corresponding search knowledge can be "Architectural Construction Drawing Design Specifications", "Architectural Design Specifications", "Construction Drawing Review Standards", etc.
[0036] Among them, the knowledge base is used to store the knowledge elements of multiple knowledge documents, as well as the logical relationships between the knowledge elements. The knowledge base is obtained by modifying the initial knowledge representation based on the standard knowledge representation. The initial knowledge representation is the knowledge representation extracted from each knowledge document based on the knowledge retrieval model. Knowledge documents can be understood as original data in the relevant field, including but not limited to books, papers, reports, web pages, etc. The standard knowledge representation is the knowledge representation obtained after entity matching of each knowledge element in the knowledge graph. The knowledge graph is constructed based on standard knowledge documents. Standard knowledge documents can be understood as verified and authoritative documents or materials in the corresponding field. For example, standard knowledge documents can include industry standards, specification documents and technical manuals.
[0037] It should be noted that although the knowledge retrieval model has a strong language understanding ability, the knowledge retrieval model itself faces problems such as insufficient interpretability, poor knowledge real-time performance, and false information in the generated results (i.e., the problem of hallucination). Moreover, since the knowledge retrieval model stores knowledge implicitly in parameters, the decision-making process is a black box, which makes it difficult to verify and explain the initial knowledge representation extracted by the knowledge retrieval model. In other words, the initial knowledge representation extracted based on the knowledge retrieval model may have low accuracy. The knowledge graph does not have the hallucination problem of the knowledge retrieval model. The structured knowledge in the knowledge graph is interpretable and authentic, but the knowledge graph cannot understand natural language. If the knowledge corresponding to the natural language is included in the knowledge graph, the complexity and difficulty of constructing the knowledge graph will increase.
[0038] It can be seen that the knowledge retrieval method provided by the embodiment of the present invention corrects the initial knowledge representation of the knowledge retrieval model based on the standard knowledge representation in the knowledge graph, thereby avoiding the problem of hallucination in the knowledge retrieval model. At the same time, the knowledge retrieval model can accurately understand natural language, thereby avoiding the problem that the knowledge graph cannot understand natural language.
[0039] The knowledge retrieval model can be a large language model (LLM), which refers to a natural language processing (NLP) model with a large parameter scale. The number of model parameters and / or the complexity of the model structure exceeds a preset threshold. The model processes large-scale text data during training and has the ability to understand and generate natural language. For example, large language models can include Spark large models, etc.
[0040] Based on the above embodiments, Figure 2 This is one of the flow charts of the knowledge base construction method provided by the present invention, such as Figure 2 As shown in the figure, the knowledge in the knowledge base is constructed based on the following steps: Step 210: Based on the knowledge retrieval model, the document content of each knowledge document is applied to search for the standard documents associated with each knowledge document, and initial knowledge representation is extracted from each knowledge document and the standard documents associated with each knowledge document; Step 220: Based on the initial knowledge representation, perform entity matching in the knowledge graph to determine the standard knowledge representation; Step 230: Based on the description document corresponding to the standard knowledge representation, the initial knowledge representation is modified to obtain the knowledge elements of multiple knowledge documents in the knowledge base and the logical relationship between the knowledge elements. The description document is used to describe the facts corresponding to the standard knowledge representation.
[0041] Specifically, a knowledge document is usually a document that focuses on a certain topic, which usually does not cover all the information. In addition, a knowledge document may be a document written by an individual, which is limited by the individual's knowledge and information acquisition ability, which will also cause the knowledge document to lack some information. Standard documents are usually intended to formulate consistent industry specifications and requirements, and their preparation process is more systematic and comprehensive. Therefore, standard documents are usually more complete in coverage and details. In this regard, an embodiment of the present invention applies the document content of each knowledge document to search for standard documents associated with each knowledge document, so that the standard document can be used to complete the missing content in the corresponding knowledge document, and the initial knowledge representation can be accurately extracted. Among them, the initial knowledge representation can be represented by the relationship between entities.
[0042] In addition, the terms in the knowledge document may include non-standard terms, and the initial knowledge representation extracted from the knowledge document may also be expressed in non-standard terms, while the knowledge graph is expressed in standard terms. In other words, for entities with the same meaning, the initial knowledge representation and the standard knowledge in the knowledge graph may correspond to different expressions. In this regard, the embodiment of the present invention performs entity matching in the knowledge graph based on the initial knowledge representation to obtain a standard knowledge representation from the knowledge graph that refers to the same entity as the initial knowledge representation. Among them, the standard knowledge representation can be expressed by the relationship between entities.
[0043] Since the standard knowledge representation is obtained from the knowledge graph, the credibility of the standard knowledge representation is relatively high. Therefore, based on the description document corresponding to the standard knowledge representation, the initial knowledge representation that may have hallucination problems can be corrected to obtain the knowledge elements of multiple knowledge documents in the knowledge base and the logical relationship between the knowledge elements.
[0044] Based on any of the above embodiments, Figure 3 is a flow chart of an implementation of step 210 in the knowledge base construction method provided by the present invention, such as Figure 3 As shown, in step 210, the document content of each knowledge document is applied to search for standard documents associated with each knowledge document, and initial knowledge representation is extracted from each knowledge document and the standard documents associated with each knowledge document, including: Step 211: Determine the business type of each knowledge document based on the document content of each knowledge document; Step 212: based on the business type of each knowledge document, search for standard documents associated with each knowledge document; Step 213: based on the standard documents associated with each knowledge document, complete the missing content of each knowledge document; Step 214: extracting initial knowledge representation from each completed knowledge document.
[0045] Specifically, the business type of each knowledge document may be the field to which each knowledge document belongs, such as construction, medical treatment, finance, etc. Optionally, the document content of each knowledge document may be analyzed to identify keywords and themes of the document content, and the business type of each knowledge document may be determined based on the keywords and themes.
[0046] In addition, standard documents can be understood as documents of the same business type as each knowledge document, and standard documents can include industry specifications, laws and regulations, etc. After determining the business type of each knowledge document, the business type can be used as a search condition to search for standard documents associated with each knowledge document.
[0047] Since standard documents are usually more complete in coverage and details, it is possible to compare knowledge documents with standard documents, identify missing content in each knowledge document, and obtain the missing content from the standard document to supplement the knowledge document. For example, the catalog of the knowledge document and the standard document can be compared, and the content corresponding to the missing catalog can be supplemented into the knowledge document as missing content.
[0048] After completing the knowledge document, the initial knowledge representation is extracted from the completed knowledge document, thereby ensuring the integrity of the initial knowledge representation. The completed knowledge document can be encoded based on the knowledge retrieval model to obtain a vector representation of each fragment in the knowledge document, and entities and relationships between entities can be extracted from the vector representation, and the identified entities and relationships can be converted into the form of a knowledge graph to obtain the initial knowledge representation.
[0049] Based on any of the above embodiments, extracting an initial knowledge representation from each completed knowledge document includes: Extract elements from each completed knowledge document; Based on the extracted elements, a corresponding icon is determined from the standard document associated with each knowledge document; Associate each element with the corresponding icon to obtain the initial knowledge representation.
[0050] Specifically, the extracted elements can be understood as key information units in each knowledge document, such as entities, relationships between entities, etc. Based on the extracted elements, standard documents corresponding to these elements are searched, corresponding icons are identified from the standard documents, and each element is associated with the corresponding icon, so that the initial knowledge representation obtained is also associated with icons, and then when performing knowledge retrieval, the icons corresponding to the elements can be obtained to intuitively obtain element information.
[0051] Figure 4 This is the second flow chart of the knowledge base construction method provided by the present invention. Figure 4 As shown, knowledge documents include structured data, semi-structured data, and unstructured data. The knowledge document is input into the knowledge retrieval model, which determines the document type of the knowledge document. After the knowledge document is split according to the document type, knowledge conflict detection is performed, and the OCR engine is started, the split documents are edited and the initial knowledge representation is extracted. Editing refers to editing and processing the split documents, and extracting key content and information from the split documents to build the initial knowledge representation based on the key content and information.
[0052] Among them, document types include word, pdf, txt, md (Markdown), html, pictures, etc. Document splitting includes rule splitting and intelligent splitting. For example, rule splitting can include splitting by directory, paragraph, symbol, and word count. Intelligent splitting can include independent extraction of table / picture elements, as well as custom splitting script splitting of national standard industry terms, industry specifications, and national standard specifications for weak current drawing design. In addition, considering that the 2B small model has a small number of parameters, low deployment cost, and good performance, the embodiment of the present invention uses a 2B small model with a small number of parameters for intelligent splitting.
[0053] In addition, considering that some knowledge documents can only express a complete semantics when they are connected as a whole paragraph or a chapter, it is necessary to merge and split these contents accordingly to form corresponding knowledge points. For this, the embodiment of the present invention can analyze the relevance of the article according to the directory, page number, paragraph, and article context content to merge and split the documents.
[0054] Considering that knowledge documents can also include national standard documents, implementation plans, patents, etc., image recognition and text table element extraction are required. The recognition results can be organized and output in the form of elements. Therefore, the elements extracted by OCR can usually include pages, layouts, areas, paragraphs, text lines, headers, titles, seals, fingerprints, QR codes, information columns, watermarks, barcodes, page numbers, tables, illustrations, lists, codes, pseudocodes, footnotes, formulas, comments, and footers.
[0055] After obtaining the initial knowledge representation, the initial knowledge representation is matched with entities in the knowledge graph to obtain the corresponding standard knowledge representation. Based on the standard knowledge representation, knowledge reasoning, knowledge discovery and knowledge evaluation are performed, and the knowledge enhanced by the knowledge graph is supplemented to the knowledge base to improve the knowledge base.
[0056] In addition, after obtaining the standard knowledge representation, the standard knowledge representation is input into the knowledge retrieval model, and the knowledge retrieval model modifies the initial knowledge representation based on the standard knowledge representation, and generates and stores the vector of the modified initial knowledge representation to construct a knowledge base.
[0057] Figure 5 It is a schematic diagram of the editing process provided by the present invention, such as Figure 5 As shown, the document is split and parsed, junk text is filtered and OCR recognition is performed, and then the big model is used to extract knowledge. When extracting knowledge, the big model performs business matching classification based on the big model and extracts knowledge points according to the business type. The business type may include building electrical, intelligent, information channel, etc. In addition, the big model may be the above-mentioned knowledge retrieval model, that is, the knowledge retrieval model uses the standard knowledge representation extracted from the knowledge graph to modify the initial knowledge representation extracted by itself to extract knowledge.
[0058] Based on any of the above embodiments, extracting elements from each completed knowledge document includes: Based on the directory structure of each knowledge document, multiple element levels are determined; At each element level, elements are extracted from each knowledge document, and the elements extracted at the current element level include all the elements extracted at the next element level.
[0059] Specifically, according to the directory structure of each knowledge document, the level of each element is identified and determined. For example, a chapter can be a first-level element, and a section can be a second-level element.
[0060] Optionally, elements may be extracted layer by layer starting from the highest level, and each element level needs to include all elements extracted from the next element level, that is, the elements extracted from the chapter need to include all the elements extracted from the section.
[0061] Among them, Table 1 is a list of some elements and corresponding identification contents. As shown in Table 1, the layout is the next element level of the page, and the identification content corresponding to the page includes the page.
[0062] Table 1
[0063] Based on any of the above embodiments, Figure 6 is a flow chart of an implementation of step 220 in the knowledge base construction method provided by the present invention, such as Figure 6 As shown, step 220 includes: Step 221: Generate cloze documents for each knowledge document based on the prompt template; Step 222: Determine missing entities in the cloze document based on the description document; Step 223: Based on the missing entities, the initial knowledge representation is modified.
[0064] Specifically, the prompt template can be a preset cloze template. For example, the entity part can be masked to make a corresponding prompt template. After generating the cloze documents of each knowledge document based on the prompt template, key information is extracted from the description document, the missing entities in the cloze document are determined, and the initial knowledge representation is updated based on the missing entities.
[0065] Optionally, erroneous entities in the initial knowledge representation may be determined based on the missing entities, and the erroneous entities in the initial knowledge representation may be replaced with the missing entities to correct the initial knowledge representation and ensure the accuracy and completeness of the initial knowledge representation.
[0066] Based on any of the above embodiments, the knowledge document includes a drawing document and / or a specification document, and the priority of the specification document corresponding to the initial knowledge representation is higher than the priority of the drawing document corresponding to the initial knowledge representation.
[0067] Specifically, specification documents usually contain detailed standards, rules, and specifications, which are usually widely verified and recognized. Therefore, specification documents have a higher priority in providing accurate and authoritative information. In this regard, if the corresponding initial knowledge representation in the specification document conflicts with the initial knowledge representation of the graph document, the initial knowledge representation of the specification document can be retained, and the initial knowledge representation of the graph document can be filtered out.
[0068] Among them, in order to accurately and quickly extract the initial knowledge representation from the knowledge document, the drawing document can be set to a unified format. For the frame scale, the appropriate frame should be selected according to the size of the drawing when drawing, and it should be scaled according to the specified ratio. For example, A0 paper type is suitable for design drawings with a building area of more than 5000m². The selection of drawing scale should be based on the specific content and complexity of the drawing to keep the information clear and readable. For the line setting, in the weak current drawing design, drawings of different professions should be distinguished by lines of different thicknesses. New content is represented by thick lines, existing facilities are represented by thin lines, and planned reserved parts are represented by dotted lines, so that the status and properties of each component can be clearly identified. For the legend text description, the drawing should contain legends and text descriptions to facilitate the understanding of the drawing content. The text descriptions should be arranged neatly and evenly spaced, and the "Songti" or "Fangsongti" fonts should be used uniformly to improve the professionalism and readability of the drawings.
[0069] In addition, specification documents can include design drawing specifications, relevant national standards and industry standards. Drawing documents need to follow specification documents. For example, drawing documents need to be produced in accordance with design drawing specifications, which include detailed steps, layer management and standard accuracy. Among them, the detailed steps are that before the design begins, the use function of the building must be fully understood and considered to ensure that the weak current system meets all operational requirements. Designers need to arrange points and pipelines according to specific application scenarios to avoid conflicts with other systems in the building. Layer management is that in CAD drawings, layers should be used reasonably to organize and manage different design elements. For example, special layers can be set to distinguish background building information, electrical facilities and annotations, which is helpful for reading and modifying drawings. Annotation accuracy is that all equipment and lines should be clearly numbered and labeled for easy identification and maintenance. Dimensions should be written along the direction of the dimension line and in accordance with the view direction to ensure that construction personnel can accurately implement the design intent.
[0070] Based on any of the above embodiments, Figure 7 This is the second flow chart of the knowledge retrieval method provided by the present invention. Figure 7As shown, the method includes: (a) Knowledge base construction
[0071] Obtain knowledge documents, which include semi-structured data, unstructured data, and structured data. Input the knowledge documents into the SVM classification model (support vector machine classification model) to determine the business type to which each knowledge document belongs.
[0072] The knowledge documents under each business type are input into the Pattern classification model (pattern classification model), the format type of each knowledge document is determined, and knowledge is extracted according to the extraction logic (text extraction logic and table extraction logic) corresponding to the format type to obtain a standard knowledge representation.
[0073] In addition, OCR recognition is performed on the knowledge documents, and a small feature extraction model is used to perform feature recognition and structured recognition to extract the initial knowledge representation. Based on the initial knowledge representation, entity alignment is performed with the standard knowledge representation. Based on the entity-aligned standard knowledge representation, the initial knowledge representation in the knowledge base is corrected to construct a knowledge base.
[0074] Among them, the small factor extraction model can share knowledge with the knowledge retrieval model, that is, share the identified factors with the knowledge retrieval model, so that the knowledge retrieval model can expand the knowledge graph.
[0075] (b) Knowledge retrieval
[0076] After the knowledge base is constructed, keywords of the search text are extracted, natural language search is performed on the search text, and structured recognition and feature extraction are performed on the text images in the search text. Intent understanding is performed based on the natural language search results and feature extraction results, and the knowledge retrieval intent is determined. Prompt text is constructed based on the knowledge retrieval intent and keywords, and the Prompt text is input into the knowledge retrieval model. The knowledge retrieval model searches the knowledge base based on the Prompt text to obtain the corresponding retrieval knowledge.
[0077] It can be seen that the embodiments of the present invention utilize the knowledge retrieval model to perform unstructured document retrieval and an anthropomorphic interactive method to reduce the original traditional knowledge graph retrieval method and reduce the professional cost of retrieval personnel. At the same time, the rapid retrieval of unstructured data by the knowledge retrieval model can also transform a large amount of design standards (books, papers, reports, web pages), design cases and other non-standard structured data into retrieval knowledge, thereby greatly reducing the original traditional knowledge graph construction professionalism and complexity, and improving the simplicity and timeliness of modeling.
[0078] The knowledge retrieval device provided by the present invention is described below. The knowledge retrieval device described below and the knowledge retrieval method described above can be referenced to each other.
[0079] Based on any of the above embodiments, Figure 8 is a schematic diagram of the structure of the knowledge retrieval device provided by the present invention, such as Figure 8 As shown, the device comprises: The parsing unit 810 is used to perform intent parsing on the search document based on the knowledge search model to obtain search elements; A retrieval unit 820 is used to search the knowledge base in the knowledge retrieval model based on the retrieval elements to obtain retrieval knowledge corresponding to the retrieval document; The knowledge base is used to store the knowledge elements of multiple knowledge documents and the logical relationships between the knowledge elements. The knowledge base is obtained by modifying the initial knowledge representation based on the standard knowledge representation. The standard knowledge representation is the knowledge representation obtained after entity matching in the knowledge graph based on the initial knowledge representation. The knowledge graph is constructed based on standard knowledge documents. The initial knowledge representation is the knowledge representation extracted from each knowledge document based on the knowledge retrieval model.
[0080] Based on any of the above embodiments, the knowledge in the knowledge base is constructed based on the following steps: Based on the knowledge retrieval model, the document content of each knowledge document is applied to search for the standard documents associated with each knowledge document, and the initial knowledge representation is extracted from each knowledge document and the standard documents associated with each knowledge document; Based on the initial knowledge representation, perform entity matching in the knowledge graph to determine the standard knowledge representation; Based on the description document corresponding to the standard knowledge representation, the initial knowledge representation is modified to obtain the knowledge elements of multiple knowledge documents in the knowledge base and the logical relationship between the knowledge elements. The description document is used to describe the facts corresponding to the standard knowledge representation.
[0081] Based on any of the above embodiments, using the document content of each knowledge document, searching for standard documents associated with each knowledge document, and extracting initial knowledge representation from each knowledge document and the standard documents associated with each knowledge document, including: Based on the document content of each knowledge document, determine the business type to which each knowledge document belongs; Based on the business type of each knowledge document, search for standard documents associated with each knowledge document; Complete the missing content of each knowledge document based on the standard documents associated with each knowledge document; The initial knowledge representation is extracted from each completed knowledge document.
[0082] Based on any of the above embodiments, extracting an initial knowledge representation from each completed knowledge document includes: Extract elements from each completed knowledge document; Based on the extracted elements, a corresponding icon is determined from the standard document associated with each knowledge document; Associate each element with the corresponding icon to obtain the initial knowledge representation.
[0083] Based on any of the above embodiments, extracting elements from each completed knowledge document includes: Based on the directory structure of each knowledge document, multiple element levels are determined; At each element level, elements are extracted from each knowledge document, and the elements extracted at the current element level include all the elements extracted at the next element level.
[0084] Based on any of the above embodiments, the initial knowledge representation is modified based on the description document corresponding to the standard knowledge representation, including: Generate cloze documents for each knowledge document based on the prompt template; Determine missing entities in cloze documents based on description documents; Based on the missing entities, the initial knowledge representation is modified.
[0085] Based on any of the above embodiments, the knowledge document includes a drawing document and / or a specification document, and the priority of the specification document corresponding to the initial knowledge representation is higher than the priority of the drawing document corresponding to the initial knowledge representation.
[0086] Fig. 9 is a schematic diagram of the structure of the electronic device provided by the present invention, such as Fig. 9 As shown, the electronic device may include: a processor 910, a communication interface 920, a memory 930 and a communication bus 940, wherein the processor 910, the communication interface 920 and the memory 930 communicate with each other through the communication bus 940. The processor 910 may call the logic instructions in the memory 930 to execute the knowledge retrieval method, which includes: based on the knowledge retrieval model, performing intent parsing on the retrieval document to obtain retrieval elements; based on the retrieval elements, performing retrieval in the knowledge base in the knowledge retrieval model to obtain retrieval knowledge corresponding to the retrieval document; the knowledge base is used to store knowledge elements of multiple knowledge documents and the logical relationship between each knowledge element, the knowledge base is obtained by correcting the initial knowledge representation based on the standard knowledge representation, the standard knowledge representation is a knowledge representation obtained after entity matching is performed on the initial knowledge representation in the knowledge graph, the knowledge graph is constructed based on the standard knowledge document, and the initial knowledge representation is a knowledge representation extracted from each knowledge document based on the knowledge retrieval model.
[0087] In addition, the logic instructions in the above-mentioned memory 930 can be implemented in the form of a software functional unit and can be stored in a computer-readable storage medium when it is sold or used as an independent product. Based on this understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art or the part of the technical solution, can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present invention. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk and other media that can store program codes.
[0088] On the other hand, the present invention also provides a computer program product, which includes a computer program, which can be stored on a non-transitory computer-readable storage medium. When the computer program is executed by a processor, the computer can execute the knowledge retrieval method provided by the above methods, which method includes: based on a knowledge retrieval model, performing intent analysis on the retrieval document to obtain retrieval elements; based on the retrieval elements, searching in the knowledge base in the knowledge retrieval model to obtain retrieval knowledge corresponding to the retrieval document; the knowledge base is used to store knowledge elements of multiple knowledge documents, and the logical relationship between each knowledge element. The knowledge base is obtained by modifying the initial knowledge representation based on the standard knowledge representation, and the standard knowledge representation is a knowledge representation obtained after entity matching of the initial knowledge representation in the knowledge graph. The knowledge graph is constructed based on the standard knowledge document, and the initial knowledge representation is a knowledge representation extracted from each knowledge document based on the knowledge retrieval model.
[0089] On the other hand, the present invention also provides a non-transitory computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, is implemented to execute the knowledge retrieval method provided by the above-mentioned methods, the method comprising: based on a knowledge retrieval model, performing intent analysis on a retrieval document to obtain retrieval elements; based on the retrieval elements, performing a search in a knowledge base in the knowledge retrieval model to obtain retrieval knowledge corresponding to the retrieval document; the knowledge base is used to store knowledge elements of multiple knowledge documents, and the logical relationship between each knowledge element, the knowledge base is obtained by modifying an initial knowledge representation based on a standard knowledge representation, the standard knowledge representation is a knowledge representation obtained after entity matching of the initial knowledge representation in a knowledge graph, the knowledge graph is constructed based on a standard knowledge document, and the initial knowledge representation is a knowledge representation extracted from each knowledge document based on the knowledge retrieval model.
[0090] The device embodiments described above are merely illustrative, wherein the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the scheme of this embodiment. Ordinary technicians in this field can understand and implement it without paying creative labor.
[0091] Through the description of the above implementation methods, those skilled in the art can clearly understand that each implementation method can be implemented by means of software plus a necessary general hardware platform, and of course, can also be implemented by hardware. Based on this understanding, the above technical solution is essentially or the part that contributes to the prior art can be embodied in the form of a software product, and the computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, a disk, an optical disk, etc., including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods described in each embodiment or some parts of the embodiments.
[0092] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present invention.
Claims
1. A knowledge retrieval method, characterized in that: include: Based on the knowledge retrieval model, the intent of the retrieval document is parsed to obtain the retrieval elements; Based on the search elements, searching the knowledge base in the knowledge search model to obtain search knowledge corresponding to the search document; The knowledge base is used to store knowledge elements of multiple knowledge documents and the logical relationships between the knowledge elements. The knowledge base is obtained by modifying the initial knowledge representation based on the standard knowledge representation. The standard knowledge representation is a knowledge representation obtained after entity matching of the initial knowledge representation in the knowledge graph. The knowledge graph is constructed based on standard knowledge documents. The initial knowledge representation is a knowledge representation extracted from each knowledge document based on the knowledge retrieval model.
2. The knowledge retrieval method according to claim 1, characterized in that: The knowledge in the knowledge base is constructed based on the following steps: Based on the knowledge retrieval model, the document content of each knowledge document is applied to search for the standard document associated with each knowledge document, and the initial knowledge representation is extracted from each knowledge document and the standard document associated with each knowledge document; Based on the initial knowledge representation, entity matching is performed in the knowledge graph to determine the standard knowledge representation; Based on the description document corresponding to the standard knowledge representation, the initial knowledge representation is modified to obtain the knowledge elements of multiple knowledge documents in the knowledge base and the logical relationship between the knowledge elements. The description document is used to describe the facts corresponding to the standard knowledge representation.
3. The knowledge retrieval method according to claim 2, characterized in that: The applying the document content of each knowledge document, searching for the standard document associated with each knowledge document, and extracting the initial knowledge representation from each knowledge document and the standard document associated with each knowledge document, includes: Based on the document content of each knowledge document, determine the business type to which each knowledge document belongs; Based on the business type described in each knowledge document, search for standard documents associated with each knowledge document; Complete the missing content of each knowledge document based on the standard documents associated with each knowledge document; The initial knowledge representation is extracted from each completed knowledge document.
4. The knowledge retrieval method according to claim 3, characterized in that: The extracting the initial knowledge representation from each completed knowledge document includes: Extract elements from each completed knowledge document; Based on the extracted elements, a corresponding icon is determined from the standard document associated with each knowledge document; Each element is associated with a corresponding icon to obtain the initial knowledge representation.
5. The knowledge retrieval method according to claim 4, characterized in that: The extracting elements from each completed knowledge document includes: Based on the directory structure of each knowledge document, multiple element levels are determined; At each element level, elements are extracted from each knowledge document, and the elements extracted at the current element level include all the elements extracted at the next element level.
6. The knowledge retrieval method according to claim 2, characterized in that: The modifying of the initial knowledge representation based on the description document corresponding to the standard knowledge representation includes: Generate cloze documents for each knowledge document based on the prompt template; Based on the description document, determining missing entities in the cloze document; Based on the missing entities, the initial knowledge representation is modified.
7. The knowledge retrieval method according to any one of claims 1 to 6, characterized in that: The knowledge documents include drawing documents and / or specification documents, and the priority of the specification documents corresponding to the initial knowledge representation is higher than the priority of the drawing documents corresponding to the initial knowledge representation.
8. A knowledge retrieval device, characterized in that: include: A parsing unit, used to parse the intent of the retrieval document based on the knowledge retrieval model to obtain retrieval elements; A retrieval unit, configured to search the knowledge base in the knowledge retrieval model based on the retrieval elements to obtain retrieval knowledge corresponding to the retrieval document; The knowledge base is used to store knowledge elements of multiple knowledge documents and the logical relationships between the knowledge elements. The knowledge base is obtained by modifying the initial knowledge representation based on the standard knowledge representation. The standard knowledge representation is a knowledge representation obtained after entity matching of the initial knowledge representation in the knowledge graph. The knowledge graph is constructed based on standard knowledge documents. The initial knowledge representation is a knowledge representation extracted from each knowledge document based on the knowledge retrieval model.
9. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein: When the processor executes the computer program, the knowledge retrieval method according to any one of claims 1 to 7 is implemented.
10. A non-transitory computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the knowledge retrieval method according to any one of claims 1 to 7 is implemented.
Citation Information
Patent Citations
Expanding knowledge graphs using external data source
CN112214583A
Power grid domain knowledge graph model establishment system based on knowledge graph
CN117194667A
Tourist route recommendation method based on large language model and knowledge graph
CN117407606A
Auxiliary retrieval method fusing knowledge graph and large language model
CN117633252A
Automatic correction method and device for big language model illusion problem based on knowledge graph
CN117688186A
