Attribute triple combination method and device, terminal and computer readable storage medium
By performing attribute detection on the retrieved text and applying the BERT model, a detection input template is generated to determine the category of attribute information, thus solving the problem of low accuracy in ternary combination and achieving more efficient attribute ternary combination and merging.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- ZHEJIANG DAHUA TECH CO LTD
- Filing Date
- 2022-10-10
- Publication Date
- 2026-07-31
AI Technical Summary
Existing technologies have low accuracy in merging triples, making it difficult to efficiently extract data value.
The attribute triplet merging method is adopted. By performing attribute detection on the retrieved text, attribute triplets are generated. The detection input template is constructed using the BERT model and the Prompt-learning concept to determine the detection category of attribute information, and then decide whether to merge or separate the attribute triplets.
It improves the accuracy of attribute ternary combination merging, is suitable for open domain information retrieval scenarios, and solves the problem of low accuracy of ternary combination merging.
Smart Images

Figure CN115712737B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of information processing technology, and in particular to a method, apparatus, terminal, and computer-readable storage medium for combining attribute ternaries. Background Technology
[0002] With the rapid digitalization of all sectors of society, an unprecedented amount of data has far exceeded the processing capabilities of existing traditional computer technologies and information systems. Furthermore, there is a significant amount of isolated and heterogeneous data, lacking efficient processing, storage, and computing methods, hindering the true extraction of data value. The maturation of artificial intelligence and big data, along with fast and inexpensive computing power, has made it possible to build high-performance storage technologies that support the rapid deployment of data-driven models and a wider range of big data application scenarios. Knowledge graphs, by establishing connections between data, organically organize fragmented data, making it easier for humans and machines to understand and process, and facilitating higher-level applications such as search, mining, and analysis.
[0003] When performing information retrieval on knowledge graphs, the commonly used method is to perform semantic parsing on the search statement to generate corresponding triples, including attribute triples and relation triples. Then, the triple information is used to generate knowledge graph query statements for retrieval. The accuracy of the retrieval results depends on the accuracy of the generated triples. Summary of the Invention
[0004] The main technical problem solved by this invention is to provide a method, apparatus, terminal and computer-readable storage medium for combining attribute triples, thereby solving the problem of low accuracy in merging triples in the prior art.
[0005] To solve the above-mentioned technical problems, the first technical solution adopted by the present invention is: to provide an attribute triplet combination and merging method, the attribute triplet combination and merging method comprising: performing attribute detection on the acquired search text to obtain N attribute information contained in the search text, and generating attribute triplets corresponding to the N attribute information respectively, wherein N is a positive integer greater than or equal to 2; generating detection input templates corresponding to two attribute information based on any two attribute information and the search text; determining the detection category corresponding to the two attribute information based on the detection input templates corresponding to the two attribute information; and determining whether to merge the attribute triplets corresponding to the two attribute information based on the detection category corresponding to the two attribute information.
[0006] The attribute ternary combination method further includes: constructing a category label-label-related text correspondence table; wherein the category label-label-related text correspondence table includes at least two category labels and the label-related text mapped to each category label respectively; the number of words in the label-related text is consistent with the number of words in the category label.
[0007] The attribute ternary combination method further includes: constructing a preset template, which includes the original search text, the first attribute information, the second attribute information, and a preset number of mask texts; and generating a detection input template corresponding to the two attribute information based on any two attribute information and the search text, including: filling the two attribute information and the search text into the preset template to generate the detection input template corresponding to the two attribute information.
[0008] Specifically, based on the detection input templates corresponding to the two attribute information, the detection category corresponding to the two attribute information is determined, including: inputting the detection input templates corresponding to the two attribute information into the BERT model to determine the detection category corresponding to the two attribute information; the number of word texts corresponding to the detection category is consistent with the number of mask texts.
[0009] The training method for the BERT model includes: obtaining a training dataset, which includes multiple training data templates, each template being a template corresponding to a two-attribute triplet; the training data templates are associated with labeled categories; the training data templates are input into the BERT model to obtain predicted categories; and the BERT model is iteratively trained based on the error value between the predicted categories and labeled categories corresponding to the training data templates.
[0010] The category labels include a first preset category and a second preset category. Based on the detection categories corresponding to the two attribute information, it is determined whether to merge the attribute triples corresponding to the two attribute information respectively, including: calculating the similarity between the word text corresponding to the detection category and the text information corresponding to the first preset category as the first similarity; calculating the similarity between the word text corresponding to the detection category and the text information corresponding to the second preset category as the second similarity; comparing the first similarity and the second similarity to determine whether to merge the attribute triples corresponding to the two attribute information respectively.
[0011] The text information corresponding to the first preset category belongs to the same subject, while the text information corresponding to the second preset category belongs to different subjects. The first similarity and the second similarity are compared to determine whether to merge the attribute triples corresponding to the two attribute information, including: merging the attribute triples corresponding to the two attribute information if the first similarity is greater than the second similarity; and assigning the attribute triples corresponding to the two attribute information to different subjects if the first similarity is not greater than the second similarity.
[0012] To solve the above-mentioned technical problems, the second technical solution adopted by the present invention is: providing an attribute triplet merging device, which includes: a preprocessing module, used to perform attribute detection on the acquired search text, obtain N attribute information contained in the search text, and generate attribute triplets corresponding to the N attribute information respectively, where N is a positive integer greater than or equal to 2; a generation module, used to generate detection input templates corresponding to two attribute information based on any two attribute information and the search text; a detection module, used to determine the detection category corresponding to the two attribute information based on the detection input templates corresponding to the two attribute information; and a processing module, used to determine whether to merge the attribute triplets corresponding to the two attribute information based on the detection categories corresponding to the two attribute information.
[0013] To solve the above-mentioned technical problems, the third technical solution adopted by the present invention is to provide a terminal, which includes a memory, a processor, and a computer program stored in the memory and running on the processor. The processor is used to execute program data to implement the steps in the above-mentioned attribute ternary combination method.
[0014] To solve the above-mentioned technical problems, the fourth technical solution adopted by the present invention is to provide a computer-readable storage medium on which a computer program is stored, and when the computer program is executed by a processor, it implements the steps in the above-mentioned attribute ternary combination method.
[0015] The beneficial effects of this invention are as follows: Unlike existing technologies, this invention provides a method, apparatus, terminal, and computer-readable storage medium for merging attribute triples. The method involves detecting attributes in the acquired search text to obtain N attribute information contained in the search text, and generating N attribute triples corresponding to each attribute information, where N is a positive integer greater than or equal to 2. Based on any two attribute information and the search text, a detection input template corresponding to the two attribute information is generated. Based on the detection input templates corresponding to the two attribute information, the detection category corresponding to the two attribute information is determined. Based on the detection category corresponding to the two attribute information, it is determined whether to merge the attribute triples corresponding to the two attribute information. This application generates detection input templates by searching the text and its corresponding attribute information, thereby determining the detection category between attribute information, and determining whether to merge the corresponding attribute information based on the detection category, thus improving the merging accuracy of attribute triples. Attached Figure Description
[0016] To more clearly illustrate the technical solutions in the embodiments of the present invention, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0017] Figure 1 This is a flowchart illustrating the attribute ternary combination method provided by the present invention;
[0018] Figure 2 This is a flowchart illustrating a specific embodiment of the attribute ternary combination method provided by the present invention;
[0019] Figure 3 yes Figure 2 A flowchart illustrating a specific embodiment of step S23 in the provided attribute ternary combination method;
[0020] Figure 4 This is a schematic diagram of the framework of an embodiment of the attribute ternary combination device provided by the present invention;
[0021] Figure 5 This is a schematic diagram of the framework of an embodiment of the terminal provided in this application;
[0022] Figure 6 A schematic diagram of a framework of an embodiment of the computer-readable storage medium provided in this application. Detailed Implementation
[0023] The embodiments of this application will now be described in detail with reference to the accompanying drawings.
[0024] In the following description, specific details such as particular system architectures, interfaces, and technologies are presented for illustrative purposes rather than for limiting purposes, in order to provide a thorough understanding of this application.
[0025] In this article, the term "and / or" simply describes the relationship between related objects, indicating that three relationships can exist. For example, A and / or B can represent: A alone, A and B simultaneously, or B alone. Additionally, the character " / " generally indicates that the preceding and following related objects have an "or" relationship. Furthermore, "more" in this article means two or more objects.
[0026] To enable those skilled in the art to better understand the technical solution of the present invention, the following describes in further detail a method for combining attribute ternaries provided by the present invention, in conjunction with the accompanying drawings and specific embodiments.
[0027] This application utilizes deep learning technology and employs the Prompt-learning approach to determine whether attribute information in the retrieved text corresponds to the same subject, thereby improving the accuracy of attribute ternary combination merging.
[0028] Prompt learning, a novel paradigm in Natural Language Processing (NLP), directly applies pre-trained language models to tasks such as cloze test prediction, autoregressive modeling, and sequence-to-sequence generation, achieving good performance across various tasks. Essentially, prompt learning transforms the input and output of downstream tasks into the form of the pre-trained task, i.e., the form of a Masked Language Model (MLM). In traditional supervised learning systems for NLP tasks, the input x is typically text data, and the output y is predicted based on the model P(y|x; θ). However, a major problem with supervised learning is the difficulty in finding suitable supervised data for training the model P(y|x; θ). Prompt-based learning methods attempt to circumvent this problem by learning an MLM that models the probability P(x; θ) of the text x itself and uses this probability to predict y, thereby reducing or eliminating the need for large supervised datasets for training the model.
[0029] Please see Figure 1 , Figure 1 This is a flowchart illustrating the attribute ternary combination and merging method provided by the present invention. This embodiment provides an attribute ternary combination and merging method, which includes the following steps.
[0030] S11: Perform attribute detection on the obtained search text to obtain N attribute information contained in the search text, and generate attribute triples corresponding to the N attribute information respectively.
[0031] Specifically, N is a positive integer greater than or equal to 2.
[0032] In one embodiment, a category label-label-related text mapping table is constructed. This table includes at least two category labels and the corresponding label-related text mapped to each category label; the number of words in the label-related text is the same as the number of words in the category label. Specifically, the category labels include a first preset category and a second preset category.
[0033] In one embodiment, a preset template is constructed, which includes the original search text, first attribute information, second attribute information, and a preset number of mask texts.
[0034] S12: Generate detection input templates corresponding to the two attribute information based on any two attribute information and the search text.
[0035] Specifically, the two attribute information and the search text are substituted into the preset template to generate the detection input template.
[0036] S13: Based on the detection input template corresponding to the two attribute information, determine the detection category corresponding to the two attribute information.
[0037] Specifically, the two attribute information and the search text are substituted into the preset template to generate the detection input template.
[0038] In one embodiment, the detection input template of two attribute triples is input into the BERT model to determine the detection category of the two attribute triples; the number of word texts corresponding to the detection category is consistent with the number of mask texts.
[0039] S14: Based on the detection categories corresponding to the two attribute information, determine whether to merge the attribute triples corresponding to the two attribute information respectively.
[0040] Specifically, the similarity between the word text corresponding to the detection category and the text information corresponding to the first preset category is calculated as the first similarity; the similarity between the word text corresponding to the detection category and the text information corresponding to the second preset category is calculated as the second similarity; the first similarity and the second similarity are compared to determine whether to merge the attribute triples corresponding to the two attribute information respectively.
[0041] In one embodiment, the text information corresponding to the first preset category belongs to the same subject, and the text information corresponding to the second preset category belongs to different subjects; in response to the first similarity being greater than the second similarity, the attribute triples corresponding to the two attribute information are merged; in response to the first similarity being no greater than the second similarity, the attribute triples corresponding to the two attribute information are not merged, and the attribute triples corresponding to the two attribute information are assigned to different subjects.
[0042] The attribute triple merging method provided in this embodiment performs attribute detection on the acquired search text to obtain N attribute information contained in the search text, and generates N attribute triples corresponding to each attribute information, where N is a positive integer greater than or equal to 2; based on any two attribute information and the search text, it generates detection input templates corresponding to the two attribute information; based on the detection input templates corresponding to the two attribute information, it determines the detection category corresponding to the two attribute information; based on the detection category corresponding to the two attribute information, it determines whether to merge the attribute triples corresponding to the two attribute information. This application generates detection input templates by searching the text and its corresponding attribute information, thereby determining the detection category between attribute information, and determining whether to merge the corresponding attribute information based on the detection category, thereby improving the merging accuracy of attribute triples.
[0043] Please see Figure 2 , Figure 2This is a flowchart illustrating a specific embodiment of the attribute ternary combination and merging method provided by the present invention. This embodiment provides an attribute ternary combination and merging method, which includes the following steps.
[0044] S21: Construct a table showing the correspondence between category labels and related text.
[0045] In this embodiment, the category labels include a first preset category and a second preset category. The category labels for the first preset category are for the same subject, while the category labels for the second preset category are for different subjects.
[0046] In one embodiment, a first preset category corresponds to multiple tag-related texts, and the tag-related texts corresponding to the first preset category are the same as or similar to the category tags of the first preset category. For example, the tag-related texts corresponding to the first preset category include "same subject," "same subject," "same individual," "same individual," etc. That is, when the detection category corresponding to two attribute information is the same individual, the category tags corresponding to the two attribute information are determined to be the same subject.
[0047] In one embodiment, the second preset category corresponds to multiple tag-related texts, and the tag-related texts corresponding to the second preset category are the same as or similar to the category tags of the second preset category. For example, the tag-related texts corresponding to the second preset category include different subjects, the same individual, etc. That is, when the detection categories corresponding to two attribute information are different individuals, the category tags corresponding to the two attribute information are determined to be different subjects.
[0048] S22: Construct a preset template, which includes the original search text, first attribute information, second attribute information, and a preset number of mask texts.
[0049] Specifically, another core aspect of Prompt-learning is template construction. The quality of the template plays a crucial role in the final detection results of the BERT (Bidirectional Encoder Representations from Transformers) model. A good template can unlock the potential of the BERT model, enabling it to complete attribute triple combination tasks using very little labeled data.
[0050] In one specific embodiment, based on the analysis of the retrieval scenario and the characteristics of the attribute triples to be detected, a preset template is constructed as shown in Formula 1.
[0051] T1(x) = x. [Entity 1] and [Entity 2] belong to [MASK][MASK][MASK][MASK] (Formula 1)
[0052] In Formula 1: T1(x) represents the preset template, x represents the input original search text; Entity 1 and Entity 2 represent attribute information respectively; [MASK][MASK][MASK][MASK] represents the mask space for the detection category corresponding to the two attribute information. In this embodiment, the number of mask spaces corresponding to the preset category is four. In other embodiments, [MASK][MASK][MASK][MASK] in the preset template can be set according to the actual number of words in the preset category.
[0053] S23: The BERT model is obtained through training.
[0054] Specifically, BERT is a novel language representation model. BERT comprises two steps: pre-training and fine-tuning. In pre-training, the BERT model is trained on unlabeled data across various pre-training tasks, thus incorporating a large amount of common-sense knowledge. In fine-tuning, the BERT model is first initialized based on the parameters obtained from pre-training, and then all parameters are fine-tuned using labeled data from downstream specific tasks. The BERT model pre-training process utilizes Masked Language Modeling (MLM) and incorporates NextSentence Prediction (NSP). MLM primarily involves randomly masking certain positions in the input sequence and then predicting them using the model. The NSP task involves simultaneously inputting two sentences into the model and predicting whether the second sentence is the next sentence after the first. This embodiment primarily uses the MLM concept to implement an attribute triple combination method in a retrieval scenario.
[0055] The specific steps for training and obtaining the BERT model are as follows.
[0056] Please see Figure 3 , Figure 3 yes Figure 2 A flowchart illustrating a specific embodiment of step S23 in the provided attribute ternary combination method.
[0057] S231: Obtain the training dataset.
[0058] Specifically, the training dataset includes multiple training data templates, each template corresponding to a two-attribute triple; each training data template is associated with a labeled category. The labeled categories corresponding to each training data template can be the same subject or different subjects.
[0059] In one embodiment, the training data template can be T1(x) = "a 20-30 year old woman with a height of approximately 170-180 cm walking with a male named Zhang San". [Height approximately 170-180 cm] and [male] belong to [MASK][MASK][MASK][MASK]. The annotation category associated with this training data template is "different subjects".
[0060] In one embodiment, the training data template can be T1(x) = "a 20-30 year old woman with a height of approximately 170-180 cm walking with a male named Zhang San". [Height approximately 170-180 cm] and [woman] belong to [MASK][MASK][MASK][MASK]. Furthermore, the annotation category associated with this training data template is "same subject".
[0061] S232: Input the training data template into the BERT model to obtain the predicted category.
[0062] Specifically, the BERT model predicts the category corresponding to two attributes in the training data template and fills the four masked spaces in [MASK][MASK][MASK][MASK]. For example, it fills the four word texts of the predicted category "same subject" into the four masked spaces in the training data template in sequence.
[0063] S233: Iteratively train the BERT model based on the error value between the predicted category and the labeled category corresponding to the training data template.
[0064] Specifically, the error value between the predicted category and the labeled category corresponding to the training data template is calculated, and the BERT model is iteratively trained based on the error value.
[0065] In one specific embodiment, the error values are calculated by comparing the four word texts corresponding to the predicted category in the training data template with the four word texts corresponding to the labeled category. Then, the error values for each of the four word texts are summed to obtain the error value between the predicted and labeled categories. The BERT model is then iteratively trained based on this error value.
[0066] In one optional embodiment, the results of the BERT model are backpropagated, and the weights of the BERT model are adjusted based on the error value between the predicted category and the labeled category of the same training data template, thereby achieving the training of the BERT model.
[0067] The training data template is input into the BERT model, which detects the corresponding category between two attributes in the training data template. Training of the BERT model stops when the error between the predicted category and the labeled category corresponding to the training data template is less than a preset threshold (which can be set manually, such as 1% or 5%).
[0068] S24: Perform attribute detection on the obtained search text to obtain N attribute information contained in the search text, and generate attribute triples corresponding to the N attribute information respectively.
[0069] Specifically, retrieve the original input search text. For example, the original input search text is "women aged 20-30 who are about 170-180 cm tall and walking with a man named Zhang San".
[0070] The retrieved text is subjected to attribute detection to obtain multiple attribute information corresponding to the retrieved text. Specifically, attribute information in the retrieved text can be detected and extracted based on a deep learning network model. For example, the attribute information corresponding to the retrieved text "a woman aged 20-30 with a height of about 170-180 cm walking with a male named Zhang San" includes "height of about 170-180 cm", "male", "Zhang San", "20-30 years old", and "female".
[0071] Attribute triples are generated based on attribute information and knowledge graph schemas. For example, the attribute triples corresponding to each attribute information are: <person, height, around 170-180>, <person, gender, male>, <person, name, Zhang San>, <person, age, 20-30 years old>, <person, gender, female>.
[0072] S25: Substitute the two attribute information and the search text into the preset template to generate the detection input template.
[0073] Specifically, any two attribute information corresponding to the searched text and the searched text are input into a preset template to obtain the detection input template corresponding to the two attribute information.
[0074] In one specific embodiment, any two attribute information from all attribute information corresponding to the searched text are input into a preset template to obtain the corresponding detection input template.
[0075] For example, the detection input template can be in the following data format:
[0076] T1 = A woman aged 20-30, approximately 170-180cm tall, accompanying a man named Zhang San. [Approximately 170-180cm]
[0077] [Male] belongs to [MASK][MASK][MASK][MASK]; T1 = A woman aged 20-30, approximately 170-180cm tall, walking with a male named Zhang San. [Approximately 170-180cm]
[0078] [Zhang San] belongs to [MASK][MASK][MASK][MASK]; T1 = A woman aged 20-30, approximately 170-180cm tall, accompanying a male named Zhang San. [Approximately 170-180cm]
[0079] [20-30 years old] belongs to [MASK][MASK][MASK][MASK]; T1 = a 20-30 year old woman with a height of approximately 170-180 cm who is walking with a man named Zhang San. [Approximately 170-180 cm]
[0080] [Female] belongs to [MASK][MASK][MASK][MASK]; T1 = A woman aged 20-30, approximately 170-180cm tall, walking with male Zhang San. [Male]
[0081] [Zhang San] belongs to [MASK][MASK][MASK][MASK];
[0082] T1 = A woman aged 20-30, approximately 170-180cm tall, accompanying a man named Zhang San. [Male]
[0083] [20-30 years old] belongs to [MASK][MASK][MASK][MASK];
[0084] T1 = A woman aged 20-30, approximately 170-180cm tall, accompanying a man named Zhang San. [Male]
[0085] [Women] belong to [MASK][MASK][MASK][MASK];
[0086] T1 = A woman aged 20-30, approximately 170-180cm tall, accompanying a man named Zhang San. [Zhang San]
[0087] [20-30 years old] belongs to [MASK][MASK][MASK][MASK];
[0088] T1 = A woman aged 20-30, approximately 170-180cm tall, accompanying a man named Zhang San. [Zhang San]
[0089] [Women] belong to [MASK][MASK][MASK][MASK].
[0090] Compared with traditional clustering methods, this method can solve the problem of inaccurate clustering of attributes when the number of subjects in the search text is not fixed, and it is applicable to open domain information retrieval scenarios.
[0091] S26: Input the detection input templates corresponding to the two attribute information into the BERT model to determine the detection category corresponding to the two attribute information.
[0092] Specifically, each detection input template is input into the BERT model. The BERT model detects the categories corresponding to the two attribute information of the detection input template and fills the detected categories into the [MASK][MASK][MASK][MASK] field of the detection input template. The detection categories filled into [MASK][MASK][MASK][MASK] can be the same subject or different subjects.
[0093] S27: Calculate the similarity between the detected category and the first preset category and the second preset category, respectively.
[0094] Specifically, the similarity between the word text corresponding to the detected category and the text information corresponding to the first preset category is calculated as the first similarity. The text information corresponding to the first preset category belongs to the same subject. The similarity between the word text corresponding to the detected category and the text information corresponding to the second preset category is calculated as the second similarity; the text information corresponding to the second preset category belongs to different subjects.
[0095] In one specific embodiment, the probability value p that the detection category belongs to the same category as the first preset category and the probability value p that the detection category belongs to the same category as the second preset category are calculated based on the following formula 2.
[0096] p(y∈Y|x)=p(w∈V y |T(x))(Formula 2)
[0097] In Formula 2: w represents the word at the [MASK] position, V y This is a list of similar words in the category label-label related text correspondence table that belong to the same category as the first or second preset category.
[0098] S28: Compare the first similarity and the second similarity to determine whether to merge the attribute triples corresponding to the two attribute information respectively.
[0099] Specifically, in response to a first similarity score being greater than a second similarity score, the attribute triples corresponding to the two attribute information points of the detection input template are merged. That is, all attribute triples of the same subject are merged and attributed to the same subject. This results in person1: [<person, gender, male>, <person, name, Zhang San>], person2: [<person, height, approximately 170-180>, <person, gender, female>]. In one embodiment, in response to a probability value where the detection category belongs to the same category as the first preset category being greater than the probability value where the detection category belongs to the same category as the second preset category, the attribute triples corresponding to the two attribute information points of the detection input template are merged.
[0100] In another embodiment, in response to the first similarity being no greater than the second similarity, the attribute triples corresponding to the two attribute information of the detected input template are respectively assigned to different subjects.
[0101] The attribute triple merging method provided in this embodiment performs attribute detection on the acquired search text to obtain N attribute information contained in the search text, and generates N attribute triples corresponding to each attribute information, where N is a positive integer greater than or equal to 2; based on any two attribute information and the search text, it generates detection input templates corresponding to the two attribute information; based on the detection input templates corresponding to the two attribute information, it determines the detection category corresponding to the two attribute information; based on the detection category corresponding to the two attribute information, it determines whether to merge the attribute triples corresponding to the two attribute information. This application generates detection input templates by searching the search text and its corresponding attribute information, thereby determining the detection category between attribute information, and determining whether to merge the corresponding attribute information based on the detection category, thereby improving the merging accuracy of attribute triples.
[0102] See Figure 4 , Figure 4 This is a schematic diagram of the framework of an embodiment of the attribute ternary combination and merging device provided by the present invention. This embodiment provides an attribute ternary combination and merging device 60, which includes a preprocessing module 61, a generation module 62, a detection module 63, and a processing module 64.
[0103] The preprocessing module 61 is used to perform attribute detection on the acquired search text, obtain N attribute information contained in the search text, and generate attribute triplets corresponding to the N attribute information, where N is a positive integer greater than or equal to 2.
[0104] The generation module 62 is used to generate detection input templates corresponding to two attribute information based on any two attribute information and the search text.
[0105] The detection module 63 is used to determine the detection category corresponding to the two attribute information based on the detection input template corresponding to the two attribute information.
[0106] The processing module 64 is used to determine whether to merge the attribute triplets corresponding to the two attribute information based on the detection categories corresponding to the two attribute information.
[0107] The attribute triplet merging device provided in this embodiment generates a detection input template by retrieving text and its corresponding attribute information, thereby determining the detection category between attribute information, and determining whether to merge the corresponding attribute information based on the detection category, thereby improving the merging accuracy of attribute triplets.
[0108] Please see Figure 5 , Figure 5 This is a schematic diagram of a terminal embodiment provided in this application. The terminal 80 includes a memory 81 and a processor 82 coupled to each other. The processor 82 is used to execute program instructions stored in the memory 81 to implement the steps of any of the above-described attribute ternary combination method embodiments. In a specific implementation scenario, the terminal 80 may include, but is not limited to, a microcomputer or a server. In addition, the terminal 80 may also include mobile devices such as laptops and tablets, which are not limited here.
[0109] Specifically, processor 82 controls itself and memory 81 to implement the steps of any of the above-described attribute ternary combination method embodiments. Processor 82 can also be referred to as a CPU (Central Processing Unit). Processor 82 may be an integrated circuit chip with signal processing capabilities. Processor 82 can also be a general-purpose processor, digital signal processor (DSP), application-specific integrated circuit (ASIC), field-programmable gate array (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components. A general-purpose processor can be a microprocessor or any conventional processor. Furthermore, processor 82 can be implemented using integrated circuit chips.
[0110] Please see Figure 6 , Figure 6 This is a schematic diagram of an embodiment of a computer-readable storage medium provided in this application. The computer-readable storage medium 90 stores program instructions 901 that can be executed by a processor. The program instructions 901 are used to implement the steps of any of the above-described attribute ternary combination method embodiments.
[0111] In some embodiments, the functions or modules of the apparatus provided in this disclosure can be used to perform the methods described in the above method embodiments. The specific implementation can be referred to the description of the above method embodiments, and for the sake of brevity, it will not be repeated here.
[0112] The description of the various embodiments above tends to emphasize the differences between the various embodiments. The similarities or similarities between them can be referred to, and for the sake of brevity, they will not be repeated here.
[0113] In the several embodiments provided in this application, it should be understood that the disclosed methods and apparatus can be implemented in other ways. For example, the apparatus implementations described above are merely illustrative. For instance, the division of modules or units is only a logical functional division, and in actual implementation, there may be other division methods. For example, units or components 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 of devices or units may be electrical, mechanical, or other forms.
[0114] 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 as a software functional unit.
[0115] If the integrated unit 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, 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 storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) or processor to execute all or part of the steps of the methods of various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.
[0116] If the technical solution of this application involves personal information, the product using this technical solution has clearly informed the user of the personal information processing rules and obtained the user's voluntary consent before processing the personal information. If the technical solution of this application involves sensitive personal information, the product using this technical solution has obtained the user's separate consent before processing the sensitive personal information, and also meets the requirement of "express consent". For example, at personal information collection devices such as cameras, clear and prominent signs are set up to inform users that they have entered the scope of personal information collection and that personal information will be collected. If an individual voluntarily enters the collection scope, it is deemed that they have agreed to the collection of their personal information; or on the personal information processing device, with clear signs / information informing users of the personal information processing rules, authorization is obtained from the individual through pop-up information or by asking the individual to upload their personal information; wherein, the personal information processing rules may include information such as the personal information processor, the purpose of personal information processing, the processing method, and the types of personal information processed.
[0117] The above are merely embodiments of the present invention and do not limit the scope of patent protection of the present invention. Any equivalent structural or procedural transformations made based on the content of the present invention's specification and drawings, or direct or indirect applications in other related technical fields, are similarly included within the scope of patent protection of the present invention.
Claims
1. A method for combining attribute ternaries, characterized in that, The attribute ternary combination method includes: The obtained search text is subjected to attribute detection to obtain N attribute information contained in the search text, and attribute triplet corresponding to the N attribute information is generated, where N is a positive integer greater than or equal to 2; Based on any two of the attribute information and the search text, a detection input template corresponding to the two attribute information is generated; wherein, a preset template is constructed, the preset template includes the original search text, the first attribute information, the second attribute information, and a preset number of mask texts, the preset number of mask texts representing the mask empty spaces of the detection categories corresponding to the first attribute information and the second attribute information; the step of generating the detection input template corresponding to the two attribute information based on any two of the attribute information and the search text includes: filling the two attribute information and the search text into the preset template to generate the detection input template corresponding to the two attribute information; Based on the detection input template corresponding to the two attribute information, the detection category corresponding to the two attribute information is determined; Based on the detection category corresponding to the two attribute information, determine whether to merge the attribute triplets corresponding to the two attribute information respectively; The step of determining the detection category corresponding to the two attribute information based on the detection input template corresponding to the two attribute information includes: inputting the detection input template corresponding to the two attribute information into the BERT model to determine the detection category corresponding to the two attribute information; the number of word texts corresponding to the detection category is consistent with the number of mask texts.
2. The attribute ternary combination method according to claim 1, characterized in that, The attribute ternary combination method also includes: Construct a category label-label-related text correspondence table; wherein the category label-label-related text correspondence table includes at least two category labels and the label-related text mapped to each category label respectively; the number of words in the label-related text is the same as the number of words in the category label.
3. The attribute ternary combination method according to claim 1, characterized in that, The training methods for the BERT model include: Obtain a training dataset, which includes multiple training data templates. Each training data template is a template corresponding to a two-attribute triplet. Each training data template is associated with a labeled category. The training data template is input into the BERT model to obtain the predicted category; The BERT model is iteratively trained based on the error value between the predicted category and the labeled category corresponding to the training data template.
4. The attribute ternary combination method according to claim 2, characterized in that, The category labels include a first preset category and a second preset category; The step of determining whether to merge the attribute triples corresponding to the two attribute information based on the detection category includes: The similarity between the word text corresponding to the detected category and the text information corresponding to the first preset category is calculated as the first similarity. The similarity between the word text corresponding to the detected category and the text information corresponding to the second preset category is calculated as the second similarity. The first similarity and the second similarity are compared to determine whether to merge the attribute triples corresponding to the two attribute information respectively.
5. The attribute ternary combination method according to claim 4, characterized in that, The text information corresponding to the first preset category belongs to the same subject, while the text information corresponding to the second preset category belongs to different subjects; The step of comparing the first similarity and the second similarity to determine whether to merge the attribute triples corresponding to the two attribute information includes: If the first similarity is greater than the second similarity, then the attribute triples corresponding to the two attribute information are merged. If the first similarity is not greater than the second similarity, then the attribute triples corresponding to the two attribute information are assigned to different subjects.
6. A ternary attribute combination device, characterized in that, The attribute ternary combination device includes: The preprocessing module is used to perform attribute detection on the acquired search text, obtain N attribute information contained in the search text, and generate attribute triplets corresponding to the N attribute information, where N is a positive integer greater than or equal to 2. A generation module is used to generate a detection input template corresponding to any two attribute information and the search text; wherein, a preset template is constructed, the preset template including the original search text, first attribute information, second attribute information, and a preset number of mask texts, the preset number of mask texts representing the mask empty spaces of the detection categories corresponding to the first attribute information and the second attribute information; the step of generating the detection input template corresponding to the two attribute information based on any two attribute information and the search text includes: filling the two attribute information and the search text into the preset template to generate the detection input template corresponding to the two attribute information; The detection module is used to determine the detection category corresponding to the two attribute information based on the detection input template corresponding to the two attribute information; wherein, the detection input template corresponding to the two attribute information is input into the BERT model to determine the detection category corresponding to the two attribute information; the number of word texts corresponding to the detection category is consistent with the number of mask texts; The processing module is used to determine whether to merge the attribute triplets corresponding to the two attribute information based on the detection category corresponding to the two attribute information.
7. A terminal, characterized in that, The terminal includes a memory, a processor, and a computer program stored in the memory and running on the processor, the processor being used to execute program data to implement the steps in the attribute ternary combination method as described in any one of claims 1 to 5.
8. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program that, when executed by a processor, implements the steps of the attribute ternary combination method as described in any one of claims 1 to 5.