A method and apparatus for determining information similarity
By acquiring entities and relationships in information processing, updating the knowledge base, and converting them into representation vectors to calculate similarity, the problem of inaccurate judgment based solely on text similarity in existing technologies is solved, achieving more accurate determination of information similarity.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-07-14
- Publication Date
- 2026-03-10
AI Technical Summary
In existing technologies, when determining information similarity solely based on the degree of similarity of information text, the influence of entities and relationships cannot be fully considered, leading to inaccurate similarity. This is especially true when the executor and the person subject to execution are different in case information, or when the location and time of occurrence are different, resulting in the failure of similarity judgment.
By acquiring entities and entity relationships from the information to be processed, updating the knowledge base, and matching it with entities and relationships from previously processed information, the similarity is represented using a knowledge graph approach, and then the similarity is calculated after being converted into a representation vector.
It improves the accuracy of information similarity by fully considering the influence of entities and relationships, ensuring more precise similarity judgment.
Smart Images

Figure CN115270751B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of natural language processing, and particularly relates to a method and device for determining information similarity. BACKGROUND
[0002] In many industries at present, in order to improve the efficiency of information processing, the method of fusing information and extracting similar information in the past is becoming more and more common. For example, when receiving a complaint, some telecom operators can obtain similar past complaint cases, and thus can quickly solve the current complaint case.
[0003] Therefore, how to obtain information similar to the information to be processed is particularly important. The common method at present is to convert information text into vectors, determine the similarity between information texts based on the distance between vectors, and determine the similarity of information according to the similarity of texts. However, in many cases, the similarity of information texts cannot represent the similarity of information. For example, the text content in two cases is similar, but the executants and the executed persons in the cases are different or the locations and the occurrence times are different, which leads to a big difference between the two cases. Therefore, it is not enough to determine the similarity of information only by considering the similarity of texts. SUMMARY
[0004] The present application provides a method and device for determining information similarity, to improve the accuracy of the determined information similarity.
[0005] In a first aspect, the present application provides a method for determining information similarity, comprising:
[0006] obtaining a plurality of entities contained in the information to be processed and the relationships between the plurality of entities;
[0007] updating a knowledge base based on the matching result of the plurality of entities and the relationships between the plurality of entities and the entities contained in the knowledge base and the relationships between the entities; the knowledge base is constructed based on the entities contained in a plurality of past processed information;
[0008] determining the similarity between the information to be processed and the plurality of past processed information according to the distance between the representation vector corresponding to the information to be processed in the updated knowledge base and the representation vector corresponding to the plurality of past processed information.
[0009] Based on the above scheme, the application first compares the entities in the to-be-processed information and the similarity between the relationships between the entities with the similarity between the entities in the past processed information and the relationships between the entities in the past processed information, and represents the similarity between the entities contained in the to-be-processed information and the past processed information in the form of a knowledge graph. Further, the steps of converting the representation vector and calculating the similarity are performed. Compared with the scheme in the prior art that directly determines the similarity between information according to the distance between the text vectors corresponding to the information texts, the method proposed in the application fully considers the influence of the entities in the information on the similarity between the information, so that the determined similarity between the information is more accurate.
[0010] In some embodiments, the updating the knowledge base based on the matching result of the plurality of entities and the relationships between the plurality of entities with the entities and the relationships between the entities contained in the knowledge base comprises:
[0011] When there is a second entity in the knowledge base that matches the first entity successfully, and the relationship related to the first entity is not equal to the relationship related to the second entity, adding the relationship related to the first entity to the second entity;
[0012] When there is no entity in the knowledge base that matches the first entity successfully, adding the first entity and the relationship related to the first entity to the knowledge base;
[0013] Wherein, the first entity is any one of the plurality of entities.
[0014] In some embodiments, the matching process of the plurality of entities and the relationships between the plurality of entities with the entities and the relationships between the entities contained in the knowledge base comprises:
[0015] Matching any one of the plurality of entities with the entities contained in the knowledge base respectively;
[0016] If there is an entity in the knowledge base that matches the any one entity successfully, matching the relationship related to the matched entity with the relationship related to the first entity.
[0017] In some embodiments, the obtaining the plurality of entities contained in the to-be-processed information and the relationships between the plurality of entities comprises:
[0018] Converting the to-be-processed information into a text vector;
[0019] Determining the positions of the plurality of entities and the relationships between the plurality of entities contained in the text vector by using a pre-trained neural network model;
[0020] determine positions of the plurality of entities and the relationships among the plurality of entities in the to-be-processed information according to positions of the plurality of entities and the relationships among the plurality of entities in the text vector;
[0021] extract the plurality of entities and the relationships among the plurality of entities from the to-be-processed information according to the positions of the plurality of entities and the relationships among the plurality of entities in the to-be-processed information.
[0022] In some embodiments, the method further includes:
[0023] transform the to-be-processed information in the updated knowledge base and the plurality of past processed information into representation vectors respectively by using a graph embedding algorithm.
[0024] In some embodiments, the method further includes:
[0025] output a set number of past processed information in a descending order of similarity according to the similarity between the to-be-processed information and the plurality of past processed information respectively.
[0026] In a second aspect, an embodiment of the present application provides a device for determining information similarity, including:
[0027] an obtaining unit, configured to obtain a plurality of entities contained in to-be-processed information and relationships among the plurality of entities;
[0028] a processing unit, configured to update a knowledge base based on a matching result of the plurality of entities and the relationships among the plurality of entities and entities contained in the knowledge base and relationships among the entities; the knowledge base is constructed based on entities contained in a plurality of past processed information;
[0029] the processing unit is further configured to determine similarity between the to-be-processed information and the plurality of past processed information respectively according to distances between representation vectors corresponding to the to-be-processed information in the updated knowledge base and representation vectors corresponding to the plurality of past processed information.
[0030] In some embodiments, the processing unit is specifically configured to:
[0031] when there is a second entity in the knowledge base that matches the first entity successfully and a relationship related to the first entity is not equal to a relationship related to the second entity, add the relationship related to the first entity to the second entity;
[0032] when there is no entity in the knowledge base that matches the first entity successfully, add the first entity and the relationship related to the first entity to the knowledge base;
[0033] The first entity is any one of the plurality of entities.
[0034] In some embodiments, the processing unit is further configured to match the plurality of entities and the relationships between the plurality of entities with entities and relationships between entities contained in a knowledge base, in particular configured to:
[0035] match each of the plurality of entities with an entity contained in the knowledge base;
[0036] when there is a matched entity in the knowledge base that matches the any one entity, match the relationship related to the matched entity with the relationship related to the first entity.
[0037] In some embodiments, the obtaining unit is in particular configured to:
[0038] convert the to-be-processed information into a text vector by the processing unit; determine positions of the plurality of entities and the relationships between the plurality of entities contained in the text vector by using a pre-trained neural network model; and determine positions of the plurality of entities and the relationships between the plurality of entities in the to-be-processed information according to the positions of the plurality of entities and the relationships between the plurality of entities in the text vector.
[0039] extract the plurality of entities and the relationships between the plurality of entities from the to-be-processed information according to the positions of the plurality of entities and the relationships between the plurality of entities in the to-be-processed information.
[0040] In some embodiments, the processing unit is further configured to:
[0041] convert the to-be-processed information and the plurality of past processed information in the updated knowledge base into representation vectors respectively by using a graph embedding algorithm.
[0042] In some embodiments, the processing unit is further configured to:
[0043] output a set number of past processed information in a descending order of similarity according to similarities between the to-be-processed information and the plurality of past processed information respectively.
[0044] In a third aspect, an electronic device is provided, which includes a controller and a memory. The memory is configured to store computer-executable instructions, and the controller is configured to execute the computer-executable instructions in the memory to perform the operation steps of the method of any possible implementation of the first aspect by using hardware resources in the controller.
[0045] In a fourth aspect, a computer readable storage medium is provided, and the computer readable storage medium stores instructions which, when executed on a computer, cause the computer to perform the method of any of the above aspects.
[0046] In addition, the beneficial effects of the second aspect to the fourth aspect can refer to the beneficial effects as described in the first aspect, which will not be repeated here. BRIEF DESCRIPTION OF DRAWINGS
[0047] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings needed to be used in the embodiment description will be briefly introduced as follows. Obviously, the drawings in the following description are only some embodiments of the present application, and other drawings can also be obtained by those skilled in the art without creative labor on the basis of these drawings.
[0048] Figure 1 A flow chart of a method for determining information similarity provided by the embodiments of the present application is provided.
[0049] Figure 2 A flow chart of a method for obtaining entities and relationships between entities contained in the information to be processed provided by the embodiments of the present application is provided.
[0050] Figure 3 A flow chart of a method for updating the knowledge base provided by the embodiments of the present application is provided.
[0051] Figure 4 A flow chart of a method for determining information similarity based on the updated knowledge base provided by the embodiments of the present application is provided.
[0052] Figure 5 A structural schematic diagram of an information similarity determination device provided by the embodiments of the present application is provided.
[0053] Figure 6 A structural schematic diagram of an electronic device provided by the embodiments of the present application is provided. DETAILED DESCRIPTION
[0054] In order to make the purpose, technical solutions and advantages of the embodiments of the present application more clear, the technical solutions in the embodiments of the present application will be described clearly and completely with reference to the drawings of the embodiments of the present application.
[0055] It should be noted that the terms "first", "second", and the like in the present application are used to distinguish similar objects, and do not necessarily have to be used to describe a specific order or sequence. The data used in this way should be understood to be interchangeable under appropriate circumstances, so that the embodiments of the disclosure described herein can be implemented in an order other than those illustrated or described herein. The implementation described in the following exemplary embodiments does not represent all implementations consistent with the present application. Rather, they are merely examples of devices and methods consistent with some aspects of the present application as detailed in the appended claims.
[0056] Deep learning is part of a broader family of machine learning methods based on artificial neural networks. Learning can be supervised, semi-supervised or unsupervised. Deep learning models, such as deep neural networks, deep belief networks, recurrent neural networks and convolutional neural networks, have been applied to fields including computer vision, speech recognition, natural language processing, audio recognition, social network filtering, machine translation, bioinformatics, drug design, medical image analysis, material inspection and chess game programs.
[0057] Natural language processing is a discipline that studies language problems in human-to-human communication and human-to-computer communication. Simply put, it is a computer that accepts user natural language form input, and internally processes, calculates and other series of operations through human-defined algorithms, to simulate human understanding of natural language, and returns the results expected by the user. The purpose of natural language processing is to replace manual processing of large-scale natural language information with computers. It mainly includes automatic word segmentation, part-of-speech tagging, syntax analysis, text classification, information extraction, etc. It is a cross field of artificial intelligence, computer science, information engineering, and knowledge of design statistics, linguistics.
[0058] With the wide application of natural language processing technology and deep learning, information similarity calculation is also increasingly applied in various industries. When processing information, users can obtain similar information processed in the past based on information similarity calculation, and the efficiency and accuracy of processing information can be improved based on similar information in the past. However, in related technologies, when calculating information similarity, a pre-trained model is generally used to convert the information to be processed and the past information into text vectors, and the similarity of the information is determined based on the distance between the text vectors. However, in some scenarios, the similarity of information is not simply the degree of text similarity, but depends on some elements in the information. For example, some information about cases, even if the text content of two cases is relatively similar, the difference between the executor and the executed person of the case will result in a big difference in the similarity of the case.
[0059] To solve this problem, the embodiment of the present application provides a method for determining information similarity, which extracts elements in the information to be processed and the relationship between each element. The elements and the relationship are matched with the past processed information in a knowledge base, and the knowledge base is updated based on the matching result. The past processed information and the information to be processed included in the updated knowledge base are converted into feature vectors, the distance between each feature vector is calculated, and the similarity between the information to be processed and the past processed information is determined according to the distance. It can be seen that the present application does not simply determine the similarity between information based on the similarity of the text, but first associates the information to be processed with the past processed information based on the similarity of the elements and the relationship, and then performs the steps of converting the feature vectors and calculating the similarity. Compared with the method for determining the similarity in the prior art, the method proposed in the present application determines the similarity by fully considering the influence of the elements in the information on the similarity, so that the determined similarity of the information is more accurate.
[0060] Next, a method and device for determining information similarity are described in detail. In the embodiments described below, "and / or" describes the association relationship of the associated objects, which means that there can be three kinds of relationships, for example, A and / or B, which can represent the following three cases: A exists alone, A and B exist together, and B exists alone, where A and B can be singular or plural. The character " / " generally represents an "or" relationship between the associated objects before and after it. "At least one of the following" or similar expressions means any combination of these items, including any combination of single item or multiple items. For example, at least one of a, b or c can represent a, b, c, a-b, a-c, b-c, or a-b-c, where a, b, and c can be single or multiple. The singular expressions "one", "a kind", "the", "the above", "the", and "this" are intended to also include expressions such as "one or more", unless the context clearly indicates otherwise. In addition, unless otherwise stated, the ordinal numbers "first", "second", etc. mentioned in the embodiments of the present application are used to distinguish a plurality of objects, and are not used to limit the order, time sequence, priority or importance of the plurality of objects. For example, the first task execution device and the second task execution device are only used to distinguish different task execution devices, and do not represent the difference in priority or importance of the two task execution devices.
[0061] Reference within the specification of this application to "one embodiment" or "some embodiments" means that a particular feature, structure, or characteristic described in connection with the embodiment is included in at least one embodiment of the application. The appearances of the phrase "in one embodiment" or "in some embodiments" in various places within specified descriptions in this specification are not necessarily all referring to the same embodiment, however, but can refer to one or more but not all embodiments. The terms "including," "comprising," "featuring," and variations thereof are meant to encompass the items listed thereafter and equivalents thereof as well as additional items.
[0062] To facilitate the understanding of the schemes provided by various embodiments of the present application, first, the technical terms involved in the present application are briefly introduced:
[0063] (1) Named Entity Recognition (NER): also known as named entity recognition, refers to recognizing entities with specific meanings in text, mainly including names, place names, organization names, and proper nouns. It usually includes two parts: entity boundary recognition; and determining entity categories (names, place names, organization names, or others).
[0064] (2) Relation Extraction (RE) is a natural language processing task aimed at extracting relationships between entities. Relation extraction is a key technology in automatic knowledge graph construction. Through relation extraction, new relationship facts can be extracted to expand the knowledge graph. Optionally, Open NRE can be used for relation extraction. Open NRE is an open and extensible toolkit that provides a unified framework for implementing relation extraction models.
[0065] (3) Knowledge graph: a knowledge graph is essentially a semantic network, whose nodes represent entities or concepts, and edges represent various semantic relationships between entities or concepts. It can describe cognitive knowledge at various levels of concepts, facts, rules, etc. Knowledge graph, with its rich semantic representation ability and flexible structure, has become an effective carrier for representing information and knowledge in the cognitive and physical worlds in the computer world, and has become an important infrastructure for artificial intelligence applications.
[0066] (4) BERT model: a language representation model, which includes two steps in the processing process: pre-training and fine-tuning. In pre-training, the model is based on unlabeled data and trained on different pre-training tasks, so the BERT model contains a large amount of common sense knowledge. In fine-tuning, the model is first initialized based on the parameters obtained by pre-training, and then all parameters are fine-tuned using labeled data from the specific task downstream.
[0067] (5) Sigmoid function: used for the output of hidden layer neurons, the value range is (0, 1), which can map a real number to the interval (0, 1) and can be used for binary classification. It is better when the feature difference is relatively complex or not particularly large. The function expression can be seen in formula (1) as follows:
[0068]
[0069] wherein z is the input of the function, σ(z) is the output of the function, the value range of z is (-∞, +∞), and the value range of σ(z) is (0, 1).
[0070] (6) Graph embedding: a process of mapping graph data (usually high-dimensional dense matrix) into low-dimensional sparse vector, which can well solve the problem that graph data is difficult to be efficiently input into machine learning algorithm. Common graph embedding representation techniques include graph convolutional network (GCN) and graph attention network (GAT).
[0071] Next, the scheme provided by the present application is specifically introduced, please refer to Figure 1 A flowchart of an information similarity determination method provided by an embodiment of the present application. It should be noted that the present application does not limit the execution subject of the information similarity determination method, for example, the information similarity determination method can be executed by a computer, a mobile phone or other terminal, or can be executed by a server, a processing chip or other electronic device with computing capability. Figure 1 The method flow specifically includes:
[0072] 101, obtaining a plurality of entities contained in the to-be-processed information and relationships between the plurality of entities.
[0073] Optionally, the plurality of entities can be extracted from the to-be-processed information by using a named entity recognition technology, and the relationships between the plurality of entities can be extracted from the to-be-processed information by using a relationship extraction technology.
[0074] For example, if the to-be-processed information contains the name of the performer as Zhang San and the mobile phone number as 123XXXXXXXX, the entities recognized from the to-be-processed information include: entity A: Zhang San, and entity B: 123XXXXXXXX, and the relationship between entity A and entity B is that entity B is the mobile phone number of entity A.
[0075] 102, updating the knowledge base based on the matching result of the plurality of entities and the relationships between the plurality of entities and the entities contained in the knowledge base and the relationships between the entities.
[0076] The knowledge base is built based on entities contained in the plurality of processed information. The knowledge base includes entities contained in the plurality of processed information and relationships between the entities. For example, two pieces of processed information each include three entities, and the knowledge base includes six entities and relationships between the six entities.
[0077] Optionally, the entities and relationships contained in the to-be-processed information can be added to the knowledge base according to the matching result of the entities and relationships in the to-be-processed information and the entities and relationships in the knowledge base, so as to complete the updating of the knowledge base.
[0078] 103. Determine the similarity between the to-be-processed information and each piece of processed information according to the distance between the representation vector corresponding to the to-be-processed information in the updated knowledge base and the representation vector corresponding to the processed information.
[0079] Optionally, after the updating of the knowledge base is completed, the graph embedding algorithm can be used to convert each piece of information (including the to-be-processed information and the plurality of processed information) included in the updated knowledge base into a representation vector. For example, each piece of information in the knowledge base can be regarded as a sub-knowledge graph, and the graph embedding representation technology can be used to convert the sub-knowledge graph into a representation vector.
[0080] In one possible implementation, the distance between the representation vector corresponding to the to-be-processed information and the representation vector corresponding to each piece of processed information can be calculated. Further, the similarity between the to-be-processed information and each piece of processed information can be determined based on the distance.
[0081] Based on the above scheme, the present application first compares the similarity of entities and relationships between entities in the to-be-processed information and the processed information, and represents the similarity of entities contained in the to-be-processed information and the processed information in the form of a knowledge graph. Further, the steps of converting the representation vector and calculating the similarity are performed. Compared with the scheme in the prior art that directly determines the similarity between information according to the distance between the text vectors corresponding to the information texts, the method proposed in the present application fully considers the influence of entities in information on the similarity of information, so that the determined similarity of information is more accurate.
[0082] In some embodiments, the to-be-processed information can be converted into a text vector when a plurality of entities contained in the to-be-processed information and a relationship between the plurality of entities are acquired. The manner adopted by the present application for converting the to-be-processed information into a text vector is not specifically limited, for example, the to-be-processed information can be converted into a text vector by using a word2vec model. Further, a pre-trained neural network model can be used to determine the positions of the plurality of entities contained in the text vector. The positions of the plurality of entities in the to-be-processed information can be determined according to the positions of the plurality of entities in the text vector. Further, the plurality of entities can be extracted based on the positions of the plurality of entities in the to-be-processed information.
[0083] In a possible implementation manner, an entity can be determined based on a description of the entity and a relationship predicate related to the entity. For example, taking an entity and a relationship related to the entity as an example, the entity and the relationship related to the entity can be extracted by using a slot filling manner. Optionally, a slot template can be defined first, and the format of the slot template can be R(e, a), where R is a relationship predicate, e is a description of an entity, and a is the entity. For example, if an executor contained in to-be-processed information is Zhang San, the generated slot template is: the name of the executor (the executor, Zhang San). Further, a corresponding natural text question can be generated based on the slot template, for example: question: what is the name of the executor? answer: Zhang San. Optionally, a separator can be used to separate the question and the answer to avoid recognition errors. Further, the natural text question and the answer can be converted into a text vector, and a pre-trained neural network model can be used to determine the positions of the plurality of entities and the relationship between the plurality of entities in the text vector. Thus, the positions of the plurality of entities and the relationship between the plurality of entities in the to-be-processed information can be determined, and the entity and the relationship can be extracted based on the determined positions.
[0084] Optionally, before the entity and the relationship are extracted from the to-be-processed information, the to-be-processed information can be preprocessed first to avoid recognition errors. For example, some entities in the to-be-processed information can be replaced by synonyms, for example, the words such as executor, implementer, or case handler can be replaced by the word of executor.
[0085] In order to facilitate understanding of the process of acquiring the entity and the relationship between the entities in the to-be-processed information, specific embodiments will be introduced below, for example, Figure 2 A method flowchart for acquiring an entity contained in to-be-processed information and a relationship between the entities is provided for implementation of the present application, and the method flowchart comprises the following steps:
[0086] 201, preprocessing the to-be-processed information.
[0087] Optionally, the preprocessing can be replacing some ambiguous words in the information to be processed to avoid machine recognition errors. The specific preprocessing process can be referred to the description in the above embodiments, which will not be described here.
[0088] 202, determining answers of the predefined questions based on the information to be processed, to obtain a plurality of question-answer texts.
[0089] Optionally, the entities in the information to be processed and the relationships related to each entity can be obtained by using a predefined slot template, and then the plurality of question-answer texts can be generated based on the slot template.
[0090] For example, a generated slot template is: the name of the executor (executor, Zhang San). The predefined question is: What is the name of the executor? Based on the slot template, the answer of the question can be obtained, thereby generating the question-answer text: "Question: What is the name of the executor? Answer: Zhang San".
[0091] 203, converting the plurality of question-answer texts into text vectors respectively.
[0092] Optionally, the BERT model can be used to deeply encode each word in the question-answer text to obtain deep semantic information of the question-answer text. Further, each word can be encoded based on the context semantic information of the word to obtain a word vector corresponding to the word. Further, the plurality of word vectors obtained can be combined as a text vector.
[0093] 204, determining the positions of the plurality of entities and the relationships related to the plurality of entities in the information to be processed based on each text vector.
[0094] As a possible implementation manner, the text vector can be first linearly transformed by a first linear layer pre-trained, and then the output result of the first linear layer can be subjected to a Sigmoid function. Thus, a score value of each word belonging to the start position of the entity can be obtained, and the score value can be normalized for easy judgment. For example, if the normalized value is greater than 0.5, the value is set to 1, otherwise it is set to 0. The word position with the value of 1 can be taken as the start position of the entity. Similarly, the text vector can be linearly transformed by a second linear layer pre-trained, and then the output result of the second linear layer can be subjected to a Sigmoid function. Thus, the end position of the entity can be determined.
[0095] Further, based on the determined start position and end position of the entity, the position of the entity in the information to be processed can be determined. Optionally, the position of the relationship related to the entity can also be determined by using the above method for determining the position of the entity, which will not be described here.
[0096] 205, extracting a plurality of entities and relationships related to the entities from the to-be-processed information according to the determined position.
[0097] In some embodiments, after the entities and relationships included in the to-be-processed information are acquired, the acquired entities and relationships can be matched with the entities and relationships in the knowledge base. Optionally, the entities in the to-be-processed information can be matched with the entities included in the knowledge base, and if there is an entity in the knowledge base that is the same as any entity in the to-be-processed information, it is determined that the matching is successful. For ease of description, the entity in the to-be-processed information that is matched successfully is referred to as a first entity, and the entity in the knowledge base that is matched successfully with the first entity is referred to as a second entity. Further, after the first entity and the second entity are matched successfully, the relationships related to the first entity and the second entity can be matched, and if there is a second relationship related to the second entity that is the same as a first relationship related to the first entity, it is determined that the second relationship of the second entity and the first relationship of the first entity are matched successfully.
[0098] As a possible implementation, after the plurality of entities included in the to-be-processed information and the relationships between the plurality of entities are matched with the entities included in the knowledge base and the relationships between the entities, the knowledge base can be updated according to the matching result.
[0099] In some embodiments, when the first entity and the second entity are matched successfully, and the first relationship related to the first entity is not the same as all relationships related to the second entity, the first relationship can be added to the second entity. For example, the first entity is Zhang San, and the first relationship related to Zhang San is that the gender of Zhang San is male. The second entity is also Zhang San, and the relationships related to the second entity do not include the gender of Zhang San. Therefore, the relationship "the gender of Zhang San is male" can be added to the knowledge base as a relationship related to the second entity.
[0100] In other embodiments, when there is no entity in the knowledge base that is matched successfully with the first entity, the first entity and the relationship related to the first entity can be directly added to the knowledge base.
[0101] In still other embodiments, when the first entity and the second entity are matched successfully, and the first relationship related to the first entity is matched successfully with the second relationship related to the second entity, it is indicated that the first entity and the first relationship are already in the knowledge base, and therefore the first entity and the first relationship do not need to be added to the knowledge base.
[0102] In order to further understand the process of updating the knowledge base proposed in the present application, specific embodiments will be introduced below. See Figure 3 A flowchart of a method for updating a knowledge base provided in an embodiment of the present application is shown in FIG. 3, which specifically includes the following steps.
[0103] 301, acquiring a first entity and a plurality of entities included in a knowledge base.
[0104] wherein the first entity is any one of the entities included in the information to be processed.
[0105] 302, judging whether there is an entity matching the first entity successfully in the knowledge base.
[0106] If there is, the entity matching the first entity successfully is referred to as a second entity, and step 303 is continued.
[0107] If there is not, step 305 is continued.
[0108] 303, judging whether there is a relationship matching the first relationship successfully related to the first entity.
[0109] wherein the first relationship is any one of the relationships related to the first entity.
[0110] If there is, the relationship matching the first relationship successfully is referred to as a second relationship, and step 306 is continued.
[0111] If there is not, step 304 is continued.
[0112] 304, adding the first relationship for the second entity in the knowledge base.
[0113] 305, adding the first entity and the relationships related to the first entity in the knowledge base.
[0114] 306, not updating the knowledge base.
[0115] Optionally, after the operation of updating the knowledge base is completed, the information included in the knowledge base can be converted into a representation vector based on the updated knowledge base. For example, a graph embedding algorithm can be used to convert each information (including the information to be processed and the plurality of past processed information) included in the updated knowledge base into a representation vector.
[0116] Further, the distance between the representation vector corresponding to the information to be processed and other representation vectors can be calculated. Optionally, the Euclidean distance or the cosine angle distance can be calculated. For example, the following formula (2) can be used to calculate the distance:
[0117]
[0118] wherein s is the distance between the representation vector corresponding to the information to be processed and the representation vector corresponding to any one of the plurality of past processed information, x i is the representation vector corresponding to the information to be processed, y i is the representation vector corresponding to any one of the plurality of past processed information, and t is the dimension of the vector.
[0119] Optionally, after the distances between the representation vector of the information to be processed and the representation vectors corresponding to the plurality of information processed in the past are calculated, the similarity between the information to be processed and the plurality of information processed in the past can be determined based on the calculated distances. As an example, the similarity and the distance can have a certain positive correlation linear relationship, that is, the closer the representation vector corresponding to the information to the representation vector of the information to be processed, the higher the similarity between the information to be processed and the information corresponding to the representation vector.
[0120] To further understand the scheme of determining the similarity based on the updated knowledge base proposed in the present application, specific embodiments will be introduced below. Referring to Figure 4 A flow chart of a method for determining the similarity of information based on the updated knowledge base provided in the embodiments of the present application, specifically comprising:
[0121] 401, converting a plurality of information included in the updated knowledge base into representation vectors respectively.
[0122] Among them, the updated knowledge base includes information to be processed and a plurality of information processed in the past.
[0123] Optionally, each information can be regarded as a sub-knowledge graph in the knowledge base, and a graph embedding representation technology can be used to convert each sub-knowledge graph into a representation vector.
[0124] 402, calculating the distances between the representation vector corresponding to the information to be processed and the representation vectors corresponding to the plurality of information processed in the past respectively.
[0125] The algorithm used by the present application to calculate the distance is not limited, such as calculating the Euclidean distance or the cosine angle distance, etc.
[0126] 403, determining the similarity of information according to the plurality of distances calculated.
[0127] Specifically, the closer the representation vector corresponding to the information to the representation vector of the information to be processed, the higher the similarity between the information to be processed and the information corresponding to the representation vector.
[0128] In some embodiments, after determining the similarity between the to-be-processed information and each of the plurality of past processed information, a set number of past processed information can be output in descending order of similarity. For example, assuming that the set number is three, and the knowledge base includes four past processed information, the similarity between the first information and the to-be-processed information is 71, the similarity between the second information and the to-be-processed information is 23, the similarity between the third information and the to-be-processed information is 80, and the similarity between the fourth information and the to-be-processed information is 51. Then the three information can be output in the order of "third information→first information→fourth information". Alternatively, the output information can be sent to the device of the staff processing the to-be-processed information for reference by the staff.
[0129] Based on the same concept as the above method, see Figure 5 An information similarity determination apparatus 500 is provided for the embodiments of the present application. The apparatus 500 is used to implement each step in the above method, and will not be described here again to avoid repetition. The apparatus 500 includes an acquisition unit 501 and a processing unit 502.
[0130] The acquisition unit 501 is configured to acquire a plurality of entities included in the to-be-processed information and relationships between the plurality of entities.
[0131] The processing unit 502 is configured to update a knowledge base based on a matching result of the plurality of entities and the relationships between the plurality of entities and entities included in the knowledge base and relationships between the entities; the knowledge base is constructed based on entities included in a plurality of past processed information.
[0132] The processing unit 502 is further configured to determine the similarity between the to-be-processed information and each of the plurality of past processed information according to a distance between a representation vector corresponding to the to-be-processed information in the updated knowledge base and representation vectors corresponding to the plurality of past processed information.
[0133] In some embodiments, the processing unit 502 is specifically configured to:
[0134] When there is a second entity in the knowledge base that matches the first entity successfully, and the relationship related to the first entity is not equal to the relationship related to the second entity, adding the relationship related to the first entity to the second entity;
[0135] When there is no entity in the knowledge base that matches the first entity successfully, adding the first entity and the relationship related to the first entity to the knowledge base;
[0136] Wherein, the first entity is any one of the plurality of entities.
[0137] In some embodiments, the processing unit 502 is further configured to match the plurality of entities and the relationships between the plurality of entities with entities and relationships between entities contained in a knowledge base, in particular for:
[0138] matching any one of the plurality of entities with an entity contained in the knowledge base respectively;
[0139] when there is an entity matched successfully with the any one of the plurality of entities in the knowledge base, matching the relationship related to the matched entity with the relationship related to the first entity.
[0140] In some embodiments, the obtaining unit 501 is in particular configured to:
[0141] transforming the to-be-processed information into a text vector by the processing unit 502; determining positions of the plurality of entities and the relationships between the plurality of entities contained in the text vector by using a pre-trained neural network model; and determining positions of the plurality of entities and the relationships between the plurality of entities in the to-be-processed information according to the positions of the plurality of entities and the relationships between the plurality of entities in the text vector;
[0142] extracting the plurality of entities and the relationships between the plurality of entities from the to-be-processed information according to the positions of the plurality of entities and the relationships between the plurality of entities in the to-be-processed information.
[0143] In some embodiments, the processing unit 502 is further configured to:
[0144] transforming the to-be-processed information and the plurality of past processed information in the updated knowledge base into representation vectors respectively by using a graph embedding algorithm.
[0145] In some embodiments, the processing unit 502 is further configured to:
[0146] outputting a set number of past processed information in a descending order of similarity according to the similarity between the to-be-processed information and the plurality of past processed information respectively.
[0147] Figure 6 A structure schematic diagram of an electronic device 600 provided by an embodiment of the present application is shown. The electronic device 600 in the embodiment of the present application can further include a communication interface 603, for example, a network interface, and the electronic device can transmit data through the communication interface 603.
[0148] In the embodiments of the present application, the memory 602 stores instructions executable by the at least one controller 601, and the at least one controller 601, by executing the instructions stored in the memory 602, can be configured to perform various steps in the above method. For example, the controller 601 can implement the functions of the acquisition unit 501 and the processing unit 502 in the above method. Figure 5
[0149] The controller 601 is the control center of the electronic device, and can be connected with various parts of the electronic device through various interfaces and lines, and can run or execute instructions stored in the memory 602 and call data stored in the memory 602. Optionally, the controller 601 can include one or more processing units, and the controller 601 can integrate an application controller and a modem controller, wherein the application controller mainly processes operating systems and applications, and the modem controller mainly processes wireless communication. It can be understood that the above-mentioned modem controller can also not be integrated into the controller 601. In some embodiments, the controller 601 and the memory 602 can be implemented on the same chip, and in some embodiments, they can also be implemented on separate chips respectively.
[0150] The controller 601 can be a general controller, such as a central controller (English: Central Processing Unit, CPU for short), a digital signal controller, an application specific integrated circuit, a field programmable gate array or other programmable logic device, a discrete gate or transistor logic device, a discrete hardware component, which can implement or execute the methods, steps and logic block diagrams disclosed in the embodiments of the present application. The general controller can be a microcontroller or any conventional controller. The steps performed by the data statistical platform disclosed in the embodiments of the present application can be directly executed by the hardware controller, or executed by a combination of hardware and software modules in the controller.
[0151] The memory 602, as a non-volatile computer readable storage medium, can be used to store non-volatile software programs, non-volatile computer executable programs and modules. The memory 602 can include at least one type of storage medium, for example, can include flash memory, hard disk, multimedia card, card type memory, random access memory (English: Random Access Memory, for short: RAM), static random access memory (English: Static Random Access Memory, for short: SRAM), programmable read-only memory (English: Programmable Read Only Memory, for short: PROM), read-only memory (English: Read Only Memory, for short: ROM), electrically erasable programmable read-only memory (English: Electrically Erasable Programmable Read-Only Memory, for short: EEPROM), magnetic memory, magnetic disk, optical disk, etc. The memory 602 is any other medium capable of carrying or storing desired program code in the form of instructions or data structures and capable of being accessed by a computer, but is not limited to this. The memory 602 in the embodiments of the present application can also be a circuit or any other device capable of realizing the storage function, used for storing program instructions and / or data.
[0152] By designing and programming the controller 601, for example, the code corresponding to the training method of the neural network model introduced in the foregoing embodiments can be fixed in the chip, so that the chip can execute the steps of the foregoing neural network model training method during runtime. How to design and program the controller 601 is a technology known to those skilled in the art, and will not be described here.
[0153] Those skilled in the art should understand that the embodiments of the present application can be provided as a method, a system or a computer program product. Therefore, the present application can take the form of a complete hardware embodiment, a complete software embodiment or an embodiment combining software and hardware aspects. Moreover, the present application can take the form of a computer program product implemented on one or more computer usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer usable program code.
[0154] The computer program instructions can also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer-implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart block or blocks. Figure 1 one or more flowcharts and / or blocks Figure 1 means for functionally implementing the steps listed in the flowchart block or blocks.
[0155] These computer program instructions can also be stored in a computer-readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instructions which implement the function specified in the flowchart block or blocks. Figure 1 one or more flowcharts and / or blocks Figure 1 means for functionally implementing the steps listed in the flowchart block or blocks.
[0156] The computer program instructions can also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer-implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart block or blocks. Figure 1 one or more flowcharts and / or blocks Figure 1 means for functionally implementing the steps listed in the flowchart block or blocks.
[0157] While the preferred embodiments of the application have been described, additional variations and modifications can be made to the embodiments described and shown, and it is therefore intended that the application be limited only by the scope of the claims presented with this written description.
[0158] Obviously, numerous modifications and variations of the present application are possible in light of the above teachings. It is therefore to be understood that within the scope of the claims, the application can be practiced otherwise than as specifically described herein.
Claims
1. A method of determining similarity of information, characterized by, The method comprises the following steps: transforming the obtained to-be-processed information into a text vector; using a pre-trained neural network model, performing linear transformation on the text vector based on a first linear layer to obtain a start position of an entity corresponding to each text vector, and performing linear transformation on the text vector based on a second linear layer to obtain an end position of the entity corresponding to each text vector; determining the positions of the plurality of entities and the relationships between the plurality of entities in the text vector based on the start position and the end position of the entity; determining the positions of the plurality of entities and the relationships between the plurality of entities in the to-be-processed information according to the positions of the plurality of entities and the relationships between the plurality of entities in the text vector; extracting the plurality of entities and the relationships between the plurality of entities from the to-be-processed information according to the positions of the plurality of entities and the relationships between the plurality of entities in the to-be-processed information; updating the knowledge base based on the matching result of the plurality of entities and the relationships between the plurality of entities and the entities and the relationships between the entities contained in the knowledge base; the knowledge base is constructed based on the entities contained in a plurality of past processed information; determining the similarity between the to-be-processed information and the plurality of past processed information respectively according to the distance between the representation vector corresponding to the to-be-processed information in the updated knowledge base and the representation vectors corresponding to the plurality of past processed information; wherein the updating the knowledge base based on the matching result of the plurality of entities and the relationships between the plurality of entities and the entities and the relationships between the entities contained in the knowledge base comprises: when there is a second entity in the knowledge base that matches the first entity successfully, and the relationship related to the first entity is not equal to the relationship related to the second entity, adding the relationship related to the first entity to the second entity; when there is no entity in the knowledge base that matches the first entity successfully, adding the first entity and the relationship related to the first entity to the knowledge base; wherein the first entity is any one of the plurality of entities.
2. The method of claim 1, wherein, The matching process of the plurality of entities and the relationships between the plurality of entities and the entities and the relationships between the entities contained in the knowledge base comprises: matching any one of the plurality of entities with the entities contained in the knowledge base respectively; if there is an entity in the knowledge base that matches the any one entity successfully, matching the relationship related to the matched entity with the relationship related to the first entity.
3. The method of claim 1, wherein, The method further comprises: using a graph embedding algorithm to transform the to-be-processed information in the updated knowledge base and the plurality of past processed information into representation vectors respectively.
4. The method of claim 1, wherein, The method further comprises: outputting a set number of past processed information in a descending order of similarity according to the similarity between the to-be-processed information and the plurality of past processed information respectively.
5. An information similarity degree determination apparatus characterized by comprising: The method comprises the following steps: an acquisition unit configured to transform the obtained to-be-processed information into a text vector; The pre-trained neural network model is used to perform linear transformation on the text vector based on a first linear layer to obtain a start position of an entity corresponding to each text vector, and perform linear transformation on the text vector based on a second linear layer to obtain an end position of the entity corresponding to each text vector; and the start position and the end position of the entity are used to determine the positions of the plurality of entities and the relationships between the plurality of entities in the text vector; The positions of the plurality of entities and the relationships between the plurality of entities in the text vector are used to determine the positions of the plurality of entities and the relationships between the plurality of entities in the information to be processed; The positions of the plurality of entities and the relationships between the plurality of entities in the information to be processed are used to extract the plurality of entities and the relationships between the plurality of entities from the information to be processed; The processing unit is configured to update the knowledge base based on a matching result of the plurality of entities and the relationships between the plurality of entities and entities and relationships between entities included in the knowledge base; The knowledge base is constructed based on entities included in a plurality of past processed information; The processing unit is further configured to determine similarities between the information to be processed and the plurality of past processed information respectively based on distances between a representation vector corresponding to the information to be processed in the updated knowledge base and representation vectors corresponding to the plurality of past processed information; The processing unit is specifically configured to: when a second entity matching the first entity successfully exists in the knowledge base, and a relationship related to the first entity is not equal to a relationship related to the second entity, adding the relationship related to the first entity to the second entity; when no entity matching the first entity successfully exists in the knowledge base, adding the first entity and the relationship related to the first entity to the knowledge base. The first entity is any one of the plurality of entities.
6. The apparatus of claim 5, wherein, The processing unit is further configured to match the plurality of entities and the relationships between the plurality of entities with entities and relationships between entities included in the knowledge base, and is specifically configured to: match any one of the plurality of entities with entities included in the knowledge base respectively; when an entity matching the any one of the plurality of entities successfully exists in the knowledge base, match a relationship related to the first entity with a relationship related to the matching entity.
7. The apparatus of claim 5, wherein, The processing unit is further configured to: use a graph embedding algorithm to convert the information to be processed in the updated knowledge base and the plurality of past processed information into representation vectors respectively.
8. The apparatus of claim 5, wherein, The processing unit is further configured to: output a set number of past processed information in a descending order of similarity based on the similarities between the information to be processed and the plurality of past processed information respectively.
9. An electronic device, comprising: The apparatus comprises: a memory and a controller; the memory is configured to store program instructions; the controller is configured to invoke the program instructions stored in the memory to execute the method according to any one of claims 1-4.
10. A computer storage medium storing computer-executable instructions, which, when executed by a processor, cause the processor to perform acts comprising: The computer executable instructions are for performing the method as claimed in any one of claims 1-4.
Citation Information
Patent Citations
Entity optimization method based on attribute calculation and knowledge template
CN111159420A
Semantic relationship processing method and device for text entity and equipment
CN111241838A
Scholar knowledge extraction and fusion method and device
CN112069817A
Text matching method and device, equipment, and storage medium
CN114077862A