Question and answer search method and device, and storage medium
By expanding the training sample set of the question-answering search model and generating a high-frequency and related domain thesaurus using historical dialogue data and labeled files, the problem of insufficient samples in the question-answering search system is solved, and the accuracy of answer search is improved.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- ZHAOLIAN CONSUMER FINANCE CO LTD
- Filing Date
- 2022-12-05
- Publication Date
- 2026-05-12
AI Technical Summary
In existing question-answering search systems, the number of negative and difficult samples is small, resulting in low accuracy in answer search.
By constructing a target sample set and combining it with historical dialogue data and labeled files, a high-frequency domain lexicon and a related domain lexicon are generated, expanding the training sample set and improving sample diversity.
This improved the breadth and practicality of the training samples for the question-answering search model, and enhanced the accuracy of answer search.
Smart Images

Figure CN116361638B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of artificial intelligence technology, and mainly relates to a question-answering search method, device and storage medium. Background Technology
[0002] Text-based question-and-answer matching algorithms are primarily used in business scenarios such as customer service and outbound call robots. With the rapid development of the internet, some question-and-answer search systems that rely heavily on manual intervention are gradually shifting towards automation and manual combination. Using automated question-and-answer recommendations to solve some problems can reduce manual intervention and provide a faster response to user needs.
[0003] Currently, the training samples used in question-answering search models in question-answering search systems are obtained by manually labeling historical dialogue data. However, in real-world question-answering scenarios, the number of certain types of samples, such as negative samples or difficult samples, is relatively small, resulting in a low accuracy rate in answer search. Summary of the Invention
[0004] This application provides a question-answering search method, apparatus, and storage medium, which can improve the diversity of samples, increase the learning breadth of the model on training samples, and help improve the accuracy of search answers.
[0005] In a first aspect, embodiments of this application provide a question-answering search method, comprising: obtaining a target object's search request for an answer to a target question; determining the text features of the target question; inputting the text features into a question-answering search model to obtain a target answer; wherein the question-answering search model is a model that meets preset conditions and is trained based on a target sample set, the target sample set including a sample set obtained by fusing a first sample set and a second sample set, the first sample set being a sample set obtained by processing a historical dialogue dataset, and the second sample set being a sample set obtained by processing a historical dialogue dataset and labeled files.
[0006] In one possible example, it also includes: analyzing the historical dialogue dataset to obtain a domain lexicon; filtering the domain lexicon to obtain a high-frequency domain lexicon; supplementing the domain lexicon to obtain a related domain lexicon; and constructing a first sample set based on the high-frequency domain lexicon and the related domain lexicon.
[0007] In one possible example, the domain lexicon is filtered to obtain a high-frequency domain lexicon, which includes: obtaining the vector representation of each domain word in the domain lexicon; clustering the vector representations of the domain words to obtain at least two types of domain word clusters; obtaining the frequency of each type of domain word cluster; and forming a high-frequency domain lexicon by grouping the domain word clusters with frequencies greater than a frequency threshold.
[0008] In one possible example, the domain lexicon is supplemented to obtain a related domain lexicon, which includes: finding replacement words for each domain word in the domain lexicon according to the preset rules corresponding to the domain type of the domain lexicon; obtaining similar words for each domain lexicon in the domain lexicon; and supplementing the domain lexicon with replacement words and similar words to obtain a related domain lexicon.
[0009] In one possible example, a first sample set is constructed based on a high-frequency domain lexicon and a related domain lexicon, including: finding a target historical dialogue dataset containing at least one domain word from the domain lexicon in the historical dialogue dataset; constructing a first subsample containing at least one domain word from the high-frequency domain lexicon based on the target historical dialogue data; replacing the domain word in the target historical dialogue data with at least one domain word from the related domain lexicon to obtain multiple second subsamples; and fusing the first subsample and multiple second subsamples to obtain the first sample set.
[0010] In one possible example, it also includes: selecting reference samples corresponding to a preset sample type from the labeled file; obtaining the similarity value between each historical dialogue data and the reference sample in the historical dialogue dataset; and filtering out historical dialogue datasets with similarity values greater than a similarity threshold from the historical dialogue dataset to obtain a second sample set.
[0011] In one possible example, determining the textual features of the target question includes: identifying keywords and the technical field of the target question; and determining the textual features of the target question based on the technical field and keywords.
[0012] Secondly, embodiments of this application provide a question-and-answer search device, wherein:
[0013] The communication unit is used to obtain the target object's search request for the answer to the target question;
[0014] The processing unit is used to determine the text features of the target question; input the text features into the question-answering search model to obtain the target answer; wherein, the question-answering search model is a model that meets preset conditions and is trained based on the target sample set. The target sample set includes a sample set obtained by fusing the first sample set and the second sample set. The first sample set is a sample set obtained by processing historical dialogue data, and the second sample set is a sample set obtained by processing historical dialogue data and labeled files.
[0015] In one possible example, the processing unit is also used to analyze the historical dialogue dataset to obtain a domain lexicon; filter the domain lexicon to obtain a high-frequency domain lexicon; supplement the domain lexicon to obtain a related domain lexicon; and construct a first sample set based on the high-frequency domain lexicon and the related domain lexicon.
[0016] In one possible example, the processing unit is specifically used to obtain the vector representation of each domain word in the domain lexicon; cluster the vector representations of the domain words to obtain at least two types of domain word clusters; obtain the frequency of each type of domain word cluster; and form a high-frequency domain lexicon by grouping the domain word clusters with frequencies greater than the frequency threshold.
[0017] In one possible example, the processing unit is specifically used to find replacement words for each domain word in the domain thesaurus according to the preset rules corresponding to the domain type of the domain thesaurus; obtain similar words for each domain thesaurus in the domain thesaurus; and supplement the replacement words and similar words into the domain thesaurus to obtain the associated domain thesaurus.
[0018] In one possible example, the processing unit is specifically used to find the target historical dialogue dataset containing at least one domain word from the domain lexicon in the historical dialogue dataset; construct a first subsample containing at least one domain word from the high-frequency domain lexicon based on the target historical dialogue data; replace the domain word in the target historical dialogue data with at least one domain word from the associated domain lexicon to obtain multiple second subsamples; and fuse the first subsample and multiple second subsamples to obtain a first sample set.
[0019] In one possible example, the processing unit is also used to select reference samples corresponding to a preset sample type from the labeled file; obtain the similarity value between each historical dialogue data and the reference sample in the historical dialogue dataset; and filter out historical dialogue datasets with similarity values greater than the similarity threshold from the historical dialogue dataset to obtain a second sample set.
[0020] In one possible example, the processing unit is specifically used to determine the keywords in the target question and the technical field of the target question; and to determine the textual features of the target question based on the technical field and keywords.
[0021] Thirdly, embodiments of this application provide a computer device including a processor, a memory, a communication interface, and one or more programs, wherein the one or more programs are stored in the memory and configured to be executed by the processor, and the programs include instructions for some or all of the steps described in the first aspect.
[0022] Fourthly, embodiments of this application provide a computer-readable storage medium storing a computer program that causes a computer to perform some or all of the steps described in the first aspect.
[0023] By implementing the embodiments of this application, after obtaining the target object's search request for an answer to a target question, the text features of the target question can be determined first. These text features are then input into a question-answering search model to obtain the target answer. The question-answering search model is a model trained on a target sample set that meets preset conditions. This target sample set includes a sample set obtained by fusing a first sample set and a second sample set. It is evident that the training samples of the question-answering search model employ at least two different types of samples, which increases sample diversity and enhances the model's learning breadth from the training samples. Furthermore, the first sample set is obtained by processing a historical dialogue dataset, and the second sample set is obtained by processing a historical dialogue dataset and labeled files. This improves the practicality and accuracy of the samples, thereby increasing the accuracy of the search answer. Attached Figure Description
[0024] To more clearly illustrate the technical solutions in the embodiments of this application or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0025] in:
[0026] Figure 1 A flowchart illustrating a question-and-answer search method provided in an embodiment of this application;
[0027] Figure 2 This is a schematic diagram of the structure of a question-and-answer search device provided in an embodiment of this application;
[0028] Figure 3 This is a schematic diagram of the structure of a computer device provided in an embodiment of this application. Detailed Implementation
[0029] To enable those skilled in the art to better understand the present application, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present application, and not all embodiments. All other embodiments obtained by those skilled in the art based on the embodiments of the present application without creative effort are within the scope of protection of the present application.
[0030] The terms "first," "second," etc., in the specification, claims, and accompanying drawings of this application are used to distinguish different objects, not to describe a specific order. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover non-exclusive inclusion. For example, a process, method, system, product, or apparatus that includes a series of steps or units is not limited to the listed steps or units, but may optionally include steps or units not listed, or may optionally include other steps or units inherent to these processes, methods, products, or apparatuses.
[0031] In this document, the term "embodiment" means that a particular feature, structure, or characteristic described in connection with an embodiment may be included in at least one embodiment of this application. The appearance of this phrase in various places throughout the specification does not necessarily refer to the same embodiment, nor is it a separate or alternative embodiment mutually exclusive with other embodiments. It will be explicitly and implicitly understood by those skilled in the art that the embodiments described herein can be combined with other embodiments.
[0032] The network architecture used in this application embodiment includes servers and electronic devices. This application embodiment does not limit the number of electronic devices and servers; a server can simultaneously provide services to multiple electronic devices. A server can be a standalone server or a cloud server providing basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, content delivery networks (CDNs), and big data and artificial intelligence platforms. Alternatively, a server cluster composed of multiple servers can be used.
[0033] Electronic devices can be personal computers (PCs), laptops, or smartphones, as well as all-in-one computers, PDAs, tablets, smart TVs, in-vehicle devices, or other portable devices. PC-based electronic devices, such as all-in-one computers, can have operating systems including, but not limited to, Linux, Unix, Windows (e.g., Windows XP, Windows 7), and Mac OS X. Mobile electronic devices, such as smartphones, can have operating systems including, but not limited to, Android, iOS, and Windows.
[0034] Electronic devices can install and run applications, and the server can be the server corresponding to the application installed on the electronic device, providing application services to the application. The application can be a standalone integrated application software, a mini-program embedded in other applications, or a system on a webpage, etc., without limitation. In this embodiment, the application can have a question-and-answer search function, such as a community question-and-answer application, which can be used to search for answers to questions and to accept answer input. The question-and-answer search function of the application can be included in the search function; for example, a browser has a search function, and answers to questions can be searched through the browser's search function. The business data for question searching involved in this application can include financial data, medical data, e-commerce data, etc., without limitation.
[0035] In this embodiment, questions and their answers can be pre-associated and stored. The collection containing questions and their answers can be called a pre-defined question-and-answer text library. This pre-defined question-and-answer text library can be stored in a block created on a blockchain network, ensuring data security while enabling data sharing across different platforms.
[0036] This application proposes a question-answering search method, which can be executed by a question-answering search device. This device can be implemented by software and / or hardware and is generally integrated into an electronic device or server. It can improve the diversity of samples, increase the learning breadth of the model on the training samples, and help improve the accuracy of the search answers.
[0037] Please refer to Figure 1 , Figure 1 This is a flowchart illustrating a question-and-answer search method provided in this application. Taking the application of this method on a server as an example, it includes the following steps S101 to S103, wherein:
[0038] S101: Obtain the target object's search request for the answer to the target question.
[0039] In this embodiment, the answer search request is used to search for an answer to a target question, and the searched answer can be referred to as the target answer. The answer search request can be obtained by converting text or voice input from an electronic device to the server by the target user, and is not limited thereto. This application does not limit the target user; it can be any registered user in the question-and-answer application, or a guest using the question application. This application also does not limit the target question; it can be any field composed of text and punctuation, or a field corresponding to a search query, etc.
[0040] The target problem can consist of characters and / or words. This application does not limit the method for segmenting characters and words, such as string matching-based segmentation methods, statistical segmentation methods, and understanding-based segmentation methods. For example, it can use segmentation tools like jieba or word2vec models. Jieba can perform word segmentation, part-of-speech tagging, and keyword extraction on Chinese text, and supports custom dictionaries. Word2vec models are a group of related models used to generate word vectors. While acquiring characters and / or words, the part-of-speech of each character and / or word can be obtained, such as nouns and verbs, as well as personal names, place names, organization names, etc., or adverbs, nouns and verbs, etc. Simultaneously, the meaning of each character and / or word can also be obtained, thereby determining the meaning of the character and / or word in the sentence, such as the target problem.
[0041] S102: Determine the textual features of the target problem.
[0042] In this application embodiment, the textual features of the target question may include character and / or word features, such as part-of-speech and word meaning. The textual features of the target question may also include features corresponding to the text of the target question, such as semantics and sentiment. The textual features of the target question may also include types such as the technical field of the question, which are not limited here. The technical field of the question can be classified according to business type, such as finance, healthcare, e-commerce, etc. The technical field of the question can also be classified according to discipline, such as information technology, biotechnology, new materials, energy technology, etc., which are not limited here. This application does not limit the number of technical fields; it may include one or more technical fields.
[0043] In some feasible examples, step S102 may include the following steps: determining the keywords in the target question and the technical field of the target question; determining the textual features of the target question based on the technical field and keywords.
[0044] Keywords can be words that influence the meaning of the target question. This application does not limit the method for determining keywords. Optionally, the target question can be segmented into multiple words, along with the meaning and part of speech of each word; keywords can then be selected from these multiple words based on their meaning and part of speech.
[0045] The word segmentation method is as described above and will not be repeated here. First, the weight corresponding to the part of speech of each word can be obtained. For example, the weight for verbs can be 1.3; the weight for adverbs can be 1.2; the weight for place nouns can be 1.4; the weight for demonstrative pronouns can be 0.7; and the weight for stop words can be 0.1, etc. The ratio between the meaning of each word and the semantics of the target question can also be obtained, for example, by obtaining the similarity value between word meaning and semantics, the proportion of identical characters, etc. Then, the weight corresponding to the part of speech of each word, and the ratio between the word meaning and the semantics of the target question, are weighted and calculated to obtain the key values of multiple words. Keywords are then selected from multiple words based on the magnitude of the key values; for example, the top N keywords with the highest values, where N can be greater than 1.
[0046] This application does not limit the number of keywords selected; a fixed preset value can be used, such as three. The number of keywords can be dynamically set based on the number of words obtained from word segmentation, or based on the number of parts of speech, etc. Keywords are selected based on the parts of speech and meanings of each word in the target question; that is, keywords are selected based on the actual scenario, which can improve the accuracy of keyword selection.
[0047] This application does not limit the method for determining the technical field. It can be determined by checking if there are nodes corresponding to keywords in knowledge graphs of various technical fields. If so, the technical field of the target problem is determined to be the technical field corresponding to that knowledge graph. Alternatively, it can be determined by searching for similar problems in labeled documents or a pre-set problem text library, and using those similar problems as the technical field of the target problem.
[0048] It's understandable that searching based on keywords related to the target question can improve search efficiency. Searching within the technical field can improve search accuracy. In this example, the textual features of the target question are determined based on its technical field and keywords. Identifying the textual features used, which include search keywords and technical fields, further improves search efficiency and accuracy.
[0049] S103: Input the text features into the question-answering search model to obtain the target answer.
[0050] In this embodiment, the question-answering search model is a model trained on a target sample set that meets preset conditions. This application does not limit the preset conditions; they may include training times exceeding a threshold, such as 50 times, or the number of training samples. Alternatively, preset conditions may include training accuracy exceeding a precision threshold, such as a loss function value less than 0.1, accuracy greater than 90%, and recall greater than 80%.
[0051] Target samples can include the sample set obtained by fusing the first and second sample sets. Target samples can also include labeled files, etc., without limitation. Labeled files can be text annotated manually, or text obtained based on a trained annotation model, etc. The labels of the labeled text can include the reference answer to the reference question, and can also include the sample type, such as: positive sample, negative sample, easy sample, hard sample, etc.
[0052] In this context, positive samples refer to samples of the target category that correspond to the ground truth, while negative samples refer to samples of all other target categories that do not correspond to the ground truth. For example, when detecting faces, faces are positive samples, while non-faces, such as nearby trees, flowers, or other objects, are negative samples.
[0053] A simple sample is one where the prediction error from the true label is small, while a difficult sample is one where the prediction error from the true label is large. For example, if the true label is [1,0,0], and the predicted probability distribution is [0.3,0.3,0.4], the difference from the true label is large, making this a difficult sample. Conversely, if the predicted probability distribution is [0.98,0.01,0.01], the difference from the true label is small, making this a simple sample.
[0054] The tagged text can be labeled with one or more tags. For example, the sample type can be negative samples and hard samples, etc. Hereinafter, negative samples and hard samples will be referred to as hard negative samples, and negative samples and easy samples will be referred to as easy negative samples. For example, an easy negative sample could be "I forgot my password," and an easy negative sample could be "What is my loan interest rate?".
[0055] This application does not limit the method of merging the first sample set and the second sample set. It can delete identical samples and expand the first sample set and the second sample set. For example, the supplementary samples can be samples obtained based on at least one of the first sample set and the second sample set.
[0056] In this embodiment, the first sample set can be a sample set obtained by processing a historical dialogue dataset. The historical dialogue dataset can include multiple historical dialogue data sets, each of which can be the dialogue content from a historical question-and-answer search process. The answers to the questions can be provided manually or obtained using a preset question-and-answer search model. In other words, the historical dialogue dataset contains questions raised by various users and answers obtained by various methods. Thus, the sample set obtained by processing the historical dialogue dataset includes not only questions but also answers, improving the practicality of the samples and thus enhancing search accuracy. The second sample set can be a sample set obtained by processing the historical dialogue dataset and labeled files. Processing the labeled files and historical dialogue dataset to obtain the second sample set improves the accuracy of the annotation, further enhancing search accuracy.
[0057] Optionally, both the first and second sample sets can be hard negative samples. This increases the number of hard negative samples, thereby increasing sample diversity and the breadth of the model's learning from the training samples, which helps improve the accuracy of the search results.
[0058] This application does not limit the method for obtaining the first sample set. In some feasible examples, the method also includes: analyzing the historical dialogue dataset to obtain a domain lexicon; filtering the domain lexicon to obtain a high-frequency domain lexicon; supplementing the domain lexicon to obtain a related domain lexicon; and constructing the first sample set based on the high-frequency domain lexicon and the related domain lexicon.
[0059] The domain lexicon includes words within the same technical field. The number of domain lexicons can be equal to the number of technical fields. When the question-answering search model involves multiple technical fields, multiple domain lexicons can be obtained. This application does not limit the method for analyzing the domain lexicon. It can process words in the historical dialogue dataset based on the point mutual information algorithm to obtain the relevance value of each word, and include words with relevance values greater than the association threshold as words in the domain lexicon.
[0060] The point mutual information algorithm is used to calculate the correlation between two words. The formula can be shown as (1).
[0061]
[0062] Among them, w 1, w1 and w2 represent words respectively. p(w1) is the probability of w1 appearing, and p(w2) is the probability of w2 appearing. p(w1) can be the ratio between the number of times w1 appears and the total number of times w2 appears, and p(w2) can be the ratio between the number of times w2 appears and the total number of times w1 appears. p(w1&2) represents w 1, The probability of the two words w2 appearing simultaneously can be expressed as w 1,w2 is the square of the ratio between the number of times two words appear together and the total number of words.
[0063] A higher PMI indicates a stronger correlation. For example, if the PMI(w) is higher... 1, If w2)>0, it means w 1, The terms w2 and w3 are related, and the larger the value, the stronger the correlation. If PMI(w2) 1, If w2) = 0, then it means w 1, The terms w2 and w2 are statistically independent, uncorrelated, and not mutually exclusive. If PMI(w 1, If w2) < 0, it means w 1, The words w2 and w2 are unrelated and mutually exclusive.
[0064] This application does not limit the association threshold; it can be a fixed value, such as 0. The association threshold can also be determined based on the average PMI, the number of words, etc. It can be understood that by calculating the correlation between adjacent characters and words, and between words, using the point mutual information algorithm, frequently occurring words can be obtained. These frequently occurring words can be used as domain-specific vocabulary, which, compared to a general-purpose thesaurus, improves specialization and is beneficial for improving the performance of downstream tasks.
[0065] In this application embodiment, the high-frequency domain lexicon refers to high-frequency words in the domain lexicon. This application does not limit the method for obtaining the high-frequency domain lexicon. In some feasible examples, filtering the domain lexicon to obtain the high-frequency domain lexicon may include the following steps: obtaining the vector representation of each domain word in the domain lexicon; clustering the vector representations of the domain words to obtain at least two types of domain word clusters; obtaining the frequency of each type of domain word cluster; and forming the high-frequency domain lexicon by grouping the domain word clusters with frequencies greater than a frequency threshold.
[0066] Vector representation can be understood as word encoding of domain terms, which can be used to transform text into a numerical matrix through data transformation or mapping. Vector representation can be obtained through word encoding using the word2vec algorithm, or through summarization extraction, or through statistical language model algorithms. Statistical language models can be n-grams, whose basic idea is to perform a sliding window operation of size n on the content of the text according to bytes, forming a sequence of byte segments (grams) of length n. The frequency of occurrence of all grams is statistically analyzed, and filtered according to a pre-set threshold to form a list of key grams, i.e., the vector feature space of the text.
[0067] Clustering is the process of dividing a dataset into different classes or clusters based on a specific label, such as distance, so that the similarity of data objects within the same cluster is maximized, while the differences between data objects in different clusters are also maximized. In other words, after clustering, data of the same class should be grouped together as much as possible, while data of different classes should be separated as much as possible. This application does not limit the type of vector representation and clustering algorithm. Clustering algorithms can include hierarchical clustering, k-means clustering, density-based clustering (ordering points to identify the clustering structure, OPTICS), density-based spatial clustering of applications with noise (DBSCAN), sparse matrix clustering such as spectral clustering, etc.
[0068] The frequency of domain term clusters can be obtained statistically from the frequencies of various domain terms, such as by calculating the average or weighted average. This application does not impose a limit on the frequency threshold; it can be a fixed value, such as 0.6. Alternatively, the frequency threshold can be determined based on the average frequency of domain term clusters, the number of domain term clusters, etc.
[0069] It is understandable that selecting high-frequency domain word clusters based on the frequency of the domain word clusters obtained by clustering the vector representations of each domain word in the domain lexicon can improve the accuracy of screening high-frequency domain lexicons and further enhance the professionalism of the selected domain words, which is conducive to improving the effect of sample training.
[0070] In this application embodiment, the associated domain lexicon refers to words related to the domain lexicon but outside of it, which may include similar words or replaceable words. This application does not limit the method for obtaining associated domain words. In some feasible examples, supplementing the domain lexicon to obtain the associated domain lexicon may include the following steps: finding replacement words for each domain word in the domain lexicon according to preset rules corresponding to the domain type; obtaining similar words for each domain word in the domain lexicon; and supplementing the domain lexicon with the replacement words and similar words to obtain the associated domain lexicon.
[0071] The domain type of the domain thesaurus can be any of the aforementioned technical fields. The preset rules corresponding to the domain type refer to the pre-defined search rules. Search rules can include search granularity and search scope. For example, the phrases "
Help me check my account
[0072] Search rules can include search thresholds. For example, similar words can be the top K samples most similar to domain words, where K can be 5 in the customer service domain and 10 in the medical domain. Another example is the recall rate of similar words, which can be 40%–60% in the customer service domain and 50%–60% in the medical domain.
[0073] This application does not limit the method for finding similar words. You can send domain-specific words into the BM25 coarse ranking module for acquisition, or you can search for similar words in the knowledge graph corresponding to the domain type.
[0074] It is understandable that by finding replacement words for each domain term according to the preset rules corresponding to the domain type in the domain thesaurus, and also obtaining similar words from the domain thesaurus, the replacement words and similar words can be added to the domain thesaurus. This allows for the addition of replacement words with different meanings from domain terms, as well as similar words with similar meanings to domain terms, thereby increasing the diversity of samples and improving the training effect.
[0075] This application does not limit the method for constructing the first sample set based on the high-frequency domain lexicon and the related domain lexicon. In some feasible examples, constructing the first sample set based on the high-frequency domain lexicon and the related domain lexicon may include the following steps: finding the target historical dialogue dataset containing at least one domain word from the domain lexicon in the historical dialogue dataset; constructing a first subsample containing at least one domain word from the high-frequency domain lexicon based on the target historical dialogue data; replacing the domain words in the target historical dialogue data according to each domain word in the related domain lexicon to obtain multiple second subsamples; and fusing the first subsample and the second subsample to obtain the first sample set.
[0076] The target historical dialogue dataset consists of historical dialogue data containing at least one domain-specific word. The first subsample contains at least one domain-specific word from a high-frequency domain-specific vocabulary and is obtained by processing the target historical dialogue data. The first subsample can be obtained by randomly sampling the target historical dialogue data, shuffling it, and then combining the results.
[0077] The second subsample contains at least one domain word from the associated domain lexicon and is obtained by replacing the target historical dialogue data. In other words, domain words in the target historical dialogue data are replaced with domain words from the associated domain lexicon. Domain words in the associated domain lexicon can be called associated domain words, and the replaced associated domain words can be determined based on the domain word to be replaced. For example, the replaced associated domain words can be similar words or replacement words of the domain word to be replaced. The fusion method for the first and second subsamples can include deleting identical subsamples, or further expanding the first and second subsample sets, etc., which are not limited here.
[0078] It is understandable that a first subsample containing at least one domain word from a high-frequency domain lexicon is constructed based on the target historical dialogue data, and multiple second subsamples are obtained by replacing the domain words in the target historical dialogue data with at least one domain word from an associated domain lexicon. The first and second subsamples are then merged to obtain the first sample set. This improves the diversity of the samples. Processing the historical dialogue dataset to obtain the first sample set enhances the practicality of the annotation.
[0079] This application does not limit the method for obtaining the second sample set. In some feasible examples, it may also include the following steps: selecting reference samples corresponding to a preset sample type from the labeled file; obtaining the similarity value between each historical dialogue data and the reference sample in the historical dialogue dataset; and filtering out historical dialogue datasets with similarity values greater than the similarity threshold from the historical dialogue dataset to obtain the second sample set.
[0080] The reference samples corresponding to the preset sample types can be the aforementioned positive samples, negative samples, simple samples, difficult samples, etc. Optionally, the reference samples are negative samples, and the second sample set is difficult samples. The method for selecting reference samples can be based on the labels in the labeled files; or the labeled files can be clustered, with clusters with high similarity values used as positive samples and clusters with low similarity values used as negative samples; or the intent of historical dialogue data can be identified, with those having the same intent used as positive samples and those having different intents used as negative samples, etc. There are no restrictions on the method for selecting reference samples here.
[0081] This application does not limit the method for obtaining the similarity value between historical dialogue data and reference samples; methods such as Jaccard similarity coefficient, edit distance, recall-oriented understudy for gisting evaluation (rouge), and term frequency-inverse document frequency (TF-IDF) can be used. The Jaccard similarity coefficient describes the degree of similarity between two samples; a larger Jaccard similarity coefficient indicates greater similarity. Edit distance is a metric used to measure the similarity between two sequences. The rouge metric is a common evaluation metric in machine translation, automatic summarization, and question answering generation. The rouge metric calculates a score by comparing the model-generated summary or answer with a reference answer (usually manually generated). TF-IDF is used to evaluate the importance of a word to a document within a document set or corpus.
[0082] The following example uses the Jaccard similarity coefficient. The formula for calculating the Jaccard similarity coefficient J(A,B) is shown in (2).
[0083]
[0084] Here, A and B are two samples to be compared. |∩B| represents the characters or words that intersect between samples A and B, and |A|+|B|-|A∩B| represents the union of the characters or words between samples A and B.
[0085] The process involves first selecting reference samples corresponding to a preset sample type from the labeled files, then obtaining the similarity value between each historical dialogue data point and the reference sample in the historical dialogue dataset. Next, a second sample set is obtained by filtering historical dialogue datasets whose similarity values are greater than a similarity threshold. In other words, finding similar samples based on preset sample types in the labeled files improves the accuracy of the annotation and enhances the precision of the search.
[0086] Optionally, after obtaining the target sample set, the process may further include sending the target sample set to the review recipient. The review recipient can be an annotator or an annotation model, etc. In this way, after receiving the target sample set, the review recipient can verify the target sample set, which helps improve the accuracy of sample annotation.
[0087] Optionally, the target sample set can be hard negative samples. In this way, easy negative samples can be filtered out from the historical dialogue dataset, and hard negative samples can be labeled and trained. This reduces the number of target samples, improves the efficiency and effectiveness of labeling, and helps to improve the accuracy of answer search.
[0088] exist Figure 1 In the question-answering search method shown, after obtaining the target object's search request for an answer to the target question, the text features of the target question can be determined first. These text features are then input into the question-answering search model to obtain the target answer. The question-answering search model is a model trained on a target sample set that meets preset conditions. This target sample set includes a sample set obtained by fusing a first sample set and a second sample set. It is evident that the training samples of the question-answering search model use at least two different types of samples, which increases sample diversity and improves the model's learning breadth from the training samples. Furthermore, the first sample set is obtained by processing a historical dialogue dataset, and the second sample set is obtained by processing a historical dialogue dataset and labeled files. This improves the practicality and accuracy of the samples, thus contributing to higher accuracy in the searched answers.
[0089] The methods of the embodiments of this application have been described in detail above, and the apparatus of the embodiments of this application is provided below.
[0090] and Figure 1 The embodiments shown are consistent; please refer to them. Figure 2 , Figure 2 This is a schematic diagram of the structure of a question-and-answer search device proposed in this application. Figure 2 As shown, the question-and-answer search device 200 includes:
[0091] Communication unit 201 is used to obtain the target object's search request for the answer to the target question;
[0092] Processing unit 202 is used to determine the text features of the target question; input the text features into the question-answering search model to obtain the target answer; wherein, the question-answering search model is a model that meets preset conditions and is trained based on the target sample set. The target sample set includes a sample set obtained by fusing the first sample set and the second sample set. The first sample set is a sample set obtained by processing historical dialogue data, and the second sample set is a sample set obtained by processing historical dialogue data and labeled files.
[0093] In one possible example, the processing unit 202 is also used to analyze the historical dialogue dataset to obtain a domain lexicon; filter the domain lexicon to obtain a high-frequency domain lexicon; supplement the domain lexicon to obtain a related domain lexicon; and construct a first sample set based on the high-frequency domain lexicon and the related domain lexicon.
[0094] In one possible example, the processing unit 202 is specifically used to obtain the vector representation of each domain word in the domain lexicon; cluster the vector representations of the domain words to obtain at least two types of domain word clusters; obtain the frequency of each type of domain word cluster; and form a high-frequency domain lexicon by combining the domain word clusters with frequencies greater than the frequency threshold.
[0095] In one possible example, the processing unit 202 is specifically used to find the replacement word for each domain word in the domain thesaurus according to the preset rules corresponding to the domain type of the domain thesaurus; obtain the similar words for each domain thesaurus in the domain thesaurus; and supplement the replacement word and similar word to the domain thesaurus to obtain the associated domain thesaurus.
[0096] In one possible example, the processing unit 202 is specifically used to find the target historical dialogue dataset containing at least one domain word in the domain lexicon from the historical dialogue dataset; construct a first subsample containing at least one domain word in the high-frequency domain lexicon based on the target historical dialogue data; replace the domain word in the target historical dialogue data with at least one domain word in the associated domain lexicon to obtain multiple second subsamples; and fuse the first subsample and multiple second subsamples to obtain a first sample set.
[0097] In one possible example, the processing unit 202 is also used to select reference samples corresponding to a preset sample type from the labeled file; obtain the similarity value between each historical dialogue data and the reference sample in the historical dialogue dataset; and filter out historical dialogue datasets with similarity values greater than the similarity threshold from the historical dialogue dataset to obtain a second sample set.
[0098] In one possible example, the processing unit 202 is specifically used to determine the keywords in the target question and the technical field of the target question; and to determine the text features of the target question based on the technical field and keywords.
[0099] For details on the execution process of each unit in the question-and-answer search device 200, please refer to the execution steps in the aforementioned method embodiment, which will not be repeated here.
[0100] and Figure 1 The implementation method is the same as above; please refer to [the example]. Figure 3 , Figure 3 This is a schematic diagram of the structure of a computer device provided in an embodiment of this application. Figure 3 As shown, the computer device 300 includes a processor 310, a memory 320, a communication interface 330, and one or more programs 340. The processor 310, memory 320, and communication interface 330 are interconnected via a bus 350. Figure 2 The functions implemented by the communication unit 201 shown can be realized through the communication interface 330. Figure 2The related functions implemented by the processing unit 202 shown can be implemented by the processor 310.
[0101] One or more programs 340 are stored in the memory 320 and configured to be executed by the processor 310. Each program 340 includes instructions for performing the following steps:
[0102] Retrieve the search request for the answer to the target question from the target object;
[0103] Identify the textual features of the target problem;
[0104] Text features are input into a question-answering search model to obtain the target answer. The question-answering search model is a model that meets preset conditions and is trained based on a target sample set. The target sample set includes a sample set obtained by fusing a first sample set and a second sample set. The first sample set is a sample set obtained by processing a historical dialogue dataset, and the second sample set is a sample set obtained by processing a historical dialogue dataset and labeled files.
[0105] In one possible example, program 340 is also used to perform instructions for the following steps:
[0106] By analyzing historical dialogue datasets, a domain-specific thesaurus is obtained.
[0107] The domain terminology is filtered to obtain a high-frequency domain terminology;
[0108] Supplementing the domain thesaurus yields a related domain thesaurus;
[0109] The first sample set is constructed based on the high-frequency domain thesaurus and the related domain thesaurus.
[0110] In one possible example, in filtering the domain thesaurus to obtain a high-frequency domain thesaurus, program 340 specifically performs the following instructions:
[0111] Obtain the vector representation of each domain word in the domain thesaurus;
[0112] Clustering the vector representations of domain words yields at least two domain word clusters;
[0113] Obtain the frequency of word clusters in various fields;
[0114] Domain term clusters with frequencies greater than a frequency threshold are compiled into a high-frequency domain term library.
[0115] In one possible example, in supplementing the domain thesaurus to obtain an associated domain thesaurus, program 340 also provides instructions to perform the following steps:
[0116] Find the target historical dialogue dataset containing at least one domain term from the domain thesaurus within the historical dialogue dataset;
[0117] Based on the preset rules corresponding to the domain type of the domain thesaurus, find the replacement words and / or similar words for each domain word in the domain thesaurus to obtain the associated domain thesaurus.
[0118] In one possible example, in constructing the first sample set based on the high-frequency domain lexicon and the related domain lexicon, program 340 specifically performs the following instructions:
[0119] Based on the target historical dialogue data and the preset sample type, construct the first sub-sample containing a high-frequency domain lexicon;
[0120] Based on the relevant domain thesaurus, domain words in the target historical dialogue data are replaced to obtain the second subsample;
[0121] The first subsample and the second subsample are merged to obtain the first sample set.
[0122] In one possible example, program 340 is also used to perform instructions for the following steps:
[0123] Select negative samples from the labeled files;
[0124] Obtain the similarity value between each historical dialogue data point and a negative sample in the historical dialogue dataset;
[0125] The second sample set is obtained by filtering out historical dialogue datasets from the historical dialogue datasets whose similarity values are greater than the similarity threshold.
[0126] In one possible example, in determining the textual features of the target question, program 340 is specifically configured to perform the following steps:
[0127] Identify the keywords and technical fields of the target problem;
[0128] The textual features of the target question are determined based on the technical field and keywords.
[0129] This application also provides a computer storage medium, wherein the computer storage medium stores a computer program that causes a computer to perform some or all of the steps of any of the methods described in the method embodiments, the computer including an electronic device and a server.
[0130] This application also provides a computer program product, which includes a non-transitory computer-readable storage medium storing a computer program operable to cause a computer to execute some or all of the steps of any of the methods described in the method embodiments. The computer program product may be a software installation package, and the computer may include electronic devices and servers.
[0131] It should be noted that, for the sake of simplicity, the foregoing method embodiments are all described as a series of actions. However, those skilled in the art should understand that this application is not limited to the described order of actions, as some steps may be performed in other orders or simultaneously according to this application. Furthermore, those skilled in the art should also understand that the embodiments described in the specification are preferred embodiments, and the actions and modes involved are not necessarily essential to this application.
[0132] In the above embodiments, the descriptions of each embodiment have different focuses. For parts not described in detail in a certain embodiment, please refer to the relevant descriptions in other embodiments.
[0133] In the several embodiments provided in this application, it should be understood that the disclosed apparatus can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative; for instance, the division of units is only a logical functional division, and in actual implementation, there may be other division methods. For example, at least one unit or component may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the mutual coupling or direct coupling or communication connection shown or discussed may be through some interfaces; the indirect coupling or communication connection between apparatuses or units may be electrical or other forms.
[0134] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across at least one network unit. Some or all of the units can be selected to achieve the purpose of this embodiment, depending on actual needs.
[0135] Furthermore, the functional units in the various embodiments of this application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or in software program mode.
[0136] If the integrated unit is implemented in the form of a software program and sold or used as an independent product, it can be stored in a computer-readable storage device (CMD). Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or all or part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a memory and includes several instructions to cause a computer (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods of the various embodiments of this application. The aforementioned memory includes various media capable of storing program code, such as a USB flash drive, read-only memory (ROM), random access memory (RAM), portable hard drive, magnetic disk, or optical disk.
[0137] The embodiments of this application have been described in detail above. Specific examples have been used to illustrate the principles and implementation methods of this application. The description of the above embodiments is only for the purpose of helping to understand the method and core ideas of this application. At the same time, for those skilled in the art, there will be changes in the specific implementation methods and application scope based on the ideas of this application. Therefore, the content of this specification should not be construed as a limitation of this application.
Claims
1. A question-and-answer search method, characterized in that, include: Retrieve the search request for the answer to the target question from the target object; Determine the textual features of the target problem; The text features are input into the question-answering search model to obtain the target answer; wherein, the question-answering search model is a model that meets preset conditions and is trained based on the target sample set. The target sample set includes a sample set obtained by fusing a first sample set and a second sample set. The first sample set is a sample set obtained by processing a historical dialogue dataset, and the second sample set is a sample set obtained by processing the historical dialogue dataset and labeled files. The historical dialogue dataset is analyzed to obtain a domain lexicon; The domain terminology is filtered to obtain a high-frequency domain terminology. Supplementing the aforementioned domain thesaurus yields a related domain thesaurus; The first sample set is constructed based on the high-frequency domain lexicon and the related domain lexicon; Select a reference sample corresponding to the preset sample type from the labeled file; Obtain the similarity value between each historical dialogue data in the historical dialogue dataset and the reference sample; The second sample set is obtained by filtering out historical dialogue datasets from the historical dialogue dataset whose similarity value is greater than the similarity threshold.
2. The method according to claim 1, characterized in that, The process of filtering the domain terminology to obtain a high-frequency domain terminology includes: Obtain the vector representation of each domain word in the domain lexicon; Clustering the vector representations of the domain words yields at least two domain word clusters; Obtain the frequency of each of the aforementioned domain term clusters; The domain word clusters with frequencies greater than the frequency threshold are used to form a high-frequency domain word library.
3. The method according to claim 1, characterized in that, The process of supplementing the domain lexicon to obtain a related domain lexicon includes: Based on the preset rules corresponding to the domain type of the domain thesaurus, find the replacement word for each domain word in the domain thesaurus; Obtain similar words for each domain terminology in the domain terminology database; The replacement words and similar words are added to the domain lexicon to obtain the associated domain lexicon.
4. The method according to claim 2, characterized in that, The step of constructing the first sample set based on the high-frequency domain lexicon and the related domain lexicon includes: Find the target historical dialogue dataset containing at least one domain term from the domain lexicon in the historical dialogue dataset; Based on the target historical dialogue data, construct a first subsample containing at least one domain word from the high-frequency domain lexicon; Based on at least one domain word in the associated domain lexicon, the domain word in the target historical dialogue data is replaced to obtain multiple second sub-samples; The first sub-sample and the plurality of second sub-samples are fused to obtain the first sample set.
5. The method according to any one of claims 1-4, characterized in that, The determination of the text features of the target question includes: Identify the keywords in the target problem and the technical field of the target problem; The textual features of the target question are determined based on the technical field and the keywords.
6. A question-and-answer search device, characterized in that, Includes units for performing the method as described in any one of claims 1-5.
7. A computer device, characterized in that, The method includes a processor, a memory, a communication interface, and one or more programs, wherein the one or more programs are stored in the memory and configured to be executed by the processor, the programs including instructions for performing the steps of the method of any one of claims 1-5.
8. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program that causes a computer to perform the method according to any one of claims 1-5.