A building material retrieval method, device, electronic equipment and storage medium
By constructing a building materials knowledge graph and using large language models for semantic analysis and query, the inaccurate and incomplete problems of existing building materials retrieval methods are solved, and more efficient building materials product information retrieval is achieved.
Patent Information
- Application Number
- CN202410080435.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-01-19
- Publication Date
- 2024-10-01
- Estimated Expiration
- 2044-01-19
AI Technical Summary
Existing building materials retrieval methods are based on keyword matching or fixed classification systems, resulting in inaccurate and incomplete retrieval results, inability to effectively handle complex query content, or missing important information.
Knowledge graph technology is used to construct a building materials knowledge graph, and user query statements are semantically analyzed through the building materials large language model. The building materials knowledge graph is used for query and reasoning, and building materials product information is obtained and sorted.
It improves the accuracy and efficiency of building materials retrieval, enables a better understanding of the complex features and uses of building materials products, and provides more accurate and comprehensive query results.
Smart Images

Figure CN117891920B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the technical field of data retrieval, and in particular to a building material retrieval method, device, electronic device and storage medium. Background Art
[0002] Currently, in the building materials industry, the retrieval and query of building materials products usually adopt methods based on keyword matching or fixed classification systems. This traditional retrieval method has some problems when dealing with complex query content or missing important information, resulting in inaccurate retrieval effects and incomplete retrieval results. First, the retrieval method based on keyword matching usually only considers the degree of match between the keywords entered by the user and the labels or descriptions of the building materials products, and does not take into account information in multiple dimensions such as materials, specifications, performance, and uses. Secondly, the fixed classification system usually divides building materials products into predefined categories, and users need to select appropriate categories from these categories to query. However, there are many types of building materials products and they are constantly updated. The fixed classification system often cannot cover all product types, making it difficult for some products to be correctly classified, thereby limiting the comprehensiveness of the query results.
[0003] Therefore, in order to improve the accuracy and efficiency of building materials retrieval, the introduction of knowledge graph technology has become a feasible solution. As a graphical knowledge representation method, knowledge graph can integrate knowledge and information in the field of building materials, including the relationship, attributes and characteristics of building materials products. By using knowledge graph, we can better understand the complex characteristics and uses of building materials products and improve the accuracy and comprehensiveness of building materials retrieval results. Summary of the invention
[0004] The present invention provides a building material retrieval method, device, electronic equipment and storage medium, which are used to improve the accuracy and efficiency of building material retrieval.
[0005] In a first aspect, a method for searching building materials is provided. The method comprises:
[0006] Obtain building material data and construct a building material knowledge graph based on the building material data;
[0007] Obtain user query statements, use the building materials language model to perform semantic analysis on the user query statements, and obtain structured user query statements related to building materials;
[0008] Query and reason about structured user query statements related to building materials based on the building materials knowledge graph to obtain building materials product information;
[0009] Sort building material product information by relevance and display it on the user interface.
[0010] In a possible design solution, the building material knowledge graph includes entity categories of building material products, structural parameters of building material products, and relationships between building material products;
[0011] Obtain building material data and construct a building material knowledge graph based on the building material data, including:
[0012] Obtain building material data, perform entity recognition and classification on the building material data, and obtain entity categories of building material products;
[0013] Extract structural parameters of building material products from building material data;
[0014] Establish the relationship between building material products based on the associated information in the building material data;
[0015] The entity categories of building materials products, the structural parameters of building materials products and the relationships between building materials products are represented in the form of a graph.
[0016] In a possible design scheme, a user query statement is obtained, and a large language model of building materials is used to semantically parse the user query statement to obtain structured user query statements related to building materials, including:
[0017] Inputting the user query sentence into the large language model of building materials, the large language model of building materials encodes the user query sentence, and obtains the structured user query sentence related to building materials after semantic analysis;
[0018] The large language model of building materials is pre-trained with data from a preset historical building material search database;
[0019] The Historical Building Materials Search Database includes product names, brands, specifications, models and product descriptions of building materials.
[0020] In a possible design scheme, the structured user query statements related to building materials are queried and reasoned based on the building materials knowledge graph to obtain building materials product information, including:
[0021] Calculate the similarity between structured user query sentences related to building materials and building materials knowledge of building materials products in the building materials knowledge graph;
[0022] Sort the building material knowledge similarities from high to low, obtain a corresponding amount of building material knowledge according to a preset quantity threshold, and form a single building material product candidate set;
[0023] According to the building materials knowledge graph, complete the candidate set of a single building materials product to obtain building materials product information.
[0024] Optionally, calculating the building materials knowledge similarity between the structured user query sentence related to building materials and the building materials products in the building materials knowledge graph includes:
[0025] Match the category of each non-empty field in the structured user query sentence related to building materials with the entity category of building materials products in the building materials knowledge graph;
[0026] The cosine similarity between each non-empty field in the structured user query sentence related to building materials and the structural parameters of the building materials products in the matching building materials knowledge graph is calculated to obtain the building materials knowledge similarity.
[0027] Optionally, a single building material product candidate set is completed according to the building material knowledge graph to obtain building material product information, including:
[0028] Search the building material knowledge graph based on the building material knowledge in the single building material product candidate set, and extract knowledge nodes related to the building material knowledge in the single building material product candidate set;
[0029] Building material product information is composed according to knowledge nodes related to building material knowledge in a single building material product candidate set.
[0030] In a possible design, the building material product information is sorted by relevance and displayed on the user interface, including:
[0031] Adding the building material knowledge similarities in the individual building material product candidate sets of the building material product information to obtain the relevance of the building material product information;
[0032] Sort the building materials product information from high to low according to their relevance;
[0033] The name, brand, specification, model and product description of building materials product information are displayed on the user interface.
[0034] In a second aspect, a building material retrieval device is provided. The device comprises:
[0035] An acquisition module is used to acquire building material data and construct a building material knowledge graph based on the building material data;
[0036] A parsing module is used to obtain user query statements, perform semantic parsing on user query statements using a large language model of building materials, and obtain structured user query statements related to building materials;
[0037] The query and reasoning module is used to query and reason about structured user query statements related to building materials based on the building materials knowledge graph to obtain building materials product information;
[0038] The sorting model is used to sort the building material product information by relevance and display it in the user interface.
[0039] According to a third aspect, an electronic device is provided. The electronic device includes a memory and a processor. A computer program is stored in the memory. When the processor executes the computer program, the method according to any one of the first aspects is implemented.
[0040] According to a fourth aspect, a computer-readable storage medium is provided, on which a computer program is stored, and when the computer program is executed by a processor, the method according to any one of the first aspects is implemented.
[0041] The present invention provides a building material retrieval method, device, electronic device and storage medium, the method comprising: obtaining building material data, constructing a building material knowledge graph according to the building material data, then obtaining a user query statement, using a building material large language model to semantically parse the user query statement, obtaining a structured user query statement related to building materials, querying and reasoning the structured user query statement related to building materials according to the building material knowledge graph, obtaining building material product information, sorting the building material product information by relevance, and displaying it on a user interface. That is, by obtaining building material data and constructing a building material knowledge graph, organizing the relevant information of building materials into a structured form, and then using a building material large language model to semantically parse the user query statement, it is helpful to more accurately understand the user's query and convert it into a structured query statement related to building materials, then, based on the building material knowledge graph and the structured user query statement related to building materials, query and reasoning are performed to obtain building material product information that meets the user's needs, and the building material product information that best meets the user's needs is displayed on the user interface, thereby improving the user experience and the efficiency of building material retrieval.
[0042] It should be understood that the contents described in the summary of the invention are not intended to limit the key or important features of the embodiments of the present invention, nor are they intended to limit the scope of the present invention. Other features of the present invention will become easily understood through the following description. BRIEF DESCRIPTION OF THE DRAWINGS
[0043] The above and other features, advantages and aspects of the embodiments of the present invention will become more apparent with reference to the following detailed description in conjunction with the accompanying drawings. In the accompanying drawings, the same or similar reference numerals represent the same or similar elements.
[0044] Figure 1 A flowchart of a building material retrieval method according to an embodiment of the present invention;
[0045] Figure 2 It is a schematic diagram of the structure of the building materials knowledge graph according to an embodiment of the present invention;
[0046] Figure 3 A schematic diagram of a structure for obtaining building material product information according to an embodiment of the present invention;
[0047] Figure 4A schematic diagram of the structure of a user interface according to an embodiment of the present invention;
[0048] Figure 5 A schematic diagram of the structure of a building material retrieval device according to an embodiment of the present invention;
[0049] Figure 6 4 is a structural diagram of an electronic device according to an embodiment of the present invention. DETAILED DESCRIPTION
[0050] In order to enable those skilled in the art to better understand the technical solutions in one or more embodiments of this specification, the technical solutions in one or more embodiments of this specification will be clearly and completely described below in conjunction with the drawings in one or more embodiments of this specification. Obviously, the described embodiments are only part of the embodiments of this specification, not all of them. Based on one or more embodiments of this specification, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of this document.
[0051] It should be noted that the description of the embodiments of the present invention is only for more clearly illustrating the technical solutions of the embodiments of the present invention, and does not constitute a limitation on the technical solutions provided by the embodiments of the present invention.
[0052] The embodiment of the present invention provides a building material retrieval method. Figure 1 FIG. 1 is a flow chart of a building material retrieval method according to an embodiment of the present invention. Figure 1 , the method comprising:
[0053] S101. Obtain building material data, and construct a building material knowledge graph based on the building material data.
[0054] Among them, the sources of building materials data include but are not limited to building materials suppliers and preset building materials databases, specifically including information such as product name, brand and specifications of building materials.
[0055] In this embodiment, constructing a building material knowledge graph based on building material data can help integrate a large amount of scattered information into a unified framework, which helps to establish an organized knowledge structure, thereby providing better decision support.
[0056] Optionally, the building material knowledge graph includes entity categories of building material products, structural parameters of building material products, and relationships between building material products;
[0057] Obtain building material data and construct a building material knowledge graph based on the building material data, including:
[0058] Obtain building material data, perform entity recognition and classification on the building material data, and obtain entity categories of building material products;
[0059] Extract structural parameters of building material products from building material data;
[0060] Establish the relationship between building material products based on the associated information in the building material data;
[0061] The entity categories of building materials products, the structural parameters of building materials products and the relationships between building materials products are represented in the form of a graph.
[0062] Figure 2 Schematic diagram of the structure of the building materials knowledge graph according to an embodiment of the present invention. Figure 2 shown.
[0063] Among them, the entity categories of building materials products in the building materials knowledge graph include but are not limited to oil-immersed transformers, oil-water separators, fume purifiers and filter cabinets. The structural parameters of building materials products include but are not limited to models, product descriptions, brands and specifications. The relationships between building materials products include but are not limited to product description relationships and brand affiliations.
[0064] In addition, graph databases can be used to manage and store building materials knowledge graphs. Graph databases use nodes to represent entity categories of building materials products, such as oil-immersed transformers, fume purifiers, filter cabinets, etc. Each node can contain structural parameter information, such as specifications, models, brands, etc. Edges are used to represent the relationship between building materials products, such as product description relationships, brand affiliation relationships, etc. Graph databases use graph structures to store data, in which the connection relationship between nodes and edges is directly stored, making it efficient to query and traverse the relationship of the building materials knowledge graph, and can quickly obtain the association information between nodes and edges. It also has good scalability and can easily add nodes, attributes and edges of new building materials products. When new building material entities or relationships appear, they can be directly added to the graph database, thereby keeping the building materials knowledge graph updated and complete, which is conducive to complex data analysis and decision support for building materials products.
[0065] In this embodiment, the building materials knowledge graph records the entity categories, structural parameters and relationships of building materials products, which can more conveniently obtain and apply the structural parameters and relationships of building materials products, thereby improving the quality and efficiency of building materials retrieval.
[0066] S102. Obtain user query statements, perform semantic analysis on the user query statements using a large language model of building materials, and obtain structured user query statements related to building materials.
[0067] Among them, the Large Language Model (LLM) of building materials first receives user query sentences as input, and the user query sentences include but are not limited to a question, a command and a statement. Then, the large language model of building materials uses its powerful language understanding ability to analyze and understand the user query sentences, and obtains accurate understanding of the query sentences by considering the grammatical structure, vocabulary meaning and contextual information of the sentences. In the process of semantic understanding, the large language model of building materials will identify the entity categories in the user query sentences, and the entity categories include but are not limited to the product name, product model and brand of building materials products. Through entity recognition, the subject and key information of the building materials products involved in the user query sentences can be determined, and then the keywords in the user query sentences can be extracted for further query processing and retrieval answer generation. In addition, by analyzing the grammatical structure and contextual information in the user query sentences, the large language model of building materials can establish the relationship between the building materials product entities, including but not limited to the product description relationship and the brand affiliation relationship. Finally, the large language model obtains the structured form of the user query sentences related to building materials through the steps of entity recognition, keyword extraction and relationship establishment, so as to better express the semantics and structure of the user query sentences.
[0068] In this embodiment, semantic analysis of user query statements is performed through a large language model to obtain structured user query statements related to building materials, which can better understand the user's query intention and improve the accuracy of building material retrieval.
[0069] Optionally, a user query statement is obtained, and a large language model of building materials is used to perform semantic analysis on the user query statement to obtain a structured user query statement related to building materials, including:
[0070] Inputting the user query sentence into the large language model of building materials, the large language model of building materials encodes the user query sentence, and obtains the structured user query sentence related to building materials after semantic analysis;
[0071] The large language model of building materials is pre-trained with data from a preset historical building material search database;
[0072] The Historical Building Materials Search Database includes product names, brands, specifications, models and product descriptions of building materials.
[0073] Among them, the content examples in the historical building materials search database can be shown in the following table:
[0074]
[0075] In this embodiment, a large language model of building materials is used to perform semantic analysis and structuring of user query statements, and combined with the data of the historical building materials search database used in pre-training, the richness of building materials data is achieved and the accuracy of building materials product searches is improved.
[0076] S103. Query and reason about structured user query statements related to building materials based on the building materials knowledge graph to obtain building materials product information.
[0077] Figure 3 FIG. 1 is a schematic diagram of a structure for obtaining building material product information according to an embodiment of the present invention. Figure 3 As shown:
[0078] The historical building materials search database is used to pre-train the building materials language model, and the user query statements are input into the pre-trained building materials language model for parsing to obtain structured user query statements related to building materials. Then, the building materials knowledge graph constructed based on the building materials data is used to query and reason about the structured user query statements related to building materials to obtain building materials product information, helping users to better obtain information.
[0079] Specifically, taking the user query sentence "I need to find a floor material suitable for use in the kitchen" as an example, the embodiment of the present invention can obtain building material product information through the following steps:
[0080] Step 1: Pre-train the architectural language model based on the historical building materials search database, which contains relevant information and characteristics of building materials, such as the name, purpose, performance indicators and manufacturer of building materials.
[0081] Step 2: Input the user query "I need to find a floor material suitable for use in the kitchen" into the pre-trained large language model of building materials for parsing and extracting key information. In this example, the key information is "kitchen" and "floor material", that is, a structured user query related to building materials.
[0082] Step 3: Use the building materials knowledge graph constructed based on building materials data to query and reason about structured user query statements related to building materials ("kitchen" and "floor materials"). In this example, for "kitchen" and "floor materials", the information that may be included in the knowledge graph is: tile flooring: waterproof, easy to clean, and available in a variety of colors and textures; laminate flooring: good wear resistance and relatively easy to install; solid wood flooring: durable and natural beauty, but requires more maintenance.
[0083] Step 4: Obtain building material product information. Based on the query and reasoning results, the building material product information can be further sorted and displayed according to the similarity ranking. In this example, tile flooring, laminate flooring, and solid wood flooring can be displayed in the user display interface in sequence according to the similarity ranking between each of them and the structured user query statements related to building materials.
[0084] In this embodiment, structured user query statements related to building materials are queried and inferred based on the building materials knowledge graph to obtain building materials product information, provide more comprehensive and accurate building materials product information to users, and avoid the uncertainty caused by fuzzy queries.
[0085] Optionally, query and reason about structured user query statements related to building materials based on the building materials knowledge graph to obtain building materials product information, including:
[0086] Calculate the similarity between structured user query sentences related to building materials and building materials knowledge of building materials products in the building materials knowledge graph;
[0087] Sort the building material knowledge similarities from high to low, obtain a corresponding amount of building material knowledge according to a preset quantity threshold, and form a single building material product candidate set;
[0088] According to the building materials knowledge graph, complete the candidate set of a single building materials product to obtain building materials product information.
[0089] Among them, the preset quantity threshold can be set as needed.
[0090] Among them, a single building material product candidate set is completed according to the building material knowledge graph. Assuming that the single building material product candidate set to be completed includes "solid wood flooring" and "laminate flooring", they can be completed respectively according to their corresponding brands, specifications, models and product descriptions.
[0091] In this embodiment, the building materials knowledge graph is used to query and reason about structured user query statements related to building materials by performing similarity calculation, sorting, quantity control, and information completion, thereby providing users with better building materials product selection and decision support.
[0092] Optionally, calculating the building materials knowledge similarity between the structured user query sentence related to building materials and the building materials products in the building materials knowledge graph includes:
[0093] Match the category of each non-empty field in the structured user query sentence related to building materials with the entity category of building materials products in the building materials knowledge graph;
[0094] The cosine similarity between each non-empty field in the structured user query sentence related to building materials and the structural parameters of the building materials products in the matching building materials knowledge graph is calculated to obtain the building materials knowledge similarity.
[0095] For example, the structure of the user query statement is {"color":"red","material":"wood","size":"120x80cm"}, and the building materials knowledge graph contains the following entity categories: color: red, blue, green, material: wood, metal, plastic, size: 120x80cm, 90x60cm, 150x100cm. Matching the fields in the user query statement with the entity categories in the building materials knowledge graph, the color field matches "red", the material field matches "wood", and the size field matches "120x80cm". Assume that the following structural parameter values are used to calculate the cosine similarity: color structural parameters: red [0.8, 0.2, 0.1], blue [0.3, 0.5, 0.2], green [0.1, 0.3, 0.6], material structural parameters: wood [0.6, 0.4, 0.2], metal [0.2, 0.7, 0.1], plastic [0.3, 0.3, 0.4], size structural parameters: 120x80cm [0.7, 0.3, 0.1], 90x60cm [0.4, 0.5, 0.3], 150x100cm: [0.6, 0.2, 0.4], then calculate the cosine between each non-empty field in the structured user query statement and the structural parameters of the building materials product in the matching building materials knowledge graph The similarity can be: the cosine similarity between the color field "red" and the color structure parameter = cosine_similarity([0.8, 0.2, 0.1], [0.8, 0.2, 0.1]) = 1.0, the cosine similarity between the material field "wood" and the material structure parameter = cosine_similarity([0.6, 0.4, 0.2], [0.6, 0.4, 0.2]) = 1.0, the cosine similarity between the size field "120x80cm" and the size structure parameter = cosine_similarity([0.7, 0.3, 0.1], [0.7, 0.3, 0.1]) = 1.0. In this way, the similarity of building materials knowledge is obtained.
[0096] In this embodiment, by matching the fields in the user query statement related to building materials with the entity categories in the building materials knowledge graph and calculating the cosine similarity between the structural parameters, it can ensure that the building materials products related to the user's needs are returned, providing an accurate similarity assessment, thereby helping users to better select suitable building materials products.
[0097] Optionally, a single building material product candidate set is completed according to the building material knowledge graph to obtain building material product information, including:
[0098] Retrieve in the building material knowledge graph according to the building material knowledge in a single building material product candidate set, and extract the knowledge nodes related to the building material knowledge in the single building material product candidate set;
[0099] Form building material product information based on the knowledge nodes related to the building material knowledge in a single building material product candidate set.
[0100] In this embodiment, more relevant building material product information is obtained from the building material knowledge graph, and accurate matching and retrieval are performed in the knowledge graph according to the building material knowledge in the candidate set, and the single building material product candidate set is complemented, so as to efficiently obtain rich building material product information and provide users with accurate, comprehensive and customized building material selection.
[0101] S104. Sort the relevance of the building material product information and display it on the user interface.
[0102] In this embodiment, by sorting the relevance of the building material product information and displaying it on the user interface, the search results can be more intuitively displayed according to the user's search intention and needs, and more personalized and accurate search results can be provided for the user.
[0103] Optionally, sorting the relevance of the building material product information and displaying it on the user interface includes,
[0104] Add the building material knowledge similarities in the single building material product candidate set of the building material product information to obtain the relevance of the building material product information;
[0105] Sort the building material product information from high to low according to the relevance of the building material product information;
[0106] Display the name, brand, specification, model and product description of the building material product information on the user interface.
[0107] In this embodiment, the structured user query statement obtained after parsing by the large language model can be denoted as query, and each non-empty field in query is denoted as query i , 0 < i < M, the value of M depends on the number of non-empty fields in the structured user query statement, query i includes but is not limited to product name, brand and specification. The building material knowledge graph can be denoted as KG (Knowledge Graph), and the jth structural parameter of the ith entity category of the building material product in the building material knowledge graph can be denoted as KG ij, where \(0 \lt j \lt N\), and the specific value of \(N\) is determined by the structural parameters corresponding to the entity categories of building materials products in the building materials knowledge graph. Then, the cosine similarity between each non-empty field in the structured user query statement and the structural parameters of the building materials products in the building materials knowledge graph that match it, that is, the building materials knowledge similarity \(S\) i The calculation formula can be:
[0108] S i =\{cosine\_similarity(query i , KG ij ) \mid j = 0, 1, \ldots, N\}
[0109] Among them, the calculation formula of the cosine similarity is:
[0110]
[0111] Finally, add up the building materials knowledge similarities \(S\) in the single building materials product candidate set of the building materials product information, and the relevance \(S\) of the building materials product information can be obtained. The calculation formula can be: i
[0112]
[0113] In this embodiment, by adding up the building materials knowledge similarities in the single building materials product candidate set of the building materials product information, the relevance of the building materials product information is obtained, and the building materials products with higher relevance are ranked in the front, making it easier for users to find the building materials products that match their needs and improving the efficiency of building materials product retrieval.
[0114] Figure 4 Figure 4 is a schematic structural diagram of the user interface of the embodiment of the present invention, as shown.
[0115] The user interface includes a user information query statement box and building materials product information entries. Among them, the building materials product information can include \(K\) items, and the value of \(K\) can be modified according to needs. The building materials product information entries include name, brand, specifications 1 to \(M\), models 1 to \(N\), and product description, where the values of \(M\) and \(N\) are determined by the content of the retrieved building materials product information.
[0116] In this embodiment, presenting the name, brand, specifications, models, and product description of the building materials product information on the user interface provides users with comprehensive and personalized search results, enhancing the user experience.
[0117] Based on the building material retrieval method provided in this embodiment, building material data is obtained, and a building material knowledge graph is constructed based on the building material data. Then, a user query statement is obtained, and the user query statement is semantically parsed using a large language model of building materials, and a structured user query statement related to building materials is obtained. The structured user query statement related to building materials is queried and reasoned based on the building material knowledge graph, and building material product information is obtained. The building material product information is sorted by relevance and displayed on the user interface. That is, by obtaining building material data and constructing a building material knowledge graph, the relevant information of building materials is organized into a structured form, and then the user query statement is semantically parsed using a large language model of building materials, which helps to more accurately understand the user's query and convert it into a structured query statement related to building materials. Then, based on the building material knowledge graph and the structured user query statement related to building materials, query and reasoning are performed to obtain building material product information that meets the user's needs, and the building material product information that best meets the user's needs is displayed on the user interface, thereby improving the user experience and the efficiency of building material retrieval.
[0118] Combination of the above Figure 1-Figure 4 The building material retrieval method provided in the embodiment of the present application is described in detail. Figure 5 A building material retrieval device for executing the building material retrieval method provided in an embodiment of the present application is described in detail.
[0119] Figure 5 FIG. 1 is a schematic diagram of the structure of a building material retrieval device according to an embodiment of the present invention. Figure 5 , the device comprises:
[0120] An acquisition module 501 is used to acquire building material data and construct a building material knowledge graph based on the building material data;
[0121] The parsing module 502 is used to obtain user query statements, perform semantic parsing on the user query statements using the building material language model, and obtain structured user query statements related to building materials;
[0122] The query and reasoning module 503 is used to query and reason about structured user query statements related to building materials according to the building materials knowledge graph to obtain building materials product information;
[0123] The sorting model 504 is used to sort the building material product information by relevance and display it on the user interface.
[0124] The technical effects of the building material retrieval device refer to the technical effects of the aforementioned building material retrieval method, which will not be repeated here.
[0125] Figure 6 is a structural diagram of an electronic device according to an embodiment of the present invention, such as Figure 6As shown, the electronic device includes a central processing unit (CPU) 601, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 602 or a program loaded from a storage part 608 into a random access memory (RAM) 603. In the RAM 603, various programs and data required for system operation are also stored. The CPU 601, the ROM 602, and the RAM 603 are connected to each other via a bus 604. An input / output (I / O) interface 605 is also connected to the bus 604.
[0126] The following components are connected to the I / O interface 605: an input section 606 including a keyboard, a mouse, etc.; an output section 607 including a cathode ray tube (CRT), a liquid crystal display (LCD), etc., and a speaker, etc.; a storage section 608 including a hard disk, etc.; and a communication section 609 including a network interface card such as a LAN card, a modem, etc. The communication section 609 performs communication processing via a network such as the Internet. A drive 610 is also connected to the I / O interface 605 as needed. A removable medium 611, such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, etc., is installed on the drive 610 as needed, so that a computer program read therefrom is installed into the storage section 608 as needed.
[0127] The flow chart and block diagram in the accompanying drawings illustrate the possible architecture, function and operation of the system, method and computer program product according to various embodiments of the present invention. In this regard, each square box in the flow chart or block diagram can represent a module, a program segment or a part of a code, and the module, program segment or a part of a code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the square box can also occur in a different order from the order marked in the accompanying drawings. For example, two square boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each square box in the block diagram and / or flow chart, and the combination of the square boxes in the block diagram and / or flow chart can be implemented with a dedicated hardware-based system that performs the specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.
[0128] The units or modules involved in the embodiments of the present invention may be implemented by software or hardware. The units or modules described may also be set in a processor, for example, it may be described as: a processor includes an acquisition module 501, a parsing module 502, a query reasoning module 503, and a sorting module 504, wherein the names of these modules do not constitute a limitation on the modules themselves in some cases.
[0129] An embodiment of the present invention provides a computer-readable storage medium, which may be a computer-readable storage medium included in the building material retrieval device described in the above embodiment; or a computer-readable storage medium that exists independently and is not assembled into an electronic device. The computer-readable storage medium stores one or more programs, and the programs are used by one or more processors to execute the quality assessment model training method described in the present invention.
[0130] The above description is only a preferred embodiment of the present invention and an explanation of the technical principles used. Those skilled in the art should understand that the scope of the invention involved in the present invention is not limited to the technical solution formed by a specific combination of the above technical features, but should also cover other technical solutions formed by any combination of the above technical features or their equivalent features without departing from the inventive concept. For example, the above features are replaced with the technical features with similar functions disclosed in the present invention (but not limited to) to form a technical solution.
Claims
1. A building material retrieval method, characterized in that: The method comprises: Acquire building material data, and construct a building material knowledge graph based on the building material data; Obtaining a user query statement, and performing semantic analysis on the user query statement using a large language model of building materials to obtain a structured user query statement related to building materials; Querying and reasoning the structured user query statements related to building materials according to the building materials knowledge graph to obtain building materials product information; sorting the building material product information by relevance and displaying it on a user interface; The building materials knowledge graph includes entity categories of building materials products, structural parameters of building materials products and relationships between building materials products; wherein the structural parameters of building materials products include: model, product description, brand and specification; the relationships between building materials products include product description relationship and brand affiliation relationship; The acquiring of building material data and constructing a building material knowledge graph according to the building material data includes: Acquire the building material data, perform entity recognition and classification on the building material data, and acquire the entity category of the building material product; Extracting structural parameters of the building material product from the building material data; Establishing the relationship between the building material products according to the association information in the building material data; Representing the entity category of the building material product, the structural parameters of the building material product and the relationship between the building material product in the form of a graph; The obtaining of user query statements, using a large language model of building materials to perform semantic analysis on the user query statements, and obtaining structured user query statements related to building materials, includes: Inputting the user query statement into the building material large language model, encoding the user query statement by the building material large language model, and obtaining the structured user query statement related to building materials after semantic analysis; The large language model of building materials is obtained by pre-training with data in a preset historical building material search database; The historical building materials search database includes the product name, brand, specification, model and product description of the building materials; The querying and reasoning of the structured user query statements related to building materials according to the building materials knowledge graph to obtain building materials product information includes: Calculating the building materials knowledge similarity between the structured user query sentence related to building materials and the building materials products in the building materials knowledge graph; Sort the building material knowledge similarities from high to low, and obtain a corresponding amount of building material knowledge according to a preset quantity threshold to form a single building material product candidate set; Completing the single building material product candidate set according to the building material knowledge graph to obtain the building material product information; The calculating of the building materials knowledge similarity between the structured user query statement related to building materials and the building materials products in the building materials knowledge graph includes: Matching the category of each non-empty field in the structured user query sentence related to building materials with the entity category of building materials products in the building materials knowledge graph; Calculating the cosine similarity between each non-empty field in the structured user query sentence related to building materials and the structural parameters of the building materials products in the building materials knowledge graph that match the non-empty field, and obtaining the building materials knowledge similarity; The relevance sorting of the building material product information and displaying it on the user interface includes: Adding the building material knowledge similarities in the individual building material product candidate sets of the building material product information to obtain the relevance of the building material product information; Sort the building material product information from high to low according to the relevance of the building material product information; Displaying the name, brand, specification, model and product description of the building material product information on the user interface; Denote each non-empty field in the query as query i , where 0 < i < M, and the value of M depends on the number of non-empty fields in the structured user query statement, and query i includes but is not limited to product name, brand, and specification; Denote the building materials knowledge graph as KG (Knowledge Graph), and denote the j-th structural parameter of the i-th entity category of building materials products in the building materials knowledge graph as KG ij , where 0 < j < N, and the specific value of N is determined by the structural parameters corresponding to the entity categories of building materials products in the building materials knowledge graph; Among them, the cosine similarity between each non-empty field in the structured user query statement and the structural parameters of the building material products in the building material knowledge graph that matches it, that is, the building material knowledge similarity S i The calculation formula is as follows: S i ={cosine_similarity(query i ,KG ij )|j=0,1,...,N} Among them, the calculation formula of cosine similarity is as follows: The building materials knowledge similarity S i Add them together to obtain the relevance S of the building materials product information, where the calculation formula of the relevance S is as follows: 。 2. The building material retrieval method according to claim 1, characterized in that: The step of completing the single building material product candidate set according to the building material knowledge graph to obtain the building material product information includes: Searching the building material knowledge graph according to the building material knowledge in the single building material product candidate set, and extracting knowledge nodes related to the building material knowledge in the single building material product candidate set; The building material product information is composed according to knowledge nodes related to building material knowledge in the single building material product candidate set.
3. A building material retrieval device, characterized in that: The device comprises, An acquisition module, used to acquire building material data and construct a building material knowledge graph based on the building material data; A parsing module, used to obtain user query statements, perform semantic parsing on the user query statements using a large language model of building materials, and obtain structured user query statements related to building materials; A query and reasoning module, used to query and reason the structured user query statements related to building materials according to the building materials knowledge graph to obtain building materials product information; A sorting model, used to sort the building material product information by relevance and display it on a user interface; The building materials knowledge graph includes entity categories of building materials products, structural parameters of building materials products and relationships between building materials products; wherein the structural parameters of building materials products include: model, product description, brand and specification; the relationships between building materials products include product description relationship and brand affiliation relationship; The acquiring of building material data and constructing a building material knowledge graph according to the building material data includes: Acquire the building material data, perform entity recognition and classification on the building material data, and acquire the entity category of the building material product; Extracting structural parameters of the building material product from the building material data; Establishing the relationship between the building material products according to the association information in the building material data; Representing the entity category of the building material product, the structural parameters of the building material product and the relationship between the building material product in the form of a graph; The obtaining of user query statements, using a large language model of building materials to perform semantic analysis on the user query statements, and obtaining structured user query statements related to building materials, includes: Inputting the user query statement into the building material large language model, encoding the user query statement by the building material large language model, and obtaining the structured user query statement related to building materials after semantic analysis; The large language model of building materials is obtained by pre-training with data in a preset historical building material search database; The historical building materials search database includes the product name, brand, specification, model and product description of the building materials; The querying and reasoning of the structured user query statements related to building materials according to the building materials knowledge graph to obtain building materials product information includes: Calculating the building materials knowledge similarity between the structured user query sentence related to building materials and the building materials products in the building materials knowledge graph; Sort the building material knowledge similarities from high to low, and obtain a corresponding amount of building material knowledge according to a preset quantity threshold to form a single building material product candidate set; Completing the single building material product candidate set according to the building material knowledge graph to obtain the building material product information; The calculating of the building materials knowledge similarity between the structured user query statement related to building materials and the building materials products in the building materials knowledge graph includes: Matching the category of each non-empty field in the structured user query sentence related to building materials with the entity category of building materials products in the building materials knowledge graph; Calculating the cosine similarity between each non-empty field in the structured user query sentence related to building materials and the structural parameters of the building materials products in the building materials knowledge graph that match the non-empty field, and obtaining the building materials knowledge similarity; The relevance sorting of the building material product information and displaying it on the user interface includes: Adding the building material knowledge similarities in the individual building material product candidate sets of the building material product information to obtain the relevance of the building material product information; Sort the building material product information from high to low according to the relevance of the building material product information; Displaying the name, brand, specification, model and product description of the building material product information on the user interface; Denote each non-empty field in the query as query i , where 0 < i < M, and the value of M depends on the number of non-empty fields in the structured user query statement, and query i includes, but is not limited to, product name, brand, and specification; Denote the building materials knowledge graph as KG (Knowledge Graph), and denote the j-th structural parameter of the i-th entity category of building materials products in the building materials knowledge graph as KG ij , where 0 < j < N, and the specific value of N is determined by the structural parameters corresponding to the entity categories of building materials products in the building materials knowledge graph; Among them, the cosine similarity between each non-empty field in the structured user query statement and the structural parameters of the building material products in the building material knowledge graph that matches it, that is, the building material knowledge similarity S i The calculation formula is as follows: S i ={cosine_similarity(query i ,KG ij )|j=0,1,...,N} Among them, the calculation formula of cosine similarity is as follows: The building materials knowledge similarity S i Add them together to obtain the relevance S of the building materials product information, where the calculation formula of the relevance S is as follows:
4. An electronic device comprising a memory and a processor, wherein a computer program is stored in the memory, wherein: When the processor executes the computer program, the method according to any one of claims 1 to 2 is implemented.
5. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the method according to any one of claims 1 to 2 is implemented.
Citation Information
Patent Citations
Chinese natural language interrogative sentence semantization knowledge base automatic question-answering method
CN105701253A
Method and device for knowledge quiz
CN106776532A
Search engine based named entity linking method
CN108415902A
Method for answering questions in petrochemical field based on knowledge map
CN109492077A
Semantic similar case retrieval method and device based on medical knowledge graph
CN111414393A
