CN111259209B - User intention prediction method based on artificial intelligence, electronic device and storage medium - Google Patents
User intention prediction method based on artificial intelligence, electronic device and storage medium Download PDFInfo
- Publication number
- CN111259209B CN111259209B CN202010029173.1A CN202010029173A CN111259209B CN 111259209 B CN111259209 B CN 111259209B CN 202010029173 A CN202010029173 A CN 202010029173A CN 111259209 B CN111259209 B CN 111259209B
- Authority
- CN
- China
- Prior art keywords
- intention
- keywords
- query statement
- semantic features
- user
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Active
Links
- 238000000034 method Methods 0.000 title claims abstract description 40
- 238000013473 artificial intelligence Methods 0.000 title claims abstract description 18
- 238000004364 calculation method Methods 0.000 claims abstract description 87
- 238000009826 distribution Methods 0.000 claims description 42
- 238000005259 measurement Methods 0.000 claims description 18
- 238000012549 training Methods 0.000 claims description 8
- 238000004220 aggregation Methods 0.000 claims 2
- 230000002776 aggregation Effects 0.000 claims 2
- 230000006870 function Effects 0.000 abstract description 6
- 238000012545 processing Methods 0.000 abstract description 6
- 238000007405 data analysis Methods 0.000 description 4
- 238000010586 diagram Methods 0.000 description 4
- 239000000284 extract Substances 0.000 description 4
- 230000008569 process Effects 0.000 description 4
- 230000004931 aggregating effect Effects 0.000 description 2
- 238000004458 analytical method Methods 0.000 description 2
- 230000000295 complement effect Effects 0.000 description 2
- 238000012937 correction Methods 0.000 description 2
- 238000013136 deep learning model Methods 0.000 description 2
- 238000001914 filtration Methods 0.000 description 2
- 230000003287 optical effect Effects 0.000 description 2
- 238000012216 screening Methods 0.000 description 2
- 238000004891 communication Methods 0.000 description 1
- 230000008094 contradictory effect Effects 0.000 description 1
- 230000000694 effects Effects 0.000 description 1
- 238000005516 engineering process Methods 0.000 description 1
- 230000010365 information processing Effects 0.000 description 1
- 230000003993 interaction Effects 0.000 description 1
- 238000012986 modification Methods 0.000 description 1
- 230000004048 modification Effects 0.000 description 1
- 230000003068 static effect Effects 0.000 description 1
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/90—Details of database functions independent of the retrieved data types
- G06F16/903—Querying
- G06F16/9032—Query formulation
- G06F16/90332—Natural language query formulation or dialogue systems
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/90—Details of database functions independent of the retrieved data types
- G06F16/903—Querying
- G06F16/9038—Presentation of query results
Landscapes
- Engineering & Computer Science (AREA)
- Physics & Mathematics (AREA)
- Databases & Information Systems (AREA)
- Theoretical Computer Science (AREA)
- Mathematical Physics (AREA)
- Computational Linguistics (AREA)
- Data Mining & Analysis (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Artificial Intelligence (AREA)
- Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
Abstract
The invention relates to the technical field of data processing, and provides an artificial intelligence-based user intention prediction method, an electronic device and a computer storage medium, wherein the method comprises the following steps: receiving a query sentence input by a user, analyzing a plurality of keywords, inputting a pre-trained recognition model, extracting semantic features corresponding to the keywords, and counting the number of the keywords; when the number of the keywords of the semantic features of the intention is zero, the intention of the query statement is predicted according to the condition, the dimension, the calculation method and the number of the keywords corresponding to the measured semantic features according to a preset matching rule, and finally, the query statement is corrected according to the predicted intention to search to obtain target data, and an expected graph and a data table corresponding to the query statement are generated. According to the invention, the query intent of the user is analyzed and predicted according to the query statement input by the user to search, the obtained search data are displayed to the user in different graphic functions, the displayed graphics are ensured to meet the user requirements, and the experience of the user is further improved.
Description
Technical Field
The present invention relates to the field of data processing technologies, and in particular, to an artificial intelligence based user intention prediction method, an electronic device, and a computer readable storage medium.
Background
Many existing software has a data query function based on natural language. To assist the user in better analyzing the data from multiple perspectives, the software presents the queried data to the user in different graphical functions, such as line graphs, bar graphs, pie charts, and the like, through a data sheet. And outputting the corresponding data table with graphic presentation by different query sentences input by the user.
However, the user has the following drawbacks in making a query using software:
1. before the user inputs the query statement, the user needs to define what kind of graphic display effect is wanted in advance, and the graphic display requirement wanted by the user is often ambiguous;
2. for natural language input by the user, the software fails to parse correctly, so that the displayed graph may not meet the user requirement.
Accordingly, there is a need for a system and method that can analyze and predict the intent of a user query.
Disclosure of Invention
In view of the above, the present invention provides a user intention prediction method, an electronic device and a computer readable storage medium based on artificial intelligence, which mainly aims to analyze and predict a query intention of a user according to a query statement input by the user to search, obtain search data, display the search data to the user with different graphic functions, ensure that the displayed graphic meets the user requirement, and further improve the experience of the user.
In order to achieve the above object, the present invention provides an artificial intelligence based user intention prediction method, which is applied to an electronic device, and the method comprises:
a receiving step: receiving a query statement input by a user through a terminal, analyzing the query statement and extracting a plurality of keywords;
and (3) counting: inputting the keywords into a pre-trained recognition model, extracting semantic features corresponding to the keywords, and counting the number of the keywords contained in each semantic feature, wherein the semantic features comprise conditions, dimensions, calculation methods, measurement and intention;
and a prediction step: when the number of keywords contained in the counted intention semantic features is zero, judging that the intention of the query statement input by a user is ambiguous, predicting the intention of the query statement according to the counted condition, dimension, calculation method and the number of keywords contained in the measured semantic features and a preset matching rule, wherein each predicted intention corresponds to an expected graph;
generating: and correcting the query statement according to the predicted intention, carrying out data retrieval in a database to obtain target data, and generating an expected graph corresponding to the query statement and a data table contained in the expected graph according to the target data.
In addition, in order to achieve the above object, the present invention also provides an electronic device including a memory and a processor, wherein an intention query program executable on the processor is stored in the memory, and the intention query program when executed by the processor realizes the steps of:
a receiving step: receiving a query statement input by a user through a terminal, analyzing the query statement and extracting a plurality of keywords;
and (3) counting: inputting the keywords into a pre-trained recognition model, extracting semantic features corresponding to the keywords, and counting the number of the keywords contained in each semantic feature, wherein the semantic features comprise conditions, dimensions, calculation methods, measurement and intention;
and a prediction step: when the number of keywords contained in the counted intention semantic features is zero, judging that the intention of the query statement input by a user is not clear, predicting the intention of the query statement according to the counted condition, dimension, calculation method and the number of keywords contained in the measured semantic features according to a preset matching rule, wherein each predicted intention corresponds to an expected graph;
generating: and correcting the query statement according to the predicted intention, carrying out data retrieval in a database to obtain target data, and generating an expected graph corresponding to the query statement and a data table contained in the expected graph according to the target data.
In addition, in order to achieve the above object, the present invention also provides a computer-readable storage medium including an intention query program therein, which when executed by a processor, can implement any one of the steps of the artificial intelligence-based user intention prediction method as described above
The invention provides an artificial intelligence-based user intention prediction method, an electronic device and a computer-readable storage medium, which are characterized in that a plurality of keywords are analyzed by receiving query sentences input by a user, the keywords are input into a pre-trained recognition model to extract semantic features corresponding to the keywords, and the number of the keywords contained in the semantic features corresponding to conditions, dimensions, calculation methods, measurement and intention is counted; when the number of keywords of the intention semantic features is zero, predicting the intention of the query statement according to the number of keywords corresponding to other statistical semantic features and a preset matching rule, and finally, correcting the query statement according to the predicted intention, searching in a database to obtain target data, and generating an expected graph corresponding to the query statement and a data table contained in the expected graph. According to the invention, the query intent of the user is analyzed and predicted according to the query statement input by the user to search, the obtained search data are displayed to the user in different graphic functions, the displayed graphics are ensured to meet the user requirements, and the experience of the user is further improved.
Drawings
FIG. 1 is a schematic diagram of an electronic device according to a preferred embodiment of the invention;
FIG. 2 is a block diagram of a preferred embodiment of the intent query program of FIG. 1;
FIG. 3 is a flow chart of a preferred embodiment of the artificial intelligence based user intent prediction method of the present invention;
the achievement of the objects, functional features and advantages of the present invention will be further described with reference to the accompanying drawings, in conjunction with the embodiments.
Detailed Description
The present invention will be described in further detail with reference to the drawings and examples, in order to make the objects, technical solutions and advantages of the present invention more apparent. It should be understood that the specific embodiments described herein are for purposes of illustration only and are not intended to limit the scope of the invention. All other embodiments, which can be made by those skilled in the art based on the embodiments of the invention without making any inventive effort, are intended to be within the scope of the invention.
It should be noted that the description of "first", "second", etc. in this disclosure is for descriptive purposes only and is not to be construed as indicating or implying a relative importance or implying an indication of the number of technical features being indicated. Thus, a feature defining "a first" or "a second" may explicitly or implicitly include at least one such feature. In addition, the technical solutions of the embodiments may be combined with each other, but it is necessary to base that the technical solutions can be realized by those skilled in the art, and when the technical solutions are contradictory or cannot be realized, the combination of the technical solutions should be considered to be absent and not within the scope of protection claimed in the present invention.
Referring to fig. 1, a schematic diagram of a preferred embodiment of an electronic device according to the present invention is shown. The electronic apparatus 1 is a device capable of automatically performing numerical calculation and/or information processing in accordance with a preset or stored instruction. The electronic device 1 may be a computer, a server group formed by a single network server, a plurality of network servers, or a cloud formed by a large number of hosts or network servers based on cloud computing, wherein the cloud computing is one of distributed computing, and is a super virtual computer formed by a group of loosely coupled computer sets.
In the present embodiment, the electronic device 1 may include, but is not limited to, a memory 11, a processor 12, and a display 13, which may be communicatively connected to each other through a system bus, and the memory 11 stores an intention query program 10 that may be run on the processor 12. It is noted that fig. 1 only shows an electronic device 1 with components 11-13, but it is understood that not all shown components are required to be implemented, and that more or fewer components may alternatively be implemented.
Wherein the storage 11 comprises a memory and at least one type of readable storage medium. The memory provides a buffer for the operation of the electronic device 1; the readable storage medium may be a non-volatile storage medium such as flash memory, hard disk, multimedia card, card memory (e.g., 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, magnetic disk, optical disk, etc. In some embodiments, the readable storage medium may be an internal storage unit of the electronic device 1, such as a hard disk of the electronic device 1; in other embodiments, the nonvolatile storage medium may also be an external storage device of the electronic apparatus 1, such as a plug-in hard disk, a Smart Media Card (SMC), a Secure Digital (SD) Card, a Flash memory Card (Flash Card) or the like, which are provided on the electronic apparatus 1. In this embodiment, the readable storage medium of the memory 11 is generally used for storing an operating system and various application software installed in the electronic device 1, for example, storing the intention query program 10 in an embodiment of the present invention. Further, the memory 11 may be used to temporarily store various types of data that have been output or are to be output.
The processor 12 may be a central processing unit (Central Processing Unit, CPU), controller, microcontroller, microprocessor, or other data processing chip in some embodiments. The processor 12 is typically used for controlling the overall operation of the electronic apparatus 1, e.g. for performing control and processing related to data interaction or communication with the other devices, etc. In this embodiment, the processor 12 is configured to execute the program code or process data stored in the memory 11, for example, to execute the intention query program 10.
The intent query program 10 is stored in a memory 11, comprising computer readable instructions stored in the memory 11, which are executable by a processor 12 to implement the methods of the embodiments of the present application.
In one embodiment, the intent query procedure 10, when executed by the processor 12, performs the following steps:
a receiving step: and receiving a query statement input by a user through a terminal, analyzing the query statement and extracting a plurality of keywords.
For example, in one embodiment, a user inputs a query sentence of "Shanghai Male occupation distribution" through a terminal (e.g., a computer, a mobile phone, or an application APP), identifies and analyzes sentence components of the query sentence, parses out keywords (e.g., keywords: shanghai, male, occupation, distribution) of the query sentence, and extracts the keywords.
And (3) counting: inputting the keywords into a pre-trained recognition model, extracting semantic features corresponding to the keywords, and counting the number of the keywords contained in each semantic feature, wherein the semantic features comprise conditions, dimensions, calculation methods, measurement and intention.
In this embodiment, the condition, dimension, calculation method, measurement and intended semantic features corresponding to the keywords are extracted through the recognition model, and the number of keywords containing each semantic feature is counted.
The conditional semantic features are denoted by F (Filter) and refer to keywords such as "Shanghai", "Male" as data screening or filtering;
the Dimension semantic features are denoted by D (Dimension), which refers to the Dimension in which the final graphic presentation presents keywords, e.g. "occupation";
the computation method semantic features are denoted by m (method), and refer to keywords of computation of metrics, such as "average";
the metric semantic feature is denoted by M (Measure), and refers to a keyword, such as "age", which is a statistical object;
the intention semantic feature is represented by I (intelt), and refers to a graphic display result, such as "distribution", which the user desires to acquire.
Further, the pre-trained recognition model includes:
obtaining keywords;
classifying the field attributes of the keywords into preset semantic features, wherein the semantic features comprise conditions, dimensions, calculation methods, measurement and intention;
training an identification model based on keywords contained in each semantic feature obtained through classification, obtaining the semantic feature corresponding to the keyword, and completing training of the identification model.
Specifically, the recognition model is a deep learning model, and can perform semantic understanding according to field attributes of the trained keywords and recognize semantic features corresponding to the keywords, wherein the semantic features comprise conditions, dimensions, calculation methods, measurement and intention. When a plurality of keywords are extracted from a query sentence input by a user, the semantic features corresponding to each keyword can be identified through an identification model.
For example, in one embodiment, the query statement input by the user is "average age distribution of different professions for Shanghai males", the extracted keywords are "Shanghai", "male", "professional", "average", "age" and "distribution", and the conditional semantic features are "Shanghai", "male" obtained by using the recognition model; the dimension semantic feature is 'occupation'; the semantic features of the calculation method are 'average'; the metric semantic feature is "age"; the intended semantic feature is a "distribution".
And a prediction step: when the number of keywords contained in the counted intention semantic features is zero, judging that the intention of the query statement input by a user is ambiguous, predicting the intention of the query statement according to the counted condition, dimension, calculation method and the number of keywords contained in the measured semantic features according to a preset matching rule, wherein each predicted intention corresponds to an expected graph.
When the intent of the query statement is ambiguous, it is difficult for the system to give a correct graphical presentation. In order to overcome the difficulty, the method predicts the intention of the query sentence according to the preset matching rule by using the counted condition, dimension, calculation method and the number of keywords contained in the semantic features of the measurement, so as to complete the intention of the query sentence with ambiguous intention input by the user.
In this embodiment, the preset is performed for each predicted intention corresponding to one expected pattern. The intended keywords comprise counts, distributions, duty ratios, contrasts, primary and secondary distributions and correlations, the expected patterns comprise counts, bar graphs, pie charts, two columns of bar graphs, transverse bar graphs and aggregate bar graphs, and each intended keyword corresponds to each expected pattern respectively. For example, the number of the cells to be processed,
a. the key words of the query statement of 'how many people the Shanghai men have' are counted, and the corresponding expected graph is displayed by a digital graph;
b. the keyword of the intention of which the query statement is 'Shanghai male occupational distribution' is distribution, and the corresponding expected graph is displayed in a histogram;
c. the query statement is that the keywords of the intention of 'the proportion of the marriage of the Shanghai male' are in proportion, and the corresponding expected graph is displayed in a pie chart;
d. the query statement is that the keywords of the intention of 'male and female income comparison' are compared, and the corresponding expected graph is displayed in two columns of bar graphs;
e. the keywords of the query statement which are the intention of the first ten professions with higher average income are distributed as primary and secondary, and the corresponding expected graph is displayed in a horizontal bar graph;
f. how does a query statement be "how relevant to profession and academy? "the intended keyword is a correlation, the corresponding intended graph is shown in an aggregate histogram.
Further, the preset matching rule further includes:
classifying intention condition combinations corresponding to each expected graph according to the expected graph, wherein each intention condition combination consists of one or more of conditions, dimensions, calculation methods and measured semantic features;
according to the pre-counted conditions, dimensions, calculation methods and the number of keywords contained in the measured semantic features, one intention condition combination meeting the requirements of the semantic features and corresponding to the number of keywords is screened out from all the intention condition combinations;
and determining a corresponding expected graph according to the screened intent condition combination.
In this embodiment, the expected graph is determined by the predicted intent, where the expected graph (count graph, histogram, pie chart, two columns of histogram, horizontal histogram, and aggregate histogram) corresponds to one keyword of intent (count, distribution, duty ratio, contrast, primary and secondary distribution, and correlation), respectively, and the intent of the predicted user query statement is determined by an intent condition combination consisting of the number of keywords corresponding to the semantic features of the condition, dimension, calculation method, and metric. The corresponding scenario for each combination of intent conditions is as follows:
1. the intent condition combination for counting the keywords corresponding to the counting graph comprises the following steps:
a. the condition f+.0, dimension d=0, calculation method m=0, metric m=0;
b. calculation method m=0, metric m=0;
2. the intent condition combination that the keywords corresponding to the histogram are distributed comprises:
a. dimension d=1, calculation method m=0, metric m=0;
b. dimension d=1, calculation method m=0, metric m=1;
c. dimension d=1, calculation method m=1, metric m=1;
d. dimension d=1, calculation method m=2, metric m=2;
3. the intention condition combination of the key words corresponding to the pie chart in proportion comprises the following steps:
a. the dimension d=1 and,
b. dimension d=1, calculation method m=0, metric m=1;
c. dimension d=0, calculation method m=1, metric m=1;
d. dimension d=2, calculation method m=0, metric m=1;
e. dimension d=2, calculation method m=1, metric m=2;
4. the intention condition combination for comparing the keywords corresponding to the two columns of bar graphs comprises:
a. dimension d=1, calculation method m=2, metric m=2;
b. dimension d=1, calculation method m=1, metric m=1;
c. the condition f=2, the calculation method m=1, the metric m=1;
d. the condition f=2, the calculation method m=2, the metric m=2;
5. the intention condition combination of the key words corresponding to the horizontal bar graph as the primary and secondary distribution comprises the following steps:
a. dimension d=2, calculation method m=0, metric m=0;
b. dimension d=2, calculation method m=1, metric m=1;
c. dimension d=2, calculation method m=0, metric m=1;
6. the intent condition combination for aggregating keywords corresponding to the histogram as relevance includes:
a. dimension d=2, calculation method m=0, metric m=0;
b. dimension d=2, calculation method m=1, metric m=1;
and setting a scene of corresponding intention condition combinations through the number of the semantic features of the keyword representation, wherein each intention condition combination corresponds to the keyword to be displayed by the prediction graph, so as to predict the prediction graph corresponding to the intention of the user query statement.
Further, in one embodiment, the predicting step further comprises:
when the number of the keywords contained in the counted intention semantic features is not zero, judging that the intention of the query statement input by the user is clear, and searching in the database according to the query statement to obtain a search result and displaying the search result to the user.
Further, the predicting the intent of the query sentence according to the number of the keywords corresponding to the counted conditions, dimensions, calculation methods and measured semantic features and a preset matching rule, and the method further includes:
when the two intention scenes are obtained by predicting the number of keywords corresponding to the statistical conditions, dimensions, calculation methods and measured semantic features according to a preset matching rule, word2vec is utilized to analyze the semantic application scenes of the keywords of the query statement, and the intention corresponding to the semantic application scenes of the query statement is determined.
For example, the query sentence is the keyword "distribution" of the "distribution ratio of the average age of the profession of the middle school student in Shanghai", and the "ratio" is the semantic feature of the intention, at this time, the word2vec is used to analyze the application scenario of the query sentence, that is, the average value of the analysis ages is reflected by the distribution to reflect the age display rule more conforming to the application scenario and the profession of the middle school student than the application ratio, so as to determine that the intention of the query sentence is the distribution, and the corresponding expected graph is a histogram.
In an alternative embodiment, the query sentence is "average age of occupation of students in Shanghai", and the number of keywords included in each semantic feature is counted, where f=1, dimension d=2, calculation method m=1, measure m=1, and intention is: i=0. The statistical result corresponds to the primary distribution and the secondary distribution and the correlation intentions in the preset matching rule, and the semantic application scene of the keyword of the query statement can be analyzed through the word2vec to screen out the intentions corresponding to the semantic application scene of the query statement.
Generating: and correcting the query statement according to the predicted intention, carrying out data retrieval in a database to obtain target data, and generating an expected graph corresponding to the query statement and a data table contained in the expected graph according to the target data.
The data table is a data analysis record table comprising results of data analysis graphically presented to a user. And correcting the query statement according to the predicted intention, wherein the correction can be to complement the intention key words in the query statement, retrieving target data from a database according to the corrected query statement, generating an expected graph corresponding to the query statement and a data table contained in the expected graph, and outputting the data table for a user to use.
Referring to FIG. 2, a block diagram of a preferred embodiment of the intent query program 10 of FIG. 1 is shown.
In one embodiment, the intent query program 10 includes: a receiving module 101, a statistics module 102, a prediction module 103, a generating module 104. The functions or operational steps implemented by the modules 101-104 are similar to the artificial intelligence based user intent prediction method described below, and will not be described in detail herein, for example, wherein:
the receiving module 101 is configured to receive a query sentence input by a user through a terminal, analyze the query sentence, and extract a plurality of keywords;
the statistics module 102 is configured to input the keywords into a pre-trained recognition model, extract semantic features corresponding to the keywords, and count the number of the keywords included in each semantic feature, where the semantic features include conditions, dimensions, calculation methods, metrics and intentions;
the prediction module 103 is configured to determine that the intent of the query sentence input by the user is ambiguous when the number of keywords included in the counted intent semantic features is zero, predict the intent of the query sentence according to a preset matching rule according to the counted condition, dimension, calculation method, and the number of keywords included in the measured semantic features, where each predicted intent corresponds to an expected graph;
and the generating module 104 is configured to correct the query statement according to the predicted intent, perform data retrieval in a database to obtain target data, and generate an expected graph corresponding to the query statement and a data table included in the expected graph according to the target data.
Referring to FIG. 3, a flowchart of a preferred embodiment of the artificial intelligence based user intent prediction method of the present invention is shown. The invention discloses an artificial intelligence-based user intention prediction method which is applied to the electronic device, and comprises the following steps:
step S210, receiving a query sentence input by a user through a terminal, analyzing the query sentence and extracting a plurality of keywords.
For example, in one embodiment, a user inputs a query sentence of "Shanghai Male occupation distribution" through a terminal (e.g., a computer, a mobile phone, or an application APP), identifies and analyzes sentence components of the query sentence, parses out keywords (e.g., keywords: shanghai, male, occupation, distribution) of the query sentence, and extracts the keywords.
Step S220, inputting the keywords into a pre-trained recognition model, extracting semantic features corresponding to the keywords, and counting the number of the keywords contained in each semantic feature, wherein the semantic features comprise conditions, dimensions, calculation methods, measurement and intention.
In this embodiment, the condition, dimension, calculation method, measurement and intended semantic features corresponding to the keywords are extracted through the recognition model, and the number of keywords containing each semantic feature is counted.
The conditional semantic features are denoted by F (Filter) and refer to keywords such as "Shanghai", "Male" as data screening or filtering;
the Dimension semantic features are denoted by D (Dimension), which refers to the Dimension in which the final graphic presentation presents keywords, e.g. "occupation";
the computation method semantic features are denoted by m (method), and refer to keywords of computation of metrics, such as "average";
the metric semantic feature is denoted by M (Measure), and refers to a keyword, such as "age", which is a statistical object;
the intention semantic feature is represented by I (intelt), and refers to a graphic display result, such as "distribution", which the user desires to acquire.
Further, the pre-trained recognition model includes:
obtaining keywords;
classifying the field attributes of the keywords into preset semantic features, wherein the semantic features comprise conditions, dimensions, calculation methods, measurement and intention;
training an identification model based on keywords contained in each semantic feature obtained through classification, obtaining the semantic feature corresponding to the keyword, and completing training of the identification model.
Specifically, the recognition model is a deep learning model, and can perform semantic understanding according to field attributes of the trained keywords and recognize semantic features corresponding to the keywords, wherein the semantic features comprise conditions, dimensions, calculation methods, measurement and intention. When a plurality of keywords are extracted from a query sentence input by a user, the semantic features corresponding to each keyword can be identified through an identification model.
For example, in one embodiment, the query statement input by the user is "average age distribution of different professions for Shanghai males", the extracted keywords are "Shanghai", "male", "professional", "average", "age" and "distribution", and the conditional semantic features are "Shanghai", "male" obtained by using the recognition model; the dimension semantic feature is 'occupation'; the semantic features of the calculation method are 'average'; the metric semantic feature is "age"; the intended semantic feature is a "distribution".
Step S230, when the number of keywords contained in the counted semantic features of the intention is zero, judging that the intention of the query sentence input by the user is ambiguous, predicting the intention of the query sentence according to the counted condition, dimension, calculation method and the number of keywords contained in the measured semantic features according to a preset matching rule, wherein each predicted intention corresponds to an expected graph.
When the intent of the query statement is ambiguous, it is difficult for the system to give a correct graphical presentation. In order to overcome the difficulty, the method predicts the intention of the query sentence according to the preset matching rule by using the counted condition, dimension, calculation method and the number of keywords contained in the semantic features of the measurement, so as to complete the intention of the query sentence with ambiguous intention input by the user.
In this embodiment, the preset is performed for each predicted intention corresponding to one expected pattern. The intended keywords comprise counts, distributions, duty ratios, contrasts, primary and secondary distributions and correlations, the expected patterns comprise counts, bar graphs, pie charts, two columns of bar graphs, transverse bar graphs and aggregate bar graphs, and each intended keyword corresponds to each expected pattern respectively. For example, the number of the cells to be processed,
a. the key words of the query statement of 'how many people the Shanghai men have' are counted, and the corresponding expected graph is displayed by a digital graph;
b. the keyword of the intention of which the query statement is 'Shanghai male occupational distribution' is distribution, and the corresponding expected graph is displayed in a histogram;
c. the query statement is that the keywords of the intention of 'the proportion of the marriage of the Shanghai male' are in proportion, and the corresponding expected graph is displayed in a pie chart;
d. the query statement is that the keywords of the intention of 'male and female income comparison' are compared, and the corresponding expected graph is displayed in two columns of bar graphs;
e. the keywords of the query statement which are the intention of the first ten professions with higher average income are distributed as primary and secondary, and the corresponding expected graph is displayed in a horizontal bar graph;
f. how does a query statement be "how relevant to profession and academy? "the intended keyword is a correlation, the corresponding intended graph is shown in an aggregate histogram.
Further, the preset matching rule further includes:
classifying intention condition combinations corresponding to each expected graph according to the expected graph, wherein each intention condition combination consists of one or more of conditions, dimensions, calculation methods and measured semantic features;
according to the pre-counted conditions, dimensions, calculation methods and the number of keywords contained in the measured semantic features, one intention condition combination meeting the requirements of the semantic features and corresponding to the number of keywords is screened out from all the intention condition combinations;
and determining a corresponding expected graph according to the screened intent condition combination.
In this embodiment, the expected graph is determined by the predicted intent, where the expected graph (count graph, histogram, pie chart, two columns of histogram, horizontal histogram, and aggregate histogram) corresponds to one keyword of intent (count, distribution, duty ratio, contrast, primary and secondary distribution, and correlation), respectively, and the intent of the predicted user query statement is determined by an intent condition combination consisting of the number of keywords corresponding to the semantic features of the condition, dimension, calculation method, and metric. The corresponding scenario for each combination of intent conditions is as follows:
1. the intent condition combination for counting the keywords corresponding to the counting graph comprises the following steps:
a. the condition f+.0, dimension d=0, calculation method m=0, metric m=0;
b. calculation method m=0, metric m=0;
2. the intent condition combination that the keywords corresponding to the histogram are distributed comprises:
a. dimension d=1, calculation method m=0, metric m=0;
b. dimension d=1, calculation method m=0, metric m=1;
c. dimension d=1, calculation method m=1, metric m=1;
d. dimension d=1, calculation method m=2, metric m=2;
3. the intention condition combination of the key words corresponding to the pie chart in proportion comprises the following steps:
a. the dimension d=1 and,
b. dimension d=1, calculation method m=0, metric m=1;
c. dimension d=0, calculation method m=1, metric m=1;
d. dimension d=2, calculation method m=0, metric m=1;
e. dimension d=2, calculation method m=1, metric m=2;
4. the intention condition combination for comparing the keywords corresponding to the two columns of bar graphs comprises:
a. dimension d=1, calculation method m=2, metric m=2;
b. dimension d=1, calculation method m=1, metric m=1;
c. the condition f=2, the calculation method m=1, the metric m=1;
d. the condition f=2, the calculation method m=2, the metric m=2;
5. the intention condition combination of the key words corresponding to the horizontal bar graph as the primary and secondary distribution comprises the following steps:
a. dimension d=2, calculation method m=0, metric m=0;
b. dimension d=2, calculation method m=1, metric m=1;
c. dimension d=2, calculation method m=0, metric m=1;
6. the intent condition combination for aggregating keywords corresponding to the histogram as relevance includes:
a. dimension d=2, calculation method m=0, metric m=0;
b. dimension d=2, calculation method m=1, metric m=1;
and setting a scene of corresponding intention condition combinations through the number of the semantic features of the keyword representation, wherein each intention condition combination corresponds to the keyword to be displayed by the prediction graph, so as to predict the prediction graph corresponding to the intention of the user query statement.
Further, in one embodiment, the step S230 further includes:
when the number of the keywords contained in the counted intention semantic features is not zero, judging that the intention of the query statement input by the user is clear, and searching in the database according to the query statement to obtain a search result and displaying the search result to the user.
Further, the predicting the intent of the query sentence according to the number of the keywords corresponding to the counted conditions, dimensions, calculation methods and measured semantic features and a preset matching rule, and the method further includes:
when the two intention scenes are obtained by predicting the number of keywords corresponding to the statistical conditions, dimensions, calculation methods and measured semantic features according to a preset matching rule, word2vec is utilized to analyze the semantic application scenes of the keywords of the query statement, and the intention corresponding to the semantic application scenes of the query statement is determined.
For example, the query sentence is the keyword "distribution" of the "distribution ratio of the average age of the profession of the middle school student in Shanghai", and the "ratio" is the semantic feature of the intention, at this time, the word2vec is used to analyze the application scenario of the query sentence, that is, the average value of the analysis ages is reflected by the distribution to reflect the age display rule more conforming to the application scenario and the profession of the middle school student than the application ratio, so as to determine that the intention of the query sentence is the distribution, and the corresponding expected graph is a histogram.
In an alternative embodiment, the query sentence is "average age of occupation of students in Shanghai", and the number of keywords included in each semantic feature is counted, where f=1, dimension d=2, calculation method m=1, measure m=1, and intention is: i=0. The statistical result corresponds to the primary distribution and the secondary distribution and the correlation intentions in the preset matching rule, and the semantic application scene of the keyword of the query statement can be analyzed through the word2vec to screen out the intentions corresponding to the semantic application scene of the query statement.
And step S240, correcting the query statement according to the predicted intention, carrying out data retrieval in a database to obtain target data, and generating an expected graph corresponding to the query statement and a data table contained in the expected graph according to the target data.
The data table is a data analysis record table comprising results of data analysis graphically presented to a user. And correcting the query statement according to the predicted intention, wherein the correction can be to complement the intention key words in the query statement, retrieving target data from a database according to the corrected query statement, generating an expected graph corresponding to the query statement and a data table contained in the expected graph, and outputting the data table for a user to use.
In addition, the present invention also provides a computer-readable storage medium including an intention query program therein, which when executed by a processor, can implement the following operations:
a receiving step: receiving a query statement input by a user through a terminal, analyzing the query statement and extracting a plurality of keywords;
and (3) counting: inputting the keywords into a pre-trained recognition model, extracting semantic features corresponding to the keywords, and counting the number of the keywords contained in each semantic feature, wherein the semantic features comprise conditions, dimensions, calculation methods, measurement and intention;
and a prediction step: when the number of keywords contained in the counted intention semantic features is zero, judging that the intention of the query statement input by a user is ambiguous, predicting the intention of the query statement according to the counted condition, dimension, calculation method and the number of keywords contained in the measured semantic features and a preset matching rule, wherein each predicted intention corresponds to an expected graph;
generating: and correcting the query statement according to the predicted intention, carrying out data retrieval in a database to obtain target data, and generating an expected graph corresponding to the query statement and a data table contained in the expected graph according to the target data.
The computer-readable storage medium of the present invention is substantially the same as the above-described embodiments of the user intention prediction method and the electronic device based on artificial intelligence, and will not be described in detail herein.
The foregoing embodiment numbers of the present invention are merely for the purpose of description, and do not represent the advantages or disadvantages of the embodiments.
It should be noted that, in this document, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, apparatus, article, or method that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, apparatus, article, or method. Without further limitation, an element defined by the phrase "comprising one … …" does not exclude the presence of other like elements in a process, apparatus, article or method that comprises the element.
From the above description of the embodiments, it will be clear to those skilled in the art that the above-described embodiment method may be implemented by means of software plus a necessary general hardware platform, but of course may also be implemented by means of hardware, but in many cases the former is a preferred embodiment. Based on such understanding, the technical solution of the present invention may be embodied essentially or in a part contributing to the prior art in the form of a software product stored in a storage medium (e.g. ROM/RAM, magnetic disk, optical disk) as described above, comprising instructions for causing a terminal device (which may be a mobile phone, a computer, a server, or a network device, etc.) to perform the method according to the embodiments of the present invention.
The foregoing description of the preferred embodiments of the present invention should not be taken as limiting the scope of the invention, but rather should be understood to cover all modifications, equivalents, and alternatives falling within the scope of the invention as defined by the following description and drawings, or by direct or indirect application to other relevant art(s).
Claims (8)
1. An artificial intelligence-based user intention prediction method is applied to an electronic device and is characterized by comprising the following steps:
a receiving step: receiving a query statement input by a user through a terminal, analyzing the query statement and extracting a plurality of keywords;
and (3) counting: inputting the keywords into a pre-trained recognition model, extracting semantic features corresponding to the keywords, and counting the number of the keywords contained in each semantic feature, wherein the semantic features comprise conditions, dimensions, calculation methods, measurement and intention;
and a prediction step: when the number of keywords contained in the counted intention semantic features is zero, judging that the intention of the query statement input by a user is not clear, predicting the intention of the query statement according to the counted condition, dimension, calculation method and the number of keywords contained in the counted semantic features according to a preset matching rule, presetting that each predicted intention corresponds to an expected graph respectively, wherein the keywords of the intention comprise count, distribution, duty ratio, comparison, primary and secondary distribution and correlation, the expected graph comprises a count graph, a histogram, a pie graph, two columns of histograms, a transverse histogram and an aggregation histogram, and each keyword of the intention corresponds to one expected graph respectively; the preset matching rule comprises the following steps: classifying intention condition combinations corresponding to each expected graph according to the expected graph, wherein each intention condition combination consists of one or more of conditions, dimensions, calculation methods and measured semantic features; according to the pre-counted conditions, dimensions, calculation methods and the number of keywords contained in the measured semantic features, one intention condition combination meeting the requirements of the semantic features and corresponding to the number of keywords is screened out from all the intention condition combinations; determining a corresponding expected graph according to the screened intent condition combination;
generating: and correcting the query statement according to the predicted intention, carrying out data retrieval in a database to obtain target data, and generating an expected graph corresponding to the query statement and a data table contained in the expected graph according to the target data.
2. The artificial intelligence based user intent prediction method as claimed in claim 1, wherein the pre-trained recognition model includes:
obtaining keywords;
classifying the field attributes of the keywords into preset semantic features, wherein the semantic features comprise conditions, dimensions, calculation methods, measurement and intention;
training an identification model based on keywords contained in each semantic feature obtained through classification, obtaining the semantic feature corresponding to the keyword, and completing training of the identification model.
3. The artificial intelligence based user intention prediction method according to claim 1, wherein the predicting step further comprises:
when the number of the keywords contained in the counted intention semantic features is not zero, judging that the intention of the query statement input by the user is clear, and searching in the database according to the query statement to obtain a search result and displaying the search result to the user.
4. The artificial intelligence based user intention prediction method according to any one of claims 1 to 3, wherein the predicting the intention of the query sentence according to a preset matching rule based on the number of keywords corresponding to the counted condition, dimension, calculation method and measured semantic feature further comprises:
when the two intention scenes are obtained by predicting the number of keywords corresponding to the counted conditions, dimensions, calculation methods and measured semantic features according to a preset matching rule, word2vec is utilized to analyze the semantic application scenes of the keywords of the query statement, and the intention corresponding to the semantic application scenes of the query statement is determined.
5. An electronic device comprising a memory and a processor, said memory having stored therein an intent query program executable on said processor, said intent query program when executed by said processor performing the steps of:
a receiving step: receiving a query statement input by a user through a terminal, analyzing the query statement and extracting a plurality of keywords;
and (3) counting: inputting the keywords into a pre-trained recognition model, extracting semantic features corresponding to the keywords, and counting the number of the keywords contained in each semantic feature, wherein the semantic features comprise conditions, dimensions, calculation methods, measurement and intention;
and a prediction step: when the number of keywords contained in the counted intention semantic features is zero, judging that the intention of the query statement input by a user is not clear, predicting the intention of the query statement according to the counted condition, dimension, calculation method and the number of keywords contained in the counted semantic features according to a preset matching rule, presetting that each predicted intention corresponds to an expected graph respectively, wherein the keywords of the intention comprise count, distribution, duty ratio, comparison, primary and secondary distribution and correlation, the expected graph comprises a count graph, a histogram, a pie graph, two columns of histograms, a transverse histogram and an aggregation histogram, and each keyword of the intention corresponds to one expected graph respectively; the preset matching rule comprises the following steps: classifying intention condition combinations corresponding to each expected graph according to the expected graph, wherein each intention condition combination consists of one or more of conditions, dimensions, calculation methods and measured semantic features; according to the pre-counted conditions, dimensions, calculation methods and the number of keywords contained in the measured semantic features, one intention condition combination meeting the requirements of the semantic features and corresponding to the number of keywords is screened out from all the intention condition combinations; determining a corresponding expected graph according to the screened intent condition combination;
generating: and correcting the query statement according to the predicted intention, carrying out data retrieval in a database to obtain target data, and generating an expected graph corresponding to the query statement and a data table contained in the expected graph according to the target data.
6. The electronic device of claim 5, wherein the pre-trained recognition model comprises:
obtaining keywords;
classifying the field attributes of the keywords into preset semantic features, wherein the semantic features comprise conditions, dimensions, calculation methods, measurement and intention;
training an identification model based on keywords contained in each semantic feature obtained through classification, obtaining the semantic feature corresponding to the keyword, and completing training of the identification model.
7. The electronic device of claim 5, wherein the predicting step further comprises:
when the number of the keywords contained in the counted intention semantic features is not zero, judging that the intention of the query statement input by the user is clear, and searching in the database according to the query statement to obtain a search result and displaying the search result to the user.
8. A computer readable storage medium, comprising an intention query program, wherein the intention query program, when executed by a processor, implements the steps of the artificial intelligence based user intention prediction method as claimed in any one of claims 1 to 4.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202010029173.1A CN111259209B (en) | 2020-01-10 | 2020-01-10 | User intention prediction method based on artificial intelligence, electronic device and storage medium |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202010029173.1A CN111259209B (en) | 2020-01-10 | 2020-01-10 | User intention prediction method based on artificial intelligence, electronic device and storage medium |
Publications (2)
Publication Number | Publication Date |
---|---|
CN111259209A CN111259209A (en) | 2020-06-09 |
CN111259209B true CN111259209B (en) | 2023-12-29 |
Family
ID=70948620
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202010029173.1A Active CN111259209B (en) | 2020-01-10 | 2020-01-10 | User intention prediction method based on artificial intelligence, electronic device and storage medium |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN111259209B (en) |
Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JP2013134730A (en) * | 2011-12-27 | 2013-07-08 | Omron Corp | Character-inputting program and information processor |
CN103914504A (en) * | 2012-12-28 | 2014-07-09 | 富士通株式会社 | Information processing apparatus and method for generating graphs |
CN105930505A (en) * | 2016-05-09 | 2016-09-07 | 广州神马移动信息科技有限公司 | Information search method and apparatus |
CN109542956A (en) * | 2018-10-17 | 2019-03-29 | 深圳壹账通智能科技有限公司 | Report form generation method, device, computer equipment and storage medium |
CN110162633A (en) * | 2019-05-21 | 2019-08-23 | 深圳市珍爱云信息技术有限公司 | Voice data is intended to determine method, apparatus, computer equipment and storage medium |
Family Cites Families (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20160299978A1 (en) * | 2015-04-13 | 2016-10-13 | Google Inc. | Device dependent search experience |
US10102256B2 (en) * | 2016-09-29 | 2018-10-16 | International Business Machines Corporation | Internet search result intention |
-
2020
- 2020-01-10 CN CN202010029173.1A patent/CN111259209B/en active Active
Patent Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JP2013134730A (en) * | 2011-12-27 | 2013-07-08 | Omron Corp | Character-inputting program and information processor |
CN103914504A (en) * | 2012-12-28 | 2014-07-09 | 富士通株式会社 | Information processing apparatus and method for generating graphs |
CN105930505A (en) * | 2016-05-09 | 2016-09-07 | 广州神马移动信息科技有限公司 | Information search method and apparatus |
CN109542956A (en) * | 2018-10-17 | 2019-03-29 | 深圳壹账通智能科技有限公司 | Report form generation method, device, computer equipment and storage medium |
CN110162633A (en) * | 2019-05-21 | 2019-08-23 | 深圳市珍爱云信息技术有限公司 | Voice data is intended to determine method, apparatus, computer equipment and storage medium |
Non-Patent Citations (1)
Title |
---|
张美珍 ; 王治莹 ; .基于用户查询意图的搜索排序算法.天津理工大学学报.(第03期), * |
Also Published As
Publication number | Publication date |
---|---|
CN111259209A (en) | 2020-06-09 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN110377558B (en) | Document query method, device, computer equipment and storage medium | |
CN110263248B (en) | Information pushing method, device, storage medium and server | |
CN108108426B (en) | Understanding method and device for natural language question and electronic equipment | |
CN106919575B (en) | Application program searching method and device | |
CN106445963B (en) | Advertisement index keyword automatic generation method and device of APP platform | |
CN110162754B (en) | Method and equipment for generating post description document | |
CN111428503B (en) | Identification processing method and processing device for homonymous characters | |
CN111553151A (en) | Question recommendation method and device based on field similarity calculation and server | |
CN113569968B (en) | Model training method, target detection method, device, equipment and storage medium | |
CN113283675A (en) | Index data analysis method, device, equipment and storage medium | |
CN112783825A (en) | Data archiving method, data archiving device, computer device and storage medium | |
CN110795942B (en) | Keyword determination method and device based on semantic recognition and storage medium | |
CN113468421A (en) | Product recommendation method, device, equipment and medium based on vector matching technology | |
CN113268597A (en) | Text classification method, device, equipment and storage medium | |
CN115544214B (en) | Event processing method, device and computer readable storage medium | |
CN112948526A (en) | User portrait generation method and device, electronic equipment and storage medium | |
CN111259209B (en) | User intention prediction method based on artificial intelligence, electronic device and storage medium | |
CN112685544A (en) | Telecommunication information query method, device, equipment and medium | |
CN111723210A (en) | Method and device for storing data table, computer equipment and readable storage medium | |
CN115935069A (en) | Search term determination method and device, computer equipment and storage medium | |
CN115186063A (en) | Service data processing method, device, equipment and storage medium | |
CN110909130B (en) | Text theme extraction and analysis method and device and computer readable storage medium | |
CN113988067A (en) | Sentence segmentation method and device and electronic equipment | |
CN114117057A (en) | Keyword extraction method of product feedback information and terminal equipment | |
CN117573956B (en) | Metadata management method, device, equipment and storage medium |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant |