Intelligent question and answer method based on spatial feature and channel feature fusion and related device
By adopting a method based on the fusion of spatial features and channel features in the intelligent question-answer system, the problem of slow inference speed and semantic error judgment when facing massive amounts of information is solved, and more efficient information processing and more reliable inference results are achieved. .
Patent Information
- Application Number
- CN202411471142.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-18
- Publication Date
- 2025-02-18
AI Technical Summary
The existing intelligent question-and-answer system has slow inference speed and poor performance when facing massive amounts of information, especially in terms of semantic error judgment, which affects the reliability of the system.
Using an intelligent question-and-answer method based on the fusion of spatial features and channel features, we can obtain user's questions and related product documents, determine the semantic features of characters and word features and answer text, and fusion of spatial features and channel features, adaptively filter out contradictions or Useless feature information, thereby improving the effectiveness of features and understanding of context information.
It improves the inference speed and reliability of the intelligent question-and-answer system, reduces the occurrence of semantic errors, can process massive information more efficiently, and enhances the competitiveness of the system.
Smart Images

Figure CN119474266A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the fields of intelligent decision-making technology and financial technology, and in particular to an interactive vehicle damage assessment method, device, computer equipment and computer-readable storage medium based on multi-model fusion. Background Art
[0002] In recent years, traditional customer service scenarios have changed from single telephone consultation to multi-channel consultation such as WeChat, Weibo, mobile applications, and web pages, which requires higher professional knowledge and working hours of customer service personnel. With the increase in labor costs, the weaknesses of traditional customer service personnel in terms of time, energy, and labor costs have gradually emerged. At the same time, the service quality of a company's customers depends on the business quality of customer service personnel, which leads to uneven service quality in actual business scenarios. Therefore, the current traditional customer service is gradually being replaced by new forms of business development.
[0003] The current weapon used to solve many problems exposed in traditional customer service is intelligent customer service. The core of intelligent customer service is to use natural language processing technology to improve the understanding of scenario information faced by business scenarios and solve the problem of automatic response. Specifically, online shopping and live streaming are extremely popular at present, and the massive amount of information faced is difficult to process manually. Therefore, a good intelligent product customer service system will undoubtedly effectively improve user purchasing efficiency, enhance user experience of shopping platforms, and increase the competitiveness of shopping platforms. Although the current intelligent customer service system has made great progress, when faced with such massive information, there are still problems with unreliable reasoning speed and performance, especially for the same words, which are prone to semantic misjudgment. For example, in the following scenario: Askin care product contains ingredient A for anti-aging, and ingredient B which can reduce pores, but will accelerate aging, the semantics of aging appears twice at this time, but the meanings of the two times are opposite, which will greatly reduce the reliability of the system.
[0004] Therefore, how to improve the reasoning speed and reliability of intelligent question answering systems is a technical problem that needs to be solved urgently. Summary of the invention
[0005] The main purpose of this application is to provide an intelligent question-answering method, device, computer equipment and computer-readable storage medium based on the fusion of spatial features and channel features, aiming to avoid the technical problems of traditional customer service being difficult to handle massive amounts of information and current intelligent customer service semantic misjudgment, so as to improve the reasoning speed and reliability of the intelligent question-answering system.
[0006] To achieve the above objectives, the present application provides an intelligent question-answering method based on the fusion of spatial features and channel features, and the intelligent question-answering method based on the fusion of spatial features and channel features comprises the following steps:
[0007] Obtain product documents corresponding to the product that the user needs to consult and questions raised about the product;
[0008] Determine, according to the product document and the question, the character and word features in the product document that are relevant to the question, the semantic features of the starting position of the answer text, and the semantic features of the ending position of the answer text;
[0009] The character and word features are fused with the semantic features at the starting position of the answer text by spatial features and channel features to obtain a first fused feature; and the character and word features are fused with the semantic features at the ending position of the answer text by spatial features and channel features to obtain a second fused feature;
[0010] An answer text corresponding to the question is determined from the product document according to the first fusion feature and the second fusion feature.
[0011] In addition, to achieve the above purpose, the present application also provides an intelligent question-answering device based on the fusion of spatial features and channel features, and the intelligent question-answering device based on the fusion of spatial features and channel features includes:
[0012] A data acquisition unit, used to acquire product documents corresponding to the product that the user needs to consult and questions raised about the product;
[0013] A feature determination unit, configured to determine, based on the product document and the question, the character and word features in the product document that are relevant to the question, the semantic features of the starting position of the answer text, and the semantic features of the ending position of the answer text;
[0014] A feature fusion unit, used for fusing the character and word features with the semantic features at the starting position of the answer text by performing spatial features and channel features to obtain a first fused feature; and fusing the character and word features with the semantic features at the ending position of the answer text by performing spatial features and channel features to obtain a second fused feature;
[0015] An answer determination unit is used to determine an answer text corresponding to the question from the product document according to the first fusion feature and the second fusion feature.
[0016] In addition, to achieve the above-mentioned purpose, the present application also provides a computer device, which includes a processor, a memory, and an intelligent question and answer program based on the fusion of spatial features and channel features stored in the memory and executable by the processor, wherein when the intelligent question and answer program based on the fusion of spatial features and channel features is executed by the processor, the steps of the intelligent question and answer method based on the fusion of spatial features and channel features as described above are implemented.
[0017] In addition, to achieve the above-mentioned purpose, the present application also provides a computer-readable storage medium, on which is stored an intelligent question and answer program based on the fusion of spatial features and channel features. When the intelligent question and answer program based on the fusion of spatial features and channel features is executed by a processor, the steps of the intelligent question and answer method based on the fusion of spatial features and channel features as described above are implemented.
[0018] The present application provides an intelligent question-answering method, apparatus, computer device and computer-readable storage medium based on the fusion of spatial features and channel features, which obtains product documents corresponding to the product that a user needs to consult and questions raised about the product; determines character and word features related to the question in the product document, semantic features at the starting position of the answer text, and semantic features at the ending position of the answer text according to the product document and the question; performs spatial feature and channel feature fusion on the character and word features with the semantic features at the starting position of the answer text and the semantic features at the ending position of the answer text, respectively, to obtain a first fused feature and a second fused feature; and determines the answer text corresponding to the question from the product document according to the first fused feature and the second fused feature. Compared with traditional customer service, the intelligent product customer service system adopted in this application can handle the massive amount of information it faces with higher efficiency and faster reasoning speed; compared with the currently existing intelligent customer service system, this application introduces a model based on the fusion of spatial features and channel features, which fuses the character and word features with the semantic features of the starting position of the answer text and the semantic features of the ending position of the answer text respectively, and can adaptively filter out contradictory or useless information in the features, form more effective features and strengthen the understanding of the contextual information of each sentence, reducing the technical problems of current intelligent customer service semantic misjudgment and improving the reliability of the intelligent question and answer system. BRIEF DESCRIPTION OF THE DRAWINGS
[0019] Figure 1 A flowchart of an intelligent question-answering method based on the fusion of spatial features and channel features provided in an embodiment of the present application;
[0020] Figure 2 A flowchart of another intelligent question-answering method based on the fusion of spatial features and channel features provided in an embodiment of the present application;
[0021] Figure 3 A flowchart of another intelligent question-answering method based on the fusion of spatial features and channel features provided in an embodiment of the present application;
[0022] Figure 4 It is a functional module diagram of an intelligent question-answering device based on the fusion of spatial features and channel features provided in an embodiment of the present application;
[0023] Figure 5 It is a schematic block diagram of the structure of a computer device provided in an embodiment of the present application.
[0024] The realization of the purpose, functional features and advantages of this application will be further explained in conjunction with embodiments and with reference to the accompanying drawings. DETAILED DESCRIPTION
[0025] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.
[0026] The flowcharts shown in the accompanying drawings are only examples and do not necessarily include all the contents and operations / steps, nor must they be executed in the order described. For example, some operations / steps may also be decomposed, combined or partially merged, so the actual execution order may change according to actual conditions.
[0027] It should be understood that the terms used in this application specification are only for the purpose of describing specific embodiments and are not intended to limit the application. As used in this application specification and the appended claims, unless the context clearly indicates otherwise, the singular forms "a", "an" and "the" are intended to include plural forms.
[0028] It should be further understood that the term “and / or” used in the specification and appended claims refers to any combination and all possible combinations of one or more of the associated listed items, and includes these combinations.
[0029] The intelligent question-answering method based on the fusion of spatial features and channel features involved in the embodiments of the present application is mainly applied to computer devices. The intelligent question-answering device based on the fusion of spatial features and channel features can be a PC, a portable computer, a mobile terminal, or other device with display and processing functions.
[0030] In conjunction with the accompanying drawings, some embodiments of the present application are described in detail below. In the absence of conflict, the following embodiments and features in the embodiments can be combined with each other.
[0031] Reference Figure 1 , Figure 1 A flowchart of an intelligent question-answering method based on the fusion of spatial features and channel features provided in an embodiment of the present application.
[0032] like Figure 1 As shown, an embodiment of the present application provides an intelligent question-answering method based on the fusion of spatial features and channel features. The intelligent question-answering method based on the fusion of spatial features and channel features includes steps S101 to S104.
[0033] In this embodiment, the intelligent question answering based on the fusion of spatial features and channel features includes the following steps:
[0034] Step S101: Obtain product documents corresponding to the product that the user needs to consult and questions raised about the product;
[0035] Specifically, when a user enters the intelligent question-and-answer system through a terminal, the server or terminal loaded with the intelligent question-and-answer system sends a greeting, asking the user about the product that the user needs to consult, and after receiving the question about the product, obtains the product document corresponding to the product from the database. The inquiry or answer can be a voice inquiry or answer or a text inquiry or answer. If it is voice, it is converted by a built-in voice-to-text conversion module.
[0036] Step S102: determining, according to the product document and the question, the character and word features in the product document that are relevant to the question, the semantic features of the starting position of the answer text, and the semantic features of the ending position of the answer text;
[0037] Characters can be divided into different types such as letters, numbers, punctuation marks, etc., so character features include type features, length features, position features, and frequency features. The frequency feature is used to indicate the number of times the character appears in a certain text, which can be a sentence, paragraph, article, or book.
[0038] A word refers to the smallest meaningful unit in a language and can be used independently. Word features include word frequency, inverse document frequency, part-of-speech tagging, sentiment tendency, and other features.
[0039] Semantic features are specific properties that describe the meaning of words. They help define how words combine with other words to form larger linguistic units, such as phrases or sentences.
[0040] In a specific embodiment provided in the present application, the determining, according to the product document and the question, the character and word features related to the question in the product document, the semantic features of the starting position of the answer text, and the semantic features of the ending position of the answer text includes:
[0041] Determine the semantic feature vectors of the product document and the question according to the product document and the question;
[0042] Calculate the correlation between the semantic feature vector of the question and the semantic feature vector of the product document to obtain a correlation matrix;
[0043] Determine the character and word features related to the question in the product document, the semantic features of the start position of the answer text, and the semantic features of the end position of the answer text according to the semantic feature vector of the question, the semantic feature vector of the product document, and the correlation matrix.
[0044] Specifically, the determining the semantic feature vectors of the product document and the question according to the product document and the question includes:
[0045] Preprocess the text corresponding to the question and the product document respectively to obtain a question text vector and a product document vector;
[0046] Encode the question text vector and the product document vector to obtain a semantic feature vector of the question and a semantic feature vector of the product document.
[0047] Among them, the preprocessing includes operations such as word segmentation, stop word removal, and lemmatization. Word segmentation refers to decomposing the document and the question into individual words. Stop word removal refers to removing common but meaningless words, such as "de", "shi", "zai", etc. Lemmatization refers to restoring the word to its basic form, for example, restoring "running" to "run".
[0048] After preprocessing, a pre-trained word vector model can be used to map each word to a vector in a high-dimensional space. Word vector models such as Word2Vec, GloVe, etc. At the same time, the frequency of each word appearing in the document can also be calculated and the importance of the word can be measured, and then the frequency and importance are combined to form a weight vector for each word.
[0049] Among them, the question text vector and the product document vector include various features. After screening out other features and then encoding, the semantic feature vector of the question and the semantic feature vector of the product document can be obtained.
[0050] Among them, the correlation between vectors can be represented by cosine similarity, Euclidean distance, Manhattan distance, etc.
[0051] Specifically, the determining the character and word features related to the question in the product document, the semantic features of the start position of the answer text, and the semantic features of the end position of the answer text according to the semantic feature vector of the question, the semantic feature vector of the product document, and the correlation matrix includes:
[0052] Multiplying the correlation matrix by the semantic feature vector of the product document to obtain a first weighted sum of attention of the product document, wherein the first weighted sum is used to characterize character and word features in the product document that are related to the question;
[0053] By multiplying the correlation matrix by the question semantic feature vector and inputting it into the first model encoding layer, a second weighted sum of the question with respect to the attention is obtained, wherein the second weighted sum is used to characterize the semantic features of the starting position of the answer text related to the question in the product document;
[0054] By multiplying the correlation matrix by the question semantic feature vector and inputting it into the second model encoding layer, a third weighted sum of the question with respect to the attention is obtained, and the third weighted sum is used to characterize the semantic features of the end position of the answer text related to the question in the product document; the model parameters of the first model encoding layer and the second model encoding layer are different.
[0055] The model encoding layer is a sequence labeling model, such as BiLSTM-CRF (Bidirectional Long Short-Term Memory Network-Conditional Random Field) or BERT-BiLSTM-CRF, which is used to identify the boundary of the answer. When the model is trained to identify the starting position, the predicted result is compared with the actual starting position to update the model parameters, while when it is trained to identify the ending position, the predicted result is compared with the actual ending position to update the model parameters, so the model parameters obtained by the two are different.
[0056] In another specific embodiment provided by the present application, the determining, according to the product document and the question, the character and word features related to the question in the product document, the semantic features of the starting position of the answer text, and the semantic features of the ending position of the answer text includes:
[0057] Determining character and word features in the product document that are relevant to the question, and setting a tracking marker, wherein the tracking marker is used to determine whether a current character feature or word feature is within a sentence;
[0058] The character and word features related to the question in the product document are scanned word by word by the tracking marker to determine the semantic features of the starting position of the answer text; the character and word features related to the question in the product document are scanned word by word by the tracking marker to determine the semantic features of the ending position of the answer text.
[0059] Specifically, scanning the character and word features related to the question in the product document word by word through the tracking marker to determine the semantic features of the end position of the answer text includes:
[0060] Determine whether the character feature currently scanned is a punctuation mark indicating the end of a sentence;
[0061] If the currently scanned character feature is a punctuation mark indicating the end of a sentence, then obtaining a word feature before and a word feature after the currently scanned character feature, wherein the characters and word features related to the problem in the product document include the currently scanned character feature, the word feature before and the word feature after the currently scanned character feature;
[0062] Determining whether the first word feature is an abbreviation or a number, and determining whether the second word feature is a capital letter;
[0063] When the previous word feature is not an abbreviation or a number, and the next word feature is an uppercase letter, the currently scanned character feature is determined to be a semantic feature of the end position of the answer text.
[0064] Among them, the punctuation marks indicating the end of a sentence may be, for example, a period (.), a question mark (?), or an exclamation mark (!). However, sometimes, the period after some words does not represent the end of a sentence, such as Dr., Inc., etc. Therefore, it is also very important to identify these abbreviations and handle them correctly. In addition, in a number sequence or list, the period may only be used to separate numbers or items, not the end of a sentence. In addition to punctuation marks, you can also check the contextual information before and after the period. For example, if the period is followed by a lowercase letter, it is likely that this is not the end of a sentence; on the contrary, if the period is followed by an uppercase letter, it is likely the beginning of a new sentence.
[0065] Specifically, scanning the character and word features related to the question in the product document word by word through the tracking marker to determine the semantic features of the starting position of the answer text includes:
[0066] If it is determined whether the currently scanned character feature meets the following sentence start condition, the currently scanned character feature is determined as the semantic feature of the starting position of the answer text.
[0067] Sentence start conditions include the following: the first letter of the new sentence is capitalized, the sentence is quoting someone else's words or text, and the first word is the following vocabulary or phrases, such as "Firstly," "Secondly," etc.
[0068] Step S103, fusing the character and word features with the semantic features at the starting position of the answer text by performing spatial features and channel features to obtain a first fused feature; and fusing the character and word features with the semantic features at the ending position of the answer text by performing spatial features and channel features to obtain a second fused feature;
[0069] Among them, spatial features involve location information, while channel features involve different types of feature representations, such as word vectors, part-of-speech tags, named entity tags, dependency syntactic relations, etc. The fusion of these two features can significantly improve the performance of the model. Its specific implementation can be to apply a convolution operation on the input vector on each channel to capture local features, and then fuse the convolution results of each channel, such as by concatenation or weighted summation; or it can be to use an attention mechanism (such as a self-attention mechanism) to capture the relationship between words and assign a weight to each word, which can reflect the importance of the word in the sentence; then fuse the feature vectors of different channels through the attention mechanism, such as by weighted summation.
[0070] Step S104: Determine the answer text corresponding to the question from the product document according to the first fusion feature and the second fusion feature.
[0071] Specifically, determining the answer text corresponding to the question from the product document according to the first fusion feature and the second fusion feature includes:
[0072] Performing linear transformation on the first fused feature and the second fused feature respectively to obtain a first linear feature and a second linear feature that meet the output size requirement;
[0073] Convert each element in the first linear feature and the second linear feature into a probability value to obtain the first linear feature and the second linear feature represented by the probability values;
[0074] Determine the starting position of the answer text from the first linear feature represented by the probability value according to the element corresponding to the maximum probability value, and determine the ending position of the answer text from the second linear feature represented by the probability value according to the element corresponding to the maximum probability value;
[0075] An answer text corresponding to the question is determined from the product document according to the start position and the end position.
[0076] It can be seen that the embodiment of the present application obtains the product document corresponding to the product that the user needs to consult and the questions raised about the product; determines the character and word features related to the question in the product document, the semantic features of the starting position of the answer text, and the semantic features of the ending position of the answer text according to the product document and the questions; performs spatial feature and channel feature fusion on the character and word features with the semantic features of the starting position of the answer text and the semantic features of the ending position of the answer text, respectively, to obtain a first fusion feature and a second fusion feature; determines the answer text corresponding to the question from the product document according to the first fusion feature and the second fusion feature. Compared with traditional customer service, the intelligent product customer service system adopted in this application can handle the massive amount of information it faces with higher efficiency and faster reasoning speed; compared with the currently existing intelligent customer service system, this application introduces a model based on the fusion of spatial features and channel features, which fuses the character and word features with the semantic features of the starting position of the answer text and the semantic features of the ending position of the answer text respectively, and can adaptively filter out contradictory or useless information in the features, form more effective features and strengthen the understanding of the contextual information of each sentence, reducing the technical problems of current intelligent customer service semantic misjudgment and improving the reliability of the intelligent question and answer system.
[0077] Reference Figure 2 , Figure 2 A flowchart of another intelligent question-answering method based on the fusion of spatial features and channel features provided in an embodiment of the present application.
[0078] like Figure 2 As shown, an embodiment of the present application provides an intelligent question-answering method based on the fusion of spatial features and channel features. The intelligent question-answering method based on the fusion of spatial features and channel features includes steps S201 to S212.
[0079] Step S201: Obtain product documents corresponding to the product that the user needs to consult and questions raised about the product.
[0080] Step S202: pre-process the text corresponding to the question and the product document respectively to obtain a question text vector and a product document vector.
[0081] Step S203: Encode the question text vector and the product document vector to obtain a question semantic feature vector and a product document semantic feature vector.
[0082] Step S204: Calculate the correlation between the question semantic feature vector and the product document semantic feature vector to obtain a correlation matrix.
[0083] Step S205: multiply the correlation matrix by the semantic feature vector of the product document to obtain a first weighted sum of attention of the product document, wherein the first weighted sum is used to characterize character and word features in the product document that are related to the question.
[0084] Step S206: By multiplying the correlation matrix by the question semantic feature vector and inputting it into the first model encoding layer, a second weighted sum of the question with respect to the attention is obtained, and the second weighted sum is used to characterize the semantic features of the starting position of the answer text related to the question in the product document.
[0085] Step S207: By multiplying the correlation matrix by the question semantic feature vector and inputting it into the second model encoding layer, a third weighted sum of the question regarding the attention is obtained, and the third weighted sum is used to characterize the semantic features of the end position of the answer text related to the question in the product document; the model parameters of the first model encoding layer and the second model encoding layer are different.
[0086] Step S208, performing spatial feature and channel feature fusion of the character and word features with the semantic features at the starting position of the answer text to obtain a first fused feature; and performing spatial feature and channel feature fusion of the character and word features with the semantic features at the ending position of the answer text to obtain a second fused feature.
[0087] Step S209: perform linear transformation on the first fused feature and the second fused feature respectively to obtain a first linear feature and a second linear feature that meet the output size requirement.
[0088] Step S210: Convert each element in the first linear feature and the second linear feature into a probability value to obtain the first linear feature and the second linear feature represented by the probability values.
[0089] Step S211, determine the starting position of the answer text from the first linear feature represented by the probability value according to the element corresponding to the maximum probability value, and determine the ending position of the answer text from the second linear feature represented by the probability value according to the element corresponding to the maximum probability value.
[0090] Step S212: Determine the answer text corresponding to the question from the product document according to the start position and the end position.
[0091] It should be noted that those skilled in the art can clearly understand that, for the convenience and brevity of description, the above method embodiments can refer to the corresponding processes in the aforementioned method embodiments, which will not be repeated here.
[0092] Reference Figure 3 , Figure 3 A flowchart of another intelligent question-answering method based on the fusion of spatial features and channel features provided in an embodiment of the present application.
[0093] like Figure 3 As shown, an embodiment of the present application provides an intelligent question-answering method based on the fusion of spatial features and channel features. The intelligent question-answering method based on the fusion of spatial features and channel features includes steps S301 to S312.
[0094] Step S301: Obtain product documents corresponding to the product that the user needs to consult and questions raised about the product.
[0095] Step S302: Determine the character and word features in the product document that are relevant to the question, and set a tracking marker, wherein the tracking marker is used to determine whether the current character feature or word feature is within a sentence.
[0096] Step S303: Scan the characters and word features related to the question in the product document word by word using the tracking marker to determine the semantic features of the starting position of the answer text.
[0097] Step S304: Determine whether the currently scanned character feature is a punctuation mark indicating the end of a sentence.
[0098] Step S305: If the character feature currently scanned is a punctuation mark indicating the end of a sentence, obtain the word feature before and after the character feature currently scanned, and the characters and word features related to the question in the product document include the character feature currently scanned, the word feature before and after the character feature currently scanned.
[0099] Step S306: Determine whether the previous word feature is an abbreviation or a number, and determine whether the next word feature is an uppercase letter.
[0100] Step S307: when the previous word feature is not an abbreviation or a number, and the next word feature is an uppercase letter, determine that the currently scanned character feature is a semantic feature of the end position of the answer text.
[0101] Step S308, performing spatial feature and channel feature fusion of the character and word features with the semantic features at the starting position of the answer text to obtain a first fused feature; and performing spatial feature and channel feature fusion of the character and word features with the semantic features at the ending position of the answer text to obtain a second fused feature.
[0102] Step S309: perform linear transformation on the first fused feature and the second fused feature respectively to obtain a first linear feature and a second linear feature that meet the output size requirement.
[0103] Step S310: Convert each element in the first linear feature and the second linear feature into a probability value to obtain the first linear feature and the second linear feature represented by the probability values.
[0104] Step S311, determine the starting position of the answer text from the first linear feature represented by the probability value according to the element corresponding to the maximum probability value, and determine the ending position of the answer text from the second linear feature represented by the probability value according to the element corresponding to the maximum probability value.
[0105] Step S312: Determine the answer text corresponding to the question from the product document according to the start position and the end position.
[0106] It should be noted that those skilled in the art can clearly understand that, for the convenience and brevity of description, the above method embodiments can refer to the corresponding processes in the aforementioned method embodiments, which will not be repeated here.
[0107] See also Figure 4 , Figure 4 It is a functional module diagram of an intelligent question-answering device based on the fusion of spatial features and channel features provided in an embodiment of the present application.
[0108] like Figure 4 As shown, the intelligent question-answering device based on the fusion of spatial features and channel features includes:
[0109] The data acquisition unit 401 is used to acquire the product documents corresponding to the product that the user needs to consult and the questions raised about the product;
[0110] A feature determination unit 402, configured to determine, based on the product document and the question, the character and word features in the product document that are related to the question, the semantic features of the starting position of the answer text, and the semantic features of the ending position of the answer text;
[0111] The feature fusion unit 403 is used to fuse the character and word features with the semantic features at the starting position of the answer text by performing spatial features and channel features to obtain a first fused feature; and to fuse the character and word features with the semantic features at the ending position of the answer text by performing spatial features and channel features to obtain a second fused feature;
[0112] The answer determination unit 404 is used to determine the answer text corresponding to the question from the product document according to the first fusion feature and the second fusion feature.
[0113] Specifically, in determining the character and word features related to the question in the product document, the semantic features of the starting position of the answer text, and the semantic features of the ending position of the answer text according to the product document and the question, the feature determination unit 402 is specifically used to:
[0114] Determine a product document semantic feature vector and a question semantic feature vector according to the product document and the question;
[0115] Calculating the correlation between the question semantic feature vector and the product document semantic feature vector to obtain a correlation matrix;
[0116] Character and word features related to the question in the product document, semantic features of the starting position of the answer text, and semantic features of the ending position of the answer text are determined according to the question semantic feature vector, the product document semantic feature vector, and the correlation matrix.
[0117] Specifically, in determining the character and word features related to the question in the product document, the semantic features of the starting position of the answer text, and the semantic features of the ending position of the answer text according to the question semantic feature vector, the product document semantic feature vector, and the correlation matrix, the feature determination unit 402 is specifically used to:
[0118] Multiplying the correlation matrix by the semantic feature vector of the product document to obtain a first weighted sum of attention of the product document, wherein the first weighted sum is used to characterize character and word features in the product document that are related to the question;
[0119] By multiplying the correlation matrix by the question semantic feature vector and inputting it into the first model encoding layer, a second weighted sum of the question with respect to the attention is obtained, wherein the second weighted sum is used to characterize the semantic features of the starting position of the answer text related to the question in the product document;
[0120] By multiplying the correlation matrix by the question semantic feature vector and inputting it into the second model encoding layer, a third weighted sum of the question with respect to the attention is obtained, and the third weighted sum is used to characterize the semantic features of the end position of the answer text related to the question in the product document; the model parameters of the first model encoding layer and the second model encoding layer are different.
[0121] Specifically, in determining the product document semantic feature vector and the question semantic feature vector according to the product document and the question, the feature determination unit 402 is specifically configured to:
[0122] Preprocessing the text corresponding to the question and the product document respectively to obtain a question text vector and a product document vector;
[0123] The question text vector and the product document vector are encoded to obtain a question semantic feature vector and a product document semantic feature vector.
[0124] Specifically, in determining the answer text corresponding to the question from the product document according to the first fusion feature and the second fusion feature, the answer determination unit 404 is specifically configured to:
[0125] Performing linear transformation on the first fused feature and the second fused feature respectively to obtain a first linear feature and a second linear feature that meet the output size requirement;
[0126] Convert each element in the first linear feature and the second linear feature into a probability value to obtain the first linear feature and the second linear feature represented by the probability values;
[0127] Determine the starting position of the answer text from the first linear feature represented by the probability value according to the element corresponding to the maximum probability value, and determine the ending position of the answer text from the second linear feature represented by the probability value according to the element corresponding to the maximum probability value;
[0128] An answer text corresponding to the question is determined from the product document according to the start position and the end position.
[0129] Specifically, in determining the character and word features related to the question in the product document, the semantic features of the starting position of the answer text, and the semantic features of the ending position of the answer text according to the product document and the question, the feature determination unit 402 is specifically used to:
[0130] Determining character and word features in the product document that are relevant to the question, and setting a tracking marker, wherein the tracking marker is used to determine whether a current character feature or word feature is within a sentence;
[0131] The character and word features related to the question in the product document are scanned word by word by the tracking marker to determine the semantic features of the starting position of the answer text; the character and word features related to the question in the product document are scanned word by word by the tracking marker to determine the semantic features of the ending position of the answer text.
[0132] Specifically, in the aspect of scanning the character and word features related to the question in the product document word by word through the tracking marker to determine the semantic features of the end position of the answer text, the feature determination unit 402 is specifically used to:
[0133] Determine whether the character feature currently scanned is a punctuation mark indicating the end of a sentence;
[0134] If the currently scanned character feature is a punctuation mark indicating the end of a sentence, then obtaining a word feature before and a word feature after the currently scanned character feature, wherein the characters and word features related to the problem in the product document include the currently scanned character feature, the word feature before and the word feature after the currently scanned character feature;
[0135] Determining whether the first word feature is an abbreviation or a number, and determining whether the second word feature is a capital letter;
[0136] When the previous word feature is not an abbreviation or a number, and the next word feature is an uppercase letter, the currently scanned character feature is determined to be a semantic feature of the end position of the answer text.
[0137] It should be noted that those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working process of the above-described device and each module can refer to the corresponding process in the aforementioned method embodiment, and will not be repeated here.
[0138] The above-mentioned device can be implemented in the form of a computer program. Figure 5 Runs on the computer device shown.
[0139] See also Figure 5 , Figure 5 1 is a schematic block diagram of a computer device provided in an embodiment of the present application. The computer device may be a server.
[0140] See also Figure 5 The computer device includes a processor, a memory and a network interface connected through a system bus, wherein the memory may include a non-volatile storage medium and an internal memory.
[0141] The non-volatile storage medium can store an operating system and a computer program. The computer program includes program instructions, and when the program instructions are executed, the processor can execute any intelligent question-answering method based on the fusion of spatial features and channel features.
[0142] The processor is used to provide computing and control capabilities and support the operation of the entire computer equipment.
[0143] The internal memory provides an environment for the operation of the computer program in the non-volatile storage medium. When the computer program is executed by the processor, the processor can execute any intelligent question-answering method based on the fusion of spatial features and channel features.
[0144] The network interface is used for network communication, such as sending assigned tasks, etc. Those skilled in the art will appreciate that Figure 5 The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.
[0145] It should be understood that the processor may be a central processing unit (CPU), and the processor may also be other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. Among them, the general-purpose processor may be a microprocessor or the processor may also be any conventional processor, etc.
[0146] In one embodiment, the processor is used to run a computer program stored in the memory to implement the following steps:
[0147] Obtain product documents corresponding to the product that the user needs to consult and questions raised about the product;
[0148] Determine, according to the product document and the question, the character and word features in the product document that are relevant to the question, the semantic features of the starting position of the answer text, and the semantic features of the ending position of the answer text;
[0149] The character and word features are fused with the semantic features at the starting position of the answer text by spatial features and channel features to obtain a first fused feature; and the character and word features are fused with the semantic features at the ending position of the answer text by spatial features and channel features to obtain a second fused feature;
[0150] An answer text corresponding to the question is determined from the product document according to the first fusion feature and the second fusion feature.
[0151] In one embodiment, in determining, according to the product document and the question, the character and word features in the product document related to the question, the semantic features of the starting position of the answer text, and the semantic features of the ending position of the answer text, the processor is used to run a computer program stored in the memory to implement the following steps:
[0152] Determine a product document semantic feature vector and a question semantic feature vector according to the product document and the question;
[0153] Calculating the correlation between the question semantic feature vector and the product document semantic feature vector to obtain a correlation matrix;
[0154] Character and word features related to the question in the product document, semantic features of the starting position of the answer text, and semantic features of the ending position of the answer text are determined according to the question semantic feature vector, the product document semantic feature vector, and the correlation matrix.
[0155] In one embodiment, in the aspect of determining the character and word features related to the question in the product document, the semantic features of the starting position of the answer text, and the semantic features of the ending position of the answer text according to the question semantic feature vector, the product document semantic feature vector, and the correlation matrix, the processor is used to run a computer program stored in the memory to implement the following steps:
[0156] Multiplying the correlation matrix by the semantic feature vector of the product document to obtain a first weighted sum of attention of the product document, wherein the first weighted sum is used to characterize character and word features in the product document that are related to the question;
[0157] By multiplying the correlation matrix by the question semantic feature vector and inputting it into the first model encoding layer, a second weighted sum of the question with respect to the attention is obtained, wherein the second weighted sum is used to characterize the semantic features of the starting position of the answer text related to the question in the product document;
[0158] By multiplying the correlation matrix by the question semantic feature vector and inputting it into the second model encoding layer, a third weighted sum of the question with respect to the attention is obtained, and the third weighted sum is used to characterize the semantic features of the end position of the answer text related to the question in the product document; the model parameters of the first model encoding layer and the second model encoding layer are different.
[0159] In one embodiment, in determining the product document semantic feature vector and the question semantic feature vector according to the product document and the question, the processor is used to run a computer program stored in a memory to implement the following steps:
[0160] Preprocessing the text corresponding to the question and the product document respectively to obtain a question text vector and a product document vector;
[0161] The question text vector and the product document vector are encoded to obtain a question semantic feature vector and a product document semantic feature vector.
[0162] In one embodiment, in determining the answer text corresponding to the question from the product document according to the first fusion feature and the second fusion feature, the processor is used to run a computer program stored in a memory to implement the following steps:
[0163] Performing linear transformation on the first fused feature and the second fused feature respectively to obtain a first linear feature and a second linear feature that meet the output size requirement;
[0164] Convert each element in the first linear feature and the second linear feature into a probability value to obtain the first linear feature and the second linear feature represented by the probability values;
[0165] Determine the starting position of the answer text from the first linear feature represented by the probability value according to the element corresponding to the maximum probability value, and determine the ending position of the answer text from the second linear feature represented by the probability value according to the element corresponding to the maximum probability value;
[0166] An answer text corresponding to the question is determined from the product document according to the start position and the end position.
[0167] In one embodiment, in determining, according to the product document and the question, the character and word features in the product document related to the question, the semantic features of the starting position of the answer text, and the semantic features of the ending position of the answer text, the processor is used to run a computer program stored in the memory to implement the following steps:
[0168] Determining character and word features in the product document that are relevant to the question, and setting a tracking marker, wherein the tracking marker is used to determine whether a current character feature or word feature is within a sentence;
[0169] The character and word features related to the question in the product document are scanned word by word by the tracking marker to determine the semantic features of the starting position of the answer text; the character and word features related to the question in the product document are scanned word by word by the tracking marker to determine the semantic features of the ending position of the answer text.
[0170] In one embodiment, in the aspect of scanning the character and word features related to the question in the product document word by word through the tracking marker to determine the semantic features of the end position of the answer text, the processor is used to run a computer program stored in the memory to implement the following steps:
[0171] Determine whether the character feature currently scanned is a punctuation mark indicating the end of a sentence;
[0172] If the currently scanned character feature is a punctuation mark indicating the end of a sentence, then obtaining a word feature before and a word feature after the currently scanned character feature, wherein the characters and word features related to the problem in the product document include the currently scanned character feature, the word feature before and the word feature after the currently scanned character feature;
[0173] Determining whether the first word feature is an abbreviation or a number, and determining whether the second word feature is a capital letter;
[0174] When the previous word feature is not an abbreviation or a number, and the next word feature is an uppercase letter, the currently scanned character feature is determined to be a semantic feature of the end position of the answer text.
[0175] A computer-readable storage medium is also provided in an embodiment of the present application, wherein the computer-readable storage medium stores a computer program, wherein the computer program includes program instructions, and the processor executes the program instructions to implement any one of the intelligent question-answering methods based on the fusion of spatial features and channel features provided in the embodiments of the present application.
[0176] The computer-readable storage medium may be an internal storage unit of the computer device described in the foregoing embodiment, such as a hard disk or memory of the computer device. The computer-readable storage medium may also be an external storage device of the computer device, such as a plug-in hard disk, a smart memory card (Smart Medi a Card, SMC), a secure digital (Secure Digital, SD) card, a flash memory card (Flash Card), etc., equipped on the computer device.
[0177] The above is only a specific implementation of the present application, but the protection scope of the present application is not limited thereto. Any technician familiar with the technical field can easily think of various equivalent modifications or replacements within the technical scope disclosed in the present application, and these modifications or replacements should be included in the protection scope of the present application. Therefore, the protection scope of the present application shall be based on the protection scope of the claims.
Claims
1. An intelligent question answering method based on the fusion of spatial features and channel features, characterized in that: The intelligent question answering method based on the fusion of spatial features and channel features comprises the following steps: Obtain product documents corresponding to the product that the user needs to consult and questions raised about the product; Determine, according to the product document and the question, the character and word features in the product document that are relevant to the question, the semantic features of the starting position of the answer text, and the semantic features of the ending position of the answer text; The character and word features are fused with the semantic features at the starting position of the answer text by spatial features and channel features to obtain a first fused feature; and the character and word features are fused with the semantic features at the ending position of the answer text by spatial features and channel features to obtain a second fused feature; An answer text corresponding to the question is determined from the product document according to the first fusion feature and the second fusion feature.
2. The intelligent question-answering method based on the fusion of spatial features and channel features according to claim 1, characterized in that: The step of determining, according to the product document and the question, the character and word features in the product document that are related to the question, the semantic features of the starting position of the answer text, and the semantic features of the ending position of the answer text includes: Determine a product document semantic feature vector and a question semantic feature vector according to the product document and the question; Calculating the correlation between the question semantic feature vector and the product document semantic feature vector to obtain a correlation matrix; Character and word features related to the question in the product document, semantic features of the starting position of the answer text, and semantic features of the ending position of the answer text are determined according to the question semantic feature vector, the product document semantic feature vector, and the correlation matrix.
3. The intelligent question-answering method based on the fusion of spatial features and channel features as claimed in claim 2, characterized in that: The step of determining, according to the question semantic feature vector, the product document semantic feature vector and the correlation matrix, the character and word features related to the question in the product document, the semantic features of the starting position of the answer text, and the semantic features of the ending position of the answer text includes: Multiplying the correlation matrix by the semantic feature vector of the product document to obtain a first weighted sum of attention of the product document, wherein the first weighted sum is used to characterize character and word features in the product document that are related to the question; By multiplying the correlation matrix by the question semantic feature vector and inputting it into the first model encoding layer, a second weighted sum of the question with respect to the attention is obtained, wherein the second weighted sum is used to characterize the semantic features of the starting position of the answer text related to the question in the product document; By multiplying the correlation matrix by the question semantic feature vector and inputting it into the second model encoding layer, a third weighted sum of the question with respect to the attention is obtained, and the third weighted sum is used to characterize the semantic features of the end position of the answer text related to the question in the product document; the model parameters of the first model encoding layer and the second model encoding layer are different.
4. The intelligent question-answering method based on the fusion of spatial features and channel features according to claim 2, characterized in that: The step of determining a product document semantic feature vector and a question semantic feature vector according to the product document and the question includes: Preprocessing the text corresponding to the question and the product document respectively to obtain a question text vector and a product document vector; The question text vector and the product document vector are encoded to obtain a question semantic feature vector and a product document semantic feature vector.
5. The intelligent question answering method based on the fusion of spatial features and channel features according to any one of claims 1 to 4, characterized in that: The determining the answer text corresponding to the question from the product document according to the first fusion feature and the second fusion feature includes: Performing linear transformation on the first fused feature and the second fused feature respectively to obtain a first linear feature and a second linear feature that meet the output size requirement; Convert each element in the first linear feature and the second linear feature into a probability value to obtain the first linear feature and the second linear feature represented by the probability values; Determine the starting position of the answer text from the first linear feature represented by the probability value according to the element corresponding to the maximum probability value, and determine the ending position of the answer text from the second linear feature represented by the probability value according to the element corresponding to the maximum probability value; An answer text corresponding to the question is determined from the product document according to the start position and the end position.
6. The intelligent question-answering method based on the fusion of spatial features and channel features according to claim 1, characterized in that: The step of determining, according to the product document and the question, the character and word features in the product document that are related to the question, the semantic features of the starting position of the answer text, and the semantic features of the ending position of the answer text includes: Determining character and word features in the product document that are relevant to the question, and setting a tracking marker, wherein the tracking marker is used to determine whether a current character feature or word feature is within a sentence; The character and word features related to the question in the product document are scanned word by word by the tracking marker to determine the semantic features of the starting position of the answer text; the character and word features related to the question in the product document are scanned word by word by the tracking marker to determine the semantic features of the ending position of the answer text.
7. The intelligent question-answering method based on the fusion of spatial features and channel features according to claim 6, characterized in that: The step of scanning the characters and word features related to the question in the product document word by word through the tracking marker to determine the semantic features of the end position of the answer text includes: Determine whether the character feature currently scanned is a punctuation mark indicating the end of a sentence; If the currently scanned character feature is a punctuation mark indicating the end of a sentence, then obtaining a word feature before and a word feature after the currently scanned character feature, wherein the characters and word features related to the problem in the product document include the currently scanned character feature, the word feature before and the word feature after the currently scanned character feature; Determining whether the first word feature is an abbreviation or a number, and determining whether the second word feature is a capital letter; When the previous word feature is not an abbreviation or a number, and the next word feature is an uppercase letter, the currently scanned character feature is determined to be a semantic feature of the end position of the answer text.
8. An intelligent question-answering device based on the fusion of spatial features and channel features, characterized in that: The intelligent question-answering device based on the fusion of spatial features and channel features includes: A data acquisition unit, used to acquire product documents corresponding to the product that the user needs to consult and questions raised about the product; A feature determination unit, configured to determine, based on the product document and the question, the character and word features in the product document that are relevant to the question, the semantic features of the starting position of the answer text, and the semantic features of the ending position of the answer text; A feature fusion unit, used for fusing the character and word features with the semantic features at the starting position of the answer text by performing spatial features and channel features to obtain a first fused feature; and fusing the character and word features with the semantic features at the ending position of the answer text by performing spatial features and channel features to obtain a second fused feature; An answer determination unit is used to determine an answer text corresponding to the question from the product document according to the first fusion feature and the second fusion feature.
9. A computer device, characterized in that: The computer device includes a processor, a memory, and an intelligent question-answering program based on the fusion of spatial features and channel features stored in the memory and executable by the processor. When the intelligent question-answering program based on the fusion of spatial features and channel features is executed by the processor, the steps of the intelligent question-answering method based on the fusion of spatial features and channel features as described in any one of claims 1 to 7 are implemented.
10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores an intelligent question-answering program based on the fusion of spatial features and channel features. When the intelligent question-answering program based on the fusion of spatial features and channel features is executed by a processor, the steps of the intelligent question-answering method based on the fusion of spatial features and channel features as described in any one of claims 1 to 7 are implemented.