An entity extraction method, device, apparatus and storage medium
By vectorizing the target question and using vector indexes to identify entities, the problem of low efficiency and low accuracy of entity matching in knowledge graphs is solved, and efficient entity extraction and intent recognition are achieved in voice interaction scenarios.
Patent Information
- Application Number
- CN202211698372.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-12-28
- Publication Date
- 2026-01-16
- Estimated Expiration
- 2042-12-28
AI Technical Summary
Existing technologies suffer from problems such as high computation time consumption, word segmentation conflicts, and limited intent recognition when matching entities in knowledge graphs in voice interaction scenarios, resulting in a poor user experience.
A language model engine is used to vectorize the target question, and the target entity is identified by combining the vector index of the target knowledge graph, thereby improving the accuracy and efficiency of entity extraction.
When dealing with large amounts of knowledge graph data, it can quickly and accurately extract target entities, improving the accuracy of user intent recognition and the interactive experience.
Smart Images

Figure CN116010568B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of artificial intelligence, and in particular to an entity extraction method, device, equipment and storage medium. BACKGROUND
[0002] In the existing knowledge graph question answering of menu in the voice interaction scene, the existing algorithm logic of knowledge graph intent and entity matching is that the question is first hard-matched with the entity in the graph, the matched entity is obtained, the entity is replaced according to the type to which the entity belongs, the question is templated, and finally the intent can be obtained.
[0003] At present, the existing method of first performing hard matching of entities and then performing question template matching will greatly consume the operation time of the hard matching of entities in the case of a more and more large graph and more and more rich entities, and there will also be conflicts in word segmentation between entities (for example, spicy chicken cubes, spicy chicken, and spicy, which are actually three different foods. In different scenarios, if the word segmentation is wrong, it may cause the intent to be mismatched). In addition, the question template based on word segmentation is very limited in intent recognition and only has a small generalization ability. At this time, a different question may not be able to recognize the intent, and the user experience is poor. Therefore, an effective and accurate entity extraction method is needed to more accurately match the user intent. SUMMARY
[0004] The present application provides an entity extraction method, device, equipment and storage medium to improve the accuracy of entity extraction in the catering scene, so as to accurately identify the user intent.
[0005] According to an aspect of the present application, an entity extraction method is provided, which comprises:
[0006] Obtaining a target question in the process of user and robot interaction in the catering scene;
[0007] Based on the language model engine, the target question is vectorized to obtain a target question vector;
[0008] According to the target question vector and the vector index corresponding to the target knowledge graph, a target entity is determined.
[0009] According to another aspect of the present application, an entity extraction device is provided, which comprises:
[0010] A target question acquisition module is configured to obtain a target question in the process of user and robot interaction in the catering scene;
[0011] The target question vector determination module is configured to perform vectorization processing on the target question based on the language model engine to obtain a target question vector.
[0012] The target entity determination module is configured to determine a target entity according to the target question vector and a vector index corresponding to the target knowledge graph.
[0013] According to another aspect of the present application, an electronic device is provided, which comprises:
[0014] at least one processor; and
[0015] a memory connected to the at least one processor in communication; wherein
[0016] The memory stores a computer program executable by the at least one processor, and the computer program is executed by the at least one processor to enable the at least one processor to perform the entity extraction method according to any one of the embodiments of the present application.
[0017] According to another aspect of the present application, a computer readable storage medium is provided, which stores computer instructions for enabling a processor to perform the entity extraction method according to any one of the embodiments of the present application when executed.
[0018] The technical solution of the embodiments of the present application obtains a target question in the interaction process between a user and a robot in a catering scenario, then performs vectorization processing on the target question based on a language model engine to obtain a target question vector, and further determines a target entity according to the target question vector and a vector index corresponding to a target knowledge graph. Compared with the entity determination method based on a word segmentation inverted index in the prior art, the above technical solution can solve the problem of slow entity extraction efficiency and low accuracy in the case of a large amount of data in the knowledge graph. In the present application, the target question vector is introduced to determine the target entity in the target question based on the vector index, and the target entity can be quickly and accurately extracted especially in the case of a large amount of data in the knowledge graph.
[0019] It should be understood that the content described in this part is not intended to identify key or important features of the embodiments of the present application, nor is it used to limit the scope of the present application. Other features of the present application will become apparent from the following description. BRIEF DESCRIPTION OF DRAWINGS
[0020] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings needed 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 be obtained by those skilled in the art without creative labor.
[0021] Figure 1 is a flow chart of an entity extraction method according to an embodiment of the present application;
[0022] Figure 2 is a flow chart of an entity extraction method according to an embodiment of the present application;
[0023] Figure 3 is a flow chart of an entity extraction method according to an embodiment of the present application;
[0024] Figure 4 is a structural schematic diagram of an entity extraction device according to an embodiment of the present application;
[0025] Figure 5 is a structural schematic diagram of an electronic device implementing an entity extraction method according to an embodiment of the present application. DETAILED DESCRIPTION
[0026] In order to make the personnel in the art better understand the present application, the technical solutions in the embodiments of the present application will be described clearly and completely below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only a part of the embodiments of the present application, rather than all the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those skilled in the art without creative labor should belong to the scope of protection of the present application.
[0027] It should be noted that the terms "target", "candidate" and the like in the specification and claims of the present application and the above-mentioned drawings are used to distinguish similar objects, and do not necessarily describe a specific order or sequence. It should be understood that the data thus used can be interchanged under appropriate circumstances, so that the embodiments of the present application described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "include" and "have" and any variations thereof are intended to cover non-exclusive inclusion, for example, a process, method, system, product or device including a series of steps or units does not necessarily limit to those steps or units clearly listed, but can include other steps or units not clearly listed or inherent to these processes, methods, products or devices.
[0028] In addition, it should also be noted that in the technical solutions of the present application, the collection, storage, use, processing, transmission, provision and disclosure of related data such as target question sentences and target knowledge graphs in the technical solutions of the present application all comply with the relevant legal regulations and do not violate public order and good customs.
[0029] Embodiment one
[0030] Figure 1is a flowchart of an entity extraction method according to an embodiment of the present application. The embodiment can be applicable to the case of how to recognize user intent in the process of robot voice interaction in a catering scenario. The method can be executed by an entity extraction device, which can be realized in the form of hardware and / or software and can be integrated into an electronic device carrying an entity extraction function, such as a catering robot. As shown in Figure 1 , the entity extraction method of the embodiment can include:
[0031] S110, obtaining a target question in the process of user interaction with a robot in a catering scenario.
[0032] In the embodiment, the target question refers to the text information obtained by text conversion of the voice information obtained in the process of robot interaction with the user.
[0033] Specifically, more and more robots are applied in catering scenarios in catering scenarios. In catering places, robots replace manual labor to provide catering services to users, such as ordering services, dish query services, etc. In the process of robot interaction with the user, the voice information of the user is obtained, and the voice information is converted into text information to obtain the target question. For example, in the process of user voice interaction with the robot, there is a target question: "How much is your boiled fish?".
[0034] S120, based on a language model engine, vectorizing the target question to obtain a target question vector.
[0035] In the embodiment, the language model engine refers to the engine obtained by introducing a high-dimensional vector into the language model, which can be used for vectorizing the text data and outputting a vector of a preset value dimension; wherein the preset value can be set by the person skilled in the art according to the actual demand. The language model is obtained by fine-tuning the pre-trained language model Distilbert model using dialog sample data. The dialog sample data refers to the dialog log sample data collected from the actual voice interaction process of the robot in the catering scenario. Specifically, the deployment tool of Transformer-deploy is used to recompile the pre-trained language model using TensorRT to achieve some optimizations such as operator fusion and same network layer merging, thereby improving the inference speed of the language model engine.
[0036] The target question vector refers to the vector obtained by vectorizing the target question.
[0037] Specifically, the target question can be input into the language model engine for vectorization to obtain the target question vector.
[0038] S130, determine the target entity according to the target question vector and the vector index corresponding to the target knowledge graph.
[0039] In the embodiment, the target knowledge graph refers to a knowledge graph containing related objects in a catering scenario. Optionally, the target knowledge graph can include at least one object entity, at least one object attribute corresponding to the object entity, and attribute values corresponding to the object attribute. The object entity can be a dish entity, such as boiled fish or boiled meat. The object attribute is used to describe the related information of the object entity, such as introduction, price, type, and advertising language. The attribute value refers to the specific value of the object attribute. For example, the object entity in the target knowledge graph is grilled green fish. The attributes of this object entity include price, type, and advertising language. The attribute value of the price attribute is 38 yuan, the attribute value of the type attribute is signature, and the attribute value of the advertising language is fresh and delicious, fresh and freshly cooked, and seasonal seafood.
[0040] The vector index refers to the corresponding index in the target knowledge graph. Optionally, the vector index can include, but is not limited to, the following fields: question template, question vector, entity, and relationship between entities.
[0041] Specifically, the target entity in the target question can be determined based on the entity determination module according to the target question vector and the vector index corresponding to the target knowledge graph. The entity determination model can be obtained based on a machine learning algorithm.
[0042] The technical scheme of the embodiment of the application obtains the target question in the interaction process between the user and the robot in the catering scenario, then performs vectorization processing on the target question based on the language model engine to obtain the target question vector, and further determines the target entity according to the target question vector and the vector index corresponding to the target knowledge graph. The above technical scheme can solve the problem of slow entity extraction efficiency and low accuracy rate in the case of large amount of data in the knowledge graph compared to the entity determination mode based on the word segmentation and inverted index in the prior art. In the application, the target question vector is introduced to determine the target entity in the target question based on the vector index. Especially in the case of a large amount of data in the knowledge graph, the target entity can be quickly and accurately extracted.
[0043] On the basis of the above embodiment, as an optional way of the application, after determining the target entity according to the target question vector and the vector index corresponding to the target knowledge graph, the method further includes: querying the target knowledge graph according to the target entity to obtain the target answer corresponding to the target question; and showing the target answer to the user.
[0044] The target answer refers to the answer corresponding to the real intention in the target question.
[0045] Specifically, the target entity can be taken as an index to query the target answer corresponding to the target question from the target knowledge graph, and the target answer can be displayed to the user based on a preset display mode. For example, the extracted target entity is boiled fish and price, it can be determined that the intention of the target question is to inquire the price of the dish, and the price of the boiled fish is queried from the target knowledge graph, such as the price of the boiled fish entity is "78 yuan", the target answer "78 yuan" can be output to the user in the form of voice, or the target answer "78 yuan" is displayed on the robot screen, etc. It should be noted that the preset display mode is not limited in the present application, and the skilled person can set it according to the actual needs.
[0046] It can be understood that the answer corresponding to the user's intention can be more accurately and quickly queried from the target knowledge graph according to the determined target entity, and the answer is displayed to the user, which can clearly and intuitively feedback the answer to the user, especially in a catering place, the answer can be displayed to the user by the catering robot, which can improve the user's voice interaction experience.
[0047] Further, on the basis of the above-mentioned embodiments, as an optional way of the present application, after determining the target entity according to the target question vector and the vector index corresponding to the target knowledge graph, the method further comprises: inquiring the user whether the target entity is correct; if a negative answer is recognized, prompting the user to re-input the target question.
[0048] Specifically, to ensure the accuracy of the user's intention recognition, after determining the target entity, the user can be inquired whether the target entity is correct by a preset inquiry mode, such as inquiring whether the target entity is correct in the form of voice, or inquiring whether the target entity is correct in the form of pop-up window; then if a negative answer of voice is recognized or a negative button in the user's first pop-up window is clicked, the user can be prompted to re-input the target question. It can be understood that the accuracy of the user's intention is further determined by inquiring the user again whether the target entity is correct, so as to provide a guarantee for the user to provide accurate answers.
[0049] Embodiment two
[0050] Figure 2 is a flow chart of an entity extraction method according to embodiment two of the present application. This embodiment further describes the determination mode of the vector index on the basis of the above-mentioned embodiments. As shown in Figure 2 the entity extraction method of this embodiment can include:
[0051] S210, obtaining a target question in the process of user and robot interaction in a catering scene.
[0052] S220, based on a language model engine, vectorizing the target question to obtain a target question vector.
[0053] S230, determining the target entity according to the target question vector and the vector index corresponding to the target knowledge graph.
[0054] Optionally, in the embodiment, the vector index is determined by the following method: determining at least one object entity, at least one object attribute corresponding to the object entity, attribute value corresponding to the object attribute, and at least one question template corresponding to the object attribute; for each question template, performing a preset processing on the question template, the object entity corresponding to the question template, the object attribute corresponding to the object entity, and the attribute value corresponding to the object attribute, to obtain at least one new question corresponding to the question template; performing vectorization processing on the new question based on the language model engine to obtain a question vector; and constructing the vector index based on the at least one question vector, the question template corresponding to the question vector, and the object entity.
[0055] Specifically, for each object entity in the target knowledge graph, at least one object attribute corresponding to the object entity, attribute value corresponding to the object attribute, and at least one question template corresponding to the object attribute are determined. For example, for the dish entity grilled green fish, the object attributes corresponding thereto include price, type, and advertising language, the attribute value of the price is 38 yuan, the attribute value of the type is signature dish, and the attribute value of the advertising language is fresh and delicious, fresh and freshly cooked, and seasonal seafood; wherein the question template corresponding to the object attribute price is question template 1 “{{entity}}’s {{property}} is how much?” and question template 2 “{{entity}}{{property}} is how much?”; wherein entity represents the object entity and property represents the attribute. For example, for question template 1, the object entity grilled green fish and the attribute price corresponding to the grilled green fish are brought into the question template to obtain a new question “How much is the price of grilled green fish”. Then the new question “How much is the price of grilled green fish” is input into the speech model engine for vectorization processing to obtain a question vector; and the question vector, the corresponding template “{{entity}}’s {{property}} is how much?”, and grilled green fish are spliced to obtain a vector index.
[0056] Further, the vector index can also include the relationship between the object attribute and / or different object entities. Specifically, the at least one question vector, the question template corresponding to the question vector, the object entity, and the object attribute can be spliced to obtain the vector index; or the at least one question vector, the question template corresponding to the question vector, the object entity, and the relationship between the object entities can be spliced to obtain the vector index; or the object attribute, the at least one question vector, the question template corresponding to the question vector, the object entity, and the relationship between the object attribute and different object entities can be spliced to obtain the vector index. By continuously enriching the vector index, the determination of the target entity can be improved.
[0057] It can be understood that the vector index of the target knowledge graph constructed in the above manner can lay a foundation for entity extraction in the target question.
[0058] The technical scheme of the embodiment of the application obtains the target question in the interaction process between the user and the robot in the catering scenario, then performs vectorization processing on the target question based on the language model engine to obtain the target question vector, and further determines the target entity according to the target question vector and the vector index corresponding to the target knowledge graph. Compared with the entity determination mode based on the word segmentation inverted index in the prior art, the above technical scheme can solve the problem of slow entity extraction efficiency and low accuracy in the case of a large amount of data in the knowledge graph. In the application, the target question vector is introduced, and the target entity in the target question is determined based on the vector index, which can quickly and accurately extract the target entity, especially in the case of a large amount of data in the knowledge graph.
[0059] Embodiment three
[0060] Figure 3 is a flowchart of an entity extraction method according to the embodiment three of the application. Based on the above-mentioned embodiments, the embodiment further optimizes the step of "determining the target entity according to the target question vector and the vector index corresponding to the target knowledge graph", and provides an optional implementation scheme. As shown in Figure 3 , the entity extraction method of the embodiment can include:
[0061] S310, obtaining a target question in the interaction process between the user and the robot in the catering scenario.
[0062] S320, performing vectorization processing on the target question based on the language model engine to obtain a target question vector.
[0063] S330, determining a candidate entity according to the target question vector and the vector index corresponding to the target knowledge graph.
[0064] In the embodiment, the candidate entity refers to an entity extracted from a question that is the same as or similar to the target question.
[0065] Optionally, the similarity between the target question vector and the question vector in the vector index can be determined, and the candidate question vector can be determined from the vector index according to the similarity; the candidate question can be determined according to the candidate question vector; and the candidate entity can be obtained by performing entity extraction on the candidate question.
[0066] The candidate question vector refers to a vector that is the same as or similar to the target question vector. The candidate question refers to a question that is the same as or similar to the target question.
[0067] Specifically, the similarity between the target question vector and the question vectors in the vector index can be determined based on a preset similarity determination manner. For example, cosine similarity calculation can be performed between the target question vector and the question vectors in the vector index to obtain a cosine value as the similarity between the target question vector and the question vectors in the vector index. Then, the question vectors with a similarity greater than a similarity threshold in the vector index can be selected as candidate question vectors, and the number of the candidate question vectors can be one or more. The similarity threshold can be determined by a person skilled in the art according to experience, for example, the similarity threshold can be 0.8. It should be noted that in the vector dimension, the greater the similarity (cosine value) is, the higher the text similarity is, that is, the greater the similarity between the target question vector and the question vectors in the vector index is. Therefore, the question vector with the greatest similarity and a similarity greater than the similarity threshold can also be selected from the vector index as the candidate question vector. Thus, the question vector closest to the user's intention can be quickly found.
[0068] Further, the corresponding candidate question is determined from the vector index according to the candidate question vector. The candidate entity is obtained by performing entity extraction on the candidate question. For example, the target question vector "How much is the price of the boiled fish here?" matches the vector index corresponding to the candidate question "How much is the price of the boiled fish?" in the vector index, that is, the candidate question vector. Then, entity extraction is performed on the candidate question to obtain { "entity": "boiled fish", "property": "price"}, that is, the candidate entities "boiled fish" and "price".
[0069] It can be understood that matching the user's intention based on the vector similarity has high generalization ability. For example, the target question is "I want to ask how much is the price of the boiled fish?", "How much is the price of the boiled fish?", and "How much is the price of the boiled fish here?" These can successfully perform intention matching, and the similarity is greater than the similarity threshold 0.8, which greatly improves the generalization understanding ability of the user's question.
[0070] S340, determining the target entity of the target question according to the candidate entity.
[0071] Optionally, the candidate entity can be directly used as the target entity of the target question.
[0072] Further, the candidate entity and the target question can be matched; according to the matching result, the target entity is determined. Specifically, the candidate entity and the target question can be hard matched, such as, the candidate entity and the target question are segmented and matched, or the candidate entity and the target question are fully matched. Then, according to the matching result, if it is successful, the candidate entity is determined as the target entity, at this time, it is considered that the intent of the target question “how much is the price of the boiled fish here” is to inquire the price of the dish, and the target entity extracts {“entity”: “boiled fish”, “property”: “price”}. If the matching result is unsuccessful, the S320 can be returned to determine the target question vector again.
[0073] It can be understood that the candidate entity is matched again in the hard matching mode to ensure that the target entity obtained is closer to the user intent.
[0074] The technical scheme provided by the embodiment of the application comprises the following steps: obtaining a target question in a user-robot interaction process in a catering scenario, then performing vectorization processing on the target question based on a language model engine to obtain a target question vector, and then determining a candidate entity according to the target question vector and a vector index corresponding to a target knowledge graph, and determining a target entity of the target question according to the candidate entity. Compared with the entity recall based on the segmentation and the inverted index of the traditional search engine, the essence of the above technical scheme is to count the word frequency, and the similarity is reduced or even not matched when the question method is slightly changed. In the application, the vector method is used to determine the entity of the target question, and the entity of the question method similar to the intent can be recalled more quickly and accurately. That is, with the continuous expansion of the question templates and the entities in the vector index, the vector boundary of the different question vectors in the vector space of the vector index corresponding to the same intent is also continuously expanded, so that the recall rate of the final intent, that is, the accuracy of the entity extraction, is continuously increased.
[0075] Embodiment four
[0076] Figure 4 It is a structural schematic diagram of an entity extraction device provided by the embodiment four of the application. The embodiment can be applied to the case of how to identify the user intent in the process of the robot voice interaction in the catering scenario. The entity extraction device can be realized in the form of hardware and / or software, and can be integrated in an electronic device carrying the entity extraction function, such as a catering robot. As shown in the figure, the entity extraction device of the embodiment can comprise: Figure 4
[0077] A target question acquisition module 410 is configured to acquire a target question in a user-robot interaction process in a catering scenario.
[0078] The target question vector determination module 420 is configured to perform vectorization processing on the target question based on the language model engine to obtain a target question vector.
[0079] The target entity determination module 430 is configured to determine a target entity according to the target question vector and a vector index corresponding to the target knowledge graph.
[0080] The technical solution of the embodiment of the application obtains a target question in the interaction process between a user and a robot in a catering scenario, then performs vectorization processing on the target question based on a language model engine to obtain a target question vector, and further determines a target entity according to the target question vector and a vector index corresponding to a target knowledge graph. Compared with the entity determination mode based on a word segmentation inverted index in the prior art, which causes the problem of slow entity extraction efficiency and low accuracy in the case of a large amount of data in the knowledge graph, the target question vector is introduced in the application to determine the target entity in the target question based on the vector index, and the target entity can be quickly and accurately extracted especially in the case of a large amount of data in the knowledge graph.
[0081] Optionally, the vector index is determined in the following manner:
[0082] determining at least one object entity, at least one object attribute corresponding to the object entity, an attribute value corresponding to the object attribute, and at least one question template corresponding to the object attribute;
[0083] for each question template, performing preset processing on the question template and the object entity corresponding to the question template, the object attribute corresponding to the object entity, and the attribute value corresponding to the object attribute to obtain at least one new question corresponding to the question template;
[0084] performing vectorization processing on the new question based on the language model engine to obtain a question vector;
[0085] constructing a vector index based on the at least one question vector, a question template corresponding to the question vector, and an object entity.
[0086] Optionally, the vector index further includes an object attribute and / or a relationship between different object entities.
[0087] Optionally, the target entity determination module includes:
[0088] The candidate entity determination unit is configured to determine a candidate entity according to the target question vector and the vector index corresponding to the target knowledge graph.
[0089] The target entity determination unit is configured to determine a target entity of the target question according to the candidate entity.
[0090] Optionally, the candidate entity determination unit is specifically configured to:
[0091] determine the similarity between the target question vector and the question vectors in the vector index, and determine a candidate question vector from the vector index according to the similarity;
[0092] determine a candidate question according to the candidate question vector;
[0093] perform entity extraction on the candidate question to obtain a candidate entity.
[0094] Optionally, the target entity determination unit is specifically configured to:
[0095] match the candidate entity with the target question;
[0096] determine the target entity according to the matching result.
[0097] Optionally, the apparatus further comprises a target answer display module configured to:
[0098] after determining the target entity according to the target question vector and the vector index corresponding to the target knowledge graph, query the target knowledge graph according to the target entity to obtain a target answer corresponding to the target question;
[0099] Optionally, the apparatus further comprises a target question inquiry module configured to:
[0100] after determining the target entity according to the target question vector and the vector index corresponding to the target knowledge graph, inquire the user about whether the target entity is correct;
[0101] if a negative answer is recognized, prompt the user to re-input the target question.
[0102] The entity extraction apparatus provided in the embodiments of the present application can execute the entity extraction method provided in any of the embodiments of the present application, and has the corresponding functional modules and beneficial effects of the execution method.
[0103] Embodiment five
[0104] Figure 5 is a structural schematic diagram of an electronic device for implementing the entity extraction method of the embodiments of the present application. Figure 5A structural diagram of an electronic device 10 that can be used to implement embodiments of the present application is shown. The electronic device is intended to represent various forms of digital computers, such as laptops, desktops, tablets, personal digital assistants, servers, blade servers, mainframes, and other appropriate computers. The electronic device can also represent various forms of mobile devices, such as personal digital assistants, cellular telephones, smartphones, wearable devices (e.g., headsets, glasses, watches, etc.), and other similar computing devices. The components shown here, their connections and relationships, and their functions, are meant to be examples only, and are not meant to limit implementations of the present application described and / or claimed in this document.
[0105] As shown, Figure 5 The electronic device 10 includes at least one processor 11, and a memory, such as a read-only memory (ROM) 12, a random access memory (RAM) 13, etc., communicatively connected to the at least one processor 11, where the memory stores computer programs executable by the at least one processor. The processor 11 can perform various appropriate actions and processes according to the computer programs stored in the read-only memory (ROM) 12 or loaded from the storage unit 18 into the random access memory (RAM) 13. In the RAM 13, various programs and data required for the operation of the electronic device 10 can also be stored. The processor 11, the ROM 12, and the RAM 13 are connected to each other through a bus 14. An input / output (I / O) interface 15 is also connected to the bus 14.
[0106] Various components in the electronic device 10 are connected to the I / O interface 15, including an input unit 16, such as a keyboard, a mouse, etc., an output unit 17, such as various types of displays, speakers, etc., a storage unit 18, such as a magnetic disk, an optical disk, etc., and a communication unit 19, such as a network card, a modem, a wireless communication transceiver, etc. The communication unit 19 allows the electronic device 10 to exchange information / data with other devices through a computer network, such as the Internet, and / or various telecommunication networks.
[0107] The processor 11 can be various general and / or special purpose processing components with processing and computing capabilities. Some examples of the processor 11 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various special-purpose artificial intelligence (AI) computing chips, various processors running machine learning model algorithms, a digital signal processor (DSP), and any appropriate processor, controller, microcontroller, etc. The processor 11 performs various methods and processes described above, such as the entity extraction method.
[0108] In some embodiments, the entity extraction method can be implemented as a computer program tangibly embodied in a computer readable storage medium, e.g., storage unit 18. In some embodiments, portions or all of the computer program can be loaded and / or installed onto electronic device 10 via, e.g., ROM 12 and / or communication unit 19. When the computer program is loaded onto RAM 13 and executed by processor 11, one or more steps of the entity extraction method described above can be performed. Alternatively, in other embodiments, processor 11 can be configured to perform the entity extraction method by other means, e.g., with the aid of firmware.
[0109] Various implementations of the systems and techniques described above can be realized in digital electronic circuitry, integrated circuitry, specially designed application specific integrated circuits (ASICs), field programmable gate arrays (FPGAs), computer hardware, firmware, software, and / or combinations thereof. These various implementations can include implementation in one or more computer programs that are executable and / or interpretable on a programmable system including at least one programmable processor, which can be special or general purpose, coupled to receive data and instructions from, and to transmit data and instructions to, a storage system, at least one input device, and at least one output device.
[0110] Computer programs used to implement the methods of the application can be written in any combination of one or more programming languages. These computer programs can be provided to a processor of a general purpose computer, special purpose computer, or other programmable data processing apparatus to produce a machine, such that the computer program, when executed, can implement the functions / acts specified in the flowcharts and / or block diagrams.
[0111] In the context of the present application, a computer-readable storage medium can be a tangible medium that can contain or store computer programs for use by or in connection with an instruction execution system, apparatus, or device. Computer-readable storage media can include, but are not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatus, or devices, or any suitable combination of the foregoing. Alternatively, a computer-readable storage medium can be a machine-readable signal medium. More specific examples of a machine-readable storage medium will include one or more lines of a program of instructions in a transitory signal, a portable computer diskette, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or Flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
[0112] To provide for interaction with a user, the systems and techniques described here can be implemented on an electronic device having a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user and a keyboard and a pointing device (e.g., a mouse or a trackball) by which the user can provide input to the electronic device. Other kinds of devices can be used to provide for interaction with a user as well; for example, feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form, including acoustic, speech, or tactile input.
[0113] The systems and techniques described here can be implemented in a computing system that includes a back end component (e.g., as a data server), or that includes a middleware component (e.g., an application server), or that includes a front end component (e.g., a user computer having a graphical user interface or a Web browser through which a user can interact with an implementation of the systems and techniques described here), or any combination of such back end, middleware, or front end components. The components of the system can be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include a local area network (LAN), a wide area network (WAN), a blockchain network, and the Internet.
[0114] The computing system can include clients and servers. A client and server are generally remote from each other and typically interact through a communication network. The relationship of client and server arises by virtue of computer programs running on the respective computers and having a client-server relationship to each other. The server can be a cloud server, also known as a cloud computing server or cloud host, which is a host product in the cloud computing service system, to solve the defects of large management difficulty and weak business scalability in traditional physical host and VPS service.
[0115] It should be understood that the various forms of flow shown above can be used to reorder, add or delete steps. For example, each step described in the present application can be executed in parallel, sequentially or in a different order, as long as the desired results of the technical solutions of the present application can be achieved, which is not limited herein.
[0116] The above detailed description does not constitute a limitation on the protection scope of the present application. Those skilled in the art should understand that various modifications, combinations, sub-combinations and substitutions can be made according to design requirements and other factors. Any modifications, equivalent replacements and improvements made within the spirit and principles of the present application shall be included in the protection scope of the present application.
Claims
1. An entity extraction method, characterized by, The method comprises the following steps: acquiring a target question in the process of interaction between a user and a robot in a catering scenario; vectorizing the target question based on a language model engine to obtain a target question vector; determining a target entity according to the target question vector and a vector index corresponding to a target knowledge graph; wherein the vector index is determined in the following manner: determining at least one object entity, at least one object attribute corresponding to the object entity, an attribute value corresponding to the object attribute, and at least one question template corresponding to the object attribute; for each question template, performing a preset processing on the question template, the object entity corresponding to the question template, the object attribute corresponding to the object entity, and the attribute value corresponding to the object attribute to obtain at least one new question corresponding to the question template; vectorizing the new question based on the language model engine to obtain a question vector; constructing a vector index based on at least one question vector, a question template corresponding to the question vector, and an object entity.
2. The method of claim 1, wherein, The vector index further comprises object attributes and / or relationships between different object entities.
3. The method of claim 1, wherein, The determination of the target entity according to the target question vector and the vector index corresponding to the target knowledge graph comprises the following steps: determining a candidate entity according to the target question vector and the vector index corresponding to the target knowledge graph; determining the target entity of the target question according to the candidate entity.
4. The method of claim 3, wherein, The determination of the candidate entity according to the target question vector and the vector index corresponding to the target knowledge graph comprises the following steps: determining a similarity between the target question vector and a question vector in the vector index, and determining a candidate question vector from the vector index according to the similarity; determining a candidate question according to the candidate question vector; performing entity extraction on the candidate question to obtain the candidate entity.
5. The method of claim 3, wherein, The determination of the target entity of the target question according to the candidate entity comprises the following steps: matching the candidate entity with the target question; determining the target entity according to the matching result.
6. The method of claim 1, wherein, After the determination of the target entity according to the target question vector and the vector index corresponding to the target knowledge graph, the method further comprises the following steps: querying the target knowledge graph according to the target entity to obtain a target answer corresponding to the target question; displaying the target answer to the user.
7. The method of claim 1, wherein, After the determination of the target entity according to the target question vector and the vector index corresponding to the target knowledge graph, the method further comprises the following steps: inquiring the user about whether the target entity is correct; if a negative answer is recognized, prompting the user to re-input the target question.
8. An entity extraction apparatus characterized by comprising: The method comprises the following steps: a target question acquisition module, configured to acquire a target question in the process of interaction between a user and a robot in a catering scenario; a target question vector determination module, configured to vectorize the target question based on a language model engine to obtain a target question vector; a target entity determination module, configured to determine a target entity according to the target question vector and a vector index corresponding to a target knowledge graph; wherein the vector index is determined in the following manner: determining at least one object entity, at least one object attribute corresponding to the object entity, an attribute value corresponding to the object attribute, and at least one question template corresponding to the object attribute; for each question template, performing preset processing on the question template, the object entity corresponding to the question template, the object attribute corresponding to the object entity, and the attribute value corresponding to the object attribute, to obtain at least one new question corresponding to the question template; performing vectorization processing on the new question based on the language model engine to obtain a question vector; constructing a vector index based on at least one question vector, a question template corresponding to the question vector, and an object entity.
9. An electronic device, comprising: The electronic device comprises: at least one processor; and a memory connected in communication with the at least one processor; wherein the memory stores a computer program executable by the at least one processor, and the computer program is executed by the at least one processor to enable the at least one processor to execute the entity extraction method in any one of claims 1-7.
10. A computer-readable storage medium, characterized in that, The computer readable storage medium stores computer instructions for causing the processor to implement the entity extraction method in any one of claims 1-7 when executed.
Citation Information
Patent Citations
Automatic question and answer processing method and device, computer equipment and storage medium
CN111858859A
Conversation reply determination method and device based on artificial intelligence, equipment and medium
CN114116980A