Push method, device, equipment and storage medium of dialogue module
By calculating the similarity between the question sentence entered by the user and the corpus template sentence, filtering and sorting the target template sentence set, and pushing the corresponding dialogue module, it solves the problem of inconsistent display of traditional text robots and achieves higher display flexibility and interface. Utilization.
Patent Information
- Application Number
- CN202110465679.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-04-28
- Publication Date
- 2024-10-18
- Estimated Expiration
- 2041-04-28
AI Technical Summary
Traditional text robot dialog boxes cannot flexibly display multiple types of dialogue modules according to user needs, resulting in inconsistent display, low interface utilization, and inability to guide users to related scenarios.
By obtaining the question sentence input by the user, distribute it to the corpus corresponding to each dialogue module of the intelligent robot, calculate the similarity between the question sentence and the template sentence, filter and sort the target template sentence set, and calculate the score according to the preset rules, and push Corresponding dialogue module to user terminal.
It enables the display of different dialogue modules to be flexibly pushed according to user needs, improves the richness and flexibility of robot display, unifies the style of dialogue modules, and improves interface utilization.
Smart Images

Figure CN113127621B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of data push, and in particular to a push method, device, equipment and storage medium of a dialogue module. Background Art
[0002] At present, the display format of traditional text robot dialog boxes is relatively simple, and generally can only display one type of dialogue module, such as a question-and-answer module or a task-based dialogue module. For different types of replies, such as text, tables, pictures, hyperlinks, etc., different interfaces are often used to obtain data from the background, and different front-end styles are required for data display, resulting in inconsistent display of robot dialog boxes and low interface utilization.
[0003] When there are multiple data sources or multiple types of dialogue modules, traditional robots can only display one of them and cannot flexibly display multiple types of dialogue modules according to user needs, resulting in the inability to guide users to a scene associated with a certain dialogue module. Summary of the invention
[0004] In view of the above, the present invention provides a method, device, equipment and storage medium for pushing a dialogue module, which aims to solve the technical problem in the prior art that multiple types of dialogue modules cannot be flexibly displayed according to user needs.
[0005] To achieve the above object, the present invention provides a method for pushing a dialogue module, the method comprising:
[0006] Obtaining a question sentence input by a user, and distributing the question sentence to a corpus corresponding to each dialogue module included in the intelligent robot;
[0007] Calculating the similarity between the question sentence and each template sentence in each corpus to obtain a similarity value between the question sentence and each template sentence;
[0008] Determine whether there is a first template sentence in each corpus whose similarity value with the question sentence is greater than or equal to a first threshold; if so, select the first template sentence, sort the first template sentence from large to small according to the similarity value, and select a preset number of the first template sentences as the target template sentence set of the corpus;
[0009] The scores of each target template sentence set are calculated according to preset calculation rules, and the dialogue modules corresponding to each corpus are sorted according to the scores of each target template sentence set. The dialogue modules after the sorting operation are pushed to the terminal corresponding to the user for display.
[0010] Preferably, the calculating the similarity between the question sentence and each template sentence in each corpus includes:
[0011] The question sentence is segmented using a preset segmentation rule, each segmented word is converted into a word vector, and based on the word vector of the question sentence and the word vector of each template sentence, a similarity value between the question sentence and each template sentence is calculated.
[0012] Preferably, the calculating the similarity value between the question statement and each template statement includes:
[0013] The similarity value between the question sentence and each template sentence is calculated using the following formula:
[0014]
[0015] Among them, A represents the word vector set of the question sentence, B represents the word vector set of the template sentence, and J(A,B) represents the similarity value between the question sentence and the template sentence.
[0016] Preferably, performing a word segmentation operation on the question sentence using a preset word segmentation rule includes:
[0017] Matching the read segmented words with a preset word library according to a forward maximum matching method to obtain a first matching result, wherein the first matching result includes a first number of first phrases and a second number of single words;
[0018] Matching the read segmented words with a preset word library according to a reverse maximum matching method to obtain a second matching result, wherein the second matching result includes a third number of second phrases and a fourth number of single words;
[0019] If the first number is equal to the third number and the second number is less than or equal to the fourth number, or if the first number is less than the third number, the first matching result is used as the word segmentation result of the question statement; if the first number is equal to the second number and the third number is greater than the fourth number, or if the first number is greater than the third number, the second matching result is used as the word segmentation result of the question statement.
[0020] Preferably, after selecting a preset number of template sentences as the target template sentence set of the corpus, the method further comprises:
[0021] Determine whether there is a second template sentence in each corpus whose similarity value with the question sentence is greater than the second threshold and less than the first threshold; if so, feed back a prompt sentence corresponding to the second template sentence to the user so that the user can select the prompt sentence corresponding to the second template sentence, and add the second template sentence corresponding to the prompt sentence selected by the user in the terminal interface to the target template sentence set.
[0022] Preferably, the method further comprises:
[0023] When it is determined that there is no template sentence in each corpus whose similarity value with the question sentence is greater than the second threshold, the pre-configured default dialogue module is pushed to the terminal corresponding to the user for display.
[0024] Preferably, the preset calculation rules include:
[0025] S=W*Y
[0026] Among them, S represents the score of the target template sentence, W represents the preset weight value of the corpus corresponding to the target template sentence, and Y represents the similarity value between the target template sentence and the question sentence.
[0027] To achieve the above object, the present invention further provides a push device for a dialogue module, the push device for the dialogue module comprising:
[0028] Distribution module: used to obtain the question sentence input by the user, and distribute the question sentence to the corpus corresponding to each dialogue module included in the intelligent robot;
[0029] Calculation module: used to calculate the similarity between the question sentence and each template sentence in each corpus, and obtain the similarity value between the question sentence and each template sentence;
[0030] A selection module is used to determine whether there is a first template sentence in each corpus whose similarity value with the question sentence is greater than or equal to a first threshold value. If so, the first template sentence is selected, and the first template sentences are sorted from large to small according to the similarity value, and a preset number of the first template sentences are selected as the target template sentence set of the corpus;
[0031] Push module: used to calculate the scores of each target template sentence set according to preset calculation rules, perform sorting operations on the dialogue modules corresponding to each corpus according to the size of the scores of each target template sentence set, and push the dialogue modules after the sorting operation to the terminal corresponding to the user for display.
[0032] To achieve the above object, the present invention further provides an electronic device, the electronic device comprising:
[0033] at least one processor; and,
[0034] a memory communicatively connected to the at least one processor; wherein,
[0035] The memory stores a program executable by the at least one processor, and the program is executed by the at least one processor so that the at least one processor can execute any step of the push method of the dialogue module as described above.
[0036] To achieve the above objectives, the present invention also provides a computer-readable storage medium, which stores a push program for a dialogue module. When the push program for the dialogue module is executed by a processor, any step of the push method for the dialogue module as described above is implemented.
[0037] The method, device, equipment and storage medium for pushing dialogue modules proposed in the present invention can flexibly push and display different dialogue modules according to the needs of business users, thereby improving the richness and flexibility of robot display, configuring display rules between different dialogue modules, unifying the styles of robot dialogue modules, and improving interface utilization. BRIEF DESCRIPTION OF THE DRAWINGS
[0038] Figure 1 It is a flowchart diagram of a preferred embodiment of the method for pushing a conversation module of the present invention;
[0039] Figure 2 A schematic diagram of a module of a preferred embodiment of a push device for a dialogue module of the present invention;
[0040] Figure 3 A schematic diagram of a preferred embodiment of the electronic device of the present invention;
[0041] The realization of the purpose, functional features and advantages of the present invention will be further explained in conjunction with embodiments and with reference to the accompanying drawings. DETAILED DESCRIPTION
[0042] In order to make the purpose, technical scheme and advantages of the present invention more clearly understood, the present invention is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present invention and are not intended to limit the present invention. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of the present invention.
[0043] The present invention provides a method for pushing a dialogue module. Figure 1 FIG. 1 is a flow chart of a method of pushing a conversation module according to an embodiment of the present invention. The method may be executed by an electronic device, and the electronic device may be implemented by software and / or hardware. The conversation module pushing method includes:
[0044] Step S10: Obtain the question sentence input by the user, and distribute the question sentence to the corpus corresponding to each dialogue module included in the intelligent robot.
[0045] The application scenario of this solution can be that when a user interacts with an intelligent text robot, the intelligent text robot pushes a dialogue module related to the user's question to the user based on the question input by the user. It should be noted that the actual application scenario of the push of the dialogue module of this solution is not limited to this. As a major component of intelligent customer service, text robots are widely used in government service websites, e-commerce platforms, life service platforms, etc. Unlike traditional application software, text robots provide services such as consulting and handling affairs by having conversations with users. In robot products, dialogue modules (dialog boxes) gradually replace traditional graphical user interfaces and become the main human-computer interaction method.
[0046] In this embodiment, when a user inputs a question sentence into the interactive interface of the text robot, the dialogue module push program installed in the text robot distributes the user's question sentence to the corpus corresponding to each dialogue module. The dialogue module may include a question-answering module or a task-based dialogue module.
[0047] In one embodiment, the dialogue module includes a first component, a second component and a third component, the first component is used to display pre-configured guiding words, the second component is used to display relevant content found in the database based on the input question statement, and the third component is used to display at least one type of scene button.
[0048] The first component is used to display the default guiding speech of the text robot, including but not limited to word slot clarification speech, default reply speech, intent recognition failure speech, single intent confirmation speech, multiple intent clarification speech, word slot recognition failure speech, single word slot confirmation speech, multiple word slot selection speech, fallback speech, no answer default speech, etc. Data types include but are not limited to numbers, strings, lists, etc.
[0049] The second component is used to display relevant content found by the robot in the database based on user input, including but not limited to dictionary value lists, answer lists, multi-intent lists, question lists, multi-slot lists, entity content, matter content, answer content, etc. The display forms include text, lists, hyperlinks, pictures, tags, service interfaces, etc.
[0050] The third component is used to display at least one type of scenario button. Some conversations involve scenarios where users need to click buttons, including jump buttons, confirmation buttons, cancel buttons, service buttons, etc.
[0051] Step S20: Calculate the similarity between the question sentence and each template sentence in each corpus to obtain the similarity value between the question sentence and each template sentence.
[0052] In this embodiment, the similarity between the question statement input by the user and each template statement in each corpus is calculated, and the similarity value between the question statement and each template statement in the corpus can be obtained. Each dialogue module has a corresponding corpus, and different corpora store different template statements, for example, pre-configured similar questions, dialogue templates, dialogue sample sets, etc.
[0053] In one embodiment, calculating the similarity between the question sentence and each template sentence in each corpus includes:
[0054] The question sentence is segmented using a preset segmentation rule, each segmented word is converted into a word vector, and based on the word vector of the question sentence and the word vector of each template sentence, a similarity value between the question sentence and each template sentence is calculated.
[0055] Furthermore, the calculating of the similarity value between the question statement and each template statement includes:
[0056] The similarity value between the question sentence and each template sentence is calculated using the following formula:
[0057]
[0058] Among them, A represents the word vector set of the question sentence, B represents the word vector set of the template sentence, and J(A,B) represents the similarity value between the question sentence and the template sentence.
[0059] The word segmentation rule can be the maximum forward matching method or the reverse maximum matching method. The word vector model word2vec is used to convert each word segmentation into a word vector. According to the word vector of the question sentence and the word vector of the template sentence, the similarity value between the question sentence and each template sentence is calculated using the Jaccard coefficient algorithm. The similarity value can also be calculated using the edit distance, longest substring, WMD, Euclidean distance, dot product algorithm, etc. Among them, word2vec is a tool for converting words into vectors, which can simplify the processing of texts into vector operations in vector space to represent the semantic similarity of texts. For example, word2vec can simplify the processing of texts into vector operations in K-dimensional vector space through training, and the similarity in vector space can be used to represent the semantic similarity of texts.
[0060] Furthermore, performing a word segmentation operation on the question sentence using a preset word segmentation rule includes:
[0061] Matching the read segmented words with a preset word library according to a forward maximum matching method to obtain a first matching result, wherein the first matching result includes a first number of first phrases and a second number of single words;
[0062] Matching the read segmented words with a preset word library according to a reverse maximum matching method to obtain a second matching result, wherein the second matching result includes a third number of second phrases and a fourth number of single words;
[0063] If the first number is equal to the third number and the second number is less than or equal to the fourth number, or if the first number is less than the third number, the first matching result is used as the word segmentation result of the question statement; if the first number is equal to the second number and the third number is greater than the fourth number, or if the first number is greater than the third number, the second matching result is used as the word segmentation result of the question statement.
[0064] This word segmentation method is used to analyze the stickiness of the combined content before and after the segmented text content. Because under normal circumstances, the probability that a phrase can represent the core idea information is higher, that is, the core idea information can be better expressed through a phrase, therefore, by performing word segmentation matching in both the forward and reverse directions at the same time, a word segmentation matching result with fewer single words and more phrases is found as the word segmentation result of the segmented sentence, which can improve the accuracy of word segmentation.
[0065] Step S30: Determine whether there is a first template sentence in each corpus whose similarity value with the question sentence is greater than or equal to a first threshold; if so, filter out the first template sentence, and sort the first template sentences from large to small according to the similarity value, and select a preset number of the first template sentences as the target template sentence set of the corpus.
[0066] In this embodiment, after calculating the similarity values between the question sentence and each template sentence in each corpus, it is determined whether there is a template sentence in each corpus whose similarity value with the question sentence is greater than or equal to a first threshold (for example, 90%). When there is a template sentence whose similarity value with the question sentence is greater than or equal to the first threshold, the template sentences in each corpus whose similarity value is greater than the first threshold are screened out and sorted from large to small, and a preset number (for example, the top 3) of template sentences are selected as the target template sentence set of the corpus.
[0067] In one embodiment, after selecting a preset number of template sentences as the target template sentence set of the corpus, the method further includes:
[0068] Determine whether there is a second template sentence in each corpus whose similarity value with the question sentence is greater than the second threshold and less than the first threshold; if so, feed back a prompt sentence corresponding to the second template sentence to the user so that the user can select the prompt sentence corresponding to the second template sentence, and add the second template sentence corresponding to the prompt sentence selected by the user in the terminal interface to the target template sentence set.
[0069] For example, when there are three template statements that are greater than the second threshold (e.g., 85%) and less than the first threshold, the prompt statements corresponding to the three template statements are fed back to the user, and the prompt statement may be a summary of the semantics of the template statement, such as "Do you want to know the current status of...", "Do you want to know the properties of...", etc. The user is allowed to select the prompt statement corresponding to the template statement, and the template statement corresponding to the prompt statement selected by the user is added to the target template statement set.
[0070] Furthermore, when it is determined that there is no template sentence in each corpus whose similarity value with the question sentence is greater than a second threshold, the pre-configured default dialogue module is pushed to the terminal corresponding to the user for display.
[0071] When the similarity values between the template sentences in each corpus and the question sentence do not exceed the second threshold, it means that the question sentence input by the user has a low matching degree with the template sentences in each corpus. At this time, if the dialogue module is returned, it may not be the dialogue template required by the user. Therefore, the default dialogue module can be pushed to the terminal corresponding to the user for recommendation and display, so as to prompt the user to re-enter the question sentence.
[0072] Step S40: Calculate the scores of each target template sentence set according to preset calculation rules, perform sorting operations on the dialogue modules corresponding to each corpus according to the scores of each target template sentence set, and push the dialogue modules after the sorting operation to the terminal corresponding to the user for display.
[0073] In this embodiment, after selecting the target template sentences in each corpus, the score of each target template sentence set can be calculated according to the preset corpus weight, and the score of each sentence in the target template sentence set can be added up to obtain the score of the target template sentence set. Then, according to the score of each target template sentence set, the dialogue modules corresponding to each corpus are sorted from large to small. For example, the score of target template sentence set A>the score of target template sentence set B>the score of target template sentence set C, then the sorting order of the dialogue modules is A dialogue template, B dialogue module, C dialogue module, and the sorted dialogue modules are pushed to the terminal corresponding to the user for display, so that the user can more intuitively select the dialogue module with a high matching degree.
[0074] Multiple dialogue modules can be displayed at the same time, and the display format of different modules can be flexibly configured according to business needs, which improves the richness and flexibility of the text robot display, unifies the dialogue module styles, and improves interface utilization.
[0075] In one embodiment, the preset calculation rules include:
[0076] S=W*Y
[0077] Among them, S represents the score of the target template sentence, W represents the preset weight value of the corpus corresponding to the target template sentence, and Y represents the similarity value between the target template sentence and the question sentence.
[0078] Reference Figure 2 FIG. 1 is a schematic diagram of functional modules of a push device 100 of a dialogue module according to the present invention.
[0079] The push device 100 of the dialogue module of the present invention can be installed in an electronic device. According to the functions to be implemented, the push device 100 of the dialogue module can include a distribution module 110, a calculation module 120, a selection module 130 and a push module 140. The module described in the present invention can also be called a unit, which refers to a series of computer program segments that can be executed by a processor of an electronic device and can complete fixed functions, which are stored in the memory of the electronic device.
[0080] In this embodiment, the functions of each module / unit are as follows:
[0081] The distribution module 110 is used to obtain the question sentence input by the user and distribute the question sentence to the corpus corresponding to each dialogue module included in the intelligent robot.
[0082] In this embodiment, when a user inputs a question sentence into the interactive interface of the text robot, the distribution module of the push device of the dialogue module in the text robot distributes the user's question sentence to the corpus corresponding to each dialogue module. The dialogue module may include a question-answering module or a task-based dialogue module.
[0083] In one embodiment, the dialogue module includes a first component, a second component and a third component, the first component is used to display pre-configured guiding words, the second component is used to display relevant content found in the database based on the input question statement, and the third component is used to display at least one type of scene button.
[0084] The first component is used to display the default guiding speech of the text robot, including but not limited to word slot clarification speech, default reply speech, intent recognition failure speech, single intent confirmation speech, multiple intent clarification speech, word slot recognition failure speech, single word slot confirmation speech, multiple word slot selection speech, fallback speech, no answer default speech, etc. Data types include but are not limited to numbers, strings, lists, etc.
[0085] The second component is used to display relevant content found by the robot in the database based on user input, including but not limited to dictionary value lists, answer lists, multi-intent lists, question lists, multi-slot lists, entity content, matter content, answer content, etc. The display forms include text, lists, hyperlinks, pictures, tags, service interfaces, etc.
[0086] The calculation module 120 is used to calculate the similarity between the question sentence and each template sentence in each corpus, and obtain the similarity value between the question sentence and each template sentence.
[0087] In this embodiment, the similarity between the question statement input by the user and each template statement in each corpus is calculated, and the similarity value between the question statement and each template statement in the corpus can be obtained. Each dialogue module has a corresponding corpus, and different corpora store different template statements, for example, pre-configured similar questions, dialogue templates, dialogue sample sets, etc.
[0088] In one embodiment, calculating the similarity between the question sentence and each template sentence in each corpus includes:
[0089] The question sentence is segmented using a preset segmentation rule, each segmented word is converted into a word vector, and based on the word vector of the question sentence and the word vector of each template sentence, a similarity value between the question sentence and each template sentence is calculated.
[0090] Furthermore, the calculating of the similarity value between the question statement and each template statement includes:
[0091] The similarity value between the question sentence and each template sentence is calculated using the following formula:
[0092]
[0093] Among them, A represents the word vector set of the question sentence, B represents the word vector set of the template sentence, and J(A,B) represents the similarity value between the question sentence and the template sentence.
[0094] The word segmentation rule can be the maximum forward matching method or the reverse maximum matching method. The word vector model word2vec is used to convert each word segmentation into a word vector. According to the word vector of the question sentence and the word vector of the template sentence, the similarity value between the question sentence and each template sentence is calculated using the Jaccard coefficient algorithm. The similarity value can also be calculated using the edit distance, longest substring, WMD, Euclidean distance, dot product algorithm, etc. Among them, word2vec is a tool for converting words into vectors, which can simplify the processing of texts into vector operations in vector space to represent the semantic similarity of texts. For example, word2vec can simplify the processing of texts into vector operations in K-dimensional vector space through training, and the similarity in vector space can be used to represent the semantic similarity of texts.
[0095] Furthermore, performing a word segmentation operation on the question sentence using a preset word segmentation rule includes:
[0096] Matching the read segmented words with a preset word library according to a forward maximum matching method to obtain a first matching result, wherein the first matching result includes a first number of first phrases and a second number of single words;
[0097] Matching the read segmented words with a preset word library according to a reverse maximum matching method to obtain a second matching result, wherein the second matching result includes a third number of second phrases and a fourth number of single words;
[0098] If the first number is equal to the third number and the second number is less than or equal to the fourth number, or if the first number is less than the third number, the first matching result is used as the word segmentation result of the question statement; if the first number is equal to the second number and the third number is greater than the fourth number, or if the first number is greater than the third number, the second matching result is used as the word segmentation result of the question statement.
[0099] This word segmentation method is used to analyze the stickiness of the combined content before and after the segmented text content. Because under normal circumstances, the probability that a phrase can represent the core idea information is higher, that is, the core idea information can be better expressed through a phrase, therefore, by performing word segmentation matching in both the forward and reverse directions at the same time, a word segmentation matching result with fewer single words and more phrases is found as the word segmentation result of the segmented sentence, which can improve the accuracy of word segmentation.
[0100] The selection module 130 is used to determine whether there is a first template sentence in each corpus whose similarity value with the question sentence is greater than or equal to a first threshold. If so, the first template sentence is screened out, and the first template sentences are sorted from large to small according to the similarity value, and a preset number of the first template sentences are selected as the target template sentence set of the corpus.
[0101] In this embodiment, after calculating the similarity values between the question sentence and each template sentence in each corpus, it is determined whether there is a template sentence in each corpus whose similarity value with the question sentence is greater than or equal to a first threshold (for example, 90%). When there is a template sentence whose similarity value with the question sentence is greater than or equal to the first threshold, the template sentences in each corpus whose similarity value is greater than the first threshold are screened out and sorted from large to small, and a preset number (for example, the top 3) of template sentences are selected as the target template sentence set of the corpus.
[0102] In one embodiment, after selecting a preset number of template sentences as the target template sentence set of the corpus, the selection module is further used to:
[0103] Determine whether there is a second template sentence in each corpus whose similarity value with the question sentence is greater than the second threshold and less than the first threshold; if so, feed back a prompt sentence corresponding to the second template sentence to the user so that the user can select the prompt sentence corresponding to the second template sentence, and add the second template sentence corresponding to the prompt sentence selected by the user in the terminal interface to the target template sentence set.
[0104] For example, when there are three template statements that are greater than the second threshold (e.g., 85%) and less than the first threshold, the prompt statements corresponding to the three template statements are fed back to the user, and the prompt statement may be a summary of the semantics of the template statement, such as "Do you want to know the current status of...", "Do you want to know the properties of...", etc. The user is allowed to select the prompt statement corresponding to the template statement, and the template statement corresponding to the prompt statement selected by the user is added to the target template statement set.
[0105] Furthermore, when it is determined that there is no template sentence in each corpus whose similarity value with the question sentence is greater than a second threshold, the pre-configured default dialogue module is pushed to the terminal corresponding to the user for display.
[0106] When the similarity values between the template sentences in each corpus and the question sentence do not exceed the second threshold, it means that the question sentence input by the user has a low matching degree with the template sentences in each corpus. At this time, if the dialogue module is returned, it may not be the dialogue template required by the user. Therefore, the default dialogue module can be pushed to the terminal corresponding to the user for recommendation and display, so as to prompt the user to re-enter the question sentence.
[0107] The push module 140 is used to calculate the scores of each target template sentence set according to preset calculation rules, perform sorting operations on the dialogue modules corresponding to each corpus according to the size of the scores of each target template sentence set, and push the dialogue modules after the sorting operation to the terminal corresponding to the user for display.
[0108] In this embodiment, after selecting the target template sentences in each corpus, the score of each target template sentence set can be calculated according to the preset corpus weight, and the score of each sentence in the target template sentence set can be added up to obtain the score of the target template sentence set. Then, according to the score of each target template sentence set, the dialogue modules corresponding to each corpus are sorted from large to small. For example, the score of target template sentence set A>the score of target template sentence set B>the score of target template sentence set C, then the sorting order of the dialogue modules is A dialogue template, B dialogue module, C dialogue module, and the sorted dialogue modules are pushed to the terminal corresponding to the user for display, so that the user can more intuitively select the dialogue module with a high matching degree.
[0109] Multiple dialogue modules can be displayed at the same time, and the display format of different modules can be flexibly configured according to business needs, which improves the richness and flexibility of the text robot display, unifies the dialogue module styles, and improves interface utilization.
[0110] In one embodiment, the preset calculation rules include:
[0111] S=W*Y
[0112] Among them, S represents the score of the target template sentence, W represents the preset weight value of the corpus corresponding to the target template sentence, and Y represents the similarity value between the target template sentence and the question sentence.
[0113] Reference Figure 3 FIG. 1 is a schematic diagram of a preferred embodiment of an electronic device 1 of the present invention.
[0114] The electronic device 1 includes but is not limited to: a memory 11, a processor 12, a display 13 and a network interface 14. The electronic device 1 is connected to a network through the network interface 14 to obtain raw data. The network may be a wireless or wired network such as an intranet, the Internet, a global system of mobile communications (GSM), a wideband code division multiple access (WCDMA), a 4G network, a 5G network, Bluetooth, Wi-Fi, a call network, etc.
[0115] Among them, the memory 11 includes at least one type of readable storage medium, and the readable storage medium includes flash memory, hard disk, multimedia card, card-type memory (for example, SD or DX memory, etc.), random access memory (RAM), static random access memory (SRAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), programmable read-only memory (PROM), magnetic memory, disk, optical disk, etc. In some embodiments, the memory 11 can be an internal storage unit of the electronic device 1, such as a hard disk or memory of the electronic device 1. In other embodiments, the memory 11 can also be an external storage device of the electronic device 1, such as a plug-in hard disk, a smart memory card (Smart Media Card, SMC), a secure digital (Secure Digital, SD) card, a flash card (Flash Card), etc. equipped with the electronic device 1. Of course, the memory 11 can also include both the internal storage unit of the electronic device 1 and its external storage device. In this embodiment, the memory 11 is generally used to store the operating system and various application software installed on the electronic device 1, such as the program code of the push program 10 of the dialogue module, etc. In addition, the memory 11 can also be used to temporarily store various types of data that have been output or are to be output.
[0116] In some embodiments, the processor 12 may be a central processing unit (CPU), a controller, a microcontroller, a microprocessor, or other data processing chips. The processor 12 is generally used to control the overall operation of the electronic device 1, such as performing control and processing related to data interaction or communication. In this embodiment, the processor 12 is used to run the program code stored in the memory 11 or process data, such as running the program code of the push program 10 of the dialogue module.
[0117] The display 13 may be referred to as a display screen or a display unit. In some embodiments, the display 13 may be an LED display, a liquid crystal display, a touch-sensitive liquid crystal display, and an organic light-emitting diode (OLED) touch device. The display 13 is used to display information processed in the electronic device 1 and to display a visual working interface, such as displaying the results of data statistics.
[0118] The network interface 14 may optionally include a standard wired interface, a wireless interface (such as a WI-FI interface), and the network interface 14 is generally used to establish a communication connection between the electronic device 1 and other electronic devices.
[0119] Figure 3Only the electronic device 1 having the components 11 - 14 and the push program 10 of the dialogue module is shown, but it should be understood that it is not required to implement all of the components shown, and more or fewer components may be implemented instead.
[0120] Optionally, the electronic device 1 may further include a user interface, which may include a display (Display), an input unit such as a keyboard (Keyboard), and the optional user interface may also include a standard wired interface and a wireless interface. Optionally, in some embodiments, the display may be an LED display, a liquid crystal display, a touch-sensitive liquid crystal display, and an organic light-emitting diode (Organic Light-Emitting Diode, OLED) touch device, etc. Among them, the display may also be appropriately referred to as a display screen or a display unit, which is used to display information processed in the electronic device 1 and to display a visual user interface.
[0121] The electronic device 1 may further include a radio frequency (RF) circuit, a sensor, an audio circuit, etc., which will not be described in detail here.
[0122] In the above embodiment, the processor 12 may implement the following steps when executing the push program 10 of the dialogue module stored in the memory 11:
[0123] Obtaining a question sentence input by a user, and distributing the question sentence to a corpus corresponding to each dialogue module included in the intelligent robot;
[0124] Calculating the similarity between the question sentence and each template sentence in each corpus to obtain a similarity value between the question sentence and each template sentence;
[0125] Determine whether there is a first template sentence in each corpus whose similarity value with the question sentence is greater than or equal to a first threshold; if so, select the first template sentence, sort the first template sentence from large to small according to the similarity value, and select a preset number of the first template sentences as the target template sentence set of the corpus;
[0126] The scores of each target template sentence set are calculated according to preset calculation rules, and the dialogue modules corresponding to each corpus are sorted according to the scores of each target template sentence set. The dialogue modules after the sorting operation are pushed to the terminal corresponding to the user for display.
[0127] The storage device may be the memory 11 of the electronic device 1 , or may be another storage device that is communicatively connected to the electronic device 1 .
[0128] For a detailed description of the above steps, please refer to the above Figure 2Functional module diagram of the push device 100 embodiment of the conversation module and Figure 1 Description of a flowchart of an embodiment of a push method for a dialogue module.
[0129] In addition, the embodiment of the present invention also proposes a computer-readable storage medium, which can be non-volatile or volatile. The computer-readable storage medium can be any one or any combination of a hard disk, a multimedia card, an SD card, a flash memory card, an SMC, a read-only memory (ROM), an erasable programmable read-only memory (EPROM), a portable compact disk read-only memory (CD-ROM), a USB memory, etc. The computer-readable storage medium includes a data storage area and a program storage area. The data storage area stores data created according to the use of the blockchain node, and the program storage area stores a push program 10 of the dialogue module. When the push program 10 of the dialogue module is executed by the processor, the following operations are implemented:
[0130] Obtaining a question sentence input by a user, and distributing the question sentence to a corpus corresponding to each dialogue module included in the intelligent robot;
[0131] Calculating the similarity between the question sentence and each template sentence in each corpus to obtain a similarity value between the question sentence and each template sentence;
[0132] Determine whether there is a first template sentence in each corpus whose similarity value with the question sentence is greater than or equal to a first threshold; if so, select the first template sentence, sort the first template sentence from large to small according to the similarity value, and select a preset number of the first template sentences as the target template sentence set of the corpus;
[0133] The scores of each target template sentence set are calculated according to preset calculation rules, and the dialogue modules corresponding to each corpus are sorted according to the scores of each target template sentence set. The dialogue modules after the sorting operation are pushed to the terminal corresponding to the user for display.
[0134] The specific implementation of the computer-readable storage medium of the present invention is substantially the same as the specific implementation of the push method of the above-mentioned dialogue module, and will not be described in detail here.
[0135] In another embodiment, the push method of the dialogue module provided by the present invention can further ensure the privacy and security of all the above data, and all the above data can also be stored in a blockchain node. For example, question sentences and target template sentence sets, etc., can all be stored in the blockchain node.
[0136] It should be noted that the blockchain referred to in the present invention is a new application model of computer technologies such as distributed data storage, peer-to-peer transmission, consensus mechanism, encryption algorithm, etc. Blockchain is essentially a decentralized database, a string of data blocks generated by cryptographic methods. Each data block contains a batch of network transaction information, which is used to verify the validity of its information (anti-counterfeiting) and generate the next block. Blockchain can include the blockchain underlying platform, platform product service layer, and application service layer.
[0137] It should be noted that the serial numbers of the above embodiments of the present invention are only for description and do not represent the advantages and disadvantages of the embodiments. And the terms "including", "comprising" or any other variants thereof in this article are intended to cover non-exclusive inclusion, so that a process, device, article or method including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, device, article or method. In the absence of further restrictions, an element defined by the sentence "including a ..." does not exclude the presence of other identical elements in the process, device, article or method including the element.
[0138] Through the description of the above implementation methods, those skilled in the art can clearly understand that the above-mentioned embodiment methods can be implemented by means of software plus a necessary general hardware platform, and of course can also be implemented by hardware, but in many cases the former is a better implementation method. Based on such an understanding, the technical solution of the present invention is essentially or the part that contributes to the prior art can be embodied in the form of a software product, and the computer software product is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk) as described above, including a number of instructions for enabling a terminal device (which can be a mobile phone, a computer, an electronic device, or a network device, etc.) to execute the methods described in each embodiment of the present invention.
[0139] The above are only preferred embodiments of the present invention, and are not intended to limit the patent scope of the present invention. Any equivalent structure or equivalent process transformation made using the contents of the present invention specification and drawings, or directly or indirectly applied in other related technical fields, are also included in the patent protection scope of the present invention.
Claims
1. A method for pushing a dialogue module, characterized in that: The method comprises: Obtaining a question sentence input by a user, and distributing the question sentence to a corpus corresponding to each dialogue module included in the intelligent robot; Calculating the similarity between the question sentence and each template sentence in each corpus to obtain a similarity value between the question sentence and each template sentence; Determine whether there is a first template sentence in each corpus whose similarity value with the question sentence is greater than or equal to a first threshold; if so, select the first template sentence, sort the first template sentences from large to small according to the similarity value, and select a preset number of the first template sentences as the target template sentence set of the corpus; Determine whether there is a second template sentence in each corpus whose similarity with the question sentence is greater than a second threshold and less than a first threshold; if so, feed back a prompt sentence corresponding to the second template sentence to the user so that the user can select the prompt sentence corresponding to the second template sentence, and add the second template sentence corresponding to the prompt sentence selected by the user on the terminal interface to the target template sentence set; Calculating the score of each sentence in each target template sentence set according to the preset corpus weight, and accumulating the score of each sentence to obtain the score of each target template sentence set, performing a sorting operation on the dialogue modules corresponding to each corpus according to the size of the score of each target template sentence set, and pushing the dialogue modules after the sorting operation to the terminal corresponding to the user for display; When it is determined that there is no template sentence in each corpus whose similarity with the question sentence is greater than the second threshold, the pre-configured default dialogue module is pushed to the terminal corresponding to the user for display, so as to prompt the user to re-enter the question sentence.
2. The method for pushing a dialogue module according to claim 1, characterized in that: The calculating the similarity between the question sentence and each template sentence in each corpus includes: The question sentence is segmented using a preset segmentation rule, each segmented word is converted into a word vector, and based on the word vector of the question sentence and the word vector of each template sentence, a similarity value between the question sentence and each template sentence is calculated.
3. The method for pushing a dialogue module according to claim 2, characterized in that: The calculating of the similarity value between the question sentence and each template sentence includes: The similarity value between the question sentence and each template sentence is calculated using the following formula: Among them, A represents the word vector set of the question sentence, B represents the word vector set of the template sentence, and J(A,B) represents the similarity value between the question sentence and the template sentence.
4. The method for pushing a dialogue module according to claim 2, characterized in that: The performing a word segmentation operation on the question sentence using a preset word segmentation rule comprises: Matching the read segmented words with a preset word library according to a forward maximum matching method to obtain a first matching result, wherein the first matching result includes a first number of first phrases and a second number of single words; Matching the read segmented words with a preset word library according to a reverse maximum matching method to obtain a second matching result, wherein the second matching result includes a third number of second phrases and a fourth number of single words; If the first number is equal to the third number and the second number is less than or equal to the fourth number, or if the first number is less than the third number, the first matching result is used as the word segmentation result of the question statement; if the first number is equal to the second number and the third number is greater than the fourth number, or if the first number is greater than the third number, the second matching result is used as the word segmentation result of the question statement.
5. The method for pushing a dialogue module according to claim 1, characterized in that: The preset calculation rules include: S=W*Y Among them, S represents the score of the target template sentence, W represents the preset weight value of the corpus corresponding to the target template sentence, and Y represents the similarity value between the target template sentence and the question sentence.
6. A push device for a dialogue module, characterized in that: The device comprises: Distribution module: used to obtain the question sentence input by the user, and distribute the question sentence to the corpus corresponding to each dialogue module included in the intelligent robot; Calculation module: used to calculate the similarity between the question sentence and each template sentence in each corpus, and obtain the similarity value between the question sentence and each template sentence; Selection module: used to determine whether there is a first template sentence in each corpus whose similarity value with the question sentence is greater than or equal to a first threshold; if so, screen out the first template sentence, sort the first template sentence from large to small according to the similarity value, and select a preset number of the first template sentences as the target template sentence set of the corpus; determine whether there is a second template sentence in each corpus whose similarity with the question sentence is greater than a second threshold and less than the first threshold; if so, feed back the prompt sentence corresponding to the second template sentence to the user so that the user can select the prompt sentence corresponding to the second template sentence, and add the second template sentence corresponding to the prompt sentence selected by the user in the terminal interface to the target template sentence set; Push module: used to calculate the score of each sentence in each target template sentence set according to the preset corpus weight, and accumulate the score of each sentence to obtain the score of each target template sentence set, perform a sorting operation on the dialogue module corresponding to each corpus according to the size of the score of each target template sentence set, and push the dialogue module after the sorting operation to the terminal corresponding to the user for display; when it is determined that there is no template sentence in each corpus whose similarity with the question sentence is greater than the second threshold, push the pre-configured default dialogue module to the terminal corresponding to the user for display, so as to prompt the user to re-enter the question sentence.
7. An electronic device, characterized in that: The electronic device comprises: at least one processor; and, a memory communicatively connected to the at least one processor; wherein, The memory stores a program executable by the at least one processor, and the program is executed by the at least one processor so that the at least one processor can execute the push method of the dialogue module according to any one of claims 1 to 5.
8. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a push program of the dialogue module. When the push program of the dialogue module is executed by the processor, the steps of the push method of the dialogue module as claimed in any one of claims 1 to 5 are implemented.
Citation Information
Patent Citations
Speech recognition method and system
CN107204184A
Question answering method and device, computer equipment and storage medium
CN111597313A
