Contextual scene data identification method and apparatus
By calculating similarity using single-sentence and contextual topic models, the problem of the time-consuming nature of manually annotating contextual intent relationships is solved, enabling more comprehensive contextual data discovery and model improvement.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- QINDAO HAIER REFRIGERATOR CO LTD
- Filing Date
- 2023-01-03
- Publication Date
- 2026-05-12
AI Technical Summary
Existing technologies require extensive manual annotation of contextual intent relationships when training human-computer interaction models, resulting in huge consumption of human and material resources. Furthermore, clustering methods can only cluster based on literal meaning and cannot fully understand the topic-related corpus data.
Single-sentence topic models and context topic models are used to process the preceding and following text data respectively. The context scene data is judged by calculating the similarity of the three. The LDA topic model is used for training, and the model is retrained when the similarity does not meet the threshold.
It improves the sufficiency of contextual scene data discovery, reduces annotation costs, uncovers deeper contextual relationships, and establishes a more complete model.
Smart Images

Figure CN116070122B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of deep learning, and in particular to a method and apparatus for contextual scene data recognition. Background Technology
[0002] Training a human-computer interaction model requires inputting a large amount of dialogue data into the model. This data often requires manual annotation of the contextual intent relationships, which is a huge workload and requires a lot of human and material resources.
[0003] There are some existing solutions, such as clustering similar contextual texts. However, this method can only obtain clustering results from the surface meaning of words, which will miss corpus data that are not literally related but have a contextual relationship in terms of topic, leaving only corpus data with similar literal meanings. The interaction model trained on this model cannot fully understand corpus data that are related in terms of topic but not literally related. Therefore, we need to obtain more comprehensive contextual dialogue data through more intelligent methods to build more suitable models. Summary of the Invention
[0004] To address at least one of the aforementioned problems in the prior art, the present invention aims to provide a method and apparatus for more accurately identifying contextual relationships in contextual scene data recognition. 。
[0005] To achieve the above-mentioned objective, one embodiment of the present invention provides a method for contextual scene data recognition, comprising the following steps:
[0006] The preceding and following text data in the context text data are respectively input into the single sentence topic model to obtain the preceding topic representation and the following topic representation. The single sentence topic model is a model trained with a large amount of single sentence text data.
[0007] Contextual text data is input into a contextual topic model to obtain a contextual topic representation, wherein the contextual topic model is a model trained with a large amount of contextual data;
[0008] Calculate the similarity between any two of the preceding topic representation, the following topic representation, and the context topic representation;
[0009] Determine whether the similarity meets the threshold condition. If so, the preceding and following data are determined as contextual scene data.
[0010] As a further improvement of the present invention, the single-sentence topic model and the context topic model are established based on the LDA topic model.
[0011] As a further improvement of the present invention, the text data content used to train the single-sentence topic model and the context topic model is different.
[0012] As a further improvement of the present invention, the step of determining whether the similarity meets the threshold condition further includes:
[0013] If not, then the single-sentence topic model and the context topic model are retrained using the preceding and following text data.
[0014] As a further improvement of the present invention, both the single-sentence topic model and the context topic model use a semantic representation framework to encode the text content using a network with the same structure and shared parameters to obtain a vector representation of the text.
[0015] As a further improvement of the present invention, the step of calculating the similarity of any two of the preceding topic representation, the following topic representation, and the context topic representation includes:
[0016] Calculate the first similarity between the preceding topic representation and the following topic representation, with a value ranging from (0,1);
[0017] Calculate the second similarity between the preceding topic representation and the context topic representation, with a value ranging from (0,1);
[0018] Calculate the third similarity between the following topic representation and the context topic representation, with a value ranging from (0,1);
[0019] The first similarity, the second similarity, and the third similarity are weighted and summed to calculate the total similarity.
[0020] As a further improvement of the present invention, the calculation methods for the first similarity, the second similarity and the third similarity are the same, which are to calculate the similarity between vectors, and the sum of the weight values of the first similarity, the second similarity and the third similarity is 1.
[0021] To achieve one of the above-mentioned objectives, an embodiment of the present invention provides a contextual scene data recognition device, comprising:
[0022] The single-sentence representation module is used to input the preceding and following text data from the context text data into the single-sentence topic model to obtain the preceding topic representation and the following topic representation. The single-sentence topic model is a model trained with a large amount of single-sentence text data.
[0023] The context representation module is used to input context text data into the context topic model to obtain a context topic representation, wherein the context topic model is a model trained with a large amount of context data;
[0024] The similarity calculation module is used to calculate the similarity between any two of the preceding topic representation, the following topic representation, and the context topic representation;
[0025] The judgment module is used to determine whether the similarity meets the threshold condition. If it does, the preceding and following data are judged as contextual scene data. If not, the single-sentence topic model and the contextual topic model are retrained using the preceding and following data.
[0026] To achieve one of the above-mentioned objectives, one embodiment of the present invention provides an electronic device, comprising:
[0027] Storage module, used to store computer programs;
[0028] The processing module, when executing the computer program, can implement the steps in the above-described contextual scene data recognition method.
[0029] To achieve one of the above-mentioned objectives, one embodiment of the present invention provides a readable storage medium storing a computer program that, when executed by a processing module, can implement the steps in the above-described context scene data recognition method.
[0030] Compared with existing technologies, the present invention has the following beneficial effects: By applying this contextual scene data recognition method through a two-round contextual data discovery process, the sufficiency of contextual scene data discovery is improved. At the same time, the similarity calculation is performed by introducing the correlation information between the preceding topic representation, the following topic representation, and the contextual topic representation, thereby obtaining in-depth contextual topic correlation data. This reduces the manpower, time, and cost spent in the contextual scene data annotation process, fully explores contextual relationships, obtains reliable contextual data, and further feeds back into the single-sentence topic model and the contextual topic model to establish a more complete model. Attached Figure Description
[0031] Figure 1 This is a flowchart of a context scene data recognition method according to an embodiment of the present invention;
[0032] Figure 2 This is a schematic diagram of the data flow order in a context scene data recognition method according to an embodiment of the present invention;
[0033] Figure 3 This is a schematic diagram of a context scene data recognition device according to an embodiment of the present invention. Detailed Implementation
[0034] The present invention will now be described in detail with reference to the specific embodiments shown in the accompanying drawings. However, these embodiments do not limit the present invention, and any structural, methodological, or functional modifications made by those skilled in the art based on these embodiments are included within the scope of protection of the present invention.
[0035] One embodiment of the present invention provides a method and apparatus for identifying contextual scene data. This method can obtain in-depth contextual topic correlation data and establish a more complete topic analysis model.
[0036] As described in the background section, the method of the present invention is used to solve the problem of large-scale manual annotation, establishes a complete topic analysis model, and continuously iterates the model through data.
[0037] Before running this method, you can first perform the following steps:
[0038] Step Z10: Establish a single-sentence topic model and a contextual topic model. Both the single-sentence topic model and the contextual topic model can be based on LDA (Latent Dirichlet Allocation) topic models, and trained by inputting a large amount of single-sentence text data and contextual data, respectively. The single-sentence text data consists of each independent sentence, training the single-sentence topic model to identify the topic of each sentence; the contextual data consists of continuous dialogue data on the same topic from multiple conversations, identifying the topic of multiple conversations through a large amount of coherent context.
[0039] Single-sentence topic models and context-based topic models can represent themes within the text. Topic models can capture the thematic information involved in the text, yielding deeper textual representations based on themes. By training single-sentence topic models and context-based topic models, deeper thematic information is used to represent the contextual data. The number of topics trained can be set to 5, and the number of training iterations can be set to 100.
[0040] Both the single-sentence topic model and the context topic model use a semantic representation framework to encode the text content using a network with the same structure and shared parameters, thereby obtaining a vector representation of the text.
[0041] During training, the text data content for training the single-sentence topic model and the context topic model is different. This results in two independent models, making the similarity scores obtained by the different models more independent in the subsequent similarity calculation process.
[0042] The following is combined with Figures 1-2This invention provides a contextual scene data recognition method according to an embodiment of the present invention. Although this application provides method operation steps as shown in the following embodiments or flowcharts, the execution order of steps in which there is no necessary causal relationship in logic, based on conventional or non-creative labor, is not limited to the execution order provided in the embodiments of this application. For example, the order of steps S10 and S20 below can be arbitrarily adjusted or performed simultaneously, without distinguishing the chronological order.
[0043] Specifically, the context scene data recognition method of this embodiment includes the following steps: Figure 1 As shown, the data flow sequence is as follows: Figure 2 As shown, it includes the following steps:
[0044] Step S10: Input the preceding and following text data from the context text data into the single-sentence topic model to obtain the preceding topic representation and the following topic representation.
[0045] The contextual text data can be two consecutive sentences, with the preceding sentence being the data above the preceding sentence and the following sentence being the data below the preceding sentence. The two sentences are input into the single-sentence topic model to obtain the preceding topic representation and the following topic representation for each sentence. Both the preceding topic representation and the following topic representation can be the text represented in vector form.
[0046] Step S20: Input the context text data into the context topic model to obtain the context topic representation.
[0047] The contextual text data here is the same as the contextual text data in step S10. The two sentences are treated as a whole, and the theme is understood to obtain the vector representation of the whole.
[0048] Step S30: Calculate the similarity between any two of the preceding topic representation, the following topic representation, and the context topic representation.
[0049] The similarity calculated in step S30 can include the similarity between the preceding topic representation and the following topic representation, the similarity between the preceding topic representation and the context topic representation, and the similarity between the following topic representation and the context topic representation. This can determine the correlation information between the context itself and between them, and realize the filtering of context scene data. Subsequent steps will then determine whether the current data is context scene data based on these three similarities.
[0050] Step S30 specifically also includes:
[0051] Calculate the first similarity between the preceding topic representation and the following topic representation, with a value ranging from (0,1);
[0052] Calculate the second similarity between the preceding topic representation and the context topic representation, with a value ranging from (0,1);
[0053] Calculate the third similarity between the following topic representation and the context topic representation, with a value ranging from (0,1);
[0054] The first similarity, the second similarity, and the third similarity are weighted and summed to calculate the total similarity.
[0055] The calculation methods for the first similarity, the second similarity, and the third similarity are the same; they all calculate the similarity between vectors, which can be the ratio of the product of the vectors to the product of their magnitudes.
[0056] When calculating the total similarity, the sum of the weights of the first similarity, the second similarity, and the third similarity is 1. Therefore, the final similarity score will range from (0,1).
[0057] Step S40: Determine whether the similarity meets the threshold condition.
[0058] The threshold and weight can be adjusted as needed; generally, the threshold is set to 0.5.
[0059] If the result of step S40 is yes, then proceed with the following steps:
[0060] Step S41: Determine the preceding and following data as contextual scenario data.
[0061] If the result of step S40 is negative, proceed with the following steps:
[0062] Step S42: Retrain the single-sentence topic model and the context topic model using the preceding and following text data.
[0063] Step S42 indicates that the current model has not yet been able to identify the topic of the context, or that the two models have not yet formed a unified understanding of the topic of the context. Therefore, such texts that do not meet the threshold conditions are returned to the model to retrain the model, obtain new context scene data discovery results, obtain recalled context scene data, increase the recall of the discovery results, and enable the model to more accurately identify similar corpora in subsequent steps.
[0064] Compared with the prior art, this embodiment has the following beneficial effects:
[0065] This contextual scenario data recognition method improves the sufficiency of contextual scenario data discovery through a two-round contextual data discovery process. It also introduces the correlation information between the preceding topic representation, the following topic representation, and the contextual topic representation for similarity calculation, resulting in in-depth contextual topic correlation data discovery results. This reduces the manpower, time, and cost spent in the contextual scenario data annotation process, fully explores contextual relationships, obtains reliable contextual data, and further feeds back into the single-sentence topic model and the contextual topic model to establish a more complete model.
[0066] In one embodiment, a contextual scene data recognition device is provided, such as Figure 3 As shown. The context scene data recognition device includes the following modules, and the specific functions of each module are as follows:
[0067] The single-sentence representation module is used to input the preceding and following text data from the context text data into the single-sentence topic model to obtain the preceding topic representation and the following topic representation. The single-sentence topic model is a model trained with a large amount of single-sentence text data.
[0068] The context representation module is used to input context text data into the context topic model to obtain a context topic representation, wherein the context topic model is a model trained with a large amount of context data;
[0069] The similarity calculation module is used to calculate the similarity between any two of the preceding topic representation, the following topic representation, and the context topic representation;
[0070] The judgment module is used to determine whether the similarity meets the threshold condition. If it does, the preceding and following data are judged as contextual scene data. If not, the single-sentence topic model and the contextual topic model are retrained using the preceding and following data.
[0071] It should be noted that for details not disclosed in the context scene data recognition device of this embodiment, please refer to the details disclosed in the context scene data recognition method of this embodiment.
[0072] Those skilled in the art will understand that the schematic diagram of the module is merely an example of a context scene data recognition device and does not constitute a limitation on the terminal device of the context scene data recognition device. It may include more or fewer components than shown in the diagram, or combine certain components, or different components. For example, the context scene data recognition device may also include input / output devices, network access devices, buses, etc.
[0073] The contextual scene data recognition device may further include computing devices such as computers, laptops, handheld computers, and cloud servers, as well as, but not limited to, processing modules, storage modules, and computer programs stored in the storage modules and capable of running on the processing modules, such as the contextual scene data recognition method program described above. When the processing module executes the computer program, it implements the steps in the various contextual scene data recognition method embodiments described above, for example... Figure 1 The steps are shown.
[0074] In addition, the present invention also proposes an electronic device, which includes a storage module and a processing module. When the processing module executes the computer program, it can implement the steps in the above-mentioned context scene data recognition method, that is, implement the steps in any of the above-mentioned technical solutions of the context scene data recognition method.
[0075] The electronic device may be part of a contextual scene data recognition device, a local terminal device, or part of a cloud server.
[0076] The processing module can be a Central Processing Unit (CPU), or other general-purpose processors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. The general-purpose processor can be a microprocessor or any conventional processor. The processing module is the control center of the context scene data recognition device, connecting all parts of the device via various interfaces and lines.
[0077] The storage module can be used to store the computer programs and / or modules. The processing module implements various functions of the context scene data recognition device by running or executing the computer programs and / or modules stored in the storage module and by calling the data stored in the storage module. The storage module may mainly include a program storage area and a data storage area. The program storage area may store the operating system, at least one application program required for a function, etc. In addition, the storage module may include high-speed random access memory, and may also include non-volatile memory, such as hard disk, memory, plug-in hard disk, smart media card (SMC), secure digital (SD) card, flash card, at least one disk storage device, flash memory device, or other volatile solid-state storage device.
[0078] For example, the computer program can be divided into one or more modules / units, which are stored in a storage module and executed by a processing module to complete the present invention. The one or more modules / units can be a series of computer program instruction segments capable of performing specific functions, which describe the execution process of the computer program in the context scene data recognition device.
[0079] Furthermore, one embodiment of the present invention provides a readable storage medium storing a computer program that, when executed by a processing module, can implement the steps in the above-described context scene data recognition method, that is, implement the steps in any of the technical solutions of the above-described context scene data recognition method.
[0080] If the integrated module of the contextual scene data recognition method is implemented as a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, all or part of the processes in the methods of the above embodiments of the present invention can also be implemented by a computer program instructing related hardware. The computer program can be stored in a computer-readable storage medium, and when executed by the processing module, it can implement the steps of the various method embodiments described above.
[0081] The computer program includes computer program code, which can be in the form of source code, object code, executable file, or some intermediate form. The computer-readable medium can include any entity or device capable of carrying the computer program code, recording media, U disks, portable hard drives, magnetic disks, optical disks, computer memory, read-only memory (ROM), random access memory (RAM), electrical carrier signals, telecommunication signals, and software distribution media, etc. It should be noted that the content included in the computer-readable medium can be appropriately added to or subtracted according to the requirements of legislation and patent practice in the jurisdiction. For example, in some jurisdictions, according to legislation and patent practice, computer-readable media do not include electrical carrier signals and telecommunication signals.
[0082] It should be understood that although this specification describes embodiments, not every embodiment contains only one independent technical solution. This way of describing the specification is only for clarity. Those skilled in the art should regard the specification as a whole. The technical solutions in each embodiment can also be appropriately combined to form other embodiments that can be understood by those skilled in the art.
[0083] The detailed descriptions listed above are merely specific descriptions of feasible embodiments of the present invention, and are not intended to limit the scope of protection of the present invention. All equivalent embodiments or modifications made without departing from the spirit of the present invention should be included within the scope of protection of the present invention.
Claims
1. A method for recognizing contextual scene data, characterized in that, Includes the following steps: The preceding and following text data in the context text data are respectively input into the single sentence topic model to obtain the preceding topic representation and the following topic representation. The single sentence topic model is a model trained with a large amount of single sentence text data. Contextual text data is input into a contextual topic model to obtain a contextual topic representation, wherein the contextual topic model is a model trained with a large amount of contextual data; Calculate the similarity between any two of the preceding topic representation, the following topic representation, and the context topic representation; Determine whether the similarity meets the threshold condition. If so, then the preceding and following data are determined as context scene data. The calculation of the similarity between any two of the preceding topic representation, the following topic representation, and the context topic representation includes: Calculate the first similarity between the preceding topic representation and the following topic representation, with a value range of (0,1). Calculate the second similarity between the above topic representation and the context topic representation, with a value range of (0,1). Calculate the third similarity between the following topic representation and the context topic representation, with a value ranging from (0,1). The first similarity, the second similarity, and the third similarity are weighted and summed to calculate the total similarity.
2. The contextual scene data recognition method according to claim 1, characterized in that, Based on the LDA topic model, the single-sentence topic model and the context topic model are established.
3. The contextual scene data recognition method according to claim 1, characterized in that, The text data used to train the single-sentence topic model and the context topic model are different.
4. The contextual scene data recognition method according to claim 1, characterized in that, The step of determining whether the similarity meets the threshold condition also includes: If not, then the single-sentence topic model and the context topic model are retrained using the preceding and following text data.
5. The contextual scene data recognition method according to claim 1, characterized in that, Both the single-sentence topic model and the context topic model use a semantic representation framework to encode the text content using a network with the same structure and shared parameters, thereby obtaining a vector representation of the text.
6. The contextual scene data recognition method according to claim 5, characterized in that, The first similarity, the second similarity, and the third similarity are calculated in the same way, which is to calculate the similarity between vectors. The sum of the weight values of the first similarity, the second similarity, and the third similarity is 1.
7. A contextual scene data recognition device, characterized in that, include: The single-sentence representation module is used to input the preceding and following text data from the context text data into the single-sentence topic model to obtain the preceding topic representation and the following topic representation. The single-sentence topic model is a model trained with a large amount of single-sentence text data. The context representation module is used to input context text data into the context topic model to obtain a context topic representation, wherein the context topic model is a model trained with a large amount of context data; The similarity calculation module is used to calculate the similarity between any two of the preceding topic representation, the following topic representation, and the context topic representation, including: calculating a first similarity between the preceding topic representation and the following topic representation, with a value ranging from (0,1); calculating a second similarity between the preceding topic representation and the context topic representation, with a value ranging from (0,1); calculating a third similarity between the following topic representation and the context topic representation, with a value ranging from (0,1); and weighted summing the first similarity, the second similarity, and the third similarity to calculate the total similarity. The judgment module is used to determine whether the similarity meets the threshold condition. If it does, the preceding and following data are judged as contextual scene data. If not, the single-sentence topic model and the contextual topic model are retrained using the preceding and following data.
8. An electronic device, characterized in that, include: Storage module, used to store computer programs; The processing module, when executing the computer program, can implement the steps in the context scene data recognition method according to any one of claims 1 to 6.
9. A readable storage medium storing a computer program, characterized in that, When executed by the processing module, the computer program can implement the steps in the context scene data recognition method according to any one of claims 1 to 6.