Data analysis method, device, equipment, storage medium and program product
By segmenting the user-input text and outputting prompts, the system assists users in inputting complete query text, solving the problem of low complexity in mobile BI operations and enabling a more flexible data analysis process.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- CHINA CONSTRUCTION BANK
- Filing Date
- 2022-09-07
- Publication Date
- 2026-06-05
AI Technical Summary
In the process of data analysis in mobile BI, users need to input complex query statements and specify data dimensions, resulting in low operational flexibility and increasing the barrier to entry.
By acquiring the text input by the user, performing word segmentation, outputting prompts to instruct the user to input the complete text to be queried, and generating data analysis results based on the text to be queried, including matching processing of word segmentation results and generation of structured query statements.
It improves the flexibility of data analysis, lowers the barrier to entry for mobile BI, and makes it easier for users to conduct data analysis.
Smart Images

Figure CN115640311B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of data analysis technology, and in particular to a data analysis method, apparatus, device, storage medium, and program product. Background Technology
[0002] Business intelligence (BI), also known as business wisdom or commercial intelligence, is a technology that effectively extracts information from data, discovers knowledge from that information in a timely manner, and thus supports decision-making. Mobile BI has also become a tool for users to conduct data analysis anytime, anywhere.
[0003] The user workflow for data analysis using mobile BI typically includes requirements analysis, data extraction and processing, creation of BI analysis reports, and results publishing. In related technologies, this workflow is custom-developed by developers based on business needs. Users must input request information according to the rules set on the relevant operation page; for example, users need to input correctly formatted query statements and specify data dimensions and metrics. This data analysis method demands a high level of data analysis expertise from users, and the complex operations result in limited user flexibility. Summary of the Invention
[0004] This application provides a data analysis method, apparatus, device, storage medium, and program product to solve the problem that the complex operation of creating BI analysis reports in related technologies results in low user flexibility.
[0005] In a first aspect, embodiments of this application provide a data analysis method, including:
[0006] Get the first text entered by the user;
[0007] The first text is segmented to obtain a first segmentation result, which includes multiple first words in the first text and the first category of each first word.
[0008] Based on the first word segmentation result, a prompt message is output, which is used to instruct the user to input the text to be queried;
[0009] Obtain the text to be queried input by the user according to the prompt information, and generate data analysis results based on the text to be queried.
[0010] In one possible implementation, the step of outputting prompt information based on the first word segmentation result includes:
[0011] The first word segmentation result is matched with preset information to obtain the matching result corresponding to each first word. The matching result is either a matching failure or includes the prompt value obtained from the matching.
[0012] The prompt information is determined based on the matching results corresponding to each first word;
[0013] Output the aforementioned prompt message.
[0014] In one possible implementation, the preset information includes first information and second information. The first information includes multiple historical high-frequency statements and the frequency corresponding to each historical high-frequency statement. The second information includes multiple categories and the prompt value corresponding to each category.
[0015] The step of matching the first word segmentation result with preset information to obtain the matching result corresponding to each first word includes:
[0016] Each first word is matched with the first information to obtain a first matching result for each first word. The first matching result is either a failed match or includes the matched target high-frequency phrase; and / or,
[0017] Each first word is matched with the second information to obtain a second matching result for each first word. The second matching result is either a failed match or includes the words corresponding to each first category that have been matched.
[0018] The matching result includes the first matching result and / or the second matching result.
[0019] In one possible implementation, determining the prompt information based on the matching result corresponding to each first word includes:
[0020] If the matching result for each first word includes the matched prompt value, then multiple target texts are determined based on the prompt value in the matching result for each first word, and the prompt information includes the multiple target texts.
[0021] If at least one of the multiple first words has a matching failure result for at least one second word, then the prompt message is determined to include at least one second word.
[0022] In one possible implementation, the step of performing word segmentation on the first text to obtain a first word segmentation result includes:
[0023] The first text is segmented to obtain the plurality of first words;
[0024] In the preset word segmentation information, query the second category corresponding to each first word to obtain the first word segmentation result.
[0025] In one possible implementation, generating data analysis results based on the text to be queried includes:
[0026] The text to be queried is segmented to obtain a second segmentation result, which includes multiple third words in the text to be queried and the category of each third word;
[0027] Based on the second word segmentation result, generate a structured query statement corresponding to the text to be queried;
[0028] Based on the structured query statement, retrieve the data corresponding to the text to be queried;
[0029] The data corresponding to the text to be queried is visualized to obtain the data analysis results.
[0030] In one possible implementation, the visualization processing of the data corresponding to the query text to obtain the data analysis results includes:
[0031] Determine the number of each second category in the second word segmentation result;
[0032] Based on the number of each of the second categories, determine at least one chart type;
[0033] Based on the at least one chart type, the data corresponding to the text to be queried is visualized to obtain the data analysis results.
[0034] In one possible implementation, the visualization processing of the data corresponding to the query text based on the at least one chart type includes:
[0035] If the second word segmentation result includes a preset category, then the target chart type is determined from the at least one chart type according to the preset category;
[0036] The data corresponding to the text to be queried is visualized according to the target chart type.
[0037] Secondly, embodiments of this application provide a data analysis apparatus, comprising:
[0038] The acquisition module is used to acquire the first text input by the user;
[0039] The first processing module is used to perform word segmentation on the first text to obtain a first word segmentation result, wherein the word segmentation result includes multiple first words in the first text and a first category for each first word;
[0040] The output module is used to output prompt information based on the first word segmentation result, the prompt information being used to instruct the user to input the text to be queried;
[0041] The second processing module is used to obtain the text to be queried input by the user according to the prompt information, and generate data analysis results based on the text to be queried.
[0042] In one possible implementation, the output module is specifically used for:
[0043] The first word segmentation result is matched with preset information to obtain the matching result corresponding to each first word. The matching result is either a matching failure or includes the prompt value obtained from the matching.
[0044] The prompt information is determined based on the matching results corresponding to each first word;
[0045] Output the aforementioned prompt message.
[0046] In one possible implementation, the preset information includes first information and second information. The first information includes multiple historical high-frequency statements and the frequency corresponding to each historical high-frequency statement. The second information includes multiple categories and the prompt value corresponding to each category. The output module is further configured to:
[0047] Each first word is matched with the first information to obtain a first matching result for each first word. The first matching result is either a failed match or includes the matched target high-frequency phrase; and / or,
[0048] Each first word is matched with the second information to obtain a second matching result for each first word. The second matching result is either a failed match or includes the words corresponding to each first category that have been matched.
[0049] The matching result includes the first matching result and / or the second matching result.
[0050] In one possible implementation, the output module is further configured to:
[0051] If the matching result for each first word includes the matched prompt value, then multiple target texts are determined based on the prompt value in the matching result for each first word, and the prompt information includes the multiple target texts.
[0052] If at least one of the multiple first words has a matching failure result for at least one second word, then the prompt message is determined to include at least one second word.
[0053] In one possible implementation, the first processing module is specifically used for:
[0054] The first text is segmented to obtain the plurality of first words;
[0055] In the preset word segmentation information, query the category corresponding to each first word to obtain the first word segmentation result.
[0056] In one possible implementation, the second processing module is specifically used for:
[0057] The text to be queried is segmented to obtain a second segmentation result, which includes multiple third words in the text to be queried and a second category for each third word.
[0058] Based on the second word segmentation result, generate a structured query statement corresponding to the text to be queried;
[0059] Based on the structured query statement, retrieve the data corresponding to the text to be queried;
[0060] The data corresponding to the text to be queried is visualized to obtain the data analysis results.
[0061] In one possible implementation, the second processing module is further configured to:
[0062] Determine the number of each second category in the second word segmentation result;
[0063] Based on the number of each of the second categories, determine at least one chart type;
[0064] Based on the at least one chart type, the data corresponding to the text to be queried is visualized to obtain the data analysis results.
[0065] In one possible implementation, the second processing module is further configured to:
[0066] If the second word segmentation result includes a preset category, then the target chart type is determined from the at least one chart type according to the preset category;
[0067] The data corresponding to the text to be queried is visualized according to the target chart type.
[0068] Thirdly, embodiments of this application provide an electronic device, including: a processor, and a memory communicatively connected to the processor;
[0069] The memory stores computer-executed instructions;
[0070] The processor executes computer execution instructions stored in the memory to implement the data analysis method as described in the first aspect.
[0071] Fourthly, embodiments of this application provide a computer-readable storage medium storing computer-executable instructions, which, when executed by a processor, are used to implement the data analysis method as described in the first aspect.
[0072] Fifthly, embodiments of this application provide a computer program product, including a computer program that, when executed by a processor, implements the data analysis method as described in the first aspect.
[0073] This application provides a data analysis method, apparatus, device, storage medium, and program product. It acquires first text input by a user, performs word segmentation on the first text to obtain a first word segmentation result, and then outputs prompt information based on the first word segmentation result. This prompt information allows the user to input text to be queried, and finally, data analysis results are generated based on the acquired text to be queried. The data analysis method of this application not only assists users in inputting complete text to be queried, improving the flexibility of data analysis, but also lowers the barrier to entry for mobile BI for users. Attached Figure Description
[0074] The accompanying drawings, which are incorporated in and form part of this specification, illustrate embodiments consistent with this application and, together with the description, serve to explain the principles of this application.
[0075] Figure 1 A schematic diagram of the data analysis process in mobile BI;
[0076] Figure 2 This is a schematic diagram illustrating one application scenario to which this application applies;
[0077] Figure 3 A flowchart illustrating a data analysis method provided in Embodiment 1 of this application;
[0078] Figure 4 A flowchart illustrating another data analysis method provided in Embodiment 2 of this application;
[0079] Figure 5 A flowchart illustrating another data analysis method provided in Embodiment 3 of this application;
[0080] Figure 6 This is a schematic diagram of the structure of a data analysis device provided in Embodiment 4 of this application;
[0081] Figure 7 This is a schematic diagram of the structure of a data analysis device provided in Embodiment 5 of this application.
[0082] The accompanying drawings illustrate specific embodiments of this application, which will be described in more detail below. These drawings and descriptions are not intended to limit the scope of the concept in any way, but rather to illustrate the concept of this application to those skilled in the art through reference to particular embodiments. Detailed Implementation
[0083] Exemplary embodiments will now be described in detail, examples of which are illustrated in the accompanying drawings. When the following description relates to the drawings, unless otherwise indicated, the same numbers in different drawings denote the same or similar elements. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with this application. Rather, they are merely examples of apparatuses and methods consistent with some aspects of this application as detailed in the appended claims.
[0084] The development of mobile applications has made mobile office possible. Users can use mobile devices such as mobile phones and tablets to handle any business anytime and anywhere through mobile BI, without being limited by time and space.
[0085] For example, the data analysis process of mobile BI is as follows: Figure 1 As shown, it includes four stages: requirements analysis, data extraction and processing, BI analysis report creation, and results publication.
[0086] Among them, Requirement Analysis 101 confirms the information provided by the user, including data fields, statistical caliber, statistical frequency, and display format, and can also prioritize the data analysis request based on its importance or urgency.
[0087] Data extraction and processing 102 involves extracting the required data from the storage database to the analysis database, and processing and statistically analyzing the display field data required by the user based on the information in the requirements analysis.
[0088] Create BI analysis report 103, completing the design of Hyper Text Markup Language (HTML) including data binding, parameter design, style design, chart design, and color scheme optimization.
[0089] Result 104: The report obtained during the BI analysis report creation phase will be published to the mobile device for users to view and use.
[0090] However, the data analysis process described above is custom-developed by developers based on business needs. This means that users need to have certain professional knowledge and input request information according to the operation rules set in the relevant operation page. For example, users need to input query statements in the correct format and specify the dimensions and indicators of the data. As a result, the complex operation makes the user's operation less flexible when performing data analysis.
[0091] Therefore, this application proposes a data analysis method that outputs prompts to the user based on the text information input by the user, prompting the user to input the complete text to be queried, and then generates data analysis results based on the text to be queried, which improves the flexibility of data analysis and lowers the threshold for users to use mobile BI.
[0092] Figure 2 This is a schematic diagram illustrating one application scenario to which this application applies, such as... Figure 2 As shown, the system includes a terminal device 202 and a server 202. The terminal device 202 and the server 202 communicate via the Internet. The user inputs text through the terminal device 202 and sends the text to the server 202. The server 202 processes the text to provide the user with complete query text prompts and generate data analysis results based on the query text. The data analysis results are then sent back to the terminal device 202, allowing the user to view the data analysis results through the terminal device.
[0093] It is understood that there can be multiple terminal devices 202 and servers 202, which are not shown in the figure. Terminal devices 202 can be mobile electronic devices such as mobile phones and tablets.
[0094] The technical solutions of this application and how they solve the aforementioned technical problems are described in detail below with specific embodiments. These specific embodiments may exist independently or in combination with each other. Identical or similar concepts or processes may not be repeated in some embodiments. The embodiments of this application will now be described with reference to the accompanying drawings.
[0095] Figure 3 This is a flowchart illustrating a data analysis method provided in Embodiment 1 of this application. The method can be executed by a data analysis device, which can be... Figure 2 The following explanation uses a server as an example. (Refer to the relevant documentation.) Figure 3 The method includes the following steps.
[0096] S301, Obtain the first text input by the user.
[0097] The server can receive a first text input by a user through a terminal device. The first text can be natural language, such as "number of customers". Regarding the way the user inputs the first text, it can be that the user types the first text on the input interface of the terminal device, or it can be input through other means such as voice or text scanning via the camera of the terminal device. This application does not limit this.
[0098] S302. Perform word segmentation on the first text to obtain a first word segmentation result. The word segmentation result includes multiple first words in the first text and the first category of each first word.
[0099] After the server obtains the first text, it is not certain at this time whether the first text input by the user is the complete text to be queried required for its data analysis needs. For example, the text to be queried is "the number of female customers in 2022". The first text may be part of the text to be queried, such as "number of customers" or "female customers", etc., or it may be the text to be queried.
[0100] Then, the server can perform word segmentation on the first text to obtain a first word segmentation result. The first word segmentation result includes multiple first words in the first text and the first category of each first word. Exemplarily, if the first text is "the number of female customers", then the first words can be "female customers" and "number of customers"; if the first text is "gender", then the first word can be "gender".
[0101] The first category corresponding to each first word can be a dimension or an index, etc. For example, the number of customers represents an index, then the first category corresponding to the first word "number of customers" can be an index.
[0102] The way for the server to determine the first word segmentation result can be, for example: perform word segmentation on the first text to obtain multiple first words, and then query the category corresponding to each first word in the preset word segmentation information to obtain the first word segmentation result. Among them, the way of word segmentation can be, for example: segment the first text according to particles, adverbs, etc. in the first text. For example, if the first text is "the number of customers in 202201", then segment it according to the particle "of", and the multiple first words obtained are: "202201" and "number of customers".
[0103] Exemplarily, the preset word segmentation information can be a dimension-index information dictionary, as shown in Table 1. The field names in the table are only examples:
[0104] Table 1
[0105] Table name category Field Name Fields t Dimension Organization Name ins_nm t Dimension gender sex t index Customers cst_num
[0106] S303. Based on the first word segmentation result, output a prompt message. The prompt message is used to instruct the user to enter the text to be queried.
[0107] After obtaining the first word segmentation result, the server can output a prompt message based on the first word segmentation result, so that the user can input the text to be queried based on the prompt message.
[0108] In one possible implementation, if the first text entered by the user is the text to be queried, the prompt message can be used to prompt the user to confirm the input of the first text in order to complete the input of the text to be queried.
[0109] In another possible implementation, if the first text entered by the user is a part of the text to be queried, then the prompt message includes multiple target texts related to the first text, providing the user with options to select from, in order to assist the user in completing the input of the text to be queried.
[0110] S304. Obtain the text to be queried entered by the user according to the prompt information, and generate data analysis results based on the text to be queried.
[0111] After the user enters the text to be queried according to the prompts, the server can generate data analysis results based on the retrieved text.
[0112] The server can generate data analysis results in the following ways: it can perform word segmentation on the query text to obtain the word segmentation results, and generate a structured query statement based on the word segmentation results. The server can then use the structured query statement to retrieve the corresponding data from the database, thereby enabling visualization of the data and obtaining data analysis results.
[0113] In this embodiment, the first text input by the user is obtained, and word segmentation is performed on the first text to obtain a first word segmentation result. Then, prompt information is output based on the first word segmentation result, allowing the user to input the text to be queried according to the prompt information. Finally, data analysis results are generated based on the obtained text to be queried. The data analysis method of this application embodiment not only assists users in inputting complete text to be queried, improving the flexibility of data analysis, but also lowers the barrier to entry for users to use mobile BI.
[0114] The following is a detailed explanation of S303 in Example 1 through Example 2, that is, a detailed explanation of how to output prompt information based on the first word segmentation result.
[0115] Figure 4 This is a flowchart illustrating another data analysis method provided in Embodiment 2 of this application. This method can be executed by a server. (Refer to...) Figure 4 The method includes the following steps.
[0116] S401. Match the first word segmentation result with the preset information to obtain the matching result corresponding to each first word.
[0117] The server can match the first word segmentation result with the preset information, that is, match each first word and the first category of each first word with the preset information to obtain the matching result corresponding to each first word.
[0118] The preset information may include first information and second information. The first information includes multiple historical high-frequency statements and the frequency corresponding to each historical high-frequency statement. The second information includes multiple categories and the prompt value corresponding to each category. For example, the first information may be multiple dictionaries storing multiple historical high-frequency statements and the frequency corresponding to each historical high-frequency statement, as shown in Table 2. The second information may be a dictionary storing multiple categories and the prompt value corresponding to each category, as shown in Table 3. The text in the tables is for illustrative purposes only.
[0119] Specifically, the server can match each first word in the first word segmentation result with the first information in the preset information to obtain the first matching result corresponding to each first word. The first matching result is either a failed match or includes the target high-frequency phrase that has been matched.
[0120] And / or, the server can also perform matching processing on the first category corresponding to each first word in the first word segmentation result and the second information in the preset information to obtain the second matching result corresponding to each first word. The second matching result is either a failed match or includes the word corresponding to each first category that has been matched.
[0121] For example, if the first word is "gender", the server will match this first word with the input statement in the first information. Taking Table 2 as an example, the target high-frequency statement for the first matching result corresponding to the first word could be "the number of female customers in each institution". Alternatively, if the first word is "number of customers", the target high-frequency statement for the first matching result could be "the number of customers in each institution in January" and "the number of female customers in each institution". Or, the most frequent of "the number of customers in each institution in January" and "the number of female customers in each institution" could be "the number of customers in each institution in January" as the target high-frequency statement for the first matching result corresponding to the first word. The target high-frequency statement serves as the prompt value obtained from the matching.
[0122] For example, if the first category of the first word is "dimension", then the server will match the first category of the first word with the categories in the second information. Taking Table 3 as an example, the second matching results corresponding to the first word are: "is", "contains", and "equals".
[0123] After the server matches the first word segmentation result with the preset information, it obtains the matching result for each first word, including the first matching result and / or the second matching result.
[0124] Specifically, the matching results for each first word can be categorized into the following types:
[0125] In one possible implementation, the server performs matching processing on each first word with the first information in the preset information, and the resulting first matching result is used as the matching result corresponding to each first word.
[0126] In another possible implementation, when the server matches the first category corresponding to each first word with the second information in the preset information, the resulting second matching result is used as the matching result for each first word. It can be understood that when the first categories of N first words are the same, the matching results corresponding to the N first words are the same. Therefore, when outputting the prompt information, for these N matching results, only one of the N matching results can be output, where N is an integer greater than 1.
[0127] In another possible implementation, when the server matches each first word with the first information in the preset information, and simultaneously matches the first category corresponding to each first word with the second information in the preset information, if neither the first nor the second matching result is a match failure, then the matching result for each first word can include both the first and second matching results (i.e., the target high-frequency phrase and the word corresponding to each first category). If the first matching result in the first and second matching results is a match failure, then the matching result for each first word includes the second matching result (i.e., the word corresponding to each first category).
[0128] Table 2
[0129]
[0130] Table 3
[0131] category prompt value Dimension yes Dimension Include Dimension equal index Greater than index Less than Include (condition 1, condition 2)
[0132] S402. Determine the prompt information based on the matching results corresponding to each first word.
[0133] In one possible implementation, if the matching results for each first word include a matching prompt value, the server can determine multiple target texts based on the prompt values in the matching results for each first word, and determine that the prompt information includes multiple target texts. The user can then select the desired target text from the multiple prompt values according to their needs.
[0134] In another possible implementation, if at least one of the first words fails to match, the server can determine that the prompt message includes at least one second word.
[0135] Specifically, at least one second word included in the prompt message can be highlighted, allowing the user to determine that the highlighted word is a failed match based on the prompt message, so as to modify the second word. The modification operation includes changing or deleting.
[0136] In another possible implementation, if at least one of the first words fails to match, the server can match at least one second word with third information. For example, the third information can be a dictionary including multiple field names. The server can match at least one second word with the field names in Table 4, as shown in Table 4. The text in the table is just an example.
[0137] If the second word fails to match a portion of the text of a field name in the third information, the prompt message will include a prompt word related to each second word. For example, if the second word is "organization", the second text will only partially match the field name "organization name" in Table 4, meaning the second word fails to match the "name" part of the field name "organization name". Therefore, the prompt message will include the prompt word related to the second word as "name", which is the unmatched portion of the text, to prompt the user to input based on this prompt word.
[0138] If the second word fails to match any of the field names in the third information, or if the second word successfully matches any of the field names in the third information, no processing is performed; that is, the server can determine that the prompt message includes at least one second word.
[0139] Table 4
[0140] Table name Field Name Fields t Organization Name ins_nm t gender sex t Number of customers cst_num
[0141] S403, Output prompt message.
[0142] After determining the prompt information, the server can output the prompt information. For example, the server can send the prompt information to the terminal device, so that the terminal device can display the prompt information on the corresponding display interface to prompt the user to enter the text to be queried based on the prompt information.
[0143] In this embodiment, the server matches the first word segmentation result with preset information to obtain the matching result corresponding to each first word, and determines the prompt information based on the matching result corresponding to each first word, so that the user can input the text to be queried according to the prompt information, which further improves the flexibility of data analysis.
[0144] In one possible implementation, the above matching process can be based on a text matching algorithm, such as the Long Short-Term Memory (LSTM) algorithm.
[0145] Specifically, taking the LSTM algorithm as an example, the first text is converted into a first semantic vector, and the text in the preset information is converted into multiple second semantic vectors. The similarity between the first semantic vector and each second semantic vector is calculated, and the similarity score is obtained by normalization using a negative exponential function. The text corresponding to at least one second semantic vector with the highest similarity score can be determined as the matching result. For example, similarity can be represented using Manhattan distance.
[0146] In another possible implementation, the above matching process can be based directly on the first text as the query condition, and a query is performed in the preset information. If the first text is found, the match is successful; if the query fails, the match fails.
[0147] Furthermore, Example 3 will be used to provide a detailed explanation of S304 in Example 1, that is, to provide a detailed explanation of the data analysis results generated based on the text to be queried.
[0148] Figure 5 This is a flowchart illustrating another data analysis method provided in Embodiment 3 of this application. This method can be executed by a server. (Refer to...) Figure 5 The method includes the following steps.
[0149] S501. Perform word segmentation on the query text to obtain the second word segmentation result, which includes multiple third words in the query text and the category of each third word.
[0150] After the server obtains the text to be queried, it can perform word segmentation on the text to obtain the second word segmentation result.
[0151] Specifically, the server can perform word segmentation on the query text to obtain multiple second words, and then query the category corresponding to each second word in the preset word segmentation information to obtain the second word segmentation result. For example, the preset word segmentation information can be found in Table 1.
[0152] S502. Based on the second word segmentation result, generate a structured query statement corresponding to the text to be queried.
[0153] Based on the second word segmentation result, the server can generate a structured query statement corresponding to the text to be queried, and the server can determine the assembly logic of the Structured Query Language (SQL) statement.
[0154] For example, the assembly logic is as follows:
[0155] [A] The table name t corresponding to the text to be queried.
[0156] [B] Dimension
[0157] [C] Indicator
[0158] [D] SQL syntax corresponding to the keyword
[0159] [E] Range corresponding to query conditions
[0160] Therefore, assembling an SQL statement can include: SELECT[B], sum([C]) FROM[A] WHERE[D][E] GROUP BY[B].
[0161] For example, the SQL syntax corresponding to the keywords can be found in Table 5. The text in the table is for illustrative purposes only.
[0162] Table 5
[0163] Keyword Name Syntax rules yes = Include in Less than < Greater than >
[0164] For example, if the query text is "the number of female customers in 202201", then the table corresponding to the query text can be the customer data statistics table t. It can be understood that the preset information used for matching can be generated based on the customer data statistics table t.
[0165] The second word segmentation result of the query text is:
[0166] Multiple second words: "202201", "gender", "is", "female", "number of customers".
[0167] Multiple second words correspond to multiple second categories: "202201" corresponds to the category of dimension, "gender" corresponds to the category of dimension, "female" corresponds to the category of gender range, "number of customers" corresponds to the category of indicator, and "is" is the keyword.
[0168] Therefore, the SQL query statement corresponding to the text to be queried could be:
[0169] SELECT t.sex,sum(t.cst_num)FROM t WHERE t.date='202201'AND t.sex='Female'GROUP BY t.sex.
[0170] S503. Based on the structured query statement, retrieve the data corresponding to the text to be queried.
[0171] Once the structured query statement is determined, the server can use it to retrieve the data corresponding to the text to be queried from the database containing the customer data statistics table t.
[0172] S504. Visualize the data corresponding to the query text to obtain the data analysis results.
[0173] The server can perform visualization processing on the data corresponding to the query text. Specifically, the server can determine the number of each second category in the second word segmentation result, and determine at least one chart type based on the number of each second category.
[0174] Then, based on at least one chart type, the data corresponding to the query text is visualized to obtain the data analysis results. Specifically, if the second word segmentation result includes a preset category, the target chart type is determined from at least one chart type according to the preset category, and then the server visualizes the data corresponding to the query text according to the target chart type.
[0175] For example, the correspondence between the number of each second category and the chart type is shown in Table 6:
[0176] Table 6
[0177]
[0178] For example, the chart types corresponding to the preset categories are shown in Table 7:
[0179] Table 7
[0180]
[0181] In this embodiment, the server performs word segmentation on the text to be queried to obtain a second word segmentation result. Then, based on the second word segmentation result, it generates a structured query statement corresponding to the text to be queried. Based on the structured query statement, it queries the data corresponding to the text to be queried. Finally, it performs visualization processing on the data corresponding to the text to be queried to obtain data analysis results. This eliminates the need for users to input structured query statements, improves the flexibility of data analysis, and lowers the barrier to entry for users to use mobile BI.
[0182] Figure 6This is a schematic diagram of a data analysis device provided in Embodiment 4 of this application. The device 60 includes: an acquisition module 601, a first processing module 602, an output module 603, and a second processing module 604.
[0183] Module 601 is used to acquire the first text input by the user;
[0184] The first processing module 602 is used to perform word segmentation on the first text to obtain the first word segmentation result, which includes multiple first words in the first text and the first category of each first word.
[0185] The output module 603 is used to output prompt information based on the first word segmentation result. The prompt information is used to instruct the user to input the text to be queried.
[0186] The second processing module 604 is used to obtain the text to be queried by the user according to the prompt information, and generate data analysis results based on the text to be queried.
[0187] In one possible implementation, the output module 603 is specifically used for:
[0188] The first word segmentation result is matched with the preset information to obtain the matching result for each first word. The matching result is either a failed match or includes the matching prompt value.
[0189] Based on the matching results for each first word, determine the prompt message.
[0190] Output a prompt message.
[0191] In one possible implementation, the preset information includes first information and second information. The first information includes multiple historical high-frequency statements and the frequency corresponding to each historical high-frequency statement. The second information includes multiple categories and the prompt value corresponding to each category. The output module 603 is further configured to:
[0192] Each first word is matched with the first piece of information to obtain a first matching result for each first word. The first matching result is either a failed match or includes the matched high-frequency target phrase. And / or,
[0193] Each first word is matched with its first category and second information to obtain a second matching result for each first word. The second matching result is either a failed match or includes the words corresponding to each first category that have been matched.
[0194] The matching results include the first matching result and / or the second matching result.
[0195] In one possible implementation, the output module 603 is further configured to:
[0196] If the matching results for each first word include the matched prompt value, then multiple target texts are determined based on the prompt value in the matching results for each first word, and the prompt information includes multiple target texts.
[0197] If at least one of the first words fails to match, then the prompt message will indicate that at least one second word is included.
[0198] In one possible implementation, the first processing module 602 is specifically used for:
[0199] The first text is segmented to obtain multiple first words.
[0200] In the preset word segmentation information, query the category corresponding to each first word to obtain the first word segmentation result.
[0201] In one possible implementation, the second processing module 604 is specifically used for:
[0202] The query text is segmented to obtain a second segmentation result, which includes multiple third words in the query text and a second category for each third word.
[0203] Based on the second word segmentation result, generate a structured query statement corresponding to the text to be queried.
[0204] Based on the structured query statement, retrieve the data corresponding to the text to be queried.
[0205] The data corresponding to the query text is visualized to obtain the data analysis results.
[0206] In one possible implementation, the second processing module 604 is further configured to:
[0207] Determine the number of each second category in the second word segmentation result.
[0208] Determine at least one chart type based on the number of each second category.
[0209] Based on at least one chart type, the data corresponding to the query text is visualized to obtain data analysis results.
[0210] In one possible implementation, the second processing module 604 is further configured to:
[0211] If the second word segmentation result includes a preset category, then the target chart type is determined from at least one chart type based on the preset category.
[0212] Visualize the data corresponding to the query text based on the target chart type.
[0213] The apparatus in this embodiment can be used to execute the technical solutions of the above method embodiments. The specific implementation methods and technical effects are similar, and will not be described again here.
[0214] Figure 7 This is a schematic diagram of the structure of an electronic device provided in Embodiment 5 of this application, as shown below. Figure 7 As shown, the electronic device 70 may include at least one processor 701 and a memory 702.
[0215] The memory 702 is used to store programs. Specifically, the program may include program code, which includes computer operation instructions.
[0216] The memory 702 may include random access memory (RAM) and may also include non-volatile memory, such as at least one disk storage device.
[0217] The processor 701 is used to execute computer execution instructions stored in the memory 702 to implement the method described in the foregoing method embodiments. The processor 701 may be a central processing unit (CPU), an application-specific integrated circuit (ASIC), or one or more integrated circuits configured to implement the embodiments of this application.
[0218] Optionally, the electronic device 70 may also include a communication interface 703. In specific implementations, if the communication interface 703, memory 702, and processor 701 are implemented independently, they can be interconnected via a bus to complete communication. The bus can be an Industry Standard Architecture (ISA) bus, a Peripheral Component Interconnect (PCI) bus, or an Extended Industry Standard Architecture (EISA) bus, etc. Buses can be categorized as address buses, data buses, control buses, etc., but this does not imply that there is only one bus or one type of bus.
[0219] Optionally, in a specific implementation, if the communication interface 703, memory 702, and processor 701 are integrated on a single chip, then the communication interface 703, memory 702, and processor 701 can communicate through an internal interface.
[0220] Electronic device 70 can be a server, etc.
[0221] The electronic device in this embodiment can be used to execute the technical solution shown in the above method embodiment. The specific implementation method and technical effect are similar, and will not be repeated here.
[0222] Embodiment 6 of this application provides a computer-readable storage medium, which may include various media capable of storing computer programs, such as USB flash drives, portable hard drives, read-only memory (ROM), RAM, disks, or optical discs. Specifically, the computer-readable storage medium stores a computer program, which is executed by a processor to implement the technical solutions shown in the above method embodiments. The specific implementation methods and technical effects are similar and will not be repeated here.
[0223] Embodiment 7 of the present invention provides a computer program product, including a computer program. When the computer program is executed by a processor, it implements the technical solution shown in the above method embodiments. The specific implementation method and technical effect are similar, and will not be repeated here.
[0224] The collection, storage, use, processing, transmission, provision, and disclosure of user data and other information involved in the technical solution of this application all comply with the provisions of relevant laws and regulations and do not violate public order and good morals.
[0225] Other embodiments of this application will readily occur to those skilled in the art upon consideration of the specification and practice of the invention disclosed herein. This application is intended to cover any variations, uses, or adaptations of this application that follow the general principles of this application and include common knowledge or customary techniques in the art not disclosed herein. The specification and examples are to be considered exemplary only, and the true scope and spirit of this application are indicated by the following claims.
[0226] It should be understood that this application is not limited to the precise structure described above and shown in the accompanying drawings, and various modifications and changes can be made without departing from its scope. The scope of this application is limited only by the appended claims.
Claims
1. A data analysis method, characterized in that, include: Get the first text entered by the user; The first text is segmented to obtain a first segmentation result, which includes multiple first words in the first text and the first category of each first word. Based on the first word segmentation result, a prompt message is output, which is used to instruct the user to input the text to be queried; Obtain the text to be queried input by the user according to the prompt information, and generate data analysis results based on the text to be queried; The step of outputting prompt information based on the first word segmentation result includes: Each first word is matched with the first information to obtain the first matching result corresponding to each first word. The first matching result is either a failed match or includes the target high-frequency statement that has been matched. The first information includes multiple historical high-frequency statements and the frequency corresponding to each historical high-frequency statement. Each first word is matched with its first category and the second information to obtain a second matching result for each first word. The second matching result is either a failed match or includes the words corresponding to each first category that have been matched. The second information includes multiple categories and a prompt value for each category. Based on the first matching result and the second matching result, the prompt information is determined and output.
2. The method according to claim 1, characterized in that, The step of determining the prompt information based on the matching result corresponding to each first word includes: If the matching result for each first word includes the matched prompt value, then multiple target texts are determined based on the prompt value in the matching result for each first word, and the prompt information includes the multiple target texts. If at least one of the multiple first words has a matching failure result for at least one second word, then the prompt message is determined to include at least one second word.
3. The method according to claim 1, characterized in that, The step of performing word segmentation on the first text to obtain the first word segmentation result includes: The first text is segmented to obtain the plurality of first words; In the preset word segmentation information, query the category corresponding to each first word to obtain the first word segmentation result.
4. The method according to claim 1 or 3, characterized in that, The process of generating data analysis results based on the text to be queried includes: The text to be queried is segmented to obtain a second segmentation result, which includes multiple third words in the text to be queried and a second category for each third word. Based on the second word segmentation result, generate a structured query statement corresponding to the text to be queried; Based on the structured query statement, retrieve the data corresponding to the text to be queried; The data corresponding to the text to be queried is visualized to obtain the data analysis results.
5. The method according to claim 4, characterized in that, The visualization processing of the data corresponding to the text to be queried to obtain the data analysis results includes: Determine the number of each second category in the second word segmentation result; Based on the number of each of the second categories, determine at least one chart type; Based on the at least one chart type, the data corresponding to the text to be queried is visualized to obtain the data analysis results.
6. The method according to claim 5, characterized in that, The visualization processing of the data corresponding to the query text based on the at least one chart type includes: If the second word segmentation result includes a preset category, then the target chart type is determined from the at least one chart type according to the preset category; The data corresponding to the text to be queried is visualized according to the target chart type.
7. A data analysis device, characterized in that, include: The acquisition module is used to acquire the first text input by the user; The first processing module is used to perform word segmentation on the first text to obtain a first word segmentation result, wherein the first word segmentation result includes multiple first words in the first text and a first category for each first word. The output module is used to output prompt information based on the first word segmentation result, the prompt information being used to instruct the user to input the text to be queried; The second processing module is used to obtain the text to be queried input by the user according to the prompt information, and generate data analysis results based on the text to be queried; The output module is specifically used for: Each first word is matched with the first information to obtain the first matching result corresponding to each first word. The first matching result is either a failed match or includes the target high-frequency statement that has been matched. The first information includes multiple historical high-frequency statements and the frequency corresponding to each historical high-frequency statement. Each first word is matched with its first category and the second information to obtain a second matching result for each first word. The second matching result is either a failed match or includes the words corresponding to each first category that have been matched. The second information includes multiple categories and a prompt value for each category. Based on the first matching result and the second matching result, the prompt information is determined and output.
8. An electronic device, characterized in that, include: A processor, and a memory communicatively connected to the processor; The memory stores computer-executed instructions; The processor executes computer execution instructions stored in the memory to implement the data analysis method as described in any one of claims 1-6.
9. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer-executable instructions, which, when executed by a processor, are used to implement the data analysis method as described in any one of claims 1-6.
10. A computer program product, characterized in that, It includes a computer program that, when executed by a processor, implements the data analysis method as described in any one of claims 1-6.