Question and answer method and device and electronic equipment

By using the similarity between the target problem and the feature library fragment in the AIGC model question and answer system, the problem of low answer accuracy in the prior art is solved, and higher answer accuracy is achieved.

CN119396962APending Publication Date: 2025-02-07ZHEJIANG UNIVIEW TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202310927954.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2023-07-26
Publication Date
2025-02-07

AI Technical Summary

Technical Problem

In the prior art, when using the AIGC model for question and answer, the answer accuracy is low, mainly because the answers generated by the AIGC model match the questions with the lower degree of matching.

Method used

The first similarity is determined by determining the problem characteristics and fragment characteristics of each document in the feature library of the target problem, and the target fragment is determined; then the second similarity is determined based on the problem characteristics and sub-fragment characteristics of the target fragment, and the target sub-fragment is determined; finally, based on the Target sub-snippets and target question determination answer information.

Benefits of technology

It improves the degree of matching the answer information with the overall content of the target question, and significantly improves the accuracy of the answer information.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119396962A_ABST
    Figure CN119396962A_ABST
Patent Text Reader

Abstract

The invention provides a question and answer method and device and electronic equipment, and relates to the technical field of artificial intelligence. The method comprises the steps of determining a first similarity between a target question and each fragment based on question features of the target question and fragment features of at least two fragments of each document in a feature library; determining at least one target fragment from the at least two fragments based on the first similarities; for each target segment, determining a second similarity between the target problem and each sub-segment based on the problem feature and the sub-segment feature of each sub-segment of the target segment in the feature library; and based on each second similarity, determining a target sub-fragment from each sub-fragment, and based on the target sub-fragment and the target question, determining answer information corresponding to the target question. According to the method, the target sub-fragment which is relatively similar to the overall content of the target question can be determined by using the first similarity and the second similarity, and the answer information is determined based on the target question and the target sub-fragment, so that the accuracy of the answer information can be improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of artificial intelligence technology, and in particular to a question-answering method, device and electronic equipment. Background Art

[0002] At present, artificial intelligence generated content (AIGC) models represented by ChatGPT (Chat Generative Pre-trained Transformer) are developing rapidly, and AIGC models are used in many content generation scenarios. The AIGC model has its own knowledge base. When generating answers to questions, the AIGC model will generate answers based on its own knowledge base. In some question-and-answer scenarios, in addition to the AIGC model's own knowledge base, it is also necessary to combine knowledge outside the AIGC model's own knowledge base to answer questions.

[0003] In the related technology, the method of plug-in knowledge base is adopted to answer questions using AIGC model. The plug-in knowledge base is a proprietary knowledge base that is different from the AIGC model's own knowledge base. When answering questions by combining the content in the plug-in proprietary knowledge base and the AIGC model, it is necessary to first search for knowledge content related to the question from the plug-in proprietary knowledge base. The AIGC model will generate the answer to the question based on the found knowledge content and the question.

[0004] In actual applications, when using the AIGC model for question and answering using an external knowledge base, once a keyword appears in the question, the AIGC model generates content related to the keyword as the answer, which makes the answer generated by the AIGC model less likely to match the question, resulting in lower accuracy of the generated answer. Summary of the invention

[0005] The present invention provides a question-answering method, device and electronic device, which are used to solve the defect of low answer accuracy in the prior art and achieve the purpose of improving the accuracy of question-answering.

[0006] The present invention provides a question-answering method, comprising:

[0007] Determine a first similarity between the target question and each of the segments based on a question feature of the target question and segment features of at least two segments of each document in the feature library;

[0008] Based on each of the first similarities, determining at least one target segment from at least two segments;

[0009] For each target segment, based on the question feature and the sub-segment features of each sub-segment of the target segment in the feature library, determine a second similarity between the target question and each sub-segment;

[0010] Based on each of the second similarities, a target sub-segment is determined from each of the sub-segments, and based on the target sub-segment and the target question, answer information corresponding to the target question is determined.

[0011] According to the question-answering method provided by the present invention, the determining of the first similarity between the target question and each of the segments based on the question feature of the target question and the segment features of at least two segments of each document in the feature library includes:

[0012] Based on the key information in the target problem, determine the dimensional characteristics of the target problem;

[0013] Based on the problem feature and the dimension feature, determining a first feature corresponding to the target problem;

[0014] The first similarity is determined based on the first feature and second features corresponding to each segment in the feature library, where the second features include segment features of the segment and document features of the document to which the segment belongs.

[0015] According to the question-answering method provided by the present invention, determining the first similarity based on the first feature and the second feature corresponding to each fragment in the feature library includes:

[0016] Determining the credibility of the dimensional features based on the matching degree between the key information in the target question and the dimensional information of each of the documents;

[0017] Determining the weight of the dimensional feature based on the credibility and the preset importance of the dimensional information;

[0018] The first similarity is determined based on the weight of the dimensional feature, the preset weight of the question feature, the first feature, and the second feature.

[0019] According to the question-answering method provided by the present invention, the step of determining a target sub-segment from each of the sub-segments based on each of the second similarities includes:

[0020] Determine a sub-segment list according to the order of the second similarities from high to low, wherein the sub-segment list includes sub-segments corresponding to the first preset number of second similarities;

[0021] Traversing the sub-segment list starting from the sub-segment corresponding to the highest second similarity, and determining, based on the order of the sub-segments contained in the document to which the currently traversed sub-segment belongs, a third similarity between the sub-segment feature of the previous sub-segment and the problem feature, and a fourth similarity between the sub-segment feature of the next sub-segment and the problem feature, wherein the previous sub-segment is a sub-segment previous to the currently traversed sub-segment, and the next sub-segment is a sub-segment next to the currently traversed sub-segment;

[0022] The target sub-segment is determined from the sub-segments based on the third similarity and the fourth similarity.

[0023] According to the question-answering method provided by the present invention, determining the target sub-segment from each of the sub-segments based on the third similarity and the fourth similarity includes:

[0024] In a case where the third similarity is greater than the fourth similarity, determining the target sub-segment based on the currently traversed sub-segment and the previous sub-segment;

[0025] In a case where the fourth similarity is greater than the third similarity, the target sub-segment is determined based on the currently traversed sub-segment and the next sub-segment.

[0026] According to the question-answering method provided by the present invention, determining the second similarity between the target question and each sub-segment based on the question feature and each sub-segment feature of each sub-segment of the target segment in the feature library includes:

[0027] The second similarity is determined based on the first feature and a third feature corresponding to each sub-segment in the feature library, wherein the third feature includes a sub-segment feature of the sub-segment and a document feature of the document to which the sub-segment belongs.

[0028] According to the question-answering method provided by the present invention, the method further comprises:

[0029] Get at least one document;

[0030] For each of the documents, segment the document based on a first preset length and a preset segment identifier to obtain at least two segments;

[0031] For each of the segments, segment the segment based on a second preset length and a preset sub-segment identifier to obtain at least two sub-segments;

[0032] The segment features of each of the segments and the sub-segment features of each of the sub-segments are stored in the feature library.

[0033] According to the question-answering method provided by the present invention, the method further comprises:

[0034] For each of the documents, determining a document feature of the document based on the dimension information of the document;

[0035] Determine a second feature corresponding to each segment based on the document feature of the document and the segment feature of each segment in the document;

[0036] Determine a third feature corresponding to each sub-segment based on the document feature of the document and the sub-segment feature corresponding to the sub-segment of each segment in the document;

[0037] The second feature corresponding to each segment and the third feature corresponding to each sub-segment are stored in the feature library.

[0038] The present invention also provides a question-answering device, comprising:

[0039] a determining unit, configured to determine a first similarity between the target question and each of the segments based on a question feature of the target question and respective segment features of at least two segments of each document in the feature library;

[0040] The determining unit is further configured to determine at least one target segment from at least two segments based on each of the first similarities;

[0041] The determining unit is further configured to determine, for each target segment, a second similarity between the target question and each sub-segment based on the question feature and the sub-segment features of each sub-segment of the target segment in the feature library;

[0042] The determination unit is further configured to determine a target sub-segment from each of the sub-segments based on each of the second similarities, and determine answer information corresponding to the target question based on the target sub-segment and the target question.

[0043] 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 computer program, any one of the question-and-answer methods described above is implemented.

[0044] The present invention also provides a computer-readable storage medium on which a computer program is stored. When the computer program is executed by a processor, the question-and-answer method described above is implemented.

[0045] The present invention also provides a computer program product, comprising a computer program, wherein when the computer program is executed by a processor, the question-answering method described above is implemented.

[0046] The question-and-answer method, device and electronic device provided by the present invention utilize a first similarity between question features of a target question and fragment features of fragments in each document to determine a target fragment that is relatively similar to the overall content of the target question, and further utilize a second similarity between question features of the target question and sub-fragment features of each sub-fragment in the target fragment to determine a target sub-fragment that is relatively similar to the overall content of the target question, and then determine answer information corresponding to the target question based on the target question and the target sub-fragment, so that the answer information has a high degree of matching with the overall content of the target question, thereby improving the accuracy of the answer information. BRIEF DESCRIPTION OF THE DRAWINGS

[0047] 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.

[0048] Figure 1 is a flowchart of a question-and-answer method provided by an embodiment of the present invention;

[0049] Figure 2 is a flowchart of determining the second feature and the third feature provided by an embodiment of the present invention;

[0050] Figure 3 is a schematic diagram of a feature library provided by an embodiment of the present invention;

[0051] Figure 4 is a schematic block diagram of a question-answering method provided by an embodiment of the present invention;

[0052] Figure 5 is a schematic diagram of the structure of a question-answering device provided by an embodiment of the present invention;

[0053] Figure 6 It is a schematic diagram of the physical structure of an electronic device provided by an embodiment of the present invention. DETAILED DESCRIPTION

[0054] 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.

[0055] It should be noted that the serial numbers assigned to the objects described in the present invention, such as "first", "second", etc., are only used to distinguish the objects described and do not have any order or technical meaning.

[0056] The generative AI model, namely the AIGC model, can be applied to various types of content generation scenarios. For example, the AIGC model can be applied to the scenario of enterprise Q&A. Setting the AIGC model in the enterprise Q&A robot can answer questions related to the enterprise. Knowledge related to the enterprise is stored in the enterprise knowledge base, which is the enterprise's proprietary knowledge base. The AIGC model's own knowledge base does not contain the content in the enterprise knowledge base. Therefore, when using the AIGC model to ask and answer questions related to the enterprise, it is necessary to import the content of the enterprise knowledge base into the AIGC model in advance to obtain answer information that conforms to the enterprise knowledge content.

[0057] In the prior art, the content of the enterprise knowledge base is usually imported into the AIGC model by fine-tuning or plug-in knowledge base. Fine-tuning refers to providing the content of the enterprise knowledge base to the AIGC model through model training, and making appropriate adjustments to the AIGC model. This method requires model training for the AIGC model, and its applicability is poorer than the plug-in knowledge base method. The plug-in knowledge base means finding documents related to the question in a pre-prepared enterprise knowledge base based on the content of the question, and then inputting both the document and the question into the AIGC model, and the AIGC model answers the question. The use of the plug-in knowledge base method does not require changing the original AIGC model, has strong applicability, and is more suitable for application in enterprise question-and-answer scenarios.

[0058] However, when using an external knowledge base to conduct question and answering using the AIGC model, the knowledge content found in the enterprise knowledge base is only related to the keywords in the question. The AIGC model will generate answers for the keywords in the question and the content related to the keywords. The degree of match between the answer and the overall content of the question is low, and the answer cannot accurately answer the question. Therefore, the accuracy of the matched answer information is low and cannot meet user needs.

[0059] Based on the above problems, the question-answering method provided by the embodiment of the present invention determines the target segment based on the first similarity between the question features of the target question and the segment features of the document segment; and determines the target sub-segment based on the second similarity between the sub-segment features of the sub-segment of the target segment and the question features of the target question; and then determines the answer information corresponding to the target question based on the target sub-segment and the target question, so that the degree of matching between the answer information and the overall content of the target question is relatively high, thereby improving the accuracy of the answer information.

[0060] The question-answering method provided in the embodiment of the present invention can be applied to question-answering scenarios of various types of plug-in knowledge bases, for example, it can be applied to question-answering scenarios of enterprise question-answering robots. Figures 1 to 4 The question-answering method provided by an embodiment of the present invention is described.

[0061] Figure 1 : is a flowchart of the question-answering method provided by an embodiment of the present invention. The execution subject of the method may be an electronic device such as a mobile phone, a robot, a computer or a server, or a specially designed intelligent device, or a question-answering device set in the electronic device or intelligent device. The question-answering device may be implemented by software, hardware or a combination of the two. Figure 1 As shown, the question-answering method includes steps 110 to 140.

[0062] Step 110: Determine a first similarity between the target question and each segment based on the question feature of the target question and the segment features of at least two segments of each document in the feature library.

[0063] Specifically, the target question is a question raised during question-answering, and an answer is required for the target question. The target question can be vectorized (embedded) to obtain a question vector, which can be used to characterize the characteristics of the target question. The problem characteristics of the target question can be the question vector obtained after the target question is vectorized.

[0064] The document in the feature library can be any document that records text content. After segmenting the content of the document, at least two segments can be obtained. After vectorizing each segment, the segment vector corresponding to each segment can be obtained, that is, the segment feature. All documents in the knowledge base are segmented separately, and each segment is vectorized to obtain the segment features of each segment. All segment features are stored in the database to form a feature library.

[0065] Exemplarily, the first similarity can be used to characterize the degree of similarity between the overall content of the target question and the overall content of the segment. Based on the question features and the segment features, the similarity between the two is determined, and the first similarity between the target question and the segment can be determined. In practical applications, any similarity determination method can be used to determine the similarity between the question features and the segment features.

[0066] For example, the similarity between the question vector and the fragment vector can be determined by calculating the cosine distance between the vectors, and this similarity is the first similarity between the target question and the fragment. The similarity between the question vector and the fragment vector can also be determined by calculating the Euclidean distance, Manhattan distance or Pearson correlation coefficient between the vectors, etc., and this embodiment of the present invention is not limited to this.

[0067] Step 120: Determine at least one target segment from at least two segments based on the first similarities.

[0068] Specifically, after determining each first similarity between the target question and each segment, at least one target segment may be determined from the at least two segments based on each first similarity.

[0069] Exemplarily, in one implementation, a first similarity judgment threshold for determining the target segment is set, and a segment corresponding to the first similarity whose first similarity is greater than or equal to the first similarity judgment threshold is determined as the target segment.

[0070] In another implementation, the first similarities are sorted from high to low according to their levels, and the segments corresponding to the first M first similarities in the sorting are all determined as target segments, where M is a positive integer greater than or equal to 1, for example, M is 3.

[0071] Step 130: For each target segment, based on the question feature and the sub-segment features of each sub-segment of the target segment in the feature library, determine a second similarity between the target question and each sub-segment.

[0072] Specifically, for each segment, at least two sub-segments can be obtained after segmenting the content of the segment, and sub-segment vectors corresponding to each sub-segment can be obtained after vectorization processing of each sub-segment, that is, sub-segment features of the sub-segment. The feature library can store sub-segment features of all sub-segments.

[0073] Exemplarily, the second similarity can be used to characterize the degree of similarity between the overall content of the target question and the overall content of the sub-segment. Based on the question features and the sub-segment features of the sub-segment in the target segment, the similarity between the two is determined, and the second similarity between the target question and the sub-segment can be determined. Any similarity determination method can be used to determine the similarity between the question features and the sub-segment features. For example, the similarity between the question vector and the sub-segment vector can be determined by calculating the cosine distance between the vectors, and this similarity is the second similarity between the target question and the sub-segment. When calculating the second similarity, the same method as that for determining the first similarity can be used, or a different method from that for determining the first similarity can be used, and this is not limited in the embodiments of the present invention.

[0074] Step 140: Based on each second similarity, determine a target sub-segment from each sub-segment, and based on the target sub-segment and the target question, determine answer information corresponding to the target question.

[0075] Specifically, after determining the second similarities between the target question and the sub-segments, at least one target sub-segment may be determined from the sub-segments based on the second similarities.

[0076] Exemplarily, in one implementation, a second similarity judgment threshold for determining the target sub-segment is set, and the sub-segment corresponding to the second similarity whose second similarity is greater than or equal to the second similarity judgment threshold is determined as the target sub-segment. The second similarity judgment threshold may be equal to the first similarity judgment threshold, or may not be equal to the first similarity judgment threshold.

[0077] In another implementation, the second similarities are sorted from high to low according to their levels, and the sub-segments corresponding to the first N second similarities in the sorting are all determined as target sub-segments, where N is a positive integer greater than or equal to 1, for example, N is 3.

[0078] After the target sub-segment is determined, answer information corresponding to the target question may be determined based on the target sub-segment and the target question.

[0079] For example, the determined target sub-segment and target question are input into the AIGC model, and the AIGC model answers based on the target sub-segment and the target question, and can output answer information corresponding to the target question. When there are at least two determined target sub-segments, each target sub-segment and the target question can be used as inputs of the AIGC model, and input into the AIGC model respectively to obtain the answer information corresponding to each target sub-segment output by the AIGC model, and one answer information can be determined from the answer information of each target sub-segment as the answer information corresponding to the target question, or the answer information of each target sub-segment can be integrated to determine the answer information corresponding to the target question, or other methods are used to determine the answer information corresponding to the target question based on the answer information of each target sub-segment to determine the answer information.

[0080] The question-answering method provided by an embodiment of the present invention utilizes the first similarity between the question features of the target question and the fragment features of the fragments in each document to determine the target fragment that is relatively similar to the overall content of the target question, and further utilizes the second similarity between the question features of the target question and the sub-fragment features of each sub-fragment in the target fragment to determine the target sub-fragment that is relatively similar to the overall content of the target question, and then determines the answer information corresponding to the target question based on the target question and the target sub-fragment, so that the answer information has a high degree of matching with the overall content of the target question, thereby improving the accuracy of the answer information.

[0081] Exemplarily, the first similarity may represent the similarity between the target question and each segment. In order to make the first similarity more accurately reflect the similarity between the two, the first similarity may be determined based on the first feature corresponding to the target question and the second feature corresponding to each segment.

[0082] In one embodiment, based on the question feature of the target question and the segment features of at least two segments of each document in the feature library, determining the first similarity between the target question and each segment can be achieved in the following manner:

[0083] Based on the key information in the target question, the dimensional characteristics of the target question are determined; based on the question characteristics and the dimensional characteristics, the first feature corresponding to the target question is determined; based on the first feature and the second feature corresponding to each fragment in the feature library, the first similarity is determined, and the second feature includes the fragment feature of the fragment and the document feature of the document to which the fragment belongs.

[0084] Specifically, multiple dimensions can be established for each document in the feature library, and each document can be classified in multiple dimensions based on the established dimensions. Using vectors to represent the dimension values ​​of each dimension can realize vectorization processing of documents based on the established dimensions to obtain document dimension vectors, that is, document features of the document.

[0085] The key information in the target question may be key information that reflects the specific content of the target question. For example, the key information may be information such as the product name, product category, product subcategory, or keywords in the target question. By using multiple dimensions established for each document, the target question can be analyzed in multiple dimensions, and the key information in the target question can be represented by the dimension value of each dimension. Furthermore, by using a vector to represent the dimension value of each dimension, the target question can be vectorized based on the established dimensions to obtain the problem dimension vector of the target question, that is, the dimensional feature of the target question.

[0086] After determining the dimensional features of the target problem, the first feature corresponding to the target problem can be determined based on the problem features and the dimensional features of the target problem. For example, the first feature can be obtained by fusion of the problem features and the dimensional features.

[0087] In addition, the second feature corresponding to each segment in the feature library is determined based on the segment feature of the segment and the document feature of the document to which the segment belongs after the document feature of the document is determined. For example, the second feature can be obtained by fusion of the segment feature of the segment and the document feature of the document to which the segment belongs.

[0088] For example, for each document in the enterprise knowledge base, five dimensions can be established, namely dimension 1 to dimension 5. Among them, dimension 1 is the product line dimension, dimension 2 is the product category dimension, dimension 3 is the product subcategory dimension, dimension 4 is the document type dimension, and dimension 5 is the keyword dimension. According to the magnitude of the dimension value under each dimension, a one-dimensional vector or an n-dimensional vector can be used to realize vectorization representation of each dimension. An n-dimensional vector is an ordered array composed of n numbers, such as (a1, a2, ..., a n ).

[0089] Dimension 1, the product line dimension, has fewer dimensional values, so a one-dimensional vector can be used to represent the dimensional value of the product line dimension. Dimension 2, the product category dimension, can also be represented by a one-dimensional vector. Dimension 3, the product subcategory dimension, can be represented by a two-dimensional vector. Dimension 4, the document type dimension, can also be represented by a one-dimensional vector. Dimension 5, the keyword dimension, has more dimensional values, so a five-dimensional vector can be used to represent the dimensional value of the keyword dimension. After fusing the dimensional values ​​under the above five dimensions, a ten-dimensional vector can be obtained, which is the document feature of the document. It should be understood that each document in the enterprise knowledge base can have its corresponding ten-dimensional vector to represent the document features of each document.

[0090] After segmenting the document, we can get the fragments corresponding to the document. After vectorizing each fragment, we can get the fragment features corresponding to each fragment. Taking the openai vector conversion model as an example, by inputting the fragment into the openai vector conversion model, we can get the 1536-dimensional fragment features corresponding to the fragment. After vectorizing the document to which the fragment belongs based on the dimensions of each document, we can get the 10-dimensional document features. By fusing the 1536-dimensional fragment features with the 10-dimensional document features, we can get the 1546-dimensional second features corresponding to the fragment. Perform the above processing on all the fragments in the feature library to get the second features corresponding to each fragment.

[0091] For the target question, based on the five dimensions established for the document, the key information in the target question is analyzed to determine the dimensional features of the target question. The dimensional features of the target question can be 10-dimensional dimensional features. The target question is input into the openai vector conversion model to obtain a 1536-dimensional question feature corresponding to the target question. The 1536-dimensional question feature is fused with the 10-dimensional dimensional feature to obtain a 1546-dimensional first feature corresponding to the target question.

[0092] Based on the first feature and the second feature corresponding to each fragment in the feature library, each first similarity can be determined. Exemplarily, the similarity between the first feature corresponding to the target problem and the second feature corresponding to the fragment can be calculated, and the similarity is the first similarity. For example, the cosine distance between the first vector after the first feature is vectorized and the second vector after the second feature is vectorized is calculated, and the cosine distance can be determined as the first similarity.

[0093] In this embodiment, based on the question features and dimensional features of the target question, the first feature corresponding to the target question can be determined. The dimension of the first feature is higher than the dimension of the question feature, so the granularity is smaller, and it can more accurately reflect the characteristics of the overall content of the target question; similarly, the second feature includes the fragment feature of the fragment and the document feature of the document to which the fragment belongs. The dimension of the second feature is higher than the dimension of the fragment feature, so the granularity is smaller, and it can more accurately reflect the characteristics of the overall content of the fragment. The first similarity determined based on the first feature and the second feature can more accurately reflect the similarity between the target question and the fragment, thereby improving the accuracy of the question and answer.

[0094] In practical applications, the key information in the target question is the information that reflects the substantive content of the target question. The key information has a great impact on the accuracy of the question and answer. Therefore, in order to improve the accuracy of the first similarity and thus improve the accuracy of the question and answer method, the first similarity can be determined based on the weights of the dimensional features, the preset weights of the question features, the first feature and the second feature.

[0095] In one embodiment, determining the first similarity based on the first feature and the second feature corresponding to each segment in the feature library can be implemented in the following manner:

[0096] Based on the matching degree between the key information in the target question and the dimensional information of each document, the credibility of the dimensional feature is determined; based on the credibility and the preset importance of the dimensional information, the weight of the dimensional feature is determined; based on the weight of the dimensional feature, the preset weight of the question feature, the first feature and the second feature, the first similarity is determined.

[0097] Specifically, the dimension information of each document may be the dimension set for each document and the dimension value under each dimension, such as product line, product category, product subcategory, document type, and keyword. The credibility of the dimensional feature of the target question can be used to characterize the degree of match between the key information in the target question and each dimension and each dimensional value. By determining the degree of match between the key information in the target question and the dimensional information, the credibility of the dimensional feature of the target question can be determined, and each credibility corresponds to the corresponding dimensional information.

[0098] Optionally, the credibility can be represented by a numerical value within any numerical range. For example, the credibility can take any numerical value between 0 and 100. The higher the degree of match between the key information in the target question and the dimensional information of the document, the greater the value of the credibility within the numerical range. For example, the credibility ranges from 0 to 100. When the credibility is 0, it indicates that the key information in the target question has the lowest degree of match between the dimensional information of the document, which can be understood as the key information and the dimensional information do not match or are completely different; when the credibility is 100, it indicates that the key information in the target question has the highest degree of match between the dimensional information of the document, which can be understood as the key information and the dimensional information match completely or are completely the same.

[0099] The preset importance of the dimension information may be a preset value used to characterize the importance of the dimension information. For each dimension information of each document, a preset importance corresponding to each dimension information is set, and the importance of different dimension information in the weight of the dimension feature can be distinguished by using the preset importance. The preset importance can be set to a value within any numerical range.

[0100] Optionally, the preset importance of the dimension information can take any value between 0 and 1. The preset importance of each dimension can be preset according to the importance of each dimension. For example, the dimension information includes product line dimension, product category dimension, product subcategory dimension, document type dimension and keyword dimension. According to the importance of each dimension, the preset importance of the product line dimension is set to 0.1, the preset importance of the product category dimension is set to 0.1, the preset importance of the product subcategory dimension is set to 0.2, the preset importance of the document type dimension is set to 0.1, and the preset importance of the keyword dimension is set to 0.5.

[0101] Based on the credibility and the preset importance of the dimension information, the weight of the dimension feature is determined. For example, the preset importance of each dimension information may be multiplied by the credibility corresponding to each dimension information, and the product of the two may be used as the weight of the dimension feature. For another example, the preset importance of each dimension information and the credibility corresponding to each dimension information may be added, and the sum of the two may be used as the weight of the dimension feature. Alternatively, the weight of the dimension feature may be determined in other ways.

[0102] The preset weight of the problem feature can be a preset weight value for the problem feature of the target problem. The preset weight of the problem feature can be set to any value. For example, if the preset weight of the problem feature is set to 1, then in the 1536-dimensional problem vector, the preset weight of each vector element is 1.

[0103] Exemplarily, after determining the weight of the dimensional feature, based on the weight of the dimensional feature, the preset weight of the problem feature, the first feature and the second feature, the cosine distance between the first vector and the second vector can be calculated using formula (1) shown below, and the calculated cosine distance is determined as the first similarity.

[0104]

[0105] Among them, A i represents the i-th element in the first vector; B i represents the i-th element in the second vector; W i represents the weight corresponding to the i-th element, which is the preset weight of the problem feature or the weight of the dimension feature and can be determined based on the i-th element; d n Represents the cosine distance between the first and second vectors.

[0106] In this embodiment, the credibility of the dimensional feature is determined, and the weight of the dimensional feature can be determined based on the credibility and the preset importance of the dimensional information. The first similarity is determined by combining the matching degree between the key information in the target question and the dimensional information of each document and the preset importance that characterizes the importance of each dimensional information. Furthermore, the first similarity determined based on the weight of the dimensional feature takes into account the impact of the key information of the target question on the accuracy of the question and answer, which can improve the accuracy of the question.

[0107] Exemplarily, after determining the second similarity between the target question and each sub-segment, the target sub-segment can also be determined based on the third similarity between the sub-segment features of the previous sub-segment and the question features, and the fourth similarity between the sub-segment features of the next sub-segment and the question features, so as to improve the matching degree between the overall content of the target sub-segment and the overall content of the target question, thereby improving the accuracy of the question and answer.

[0108] In one embodiment, determining the target sub-segment from each sub-segment based on each second similarity can be achieved in the following manner:

[0109] A sub-segment list is determined in descending order of the second similarities, wherein the sub-segment list includes sub-segments corresponding to the first preset number of second similarities; the sub-segment list is traversed starting from the sub-segment corresponding to the highest second similarity, and based on the order of the sub-segments contained in the document to which the currently traversed sub-segment belongs, a third similarity between the sub-segment feature of the previous sub-segment and the problem feature, and a fourth similarity between the sub-segment feature of the next sub-segment and the problem feature are determined, wherein the previous sub-segment is the previous sub-segment of the currently traversed sub-segment, and the next sub-segment is the next sub-segment of the currently traversed sub-segment; based on the third similarity and the fourth similarity, a target sub-segment is determined from each sub-segment.

[0110] Specifically, after sorting in descending order according to the second similarities, the sub-segments corresponding to the first preset number of second similarities are selected and stored in the sub-segment list, wherein the preset number can be any number pre-set according to actual needs or actual experience, for example, the preset number can be 3, 6 or 9, etc.

[0111] Optionally, the sub-segments corresponding to the first preset number of second similarities included in the sub-segment list may also be obtained by first screening from multiple second similarities and then sorting the remaining second similarities. Specifically, according to the highest second similarity, the similarity obtained by multiplying the highest second similarity by the first preset ratio is used as the reference second similarity, and the sub-segments corresponding to the second similarities less than the reference second similarity are removed, and the sub-segments corresponding to the second similarities greater than or equal to the reference second similarity are retained in the sub-segment list, so as to achieve the purpose of determining the sub-segments in the sub-segment list according to the first preset ratio, thereby enhancing the applicability of the method. The first preset ratio may be any ratio value preset for the number of sub-segments in the sub-segment list, for example, the first preset ratio may be 20%, 50% or 80%, etc.

[0112] Exemplarily, after the content of a document is segmented, each fragment corresponding to the document is formed, and the order between each fragment can be determined according to the order of the content of the document. For example, when the document is segmented, the subordinate relationship between the fragment and the document is recorded, and the order between each fragment is recorded. Similarly, after the content of a fragment is segmented, each sub-fragment corresponding to the fragment can be formed, and the order between each sub-fragment can be determined according to the order of the content of the fragment. For example, when the fragment is segmented, the subordinate relationship between the sub-fragments is recorded, and the order between each sub-fragment is recorded. The previous sub-fragment and the next sub-fragment both use the currently traversed sub-fragment as a reference sub-fragment. According to the order of the content of the document, the previous sub-fragment adjacent to the currently traversed sub-fragment is the previous sub-fragment, and the next sub-fragment adjacent to the currently traversed sub-fragment is the next sub-fragment.

[0113] The third similarity may be the similarity between the sub-segment feature used to characterize the previous sub-segment and the question feature, and the fourth similarity may be the similarity between the sub-segment feature used to characterize the next sub-segment and the question feature. It should be understood that the third similarity and the fourth similarity are relative concepts set for sub-segments at different positions in the document, and both the third similarity and the fourth similarity can be obtained from the determined target question and the second similarity between each sub-segment.

[0114] After determining the third similarity between the sub-segment feature of the previous sub-segment and the problem feature, and the fourth similarity between the sub-segment feature of the next sub-segment and the problem feature, the third similarity and the fourth similarity are compared, and a target sub-segment is determined from each sub-segment according to the comparison result.

[0115] In one embodiment, determining a target sub-segment from each sub-segment based on the third similarity and the fourth similarity may include: when the third similarity is greater than the fourth similarity, determining the target sub-segment based on the currently traversed sub-segment and the previous sub-segment; when the fourth similarity is greater than the third similarity, determining the target sub-segment based on the currently traversed sub-segment and the next sub-segment.

[0116] Exemplarily, the third similarity and the fourth similarity are compared. When the third similarity is greater than the fourth similarity, the target sub-segment is determined based on the currently traversed sub-segment and the previous sub-segment. For example, the currently traversed sub-segment and the previous sub-segment may both be determined as the target sub-segment; or, the currently traversed sub-segment, the previous sub-segment, and the sub-segment before the previous sub-segment may all be determined as the target sub-segment.

[0117] The third similarity is compared with the fourth similarity. When the fourth similarity is greater than the third similarity, the target sub-segment is determined based on the currently traversed sub-segment and the next sub-segment. For example, the currently traversed sub-segment and the next sub-segment may both be determined as the target sub-segment; or, the currently traversed sub-segment, the next sub-segment, and the sub-segment after the next sub-segment may all be determined as the target sub-segment.

[0118] For example, in general, the AIGC model has an upper limit on the character length of the input content. When the target sub-segment and the target question are input into the AIGC model to determine the answer information corresponding to the target question, the character length of the input AIGC model needs to be considered. In this embodiment, the number or length of the input target sub-segments can be determined according to the limit on the input character length of the AIGC model.

[0119] When the third similarity is greater than the fourth similarity, the sub-segment currently traversed and the sub-segments before the sub-segment are input as target sub-segments into the AIGC model without exceeding the upper limit of the input character length. It can be understood that as many target sub-segments with higher second similarity as possible are input into the AIGC model without exceeding the upper limit of the input character length, and the character length of the target problem should also be taken into consideration.

[0120] When the fourth similarity is greater than the third similarity, the sub-segment currently traversed and each sub-segment after the sub-segment are input as target sub-segments into the AIGC model without exceeding the upper limit of the input character length. It can be understood that as many target sub-segments with a higher second similarity as possible are input into the AIGC model without exceeding the upper limit of the input character length, and the character length of the target problem should also be taken into account.

[0121] In order to improve the stability of the operation of the AIGC model, the input content character length margin can be set based on the second preset ratio, wherein the second preset ratio can be any ratio value preset for the input character length, for example, the second preset ratio can be 70%, 75%, 80% or 90%, etc. It can be understood that, according to the upper limit value of the AIGC model input character length, the value obtained by multiplying the upper limit value by the second preset ratio is used as the reference upper limit value, and when determining the target sub-segment, the character length value obtained by subtracting the character length of the target question from the reference upper limit value is used as the upper limit value of the sum of the characters of each target sub-segment. For example, the character length of 75% of the upper limit of the AIGC model input character length is used as the upper limit value of the sum of the characters of the target question and the target sub-segment. Within this upper limit value, the target question and each target sub-segment are input to the AIGC model to obtain the answer information output by the AIGC model.

[0122] In this embodiment, based on each sub-segment in the sub-segment list and the order of each sub-segment in the document to which each sub-segment belongs, target sub-segments with higher accuracy can be determined; further, when the third similarity is greater than the fourth similarity, or when the fourth similarity is greater than the third similarity, the current traversed sub-segment can be expanded to the previous sub-segment or the next sub-segment in the document order to obtain target sub-segments with higher second similarity, which can further improve the correlation between the determined target sub-segments and the overall content of the target question, and can improve the accuracy of question and answer.

[0123] Exemplarily, by traversing each sub-segment starting from the sub-segment corresponding to the second highest similarity in the sub-segment list, multiple target sub-segments corresponding to each sub-segment can be obtained, and each sub-segment in the sub-segment list is used as a splicing basis, and the target sub-segments corresponding to each sub-segment in the sub-segment list are spliced ​​into their respective corresponding related content segments, so that the number of related content segments equal to the number of sub-segments in the sub-segment list can be obtained. Among them, splicing can be understood as splicing the content of the currently traversed sub-segment and the sub-segments before or after the sub-segment according to the content order in the document, and splicing them into a complete related content segment.

[0124] When inputting the AIGC model, the relevant content segment corresponding to the sub-segment with the second highest similarity in the sub-segment list and the target question can be first input into the AIGC model to obtain the first answer information; then the first answer information, the relevant content segment corresponding to the sub-segment with the second highest similarity, and the target question can be input into the AIGC model to obtain the second answer information; and so on, each relevant content segment is input into the AIGC model in turn to iterate the answer information to obtain more accurate answer information, and the answer information is returned to the user.

[0125] By dividing each target sub-segment into related content segments, and taking the related content segments, previous answer information, and target questions as input to the AIGC model in batches, iterative question and answering can be performed and the answer information can be updated to further improve the accuracy of question and answering.

[0126] Exemplarily, the second similarity may represent the similarity between the target question and the sub-segments. In order to make the second similarity more accurately reflect the similarity between the two, the second similarity may be determined based on the first feature corresponding to the target question and the third feature corresponding to each sub-segment.

[0127] In one embodiment, based on the question feature and the features of each sub-segment of each sub-segment of the target segment in the feature library, determining the second similarity between the target question and each sub-segment can be achieved in the following manner:

[0128] The second similarity is determined based on the first feature and the third feature corresponding to each sub-segment in the feature library, where the third feature includes the sub-segment feature of the sub-segment and the document feature of the document to which the sub-segment belongs.

[0129] Exemplarily, the document feature of the document to which the sub-segment belongs, that is, the document feature of the document corresponding to the sub-segment, may be, for example, a document dimension vector. The third feature may be obtained by fusing the sub-segment feature of the sub-segment and the document feature of the document to which the sub-segment belongs.

[0130] Specifically, after determining the document feature of the document, the third feature of the sub-segment can be determined based on the sub-segment feature of the sub-segment and the document feature of the document to which the sub-segment belongs. For example, the third feature can be obtained by merging the sub-segment feature of the sub-segment and the document feature of the document to which the sub-segment belongs.

[0131] Taking a document feature with 10 dimensions as an example, after segmenting the fragment, each sub-fragment corresponding to the fragment can be obtained, and each sub-fragment can be vectorized to obtain the sub-fragment features corresponding to each sub-fragment. Taking the openai vector conversion model as an example, the sub-fragment is input into the openai vector conversion model to obtain the 1536-dimensional sub-fragment feature corresponding to the sub-fragment. The document feature of the document to which the sub-fragment belongs is fused with the 1536-dimensional sub-fragment feature to obtain a 1546-dimensional third feature corresponding to the sub-fragment, which can be a third vector. The above processing is performed on all sub-fragments in the feature library to obtain the third feature corresponding to each sub-fragment.

[0132] The second similarity is determined based on the first feature and the third feature corresponding to each sub-segment in the feature library. For example, the cosine distance between the first vector corresponding to the target problem and the third vector corresponding to the sub-segment is calculated, and the cosine distance can be determined as the second similarity. The second similarity can be determined based on the first feature and the third feature, and can also be determined by other similarity algorithms between features, which is not limited in the embodiment of the present invention.

[0133] In this embodiment, the third feature includes the sub-segment feature of the sub-segment and the document feature of the document to which the sub-segment belongs. The dimension of the third feature is higher than that of the sub-segment feature, so the granularity is smaller and it can more accurately reflect the features of the overall content of the sub-segment. The second similarity determined based on the first feature and the third feature can more accurately reflect the similarity between the target question and the sub-segment, thereby improving the accuracy of the question and answer.

[0134] Exemplarily, when segmenting based on a document or a fragment, in order to make the content of each fragment or each sub-fragment more coherent and reasonable, segmentation can be implemented by using a preset length and a preset identifier.

[0135] In one embodiment, the method of the present invention also includes: acquiring at least one document; for each document, segmenting the document based on a first preset length and a preset fragment identifier to obtain at least two fragments; for each fragment, segmenting the fragment based on a second preset length and a preset sub-fragment identifier to obtain at least two sub-fragments; storing the fragment features of each fragment and the sub-fragment features of each sub-fragment in a feature library.

[0136] Specifically, the first preset length may be a segment length preset according to factors such as the length of the document content, a segment storage requirement, or a segment feature extraction requirement. For example, the first preset length may be set to 500 characters, 1024 characters, or 2048 characters. The preset segment identifier may be a segment segment identifier preset according to factors such as the content feature of the document or a segmentation requirement. For example, the preset segment identifier may be set to a punctuation mark, a space character, or a line break character.

[0137] For example, the first preset length is set to 1024 characters, and the preset segment identifier is set to the sentence-end punctuation mark. A document is obtained from the knowledge base, and 1024 characters are used as the upper limit of the character length of the segment. The document is segmented according to the position of the sentence-end punctuation mark, and at least two segments corresponding to the document can be obtained.

[0138] Exemplarily, the second preset length may be a segment length preset according to factors such as the length of the segment content, a sub-segment storage requirement, or a sub-segment feature extraction requirement. For example, the second preset length may be set to 128 characters or 200 characters. The preset sub-segment identifier may be a sub-segment segment identifier preset according to factors such as the content feature of the segment or the segmentation requirement. For example, the preset sub-segment identifier may be set to a punctuation mark, a space character, or a line break character.

[0139] For example, the second preset length is set to 128 characters, and the preset sub-segment identifier is set to the sentence-end punctuation mark. A segment is obtained, 128 characters are used as the upper limit of the character length of the sub-segment, and the segment is segmented according to the position of the sentence-end punctuation mark, so that at least two sub-segments corresponding to the segment can be obtained.

[0140] After the segments and the sub-segments of each segment are determined, the segment features of each segment and the sub-segment features of each sub-segment are extracted, and the extracted segment features and sub-segment features are stored in the feature library.

[0141] In this embodiment, based on the first preset length and the preset segment identifier, the document is segmented to obtain segments with a relatively suitable character length, and the coherence of the segment content can be improved. Based on the second preset length and the preset sub-segment identifier, the segment is segmented to obtain sub-segments with a relatively suitable character length, and the coherence of the sub-segment content can be improved.

[0142] Exemplarily, after the document or fragment is segmented, the document feature of the document can be determined based on the dimensional information of the document, and the second feature and the third feature can be determined using the document feature. The determined second feature and the third feature are stored in the feature library, so that the second feature and the third feature can be used when answering questions, which can improve the efficiency of answering questions.

[0143] In one embodiment, the method of the present invention also includes: for each document, determining the document features of the document based on the dimensional information of the document; determining the second features corresponding to each fragment based on the document features of the document and the fragment features of each fragment in the document; determining the third features corresponding to each sub-fragment based on the document features of the document and the sub-fragment features corresponding to the sub-fragments of each fragment in the document; and storing the second features corresponding to each fragment and the third features corresponding to each sub-fragment in a feature library.

[0144] Specifically, for each document, a document dimension is established, and based on the document dimension information, the document feature of the document can be determined.

[0145] For example, in the scenario of enterprise question and answer, five dimensions including product line dimension, product category dimension, product subcategory dimension, document type dimension and keyword dimension are established according to the actual situation of the enterprise and the content of each document. When uploading a document to the enterprise knowledge base, it is necessary to determine the dimension information of each dimension under the five dimensions according to the specific content of the document. For example, when uploading, it is necessary to determine the name of the product line to which the product recorded in the document belongs, the name of the product category to which the product belongs, the name of the product subcategory to which the product belongs, the name of the document type to which the document belongs, and the keywords contained in the document. The specific information under the above dimensions is the dimension information of the document, and the document features of the document can be determined based on the dimension information. The document features can be vectorized to obtain a document dimension vector.

[0146] Figure 2 is a flowchart of determining the second feature and the third feature provided by an embodiment of the present invention, such as Figure 2 As shown, the document features of the document can be determined based on the document. By segmenting the document, the fragments corresponding to the document can be obtained; by segmenting the fragments, the sub-fragments corresponding to the fragments can be obtained. By extracting features from each fragment, the fragment features corresponding to each fragment can be obtained; by extracting features from each sub-fragment, the sub-fragment features corresponding to each sub-fragment can be obtained. By fusing the fragment features corresponding to each fragment with the document features of the document to which it belongs, the second features corresponding to each fragment can be determined; by fusing the sub-fragment features corresponding to each sub-fragment with the document features of the document to which it belongs, the third features corresponding to each sub-fragment can be determined.

[0147] After determining each second feature corresponding to each segment and each third feature corresponding to each sub-segment, each second feature and each third feature are stored in a feature library, so as to implement a question-answering method based on the feature library.

[0148] Figure 3 is a schematic diagram of a feature library provided by an embodiment of the present invention, such as Figure 3 As shown, the feature library stores document features of each document, segment features of each segment corresponding to each document, and sub-segment features of each sub-segment corresponding to each segment. Exemplarily, the feature library stores the second feature corresponding to each segment and the third feature corresponding to each sub-segment.

[0149] Take the knowledge base containing 10,000 documents as an example, and build a feature library based on this knowledge base. Figure 3As shown in the figure, five dimensions are established for the ten thousand documents in the knowledge base. The product line dimension is represented by a one-dimensional vector, the product category dimension is represented by a one-dimensional vector, the product subcategory dimension is represented by a two-dimensional vector, the document type dimension is represented by a one-dimensional vector, and the keyword dimension is represented by a five-dimensional vector. Then the document feature of the document can be represented by a ten-dimensional vector. For example, the document dimension vector of the document is represented by a ten-dimensional vector (1, 2, 3, 4, 5, 6, 7, 8, 9, 10), and the document dimension vector can represent the document feature of the document. Then the ten thousand document dimension vectors in the feature library correspond to the ten thousand documents in the knowledge base.

[0150] Segment each document to get the corresponding fragments. For example, if each document is divided into five fragments, 50,000 fragments can be obtained. Extract the fragment features of each fragment. For example, using the OpenAI vector conversion model, a 1536-dimensional fragment vector can be obtained. The fragment vector can be (a1, a2, a3, ..., a 1536 ). By fusing the segment vector with the document dimension vector of the document corresponding to the segment, a 1546-dimensional second vector can be obtained. The second vector is the second feature corresponding to the segment. For example, the second vector can be (a1, a2, a3, ..., a 1546 ). The second vector is stored in a feature library, and a total of 50,000 second vectors are stored in the feature library.

[0151] Each segment is segmented to obtain the corresponding sub-segments of each segment. For example, if each segment is divided into eight sub-segments, 400,000 sub-segments can be obtained. The sub-segment features of each sub-segment can be extracted. For example, the 1536-dimensional sub-segment vector can be obtained by using the OpenAI vector conversion model. The sub-segment vector can be (b1, b2, b3, ..., b 1536 ). By fusing the sub-segment vector with the document dimension vector of the document corresponding to the sub-segment, a 1546-dimensional third vector can be obtained. The third vector is the third feature corresponding to the sub-segment. The third vector can be, for example, (b1, b2, b3, ..., b 1546 ). The third vector is stored in a feature library, and a total of 400,000 third vectors are stored in the feature library.

[0152] After establishing a feature library based on each document, you can then ask and answer the target questions. Figure 4 is a schematic block diagram of a question-answering method provided by an embodiment of the present invention, such as Figure 4As shown, problem features are extracted based on the target problem, dimensional features are determined based on key information in the target problem, and feature fusion is performed based on the problem features and the dimensional features to obtain a first feature corresponding to the target problem. For example, a 1546-dimensional first feature can be obtained based on the target problem. Based on the second feature stored in the feature library and the first feature of the target problem, the degree of similarity between the two is determined, and a first similarity can be determined.

[0153] For example, if the target question is "How many facial access control systems does egs531 support?", we can get the product line dimension information as smart channel, the product category dimension information as egs, the product category dimension information as egs531, the document type dimension information as specification, and the keyword dimension information as egs and facial access control. If the credibility is 100, the weight corresponding to the first 1536-dimensional elements in the first vector is 1, and the weight corresponding to the last 10-dimensional elements in the first vector is adjusted to 100 according to the credibility. Then, the cosine distance between the first vector and the second vector can be calculated using the aforementioned formula (1), and the first similarity between the first feature and the second feature can be obtained. The details are as follows:

[0154]

[0155] Among them, A i represents the i-th element in the first vector; B i represents the i-th element in the second vector; d n Represents the cosine distance between the first and second vectors.

[0156] After determining the first similarity between the target question and each fragment, determine the highest three first similarities among each first similarity. Based on each fragment corresponding to the three highest first similarities, calculate the second similarity between the target question and each sub-fragment corresponding to each fragment. In the sub-fragment corresponding to each fragment, determine the sub-fragment corresponding to the three highest second similarities as the sub-fragment in the sub-fragment list, and then obtain a sub-fragment list consisting of nine sub-fragments. By traversing each sub-fragment in the sub-fragment list, the relevant content segment corresponding to each sub-fragment can be determined. By inputting the relevant content segment and the target question into the AIGC model, the answer information corresponding to the target question can be obtained. Return the answer information to the user. The specific implementation process and technical effects can refer to the description in the aforementioned embodiments, which will not be repeated here.

[0157] The question-answering device provided by the present invention is described below. The question-answering device described below and the question-answering method described above can be referenced to each other.

[0158] Figure 5 is a schematic diagram of the structure of the question-answering device provided by an embodiment of the present invention, referring to Figure 5 As shown, the question-answering device comprises:

[0159] A determining unit 510, configured to determine a first similarity between the target question and each segment based on a question feature of the target question and segment features of at least two segments of each document in the feature library;

[0160] The determining unit 510 is further configured to determine at least one target segment from the at least two segments based on the first similarities;

[0161] The determining unit 510 is further configured to determine, for each target segment, a second similarity between the target question and each sub-segment based on the question feature and the sub-segment features of each sub-segment of the target segment in the feature library;

[0162] The determination unit 510 is further configured to determine a target sub-segment from each sub-segment based on each second similarity, and determine answer information corresponding to the target question based on the target sub-segment and the target question.

[0163] In an exemplary embodiment, the determining unit 510 is specifically configured to:

[0164] Determine the dimensional characteristics of the target problem based on the key information in the target problem;

[0165] Based on the problem features and dimension features, determine the first feature corresponding to the target problem;

[0166] A first similarity is determined based on the first feature and second features corresponding to each segment in the feature library, where the second feature includes a segment feature of the segment and a document feature of the document to which the segment belongs.

[0167] In an exemplary embodiment, the determining unit 510 is specifically configured to:

[0168] Determine the credibility of the dimensional features based on the matching degree between the key information in the target question and the dimensional information of each document;

[0169] Determine the weight of the dimension features based on the credibility and the preset importance of the dimension information;

[0170] A first similarity is determined based on the weight of the dimensional feature, the preset weight of the question feature, the first feature, and the second feature.

[0171] In an exemplary embodiment, the determining unit 510 is specifically configured to:

[0172] Determine a sub-segment list according to the order of the second similarities from high to low, wherein the sub-segment list includes sub-segments corresponding to the first preset number of second similarities;

[0173] Traversing the sub-segment list starting from the sub-segment corresponding to the highest second similarity, determining the third similarity between the sub-segment feature of the previous sub-segment and the problem feature, and the fourth similarity between the sub-segment feature of the next sub-segment and the problem feature based on the order of the sub-segments contained in the document to which the currently traversed sub-segment belongs, wherein the previous sub-segment is the previous sub-segment of the currently traversed sub-segment, and the next sub-segment is the next sub-segment of the currently traversed sub-segment;

[0174] Based on the third similarity and the fourth similarity, a target sub-segment is determined from among the sub-segments.

[0175] In an exemplary embodiment, the determining unit 510 is specifically configured to:

[0176] When the third similarity is greater than the fourth similarity, determining a target sub-segment based on the currently traversed sub-segment and the previous sub-segment;

[0177] When the fourth similarity is greater than the third similarity, a target sub-segment is determined based on the currently traversed sub-segment and the next sub-segment.

[0178] In an exemplary embodiment, the determining unit 510 is specifically configured to:

[0179] The second similarity is determined based on the first feature and the third feature corresponding to each sub-segment in the feature library, where the third feature includes the sub-segment feature of the sub-segment and the document feature of the document to which the sub-segment belongs.

[0180] In an exemplary embodiment, the question-answering device further comprises:

[0181] An acquisition unit, configured to acquire at least one document;

[0182] A segmentation unit, configured to segment each document based on a first preset length and a preset segment identifier to obtain at least two segments;

[0183] The segmentation unit is further configured to segment each segment based on a second preset length and a preset sub-segment identifier to obtain at least two sub-segments;

[0184] The storage unit is used to store the segment features of each segment and the sub-segment features of each sub-segment in a feature library.

[0185] In an exemplary embodiment, the determining unit 510 is further configured to determine, for each document, a document feature of the document based on the dimension information of the document;

[0186] The determining unit 510 is further configured to determine a second feature corresponding to each segment based on the document feature of the document and the segment feature of each segment in the document;

[0187] The determining unit 510 is further configured to determine a third feature corresponding to each sub-segment based on the document feature of the document and the sub-segment feature corresponding to the sub-segment of each segment in the document;

[0188] The storage unit is further used to store the second feature corresponding to each segment and the third feature corresponding to each sub-segment in the feature library.

[0189] The device of this embodiment can be used to execute the method of any embodiment in the question-and-answer method side embodiment. Its specific implementation process and technical effects are similar to those in the question-and-answer method side embodiment. For details, please refer to the detailed introduction in the question-and-answer method side embodiment, which will not be repeated here.

[0190] Figure 6 is a schematic diagram of the physical structure of an electronic device provided by an embodiment of the present invention, such as Figure 6 As shown, the electronic device may include: a processor 610, a communication interface 620, a memory 630 and a communication bus 640, wherein the processor 610, the communication interface 620 and the memory 630 communicate with each other through the communication bus 640. The processor 610 may call the logic instructions in the memory 630 to execute the above-mentioned question-answering method, which includes: determining a first similarity between the target question and each segment based on the question feature of the target question and the segment features of at least two segments of each document in the feature library; determining at least one target segment from the at least two segments based on each first similarity; determining a second similarity between the target question and each sub-segment based on the question feature and the sub-segment features of each sub-segment of the target segment in the feature library for each target segment; determining a target sub-segment from each sub-segment based on each second similarity, and determining answer information corresponding to the target question based on the target sub-segment and the target question.

[0191] In addition, the logic instructions in the above-mentioned memory 630 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 and other media that can store program codes.

[0192] On the other hand, the present invention also provides a computer program product, which includes a computer program, which can be stored on a computer-readable storage medium. When the computer program is executed by a processor, the computer can execute the above-mentioned question-answering method, which includes: determining a first similarity between the target question and each fragment based on the question feature of the target question and the fragment features of at least two fragments of each document in the feature library; determining at least one target fragment from the at least two fragments based on each first similarity; determining, for each target fragment, a second similarity between the target question and each sub-fragment based on the question feature and the sub-fragment features of each sub-fragment of the target fragment in the feature library; determining a target sub-fragment from each sub-fragment based on each second similarity, and determining answer information corresponding to the target question based on the target sub-segment and the target question.

[0193] On the other hand, the present invention also provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, is implemented to execute the question-answering method provided by the above-mentioned methods, the method comprising: determining a first similarity between the target question and each fragment based on question features of the target question and fragment features of at least two fragments of each document in a feature library; determining at least one target fragment from at least two fragments based on each first similarity; determining, for each target fragment, a second similarity between the target question and each sub-fragment based on question features and sub-fragment features of each sub-fragment of the target fragment in the feature library; determining a target sub-fragment from each sub-fragment based on each second similarity, and determining answer information corresponding to the target question based on the target sub-fragment and the target question.

[0194] 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.

[0195] 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, it 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.

[0196] 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 question-answering method, characterized in that: include: Determine a first similarity between the target question and each of the segments based on a question feature of the target question and segment features of at least two segments of each document in the feature library; Based on each of the first similarities, determining at least one target segment from at least two segments; For each target segment, based on the question feature and the sub-segment features of each sub-segment of the target segment in the feature library, determine a second similarity between the target question and each sub-segment; Based on each of the second similarities, a target sub-segment is determined from each of the sub-segments, and based on the target sub-segment and the target question, answer information corresponding to the target question is determined.

2. The question-answering method according to claim 1, characterized in that: The determining, based on the question feature of the target question and the segment features of at least two segments of each document in the feature library, a first similarity between the target question and each of the segments comprises: Based on the key information in the target problem, determining the dimensional characteristics of the target problem; Based on the problem feature and the dimension feature, determining a first feature corresponding to the target problem; The first similarity is determined based on the first feature and second features corresponding to each segment in the feature library, where the second features include segment features of the segment and document features of the document to which the segment belongs.

3. The question-answering method according to claim 2, characterized in that: The determining the first similarity based on the first feature and the second feature corresponding to each fragment in the feature library includes: Determining the credibility of the dimensional features based on the matching degree between the key information in the target question and the dimensional information of each of the documents; Determining the weight of the dimensional feature based on the credibility and the preset importance of the dimensional information; The first similarity is determined based on the weight of the dimensional feature, the preset weight of the question feature, the first feature, and the second feature.

4. The question-answering method according to claim 2, characterized in that: The determining a target sub-segment from each of the sub-segments based on each of the second similarities includes: Determine a sub-segment list according to the order of the second similarities from high to low, wherein the sub-segment list includes sub-segments corresponding to the first preset number of second similarities; Traversing the sub-segment list starting from the sub-segment corresponding to the highest second similarity, and determining, based on the order of the sub-segments contained in the document to which the currently traversed sub-segment belongs, a third similarity between the sub-segment feature of the previous sub-segment and the problem feature, and a fourth similarity between the sub-segment feature of the next sub-segment and the problem feature, wherein the previous sub-segment is a sub-segment previous to the currently traversed sub-segment, and the next sub-segment is a sub-segment next to the currently traversed sub-segment; The target sub-segment is determined from the sub-segments based on the third similarity and the fourth similarity.

5. The question-answering method according to claim 4, characterized in that: The determining the target sub-segment from each of the sub-segments based on the third similarity and the fourth similarity includes: In a case where the third similarity is greater than the fourth similarity, determining the target sub-segment based on the currently traversed sub-segment and the previous sub-segment; In a case where the fourth similarity is greater than the third similarity, the target sub-segment is determined based on the currently traversed sub-segment and the next sub-segment.

6. The question-answering method according to claim 2, characterized in that: The determining, based on the question feature and the features of each sub-segment of each sub-segment of the target segment in the feature library, the second similarity between the target question and each sub-segment includes: The second similarity is determined based on the first feature and a third feature corresponding to each sub-segment in the feature library, wherein the third feature includes a sub-segment feature of the sub-segment and a document feature of the document to which the sub-segment belongs.

7. The question-answering method according to claim 6, characterized in that: The method further comprises: Get at least one document; For each of the documents, segment the document based on a first preset length and a preset segment identifier to obtain at least two segments; For each of the segments, segment the segment based on a second preset length and a preset sub-segment identifier to obtain at least two sub-segments; The segment features of each of the segments and the sub-segment features of each of the sub-segments are stored in the feature library.

8. The question-answering method according to claim 7, characterized in that: The method further comprises: For each of the documents, determining a document feature of the document based on the dimension information of the document; Determine a second feature corresponding to each segment based on the document feature of the document and the segment feature of each segment in the document; Determine a third feature corresponding to each sub-segment based on the document feature of the document and the sub-segment feature corresponding to the sub-segment of each segment in the document; The second feature corresponding to each segment and the third feature corresponding to each sub-segment are stored in the feature library.

9. A question-answering device, characterized in that: include: a determining unit, configured to determine a first similarity between the target question and each of the segments based on a question feature of the target question and respective segment features of at least two segments of each document in the feature library; The determining unit is further configured to determine at least one target segment from at least two segments based on each of the first similarities; The determining unit is further configured to determine, for each target segment, a second similarity between the target question and each sub-segment based on the question feature and the sub-segment features of each sub-segment of the target segment in the feature library; The determination unit is further configured to determine a target sub-segment from each of the sub-segments based on each of the second similarities, and determine answer information corresponding to the target question based on the target sub-segment and the target question.

10. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein: When the processor executes the computer program, the question-answering method according to any one of claims 1 to 8 is implemented.