Method, device and storage medium for generating answers to natural language questions
By analyzing natural language questions and identifying intent, we obtain the node answer framework and parameters and generate answers, which solves the problem of low answer generation efficiency in multi-entity natural language questions, improves the utilization of data resources, and realizes efficient natural language understand.
Patent Information
- Application Number
- CN201910550376.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2019-06-24
- Publication Date
- 2024-09-24
- Estimated Expiration
- 2039-06-24
AI Technical Summary
In multi-entity natural language questions, it is difficult for existing technologies to efficiently configure answers for different entities, resulting in low answer generation efficiency and low data resource utilization.
By parsing natural language questions, extracting target intentions and named entities, obtaining node answer frames and parameters, and generating answers based on this information, the answer generation efficiency is improved, and node answers are selected by dividing them into multi-entities and multi-intent combinations, increasing The probability of answer reuse.
It improves the efficiency of answer generation and the utilization of data resources, and achieves more efficient natural language understanding and answer generation.
Smart Images

Figure 00000000_0000
Abstract
Description
Technical Field
[0001] The present application relates to the field of information processing technology, and in particular to a method, device and storage medium for generating answers to natural language questions. Background Art
[0002] Natural Language Processing (NLP) is a technology that uses natural language to communicate with computers. Because the key to processing natural language is to make computers understand natural language, natural language processing is also called natural language understanding (NLU).
[0003] In the related art, for natural language questions with multiple entities, since the answers corresponding to each entity are not necessarily the same, it is necessary to list the questions corresponding to different entities when configuring the answers, and configure different answers for each different entity one by one, which makes the answer configuration inefficient. Summary of the invention
[0004] The embodiments of the present application provide a method, device and storage medium for generating answers to natural language questions, which can improve the efficiency of answer generation and the utilization rate of data resources.
[0005] The present application embodiment provides a method for generating an answer to a natural language question, comprising:
[0006] Parse natural language questions to obtain target intent and named entities;
[0007] Obtaining a corresponding node answer framework according to the target intent;
[0008] Acquire corresponding node answer parameters according to the target intent and the named entity;
[0009] An answer to the natural language question is generated based on the named entity, the node answer parameter, and the node answer framework.
[0010] In some embodiments, performing intent recognition on the natural language question to obtain a target intent includes:
[0011] Performing word segmentation processing on the natural language question to obtain multiple candidate words;
[0012] Search multiple candidate words based on a preset knowledge base to obtain search results;
[0013] updating the multiple candidate words according to the search results;
[0014] Generate target intent based on the updated candidate words.
[0015] Accordingly, the embodiment of the present application also provides a device for generating an answer to a natural language question, including:
[0016] Parsing unit, used to parse natural language questions to obtain target intent and named entities;
[0017] An acquisition unit, used for acquiring a corresponding node answer framework according to the target intent;
[0018] A determination unit, configured to obtain corresponding node answer parameters according to the target intent and the named entity;
[0019] A generating unit is used to generate an answer to the natural language question based on the named entity, the node answer parameter and the node answer framework.
[0020] Correspondingly, an embodiment of the present application also provides a storage medium, which stores multiple instructions, and the instructions are suitable for a processor to load to execute the steps in the method for generating answers to natural language questions as described above.
[0021] Correspondingly, an embodiment of the present application also provides a terminal, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the program, the steps in the method for generating answers to natural language questions as described above are implemented.
[0022] In an embodiment of the present application, by extracting intents and named entities from natural language questions, and matching corresponding node answer parameters from the configured node answers based on this, and combining the matched node answer framework and other related information, a complete answer for the corresponding entity is automatically generated according to the set answer logic, thereby improving the efficiency of answer generation; in addition, by dividing the natural language questions into multiple entity and multiple intent combinations to select the required node answers, the probability of node answers being reused is increased to a certain extent, thereby improving the utilization rate of data resources. BRIEF DESCRIPTION OF THE DRAWINGS
[0023] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For those skilled in the art, other drawings can be obtained based on these drawings without creative work.
[0024] Figure 1 It is a flow chart of a method for generating answers to natural language questions provided in an embodiment of the present application.
[0025] Figure 2This is another flowchart of the method for generating answers to natural language questions provided in an embodiment of the present application.
[0026] Figure 3 It is a flowchart of constructing answers to natural language questions provided in an embodiment of the present application.
[0027] Figure 4 It is a schematic diagram of the structure of a device for generating answers to natural language questions provided in an embodiment of the present application.
[0028] Figure 5 It is a schematic diagram of the structure of the terminal provided in the embodiment of the present application. DETAILED DESCRIPTION
[0029] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those skilled in the art without creative work are within the scope of protection of this application.
[0030] The embodiments of the present application provide a method, device and storage medium for generating answers to natural language questions, which can improve the accuracy of natural language recognition and the efficiency of problem solving during operation and maintenance. The following are detailed explanations. It should be noted that the order of the following embodiments is not intended to limit the preferred order of the embodiments.
[0031] In one embodiment, the description will be made from the perspective that the device for generating an answer to the first natural language question is integrated in a terminal.
[0032] See also Figure 1 , Figure 1 A schematic diagram of a flow chart of a method for generating answers to natural language questions provided in an embodiment of the present application. The specific flow of the method for generating answers to natural language questions may be as follows:
[0033] 101. Parse natural language questions to obtain target intent and named entities.
[0034] Among them, natural language refers to a language that evolves naturally with culture and is the main tool for human communication and human-computer interaction. For example, English, Chinese, Japanese, etc. are all natural languages.
[0035] Named entities can be names of people, names of organizations, names of places, and all other entities identified by names. In some embodiments, the named entities also include numbers, dates, currencies, addresses, and the like.
[0036] Intent refers to the purpose of the natural language question, such as checking the weather, booking a flight, etc.
[0037] In this embodiment, the natural language question to be identified may be question information input by a user through a terminal. In specific implementation, the user may input natural language information through an information input interface of a terminal device. For example, the terminal device may display an information input interface, which is provided with an information input control, and the user may input natural language information through the information input control to achieve human-computer interaction with the device.
[0038] In actual applications, when a user inputs the natural language information to be recognized, multiple input methods may be used, for example, text information or voice information. Accordingly, the device may receive a natural language question in the form of text information or voice information.
[0039] In some embodiments, the step of “parsing the natural language question to obtain the target intent and the named entity” may include the following process:
[0040] (11) Perform entity recognition on natural language questions to obtain named entities;
[0041] (12) Perform intent recognition on natural language questions to obtain the target intent.
[0042] Specifically, in an embodiment of the present application, when parsing a natural language question, it is necessary to extract named entities and identify intents, so that the corresponding node answers can be selected according to the set logic based on the named entities and intents to generate an answer to the natural language question.
[0043] In some embodiments, the step of “performing intent recognition on a natural language question to obtain a target intent” may include the following process:
[0044] (121) Perform word segmentation on the natural language question to obtain multiple candidate words;
[0045] (122) searching multiple candidate words based on a preset knowledge base to obtain search results;
[0046] (123) updating multiple candidate words according to the search results;
[0047] (124) Generate target intent based on the updated candidate words.
[0048] Specifically, the word segmentation process can be based on statistics, and the statistical sample content comes from a standard corpus. In specific implementation, the statistical probability established by the corpus can be used. For a new sentence, the joint distribution probability corresponding to various word segmentation methods can be calculated to find the word segmentation method corresponding to the maximum probability, that is, the optimal word segmentation, thereby obtaining multiple candidate words.
[0049] In some embodiments, the search result may include: sample words matching each candidate word, and the matching degree between the candidate word and the sample word, wherein the sample word may be stored in the above-mentioned preset knowledge base. Then, when updating multiple candidate words according to the search result, a first sample word whose corresponding matching degree is lower than a first threshold may be determined from the sample words, and then the first sample word may replace the candidate word matching it in the multiple candidate words, and then a second sample word whose corresponding matching degree is lower than a second threshold may be determined from the sample words, and finally the candidate word matching the second sample word in the multiple candidate words may be deleted.
[0050] It should be noted that the first threshold is greater than the second threshold. That is, for wrong words (such as typos), they can be considered as words that have a certain degree of match with the preset knowledge base but the match is not very high, so this type of candidate words can be screened out based on the degree of match, and the candidate words can be replaced with the sample words matched in the preset knowledge base to achieve the error correction operation of the words. In addition, when performing word retrieval, candidate words with a very low degree of match can be considered as stop words, so the candidate words can be deleted to improve the validity of the data.
[0051] In actual applications, the information input by users within a certain period of time is usually specifically related, so the target intent can be identified based on the overall context. That is, the sentence to be identified (i.e., the natural language question to be identified) can be adjusted and modified based on the context of the current sentence to be identified, so that the intent of the current sentence is clearer, and then the intent of the question can be identified.
[0052] 102. Obtain the corresponding node answer framework according to the target intent.
[0053] Specifically, the node answer framework may include the node answers required for the target, and the node answers do not include answer values. For example, the node answers included in the answer framework include the maximum speed and price of car A, but do not include specific speed values and specific prices, but only indicate that the target intent requires speed information and price information. Figure 2 In some embodiments, the step of "obtaining the corresponding node answer framework according to the target intent" may include the following process:
[0054] 1021. Extracting intent words from target intent;
[0055] 1022. Obtain description information corresponding to the intent word;
[0056] 1023. Determine a natural language template corresponding to the target intent from a specified natural language template library;
[0057] 1024. Generate a node answer framework based on the description information and the natural language template.
[0058] Specifically, the description information is used to describe the meaning of the intent word in the target intent. Specifically, the formal characteristics and content characteristics of the intent word in the target intent can be described according to certain rules and standards. For example, if the intent word is "speed", the corresponding description information can be "its speed is #speed#", "its speed per hour is #speed#", etc.
[0059] In this embodiment, a natural language template library needs to be preset to match the corresponding natural language template for the target intent. The natural language template can be a pre-edited guiding speech. For example, for the intent of the speed of a certain car, the corresponding natural language template can be set to "Xiao J will now introduce you to #racing car introduction#. Isn't it great! Go and drive it."
[0060] In some embodiments, the step of "obtaining description information corresponding to the intent word" may include the following process:
[0061] (21) matching the intended word with a plurality of sample words in the sample word set;
[0062] (22) determining a target sample word with the highest matching degree with the intended word from the sample word set;
[0063] (23) Obtain the description information of the target sample word as the description information corresponding to the intended word.
[0064] The sample word set includes a plurality of preset sample words, and each sample word is configured with corresponding description information. The description information is used to extend the sample word and describe the specific purpose of the sample word. For example, if the sample word is "speed", the corresponding description information may be "speed is #speed#", "speed size is #speed#", etc.
[0065] In order to facilitate unified management, in this embodiment, the corresponding synonyms and near-synonyms will be identified in the sample word set according to the semantics of the intended word, and the sample word with the highest relevance (i.e., matching degree) will be matched to the intended word based on the original semantics. For example, if the intended word is "speed" or "rate", the sample word "speed" in the sample word set can be matched as the target sample word of the intended word. Then, the description information corresponding to the target sample word is used as the description information of the intended word.
[0066] 103. Obtain corresponding node answer parameters according to the target intent and the named entity.
[0067] Among them, the node answer parameter is the answer value corresponding to the target intent and the named entity when they are jointly constructed into an intent sentence.
[0068] In this embodiment, it is necessary to pre-construct intent nodes and entity nodes. Then, different intent nodes and different entity nodes can be arbitrarily combined to generate different intent sentences. Then, the corresponding answer will be configured for each intent sentence as the node answer corresponding to the corresponding intent node and entity node. It should be noted that the node answers configured in this embodiment are the answers with the smallest granularity under the parsing field. For example, the introduction of the racing car has smaller granularities such as price, speed, model, start time, etc. In actual applications, the correspondence between the intent node, entity node and node answer can be constructed, and can be stored in the terminal or cloud server in the form of a table.
[0069] For example, refer to Table 1 below, which is a schematic diagram of a node answer configuration table provided in an embodiment of the present application:
[0070] Table 1
[0071]
[0072] As shown in Table 3, for the intent sentence constructed with the named entity node "A-class car" and the intention node "speed", the configured answer is "300km / h"; for the intent sentence constructed with the named entity node "B-class car" and the intention node "speed", the configured answer is "200km / h"; for the intent sentence constructed with the named entity node "A-class car" and the intention node "price", the configured node answer is "5000¥"; for the intent sentence constructed with the named entity node "B-class car" and the intention node "price", the configured node answer is "2000¥".
[0073] Continue to refer Figure 2 In some embodiments, the step of “obtaining corresponding node answer parameters according to the target intent and the named entity” may include the following process:
[0074] 1031. Determine a plurality of candidate node answer parameters corresponding to a named entity based on a preset first mapping relationship, wherein the first mapping relationship includes: a mapping relationship between a named entity and a candidate node answer parameter;
[0075] 1032. Determine a node answer parameter corresponding to the target intent from multiple candidate node answer parameters.
[0076] Specifically, in this embodiment, a mapping relationship between a named entity and a candidate node answer parameter needs to be pre-constructed so that the corresponding node answer parameter can be matched to the corresponding named entity based on the mapping relationship.
[0077] In some embodiments, the step of “determining a node answer parameter that matches the target intent from multiple candidate node answer parameters” may include the following process:
[0078] (31) Extracting intent words from target intent;
[0079] (32) matching the intended word with a plurality of sample words in the sample word set to determine a target sample word with the highest matching degree with the intended word from the sample word set;
[0080] (33) Based on a preset second mapping relationship, determine the candidate node answer parameter corresponding to the target sample word from multiple candidate node answer parameters as the node answer parameter corresponding to the target intention, and the preset second mapping relationship includes: a mapping relationship between the sample word and the candidate node answer parameter.
[0081] The sample word set is a pre-constructed word set, which includes a plurality of sample words.
[0082] In order to facilitate unified management, in this embodiment, the corresponding synonyms and near-synonyms are identified in the sample word set according to the semantics of the intended word, and the sample word with the highest relevance (i.e., matching degree) is matched to the intended word based on the original semantics. For example, if the intended word is "speed" or "rate", the sample word "speed" in the sample word set can be matched as the target sample word of the intended word.
[0083] In addition, in this embodiment, a mapping relationship between sample words and candidate node answer parameters needs to be pre-constructed so that corresponding node answer parameters can be matched to corresponding sample words based on the mapping relationship.
[0084] 104. Generate answers to natural language questions based on named entities, node answer parameters, and node answer frameworks.
[0085] In this embodiment, when generating the answer to a natural language question based on the named entity, the node answer parameter and the node answer framework, the named entity and the node answer parameter can be filled into the corresponding position in the node answer framework to generate the answer to the natural language question.
[0086] In some embodiments, when filling the node answer parameter into the corresponding position in the node answer frame, multiple methods may be included. For example, in this embodiment, when filling the node answer parameter, the following process may be included:
[0087] (41) Determine the node information corresponding to the node answer parameter;
[0088] (42) determining relevant fields related to the node information in the node answer frame;
[0089] (43) determining, according to the position of the relevant field in the node answer frame, a target position of the node answer parameter corresponding to the node answer frame;
[0090] (44) Fill the node answer parameter into the target position.
[0091] The node information may include entity nodes, intent nodes and other information.
[0092] In this embodiment, the corresponding entity node information and intention node information can be found through the determined node answer parameters and the pre-built correspondence between the intention node, entity node and node answer. Then, the relevant information related to the entity node information and the intention node information is identified from the node answer framework, and the location where the node answer parameter should be placed is determined based on the field where the relevant information is located. In practical applications, the node answer parameter is usually placed before or after the intention node information.
[0093] For example, the node answer frame is "Its speed is #price#", and the matched node answer parameter is "30km / h". After filling the node answer frame based on the node answer parameter, the obtained node answer is "Its speed is 30km / h".
[0094] In the present application scheme, the FAQ (Frequently Asked Questions, question answering) editing is performed by constructing the most entity nodes and multi-intention nodes for arbitrary combination and configuring the minimum granularity node answer, so that the efficiency and intelligence of the method of editing knowledge of the intention entity of the human-computer dialogue on the FAQ editing method are greatly improved. Through the continuous creation and maintenance of the minimum granularity node answer, it can be continuously cited and reorganized in the editing process of the entire scene dialogue, so that the editing efficiency of the FAQ pair is greatly improved. In the specific application process, by extracting the intent and named entity from the natural language question, and matching the corresponding node answer parameters from the configured node answer based on this, combined with the matched node answer framework and other related information, the complete answer of the corresponding entity is automatically generated according to the set answer logic, which improves the answer generation efficiency; in addition, by dividing the natural language question into a combination of multiple entities and multiple intentions to select the required node answer, the probability of node answer reuse is increased to a certain extent, thereby improving the utilization rate of data resources.
[0095] The following describes the solution by applying the method for generating answers to natural language questions to a racing game on a terminal as an example. Specifically, the solution is described in detail by taking the entity node as a racing car and the intent node as a racing car-related attribute as an example.
[0096] In this embodiment, a node answer list of minimum granularity needs to be created in advance, refer to the following Table 2:
[0097] Table 2
[0098]
[0099] Among them, "WW", "WSS" and "SRR" in the best spraying skills refer to the shortcut keys for triggering the racing spraying skills, which can also be customized by the user. For example, "WW" can mean "double spraying" and "WSS" can mean "single spraying + nitrogen spraying + single spraying".
[0100] refer to Figure 3 , Figure 3 A flowchart for constructing answers to natural language questions provided in the embodiments of the present application. First, entity nodes need to be constructed. Entities are nouns, and they have some aliases, such as the "racing car" entity, which contains A-class cars, B-class cars, and C-class cars. At the same time, each car has its alias, such as "A-class car" can also be called "A-class car, top car" and so on.
[0101] After the entity node is built, the intent node needs to be built. When building the intent, the previously built entity node will be used. At the same time, the answer corresponding to the intent node will also use the built entity and the previously created and maintained minimum granularity node answer.
[0102] Specifically, after configuring the intent "Introduction to #racing car#", configure the answer, select which node answers are needed for the answer to the intent, and combine them with the copy. By introducing entities and minimum granularity answers, you can combine the desired answers, such as "The price of #racing car# is #price#, the maximum speed is #maximum speed#, and the startup time is only "startup time". Isn't it great! Go drive it!". Taking the A-class car as an example, the answer to "Introduction to A-class car" is "The price of the A-class car is 5000¥, the maximum speed is 300km / h, and the startup time is only 0.5S. Isn't it great! Go drive it!"
[0103] This application solution mainly needs to solve the corresponding relationship between entities in the two contents of intent and answer, and can combine the answers into new complete answers through entities, node answers and natural language, and correspond to the answers of each entity. After configuring the above answers, the answers corresponding to different entities can be called and combined in the node answers in the above table, and the above node answers are not used only this time. The more detailed the node granularity, the greater the probability of being used for free combination and reuse in the future, so that resources can be used reasonably.
[0104] In specific applications, the existing natural language processing technology is used to accurately parse the natural language questions input by the user. During the parsing process, the natural language questions can be matched with the FAQ generated by the intent and entity, and the original combination template can also be directly used to extract the intent and entity. After the corresponding intent and entity are extracted from the natural language question, they can be mapped to the corresponding answer through the one-to-one mapping table of intent and entity. The answer can be generated by combining key fields and directly conveyed to the user. The whole process is smoother and more efficient than the existing natural language understanding and answer generation mode, and realizes the configuration scheme of automatic generation of multiple entities corresponding to multiple answers when the intent entity configuration knowledge is used.
[0105] In order to facilitate better implementation of the method for generating answers to natural language questions provided in the embodiment of the present application, the embodiment of the present application also provides a device based on the method for generating answers to natural language questions. The meanings of the nouns are the same as those in the method for generating answers to natural language questions, and the specific implementation details can refer to the description in the method embodiment.
[0106] See also Figure 4 , Figure 4 A schematic diagram of a structure of a device for generating an answer to a natural language question provided in an embodiment of the present application. The device 400 for generating an answer to a natural language question may be integrated in a terminal. The device 400 for generating an answer to a natural language question may include a parsing unit 401, a first acquisition unit 402, a second acquisition unit 403, and a generation unit 404, which may be specifically as follows:
[0107] A parsing unit 401 is used to parse the natural language question to obtain the target intent and the named entity;
[0108] A first acquisition unit 402 is used to acquire a corresponding node answer framework according to the target intent;
[0109] A second acquisition unit 403 is used to acquire corresponding node answer parameters according to the target intent and the named entity;
[0110] The generating unit 404 is used to generate an answer to the natural language question based on the named entity, the node answer parameter and the node answer framework.
[0111] In some embodiments, the first acquisition unit 402 may be used to:
[0112] Extract intent words from target intent;
[0113] Get the description information corresponding to the intent word;
[0114] Determine a natural language template corresponding to the target intent from a specified natural language template library;
[0115] A node answer framework is generated according to the description information and the natural language template.
[0116] In some embodiments, when acquiring description information corresponding to an intention word, the first acquisition unit 402 may be specifically used to:
[0117] Matching the intended word with a plurality of sample words in a sample word set;
[0118] Determine, from the sample word set, a target sample word having the highest matching degree with the intended word;
[0119] The description information of the target sample word is obtained as the description information corresponding to the intended word.
[0120] In some embodiments, the second obtaining unit 403 may be used to:
[0121] Determine a plurality of candidate node answer parameters corresponding to the named entity based on a preset first mapping relationship, wherein the first mapping relationship includes: a mapping relationship between the named entity and the candidate node answer parameter;
[0122] A node answer parameter corresponding to the target intent is determined from the multiple candidate node answer parameters.
[0123] In some embodiments, when determining a node answer parameter matching the target intent from a plurality of candidate node answer parameters, the second acquisition unit 403 may be specifically used to:
[0124] extracting intent words from the target intent;
[0125] Matching the intended word with a plurality of sample words in a sample word set to determine a target sample word having the highest matching degree with the intended word from the sample word set;
[0126] Based on a preset second mapping relationship, the candidate node answer parameter corresponding to the target sample word is determined from the multiple candidate node answer parameters as the node answer parameter corresponding to the target intent, and the preset second mapping relationship includes: a mapping relationship between sample words and candidate node answer parameters.
[0127] In some embodiments, the generating unit 404 may be configured to:
[0128] The named entity and the node answer parameter are filled into corresponding positions in the node answer frame to generate an answer to the natural language question.
[0129] In some embodiments, the generating unit 404 may further be configured to:
[0130] Determine the node information corresponding to the node answer parameter;
[0131] determining relevant fields related to the node information in the node answer frame;
[0132] Determine, according to the position of the relevant field in the node answer frame, a target position of the node answer parameter corresponding to the node answer frame;
[0133] Fill the node answer parameter into the target location.
[0134] In some embodiments, the parsing unit 401 may be used to:
[0135] Performing entity recognition on the natural language question to obtain named entities;
[0136] The intent of the natural language question is identified to obtain the target intent.
[0137] In some embodiments, when performing intent recognition on the natural language question to obtain the target intent, the parsing unit 401 may be specifically used to:
[0138] Performing word segmentation processing on the natural language question to obtain multiple candidate words;
[0139] Search multiple candidate words based on a preset knowledge base to obtain search results;
[0140] updating the multiple candidate words according to the search results;
[0141] Generate target intent based on the updated candidate words.
[0142] The answer generation device for natural language questions provided in the embodiment of the present application parses the natural language questions to obtain the target intent and named entity; obtains the corresponding node answer framework according to the target intent; obtains the corresponding node answer parameters according to the target intent and the named entity; and generates the answer to the natural language question based on the named entity, the node answer parameter and the node answer framework. The solution extracts the intent and named entity from the natural language question, and based on this, matches the corresponding node answer parameter from the configured node answer, combines the matched node answer framework and other related information, and automatically generates the complete answer of the corresponding entity according to the set answer logic, thereby improving the efficiency of answer generation; in addition, by dividing the natural language question into a combination of multiple entities and multiple intents to select the required node answer, the probability of node answers being reused is increased to a certain extent, thereby improving the utilization rate of data resources.
[0143] The present application also provides a terminal. Figure 5As shown, the terminal may include a radio frequency (RF) circuit 601, a memory 602 including one or more computer-readable storage media, an input unit 603, a display unit 604, a sensor 605, an audio circuit 606, a wireless fidelity (WiFi) module 607, a processor 608 including one or more processing cores, and a power supply 609. Those skilled in the art will appreciate that Figure 5 The terminal structure shown in the figure does not constitute a limitation on the terminal, and may include more or fewer components than shown in the figure, or combine certain components, or arrange the components differently.
[0144] The RF circuit 601 can be used for receiving and sending signals during the process of sending and receiving information. In particular, after receiving the downlink information of the base station, it is handed over to one or more processors 608 for processing; in addition, the uplink data is sent to the base station. Generally, the RF circuit 601 includes but is not limited to an antenna, at least one amplifier, a tuner, one or more oscillators, a subscriber identity module (SIM) card, a transceiver, a coupler, a low noise amplifier (LNA), a duplexer, etc. In addition, the RF circuit 601 can also communicate with the network and other devices through wireless communication.
[0145] The memory 602 can be used to store software programs and modules, and the processor 608 executes various functional applications and data processing by running the software programs and modules stored in the memory 602. The memory 602 may mainly include a program storage area and a data storage area, wherein the program storage area may store an operating system, an application required for at least one function (such as a sound playback function, an image playback function, etc.), etc. In addition, the memory 602 may include a high-speed random access memory, and may also include a non-volatile memory, such as at least one disk storage device, a flash memory device, or other volatile solid-state storage devices. Accordingly, the memory 602 may also include a memory controller to provide the processor 608 and the input unit 603 with access to the memory 602.
[0146] The input unit 603 can be used to receive input digital or character information, and to generate keyboard, mouse, joystick, optical or trackball signal input related to user settings and function control. Specifically, in a specific embodiment, the input unit 603 may include a touch-sensitive surface and other input devices. The touch-sensitive surface, also known as a touch display screen or a touchpad, can collect user touch operations on or near it (such as operations performed by the user using any suitable object or accessory such as a finger, stylus, etc. on or near the touch-sensitive surface), and drive the corresponding connection device according to a pre-set program. In addition to the touch-sensitive surface, the input unit 603 may also include other input devices. Specifically, other input devices may include, but are not limited to, one or more of a physical keyboard, function keys (such as volume control keys, switch keys, etc.), a trackball, a mouse, a joystick, etc.
[0147] The display unit 604 can be used to display information input by the user or information provided to the user and various graphical user interfaces of the terminal, which can be composed of graphics, text, icons, videos and any combination thereof. The display unit 604 may include a display panel. Optionally, the display panel may be configured in the form of a liquid crystal display (LCD), an organic light-emitting diode (OLED), etc. Further, the touch-sensitive surface may cover the display panel. When the touch-sensitive surface detects a touch operation on or near it, it is transmitted to the processor 608 to determine the type of touch event. The processor 608 then provides a corresponding visual output on the display panel according to the type of touch event. Although in Figure 5 In the embodiment, the touch-sensitive surface and the display panel are used as two independent components to realize input and output functions, but in some embodiments, the touch-sensitive surface and the display panel can be integrated to realize input and output functions.
[0148] The terminal may also include at least one sensor 605, such as a light sensor, a motion sensor, and other sensors. Specifically, the light sensor may include an ambient light sensor and a proximity sensor, wherein the ambient light sensor may adjust the brightness of the display panel according to the brightness of the ambient light, and the proximity sensor may turn off the display panel and / or backlight when the terminal is moved to the ear.
[0149] The audio circuit 606, the speaker, and the microphone can provide an audio interface between the user and the terminal. The audio circuit 606 can transmit the electrical signal converted from the received audio data to the speaker, which is converted into a sound signal for output; on the other hand, the microphone converts the collected sound signal into an electrical signal, which is received by the audio circuit 606 and converted into audio data, and then the audio data is processed by the output processor 608 and sent to, for example, the terminal through the RF circuit 601, or the audio data is output to the memory 602 for further processing. The audio circuit 606 may also include an earplug jack to provide communication between an external headset and the terminal.
[0150] WiFi is a short-range wireless transmission technology. The terminal can help users send and receive emails, browse web pages, and access streaming media through the WiFi module 607. It provides users with wireless broadband Internet access. Figure 5 A WiFi module 607 is shown, but it is understandable that it is not an essential component of the terminal and can be omitted as required without changing the essence of the invention.
[0151] The processor 608 is the control center of the terminal, and uses various interfaces and lines to connect various parts of the entire mobile phone. By running or executing software programs and / or modules stored in the memory 602, and calling data stored in the memory 602, it executes various functions of the terminal and processes data, thereby controlling the mobile phone as a whole. Optionally, the processor 608 may include one or more processing cores; preferably, the processor 608 may integrate an application processor and a modem processor, wherein the application processor mainly processes the operating system, user interface, and application programs, and the modem processor mainly processes wireless communications. It is understandable that the above-mentioned modem processor may not be integrated into the processor 608.
[0152] The terminal also includes a power supply 609 (such as a battery) for supplying power to each component. Preferably, the power supply can be logically connected to the processor 608 through a power management system, so that the power management system can manage charging, discharging, and power consumption management. The power supply 609 can also include any components such as one or more DC or AC power supplies, recharging systems, power failure detection circuits, power converters or inverters, and power status indicators.
[0153] Specifically in this embodiment, the processor 608 in the terminal will load the executable files corresponding to the processes of one or more applications into the memory 602 according to the following instructions, and the processor 608 will run the applications stored in the memory 602 to implement various functions:
[0154] Obtaining natural language information to be recognized;
[0155] Trimming the natural language information to be identified according to relevant information, wherein the relevant information is context information and / or context information of the natural language information to be identified;
[0156] Performing intent recognition on the trimmed natural language information to obtain an intent recognition result;
[0157] Based on the intention recognition result, corresponding response information is obtained from a specified response information library, and corresponding operations are performed according to the response information.
[0158] The terminal provided in the embodiment of the present application improves the accuracy of natural language recognition by identifying the intent of natural language information input by the user in combination with the context environment; in addition, by decomposing and distributing tasks through natural language recognition, the user input can be accurately extracted and executed, thereby improving the efficiency of problem solving during operation and maintenance.
[0159] A person of ordinary skill in the art will appreciate that all or part of the steps in the various methods of the above embodiments may be completed by instructions, or by controlling related hardware through instructions. The instructions may be stored in a computer-readable storage medium and loaded and executed by a processor.
[0160] To this end, an embodiment of the present application provides a storage medium in which a plurality of instructions are stored, and the instructions can be loaded by a processor to execute the steps in any method for generating an answer to a natural language question provided in an embodiment of the present application. For example, the instructions can execute the following steps:
[0161] Parse natural language questions to obtain target intent and named entities;
[0162] Obtaining a corresponding node answer framework according to the target intent;
[0163] Acquire corresponding node answer parameters according to the target intent and the named entity;
[0164] An answer to the natural language question is generated based on the named entity, the node answer parameter, and the node answer framework.
[0165] The specific implementation of the above operations can be found in the previous embodiments, which will not be described in detail here.
[0166] From the above, it can be seen that the terminal provided in the embodiment of the present application can extract intentions and named entities from natural language questions, and based on this, match the corresponding node answer parameters from the configured node answers, and combine the matched node answer framework and other related information to automatically generate a complete answer for the corresponding entity according to the set answer logic, thereby improving the answer generation efficiency.
[0167] The storage medium may include: a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk, etc.
[0168] Since the instructions stored in the storage medium can execute the steps in any method for generating an answer to a natural language question provided in the embodiments of the present application, the beneficial effects that can be achieved by any method for generating an answer to a natural language question provided in the embodiments of the present application can be achieved. Please refer to the previous embodiments for details and will not be repeated here.
[0169] The above is a detailed introduction to the method, device and storage medium for generating answers to natural language questions provided in the embodiments of the present application. Specific examples are used in this article to illustrate the principles and implementation methods of the present application. The description of the above embodiments is only used to help understand the method of the present application and its core idea; at the same time, for technical personnel in this field, according to the ideas of the present application, there will be changes in the specific implementation methods and application scope. In summary, the content of this specification should not be understood as a limitation on the present application.
Claims
1. A method for generating answers to natural language questions, characterized in that: include: Parse natural language questions to obtain target intent and named entities; extracting intent words from the target intent; Obtaining description information corresponding to the intent word; Determine a natural language template corresponding to the target intent from a specified natural language template library; generate a node answer framework according to the description information and the natural language template; Acquire corresponding node answer parameters according to the target intent and the named entity; An answer to the natural language question is generated based on the named entity, the node answer parameter, and the node answer framework.
2. The method for generating answers to natural language questions according to claim 1, characterized in that: The obtaining the description information corresponding to the intention word includes: Matching the intended word with a plurality of sample words in a sample word set; Determine, from the sample word set, a target sample word having the highest matching degree with the intended word; The description information of the target sample word is obtained as the description information corresponding to the intended word.
3. The method for generating answers to natural language questions according to claim 1, characterized in that: The acquiring corresponding node answer parameters according to the target intent and the named entity includes: Determine a plurality of candidate node answer parameters corresponding to the named entity based on a preset first mapping relationship, wherein the first mapping relationship includes: a mapping relationship between the named entity and the candidate node answer parameter; A node answer parameter corresponding to the target intent is determined from the multiple candidate node answer parameters.
4. The method for generating answers to natural language questions according to claim 3, characterized in that: The step of determining a node answer parameter that matches the target intent from the plurality of candidate node answer parameters comprises: extracting intent words from the target intent; Matching the intended word with a plurality of sample words in a sample word set to determine a target sample word having the highest matching degree with the intended word from the sample word set; Based on a preset second mapping relationship, the candidate node answer parameter corresponding to the target sample word is determined from the multiple candidate node answer parameters as the node answer parameter corresponding to the target intent, and the preset second mapping relationship includes: a mapping relationship between sample words and candidate node answer parameters.
5. The method for generating answers to natural language questions according to any one of claims 1 to 4, characterized in that: The step of generating an answer to the natural language question based on the named entity, the node answer parameter and the node answer framework comprises: The named entity and the node answer parameter are filled into corresponding positions in the node answer frame to generate an answer to the natural language question.
6. The method for generating answers to natural language questions according to claim 5, characterized in that: The step of filling the node answer parameter into a corresponding position in the node answer frame includes: Determine the node information corresponding to the node answer parameter; determining relevant fields related to the node information in the node answer frame; Determine, according to the position of the relevant field in the node answer frame, a target position of the node answer parameter corresponding to the node answer frame; Fill the node answer parameter into the target location.
7. The method for generating answers to natural language questions according to claim 1, characterized in that: The natural language question is parsed to obtain the target intent and named entities, including: Performing entity recognition on the natural language question to obtain named entities; The intent of the natural language question is identified to obtain the target intent.
8. A device for generating answers to natural language questions, characterized in that: include: Parsing unit, used to parse natural language questions to obtain target intent and named entities; A first acquisition unit, used to extract an intention word from the target intention; Obtaining description information corresponding to the intent word; Determine a natural language template corresponding to the target intent from a specified natural language template library; Generate a node answer framework according to the description information and the natural language template; A second acquisition unit, configured to acquire corresponding node answer parameters according to the target intent and the named entity; A generating unit is used to generate an answer to the natural language question based on the named entity, the node answer parameter and the node answer framework.
9. A storage medium, characterized in that: The storage medium stores a plurality of instructions, which are suitable for loading by a processor to execute the steps in the method for generating answers to natural language questions as described in any one of claims 1-7.
10. A terminal comprising a memory, a processor and a computer program stored in the memory and executable on the processor, wherein the processor implements the steps in the method for generating answers to natural language questions as described in any one of claims 1 to 7 when executing the program.
