Material retrieval method and device
By gradually determining the material search results, the problem of difficulty in dealing with synonyms, synonyms and spelling errors in the prior art is solved, and higher search accuracy and search rate are achieved.
Patent Information
- Application Number
- CN202510049478.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-01-13
- Publication Date
- 2025-06-06
AI Technical Summary
When existing material search technology processes keywords entered by users, it is difficult to effectively deal with synonyms, synonyms and spelling errors, resulting in incomplete and accurate search results.
By obtaining the user's query statement collection, based on the timestamp order and semantic information of the query statement, the current search result is gradually determined, and the selection of the query statement is adjusted according to the accuracy of the search results until satisfactory search accuracy is achieved.
This method can effectively understand the user's real query intention, identify and process synonyms and synonyms, expand the search range, improve the search rate and search accuracy, and avoid traditional keyword-based errors.
Smart Images

Figure CN120104812A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of material retrieval, and in particular to a material retrieval method and device. Background Art
[0002] Material retrieval refers to quickly finding materials that match the query statement entered by the user in a specific database or system.
[0003] At present, most searches in the material database are based on keywords, that is, users input keywords, match and search in the material database according to the keywords, and finally output materials related to the keywords. However, the keywords entered by users may contain synonyms, near-synonyms or spelling errors. If the synonyms corresponding to the keywords are stored in the material database, it will be mistakenly considered that the materials corresponding to the synonyms in the material database do not match the keywords, which will lead to the retrieval of matching materials in the material database based on the keyword method. Summary of the invention
[0004] The present invention provides a material retrieval method and device to solve the defects in the prior art.
[0005] The present invention provides a material retrieval method, comprising the following steps: Get the user's query statement set; According to the timestamp order of each query statement in the query statement set, sequentially taking out a query statement from the query statement set; Determine the current search result based on the semantic information of the currently retrieved query statement and the semantic information of all previously retrieved query statements; If the accuracy of the current search result is greater than the accuracy of the previous search result, the process returns to executing the query statement taken out from the query statement set until the accuracy of the current search result is less than the accuracy of the previous search result, and the material search result is determined based on the previous search result.
[0006] According to a material retrieval method provided by the present invention, the accuracy of the current retrieval result is determined based on the current similarity between each candidate material and the target material, and each candidate material is determined based on the semantic information of the query statement in the query statement set.
[0007] According to a material retrieval method provided by the present invention, each candidate material is determined based on the following steps: Determining a query vector based on semantic information of a first query statement in the query statement set; Based on the query vector, a search is performed in a vector search database to determine the candidate materials.
[0008] According to a material search method provided by the present invention, determining a material search result based on the previous search result includes: Rewriting the text of the first query statement in the query statement set according to a preset format to obtain a rewritten statement, and determining an unstructured search result based on the rewritten statement; Based on the material retrieval model, the query statement set, the unstructured retrieval result and the previous retrieval result are applied to determine the material retrieval result.
[0009] According to a material retrieval method provided by the present invention, the first query statement in the query statement set is rewritten according to a preset format to obtain a rewritten statement, and an unstructured retrieval result is determined based on the rewritten statement, including: Based on the text rewriting model, the first query statement is completed, and the text of the completed first query statement is rewritten according to the preset format to obtain the rewritten statement; Based on the rewritten sentence, a search is performed in an unstructured database to determine the unstructured search result.
[0010] According to a material retrieval method provided by the present invention, the first query statement is completed based on the text rewriting model, and the completed first query statement is text rewritten according to the preset format to obtain the rewritten statement, including: Based on the first query statement, construct a rewriting prompt text, the rewriting prompt text is used to prompt to complete the first query statement, and rewrite the text of the completed first query statement according to the preset format; Based on the text rewriting model, the rewriting hint text is applied to perform text rewriting on the query statement to obtain the rewritten statement.
[0011] According to a material retrieval method provided by the present invention, the vector retrieval database and the unstructured database are constructed based on the following steps: Based on the semantic features of the data of each sample material, determine the similarity between the sample materials; If the similarity between any two sample materials is greater than a threshold, the sample material data corresponding to the any two sample materials are merged to obtain updated sample material data; Converting the updated sample material data into the preset format, and constructing the unstructured database based on the sample material data in the converted format; The vector retrieval database is constructed based on the semantic features corresponding to the updated sample material data.
[0012] The present invention also provides a material retrieval device, comprising the following modules: An acquisition unit, used to acquire a user's query statement set; A retrieval unit, configured to retrieve a query statement from the query statement set in sequence according to the timestamp order of the query statements in the query statement set; Determine the current search result based on the semantic information of the currently retrieved query statement and the semantic information of all previously retrieved query statements; A determination unit is used to return to execute the step of taking a query statement from the query statement set if the accuracy of the current search result is greater than the accuracy of the previous search result, until the accuracy of the current search result is less than the accuracy of the previous search result, and then determine the material search result based on the previous search result.
[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 material retrieval methods described above 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 material retrieval method as 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 material retrieval method as described above is implemented.
[0016] The material retrieval method and device provided by the present invention determine the current search result based on the semantic information of the currently retrieved query statement and the semantic information of all previously retrieved query statements. Since the semantic information can understand the true intention of the user's query, it can avoid the errors caused by literal matching in the traditional keyword-based search. In addition, based on the semantic information, synonyms, near-synonyms, etc. can be identified and processed, thereby expanding the search scope, improving the completeness rate, and avoiding the problem that the traditional keyword-based search cannot effectively process synonyms and near-synonyms, resulting in insufficient search results. Furthermore, when facing multiple query statements of the user, the present invention can determine whether the currently retrieved query statement is a relevant query statement based on the accuracy of the current search result and the accuracy of the previous search result, thereby not only accurately retrieving the corresponding materials based on multiple query statements, but also avoiding the interference of irrelevant query statements in multiple query statements on material retrieval, further improving the accuracy of material 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 It is a flow chart of the material retrieval method provided by the present invention.
[0019] Figure 2 It is a flow chart of the vector retrieval database and the unstructured database construction method provided by the present invention.
[0020] Figure 3 It is a flow chart of another material retrieval method provided by the present invention.
[0021] Figure 4 It is a structural schematic diagram of the material retrieval device provided by the present invention.
[0022] Figure 5 It is a structural schematic diagram of the electronic device provided by the present invention. DETAILED DESCRIPTION
[0023] 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.
[0024] At present, most searches in the material database are based on keywords, that is, users input keywords, match and search in the material database according to the keywords, and finally output materials related to the keywords. However, the keywords entered by users may contain synonyms, near-synonyms or spelling errors. If the synonyms corresponding to the keywords are stored in the material database, it will be mistakenly considered that the materials corresponding to the synonyms in the material database do not match the keywords, which will lead to the retrieval of matching materials in the material database based on the keyword method.
[0025] Furthermore, when no matching materials can be found in the material database, relevant experts usually judge the consistency between the materials in the material database and the materials corresponding to the keywords, which is time-consuming, labor-intensive and has high communication costs.
[0026] In addition, in actual applications, users may need to search and filter multiple times before they can find the required materials. However, when searching based on keywords, users need to enter all the keywords corresponding to the query requirements at one time each time they search. Once the keywords are wrong or need to be modified, they need to re-enter the updated keywords at one time, which increases the user's operating burden and time cost and reduces the search efficiency.
[0027] To this end, the present invention provides a material retrieval method. Figure 1 It is a schematic diagram of the flow chart of the material retrieval method provided by the present invention, such as Figure 1 As shown, the method includes step 110 , step 120 and step 130 .
[0028] Step 110: Obtain the user's query statement set.
[0029] Specifically, the query statement set can be understood as a set consisting of multiple query statements of the user within a preset time period. Each query statement in the query statement set may be a query statement for searching the same material. For example, in the query statement set, query statement 1 is "screwdriver", query statement 2 is "10cm long", query statement 3 is "0.5cm diameter", and query statement 4 is "wooden handle". It can be seen that query statements 1 to 4 are all query statements for screwdrivers. Query statement 1 limits the material name, query statement 2 limits the material length, query statement 3 limits the material diameter, and query statement 4 limits the material material. In other words, query statements 1 to 4 are all used to retrieve the same material.
[0030] In addition, each query statement in the query statement set may also be a query statement for searching different materials. For example, in the query statement set, query statement 1 is "screwdriver", query statement 2 is "10 cm long", query statement 3 is "0.5 cm diameter", and query statement 4 is "wire rope that can pull up 10 tons of weight". It can be seen that query statements 1 to 3 are all query statements for screwdrivers, but query statement 4 is a query statement for wire ropes, that is, query statement 4 retrieves different materials from the other query statements. If the corresponding screwdriver can be accurately retrieved based on query statements 1 to 3, if the search is based on query statements 1 to 4, query statement 4 may cause interference and reduce the search accuracy.
[0031] It can be seen from this that although users can improve the hit rate of material retrieval through multiple query statements, the premise is that the above multiple query statements are used to describe the same material. If any query statement is used to describe other materials, then any query statement will cause interference in the retrieval process and reduce the retrieval accuracy.
[0032] Therefore, the embodiment of the present invention needs to identify the query statements that will cause interference in the above query statement set, and then be able to eliminate the query statements in the material retrieval process to improve the material retrieval accuracy. The following steps 120 and 130 are used to describe how to identify the query statements that have interference, and finally perform retrieval based on the query statements used to describe the same material to improve the material retrieval accuracy.
[0033] Step 120: Take out one query statement from the query statement set in turn according to the timestamp order of each query statement in the query statement set, and determine the current search result based on the semantic information of the currently taken out query statement and the semantic information of all previously taken out query statements each time a query statement is taken out.
[0034] Specifically, the timestamp of each query statement can be used to characterize the time when the user inputs each query statement. Usually, when the user inputs a query statement, the current query statement may be a further limitation of the previous query statement. For example, the previous query statement is "the end of the screwdriver is cross-shaped", and the current query statement is "the cross slot number is PH0". It can be seen that "the cross slot number is PH0" is a further additional limitation of "the end of the screwdriver is cross-shaped", that is, based on "the end of the screwdriver is cross-shaped", multiple candidate screwdrivers can be obtained, and based on "the cross slot number is PH0", the target screwdriver can be determined from multiple candidate screwdrivers, that is, "the cross slot number is PH0" further narrows the search scope of the material.
[0035] It can be seen from this that if multiple query statements in a query statement set are query statements for searching the same material, then according to the order of timestamps, the query statement with a later timestamp can usually further narrow the search scope corresponding to the query statement with an earlier timestamp, thereby improving the search efficiency and search accuracy.
[0036] In this regard, the embodiment of the present invention sequentially extracts a query statement from the query statement set according to the timestamp order of each query statement in the query statement set, and each time a query statement is extracted, the current search result is determined based on the semantic information of the currently extracted query statement and the semantic information of all previously extracted query statements. For example, according to the order of timestamps, the initial query statement set includes query statements 1 to 10, the currently extracted query statement is query statement 5, and all previously extracted query statements are query statements 1 to 4 (the current query statement set includes query statements 6 to 10). At this time, the current search result is determined based on query statements 1 to 5, and the current search result here can be one material or multiple materials matching query statements 1 to 5.
[0037] It should be noted that after a query statement is taken out from the query statement set, the query statement is no longer put back into the query statement set.
[0038] In addition, the embodiment of the present invention determines the current search result based on the semantic information of the currently retrieved query statement and the semantic information of all previously retrieved query statements. Since the semantic information can understand the true intention of the user's query, it can avoid the errors caused by literal matching in traditional keyword-based search. In addition, based on the semantic information, synonyms, near-synonyms, etc. can be identified and processed, thereby expanding the search scope, improving the completeness rate, and avoiding the problem that the traditional keyword-based search cannot effectively process synonyms and near-synonyms, resulting in incomplete search results. Furthermore, the semantic information based on the context of the query statement can determine the true meaning of the query statement, thereby providing more accurate search results. For example, when searching for "apple", it can be determined based on the context whether the user is searching for fruit or electronic products, which cannot be done by keyword search.
[0039] Step 130: If the accuracy of the current search result is greater than the accuracy of the previous search result, return to execute a query statement from the query statement set until the accuracy of the current search result is less than the accuracy of the previous search result, and then determine the material search result based on the previous search result.
[0040] Specifically, the difference between the current search result and the previous search result in the corresponding search process is that the current search result is determined based on the currently retrieved query statement and all previously retrieved query statements, while the previous search result is determined based on all previously retrieved query statements. In other words, the current search result can be understood as being obtained by further searching based on the currently retrieved query statement on the basis of the previous search result. In this embodiment of the present invention, the materials pointed to by all previously retrieved query statements are the same material.
[0041] If the material pointed to by the currently retrieved query statement is the same as the material pointed to by all previously retrieved query statements, the currently retrieved query statement is a related statement. On the basis of the previous search result, the current search result obtained by further searching based on the currently retrieved query statement will be more accurate than the previous search result. If the material pointed to by the currently retrieved query statement is different from the material pointed to by all previously retrieved query statements, the currently retrieved query statement is an unrelated statement. Searching based on the currently retrieved query statement will introduce interference, and the current search result will be less accurate than the previous search result.
[0042] Based on this, if the accuracy of the current search result is greater than the accuracy of the previous search result, it indicates that the material pointed to by the currently retrieved query statement is consistent with that pointed to by all previously retrieved query statements. At this time, it is necessary to determine whether the next retrieved query statement is consistent with the material pointed to by the currently retrieved query statement. Therefore, the process returns to execute step 120, "retrieve a query statement from the query statement set, and determine the current search result based on the semantic information of the currently retrieved query statement and the semantic information of all previously retrieved query statements each time a query statement is retrieved", until the accuracy of the current search result is less than the accuracy of the previous search result, indicating that the material pointed to by the currently retrieved query statement is inconsistent with that pointed to by the previously retrieved query statement, that is, the currently retrieved query statement is not only unable to help material retrieval, but also brings interference. At this time, the material search result is determined based on the previous search result with higher accuracy, such as directly using the previous search result as the material search result, or combining the search result obtained by searching based on the keywords in the query statement set to jointly determine the material search result. Among them, the material search result can be information such as material code and material attribute.
[0043] The material retrieval method provided by the embodiment of the present invention determines the current search result based on the semantic information of the currently retrieved query statement and the semantic information of all previously retrieved query statements. Since the semantic information can understand the true intention of the user's query, it can avoid the errors caused by literal matching in the traditional keyword-based search. In addition, based on the semantic information, synonyms, near-synonyms, etc. can be identified and processed, thereby expanding the search scope, improving the completeness rate, and avoiding the problem that the traditional keyword-based search cannot effectively process synonyms and near-synonyms, resulting in insufficient search results. Furthermore, when facing multiple query statements of the user, the embodiment of the present invention can determine whether the currently retrieved query statement is a relevant query statement based on the accuracy of the current search result and the accuracy of the previous search result, thereby not only accurately retrieving the corresponding materials based on multiple query statements, but also avoiding the interference of irrelevant query statements in multiple query statements on material retrieval, further improving the accuracy of material retrieval.
[0044] Based on the above embodiment, the current search result is the current similarity between multiple candidate materials and the target material under the currently retrieved query statement and all previously retrieved query statements. The accuracy of the current search result is determined based on the current similarity between each candidate material and the target material, and each candidate material is determined based on the semantic information of the query statement in the query statement set.
[0045] Specifically, the target material can be understood as the material pointed to by the user's true intention, that is, the material that the user truly needs to retrieve. The candidate materials can be understood as the materials retrieved based on the semantic information of the currently retrieved query statement and the semantic information of all previously retrieved query statements, and the retrieved materials match the query statement. The target material may or may not be included in multiple candidate materials. Among them, the current retrieval result is the current similarity between each candidate material and the target material. The higher the current similarity between each candidate material and the target material, the higher the probability that the current retrieval result hits the target material, and thus the higher the accuracy of the current retrieval result.
[0046] Exemplarily, the accuracy of the current retrieval result can be measured by the average value of the current similarities corresponding to each candidate material. The higher the average value, the higher the corresponding accuracy. For example, the query statement set includes multiple query statements {Q1, Q2, Q3, Q4, Q5, …, Qn} in chronological order of timestamps. Q1 is retrieved, and the average value of the current similarities of multiple candidate materials obtained by retrieving materials based on Q1 is P1; Q2 is retrieved, and the average value of the current similarities of multiple candidate materials obtained by retrieving materials based on Q1 + Q2 is P2; at this time, it is determined that P1 < P2, and Q3 is retrieved continuously. The average value of the current similarities of multiple candidate materials obtained by retrieving materials based on Q1 + Q2 + Q3 is P3; at this time, it is determined that P2 < P3, and Q4 is retrieved continuously. The average value of the current similarities of multiple candidate materials obtained by retrieving materials based on Q1 + Q2 + Q3 + Q4 is P4; at this time, it is determined that P3 < P4, and Q5 is retrieved continuously. The average value of the current similarities of multiple candidate materials obtained by retrieving materials based on Q1 + Q2 + Q3 + Q4 + Q5 is P5; at this time, it is determined that P4 > P5, indicating that adding Q5 for retrieval does not improve the accuracy of the retrieval result. Most likely, the material pointed to by Q5 is different from the materials pointed to by Q1 to Q4. At this time, the retrieval result determined based on Q1 + Q2 + Q3 + Q4 is used as the material retrieval result.
[0047] Based on any of the above embodiments, each candidate material is determined based on the following steps: Based on the semantic information of the first query statement in the query statement set, determine the query vector; Based on the query vector, retrieve in the vector retrieval database to determine each candidate material.
[0048] Specifically, in order to accurately compare the differences in the accuracies of each retrieval result, it is necessary to eliminate the influence of other factors on the comparison result. In the embodiments of the present invention, the multiple candidate materials corresponding to each retrieval result are the same. For example, the multiple candidate materials corresponding to the current retrieval result are the same as the multiple candidate materials corresponding to the previous retrieval result, so as to avoid inconsistent comparison benchmarks or the introduction of interference factors caused by different candidate materials corresponding to different retrieval results, thereby affecting the accuracy of the comparison result.
[0049] In addition, considering that the first query statement in the query statement set usually contains the user's most original and direct query intention (such as the second query statement may point to new materials), the embodiment of the present invention uses the first query statement in the query statement set to determine the unstructured retrieval results.
[0050] Based on this, the embodiment of the present invention performs semantic analysis on the first query statement to understand the user's actual search intention based on the semantic information of the first query statement, and can retrieve relevant synonyms, near-synonyms, etc. based on the semantic information, thereby improving the coverage of multiple candidate materials, and multiple candidate materials match the user's actual search intention.
[0051] The query vector is used to represent the semantic information of the material pointed to by the first query statement, which can be obtained by extracting features from the first query statement through a feature extraction model. After determining the query vector, a search can be performed in a vector retrieval database based on the query vector to determine multiple candidate materials. The vector retrieval database stores semantic features corresponding to different materials, and multiple candidate materials can be determined based on the distance between the query vector and each semantic feature in the vector retrieval database. For example, materials corresponding to semantic features whose distance is less than a threshold can be used as multiple candidate materials.
[0052] The embodiment of the present invention performs retrieval by using a query vector that represents the semantic information of the material pointed to by the first query statement, and can deeply understand the user's real query intention, thereby improving the accuracy of material retrieval.
[0053] Based on any of the above embodiments, determining a material search result based on a previous search result includes: Rewriting the text of the first query statement in the query statement set according to a preset format to obtain a rewritten statement, and determining an unstructured search result based on the rewritten statement; Based on the material retrieval model, the query statement set, unstructured retrieval results and previous retrieval results are applied to determine the material retrieval results.
[0054] Specifically, considering that the first query statement in the query statement set usually contains the user's most original and direct query intention (such as the second query statement may point to a new material), the embodiment of the present invention uses the first query statement in the query statement set to determine the unstructured retrieval results.
[0055] Based on this, the embodiment of the present invention rewrites the first query statement according to the preset format to obtain a rewritten statement in the preset format, that is, the first query statement is rewritten into the preset format, and the text in the rewritten statement all comes from the first query statement. Among them, the rewritten statement can be a search expression composed of keywords in the first query statement, and then a search is performed based on the search expression, such as searching in an unstructured database to determine an unstructured search result. Since the text in the rewritten statement all comes from the first query statement, the unstructured search result is used to characterize the materials directly related to the keywords in the first query statement.
[0056] On this basis, based on the material retrieval model, the material retrieval results determined by applying the query statement set, unstructured retrieval results and the previous retrieval results can not only capture the user's true search intention, but also ensure that the materials directly related to the first query statement keywords are retrieved, thereby improving the accuracy of material retrieval.
[0057] Exemplarily, based on the query statement set, materials with a high relevance to the query statement set can be screened from the unstructured search results and the previous search results as the final material search results.
[0058] Based on any of the above embodiments, rewriting the text of the first query statement in the query statement set according to a preset format to obtain a rewritten statement, and determining an unstructured search result based on the rewritten statement, including: Based on the text rewriting model, the first query statement is completed, and the text of the completed first query statement is rewritten according to a preset format to obtain a rewritten statement; Based on the rewritten sentence, the unstructured database is searched to determine the unstructured search results.
[0059] Specifically, the first query statement may be difficult to use directly for material retrieval due to incomplete information or vague expressions, so the first query statement needs to be completed to clarify the retrieval details. For example, the first query statement is "Find a screwdriver suitable for M3 screws". The first query statement does not clearly indicate the specifications of the screwdriver. Based on the semantic information, it can be determined that "medium-sized cross-head metal magnetic screwdriver" is a screwdriver suitable for M3 screws, so the first query statement can be completed to "Find a medium-sized cross-head metal magnetic screwdriver suitable for M3 screws".
[0060] After completing the first query statement, more search details can be obtained, and then the completed first query statement is rewritten according to a preset format, and the unstructured database is searched based on the rewritten statement to determine the unstructured search results. Among them, the unstructured database may store keywords corresponding to different materials, and the rewritten statement may be a search expression composed of keywords in the completed first query statement. Based on the search expression, the unstructured database is searched to obtain the unstructured search results.
[0061] Based on any of the above embodiments, based on the text rewriting model, the first query statement is completed, and the completed first query statement is text rewritten according to a preset format to obtain a rewritten statement, including: Based on the first query statement, a rewriting prompt text is constructed, where the rewriting prompt text is used to prompt completion of the first query statement, and the text of the completed first query statement is rewritten according to a preset format; Based on the text rewriting model, the rewriting hint text is applied to perform text rewriting on the query statement to obtain a rewritten statement.
[0062] Specifically, the rewriting hint text may be generated based on the context of the first query statement or a preset rule, and is used to prompt how to complete the first query statement, such as including additional information that needs to be added, format requirements of the information, and the like.
[0063] For example, if the first query statement is "Find screwdrivers suitable for M3 screws", the rewrite prompt text can be "Please add the size (especially the blade size), material, and whether it is magnetic and other information of the screwdriver that meets the requirements in the first query statement, generate a completion statement, and rewrite the completion statement into **** format. The first query statement is *****".
[0064] After the rewriting hint text is determined, the rewriting hint text is input into the text rewriting model, and the text rewriting model completes the first query statement according to the rewriting hint text requirements, and performs text rewriting on the completed first query statement according to a preset format.
[0065] Based on any of the above embodiments, the vector retrieval database and the unstructured database are constructed based on the following steps: Based on the semantic features of the data of each sample material, determine the similarity between the sample materials; If the similarity between any two sample materials is greater than a threshold, the sample material data corresponding to the any two sample materials are merged to obtain updated sample material data; The updated sample material data is converted into a preset format, and an unstructured database is constructed based on the sample material data in the converted format; A vector retrieval database is constructed based on the semantic features corresponding to the updated sample material data.
[0066] Specifically, the sources of each sample material data may be different, that is, the formats of each sample material data may be different. Based on this, the embodiment of the present invention can extract the semantic features of each sample material data, and the semantic features are used to describe the properties, uses, etc. of the corresponding sample material. Based on the distance between the semantic features of each sample material data, the similarity between the sample materials can be determined, and the smaller the distance, the higher the similarity.
[0067] If the similarity between any two sample materials is greater than a threshold, it indicates that the probability that the two sample materials are the same material is high. Based on this, the sample material data corresponding to the two sample materials can be merged to obtain updated sample material data. In the merging process, different information can be merged and duplicate content can be removed.
[0068] The updated sample material data is converted into a preset format, which may include specific fields, data structures or encoding standards to ensure data consistency and retrievability. An unstructured database is constructed based on the converted sample material data. The unstructured database can store and retrieve a large amount of text information and support complex query and search operations. For example, the updated sample material data can be converted into JSON expression, and the JSON expression can be stored in an unstructured database, such as MongoDB.
[0069] In addition to the unstructured database, a vector retrieval database is also constructed based on the semantic features corresponding to the updated sample material data. In this process, each sample material data can be converted into a vector representation (i.e., semantic features). These vector representations can capture the semantic relationship and similarity between materials, and construct a vector retrieval database based on the semantic features of each sample material data. For example, vector retrieval technology (such as approximate nearest neighbor search, hashing method, etc.) can be used to construct a vector retrieval database so that the vector most similar to the given query vector can be efficiently found in subsequent queries. Among them, the vector retrieval database can be a database with similar functions such as Milvus, Chroma, etc.
[0070] Figure 2 Schematic diagram of the process of constructing a vector retrieval database and an unstructured database provided by the present invention. Figure 2As shown, the original material data is obtained, and the semantic features of the original material data are extracted based on the material semantic model. Then, based on the material aggregation model, the merging coefficient between the semantic features of each original material data is determined, and the original material data with a merging coefficient greater than 0.9 are merged. Finally, the merged original material data is manually sampled and verified to obtain the material data described in an unstructured language. Using the text rewriting model, the JSON expression corresponding to each material is obtained according to the given encoding format, and the JSON expression is written into the unstructured database. In addition, the material semantic model is called to extract the semantic features of the unstructured material data, and the semantic features are stored in the vector retrieval database.
[0071] Based on any of the above embodiments, Figure 3 It is a flow chart of another material retrieval method provided by the present invention, such as Figure 3 As shown, the method includes: The user's query statement set is obtained, the material semantic model is called, a query vector is determined based on the semantic information of the first query statement in the query statement set, and a vector search database is searched based on the query vector to determine multiple candidate materials.
[0072] According to the timestamp order of each query statement in the query statement set, one query statement is taken out from the query statement set in turn, and each time a query statement is taken out, the current search result is determined based on the semantic information of the currently taken out query statement and the semantic information of all previously taken out query statements; if the accuracy of the current search result is greater than the accuracy of the previous search result, then return to execute to take out a query statement from the query statement set, until the accuracy of the current search result is less than the accuracy of the previous search result, and the material search result is determined based on the previous search result. Here, it can be regarded as determining the search result based on multiple rounds of dialogue. Among them, the current search result is the current similarity between multiple candidate materials and the target material under the currently taken out query statement and all previously taken out query statements, and the accuracy of the current search result is determined based on the current similarity corresponding to each candidate material.
[0073] At the same time, based on the first query statement, a rewriting hint text is constructed, which is used to prompt the completion of the first query statement, and the completed first query statement is rewritten according to a preset format; based on the text rewriting model, the rewriting hint text is applied to rewrite the query statement to obtain a rewritten statement. Then, based on the rewritten statement, a search is performed in the unstructured database to determine the unstructured search results.
[0074] Next, based on the material retrieval model, the query statement set, the unstructured search results, and the previous search results are applied to determine the material retrieval results, and the material retrieval results are returned to the user, so that the user can determine whether to continue asking questions or ask new questions based on the returned material retrieval results. Among them, the user's continued questions or new questions will be added to the query statement set. If there are new query statements in the query statement set, the corresponding steps of "building a rewrite prompt text based on the first query statement" and "calling the above-mentioned material semantic model to determine the query vector based on the semantic information of the first query statement in the query statement set" are returned.
[0075] The material retrieval device provided by the present invention is described below. The material retrieval device described below and the material retrieval method described above can be referenced to each other.
[0076] Based on any of the above embodiments, Figure 4 Schematic diagram of the structure of the material retrieval device provided by the present invention. Figure 4 As shown, the device comprises: An acquisition unit 410 is used to acquire a user's query statement set; A retrieval unit 420 is used to retrieve a query statement from the query statement set in sequence according to the timestamp order of each query statement in the query statement set; Determine the current search result based on the semantic information of the currently retrieved query statement and the semantic information of all previously retrieved query statements; The determination unit 430 is used to return to execute a query statement from the query statement set if the accuracy of the current search result is greater than the accuracy of the previous search result, until the accuracy of the current search result is less than the accuracy of the previous search result, and determine the material search result based on the previous search result.
[0077] Based on any of the above embodiments, the accuracy of the current search result is determined based on the current similarity between each candidate material and the target material, and each candidate material is determined based on the semantic information of the query statement in the query statement set.
[0078] Based on any of the above embodiments, each candidate material is determined based on the following steps: Determine a query vector based on semantic information of a first query statement in the query statement set; Based on the query vector, search in the vector search database to determine the candidate materials.
[0079] Based on any of the above embodiments, determining a material search result based on a previous search result includes: Rewriting the text of the first query statement in the query statement set according to a preset format to obtain a rewritten statement, and determining an unstructured search result based on the rewritten statement; Based on the material retrieval model, the query statement set, unstructured retrieval results and previous retrieval results are applied to determine the material retrieval results.
[0080] Based on any of the above embodiments, rewriting the text of the first query statement in the query statement set according to a preset format to obtain a rewritten statement, and determining an unstructured search result based on the rewritten statement, including: Based on the text rewriting model, the first query statement is completed, and the text of the completed first query statement is rewritten according to a preset format to obtain a rewritten statement; Based on the rewritten sentence, the unstructured database is searched to determine the unstructured search results.
[0081] Based on any of the above embodiments, based on the text rewriting model, the first query statement is completed, and the completed first query statement is text rewritten according to a preset format to obtain a rewritten statement, including: Based on the first query statement, a rewriting prompt text is constructed, where the rewriting prompt text is used to prompt completion of the first query statement, and the text of the completed first query statement is rewritten according to a preset format; Based on the text rewriting model, the rewriting hint text is applied to perform text rewriting on the query statement to obtain a rewritten statement.
[0082] Based on any of the above embodiments, the vector retrieval database and the unstructured database are constructed based on the following steps: Based on the semantic features of the data of each sample material, determine the similarity between the sample materials; If the similarity between any two sample materials is greater than a threshold, the sample material data corresponding to the any two sample materials are merged to obtain updated sample material data; The updated sample material data is converted into a preset format, and an unstructured database is constructed based on the sample material data in the converted format; A vector retrieval database is constructed based on the semantic features corresponding to the updated sample material data.
[0083] Figure 5 is a schematic diagram of the structure of the electronic device provided by the present invention, such as Figure 5As shown, the electronic device may include: a processor 510, a communication interface 520, a memory 530 and a communication bus 540, wherein the processor 510, the communication interface 520 and the memory 530 communicate with each other through the communication bus 540. The processor 510 may call the logic instructions in the memory 530 to execute the material retrieval method, which includes: obtaining a user's query statement set; taking out a query statement from the query statement set in sequence according to the timestamp order of each query statement in the query statement set, and determining the current retrieval result based on the semantic information of the currently taken query statement and the semantic information of all previously taken query statements each time a query statement is taken out; if the accuracy of the current retrieval result is greater than the accuracy of the previous retrieval result, returning to execute the query statement taken out from the query statement set until the accuracy of the current retrieval result is less than the accuracy of the previous retrieval result, and determining the material retrieval result based on the previous retrieval result.
[0084] In addition, the logic instructions in the above-mentioned memory 530 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 such an 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, etc. Various media that can store program codes.
[0085] 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 material retrieval method provided by the above-mentioned methods, which method includes: obtaining a user's query statement set; taking out a query statement from the query statement set in sequence according to the timestamp order of each query statement in the query statement set, and determining the current retrieval result each time a query statement is taken out based on the semantic information of the currently taken out query statement and the semantic information of all previously taken out query statements; if the accuracy of the current retrieval result is greater than the accuracy of the previous retrieval result, returning to execute the query statement taken out from the query statement set until the accuracy of the current retrieval result is less than the accuracy of the previous retrieval result, and determining the material retrieval result based on the previous retrieval result.
[0086] 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 material retrieval method provided by the above-mentioned methods, the method comprising: obtaining a user's query statement set; taking out a query statement from the query statement set in sequence according to the timestamp order of each query statement in the query statement set, and determining a current retrieval result each time a query statement is taken out based on the semantic information of the currently taken out query statement and the semantic information of all previously taken out query statements; if the accuracy of the current retrieval result is greater than the accuracy of the previous retrieval result, returning to execute the step of taking out a query statement from the query statement set, until the accuracy of the current retrieval result is less than the accuracy of the previous retrieval result, and determining a material retrieval result based on the previous retrieval result.
[0087] 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.
[0088] 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.
[0089] 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 material retrieval method, characterized in that: include: Get the user's query statement set; According to the timestamp order of each query statement in the query statement set, sequentially taking out a query statement from the query statement set; Determine the current search result based on the semantic information of the currently retrieved query statement and the semantic information of all previously retrieved query statements; If the accuracy of the current search result is greater than the accuracy of the previous search result, the process returns to executing the query statement taken out from the query statement set until the accuracy of the current search result is less than the accuracy of the previous search result, and the material search result is determined based on the previous search result.
2. The material retrieval method according to claim 1, characterized in that: The accuracy of the current search result is determined based on the current similarity between each candidate material and the target material, and each candidate material is determined based on the semantic information of the query statement in the query statement set.
3. The material retrieval method according to claim 2, characterized in that: The candidate materials are determined based on the following steps: Determining a query vector based on semantic information of a first query statement in the query statement set; Based on the query vector, a search is performed in a vector search database to determine the candidate materials.
4. The material retrieval method according to claim 3, characterized in that: The determining of the material search result based on the previous search result includes: Rewriting the text of the first query statement in the query statement set according to a preset format to obtain a rewritten statement, and determining an unstructured search result based on the rewritten statement; Based on the material retrieval model, the query statement set, the unstructured retrieval result and the previous retrieval result are applied to determine the material retrieval result.
5. The material retrieval method according to claim 4, characterized in that: The step of rewriting the text of the first query statement in the query statement set according to a preset format to obtain a rewritten statement, and determining an unstructured search result based on the rewritten statement includes: Based on the text rewriting model, the first query statement is completed, and the text of the completed first query statement is rewritten according to the preset format to obtain the rewritten statement; Based on the rewritten sentence, a search is performed in an unstructured database to determine the unstructured search result.
6. The material retrieval method according to claim 5, characterized in that: The method of completing the first query statement based on the text rewriting model and rewriting the completed first query statement according to the preset format to obtain the rewritten statement includes: Based on the first query statement, construct a rewriting prompt text, the rewriting prompt text is used to prompt to complete the first query statement, and rewrite the text of the completed first query statement according to the preset format; Based on the text rewriting model, the rewriting hint text is applied to perform text rewriting on the query statement to obtain the rewritten statement.
7. The material retrieval method according to claim 5, characterized in that: The vector retrieval database and the unstructured database are constructed based on the following steps: Based on the semantic features of the data of each sample material, determine the similarity between the sample materials; If the similarity between any two sample materials is greater than a threshold, the sample material data corresponding to the any two sample materials are merged to obtain updated sample material data; Converting the updated sample material data into the preset format, and constructing the unstructured database based on the sample material data in the converted format; The vector retrieval database is constructed based on the semantic features corresponding to the updated sample material data.
8. A material retrieval device, characterized in that: include: An acquisition unit, used to acquire a user's query statement set; A retrieval unit, configured to retrieve a query statement from the query statement set in sequence according to the timestamp order of the query statements in the query statement set; Determine the current search result based on the semantic information of the currently retrieved query statement and the semantic information of all previously retrieved query statements; A determination unit is used to return to execute the step of taking a query statement from the query statement set if the accuracy of the current search result is greater than the accuracy of the previous search result, until the accuracy of the current search result is less than the accuracy of the previous search result, and then determine the material search result based on the previous search result.
9. An electronic device comprising a memory, a processor, and a computer program stored in the memory and running on the processor, characterized in that: When the processor executes the computer program, the material 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 material retrieval method according to any one of claims 1 to 7 is implemented.
11. A computer program product, comprising a computer program, characterized in that When the computer program is executed by a processor, the material retrieval method according to any one of claims 1 to 7 is implemented.