Methods, apparatus, equipment, and storage media for generating sample statements
By matching and automatically generating candidate statements from a statement library based on seed statements, the problem of low efficiency in manual annotation is solved, and the automated generation of sample statements is realized, thereby improving the training efficiency and accuracy of the relation recognition model.
Patent Information
- Application Number
- CN202110399449.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-04-14
- Publication Date
- 2025-10-28
- Estimated Expiration
- 2041-04-14
AI Technical Summary
In existing technologies, generating sample sentences through manual annotation is inefficient, resulting in insufficient training efficiency and accuracy of relationship recognition models.
By obtaining seed statements, matching the first candidate statement using a statement library, and generating the second candidate statement automatically, sample statements are generated automatically, thus improving generation efficiency.
This improves the efficiency of sample sentence generation, thereby indirectly improving the training efficiency and accuracy of the relation recognition model.
Smart Images

Figure CN113705191B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of machine learning, and in particular to a method, apparatus, device, and storage medium for generating sample sentences. Background Technology
[0002] Relation recognition, also known as relation extraction, refers to identifying the attribute conditions corresponding to entities from a statement. The statement to be identified is usually a statement used to ask a question, such as: How tall is Mount Everest? The entity contained in this statement is Mount Everest, and the attribute condition is altitude (i.e., the attribute corresponding to "how tall"). Taking Mount Everest as an example, its corresponding attributes include: altitude, geographical location, altitude ranking, etc.
[0003] After identifying the attribute conditions corresponding to entities from a statement, the attribute results can be obtained by querying the constructed knowledge graph, such as: the altitude of Mount Everest is 8848.86 meters. In related technologies, attribute conditions are identified from statements using a relation recognition model, which is trained using sample statements labeled with reference attributes. These sample statements are manually labeled.
[0004] However, when obtaining sample sentences using the above method, the annotation of sample sentences requires a lot of human and time resources due to the large number of attribute types involved in the knowledge graph, resulting in low efficiency in obtaining sample sentences and thus affecting the training efficiency of the relation recognition model. Summary of the Invention
[0005] This application provides a method, apparatus, device, and storage medium for generating sample statements, which can improve the efficiency of sample statement generation. The technical solution is as follows:
[0006] On the one hand, a method for generating sample statements is provided, the method comprising:
[0007] Obtain a seed statement for relation identification, wherein the seed statement includes a target entity and attribute conditions corresponding to the target entity, and the seed statement is used to indicate the determination of the attributes of the target entity;
[0008] The seed statement is matched with the statement library to obtain a first candidate statement that meets the first similarity condition. The statement library includes historical search statements, which are search statements received by the search platform within a historical time period.
[0009] Based on the first candidate statement, sample statements corresponding to the target entity and the attribute conditions are generated, and the sample statements are used for training relation recognition.
[0010] On the other hand, a sample statement generation apparatus is provided, the apparatus comprising:
[0011] The acquisition module is used to acquire a seed statement for relation identification. The seed statement includes a target entity and attribute conditions corresponding to the target entity. The seed statement is used to indicate the determination of the attributes of the target entity.
[0012] The matching module is used to match the seed statement with the statement library to obtain a first candidate statement that meets the first similarity condition with the seed statement. The statement library includes historical search statements, which are search statements received by the search platform within a historical time period.
[0013] The generation module is used to generate sample statements corresponding to the target entity and the attribute conditions based on the first candidate statements, and the sample statements are used for training relation recognition.
[0014] On the other hand, a computer device is provided, the computer device including a processor and a memory, the memory storing at least one instruction, at least one program, code set or instruction set, the at least one instruction, the at least one program, the code set or instruction set being loaded and executed by the processor to implement the sample statement generation method as described in any of the above embodiments of this application.
[0015] On the other hand, a computer-readable storage medium is provided, wherein at least one instruction, at least one program, code set, or instruction set is stored therein, wherein the at least one instruction, the at least one program, the code set, or the instruction set is loaded and executed by a processor to implement the sample statement generation method as described in any of the embodiments of this application above.
[0016] On the other hand, a computer program product or computer program is provided, which includes computer instructions stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium and executes the computer instructions, causing the computer device to perform the sample statement generation method described in any of the above embodiments.
[0017] The beneficial effects of the technical solutions provided in this application include at least the following:
[0018] The sample sentences are not generated using the manual annotation method in related technologies. Instead, a seed sentence is provided, and a first candidate sentence is matched from the sentence database based on the seed sentence. A second candidate sentence is then automatically generated. Thus, the sample sentences are automatically generated based on the first and second candidate sentences. This automates the sample sentence generation process, improves the efficiency of sample sentence generation, and indirectly improves the training efficiency and accuracy of relation recognition. Attached Figure Description
[0019] To more clearly illustrate the technical solutions in the embodiments of this application, 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 this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0020] Figure 1 This is a schematic diagram of the implementation environment provided by an exemplary embodiment of this application;
[0021] Figure 2 This is a schematic diagram illustrating the overall process of a sample statement generation method provided in an exemplary embodiment of this application;
[0022] Figure 3 This is a flowchart of a sample statement generation method provided in an exemplary embodiment of this application;
[0023] Figure 4 Based on Figure 3 The illustrated embodiment provides a schematic diagram of the structure of the statement matching model;
[0024] Figure 5 Based on Figure 3 The illustrated embodiment provides a schematic diagram of the structure of the statement generation model;
[0025] Figure 6 This is a flowchart of a method for generating sample statements provided in another exemplary embodiment of this application;
[0026] Figure 7 Based on Figure 6 The illustrated embodiment provides a schematic diagram of the similarity discrimination model.
[0027] Figure 8 This is a flowchart of a method for generating sample statements provided in another exemplary embodiment of this application;
[0028] Figure 9 This is a schematic diagram illustrating the training process of a relationship recognition model provided in an exemplary embodiment of this application;
[0029] Figure 10This is a structural block diagram of a sample statement generation apparatus provided in an exemplary embodiment of this application;
[0030] Figure 11 This is a structural block diagram of a sample statement generation apparatus provided in another exemplary embodiment of this application;
[0031] Figure 12 This is a structural block diagram of a server provided in an exemplary embodiment of this application. Detailed Implementation
[0032] In order to make the objectives, technical solutions and advantages of this application clearer, the implementation methods of this application will be further described in detail below with reference to the accompanying drawings.
[0033] First, a brief introduction to the terms used in the embodiments of this application:
[0034] Artificial Intelligence (AI) is the theory, methods, technology, and application systems that use digital computers or machines controlled by digital computers to simulate, extend, and expand human intelligence, perceive the environment, acquire knowledge, and use that knowledge to achieve optimal results. In other words, AI is a comprehensive technology within computer science that attempts to understand the essence of intelligence and produce a new kind of intelligent machine that can react in a way similar to human intelligence. AI studies the design principles and implementation methods of various intelligent machines, enabling them to possess the functions of perception, reasoning, and decision-making.
[0035] Artificial intelligence (AI) is a comprehensive discipline encompassing a wide range of fields, including both hardware and software technologies. Fundamental AI technologies generally include sensors, dedicated AI chips, cloud computing, distributed storage, big data processing, operating / interactive systems, and mechatronics. AI software technologies primarily include computer vision, speech processing, natural language processing, and machine learning / deep learning.
[0036] Natural Language Processing (NLP) is an important field within computer science and artificial intelligence. It studies the theories and methods for enabling effective communication between humans and computers using natural language. NLP is a science that integrates linguistics, computer science, and mathematics. Therefore, research in this field involves natural language—the language people use in daily life—and thus it has a close relationship with linguistic research. NLP techniques typically include text processing, semantic understanding, machine translation, question answering, and knowledge graphs.
[0037] Machine Learning (ML) is a multidisciplinary field involving probability theory, statistics, approximation theory, convex analysis, and algorithm complexity theory. It specifically studies how computers can simulate or implement human learning behavior to acquire new knowledge or skills and reorganize existing knowledge structures to continuously improve their performance. Machine learning is the core of artificial intelligence and the fundamental way to endow computers with intelligence; its applications span all areas of artificial intelligence. Machine learning and deep learning typically include techniques such as artificial neural networks, belief networks, reinforcement learning, transfer learning, inductive learning, and instruction-based learning.
[0038] An entity refers to an objectively existing thing that is distinct from one another. In this embodiment, an entity refers to a thing appearing in the text content that requires the determination of attribute relationships. In some embodiments, the text content is implemented as a question statement, and an entity refers to a thing appearing in the question statement that has corresponding attribute conditions. That is, a question statement usually includes the entity targeted by the question and the attributes related to the entity that need to be determined. For example, in the question statement "How high is Mount Everest?", the corresponding entity is Mount Everest, and the attribute is the altitude corresponding to "How high". Here, "How high" is the attribute expression appearing in the question statement, and altitude is the attribute expression recorded in the knowledge graph corresponding to "How high". That is, the relationship recognition model involved in this embodiment is used to identify "How high is" in the question statement as "altitude", thereby enabling the query of the corresponding result from the knowledge graph based on the entity "Mount Everest" and the attribute "altitude", namely, the query result for the altitude of Mount Everest.
[0039] Based on the above brief introduction of terms, the application scenarios of the embodiments of this application are illustrated with examples:
[0040] First, in online question-answering scenarios, when a user inputs a question statement via voice or text, the entity recognition model identifies the entities contained in the statement, and the relation recognition model identifies the attribute conditions related to the entities. Based on the entities and attribute conditions, the corresponding question result is determined from the constructed knowledge graph.
[0041] To illustrate, if a user inputs the question "Where was celebrity A born?" via text input, the entity recognition model will identify "celebrity A" from the question, and the relation recognition model will identify the attribute corresponding to the entity as "birthplace". Using "celebrity A" and "birthplace" as query keywords, a query will be performed in the knowledge graph, resulting in the query result "location b". The query result will then be fed back and displayed.
[0042] The relationship recognition model needs to be trained using sample statements labeled with reference attributes. These sample statements are automatically generated using a statement database and a statement generation model. The specific method for generating the sample statements will be described in detail in subsequent embodiments.
[0043] Second, in human-computer dialogue scenarios, when a user inputs a question by voice, the entity recognition model identifies the entities contained in the question and the relation recognition model identifies the attribute conditions related to the entities. Based on the entities and attribute conditions, a response statement is generated and output in the form of voice.
[0044] To illustrate, when a user inputs the question "Who is celebrity A's wife?" via voice input, the entity recognition model identifies "celebrity A" as the entity in the question and the relation recognition model identifies the attribute "wife" as the attribute corresponding to the entity. The search is performed using "celebrity A" and "wife" as search keywords, and the search result "person C" is obtained. The search result is embedded into the voice content to obtain "celebrity A's wife is person C", which is then output in voice form.
[0045] It is worth noting that the method for generating sample statements provided in this application embodiment can be implemented by a terminal, a server, or a combination of both. The terminal includes at least one of the following: smartphone, tablet, laptop, desktop computer, smart speaker, smart wearable device, etc. The server can be a physical server or a cloud server providing cloud computing services. Furthermore, the server can be a single server or a server cluster or distributed system composed of multiple servers.
[0046] When the terminal and the server work together to implement the solution provided in the embodiments of this application, the terminal and the server can be directly or indirectly connected through wired or wireless communication, and the embodiments of this application do not limit this.
[0047] Please refer to Figure 1 It illustrates a schematic diagram of an implementation environment provided by an exemplary embodiment of this application, such as... Figure 1 As shown, the implementation environment includes a terminal 110 and a server 120, and the terminal 110 and the server 120 are connected through a communication network 130.
[0048] In this embodiment, an online question-and-answer scenario is used as an example to describe the implementation environment. A program providing online question-and-answer functionality is installed on terminal 110. This program can be a browser, video player, e-book reader, instant messaging application, game, utility application, etc., and this embodiment does not limit it to any particular application. After terminal 110 inputs a question via text input or voice input, terminal 110 sends the question to server 120.
[0049] Server 120 stores entity recognition model 121, relation recognition model 122, and knowledge graph 123. When server 120 receives a query, it uses entity recognition model 121 to identify entities in the query, uses relation recognition model 122 to identify attributes in the query, and uses knowledge graph 123 to query the corresponding attribute conditions. Based on the entities and attribute conditions, it queries the knowledge graph 123 to obtain the corresponding query result.
[0050] The server 120 sends the query result to the terminal 110, and the terminal 110 displays the query result, wherein the display method includes at least one of voice display or interface display.
[0051] It is worth noting that the aforementioned communication network 130 can be implemented as a wired network or a wireless network, and the communication network 130 can be implemented as any one of a local area network, a metropolitan area network, or a wide area network. This application embodiment does not limit this.
[0052] It is worth noting that the aforementioned server 120 can be implemented as a cloud server in the cloud. Cloud technology refers to a hosting technology that unifies hardware, software, and network resources within a wide area network (WAN) or local area network (LAN) to achieve data computation, storage, processing, and sharing. Cloud technology is a general term encompassing network technology, information technology, integration technology, management platform technology, and application technology applied to the cloud computing business model. It can form resource pools, available on demand, and offers flexibility and convenience. Cloud computing technology will become a crucial support. Backend services of technical network systems require substantial computing and storage resources, such as video websites, image websites, and many portal websites. With the rapid development and application of the internet industry, every item may have its own identification mark in the future, requiring transmission to a backend system for logical processing. Data at different levels will be processed separately, and various industry data will require robust system support, which can only be achieved through cloud computing.
[0053] In some embodiments, the server 120 can also be implemented as a node in a blockchain system. Blockchain is a novel application model of computer technologies such as distributed data storage, peer-to-peer transmission, consensus mechanisms, and cryptographic algorithms. Essentially, a blockchain is a decentralized database, a chain of data blocks linked using cryptographic methods. Each data block contains information about a batch of network transactions, used to verify the validity of the information (anti-counterfeiting) and generate the next block. A blockchain can include a blockchain underlying platform, a platform product service layer, and an application service layer.
[0054] In this embodiment of the application, the method for generating sample statements provided in server 120 and its implementation are business services in the application service layer.
[0055] Based on the above description, the method for generating sample statements in the embodiments of this application will be introduced. Here, sample statements refer to statements labeled with reference attributes for training the relation recognition model. In related technologies, sample statements are usually generated through manual annotation, which is inefficient and requires significant human and material resources.
[0056] In this embodiment, only a small number of seed statements are needed to automatically generate a large number of sample statements. For illustrative purposes, please refer to [reference needed]. Figure 2 This illustrates a schematic diagram of the overall process of a sample statement generation method provided in an exemplary embodiment of this application, as shown below. Figure 2 The seed statement 210 is shown to be processed as follows: 1. Statement matching 221; 2. Statement generation 222.
[0057] Among them, statement matching 221 refers to matching the seed statement 210 with the statement library 230, and matching the first candidate statement with a high similarity to the seed statement 210 from the statement library 230. The statements in the statement library 230 are the historical search statements of users on the search platform.
[0058] Sentence generation 222 refers to the process of assigning seed sentence 210 to the sentence generation model and then outputting a second candidate sentence. The sentence generation model is a trained model used to generate sentences similar to seed sentence 210.
[0059] The first and second candidate statements are compared with the seed statement for similarity 240, and candidate statements that do not meet the similarity requirements are filtered out, finally resulting in sample statements 250.
[0060] Based on the above-described terms and application scenarios, the method for generating sample statements provided in this application embodiment will be described, taking the execution of the method by a server as an example. In some embodiments, the sample statements are obtained through a matching process, or through a generation process, or through a combination of matching and generation processes.
[0061] When sample statements are obtained through the matching process, seed statements for relation recognition are first obtained. The seed statements include the target entity and the corresponding attribute conditions. The seed statements are used to indicate the determination of the attributes of the target entity. The seed statements are matched with the statement library to obtain the first candidate statements that meet the first similarity condition. The statement library includes historical search statements, which are search statements received by the search platform within a historical time period. Based on the first candidate statements, sample statements corresponding to the target entity and attribute conditions are generated. The sample statements are used for training relation recognition.
[0062] In this embodiment of the application, the example of obtaining sample statements through a matching process and a generation process is used for illustration. Figure 3 As shown, the method includes:
[0063] Step 301: Obtain the seed statement for relation identification. The seed statement includes the target entity and the attribute conditions corresponding to the target entity.
[0064] Seed statements are used to instruct the determination of attributes of a target entity.
[0065] For illustration, the seed statement is "Mount Everest height", where the target entity is Mount Everest (also known as the abbreviation of Mount Everest), and the attribute condition is height (that is, expressing the altitude of Mount Everest). This seed statement is used to indicate the determination of the altitude of Mount Everest.
[0066] In some embodiments, the seed statement is obtained in at least one of the following ways:
[0067] First, the seed statement is a manually set statement, that is, a statement that is manually entered and stored.
[0068] In some embodiments, the seed statement is a manually set statement for one or more attributes. For example, for the "altitude" attribute, the seed statement "Mount Everest height" is manually set.
[0069] In some embodiments, the server stores a seed statement library. After a seed statement is input, it is stored in the seed statement library. So when it is necessary to generate a sample statement from the seed statement, the stored seed statement can be retrieved directly from the seed statement library.
[0070] Second, randomly select historical search statements from the existing statement library as seed statements.
[0071] The query database includes historical search queries, which are search queries received by the search platform within a historical time period. The search platform can be a specific platform or a group of search platforms. Optionally, the search platform can be implemented as a search engine, where users need to enter search queries into the search box to obtain search results. During the process of obtaining search results, the terminal needs to first send the user-entered search query to the server, and the server also needs to store the search query in the query database when retrieving search results.
[0072] In some embodiments, the seed statement itself is annotated with reference attributes and target entities.
[0073] Step 302: Match the seed statement with the statement library to obtain the first candidate statement that meets the first similarity condition of the seed statement.
[0074] The statement library refers to the aforementioned statement library that includes historical search statements. In some embodiments, historical search statements are stored in the statement library in sequential order; or, historical search statements are stored in the statement library corresponding to the search time; or, historical search statements are stored in the statement library corresponding to the user account that initiated the search; or, historical search statements are stored in the statement library corresponding to the terminal identifier that initiated the search. This application does not limit the storage method of historical search statements in the statement library.
[0075] To illustrate, let's take the example of storing historical search statements and their corresponding search times. That is, the statement database stores historical search statements and the search time for each statement. For example, search statement 'a' corresponds to a search time of 17:00 on May 15, 2020; search statement 'b' corresponds to a search time of 16:20 on May 15, 2020.
[0076] In some embodiments, historical search statements are search statements received by the search platform within a historical time period. Optionally, the historical time period is a specified time period preceding the current time; or, the historical time period is the time period from the moment the search platform was put into use to the current time; or, the historical time period is a specified time period. This application embodiment does not limit the historical time period.
[0077] In some embodiments, a trained statement matching model is used to match first candidate statements that are similar to the seed statement in the statement database. In some embodiments, historical search statements in the statement database are compared with the seed statement to perform similarity analysis, thereby selecting historical search statements that meet the first similarity condition as first candidate statements.
[0078] In some embodiments, a seed statement is input into a statement matching model, which includes a statement library. The seed statement is matched with the statement library, that is, matched with historical search statements in the statement library, to obtain a first candidate statement. Optionally, the seed statement and historical search statements in the statement library are analyzed for similarity using the statement matching model to obtain a first candidate statement that meets the first similarity requirement.
[0079] In some embodiments, due to the large volume of historical search statements in the statement database, ranging from hundreds of millions to billions, vector-based retrieval is employed. The statement matching model uses a dual-tower, Transformer-based Bidirectional Encoder Representations from Transformers (BERT) model. Training data can come from open-source datasets and similar statements mined from user search click logs. The structure of the statement matching model is illustrated below. Figure 4 As shown.
[0080] Historical search statements from the statement library are input into BERT model 410, and seed statements are input into BERT model 420. The similarity between the vectors output by BERT models 410 and 420 is determined, and historical search statements meeting a first similarity condition are selected as first candidate statements. This first similarity condition is implemented as a similarity threshold; for example, if the first similarity condition is 0.5, then historical search statements with a vector similarity of 0.5 are selected as first candidate statements. BERT models 410 and 420 can be the same or different models, or they can be implemented as the same model.
[0081] Step 303: Perform statement prediction on the target entity and attribute conditions to generate a second candidate statement.
[0082] In some embodiments, a second candidate statement is generated using a pre-trained statement generation model. This involves inputting a seed statement into the statement generation model, which is a pre-trained model that generates statements based on entity and attribute relationships by ethical users. The statement generation model then predicts the statement based on the target entity and attribute conditions to generate the second candidate statement.
[0083] This example illustrates how a pre-trained sentence generation model, based on a seed sentence, uses a seq2seq generation model to generate new similar sentences as second-candidate sentences. Compared to sentence matching models, sentence generation models can generate new sentences that do not exist in the sentence database. The training data for the sentence generation model can come from open-source datasets and similar sentences mined from user search and click logs.
[0084] The structure of the statement generation model is illustrative, as shown below. Figure 5 As shown, the seed statement is input into encoder 510 and encoded to obtain encoded features. The encoded features and the seed statement are then input into decoder 520 for decoding, thus obtaining the second candidate statement. The encoder of the statement generation model uses BERT, and the decoder is also initialized using BERT weights.
[0085] It is worth noting that the encoder described above can also be implemented as a Long Short-Term Memory (LSTM) network or a Gate Recurrent Unit (GRU) model.
[0086] Step 304: Generate sample statements corresponding to the target entity and attribute conditions based on the first candidate statement and the second candidate statement.
[0087] In some embodiments, sample statements are used for training relation recognition. Sample statements are statements that express the same content as seed statements but in a different way.
[0088] The sample statement is used illustratively, including at least one of the following methods:
[0089] First, the sample statements are statements used to train the relation recognition model.
[0090] Relation recognition models are used to identify the attribute conditions corresponding to entities from statements. For example, if the statement is "Mount Everest height", then the entity is Mount Everest, and the relation recognition model identifies the attribute condition as altitude, that is, the attribute condition expressed by "height".
[0091] Second, sample statements are used to broaden the scope of search results.
[0092] Because the sample statement and the seed statement indicate the same content but are expressed differently, when a user enters the seed statement to search for results, only the content expressed in the seed statement can be used as search keywords. After generating the sample statement, the user can search using the content expressed in both the seed statement and the sample statement as search keywords, thus expanding the scope of search results. For example, if the seed statement is "Mount Everest height," the entity is Mount Everest. However, the sample statement obtained through the above expansion includes phrases such as "the altitude of Mount Everest" and "the altitude of Mount Everest," thus expanding the keyword "Mount Everest" to both "Mount Everest" and "Mount Everest," and expanding the keyword "height" to both "height" and "altitude."
[0093] Third, sample sentences are used to provide candidate translation results.
[0094] In some embodiments, when translating a question statement, after the above processing is performed on the translated statement (as a seed statement), a sample statement is obtained and provided to the user for selection, so that the user can choose a more reasonable statement as the translation result from the translated statement and the sample statement.
[0095] It is worth noting that the application of the above sample statements is merely an illustrative example, and this application does not limit the scope of the embodiments. In this application embodiment, the sample statement is used as an example for training a relation recognition model.
[0096] In some embodiments, the method of generating sample statements based on the first candidate statement and the second candidate statement includes at least one of the following methods:
[0097] First, the set of the first candidate statement and the second candidate statement is used as the combination of sample statements. That is, the statements in the first candidate statement and the second candidate statement are the sample statements.
[0098] Second, a specified number of candidate statements are randomly selected from the first and second candidate statements as sample statements.
[0099] Third, a similarity analysis is performed on the first candidate statement, the second candidate statement, and the seed statement to obtain sample statements that meet the similarity criteria.
[0100] In some embodiments, the seed statement is also implemented as a statement in the sample statement.
[0101] In summary, the sample statement generation method provided in this application does not generate sample statements using the manual annotation method in related technologies. Instead, it provides a seed statement, matches a first candidate statement from the statement library based on the seed statement, and generates a second candidate statement through automatic generation. Thus, an automatically generated sample statement is obtained based on the first and second candidate statements. This automates the sample statement generation process, improves the efficiency of sample statement generation, and indirectly improves the training efficiency and accuracy of relation recognition.
[0102] In some embodiments, when sample statements are obtained solely through a matching process, only the first candidate statement is selected; when sample statements are obtained solely through a generation process, only the second candidate statement is selected; when sample statements are obtained through both a matching and a generation process, both the first and second candidate statements are selected. The following explanation uses the first and second candidate statements as examples. Figure 6 .
[0103] In an optional embodiment, the first candidate statement and the second candidate statement need to be similar to the seed statement to obtain the sample statement. Figure 6 This is a flowchart of a sample statement generation method provided in another exemplary embodiment of this application. The method is illustrated using an example where it is executed by a server. Figure 6 As shown, the method includes:
[0104] Step 601: Obtain the seed statement for relation identification. The seed statement includes the target entity and the attribute conditions corresponding to the target entity.
[0105] Seed statements are used to instruct the determination of attributes of a target entity.
[0106] For illustration, the seed statement is "Mount Everest height", where the target entity is Mount Everest (also known as the abbreviation of Mount Everest), and the attribute condition is height (that is, expressing the altitude of Mount Everest). This seed statement is used to indicate the determination of the altitude of Mount Everest.
[0107] Step 602: Match the seed statement with the statement library to obtain the first candidate statement that meets the first similarity condition of the seed statement.
[0108] In some embodiments, historical search statements are search statements received by the search platform within a historical time period. Optionally, the historical time period is a specified time period preceding the current time; or, the historical time period is the time period from the moment the search platform was put into use to the current time; or, the historical time period is a specified time period. This application embodiment does not limit the historical time period.
[0109] In some embodiments, a seed statement is input into a statement matching model, which includes a statement library. The seed statement is matched with the statement library, that is, matched with historical search statements in the statement library, to obtain a first candidate statement. Optionally, the seed statement and historical search statements in the statement library are analyzed for similarity using the statement matching model to obtain a first candidate statement that meets the first similarity requirement.
[0110] Step 603: Perform statement prediction on the target entity and attribute conditions to generate a second candidate statement.
[0111] In some embodiments, a second candidate statement is generated using a pre-trained statement generation model. This involves inputting a seed statement into the statement generation model, which is a pre-trained model that generates statements based on entity and attribute relationships by ethical users. The statement generation model then predicts the statement based on the target entity and attribute conditions to generate the second candidate statement.
[0112] Step 604: Perform similarity analysis between the first candidate statement and the seed statement, and determine the first sample statement that meets the second similarity condition from the first candidate statements.
[0113] In some embodiments, the first candidate statement and the seed statement are input into a similarity discrimination model, and the similarity discrimination model performs similarity analysis on the first candidate statement and the seed statement. Illustratively, the similarity discrimination model adopts an interactive BERT architecture, such as... Figure 7 As shown, the seed statement and the first candidate statement are concatenated and separated by the [SEP] symbol. The concatenated seed statement and the first candidate statement are then input into the similarity discrimination model 710. The similarity discrimination model 710 performs similarity analysis to obtain the similarity analysis results. If the similarity analysis results meet the second similarity condition, they are retained as the first sample statement.
[0114] The second similarity condition is implemented as a similarity threshold. For example, if the second similarity condition is 0.7, then when the similarity analysis result indicates that the similarity reaches 0.7, the first candidate statement is retained as the first sample statement.
[0115] Step 605: Perform similarity analysis between the second candidate statement and the seed statement, and determine the second sample statement that meets the third similarity condition from the second candidate statements.
[0116] In some embodiments, the method for performing similarity analysis on the second candidate statement and the seed statement is the same as or different from the method for performing similarity analysis on the first candidate statement and the seed statement described above. In some embodiments, the first candidate statement and the second candidate statement are integrated to obtain a candidate statement set, and the candidate statements in the candidate statement set are sequentially subjected to similarity analysis with the seed statement.
[0117] The third similarity condition is the same as or different from the second similarity condition mentioned above.
[0118] Step 606: Determine the set of the first sample statement and the second sample statement as the set containing the sample statements.
[0119] That is, the first sample statement and the second sample statement are used as the final sample statements.
[0120] The sample statements are used to train the relation recognition model. In some embodiments, the seed statement itself is labeled with reference attributes, and the generated sample statements retain the same labeling as the seed statement; that is, the sample statements are also labeled with reference attributes. The sample statements are used to supervise the training of the relation recognition model using these reference attributes.
[0121] In summary, the sample statement generation method provided in this application does not generate sample statements using the manual annotation method in related technologies. Instead, it provides a seed statement, matches a first candidate statement from the statement library based on the seed statement, and generates a second candidate statement through automatic generation. Thus, an automatically generated sample statement is obtained based on the first and second candidate statements. This automates the sample statement generation process, improves the efficiency of sample statement generation, and indirectly improves the training efficiency and accuracy of relation recognition.
[0122] The method provided in this embodiment, after obtaining the first candidate statement and the second candidate statement, performs similarity analysis with the seed statement to avoid the situation where the first candidate statement and the second candidate statement have low similarity with the seed statement due to the wide threshold setting limit of the statement matching model and the statement generation model. The similarity analysis ensures that the similarity between the sample statement and the seed statement meets the similarity condition, and avoids the situation where the sample statement and the seed statement are significantly different, which affects the training effect.
[0123] In an optional embodiment, after obtaining the sample statements, the relationship recognition model also needs to be trained using the sample statements. Figure 8 This is a flowchart of a sample statement generation method provided in another exemplary embodiment of this application. The method is illustrated using an example where it is implemented by a server. Figure 8 As shown, the method includes:
[0124] Step 801: Obtain the seed statement for relation identification. The seed statement includes the target entity and the attribute conditions corresponding to the target entity.
[0125] Seed statements are used to instruct the determination of attributes of a target entity.
[0126] For illustration, the seed statement is "Mount Everest height", where the target entity is Mount Everest (also known as the abbreviation of Mount Everest), and the attribute condition is height (that is, expressing the altitude of Mount Everest). This seed statement is used to indicate the determination of the altitude of Mount Everest.
[0127] Optionally, the seed statement is marked with a reference attribute. For example, taking the seed statement "Mount Everest height" as an example, the reference attribute is "altitude".
[0128] Step 802: Match the seed statement with the statement library to obtain the first candidate statement that meets the first similarity condition of the seed statement.
[0129] In some embodiments, historical search statements are search statements received by the search platform within a historical time period. Optionally, the historical time period is a specified time period preceding the current time; or, the historical time period is the time period from the moment the search platform was put into use to the current time; or, the historical time period is a specified time period. This application embodiment does not limit the historical time period.
[0130] In some embodiments, a seed statement is input into a statement matching model, which includes a statement library. The seed statement is matched with the statement library, that is, matched with historical search statements in the statement library, to obtain a first candidate statement. Optionally, the seed statement and historical search statements in the statement library are analyzed for similarity using the statement matching model to obtain a first candidate statement that meets the first similarity requirement.
[0131] Step 803: Perform statement prediction on the target entity and attribute conditions to generate a second candidate statement.
[0132] In some embodiments, a second candidate statement is generated using a pre-trained statement generation model. This involves inputting a seed statement into the statement generation model, which is a pre-trained model that generates statements based on entity and attribute relationships by ethical users. The statement generation model then predicts the statement based on the target entity and attribute conditions to generate the second candidate statement.
[0133] Step 804: Generate sample statements corresponding to the target entity and attribute conditions based on the first candidate statement and the second candidate statement.
[0134] In some embodiments, sample statements are used for training relation recognition. Sample statements are statements that express the same content as seed statements but in a different way.
[0135] Optionally, the sample statement is the statement used to train the relation recognition model. The relation recognition model is used to identify the attribute conditions corresponding to entities from the statement. For example, if the statement is "Mount Everest height", then the entity is Mount Everest, and the relation recognition model is used to identify the attribute condition as altitude, that is, the attribute condition expressed by "height".
[0136] Step 805: Mark the sample statement with reference attributes.
[0137] That is, the sample statement is labeled with the same reference attributes as the seed statement.
[0138] For illustration, the seed statement is "Mount Everest height", and the sample statement is a statement automatically generated based on the seed statement, and has the same meaning as the seed statement. Therefore, the sample statement is labeled with the same reference attribute "altitude" as the seed statement.
[0139] Step 806: Train the relationship recognition model using sample statements.
[0140] In some embodiments, the method of training the relation recognition model using sample statements includes any of the following:
[0141] The first method involves identifying attribute relationships in sample statements using a relationship recognition model to obtain predicted attributes. Based on the differences between the predicted attributes and the reference attributes, the model parameters in the relationship recognition model are adjusted.
[0142] The predicted attributes are those identified by the relation recognition model, while the reference attributes are those labeled for the seed and sample statements, which are the true attributes. Therefore, based on the predicted and reference attributes, the difference between the recognition results of the relation recognition model and the true results can be obtained. This difference can then be used to train the relation recognition model in reverse, thereby improving its recognition accuracy.
[0143] The second method involves training a relation recognition model and a statement matching model using sample statements. The relation recognition model is used to identify the attribute conditions of entities in the statement.
[0144] The relationship recognition model includes first model parameters, and the statement matching model includes second model parameters. Sample statement pairs are obtained from the sample statements; each pair includes a first sample statement and a second sample statement. The relationship recognition model is used to identify attribute relationships in the first sample statement to obtain a first predicted attribute, and the same model is used to identify attribute relationships in the second sample statement to obtain a second predicted attribute. Based on the differences between the first predicted attribute, the second predicted attribute, and the reference attribute, the first and second model parameters are adjusted.
[0145] Specifically, the process involves determining a first difference between a first predicted attribute and a reference attribute, determining a second difference between a second predicted attribute and a reference attribute, and determining a third difference between the first predicted attribute and the second predicted attribute. Based on the first, second, and third differences, a loss difference is determined, and the first and second model parameters are adjusted based on the loss difference.
[0146] In some embodiments, the sum of the first difference, the second difference, and the third difference is determined as the loss difference; or, the weighted sum of the first difference, the second difference, and the third difference is determined as the loss difference.
[0147] Indicative Figure 9 This is a schematic diagram illustrating the training process of a relationship recognition model provided in an exemplary embodiment of this application, as shown below. Figure 9 As shown, sample statement pairs are extracted from sample statements as positive example (i.e., positive sample) statement pairs, including a first sample statement and a second sample statement. The first sample statement is input into the relation recognition model 910 to obtain a first predicted attribute, and the second sample statement is input into the relation recognition model 910 to obtain a second predicted attribute. A first difference is determined based on the first predicted attribute and a reference attribute, a second difference is determined based on the second predicted attribute and a reference attribute, and a third difference is determined based on the first predicted attribute and the second predicted attribute.
[0148] As an illustration, the calculation method for the first difference is shown in Formula 1 below.
[0149] Formula 1: Loss1=logP k1
[0150] Where k1 represents the first predicted attribute obtained from the first sample statement, and Loss1 represents the difference between the first predicted attribute and the reference attribute.
[0151] The calculation method for the second difference is shown in Formula 2 below.
[0152] Formula 2: Loss2=logP k2
[0153] Where k2 represents the second predicted attribute obtained from the second sample statement, and Loss2 represents the difference between the second predicted attribute and the reference attribute.
[0154] The calculation method for the third difference is shown in Formula 3 below.
[0155] Formula 3: Loss3 = max(0, MS) - +S + )
[0156] M is a maximum profit hyperparameter, and S refers to the matching score (i.e., the difference between the predicted attribute and the reference attribute of the sample statement). + It is the matching score between the reference attribute and the positive example predicted attribute, S - It is the matching score between the reference attribute and the negative example prediction attribute. The matching is performed using the vector inner product. <V query V + >,V query V represents a reference attribute. + This represents the predicted attribute for positive examples, and a randomly sampled attribute for negative examples. The final loss difference, Loss, is the sum of Loss1, Loss2, and Loss3.
[0157] The first model parameter in the above relationship recognition model is adjusted based on the loss difference; and the second model parameter in the above statement matching model is adjusted based on the loss difference.
[0158] In some embodiments, when the loss difference converges to below the required loss value, the training of the relation recognition model and the sentence matching model is considered complete.
[0159] In summary, the sample statement generation method provided in this application does not generate sample statements using the manual annotation method in related technologies. Instead, it provides a seed statement, matches a first candidate statement from the statement library based on the seed statement, and generates a second candidate statement through automatic generation. Thus, an automatically generated sample statement is obtained based on the first and second candidate statements. This automates the sample statement generation process, improves the efficiency of sample statement generation, and indirectly improves the training efficiency and accuracy of relation recognition.
[0160] The method provided in this embodiment improves the accuracy of model training by jointly learning the relationship recognition model and the statement matching model, since relationship recognition using only the relationship recognition model usually ignores the fine-grained matching features between statements.
[0161] Figure 10 This is a structural block diagram of a sample statement generation apparatus provided in an exemplary embodiment of this application, such as... Figure 10 As shown, the device includes:
[0162] The acquisition module 1010 is used to acquire a seed statement for relation identification, wherein the seed statement includes a target entity and attribute conditions corresponding to the target entity, and the seed statement is used to indicate the determination of the attributes of the target entity;
[0163] The matching module 1020 is used to match the seed statement with the statement library to obtain a first candidate statement that meets the first similarity condition with the seed statement. The statement library includes historical search statements, which are search statements received by the search platform within a historical time period.
[0164] The generation module 1030 is further configured to generate sample statements corresponding to the target entity and the attribute conditions based on the first candidate statements.
[0165] In an optional embodiment, the matching module 1020 is further configured to input the seed statement into a statement matching model, the statement matching model including the statement library; and to match the seed statement with the statement library through the statement matching model to obtain the first candidate statement.
[0166] In an optional embodiment, the matching module 1020 is further configured to perform similarity analysis between the seed statement and the historical search statements in the statement library using the statement matching model, so as to obtain the first candidate statement that meets the first similarity.
[0167] In an optional embodiment, the generation module 1030 is further configured to perform statement prediction on the target entity and the attribute conditions to generate a second candidate statement;
[0168] The generation module 1030 is further configured to generate sample statements corresponding to the target entity and the attribute conditions based on the first candidate statement and the second candidate statement, and the sample statements are used for training relation recognition.
[0169] In an optional embodiment, the generation module 1030 is further configured to input the seed statement into a statement generation model, wherein the statement generation model is a pre-trained model for generating statements based on entity and attribute relationships; and to generate the second candidate statement by performing statement prediction on the target entity and the attribute conditions through the statement generation model.
[0170] In an optional embodiment, such as Figure 11 As shown, the generation module 1030 includes:
[0171] Analysis unit 1031 is used to perform similarity analysis between the first candidate statement and the seed statement, and to determine the first sample statement that meets the second similarity condition from the first candidate statement;
[0172] The analysis unit 1031 is further configured to perform similarity analysis between the second candidate statement and the seed statement, and determine the second sample statement that meets the third similarity condition from the second candidate statements;
[0173] The determining unit 1032 is used to determine the set of the first sample statement and the second sample statement as a set containing the sample statements.
[0174] In an optional embodiment, the seed statement is annotated with a reference attribute;
[0175] The device further includes:
[0176] The annotation module 1040 is used to annotate the reference attributes on the sample statement;
[0177] The training module 1050 is used to train the relation recognition model using the sample statements, wherein the relation recognition model is used to identify the attribute conditions of entities in the statements.
[0178] In an optional embodiment, the training module 1050 is further configured to perform attribute relationship identification on the sample statement through the relationship identification model to obtain predicted attributes; and adjust the model parameters in the relationship identification model based on the difference between the predicted attributes and the reference attributes.
[0179] In an optional embodiment, the seed statement is annotated with a reference attribute;
[0180] The device further includes:
[0181] The training module 1050 is used to train the relation recognition model and the statement matching model using the sample statements, wherein the relation recognition model is used to identify the attribute conditions of entities in the statement.
[0182] In an optional embodiment, the relationship recognition model includes a first model parameter, and the statement matching model includes a second model parameter;
[0183] The acquisition module 1010 is further configured to acquire sample statement pairs in the sample statements, wherein the sample statement pairs include a first sample statement and a second sample statement;
[0184] The training module 1050 is further configured to perform attribute relationship identification on the first sample statement using the relationship identification model to obtain a first predicted attribute; perform attribute relationship identification on the second sample statement using the relationship identification model to obtain a second predicted attribute; and adjust the first model parameters and the second model parameters based on the differences between the first predicted attribute, the second predicted attribute, and the reference attribute.
[0185] In an optional embodiment, the training module 1050 is further configured to: determine a first difference between the first predicted attribute and the reference attribute; determine a second difference between the second predicted attribute and the reference attribute; determine a third difference between the first predicted attribute and the second predicted attribute; determine a loss difference based on the first difference, the second difference, and the third difference; and adjust the first model parameters and the second model parameters based on the loss difference.
[0186] In summary, the sample sentence generation device provided in this application does not generate sample sentences using the manual annotation method in related technologies. Instead, it provides a seed sentence, matches a first candidate sentence from a sentence library based on the seed sentence, and generates a second candidate sentence automatically. Thus, an automatically generated sample sentence is obtained based on the first and second candidate sentences. This automates the sample sentence generation process, improves the efficiency of sample sentence generation, and indirectly improves the training efficiency and accuracy of relation recognition.
[0187] It should be noted that the sample statement generation apparatus provided in the above embodiments is only an example of the division of the above functional modules. In practical applications, the above functions can be assigned to different functional modules as needed, that is, the internal structure of the device can be divided into different functional modules to complete all or part of the functions described above. In addition, the sample statement generation apparatus and the sample statement generation method embodiments provided in the above embodiments belong to the same concept, and their specific implementation process can be found in the method embodiments, which will not be repeated here.
[0188] Figure 12 A schematic diagram of the structure of a server provided in an exemplary embodiment of this application is shown. Specifically:
[0189] Server 1200 includes a Central Processing Unit (CPU) 1201, a system memory 1204 including Random Access Memory (RAM) 1202 and Read Only Memory (ROM) 1203, and a system bus 1205 connecting the system memory 1204 and the CPU 1201. Server 1200 also includes a mass storage device 1206 for storing an operating system 1213, application programs 1214, and other program modules 1215.
[0190] Mass storage device 1206 is connected to central processing unit 1201 via a mass storage controller (not shown) connected to system bus 1205. Mass storage device 1206 and its associated computer-readable media provide non-volatile storage for server 1200. That is, mass storage device 1206 may include computer-readable media (not shown) such as hard disk or compact disc read-only memory (CD-ROM) drives.
[0191] Without loss of generality, computer-readable media can include computer storage media and communication media. Computer storage media includes volatile and non-volatile, removable and non-removable media implemented using any method or technology for storing information such as computer-readable instructions, data structures, program modules, or other data. Computer storage media include RAM, ROM, erasable programmable read-only memory (EPROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other solid-state storage technologies, CD-ROM, digital versatile disc (DVD) or other optical storage, magnetic tape cassettes, magnetic tape, disk storage, or other magnetic storage devices. Of course, those skilled in the art will recognize that computer storage media are not limited to the above-mentioned types. The system memory 1204 and mass storage device 1206 described above can be collectively referred to as memory.
[0192] According to various embodiments of this application, server 1200 can also be connected to a remote computer on a network, such as the Internet. That is, server 1200 can be connected to network 1212 via network interface unit 1211 connected to system bus 1205, or network interface unit 1211 can be used to connect to other types of networks or remote computer systems (not shown).
[0193] The aforementioned memory also includes one or more programs, which are stored in the memory and configured to be executed by the CPU.
[0194] Embodiments of this application also provide a computer device, which includes a processor and a memory. The memory stores at least one instruction, at least one program, code set, or instruction set. The at least one instruction, at least one program, code set, or instruction set is loaded and executed by the processor to implement the sample statement generation method provided in the above-described method embodiments.
[0195] Embodiments of this application also provide a computer-readable storage medium storing at least one instruction, at least one program, code set, or instruction set, wherein the at least one instruction, at least one program, code set, or instruction set is loaded and executed by a processor to implement the sample statement generation method provided in the above-described method embodiments.
[0196] Embodiments of this application also provide a computer program product, which includes computer instructions stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium and executes the computer instructions, causing the computer device to perform the sample statement generation method described in any of the above embodiments.
[0197] Optionally, the computer-readable storage medium may include: read-only memory (ROM), random access memory (RAM), solid-state drives (SSDs), or optical discs, etc. The random access memory may include resistive random access memory (ReRAM) and dynamic random access memory (DRAM). The sequence numbers of the embodiments in this application are merely descriptive and do not represent the superiority or inferiority of the embodiments.
[0198] Those skilled in the art will understand that all or part of the steps of the above embodiments can be implemented by hardware or by a program instructing related hardware. The program can be stored in a computer-readable storage medium, such as a read-only memory, a disk, or an optical disk.
[0199] The above description is merely an optional embodiment of this application and is not intended to limit this application. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of this application should be included within the protection scope of this application.
Claims
1. A method for generating sample statements, characterized in that, The method includes: Obtain a seed statement for relation identification, wherein the seed statement includes a target entity and attribute conditions corresponding to the target entity, and the seed statement is used to indicate the determination of the attributes of the target entity; The seed statement is matched with the statement library to obtain a first candidate statement that meets the first similarity condition. The statement library includes historical search statements, which are search statements received by the search platform within a historical time period. Perform statement prediction on the target entity and the attribute conditions to generate a second candidate statement; A similarity analysis is performed on the first candidate statement, the second candidate statement, and the seed statement to generate sample statements that meet the similarity conditions corresponding to the target entity and the attribute conditions.
2. The method according to claim 1, characterized in that, The step of matching the seed statement with the statement database to obtain a first candidate statement that meets the first similarity condition includes: The seed statement is input into the statement matching model, which includes the statement library; The seed statement is matched with the statement database using the statement matching model to obtain the first candidate statement.
3. The method according to claim 2, characterized in that, The step of matching the seed statement with the statement database using the statement matching model to obtain the first candidate statement includes: The seed statement is analyzed for similarity with the historical search statements in the statement library using the statement matching model to obtain the first candidate statement that meets the first similarity.
4. The method according to any one of claims 1 to 3, characterized in that, The step of performing statement prediction on the target entity and the attribute conditions to generate a second candidate statement includes: The seed statement is input into the statement generation model, which is a pre-trained model for generating statements based on entity and attribute relationships. The statement generation model predicts the second candidate statement by performing statement prediction on the target entity and the attribute conditions.
5. The method according to any one of claims 1 to 3, characterized in that, The step of performing similarity analysis on the first candidate statement, the second candidate statement, and the seed statement to generate sample statements that meet the similarity conditions corresponding to the target entity and the attribute conditions includes: Perform similarity analysis between the first candidate statement and the seed statement, and determine the first sample statement that meets the second similarity condition from the first candidate statements; The second candidate statement is compared with the seed statement to determine the second sample statement that meets the third similarity condition. The set of the first sample statement and the second sample statement is determined as the set containing the sample statements.
6. The method according to any one of claims 1 to 3, characterized in that, The seed statements are marked with reference attributes; After performing similarity analysis on the first candidate statement, the second candidate statement, and the seed statement to generate sample statements that meet the similarity conditions corresponding to the target entity and the attribute conditions, the method further includes: The reference attribute is labeled on the sample statement; The relationship recognition model is trained using the sample statements, and the relationship recognition model is used to identify the attribute conditions of entities in the statements.
7. The method according to claim 6, characterized in that, The step of training the relation recognition model using the sample statements includes: The attribute relationships of the sample statements are identified using the relationship recognition model to obtain predicted attributes. Based on the difference between the predicted attribute and the reference attribute, the model parameters in the relationship recognition model are adjusted.
8. The method according to any one of claims 1 to 3, characterized in that, The seed statements are marked with reference attributes; After performing similarity analysis on the first candidate statement, the second candidate statement, and the seed statement to generate sample statements that meet the similarity conditions corresponding to the target entity and the attribute conditions, the method further includes: The relationship recognition model and the statement matching model are trained using the sample statements. The relationship recognition model is used to identify the attribute conditions of entities in the statement.
9. The method according to claim 8, characterized in that, The relationship recognition model includes a first model parameter, and the statement matching model includes a second model parameter; The step of training the relationship recognition model and the statement matching model using the sample statements includes: Obtain sample statement pairs from the sample statements, wherein the sample statement pairs include a first sample statement and a second sample statement; The relationship recognition model is used to identify the attribute relationships of the first sample statement to obtain the first predicted attribute. The second sample statement is subjected to attribute relationship identification using the relationship identification model to obtain the second predicted attribute. Based on the differences between the first predicted attribute, the second predicted attribute, and the reference attribute, the first model parameters and the second model parameters are adjusted.
10. The method according to claim 9, characterized in that, The step of adjusting the first model parameters and the second model parameters based on the differences between the first predicted attribute, the second predicted attribute, and the reference attribute includes: Determine a first difference between the first predicted attribute and the reference attribute; Determine a second difference between the second predicted attribute and the reference attribute; Determine a third difference between the first predicted attribute and the second predicted attribute; The loss difference is determined based on the first difference, the second difference, and the third difference; The first model parameters and the second model parameters are adjusted based on the loss difference.
11. A sample statement generation apparatus, characterized in that, The device includes: The acquisition module is used to acquire a seed statement for relation identification. The seed statement includes a target entity and attribute conditions corresponding to the target entity. The seed statement is used to indicate the determination of the attributes of the target entity. The matching module is used to match the seed statement with the statement library to obtain a first candidate statement that meets the first similarity condition with the seed statement. The statement library includes historical search statements, which are search statements received by the search platform within a historical time period. The generation module is used to predict the statement based on the target entity and the attribute conditions, and generate a second candidate statement; and to perform similarity analysis on the first candidate statement, the second candidate statement and the seed statement, and generate a sample statement that meets the similarity conditions corresponding to the target entity and the attribute conditions.
12. A computer device, characterized in that, The computer device includes a processor and a memory, the memory storing at least one program, which is loaded and executed by the processor to implement the sample statement generation method as described in any one of claims 1 to 10.
13. A computer-readable storage medium, characterized in that, The storage medium stores at least one program segment, which is loaded and executed by a processor to implement the sample statement generation method as described in any one of claims 1 to 10.
Citation Information
Patent Citations
Entity relationship recognition method and apparatus
CN105938495A