Intention recognition method, device, equipment and storage medium based on artificial intelligence
Through the artificial intelligence-based intent recognition method, the problems of low accuracy of forum reply and low user traffic efficiency are solved, and more efficient and accurate user guidance is achieved.
Patent Information
- Application Number
- CN202010162325.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-03-10
- Publication Date
- 2025-04-11
- Estimated Expiration
- 2040-03-10
AI Technical Summary
The accuracy of forum replies is low and the efficiency of user traffic is low.
Intent recognition method based on artificial intelligence is adopted, intent recognition is calculated by timed collection of forum data, data preprocessing, word frequency-inverse text frequency index algorithm, deep neural network text classification model for intent recognition, and question text, target answers and links are combined according to template types for intelligent reply.
It improves the accuracy and timeliness of reply, enhances the efficiency of traffic to users, and achieves more accurate and efficient user guidance.
Smart Images

Figure CN111428471B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of deep learning, and in particular to an intention recognition method, device, equipment and storage medium based on artificial intelligence. Background Art
[0002] As industry competition becomes increasingly fierce, the cost of acquiring resources is also getting higher and higher. There are many ways to promote and attract traffic. Generally, it is necessary to clarify the product or service positioning, user group positioning, identify the flow scenarios of target users or potential users, analyze and explore user preferences, and formulate strategies to guide users to reach the destination platform to achieve network promotion and traffic.
[0003] The practice of attracting traffic by replying to posts on forums has long existed, but they are often low-quality advertising posts, and the replies cannot be accurately responded to according to user preferences or preferences, resulting in low accuracy and low efficiency in attracting users. Summary of the invention
[0004] The main purpose of the present invention is to solve the technical problems of low accuracy of forum reply and low efficiency in attracting users.
[0005] To achieve the above-mentioned purpose, the first aspect of the present invention provides an intention recognition method based on artificial intelligence, comprising: regularly collecting initial data from a preset forum website; performing data preprocessing on the initial data according to preset services to obtain question text sentences; calculating angle cosine values of the question text sentences according to the order in which they are processed through a word frequency-inverse text frequency index algorithm, and determining a target answer based on the angle cosine value; performing intention recognition on the question text sentences through a deep neural network text classification model to obtain a template type; combining the question text sentences, the target answer and a preset link according to the template type, and performing intelligent reply to the spliced content through the preset crawler task, wherein the preset link is used to instruct the target user to access the target online question-and-answer system.
[0006] Optionally, in a first implementation manner of the first aspect of the present invention, the periodic collection of initial data from a preset forum website includes: determining a uniform resource locator address of a preset forum website; periodically accessing the preset forum website through a preset crawler task and the uniform resource locator address of the preset forum website to obtain web page data; intercepting the web page data according to a preset page identifier to obtain initial data, the initial data including escape characters, spaces, web page tags and web page content; and recording the initial data and the uniform resource locator address of the preset forum website into a preset data table.
[0007] Optionally, in a second implementation method of the first aspect of the present invention, the initial data is preprocessed according to the preset business to obtain question text sentences, including: determining keywords of the preset business, and extracting the initial data according to the keywords; deleting the escape character and the space from the extracted data through a text processing method, and deleting the web page tag to obtain text data; performing sentence processing on the text data, and deleting sentences with empty character strings to obtain question text sentences.
[0008] Optionally, in a third implementation manner of the first aspect of the present invention, the angle cosine values of the question text sentences are calculated according to the order in which they are processed by a word frequency-inverse text frequency index algorithm, and a target answer is determined according to the angle cosine value, including: preprocessing the question text sentences in the order in which they are processed to obtain an initial vocabulary and a first question vector; text vectorizing the preset question according to the word frequency-inverse text frequency index algorithm and the initial vocabulary to obtain a second question vector; calculating the first question vector and the second question vector to obtain the angle cosine value, and setting the answer corresponding to the preset question with the largest angle cosine value as the target answer.
[0009] Optionally, in a fourth implementation method of the first aspect of the present invention, the question text sentences are pre-processed in the order in which they are processed to obtain an initial vocabulary and a first question vector, including: writing the multiple question text sentences into the tail of a preset message queue in the order in which they are processed; setting a timeout period for the question text sentence, wherein the timeout period is greater than or equal to 0; when the timeout period corresponding to the question text sentence is equal to 0 and the question text sentence is still in a waiting state, adding the question text sentence to a delayed task queue, wherein the delayed task queue is used to process overdue question text sentences; when the timeout period corresponding to the question text sentence is greater than 0, performing word segmentation and part-of-speech tagging on the question text sentence to obtain an initial vocabulary and a first question vector.
[0010] Optionally, in a fifth implementation of the first aspect of the present invention, the text vectorization of the preset question according to the word frequency-inverse text frequency index algorithm and the initial vocabulary to obtain the second question vector includes: obtaining an initial vocabulary, wherein the initial vocabulary includes a plurality of vocabulary , is a positive integer; the number of preset questions read from the preset database ; Count the multiple words according to the word frequency-inverse text frequency index algorithm The number of times it appears in the question text sentence ; Count the number of words included in the preset question Number of questions ; According to the first preset formula, the preset question is vectorized to obtain a second question vector, wherein the first preset formula , .
[0011] Optionally, in a sixth implementation manner of the first aspect of the present invention, the calculating the first question vector and the second question vector to obtain the cosine value of the angle, and setting the answer corresponding to the preset question with the largest cosine value of the angle as the target answer includes: calculating the first question vector and the second question vector according to a second preset formula to obtain the cosine value of the angle, and the second preset formula is , wherein the is the first question vector, is the second question vector, Used to indicate that the first question vector is determined according to the cosine value of the angle and the second question vector similarity; sort the answers corresponding to the preset question sentences according to the cosine value of the angle from large to small, and set the answer corresponding to the preset question sentence with the largest cosine value of the angle as the target answer.
[0012] The second aspect of the present invention provides an intention recognition device based on artificial intelligence, including: a collection unit, used to collect initial data from a preset forum website at a regular interval; a preprocessing unit, used to perform data preprocessing on the initial data according to a preset business to obtain question text sentences; a calculation unit, used to calculate the angle cosine value of the question text sentences according to the order of processing through the word frequency-inverse text frequency index algorithm, and determine the target answer according to the angle cosine value; an intention recognition unit, used to perform intention recognition on the question text sentences through a deep neural network text classification model to obtain a template type; a reply unit, used to combine the question text sentences, the target answer and the preset link according to the template type, and intelligently reply to the spliced content through the preset crawler task, and the preset link is used to instruct the target user to access the target online question and answer system.
[0013] Optionally, in a first implementation manner of the second aspect of the present invention, the collection unit is specifically used to: determine a uniform resource locator address of a preset forum website; periodically access the preset forum website through a preset crawler task and the uniform resource locator address of the preset forum website to obtain web page data; intercept the web page data according to a preset page identifier to obtain initial data, the initial data including escape characters, spaces, web page tags and web page content; and record the initial data and the uniform resource locator address of the preset forum website into a preset data table.
[0014] Optionally, in a second implementation method of the second aspect of the present invention, the preprocessing unit is specifically used to: determine keywords of the preset business, and extract the initial data based on the keywords; delete the escape character and the space from the extracted data through text processing, and delete the web page tag to obtain text data; perform sentence processing on the text data, and delete the sentences with empty strings to obtain question text sentences.
[0015] Optionally, in a third implementation manner of the second aspect of the present invention, the calculation unit further includes: a preprocessing subunit, used to preprocess the question text sentences in the order of processing to obtain an initial vocabulary and a first question vector; a text processing subunit, used to perform text vectorization on the preset question according to the word frequency-inverse text frequency index algorithm and the initial vocabulary to obtain a second question vector; a calculation subunit, used to calculate the first question vector and the second question vector to obtain an angle cosine value, and set the answer corresponding to the preset question with the largest angle cosine value as the target answer.
[0016] Optionally, in a fourth implementation manner of the second aspect of the present invention, the preprocessing subunit is specifically used to: write the multiple question text sentences into the tail of the preset message queue in the order of being processed; set a timeout period for the question text sentence, and the timeout period is greater than or equal to 0; when the timeout period corresponding to the question text sentence is equal to 0, and the question text sentence is still in a waiting state, add the question text sentence to a delayed task queue, and the delayed task queue is used to process the overdue question text sentence; when the timeout period corresponding to the question text sentence is greater than 0, perform word segmentation and part-of-speech tagging on the question text sentence to obtain an initial vocabulary and a first question vector.
[0017] Optionally, in a fifth implementation of the second aspect of the present invention, the text processing subunit is specifically used to: obtain an initial vocabulary, the initial vocabulary including a plurality of vocabulary , is a positive integer; the number of preset questions read from the preset database ; Count the multiple words according to the word frequency-inverse text frequency index algorithm The number of times it appears in the question text sentence ; Count the number of words included in the preset question Number of questions ; According to the first preset formula, the preset question is vectorized to obtain a second question vector, wherein the first preset formula , .
[0018] Optionally, in a sixth implementation of the second aspect of the present invention, the computing subunit is specifically configured to: set the first question vector to ; Calculate the first question vector and the second question vector according to a second preset formula to obtain the cosine value of the angle, wherein the second preset formula is: , wherein the is the first question vector, is the second question vector, is used to indicate that the first question vector is determined according to the cosine value of the angle and the second question vector similarity; sort the answers corresponding to the preset question sentences according to the cosine value of the angle from large to small, and set the answer corresponding to the preset question sentence with the largest cosine value of the angle as the target answer.
[0019] The third aspect of the present invention provides an artificial intelligence-based intention recognition device, comprising: a memory and at least one processor, the memory storing instructions, the memory and the at least one processor being interconnected via lines; the at least one processor calling the instructions in the memory so that the artificial intelligence-based intention recognition device executes the artificial intelligence-based intention recognition method described in the first aspect above.
[0020] The fourth aspect of the present invention provides a computer-readable storage medium, which stores instructions. When the computer-readable storage medium is run on a computer, it enables the computer to execute the artificial intelligence-based intention recognition method described in the first aspect above.
[0021] In the technical solution provided by the present invention, initial data is collected from a preset forum website at regular intervals; the initial data is preprocessed according to the preset business to obtain question text sentences; the question text sentences are calculated according to the order of being processed by the word frequency-inverse text frequency index algorithm, and the target answer is determined according to the angle cosine value; the question text sentences are intentionally identified by the deep neural network text classification model to obtain the template type; the question text sentences, the target answer and the preset link are combined according to the template type, and the spliced content is intelligently replied by the preset crawler task, and the preset link is used to instruct the target user to access the target online question and answer system. In the embodiment of the present invention, questions are regularly captured from the target forum by the crawler task, the captured questions are judged and answered by the intelligent question and answer engine, and the crawler task replies and guides the users according to the answer content, and guides the users to the target page for intelligent question and answer, thereby improving the timeliness, accuracy and efficiency of replying and guiding users. BRIEF DESCRIPTION OF THE DRAWINGS
[0022] Figure 1 Schematic diagram of an embodiment of an intention recognition method based on artificial intelligence in an embodiment of the present invention;
[0023] Figure 2 Schematic diagram of another embodiment of the intention recognition method based on artificial intelligence in an embodiment of the present invention;
[0024] Figure 3 Schematic diagram of an embodiment of an intention recognition device based on artificial intelligence in an embodiment of the present invention;
[0025] Figure 4 Schematic diagram of another embodiment of an intention recognition device based on artificial intelligence in an embodiment of the present invention;
[0026] Figure 5 The figure is a schematic diagram of an embodiment of an intention recognition device based on artificial intelligence in an embodiment of the present invention. DETAILED DESCRIPTION
[0027] The embodiments of the present invention provide an artificial intelligence-based intention recognition method, apparatus, device and storage medium, which are used to periodically capture questions from a target forum through a crawler task, identify and answer the captured questions through an intelligent question-and-answer engine, and have the crawler task reply to posts based on the answer content, thereby directing users to a target page for intelligent question-and-answering, thereby improving the timeliness and accuracy of replies and the efficiency of directing user traffic.
[0028] In order to enable those skilled in the art to better understand the solutions of the present invention, the embodiments of the present invention will be described below in conjunction with the accompanying drawings in the embodiments of the present invention.
[0029] The terms "first", "second", "third", "fourth", etc. (if any) in the specification and claims of the present invention and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchanged where appropriate, so that the embodiments described herein can be implemented in an order other than that illustrated or described herein. In addition, the terms "including" or "having" and any variations thereof are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device that includes a series of steps or units is not necessarily limited to those steps or units that are clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.
[0030] For ease of understanding, the specific process of the embodiment of the present invention is described below. Figure 1 , an embodiment of the intention recognition method based on artificial intelligence in the embodiment of the present invention includes:
[0031] 101. Collect initial data from the preset forum website regularly;
[0032] It is understandable that the execution subject of the present invention may be an intention recognition device based on artificial intelligence, or may be a terminal or a server, which is not limited here. The embodiment of the present invention is described by taking a server as the execution subject as an example.
[0033] The server periodically collects initial data from the preset forum website. The initial data includes replies and comments on posting topics and topic posts in various forum sections on the preset forum website. The initial data is represented in the form of hypertext markup language code.
[0034] Further, the server determines the uniform resource locator address of the preset forum website; the server periodically accesses the preset forum website through the preset crawler task and the uniform resource locator address of the preset forum website to obtain web page data, for example, the server accesses the uniform resource locator address A of the preset forum website through the preset crawler task every hour or at 2 a.m. every day; the server intercepts the web page data according to the preset page identifier to obtain initial data, and the initial data includes escape characters, spaces, web page tags and web page content, for example, the web page tags include,,, , The server performs regular interception on the web page data according to the regular expression to obtain the initial data; the server records the initial data and the uniform resource locator address of the preset forum website into the preset data table.
[0035] 102. Preprocess the initial data according to the preset business to obtain the question text sentence;
[0036] The server pre-processes the initial data according to the preset business to obtain the question text sentences. Among them, data extraction refers to the server extracting data from the initial data according to the preset business; data cleaning refers to deleting the extracted data according to the preset rules; data conversion refers to the process of processing the cleaned data to obtain the question text sentences.
[0037] Specifically, the specific process of the server obtaining the question text sentence includes: when the server detects that there is initial data to be processed in the preset data table, the server extracts the initial data according to the preset business; the server cleans the extracted data; the server converts the cleaned data to obtain the question text sentence.
[0038] 103. Calculate the angle cosine value of the question text sentences according to the order in which they are processed by using the word frequency-inverse text frequency index algorithm, and determine the target answer according to the angle cosine value;
[0039] The server calculates the angle cosine value of the question text sentences according to the order in which they are processed by the word frequency-inverse text frequency index algorithm, and determines the target answer according to the angle cosine value. Specifically, the server retrieves and processes multiple question text sentences in parallel through a preset message queue. For example, the server obtains question text sentences including sentence A, sentence B, sentence C, and sentence D in the order in which they are processed; the server processes the data of sentence A, sentence B, sentence C, and sentence D in turn through the preset message queue.
[0040] Then, the server calculates the angle cosine value for the question text sentence and the preset question sentence through the word frequency-inverse text frequency index algorithm, and determines the target answer based on the angle cosine value. Furthermore, the server finds the preset question sentence that matches the question text sentence in the set of existing question-answer pairs in the preset question-answer center engine through the angle cosine value, and sets the preset question sentence that matches the question text sentence as the target answer. For example, the angle cosine values calculated by the server include 0.96, 0.18, and 0.57, and the server sets the preset question sentence corresponding to the angle cosine value of 0.96 as the target answer.
[0041] 104. Use the deep neural network text classification model to identify the intent of the question text sentences and obtain the template type;
[0042] The server uses a deep neural network text classification model to perform intent recognition on the question text sentences and obtain the template type. Specifically, the server truncates the sentences through the deep neural network text classification model to obtain the sentence matrix (s, d). For example, the sentence matrix is 7*5, where 7 is the sentence length value and 5 is the word mapping vector; the server performs convolution layer processing on the sentence matrix to obtain feature vectors of different lengths. For example, the convolution kernel size is set to (2, 3, 4) to find 2-gram, 3-gram, and 4-gram features respectively; the server performs pooling processing on feature vectors of different lengths to obtain feature vectors of preset lengths; the feature vectors of preset lengths are connected and normalized to obtain the probability of each category; the server determines the matching template and template type based on the type with the highest probability.
[0043] Optionally, the server performs text similarity matching on the question text sentences through a preset intent recognition model to obtain multiple similarities; the server determines the maximum similarity from the multiple similarities; and the server determines the matching template and template type based on the maximum similarity.
[0044] 105. Combine question text sentences, target answers and preset links according to template types, and intelligently reply to the combined content through preset crawler tasks. The preset links are used to instruct target users to access the target online question-and-answer system.
[0045] The server combines the question text sentences, target answers and preset links according to the template type, and intelligently replies to the spliced content through the preset crawler task. The preset link is used to instruct the target user to access the target online question and answer system. Specifically, the server determines the question and answer template according to the template type, and the question and answer template is a replaceable string set according to the template type; the server combines the question text content, target answers and preset links based on the question and answer template; the server intelligently replies to the spliced content through the preset crawler task. For example, the spliced content is "@I already have social insurance, do I still need to buy commercial insurance? Answer: The medical expenses reimbursed by social insurance are relatively limited, and the reimbursement amount is generally around 50%. At the same time, social insurance cannot cover major diseases, so if you have social insurance, you still need supplementary insurance.
[0046] Furthermore, when the target user clicks on a preset jump link from a preset forum, the target user is guided to a target online question-and-answer system of a different scenario through the logical configuration information index number in the link, and online conversations and automatic marketing are conducted with the target user through the target online question-and-answer system.
[0047] In an embodiment of the present invention, questions are captured from a target forum at a regular interval by a crawler task, the captured questions are identified and answered by an intelligent question-and-answer engine, and replies are directed based on the answer content by the crawler task, thereby directing users to a target page for intelligent question-and-answering, thereby improving the timeliness and accuracy of replies and the efficiency of directing user traffic.
[0048] See also Figure 2 Another embodiment of the intention recognition method based on artificial intelligence in the embodiment of the present invention includes:
[0049] 201. Collect initial data from the preset forum website regularly;
[0050] The server periodically collects initial data from the preset forum website. The initial data includes replies and comments on posting topics and topic posts in various forum sections on the preset forum website. The initial data is represented in the form of hypertext markup language code.
[0051] Specifically, first, the server determines the uniform resource locator address of the preset forum website, wherein the uniform resource locator address is a representation of the location and access method of resources available from the Internet, and is the address of standard resources on the Internet. Each file on the Internet has a unique uniform resource locator address.
[0052] Secondly, the server periodically accesses the uniform resource locator address of the preset forum website through the preset crawler task to obtain access data. Specifically, the server periodically sends a request to the uniform resource locator address of the preset forum website through the preset crawler task using the get method or the post method to obtain the return result; the return result is parsed to obtain the web page data.
[0053] Next, the server intercepts the web page data according to the preset page identifier to obtain the initial data, which includes the escape character, space, web page tag and web page content. Among them, the web page data includes the escape character "\", space, web page tag and the specific content displayed on the web page, and the web page tag includes,,, , Specifically, the server sets different preset page identifiers according to different web page data, and sets a first regular expression for different preset page identifiers; the server performs regular interception on the web page data according to the first regular expression to obtain initial data, wherein the regular expression is a special character sequence used to check whether a string matches a certain pattern.
[0054] Finally, the server records the initial data and the uniform resource locator address of the preset forum website into the preset data table.
[0055] 202. Preprocess the initial data according to the preset business to obtain question text sentences;
[0056] The server pre-processes the initial data according to the preset business to obtain the question text sentences. Among them, data extraction refers to the server extracting data from the initial data according to the preset business; data cleaning refers to deleting the extracted data according to the preset rules; data conversion refers to the process of processing the cleaned data to obtain the question text sentences.
[0057] Specifically, first, the server determines the keywords of the preset business and extracts the initial data according to the keywords. For example, the server sets insurance policy as a keyword, and the server extracts part of the data related to the insurance policy from the initial data, that is, the server deletes part of the data not related to the insurance policy from the initial data.
[0058] Secondly, the server deletes escape characters and spaces from the extracted data through a text processing method, and deletes web page tags to obtain text data. Specifically, the server sets a second regular expression for the escape characters, spaces, and web page tags; the server processes the extracted data according to the second regular expression through a text processing method to obtain text data.
[0059] Then, the server processes the text data into sentences and deletes the sentences with empty strings to obtain question text sentences. Specifically, the server sets a sentence separator; the server processes the text data into sentences according to the preset segmentation function and the sentence separator to obtain multiple sentences; the server traverses and queries multiple sentences and deletes the sentences with empty strings to obtain question text sentences. Among them, the sentence separators include semicolons, periods, exclamation marks, and question marks.
[0060] 203. Preprocess the question text sentences according to the order in which they are processed to obtain an initial vocabulary and a first question sentence vector;
[0061] The server preprocesses the question text sentences in the order in which they are processed to obtain the initial vocabulary and the first question vector. The preprocessing includes word segmentation, part-of-speech tagging, and stop word filtering of the preset question sentences and question text sentences. Among them, the preset question sentences and question text sentences include sentences. Word segmentation is to decompose sentences into data structures with words as units; part-of-speech tagging is to determine a part of speech for each word based on the context of the sentence. Parts of speech include nouns, pronouns, numerals, quantifiers, and adjectives; stop word filtering is to filter out noise in the word segmentation results, for example, de, le, is, and ah.
[0062] Specifically, the server writes the question text sentences into the tail of the preset message queue in the order in which they are processed, and the preset message queue is used to sequentially process the question text sentences; the server sets a timeout for the question text sentences, the timeout is greater than or equal to 0, and sends the question text sentences to the preset question and answer center engine in a first-in-first-out order; when the timeout corresponding to the question text sentence is 0, and the question text sentence is still in a waiting state, the server adds the question text sentence to a delayed task queue, and the delayed task queue is used to process the overdue question text sentence; when the timeout corresponding to the question text sentence is greater than 0, the question text sentence is segmented and tagged with parts of speech to obtain an initial vocabulary and a first question vector.
[0063] It is understandable that the server sets the message-oriented middleware RabbitMQ as a preset message queue; when the server sends a question text sentence through RabbitMQ, RabbitMQ sets the message timeout for the question text sentence, wherein the message timeout is used to indicate the survival time of the set question text sentence, the unit of the timeout is milliseconds, and its value must be greater than or equal to 0, and the timeout of each message can be the same or different, which is not limited here; when the question text sentence is in a waiting state within the preset timeout, the question text sentence is sent to the preset question and answer center engine in a first-in-first-out order through RabbitMQ. For example: the server sends 3 question text sentences A, B and C, whose timeouts are 10 seconds, 30 seconds and 15 seconds respectively. After the timeout exceeds 5s, A, B and C are sent in sequence through RabbitMQ. It should be noted that when RabbitMQ is used to implement a delayed task queue, ensure that the delay time of A, B and C is consistent.
[0064] 204. Performing text vectorization on the preset question sentence according to the word frequency-inverse text frequency index algorithm and the initial vocabulary to obtain a second question sentence vector;
[0065] The server vectorizes the text of the preset question according to the word frequency-inverse text frequency index algorithm and the initial vocabulary to obtain the second question vector. Specifically, the server obtains the initial vocabulary, which includes multiple words , A positive integer; the server reads the number of preset questions from the preset database ; The server counts multiple words according to the word frequency-inverse text frequency index algorithm The number of times it appears in the question text sentence ; The server statistics preset question includes multiple words Number of questions ; The server vectorizes the preset question according to the preset formula to obtain the second question vector, where the preset formula , .
[0066] 205. Calculate the first question vector and the second question vector to obtain the cosine value of the angle, and set the answer corresponding to the preset question with the largest cosine value of the angle as the target answer;
[0067] The server calculates the first question vector and the second question vector to obtain the cosine value of the angle. Specifically, the server calculates the first question vector and the second question vector to obtain the cosine value of the angle. The formula for calculating the cosine value of the angle is: ,in, is the first question vector, is the second question vector, Used to indicate that the first question vector is determined based on the cosine value of the angle and the second question vector The similarity of The larger the value of , the larger the cosine value of the angle between the first question vector and the second question vector, and the higher the similarity; the server sorts the answers corresponding to the preset questions in descending order according to the cosine value of the angle, and sets the answer corresponding to the preset question with the largest cosine value of the angle as the target answer.
[0068] 206. Use a deep neural network text classification model to identify the intent of the question text sentences and obtain the template type;
[0069] The server uses a deep neural network text classification model to perform intent recognition on the question text sentences and obtain the template type. The deep neural network text classification model includes a text-CNN model. Specifically, the server truncates the sentence through the deep neural network text classification model to obtain a sentence matrix (s, d). For example, the sentence matrix is 7*5, where 7 is the sentence length value and 5 is the word mapping vector; the server performs convolution layer processing on the sentence matrix to obtain feature vectors of different lengths. For example, the convolution kernel size is set to (2, 3, 4) to find 2-gram, 3-gram, and 4-gram features respectively; the server performs pooling processing on feature vectors of different lengths to obtain feature vectors of preset lengths; the feature vectors of preset lengths are connected and normalized to obtain the probability of each category; the server determines the matching template and template type according to the type with the maximum probability.
[0070] Optionally, the server performs text similarity matching on the question text sentences through a preset intent recognition model to obtain multiple similarities; the server determines the maximum similarity from the multiple similarities; and the server determines the matching template and template type based on the maximum similarity.
[0071] It should be noted that the purpose of the server's intent recognition is to determine whether the question and answer have marketing value. If not, the question text sentence will be discarded. For example, for the question text sentence "Can I buy yyy insurance for xxx disease?", when the server performs intent recognition, it needs to determine whether yyy insurance belongs to the target enterprise. If yyy insurance belongs to the target enterprise, it determines the matching template A and template type A; if yyy insurance does not belong to the target enterprise, it determines the matching template B and template type B.
[0072] 207. Combine question text sentences, target answers and preset links according to template types, and intelligently reply to the combined content through preset crawler tasks. The preset links are used to instruct target users to access the target online question-and-answer system.
[0073] The server combines the question text sentences, target answers and preset links according to the template type, and intelligently replies to the spliced content through the preset crawler task. The preset link is used to instruct the target user to access the target online question and answer system. Specifically, the server determines the question and answer template according to the template type, and the question and answer template is a replaceable string set according to the template type; the server combines the question text sentences, target answers and preset links based on the question and answer template; the server intelligently replies to the spliced content through the preset crawler task. For example, the spliced content is "@I already have social insurance, do I still need to buy commercial insurance? Answer: The medical expenses reimbursed by social insurance are relatively limited, and the reimbursement amount is generally around 50%. At the same time, social insurance cannot cover major diseases, so if you have social insurance, you still need supplementary insurance.
[0074] Furthermore, when it is detected that the target user accesses the target online question-and-answer system through a preset link, an online dialogue is conducted with the target user through the target online question-and-answer system. When the target user clicks on a preset jump link from a preset forum, the target user is guided to a target online question-and-answer system of a different scenario through the logical configuration information index number in the link, and an online dialogue and automatic marketing are conducted with the target user through the target online question-and-answer system. For example, for insurance topics, an online dialogue and automatic marketing are conducted with the target user through the target online question-and-answer system.
[0075] In an embodiment of the present invention, questions are captured from a target forum at a regular interval by a crawler task, the captured questions are identified and answered by an intelligent question-and-answer engine, and replies are directed based on the answer content by the crawler task, thereby directing users to a target page for intelligent question-and-answering, thereby improving the timeliness and accuracy of replies and the efficiency of directing user traffic.
[0076] The above describes the intention recognition method based on artificial intelligence in the embodiment of the present invention. The following describes the intention recognition device based on artificial intelligence in the embodiment of the present invention. Figure 3 , an embodiment of the intention recognition device based on artificial intelligence in the embodiment of the present invention includes:
[0077] The collection unit 301 is used to collect initial data from a preset forum website at a regular interval;
[0078] A preprocessing unit 302 is used to perform data preprocessing on the initial data according to a preset service to obtain question text sentences;
[0079] The calculation unit 303 is used to calculate the angle cosine value of the question text sentences and the preset question sentence according to the order in which the question text sentences are processed by using the word frequency-inverse text frequency index algorithm, and determine the target answer according to the angle cosine value;
[0080] The intention recognition unit 304 is used to perform intention recognition on the question text sentence through a deep neural network text classification model to obtain a template type;
[0081] The reply unit 305 is used to combine the question text sentences, target answers and preset links according to the template type, and intelligently reply to the spliced content through the preset crawler task. The preset link is used to instruct the target user to access the target online question-answering system.
[0082] In an embodiment of the present invention, questions are captured from a target forum at a regular interval by a crawler task, the captured questions are identified and answered by an intelligent question-and-answer engine, and replies are directed based on the answer content by the crawler task, thereby directing users to a target page for intelligent question-and-answering, thereby improving the timeliness and accuracy of replies and the efficiency of directing user traffic.
[0083] See also Figure 4 Another embodiment of the intention recognition device based on artificial intelligence in the embodiment of the present invention includes:
[0084] The collection unit 301 is used to collect initial data from a preset forum website at a regular interval;
[0085] A preprocessing unit 302 is used to perform data preprocessing on the initial data according to a preset service to obtain question text sentences;
[0086] The calculation unit 303 is used to calculate the angle cosine value of the question text sentences and the preset question sentence according to the order in which the question text sentences are processed by using the word frequency-inverse text frequency index algorithm, and determine the target answer according to the angle cosine value;
[0087] The intention recognition unit 304 is used to perform intention recognition on the question text sentence through a deep neural network text classification model to obtain a template type;
[0088] The reply unit 305 is used to combine the question text sentences, target answers and preset links according to the template type, and intelligently reply to the spliced content through the preset crawler task. The preset link is used to instruct the target user to access the target online question-answering system.
[0089] Optionally, the collection unit 301 may also be specifically used for:
[0090] Determine the uniform resource locator address of the preset forum website;
[0091] Regularly access the preset forum website through the preset crawler task and the uniform resource locator address of the preset forum website to obtain web page data;
[0092] The web page data is intercepted according to the preset page identifier to obtain initial data, which includes escape characters, spaces, web page tags and web page content;
[0093] The initial data and the uniform resource locator address of the preset forum website are recorded in the preset data table.
[0094] Optionally, the preprocessing unit 302 may also be specifically configured to:
[0095] Determine the keywords of the preset business and extract the initial data based on the keywords;
[0096] By using text processing, the escape characters and spaces are deleted from the extracted data, and the web page tags are deleted to obtain text data;
[0097] The text data is processed into sentences, and the sentences with empty strings are deleted to obtain the problem text sentences.
[0098] Optionally, the calculation unit 303 may further include:
[0099] A preprocessing subunit 3031 is used to preprocess the question text sentences according to the order in which they are processed to obtain an initial vocabulary and a first question sentence vector;
[0100] The text processing subunit 3032 is used to perform text vectorization on the preset question sentence according to the word frequency-inverse text frequency index algorithm and the initial vocabulary to obtain a second question sentence vector;
[0101] The calculation subunit 3033 is used to calculate the first question vector and the second question vector to obtain the cosine value of the angle, and set the answer corresponding to the preset question with the largest cosine value of the angle as the target answer.
[0102] Optionally, the preprocessing subunit 3031 is further specifically used for:
[0103] Writing multiple question text statements to the tail of the preset message queue in the order in which they are processed;
[0104] Set a timeout for the question text sentence, which should be greater than or equal to 0;
[0105] When the timeout duration corresponding to the question text sentence is equal to 0 and the question text sentence is still in a waiting state, the question text sentence is added to a delayed task queue, which is used to process the overdue question text sentence;
[0106] When the timeout duration corresponding to the question text sentence is greater than 0, the question text sentence is segmented and POS tagged to obtain the initial vocabulary and the first question vector.
[0107] Optionally, the text processing subunit 3032 is further specifically configured to:
[0108] Get the initial vocabulary, which includes multiple words , is a positive integer;
[0109] Read the number of preset questions from the preset database ;
[0110] Count multiple words based on the word frequency-inverse text frequency index algorithm The number of times it appears in the question text sentence ;
[0111] Count the number of words in the pre-question sentence Number of questions ;
[0112] The preset question is vectorized according to the first preset formula to obtain a second question vector, wherein the first preset formula , .
[0113] Optionally, the computing subunit 3033 is further specifically configured to:
[0114] Set the first question vector to ;
[0115] The first question vector and the second question vector are calculated according to the second preset formula to obtain the cosine value of the angle. The second preset formula is: ,in, is the first question vector, is the second question vector, Used to indicate that the first question vector is determined based on the cosine value of the angle and the second question vector similarity;
[0116] The answers corresponding to the preset questions are sorted in descending order according to the cosine value of the angle, and the answer corresponding to the preset question with the largest cosine value of the angle is set as the target answer.
[0117] In an embodiment of the present invention, questions are captured from a target forum at a regular interval by a crawler task, the captured questions are identified and answered by an intelligent question-and-answer engine, and replies are directed based on the answer content by the crawler task, thereby directing users to a target page for intelligent question-and-answering, thereby improving the timeliness and accuracy of replies and the efficiency of directing user traffic.
[0118] above Figure 3 and Figure 4 The artificial intelligence-based intention recognition device in the embodiment of the present invention is described in detail from the perspective of modular functional entities, and the artificial intelligence-based intention recognition device in the embodiment of the present invention is described in detail from the perspective of hardware processing.
[0119] Figure 5 It is a structural diagram of an intention recognition device based on artificial intelligence provided by an embodiment of the present invention. The intention recognition device 500 based on artificial intelligence may have relatively large differences due to different configurations or performances, and may include one or more processors (central processing units, CPU) 501 (for example, one or more processors) and a memory 509, and one or more storage media 508 (for example, one or more mass storage devices) storing application programs 507 or data 506. Among them, the memory 509 and the storage medium 508 can be short-term storage or permanent storage. The program stored in the storage medium 508 may include one or more modules (not shown in the figure), and each module may include a series of instruction operations in the intention recognition device based on artificial intelligence. Furthermore, the processor 501 can be configured to communicate with the storage medium 508 to execute a series of instruction operations in the storage medium 508 on the intention recognition device based on artificial intelligence 500.
[0120] The artificial intelligence-based intention recognition device 500 may also include one or more power supplies 502, one or more wired or wireless network interfaces 503, one or more input and output interfaces 504, and / or one or more operating systems 505, such as Windows Serve, Mac OS X, Unix, Linux, FreeBSD, etc. It will be appreciated by those skilled in the art that Figure 5 The structure of the artificial intelligence-based intention recognition device shown in the figure does not constitute a limitation of the artificial intelligence-based intention recognition device, and may include more or fewer components than shown in the figure, or a combination of certain components, or a different arrangement of components.
[0121] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working processes of the systems, devices and units described above can refer to the corresponding processes in the aforementioned method embodiments and will not be repeated here.
[0122] In the several embodiments provided by the present invention, it should be understood that the disclosed systems, devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic. For example, the division of the units is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be an indirect coupling or communication connection through some interfaces, devices or units, which can be electrical, mechanical or other forms.
[0123] As described above, the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit the same. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that the technical solutions described in the aforementioned embodiments may still be modified, or some of the technical features thereof may be replaced by equivalents. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present invention.
Claims
1. An intention recognition method based on artificial intelligence, characterized in that: include: Collect initial data from preset forum websites regularly; Performing data preprocessing on the initial data according to preset services to obtain question text sentences; Calculating the angle cosine value of the question text sentences according to the order in which they are processed by using the word frequency-inverse text frequency index algorithm, and determining the target answer according to the angle cosine value; Performing intent recognition on the question text sentences through a deep neural network text classification model to obtain a template type; Combining the question text sentences, the target answer and the preset link according to the template type, and intelligently replying to the spliced content through the preset crawler task, wherein the preset link is used to instruct the target user to access the target online question-answering system; The step of calculating the angle cosine value of the question text sentences according to the order in which they are processed by using the word frequency-inverse text frequency index algorithm, and determining the target answer according to the angle cosine value includes: preprocessing the question text sentences according to the order in which they are processed to obtain an initial vocabulary and a first question vector; performing text vectorization on the preset question according to the word frequency-inverse text frequency index algorithm and the initial vocabulary to obtain a second question vector; calculating the first question vector and the second question vector to obtain the angle cosine value, and setting the answer corresponding to the preset question with the largest angle cosine value as the target answer; The method pre-processes the question text sentences in the order in which they are processed to obtain an initial vocabulary and a first question vector, including: writing multiple question text sentences into the tail of a preset message queue in the order in which they are processed; setting a timeout period for the question text sentences, wherein the timeout period is greater than or equal to 0; when the timeout period corresponding to the question text sentence is equal to 0 and the question text sentence is still in a waiting state, adding the question text sentence to a delayed task queue, wherein the delayed task queue is used to process overdue question text sentences; when the timeout period corresponding to the question text sentence is greater than 0, segmenting and part-of-speech tagging the question text sentence to obtain an initial vocabulary and a first question vector.
2. The intention recognition method based on artificial intelligence according to claim 1, characterized in that: The periodic collection of initial data from the preset forum website includes: Determine the uniform resource locator address of the preset forum website; Regularly access the preset forum website through the preset crawler task and the uniform resource locator address of the preset forum website to obtain web page data; The web page data is intercepted according to the preset page identifier to obtain initial data, wherein the initial data includes an escape character, a space, a web page tag and web page content; The initial data and the uniform resource locator address of the preset forum website are recorded in a preset data table.
3. The intention recognition method based on artificial intelligence according to claim 2 is characterized in that: The step of preprocessing the initial data according to the preset service to obtain question text sentences includes: Determining keywords of preset services, and extracting the initial data according to the keywords; Deleting the escape character and the space from the extracted data by text processing, and deleting the web page tag to obtain text data; The text data is processed into sentences, and sentences with empty character strings are deleted to obtain question text sentences.
4. The intention recognition method based on artificial intelligence according to claim 1, characterized in that: The step of performing text vectorization on the preset question according to the word frequency-inverse text frequency index algorithm and the initial vocabulary to obtain a second question vector includes: Obtain an initial vocabulary, wherein the initial vocabulary includes a plurality of words , is a positive integer; Read the number of preset questions from the preset database ; The plurality of words are counted according to a word frequency-inverse text frequency index algorithm The number of times it appears in the question text sentence ; Count the number of words included in the preset question Number of questions ; The preset question is vectorized according to a first preset formula to obtain a second question vector, wherein the first preset formula , , k represents the jth pre-set question.
5. The artificial intelligence-based intention recognition method according to claim 1 or 4, characterized in that: The calculating the first question vector and the second question vector to obtain the angle cosine value, and setting the answer corresponding to the preset question with the largest angle cosine value as the target answer, comprises: The first question vector and the second question vector are calculated according to a second preset formula to obtain the cosine value of the angle, where the second preset formula is: , wherein the is the first question vector, is the second question vector, Used to indicate that the first question vector is determined according to the cosine value of the angle and the second question vector similarity; The answers corresponding to the preset question sentences are sorted in descending order according to the cosine value of the angle, and the answer corresponding to the preset question sentence with the largest cosine value of the angle is set as the target answer.
6. An intention recognition device based on artificial intelligence, characterized in that: The artificial intelligence-based intention recognition device includes: A collection unit, used to collect initial data from a preset forum website at regular intervals; A preprocessing unit, used for performing data preprocessing on the initial data according to preset services to obtain question text sentences; A calculation unit, used for calculating the angle cosine value of the question text sentences according to the order in which they are processed by using the word frequency-inverse text frequency index algorithm, and determining the target answer according to the angle cosine value; An intention recognition unit, used to perform intention recognition on the question text sentence through a deep neural network text classification model to obtain a template type; A reply unit, used to combine the question text sentence, the target answer and the preset link according to the template type, and intelligently reply to the spliced content through a preset crawler task, wherein the preset link is used to instruct the target user to access the target online question-answering system; The step of calculating the angle cosine value of the question text sentences according to the order in which they are processed by using the word frequency-inverse text frequency index algorithm, and determining the target answer according to the angle cosine value includes: preprocessing the question text sentences according to the order in which they are processed to obtain an initial vocabulary and a first question vector; performing text vectorization on the preset question according to the word frequency-inverse text frequency index algorithm and the initial vocabulary to obtain a second question vector; calculating the first question vector and the second question vector to obtain the angle cosine value, and setting the answer corresponding to the preset question with the largest angle cosine value as the target answer; The method pre-processes the question text sentences in the order in which they are processed to obtain an initial vocabulary and a first question vector, including: writing multiple question text sentences into the tail of a preset message queue in the order in which they are processed; setting a timeout period for the question text sentences, wherein the timeout period is greater than or equal to 0; when the timeout period corresponding to the question text sentence is equal to 0 and the question text sentence is still in a waiting state, adding the question text sentence to a delayed task queue, wherein the delayed task queue is used to process overdue question text sentences; when the timeout period corresponding to the question text sentence is greater than 0, segmenting and part-of-speech tagging the question text sentence to obtain an initial vocabulary and a first question vector.
7. An intention recognition device based on artificial intelligence, characterized in that: The artificial intelligence-based intention recognition device includes: a memory and at least one processor, the memory stores instructions, and the memory and the at least one processor are interconnected via a line; The at least one processor calls the instructions in the memory so that the artificial intelligence-based intention recognition device executes the artificial intelligence-based intention recognition method as described in any one of claims 1-5.
8. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the artificial intelligence-based intention recognition method as described in any one of claims 1 to 5 is implemented.
Citation Information
Patent Citations
Intelligent question answering method, apparatus, computer device and storage medium
CN109522393A
Speech based learning / training system using semantic decoding
US20040030556A1