Data processing method and device, electronic equipment and storage medium
By obtaining reference examples with high similarity from the example set, building input statements and obtaining label information under the target model, the problem of insufficient semantic comprehension ability of the voice assistant is solved, and more accurate comprehension of speech and text data is achieved, which is suitable for a variety of purposes Business scenario.
Patent Information
- Application Number
- CN202310827900.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-07-06
- Publication Date
- 2025-01-10
AI Technical Summary
Existing voice assistants have room for improvement in semantic comprehension capabilities, and it is difficult to accurately understand the user's voice and text data intentions.
By obtaining reference examples with similarity satisfies preset conditions from the example set, building input statements, and obtaining label information of the original statement under the guidance of the target model, thereby improving semantic understanding. This method utilizes the reasoning ability of large language models and small sample learning ability, combining cluster analysis and feature extraction to construct high-quality example sets to assist model understanding.
It realizes a more accurate understanding of the original sentence under the guidance of reference examples, improves the semantic understanding ability of the voice assistant, and can handle user intentions more accurately. It is suitable for various business scenarios such as navigation and listening to music.
Smart Images

Figure CN119293150A_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of data processing, and in particular to the fields of artificial intelligence, voice technology, and intelligent search. Background Art
[0002] Voice assistants are widely used in speakers, mobile phones, and car systems. Semantic understanding is one of the core capabilities of voice assistants. By understanding the semantics of user voices and realizing intelligent interaction, users can solve problems. Currently, there is still room for improvement in semantic understanding capabilities. Summary of the invention
[0003] The present disclosure provides a data processing method, device, electronic device and storage medium.
[0004] According to one aspect of the present disclosure, there is provided a data processing method, comprising:
[0005] Obtaining a reference example of the original sentence from the example set, wherein the similarity between the reference example and the original sentence meets a preset condition; and the reference example contains annotation information for understanding the reference example;
[0006] Construct input sentences based on reference examples and original sentences;
[0007] Inputting the input sentence into the target model, and obtaining the annotation information of the original sentence output by the target model under the guidance of the reference example;
[0008] Based on the original statement and the annotation information of the original statement, business response data of the original statement is obtained.
[0009] According to another aspect of the present disclosure, there is provided a data processing device, comprising:
[0010] A first acquisition module is used to acquire a reference example of the original sentence from the example set, wherein the similarity between the reference example and the original sentence meets a preset condition; and the reference example contains annotation information for understanding the reference example;
[0011] A first construction module is used to construct an input sentence based on a reference example and an original sentence;
[0012] An input module, used to input an input sentence into a target model, and obtain annotation information of an original sentence output by the target model under the guidance of a reference example;
[0013] The second acquisition module is used to acquire the business response data of the original statement based on the original statement and the annotation information of the original statement.
[0014] According to another aspect of the present disclosure, there is provided an electronic device, comprising:
[0015] at least one processor; and
[0016] a memory communicatively connected to the at least one processor; wherein,
[0017] The memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to execute the method of any embodiment of the present disclosure.
[0018] According to another aspect of the present disclosure, a non-transitory computer-readable storage medium storing computer instructions is provided, wherein the computer instructions are used to enable the computer to execute the method according to any embodiment of the present disclosure.
[0019] According to another aspect of the present disclosure, a computer program product is provided, including a computer program. When the computer program is executed by a processor, the method according to any one of the embodiments of the present disclosure is implemented.
[0020] The disclosed embodiments can more accurately understand the original sentence under the guidance of the reference examples.
[0021] It should be understood that the content described in this section is not intended to identify the key or important features of the embodiments of the present disclosure, nor is it intended to limit the scope of the present disclosure. Other features of the present disclosure will become easily understood through the following description. BRIEF DESCRIPTION OF THE DRAWINGS
[0022] The accompanying drawings are used to better understand the present solution and do not constitute a limitation of the present disclosure.
[0023] Figure 1 is a flowchart of a data processing method according to an embodiment of the present disclosure;
[0024] Figure 2 is a schematic diagram of a process for constructing an example set according to an embodiment of the present disclosure;
[0025] Figure 3 is a schematic diagram of a class cluster according to an embodiment of the present disclosure;
[0026] Figure 4 is a schematic diagram of a data processing method according to an embodiment of the present disclosure;
[0027] Figure 5 is a schematic diagram of a navigation scenario according to an embodiment of the present disclosure;
[0028] Figure 6 is a structural schematic diagram of a data processing device according to an embodiment of the present disclosure;
[0029] Figure 7 is a structural schematic diagram of a data processing device according to another embodiment of the present disclosure;
[0030] Figure 8 It is a block diagram of an electronic device used to implement the data processing method of the embodiment of the present disclosure. DETAILED DESCRIPTION
[0031] The following is a description of exemplary embodiments of the present disclosure in conjunction with the accompanying drawings, including various details of the embodiments of the present disclosure to facilitate understanding, which should be considered as merely exemplary. Therefore, it should be recognized by those of ordinary skill in the art that various changes and modifications may be made to the embodiments described herein without departing from the scope of the present disclosure. Similarly, for the sake of clarity and conciseness, the description of well-known functions and structures is omitted in the following description.
[0032] In addition, the terms "first" and "second" are used for descriptive purposes only and should not be understood as indicating or implying relative importance or implicitly indicating the number of technical features indicated. Therefore, a feature defined as "first" or "second" may explicitly or implicitly include one or more of the features. In the description of the present disclosure, the meaning of "plurality" is two or more, unless otherwise clearly and specifically defined.
[0033] Voice assistants are widely used in speakers, mobile phones, car systems and other fields. Semantic understanding is one of the core capabilities of voice assistants. The semantic understanding of user voice or text data can realize intelligent interaction with users and help users solve problems.
[0034] like Figure 1 As shown, the data processing method proposed in the embodiment of the present disclosure includes:
[0035] S101, obtaining a reference example of the original sentence from an example set, wherein the similarity between the reference example and the original sentence meets a preset condition; and the reference example contains annotation information for understanding the reference example.
[0036] The original sentence may be text transcribed from the voice input by the user, or may be text directly input by the user, which is not limited in the present disclosure.
[0037] During implementation, the feature vector of the original sentence can be extracted, and the similarity can be calculated with the feature vectors of the examples in the example set.
[0038] The preset condition may be that the similarity between the two is greater than or equal to a preset threshold, or multiple examples may be ranked from large to small according to the similarity, and a preset number of examples ranked first are selected as reference examples.
[0039] For example, for a map application, the original sentence used for input is "how to get to People's Park". Assuming that the route to "People's Park" based on big data analysis will also end at "Red Star Square", the reference example can be "navigation to Red Star Square". That is, in a navigation application, for POIs with a containment relationship, if the target POI is a large geographical range, the POIs with a smaller geographical range that it contains can be used as similar reference examples.
[0040] S102, constructing an input sentence based on the reference example and the original sentence.
[0041] S103: Input the input sentence into the target model, and obtain the annotation information of the original sentence output by the target model under the guidance of the reference example.
[0042] S104, based on the annotation information of the original sentence, obtaining the business response data of the original sentence.
[0043] In the navigation scenario, taking the original sentence "Navigate to People's Park" as an example, the processing result obtained based on the above reference example is ">naviControl / LBS_ROUTE / poi=People's Park", where "naviControl" indicates that the domain of the original sentence is the navigation domain, and "LBS_ROUTE" indicates the route to the location. The business response data obtained based on the processing result is the navigation route to People's Park.
[0044] In the embodiments of the present disclosure, by obtaining reference examples similar to the original sentence, it is equivalent to obtaining multiple description methods of the original sentence, which allows the model to better understand the intention of the original sentence. In addition, by annotating the reference examples, the model can be guided to annotate the original sentence, and further generate the original sentence's own annotation information to assist in understanding the original sentence. In summary, the embodiments of the present disclosure can more accurately understand the original sentence under the guidance of the reference examples.
[0045] In the disclosed embodiments, a data processing method is proposed, which can make good use of the reasoning ability and small sample learning ability of large language models (LLMs), where the large language model can understand the model on a large scale or can be trained on a large number of samples. Based on the large model, accurate semantic understanding can be achieved.
[0046] In the embodiment of the present disclosure, the quality of the reference examples will affect the accuracy of the semantic understanding of the original sentence. In order to obtain a reasonable example set, the embodiment of the present disclosure constructs the example set based on the following method: Figure 2 As shown, including:
[0047] S201, obtaining an original data set.
[0048] In some embodiments, the original data set is an unlabeled original data set.
[0049] During implementation, user data can be collected with the user's permission to obtain the original data set.
[0050] For each service, such as navigation service and music service, each service can provide voice interaction function respectively. For each service, users have various ways to express the same intention, and the user's intention is also various. In order to obtain high-quality examples from a large amount of raw data, in S202, the embodiment of the present disclosure performs cluster analysis on the raw data set to obtain multiple clusters. In order to find representative examples.
[0051] In some embodiments, S202 may be implemented as follows:
[0052] Step A1: perform word segmentation on the original data set to obtain entity words.
[0053] Among them, the forward maximum matching method (FMM) can be used to perform word segmentation on the original data. The backward maximum matching method (BMM) and the bidirectional maximum matching method can be used to perform word segmentation on the original data set. Named entity recognition (NER) can also be used to obtain entity words, and the BIO (Begin, Inside, Outside, phrase start, phrase inside, not in phrase) annotation method can be used to annotate the entity words.
[0054] Of course, the specific method of word segmentation processing is not limited in the embodiments of the present disclosure, and it only needs to be able to identify entity words in the original data set.
[0055] In order to find more general and representative examples, in the embodiment of the present disclosure, in step A2, the entity words of the target category are replaced with general labels to obtain an intermediate data set.
[0056] The types of entity words include names of people, place names, etc. Taking navigation as an example, the target type may be a place name. Taking listening to music as an example, the target type may be a name of a person or a song name.
[0057] Taking navigation as an example, the navigation location usually includes POI (Point of Interest). For place names, the general tag can be <poi>For example, the original sentence is "Navigate to People's Park", and the poi in the sentence is "People's Park". The intermediate data after replacing it with a common label is "Navigate to <poi>”.
[0058] Step A3: extract features from the intermediate data set to obtain text features of multiple sentences in the intermediate data set.
[0059] Among them, models such as Sentence-BERT model (Sentence Bidirectional Encoder Representation from Transformers, pre-trained language representation model) and GPT-3 (Generative Pre-Training model) can be used for feature extraction.
[0060] Step A4: cluster analysis is performed on the intermediate data set based on the text features of the multiple sentences to obtain multiple clusters.
[0061] In one possible implementation, cluster analysis can be performed on the intermediate data set based on the Kmeans++ clustering method to obtain multiple clusters. For example, a sample point is randomly selected from the original data set as the first initial cluster center; the distance between each sample point and the cluster center is calculated; the sample point farthest from the cluster center is selected as the next cluster center, and the above steps are repeated until the cluster centers of all clusters are obtained.
[0062] In the disclosed embodiment, the entity words in the original data are replaced with universal tags, which can not only reduce the difficulty of unsupervised clustering, but also eliminate the influence of specific entity words, and only focus on the universal core intent. Furthermore, when the text feature extraction is performed later, representative features can be extracted, so that representative clusters can be obtained in cluster analysis.
[0063] In some other embodiments, in addition to obtaining multiple clusters based on Kmeans++, it is also possible to: perform hierarchical clustering on the original data set to obtain multiple clusters. Meanwhile, step A4 can also be implemented as obtaining multiple clusters based on hierarchical clustering.
[0064] Hierarchical clustering is a type of clustering algorithm that clusters data points by calculating the distance between different categories. The smaller the distance, the higher the similarity between the data points, and the higher the probability of being in the same cluster. A clustering tree can be constructed based on hierarchical clustering. In the clustering tree, the original data points of different categories are the bottom layer of the tree, and the top layer of the tree is a root node.
[0065] Hierarchical clustering can accurately identify subcategories under parent categories. Under a large category, there can be multiple cluster centers at the same time, which can make up for the problem that the cluster center of a large category cannot describe more subcategories well. It helps to analyze the clusters of small categories and provide data guarantee for extracting examples of different categories.
[0066] In hierarchical clustering, subcategories can be divided based on the average distance between clusters so that the similarity between data in the same cluster is higher and the similarity between data in different categories is lower.
[0067] Among them, the average distance can be used to find the root node in the clustering tree. The average distance is also called the average-linkage algorithm. The average distance between clusters C1 and C2 is equal to the average distance of all sample pairs in the two clusters. This method can be shown as expression (1):
[0068]
[0069] Where dist(C1, C2) represents the average distance between all pairs of samples in cluster C1 and cluster C2, |C1| represents the number of samples in cluster C1, |C2| represents the number of samples in cluster C2, P i represents the i-th sample data in cluster C1, P j Represents the jth sample data in cluster C2.
[0070] The sum of squared deviations can be used to determine the similarity between small classes in each cluster. This method can effectively avoid the influence of noise between small classes. The sum of squared deviations is also called the average-linkage algorithm, and its calculation method can be shown in expression (2):
[0071]
[0072] Among them, dist(C1, C2) represents the distance between cluster C1 and cluster C2, |C1| represents the number of samples in cluster C1, |C2| represents the number of samples in cluster C2, P i represents the i-th sample data in cluster C1, P j Represents the jth sample data in cluster C2.
[0073] S203, down-sampling the multiple clusters to obtain multiple representative sample data.
[0074] In some embodiments, since the original data set has a large amount of data, if too many examples are sampled from it, storage resources will be wasted. Moreover, when retrieving reference examples for the original sentence, accessing too much data may increase the retrieval time. Therefore, the embodiment of the present disclosure comprehensively considers storage resources and retrieval efficiency, and can downsample multiple clusters to extract representative sample data as much as possible to construct an example set.
[0075] In some embodiments, taking the extraction of representative sample data from one of the clusters as an example, the amount of sample data near the cluster center may be required to be higher than the amount of sample data in the data far from the cluster center. Since this sampling method can downsample the clusters to obtain multiple representative sample data, it can also be implemented as follows:
[0076] Step B1, determining weights of multiple clusters.
[0077] Each sub-class in the cluster can be weighted based on the Huffman Tree. Figure 3 As shown in , the first cluster includes multiple subclasses, and each subclass includes at least one sample data. Each subclass has a corresponding weight, that is, the weights of the sample data in the subclass are consistent. The sample data in the subclass close to the cluster center can be given a larger weight, such as Figure 3 In the D-type sample data, the data far away from the cluster center is given a smaller weight, such as Figure 3 The A-type sample data in .
[0078] The weights can be labeled using a continuous value interval, that is, the weights are between [0, 1]. Figure 3 As shown, the weight of the D-type sample data can be set to 0.8, and the weight of the A-type sample data can be set to 0.2.
[0079] In another embodiment, the subclasses may be labeled with a weight of 0 to 10, where a weight of 10 indicates that the cluster is the most important, and a weight of 9 indicates that the cluster is less important than the cluster with a weight of 10. Similarly, a weight of 0 indicates that the sample data in the cluster is not important.
[0080] In addition, the weight of a cluster can be determined based on the number of samples in the cluster. The weight can be assigned according to the rule that the more samples, the greater the weight. Moreover, the sum of the weights of the clusters under the same root node is 1.
[0081] Of course, any notation that can represent weights can be applied to the embodiments of the present disclosure, and the present disclosure does not limit this.
[0082] Step B2, based on the sampling rule that the greater the weight, the more sampled data, multiple sample data are downsampled from multiple clusters.
[0083] Or Figure 3 As shown, assuming that there are 30 sample data in class D, 30 sample data in class B, 20 sample data in class C, and 10 sample data in class A. Then the sample data obtained by sampling may be 5 sample data in class D, 2 sample data in class B, 1 sample data in class C, and 1 sample data in class A. Of course, the above sampling values are only for exemplary description, and the present disclosure does not limit this.
[0084] In the embodiment of the present disclosure, based on the sampling method, representative sample data in the cluster can be screened out, which can reduce the impact of noise in the sample while reducing the number of visits to the example set, thereby ensuring the reasoning ability of the subsequent model.
[0085] S204: labeling multiple sample data to obtain labeled data.
[0086] Each example in the example set of the disclosed embodiment is associated with annotation information for understanding the sample data. The annotation information may be the grammatical structure of the example and the field to which it belongs. For example, the original sentence is "Is Guangqumenwai congested?", and its annotation information is "noun-Guangqumenwai / adjective-congested / question word-?". The "noun-Guangqumenwai" belongs to the navigation field.
[0087] The annotation information may also be annotations closely related to intent identification. For example, it may include slots, fields, and intents. When implemented, the annotation information includes field annotations and intent annotations to help improve semantic understanding capabilities. Thus, the annotation information of the reference example includes field annotations and intent annotations; the annotation information of the original sentence includes field annotations and intent annotations for the original sentence.
[0088] For example, when the original sentence is "Is Guangqumenwai congested?", it is marked, and the marking data can be expressed as ">naviControl / LBS_TRAFFIC / poi=Guangqumenwai", where the domain of the sample is marked as "naviControl", which indicates that the sample data is in the navigation domain, and the intent is marked as "LBS_TRAFFIC", which indicates asking about traffic conditions.
[0089] The reference example can be "Is People's Park congested?", which is marked, and the marked data can be expressed as ">naviControl / LBS_TRAFFIC / poi=People's Park", where the domain of the sample is marked as "naviControl", which indicates that the sample data is in the navigation domain, and the intent is marked as "LBS_TRAFFIC", which indicates asking about traffic conditions. Based on the marking information of the two, it can be seen that the reference example and the original sentence belong to the same domain and have the same intent.
[0090] In the disclosed embodiment, the reference examples and the original sentences are annotated, which can provide valuable parameters to understand the original sentences, thereby achieving accurate semantic understanding.
[0091] S205, constructing an example set based on the labeled data.
[0092] In summary, in the embodiments of the present disclosure, representative data is screened out from multiple clusters obtained based on cluster analysis, which can reduce the difficulty of labeling samples, simplify the complexity of semantic understanding, and provide effective data guarantee for the subsequent improvement of semantic understanding capabilities.
[0093] In some embodiments, constructing an example set may be implemented as follows:
[0094] Step C1, obtaining high-frequency words.
[0095] The entity words in the original data set are subjected to word frequency analysis to obtain entity words with higher occurrence frequencies, and the words are identified as high-frequency words.
[0096] Step C2, using high-frequency words to backfill the common labels in the labeled data to obtain high-frequency samples.
[0097] Step C3: construct a query index for high-frequency samples to obtain a sample set.
[0098] In the disclosed embodiment, not only representative examples are obtained through clustering and downsampling, but also the reference examples in the example set can be guaranteed to be high-frequency words based on entity word backfilling, so as to meet business needs and respond to users as quickly and accurately as possible.
[0099] It should be noted that in order to meet business needs, the sample set can be updated in a timely manner. The update can be implemented as follows:
[0100] Step D1, obtaining incremental data.
[0101] Step D2, allocating the incremental data to the cluster that is closest to the incremental data.
[0102] Step D3, downsampling the incremental data set in the updated cluster to obtain incremental samples.
[0103] Step D4, adding incremental samples to the sample set.
[0104] By updating the example set, the current needs of users can be continuously met, and the examples in the example set can be optimized and enriched. Moreover, by means of incremental updates, the example set can be updated with small resource consumption.
[0105] After obtaining the example set based on the above operations, reference examples whose similarity meets the preset conditions can be screened out from the example set. Based on the reference examples and the original sentences, the input sentence is constructed, which can be implemented as follows: adding indicators to the reference examples to separate the natural language sentences in the reference examples and the annotation information of the reference examples; splicing the task identifier, the reference examples, and the original sentences to obtain the input sentence.
[0106] Among them, taking the original sentence asking "Is there traffic jam outside Guangqumen?" as an example, in this case, the reference example can be asking whether there is traffic jam near Hongqiao Tiandi, and the form of the reference example can be "Is there traffic jam near Hongqiao Tiandi=>naviControl / LBS_TRAFFIC / poi=Hongqiao Tiandi". Among them, "=>" is the indicator, "Is there traffic jam near Hongqiao Tiandi?" is the natural language sentence in the reference example, and "naviControl / LBS_TRAFFIC / poi=Hongqiao Tiandi" is the annotation information of the reference example.
[0107] The task identifier is used to instruct the target model to process the original sentence based on the reference example.
[0108] The task identifier, reference example, and original sentence are concatenated to obtain an input sentence. The task identifier may be "please output the correct result in combination with the reference example". Based on the task identifier, reference example, and original sentence obtained above, the input sentence may be concatenated in the following form:
[0109] Please refer to the example to output the correct result:
[0110] Is there traffic jam near Hongqiao Tiandi?
[0111] = > naviControl / LBS_TRAFFIC / poi = Hongqiao Tiandi
[0112] Is there any blockage outside Guangqumen?
[0113] The indicator "=>" after the original sentence "Is Guangqumen outside blocked?" is used to guide the target model to confirm the position of the original sentence.
[0114] In the disclosed embodiment, an indicator is used to indicate the segmentation point of the natural language sentence and the annotation information, so that the target model can quickly locate the content to be learned. Based on the task identification, it can be understood as obtaining the task type corresponding to the business response data of the original sentence. Based on the task identification, the reference example, and the input sentence constructed by the original sentence, a strong foundation is laid for the subsequent acquisition of the annotation information of the original sentence based on the target model.
[0115] In some embodiments, an input sentence is input into a target model, and labeling information of the original sentence output by the target model under the guidance of a reference example is obtained. This can be implemented as follows: based on the task identifier in the input sentence, the target model is guided to learn the expression of the reference example, so that the target model learns the labeling method for the original sentence according to the indicator in the reference example to obtain the labeling information of the original sentence.
[0116] Taking the input sentence obtained above as an example, the task identifier is "Please output the correct result in combination with the reference example", which can be understood as the need to annotate the original sentence with reference to the reference example. The form of the reference example is "Is there traffic jam near Hongqiao Tiandi=>naviControl / LBS_TRAFFIC / poi=Hongqiao Tiandi", that is, the left side of the indicator "=>" is the natural language sentence of the reference example, and the right side of the indicator "=>" is the annotation information of the reference example. Annotation of the original sentence also needs to follow the form of the reference example, that is, "Is there traffic jam outside Guangqumen" with the indicator "=>" is the natural language sentence of the original sentence, and the annotation information of the original sentence needs to be on the right side of the indicator, which can be expressed as "Is there traffic jam outside Guangqumen=>naviControl / LBS_TRAFFIC / poi=Guangqumenwai". The output result of the target model only needs to output the annotation information of the original sentence.
[0117] In the disclosed embodiment, the output of the target model is guided by the task identifier, and the reference model is used for reference, and the learning ability of the target model is combined to achieve accurate labeling of the original sentence.
[0118] In order to better understand the embodiments of the present disclosure, the application scenarios of the data processing method proposed in the embodiments of the present disclosure can be as follows: Figure 4 As shown, it includes an example set construction module 401, a retrieval module 402, and an input sentence construction module 403. In the example set construction module 401, clustering is performed based on the original data set to obtain a clustering result, and then subsequent downsampling is performed to obtain a plurality of representative unlabeled sample data, which are labeled, and then an example set is constructed based on the labeled data.
[0119] The retrieval module 402 searches the example set based on the original sentence to obtain reference examples that meet the preset conditions.
[0120] The input sentence construction module 403 can construct reference examples and original data into input sentences that can be recognized by the target model for subsequent processing.
[0121] The use of the solution proposed in the embodiment of the present disclosure is described in a navigation scenario. Figure 5 As shown, based on the example set constructed above. Taking the original sentence "Is Guangqumenwai congested?" as an example, the reference examples obtained by the retrieval module 402 are "Is there congestion near Hongqiao Tiandi? = > naviControl / LBS_TRAFFIC / poi = Hongqiao Tiandi", "Navigate to Guangqumenwai = > navi / LBS_ROUTE / route_arrival = Guangqumenwai". The input sentence is obtained based on the input sentence construction module 403. Then it is input into the target model (such as Figure 5 LLMs model in the navigation scene), and obtain the processing result of the original sentence, that is, the annotation information of the original sentence. The format of the annotation information needs to meet the requirements of the processing logic for obtaining the business response data. In the embodiment of the navigation scenario, the requirements of the processing logic can be understood as instructing the navigation function module to perform operations in accordance with the expression method that the navigation function module can understand. Take the annotation information as "naviControl / LBS_TRAFFIC / poi=Guangqumenwai" as an example, where "naviControl" is the navigation field, "LBS_TRAFFIC" indicates the intention to determine the traffic conditions in the navigation field, and "poi=Guangqumenwai" is used to indicate that the traffic conditions of "Guangqumenwai" must be determined. Since the annotation information is generated in a manner that the navigation function module can understand, it is compatible with the existing business logic of the navigation function module to obtain the business response data.
[0122] Therefore, in the embodiment of the present disclosure, the format of the annotation information meets the requirements of obtaining the processing logic of the business response data. Therefore, the original sentence is annotated based on the processing logic of the business response data, and the business processing logic can be left unchanged to obtain accurate business response data.
[0123] In some embodiments, for frequently used examples, corresponding business response data may be stored. On this basis, when the similarity between the reference example and the original sentence is higher than the similarity threshold and the target entity words are the same, the business response data corresponding to the reference example may be obtained to respond to the original sentence.
[0124] Taking the reference example as "I want to listen to song A", song A is a high-frequency usage example, and song A can be stored as the corresponding business response data. In the case where the original sentence is "I want to listen to song A", the similarity between the original sentence and the reference example is higher than the similarity threshold, and the target entity words of both are song A. In this case, the stored song A can be directly sent to the user as business response data.
[0125] In other embodiments, the annotation information of the original sentence can be used as an auxiliary expression of the original sentence. During implementation, the original sentence and its annotation information can be input into subsequent business modules together, so that the business module can understand the original sentence based on the annotation information to improve the ability to understand the original sentence.
[0126] Based on the same technical concept, the embodiment of the present disclosure also provides a data processing device 600, such as Figure 6 As shown, including:
[0127] The first acquisition module 601 is used to acquire a reference example of the original sentence from the example set, where the similarity between the reference example and the original sentence meets a preset condition; and the reference example contains annotation information for understanding the reference example;
[0128] A first construction module 602 is used to construct an input sentence based on a reference example and an original sentence;
[0129] An input module 603 is used to input an input sentence into a target model, and obtain annotation information of an original sentence output by the target model under the guidance of a reference example;
[0130] The second acquisition module 604 is used to acquire the business response data of the original sentence based on the annotation information of the original sentence.
[0131] In some embodiments, the first building block 602 is used to:
[0132] Adding indicators to the reference examples to separate the natural language sentences in the reference examples and the annotation information of the reference examples;
[0133] The task identifier, reference example, and original sentence are concatenated to obtain the input sentence.
[0134] In some embodiments, the input module 603 is used to:
[0135] Based on the task identifier in the input sentence, the target model is guided to learn the expression of the reference example, so that the target model learns the labeling method of the original sentence according to the indicator in the reference example to obtain the labeling information of the original sentence.
[0136] In some embodiments, the format of the annotation information meets the requirements of the processing logic for obtaining the business response data.
[0137] In some embodiments, Figure 6 Based on this, the embodiment of the present disclosure further provides a data processing device 700, such as Figure 7 As shown, the following modules used to build the example set are also included:
[0138] An acquisition module 701 is used to acquire an original data set;
[0139] A clustering module 702 is used to perform cluster analysis on the original data set to obtain multiple clusters;
[0140] The sampling module 703 is used to downsample the multiple clusters to obtain multiple representative sample data;
[0141] A labeling module 704 is used to label multiple sample data to obtain labeled data;
[0142] The construction module 705 is used to construct an example set based on the labeled data.
[0143] In some embodiments, the clustering module 702 is used to:
[0144] Perform word segmentation on the original data set to obtain entity words;
[0145] Replace the entity words of the target category with general labels to obtain an intermediate dataset;
[0146] Perform feature extraction on the intermediate data set to obtain text features of multiple sentences in the intermediate data set;
[0147] Based on the text features of multiple sentences, the intermediate data set is clustered and analyzed to obtain multiple clusters.
[0148] In some embodiments, the clustering module 702 is used to:
[0149] Perform hierarchical clustering on the original data set to obtain multiple clusters.
[0150] In some embodiments, the sampling module 703 is used to:
[0151] Determine the weights of multiple clusters;
[0152] Based on the sampling rule that the larger the weight, the more sampling data, multiple sample data are downsampled from multiple clusters.
[0153] In some embodiments, the construction module 705 is used to:
[0154] Acquire high-frequency vocabulary;
[0155] Use high-frequency words to backfill common labels in the labeled data to obtain high-frequency samples;
[0156] Build a query index for high-frequency samples and obtain a sample set.
[0157] In some embodiments, the annotation information of the reference example includes a domain annotation and an intent annotation; the annotation information of the original sentence includes a domain annotation and an intent annotation for the original sentence.
[0158] For the description of specific functions and examples of each module and submodule of the device in the embodiment of the present disclosure, reference can be made to the relevant description of the corresponding steps in the above method embodiment, which will not be repeated here.
[0159] In the technical solution disclosed herein, the acquisition, storage and application of user personal information involved are in compliance with the provisions of relevant laws and regulations and do not violate public order and good morals.
[0160] According to an embodiment of the present disclosure, the present disclosure also provides an electronic device, a readable storage medium and a computer program product.
[0161] Figure 8 A schematic block diagram of an example electronic device 800 that can be used to implement an embodiment of the present disclosure is shown. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device can also represent various forms of mobile devices, such as personal digital assistants, cellular phones, smart phones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely examples and are not intended to limit the implementation of the present disclosure described and / or required herein.
[0162] like Figure 8 As shown, the device 800 includes a computing unit 801, which can perform various appropriate actions and processes according to a computer program stored in a read-only memory (ROM) 802 or a computer program loaded from a storage unit 808 into a random access memory (RAM) 803. In the RAM 803, various programs and data required for the operation of the device 800 can also be stored. The computing unit 801, the ROM 802, and the RAM 803 are connected to each other via a bus 804. An input / output (I / O) interface 805 is also connected to the bus 804.
[0163] A number of components in the device 800 are connected to the I / O interface 805, including: an input unit 806, such as a keyboard, a mouse, etc.; an output unit 807, such as various types of displays, speakers, etc.; a storage unit 808, such as a disk, an optical disk, etc.; and a communication unit 809, such as a network card, a modem, a wireless communication transceiver, etc. The communication unit 809 allows the device 800 to exchange information / data with other devices through a computer network such as the Internet and / or various telecommunication networks.
[0164] The computing unit 801 may be a variety of general and / or special processing components with processing and computing capabilities. Some examples of the computing unit 801 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various dedicated artificial intelligence (AI) computing chips, various computing units running machine learning model algorithms, digital signal processors (DSPs), and any appropriate processors, controllers, microcontrollers, etc. The computing unit 801 performs the various methods and processes described above, such as data processing methods. For example, in some embodiments, the data processing method may be implemented as a computer software program, which is tangibly contained in a machine-readable medium, such as a storage unit 808. In some embodiments, part or all of the computer program may be loaded and / or installed on the device 800 via ROM 802 and / or communication unit 809. When the computer program is loaded into RAM 803 and executed by the computing unit 801, one or more steps of the data processing method described above may be performed. Alternatively, in other embodiments, the computing unit 801 may be configured to perform the data processing method in any other appropriate manner (e.g., by means of firmware).
[0165] Various implementations of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on chips (SOCs), complex programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various implementations can include: being implemented in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which can be a special purpose or general purpose programmable processor that can receive data and instructions from a storage system, at least one input device, and at least one output device, and transmit data and instructions to the storage system, the at least one input device, and the at least one output device.
[0166] The program code for implementing the method of the present disclosure may be written in any combination of one or more programming languages. These program codes may be provided to a processor or controller of a general-purpose computer, a special-purpose computer, or other programmable data processing device, so that the program code, when executed by the processor or controller, enables the functions / operations specified in the flow chart and / or block diagram to be implemented. The program code may be executed entirely on the machine, partially on the machine, partially on the machine and partially on a remote machine as a stand-alone software package, or entirely on a remote machine or server.
[0167] In the context of the present disclosure, a machine-readable medium may be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, device, or equipment. A machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, device, or equipment, or any suitable combination of the foregoing. A more specific example of a machine-readable storage medium may include an electrical connection based on one or more lines, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
[0168] To provide interaction with a user, the systems and techniques described herein can be implemented on a computer having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and pointing device (e.g., a mouse or trackball) through which the user can provide input to the computer. Other types of devices can also be used to provide interaction with the user; for example, the feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including acoustic input, voice input, or tactile input).
[0169] The systems and techniques described herein may be implemented in a computing system that includes back-end components (e.g., as a data server), or a computing system that includes middleware components (e.g., an application server), or a computing system that includes front-end components (e.g., a user computer with a graphical user interface or a web browser through which a user can interact with implementations of the systems and techniques described herein), or a computing system that includes any combination of such back-end components, middleware components, or front-end components. The components of the system may be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: a local area network (LAN), a wide area network (WAN), and the Internet.
[0170] A computer system may include a client and a server. The client and the server are generally remote from each other and usually interact through a communication network. The relationship of client and server is generated by computer programs running on respective computers and having a client-server relationship with each other. The server may be a cloud server, a server of a distributed system, or a server combined with a blockchain.
[0171] It should be understood that the various forms of processes shown above can be used to reorder, add or delete steps. For example, the steps recorded in this disclosure can be executed in parallel, sequentially or in different orders, as long as the desired results of the technical solutions disclosed in this disclosure can be achieved, and this document does not limit this.
[0172] The above specific implementations do not constitute a limitation on the protection scope of the present disclosure. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions can be made according to design requirements and other factors. Any modification, equivalent substitution and improvement made within the principles of the present disclosure shall be included in the protection scope of the present disclosure.< / poi> < / poi>
Claims
1. A data processing method, comprising: Acquire a reference example of the original sentence from the example set, wherein the similarity between the reference example and the original sentence meets a preset condition; The reference example includes annotation information for understanding the reference example; Based on the reference example and the original sentence, construct an input sentence; Inputting the input sentence into a target model, and obtaining annotation information of the original sentence output by the target model under the guidance of the reference example; Based on the annotation information of the original sentence, business response data of the original sentence is obtained.
2. The method according to claim 1, wherein: The step of constructing an input sentence based on the reference example and the original sentence includes: adding an indicator in the reference example to separate the natural language sentence in the reference example and the annotation information of the reference example; The task identifier, the reference example, and the original sentence are concatenated to obtain the input sentence.
3. The method according to claim 1, wherein: Inputting the input sentence into the target model, and obtaining the annotation information of the original sentence output by the target model under the guidance of the reference example, comprises: The target model is guided to learn the expression of the reference example based on the task identifier in the input sentence, so that the target model learns the labeling method of the original sentence according to the indicator in the reference example to obtain the labeling information of the original sentence.
4. According to the method according to any one of claims 1-3, the format of the annotation information meets the requirements of the processing logic for obtaining the business response data.
5. The method according to any one of claims 1 to 4, further comprising constructing the example set based on the following method: Get the original data set; Performing cluster analysis on the original data set to obtain multiple clusters; Downsampling the multiple clusters to obtain multiple representative sample data; Annotating the plurality of sample data to obtain annotated data; The example set is constructed based on the labeled data.
6. The method according to claim 5, wherein: The cluster analysis is performed on the original data set to obtain multiple clusters, including: Performing word segmentation processing on the original data set to obtain entity words; Replace the entity words of the target category with general labels to obtain an intermediate dataset; Performing feature extraction on the intermediate data set to obtain text features of multiple sentences in the intermediate data set; The intermediate data set is clustered based on the text features of the multiple sentences to obtain the multiple clusters.
7. The method according to claim 5, wherein the clustering analysis is performed on the original data set to obtain a plurality of clusters, comprising: Perform hierarchical clustering on the original data set to obtain the multiple clusters.
8. The method according to any one of claims 5 to 7, wherein: The downsampling of the multiple clusters to obtain multiple representative sample data includes: Determining weights of the plurality of clusters; Based on a sampling rule that the greater the weight, the more sampling data, the multiple sample data are downsampled from the multiple clusters.
9. The method according to any one of claims 5 to 8, wherein: The constructing the example set based on the labeled data includes: Acquire high-frequency vocabulary; Backfilling the common labels in the labeled data with the high-frequency vocabulary to obtain high-frequency samples; A query index of the high-frequency samples is constructed to obtain the example set.
10. According to the method described in any one of claims 5-9, the annotation information of the reference example includes domain annotation and intent annotation; the annotation information of the original sentence includes domain annotation and intent annotation for the original sentence.
11. A data processing device, comprising: A first acquisition module, configured to acquire a reference example of an original sentence from an example set, wherein the similarity between the reference example and the original sentence meets a preset condition; The reference example includes annotation information for understanding the reference example; A first construction module, configured to construct an input sentence based on the reference example and the original sentence; An input module, used for inputting the input sentence into a target model, and obtaining annotation information of the original sentence output by the target model under the guidance of the reference example; The second acquisition module is used to acquire the business response data of the original statement based on the original statement and the annotation information of the original statement.
12. The device according to claim 11, wherein The first building block is used to: adding an indicator in the reference example to separate the natural language sentence in the reference example and the annotation information of the reference example; The task identifier, the reference example, and the original sentence are concatenated to obtain the input sentence.
13. The device according to claim 11, wherein: The input module is used for: The target model is guided to learn the expression of the reference example based on the task identifier in the input sentence, so that the target model learns the labeling method of the original sentence according to the indicator in the reference example to obtain the labeling information of the original sentence.
14. The device according to any one of claims 11-13, wherein the format of the annotation information meets the requirements of the processing logic for obtaining the business response data.
15. The apparatus according to any one of claims 11 to 14, further comprising the following module for constructing the example set: The acquisition module is used to obtain the original data set; A clustering module, used to perform cluster analysis on the original data set to obtain multiple clusters; A sampling module, used for downsampling the multiple clusters to obtain multiple representative sample data; A labeling module, used for labeling the plurality of sample data to obtain labeled data; A construction module is used to construct the example set based on the labeled data.
16. The device according to claim 15, wherein: The clustering module is used to: Performing word segmentation processing on the original data set to obtain entity words; Replace the entity words of the target category with general labels to obtain an intermediate dataset; Performing feature extraction on the intermediate data set to obtain text features of multiple sentences in the intermediate data set; The intermediate data set is clustered based on the text features of the multiple sentences to obtain the multiple clusters.
17. The apparatus according to claim 15, wherein the clustering module is configured to: Perform hierarchical clustering on the original data set to obtain the multiple clusters.
18. The device according to any one of claims 15 to 17, wherein: The sampling module is used for: Determining weights of the plurality of clusters; Based on a sampling rule that the greater the weight, the more sampling data, the multiple sample data are downsampled from the multiple clusters.
19. The device according to any one of claims 15 to 18, wherein: The building blocks are used to: Acquire high-frequency vocabulary; Backfilling the common labels in the labeled data with the high-frequency vocabulary to obtain high-frequency samples; A query index of the high-frequency samples is constructed to obtain the example set.
20. According to the device of any one of claims 15-19, the annotation information of the reference example includes a domain annotation and an intent annotation; the annotation information of the original sentence includes a domain annotation and an intent annotation for the original sentence.
21. An electronic device comprising: at least one processor; as well as a memory communicatively connected to the at least one processor; wherein, The memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to perform the method according to any one of claims 1 to 10.
22. A non-transitory computer-readable storage medium storing computer instructions, wherein: The computer instructions are used to cause the computer to execute the method according to any one of claims 1-10.
23. A computer program product comprising a computer program, which, when executed by a processor, implements the method according to any one of claims 1 to 10.