Data table processing method and device

By receiving the user's natural language data table processing intentions, building a model context and generating processing code, the problem of complexity and inefficiency of data table processing in the prior art is solved, and an efficient and easy-to-use data table processing method is realized.

CN119514509APending Publication Date: 2025-02-25BEIJING VOLCANO ENGINE TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411586629.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-11-07
Publication Date
2025-02-25

AI Technical Summary

Technical Problem

In the prior art, it is difficult to use the advanced functions of office software to process data tables, and multiple advanced functions can only cooperate with each other to complete complex processing, resulting in low efficiency of user data table processing.

Method used

By receiving the user's natural language data table processing intention and model system prompt words, obtain the description information of the pending data table, build the model context, and use the code generation model to obtain the data table processing code, and directly process the to be processed data table.

Benefits of technology

Users only need to enter processing intentions in natural language to achieve efficient processing of data tables, reducing learning costs and operational complexity, and improving data table processing efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119514509A_ABST
    Figure CN119514509A_ABST
Patent Text Reader

Abstract

The embodiment of the invention provides a data table processing method and device, and relates to the technical field of data processing. Comprising the steps of receiving a data table processing intention in a natural language form input by a user to a to-be-processed data table and a model system cue word; acquiring description information of the to-be-processed data table; according to the data table processing intention, the description information and the model system cue word, constructing a model context corresponding to the data table processing intention; according to the model context and the code generation model, obtaining a data table processing code corresponding to the data table processing intention; the code generation model is a model obtained by training a machine learning model based on a training data set, the training data set comprises a plurality of training data, and any training data comprises a sample data table processing intention in a natural language form and a data table processing code corresponding to the sample data table processing intention; and processing the to-be-processed data table according to the data table processing code. The embodiment of the invention is used for improving the processing efficiency of the data table.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of data processing technology, and in particular to a method and device for processing a data table. Background Art

[0002] A data table is a structure that organizes data in the form of rows and columns, similar to a table in a spreadsheet or relational database. It is a common way to store and manage data and can be used to record and analyze various types of information.

[0003] At present, when processing data tables, users generally use advanced functions such as table formulas, vertical lookup functions, and chart tools provided by office software to process data tables. However, although the use of office software has become very common with the advancement of the times, the advanced functions of office software are difficult to use, and the processing of many data tables requires the cooperation of multiple advanced functions of office software to complete. Therefore, using the advanced functions of office software to realize data processing has a certain learning cost, which leads to low efficiency in data table processing for some users. Summary of the invention

[0004] In view of this, an embodiment of the present application provides a data table processing method and device for improving the processing efficiency of the data table.

[0005] In order to achieve the above purpose, the embodiments of the present application provide the following technical solutions:

[0006] In a first aspect, an embodiment of the present application provides a method for processing a data table, including:

[0007] Receive the data table processing intention and model system prompt words in the natural language form of the user input for the data table to be processed;

[0008] Obtaining description information of the data table to be processed;

[0009] Constructing a model context corresponding to the data table processing intent according to the data table processing intent, the description information and the model system prompt word;

[0010] According to the model context and the code generation model, a data table processing code corresponding to the data table processing intent is obtained; the code generation model is a model obtained by training a machine learning model based on a training data set, the training data set includes a plurality of training data, and any training data includes: a sample data table processing intent in a natural language form and a data table processing code corresponding to the sample data table processing intent;

[0011] The data table to be processed is processed according to the data table processing code.

[0012] As an optional implementation of the embodiment of the present application, the obtaining description information of the to-be-processed data table includes:

[0013] Convert the to-be-processed data table into a data frame format;

[0014] The description information of the data table to be processed is obtained according to the data table to be processed in the data frame format.

[0015] As an optional implementation of the embodiment of the present application, before constructing the model context corresponding to the data table processing intent according to the data table processing intent, the description information and the model system prompt word, the method further includes:

[0016] Obtain at least one processing example corresponding to the data table processing intent;

[0017] The constructing a model context corresponding to the data table processing intent according to the data table processing intent, the description information and the model system prompt word includes:

[0018] A model context corresponding to the data table processing intent is constructed according to the data table processing intent, the description information, the system prompt word and the at least one processing example.

[0019] As an optional implementation of the embodiment of the present application, before constructing the model context corresponding to the data table processing intent according to the data table processing intent, the description information and the model system prompt word, the method further includes:

[0020] Performing a sampling operation on the to-be-processed data table to obtain at least one sampling table item;

[0021] The constructing a model context corresponding to the data table processing intent according to the data table processing intent, the description information and the model system prompt word includes:

[0022] A model context corresponding to the data table processing intent is constructed according to the data table processing intent, the description information, the system prompt word and the at least one sampling table item.

[0023] As an optional implementation of the embodiment of the present application, obtaining the data table processing code corresponding to the data table processing intent according to the model context and the code generation model includes:

[0024] Inputting the model context into the code generation model, and obtaining the code in the markup language format output by the code generation model;

[0025] The data table processing code corresponding to the data table processing intent is extracted from the code in the markup language format output by the code generation model.

[0026] As an optional implementation of the embodiment of the present application, the extracting the data table processing code corresponding to the data table processing intent from the markup language format code output by the code generation model includes:

[0027] The markup language format code output by the code generation model is parsed, and the code blocks embedded in the markup language format code output by the code generation model are extracted to obtain the data table processing code corresponding to the data table processing intent.

[0028] As an optional implementation of the embodiment of the present application, the extracting the data table processing code corresponding to the data table processing intent from the markup language format code output by the code generation model includes:

[0029] The code of the specified pattern in the markup language format code output by the code generation model is matched and extracted through regular expressions to obtain the data table processing code corresponding to the data table processing intent.

[0030] As an optional implementation of the embodiment of the present application, the extracting the data table processing code corresponding to the data table processing intent from the markup language format code output by the code generation model includes:

[0031] The code in the markup language format output by the code generation model is extracted through a code providing tool corresponding to the markup language format to obtain the data table processing code corresponding to the data table processing intent.

[0032] As an optional implementation of the embodiment of the present application, the code in the markup language format output by the code generation model is Python code in Markdown format, and the data table processing code corresponding to the data table processing intent is Python code.

[0033] In a second aspect, the present application provides a data table processing device, including:

[0034] A user input unit, used to receive a user's data table processing intention and a model system prompt word in a natural language form for a data table to be processed;

[0035] An information acquisition unit, used to acquire description information of the data table to be processed;

[0036] A context construction unit, configured to construct a model context corresponding to the data table processing intent according to the data table processing intent, the description information and the model system prompt word;

[0037] A code acquisition unit is used to acquire a data table processing code corresponding to the data table processing intent according to the model context and the code generation model; the code generation model is a model obtained by training a machine learning model based on a training data set, the training data set includes a plurality of training data, and any training data includes: a sample data table processing intent in a natural language form and a data table processing code corresponding to the sample data table processing intent;

[0038] A data table processing unit is used to process the data table to be processed according to the data table processing code.

[0039] As an optional implementation of the embodiment of the present application, the information acquisition unit is specifically used to convert the data table to be processed into a data frame format; and acquire description information of the data table to be processed according to the data table to be processed in the data frame format.

[0040] As an optional implementation of the embodiment of the present application, the information acquisition unit is further used to acquire at least one processing example corresponding to the data table processing intent before constructing the model context corresponding to the data table processing intent according to the data table processing intent, the description information and the model system prompt word;

[0041] The context construction unit is specifically used to construct a model context corresponding to the data table processing intent according to the data table processing intent, the description information, the system prompt words and the at least one processing example.

[0042] As an optional implementation of the embodiment of the present application, the information acquisition unit is further used to perform a sampling operation on the data table to be processed to obtain at least one sampling table item before constructing the model context corresponding to the data table processing intent according to the data table processing intent, the description information and the model system prompt word;

[0043] The context construction unit is specifically used to construct a model context corresponding to the data table processing intent according to the data table processing intent, the description information, the system prompt word and the at least one sampling table item.

[0044] As an optional implementation of an embodiment of the present application, the code acquisition unit is specifically used to input the model context into the code generation model, and obtain the code in the markup language format output by the code generation model, and extract the data table processing code corresponding to the data table processing intent from the code in the markup language format output by the code generation model.

[0045] As an optional implementation of an embodiment of the present application, the code acquisition unit is specifically used to parse the code in the markup language format output by the code generation model, and extract the code blocks embedded in the code in the markup language format output by the code generation model to obtain the data table processing code corresponding to the data table processing intent.

[0046] As an optional implementation of the embodiment of the present application, the code acquisition unit is specifically used to match and extract the code of a specified pattern in the markup language format code output by the code generation model through regular expressions to obtain the data table processing code corresponding to the data table processing intent.

[0047] As an optional implementation of the embodiment of the present application, the code acquisition unit is specifically used to extract the code in the markup language format output by the code generation model through a code providing tool corresponding to the markup language format, so as to obtain the data table processing code corresponding to the data table processing intent.

[0048] As an optional implementation of the embodiment of the present application, the code in the markup language format output by the code generation model is Python code in Markdown format, and the data table processing code corresponding to the data table processing intent is Python code.

[0049] In a third aspect, an embodiment of the present application provides an electronic device, comprising: a memory and a processor, wherein the memory is used to store a computer program and the processor is used to enable the electronic device to implement the data table processing method described in any of the above embodiments when executing the computer program.

[0050] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium, which, when the computer program is executed by a computing device, enables the computing device to implement the data table processing method described in any of the above-mentioned embodiments.

[0051] In a fifth aspect, an embodiment of the present application provides a computer program product. When the computer program product is run on a computer, the computer implements the data table processing method described in any of the above-mentioned embodiments.

[0052] The data table processing method provided in the embodiment of the present application, when receiving the data table processing intention and model system prompt words in the natural language form input by the user for the data table to be processed, first obtains the description information of the data table to be processed, and constructs the model context corresponding to the data table processing intention according to the data table processing intention, the description information and the model system prompt words, and then obtains the data table processing code corresponding to the data table processing intention according to the model context and the code generation model, and processes the data table to be processed according to the data table processing code. Because when the data table processing method provided in the embodiment of the present application is used to process the data table to be processed, after the user inputs the data table processing intention and the model system prompt words in the natural language form, the data table processing device can construct the model context corresponding to the data table processing intention, obtain the data table processing code corresponding to the data table processing intention according to the model context and the code generation model, and process the data table to be processed according to the data table processing code, so the user only needs to input information in the natural language form to process the data table to be processed, so the embodiment of the present application can improve the processing efficiency of the data table. BRIEF DESCRIPTION OF THE DRAWINGS

[0053] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present application and, together with the description, serve to explain the principles of the present application.

[0054] In order to more clearly illustrate the technical solutions in the embodiments of the present application or the prior art, the drawings required in the embodiments or the description of the prior art will be briefly introduced below. Obviously, for ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative labor.

[0055] Figure 1 One of the step flow charts of the method for processing a data table provided in an embodiment of the present application;

[0056] Figure 2 The second step flow chart of the method for processing a data table provided in an embodiment of the present application;

[0057] Figure 3 A schematic diagram of the model interaction interface provided in the embodiment of the present application;

[0058] Figure 4 A schematic diagram of the structure of a data table processing device provided in an embodiment of the present application;

[0059] Figure 5 A schematic diagram of the hardware structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0060] In order to more clearly understand the above-mentioned purposes, features and advantages of the present application, the scheme of the present application will be further described below. It should be noted that the embodiments of the present application and the features in the embodiments can be combined with each other without conflict.

[0061] In the following description, many specific details are set forth to facilitate a full understanding of the present application, but the present application may also be implemented in other ways different from those described herein. Obviously, the embodiments in the specification are only part of the embodiments of the present application, rather than all of the embodiments.

[0062] In the embodiments of the present application, words such as "exemplary" or "for example" are used to indicate examples, illustrations or descriptions. Any embodiment or design described as "exemplary" or "for example" in the embodiments of the present application should not be interpreted as being more preferred or more advantageous than other embodiments or designs. Specifically, the use of words such as "exemplary" or "for example" is intended to present related concepts in a concrete way. In addition, in the description of the embodiments of the present application, unless otherwise specified, the meaning of "multiple" refers to two or more.

[0063] The embodiment of the present application provides a data table processing method, and the execution subject of the data table processing method can be an electronic device such as a mobile phone, a personal computer, a handheld computer, a vehicle-mounted device, a server, or a data table processing device integrated in the electronic device, referring to Figure 1 As shown, the method for processing the data table includes the following steps:

[0064] S101, receiving a data table processing intention and a model system prompt word in the form of natural language input by a user for a data table to be processed.

[0065] In the embodiment of the present application, the data table processing intention refers to the desired goal or operation direction when processing the data table. Exemplarily, the data table processing intention in natural language may include: "clean the data table", "aggregate the data table", "generate a bar chart corresponding to the data table", etc.

[0066] In an embodiment of the present application, a model system prompt word refers to text or instructions provided when interacting with a language model in order to guide the model to generate output that is more in line with specific needs, themes, types, or styles. Model system prompt words can help the model better understand the user's intent, thereby providing more accurate and useful answers or generating more relevant content. Exemplary, model system prompt words in natural language form may include: "review the data provided", "output the Python code corresponding to the user's intent", etc.

[0067] S102: Obtain description information of the data table to be processed.

[0068] In some embodiments, the implementation method of obtaining the description information of the to-be-processed data table may include the following steps a and b:

[0069] Step a: convert the data table to be processed into a data frame (DataFrame) format.

[0070] A data frame is a two-dimensional data structure consisting of rows and columns. Rows represent the individual observations in a data set, and columns represent the different attributes or features of the observations. For example, for a data table consisting of sales data, each sales record can be used as a row, and the sales-related attributes such as date, product name, and sales amount can be used as columns to convert the data table into a data frame format.

[0071] In some embodiments, the method of converting the data table to be processed into a data frame format may be: converting the data table to be processed into a data frame format through a data operation library, for example: converting the data table to be processed into a data frame format through Pandas (a Python library for data processing and analysis).

[0072] Step b: obtaining description information of the data table to be processed according to the data table to be processed in a data frame format.

[0073] That is, after converting the data table into a data frame format, the characteristics of the data frame are used to obtain description information about the data table.

[0074] In some embodiments, obtaining the descriptive information of the data table to be processed according to the data table to be processed in the data frame format may include: structural information of the data table. The structural information of the data table may specifically include the shape (Shape) of the data table and the index (Index) of the data table. The shape of the data table can be represented by a 2-dimensional element group, one element of the 2-dimensional element group represents the number of rows of the data table, and the other element represents the number of columns of the data table. For example: if the 2-dimensional element group is (100, 5), it means that the data table has 100 rows and 5 columns of data. The index of the data table can be a default integer index, or it can be a custom index such as date, name, etc.

[0075] In some embodiments, obtaining the description information of the data table to be processed according to the data table to be processed in the data frame format may include: data type information of the data table. The data type information of the data table may include the data type of each column of data in the data table. The data type may be: 64-bit integer (int64), 64 floating point number (float64), data object (object, used to store strings, mixed types, etc.), date and time type (datetime), etc. For example, for a data table containing an integer column col1 and a string column col2, the data type information may include: col1 int64, col2 object.

[0076] In some embodiments, obtaining the description information of the data table to be processed according to the data table to be processed in the data frame format may include: statistical information of the data table. The statistical information of the data table may include: overall statistical information of the data table, such as the count, mean, standard deviation, minimum value, quartile (25%, 50%, 75%) and maximum value of the data table. The statistical information of the data table may also include: statistical information of one or more data columns in the data table. Similarly, the statistical information of the data columns may include: sum, mean, median, minimum value, maximum value, etc.

[0077] In some embodiments, obtaining the descriptive information of the data table to be processed according to the data table to be processed in a data frame format may include: data missing information of the data table. The data missing information of the data table may be obtained in a Boolean data frame format table with the same shape as the data table, where True in the table indicates that the data at that position is a missing value, and False indicates that the data at that position is complete. The data missing information of the data table may include the number of missing values ​​of each data column. For example, if the data table has three data columns col1, col2, and col3, and col2 has 2 missing values, the number of missing values ​​of the data columns may be expressed as: col1 0, col2 2, col3 0.

[0078] S103: construct a model context corresponding to the data table processing intent according to the data table processing intent, the description information and the model system prompt words.

[0079] In-Context Learning is a learning method in Natural Language Processing (NLP), especially in Large Language Models (LLM). Specifically, it means that when the model processes the current input, it uses the contextual information in the input (such as the provided examples or related text fragments) to learn and reason, without the need for additional pre-training or fine-tuning of the model. The embodiment of the present application will guide the large language model to generate the data table processing code corresponding to the data table processing intent through context learning. Therefore, the present application needs to construct the model context corresponding to the data table processing intent according to the data table processing intent, the descriptive information and the model system prompt words.

[0080] S104: Obtain a data table processing code corresponding to the data table processing intent according to the model context and the code generation model.

[0081] Among them, the code generation model is a model obtained by training a machine learning model based on a training data set, and the training data set includes multiple training data, and any training data includes: a sample data table processing intention in natural language form and a data table processing code corresponding to the sample data table processing intention.

[0082] In some embodiments, the code generation model is a large language model.

[0083] In some embodiments, obtaining the data table processing code corresponding to the data table processing intent according to the model context and the code generation model includes: inputting the model context into the code generation model, and obtaining the markup language format code output by the code generation model, and extracting the data table processing code corresponding to the data table processing intent from the markup language format code output by the code generation model.

[0084] In some embodiments, the code in the markup language format may be Python code in the Markdown format, and the data table processing code corresponding to the data table processing intent is Python code.

[0085] Markdown is a lightweight markup language that can be used to write documents in plain text and use simple markup symbols to identify document titles, paragraphs, lists, links, images, and other information.

[0086] In some embodiments, the code generation model output also includes a chain-of-thought corresponding to the data table processing intent.

[0087] Thought chaining is a reasoning technique in the field of natural language processing, especially in large language models. It aims to improve the model's ability to answer complex questions by showing a series of intermediate reasoning steps, rather than just giving the final answer directly. When the model answers questions through thought chaining, the model generates a reasoning chain similar to the human thinking process, thereby breaking down complex problems into multiple simpler sub-problems, allowing the model to handle problems more accurately.

[0088] S105: Process the data table to be processed according to the data table processing code.

[0089] In some embodiments, processing the data table to be processed according to the data table processing code includes: loading and running the data table processing code through a code interpreter to process the data table to be processed.

[0090] In some embodiments, processing the data table to be processed according to the data table processing code may include: performing operations such as data cleaning, data conversion, and data calculation on the data table to be processed, and outputting the processed data table.

[0091] In some embodiments, processing the data table to be processed according to the data table processing code may include: performing analysis processing such as data aggregation and comparison on the data table to be processed, and outputting analysis conclusions of the data table.

[0092] In some embodiments, processing the data table to be processed according to the data table processing code may include: converting the data table to be processed into a visualization operation such as a bar chart, a line chart, a pie chart, etc., and outputting a visualized icon.

[0093] The data table processing method provided in the embodiment of the present application, when receiving the data table processing intention and model system prompt words in the natural language form input by the user for the data table to be processed, first obtains the description information of the data table to be processed, and constructs the model context corresponding to the data table processing intention according to the data table processing intention, the description information and the model system prompt words, and then obtains the data table processing code corresponding to the data table processing intention according to the model context and the code generation model, and processes the data table to be processed according to the data table processing code. Because when the data table processing method provided in the embodiment of the present application is used to process the data table to be processed, after the user inputs the data table processing intention and the model system prompt words in the natural language form, the data table processing device can construct the model context corresponding to the data table processing intention, obtain the data table processing code corresponding to the data table processing intention according to the model context and the code generation model, and process the data table to be processed according to the data table processing code, so the user only needs to input information in the natural language form to process the data table to be processed, so the embodiment of the present application can improve the processing efficiency of the data table.

[0094] As an extension and refinement of the above embodiment, the present application embodiment provides another method for processing a data table, referring to Figure 2 As shown, the method for processing the data table includes the following steps:

[0095] S201, receiving a data table processing intention and a model system prompt word in the form of natural language input by a user for a data table to be processed.

[0096] For example, refer to Figure 3 As shown, the implementation method of receiving the data table processing intention and model system prompt words in the natural language form input by the user for the data table to be processed may include: displaying a model interaction interface 300, wherein the model interaction interface includes a first information input box 31 for inputting the model system prompt words and a second information input box 32 for inputting the data table processing intention. The user can input the model system prompt words in the natural language form in the first information input box 31 through an information device such as a physical keyboard, a microphone, a virtual keyboard, etc. Figure 3 The model system prompts include: "Role: You are an excellent data analyst, please use Python code to process data", "Steps: 1. Preview the provided DataFrame; 2. Understand the provided data and user input; 3. Output a Python code for processing data", and "Constraints: Please use Markdown for final output" as examples. The user can also enter the user intention in natural language form in the second information input box 32. Figure 3 The user intent includes: "remove rows where int_col is less than 1000".

[0097] S202: Convert the to-be-processed data table into a data frame format.

[0098] S203: Acquire description information of the data table to be processed according to the data table to be processed in a data frame format.

[0099] S204: Perform a sampling operation on the to-be-processed data table to obtain at least one sampling table item.

[0100] In some embodiments, sampling the data table to be processed to obtain at least one sampling table item includes: sampling the data table to be processed in a data frame format using a sampling command to obtain at least one sampling table item. Exemplarily, the sampling command may be df.sample(3).

[0101] Sampling the data table to be processed to obtain at least one sampled table item can select a representative table item from the overall data table, thereby providing the code generation model with a data sample that is easier to process and analyze, thereby improving the code generation model's ability to understand and process data.

[0102] S205: Obtain at least one processing example corresponding to the data table processing intent.

[0103] Few-Shot Prompting is a method that can significantly improve the model generation effect. In the field of natural language processing, especially in large language models, a small number (usually a few) examples can be provided in the model input to help the model better understand and learn the task, thereby improving the accuracy and quality of the model generation effect.

[0104] S206: Construct a model context corresponding to the data table processing intent according to the data table processing intent, the description information, the system prompt word, the at least one processing example, and the at least one sampling table item.

[0105] That is, the model system prompt words, few-shot examples, data table description information and sampled data are organically spliced ​​together to form a complete, coherent and informative unified context.

[0106] S207: Input the model context into the code generation model, and obtain the code in the markup language format output by the code generation model.

[0107] Setting the markup language format of the code generated by the code generation model output can make it easier for users to understand whether the output of the code generation model conforms to the data table processing intention.

[0108] S208: Extracting the data table processing code corresponding to the data table processing intent from the code in the markup language format output by the code generation model.

[0109] In some embodiments, the data table processing code corresponding to the data table processing intent is extracted from the markup language format code output by the code generation model, including: parsing the markup language format code output by the code generation model, and extracting the code blocks embedded in the markup language format code output by the code generation model to obtain the data table processing code corresponding to the data table processing intent.

[0110] When the code in the markup language format is Python code in Markdown format, a specific parser or parsing library can be used to parse the Markdown text and extract the embedded Python code blocks therefrom to obtain the data table processing code corresponding to the data table processing intent.

[0111] In some embodiments, the data table processing code corresponding to the data table processing intent is extracted from the markup language format code output by the code generation model, including: matching and extracting the code of a specified pattern in the markup language format code output by the code generation model through a regular expression to obtain the data table processing code corresponding to the data table processing intent.

[0112] Exemplarily, when the code in the markup language format is Python code in the Markdown format, the Python code block therein may be matched and extracted by using the regular expression “…python\n(.*?)…”.

[0113] In some embodiments, the data table processing code corresponding to the data table processing intent is extracted from the markup language format code output by the code generation model, including: extracting the markup language format code output by the code generation model through a code corresponding to the markup language format providing tool to obtain the data table processing code corresponding to the data table processing intent.

[0114] When the code in the markup language format is Python code in Markdown format, some tools or scripts specially designed for extracting Python code in Markdown can be used to extract the Python code therein to obtain the data table processing code corresponding to the data table processing intent.

[0115] S209: Process the data table to be processed according to the data table processing code.

[0116] Figure 2 The data table processing method provided in the embodiment shown is Figure 1The implementation principle and technical effect of the data table processing method provided in the illustrated embodiment are similar and will not be described in detail here.

[0117] Based on the same inventive concept, as an implementation of the above method, an embodiment of the present application also provides a data table processing device, which corresponds to the above method embodiment. For ease of reading, this embodiment will no longer repeat the details of the above method embodiment one by one, but it should be clear that the data table processing device in this embodiment can correspond to all the contents of the above method embodiment.

[0118] The present application embodiment provides a data table processing device, Figure 4 is a structural diagram of the processing device of the data table, such as Figure 4 As shown, the data table processing device 400 includes:

[0119] A user input unit 41 is used to receive a user's natural language input of a data table processing intention and a model system prompt word for a data table to be processed;

[0120] An information acquisition unit 42 is used to acquire description information of the data table to be processed;

[0121] A context construction unit 43, configured to construct a model context corresponding to the data table processing intent according to the data table processing intent, the description information and the model system prompt word;

[0122] A code acquisition unit 44 is used to acquire a data table processing code corresponding to the data table processing intent according to the model context and the code generation model; the code generation model is a model obtained by training a machine learning model based on a training data set, the training data set includes a plurality of training data, and any training data includes: a sample data table processing intent in a natural language form and a data table processing code corresponding to the sample data table processing intent;

[0123] The data table processing unit 45 is used to process the data table to be processed according to the data table processing code.

[0124] As an optional implementation of the embodiment of the present application, the information acquisition unit 42 is specifically used to convert the data table to be processed into a data frame format; and acquire description information of the data table to be processed according to the data table to be processed in the data frame format.

[0125] As an optional implementation of the embodiment of the present application, the information acquisition unit 42 is further used to acquire at least one processing example corresponding to the data table processing intent before constructing the model context corresponding to the data table processing intent according to the data table processing intent, the description information and the model system prompt word;

[0126] The context construction unit 43 is specifically used to construct a model context corresponding to the data table processing intent according to the data table processing intent, the description information, the system prompt word and the at least one processing example.

[0127] As an optional implementation of the embodiment of the present application, the information acquisition unit 42 is further used to perform a sampling operation on the data table to be processed to obtain at least one sampling table item before constructing the model context corresponding to the data table processing intent according to the data table processing intent, the description information and the model system prompt word;

[0128] The context construction unit 43 is specifically configured to construct a model context corresponding to the data table processing intent according to the data table processing intent, the description information, the system prompt word and the at least one sampling table item.

[0129] As an optional implementation of the embodiment of the present application, the code acquisition unit 44 is specifically used to input the model context into the code generation model, and obtain the code in the markup language format output by the code generation model, and extract the data table processing code corresponding to the data table processing intent from the code in the markup language format output by the code generation model.

[0130] As an optional implementation of the embodiment of the present application, the code acquisition unit 44 is specifically used to parse the code in the markup language format output by the code generation model, and extract the code blocks embedded in the code in the markup language format output by the code generation model to obtain the data table processing code corresponding to the data table processing intent.

[0131] As an optional implementation of the embodiment of the present application, the code acquisition unit 44 is specifically used to match and extract the code of a specified pattern in the markup language format code output by the code generation model through regular expressions to obtain the data table processing code corresponding to the data table processing intent.

[0132] As an optional implementation of the embodiment of the present application, the code acquisition unit 44 is specifically used to extract the code in the markup language format output by the code generation model through a code providing tool corresponding to the markup language format, so as to obtain the data table processing code corresponding to the data table processing intent.

[0133] As an optional implementation of the embodiment of the present application, the code in the markup language format output by the code generation model is Python code in Markdown format, and the data table processing code corresponding to the data table processing intent is Python code.

[0134] The data table processing device provided in the embodiment of the present application can execute the data table processing method provided in any of the above embodiments, and its implementation principle and technical effect are similar, which will not be repeated here.

[0135] Based on the same inventive concept, an embodiment of the present application also provides an electronic device. Figure 5 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application, such as Figure 5 As shown, the electronic device provided in this embodiment includes: a memory 501 and a processor 502, wherein the memory 501 is used to store a computer program, and the processor 502 is used to execute the data table processing method provided in the above embodiment when executing the computer program.

[0136] Based on the same inventive concept, an embodiment of the present application also provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the computing device implements the data table processing method provided in the above embodiment.

[0137] Based on the same inventive concept, an embodiment of the present application further provides a computer program product. When the computer program product is run on a computer, the computing device implements the data table processing method provided in the above embodiment.

[0138] Those skilled in the art will appreciate that the embodiments of the present application may be provided as methods, systems, or computer program products. Therefore, the present application may adopt the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Moreover, the present application may adopt the form of a computer program product implemented on one or more computer-usable storage media that include computer-usable program code.

[0139] The processor can be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSP), dedicated injection circuits,

[0140] (Application Specific Integrated Circuit, ASIC), off-the-shelf programmable gate array (Field-Programmable Gate Array, FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor can be a microprocessor or the processor can also be any conventional processor, etc.

[0141] The memory may include non-permanent memory in a computer-readable medium, random access memory (RAM) and / or non-volatile memory in the form of read-only memory (ROM) or flash RAM. The memory is an example of a computer-readable medium.

[0142] Computer readable media include permanent and non-permanent, removable and non-removable storage media. Storage media can be implemented by any method or technology to store information, and the information can be computer-readable instructions, data structures, program modules or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, compact disk read-only memory (CD-ROM), digital versatile disk (DVD) or other optical storage, magnetic cassettes, magnetic disk storage or other magnetic storage devices or any other non-transmission media that can be used to store information that can be accessed by a computing device. As defined herein, computer readable media does not include temporary computer readable media (transitory media), such as modulated data signals and carrier waves.

[0143] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit it. Although the present application has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some or all of the technical features therein, and these modifications or replacements do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of the present application.

Claims

1. A method for processing a data table, characterized in that: include: Receive the data table processing intention and model system prompt words in the natural language form of the user input for the data table to be processed; Obtaining description information of the data table to be processed; Constructing a model context corresponding to the data table processing intent according to the data table processing intent, the description information and the model system prompt word; According to the model context and the code generation model, obtaining the data table processing code corresponding to the data table processing intent; The code generation model is a model obtained by training a machine learning model based on a training data set, wherein the training data set includes a plurality of training data, and any training data includes: a sample data table processing intent in a natural language form and a data table processing code corresponding to the sample data table processing intent; The data table to be processed is processed according to the data table processing code.

2. The method according to claim 1, characterized in that The obtaining description information of the data table to be processed includes: Convert the to-be-processed data table into a data frame format; The description information of the data table to be processed is obtained according to the data table to be processed in the data frame format.

3. The method according to claim 1, characterized in that Before constructing a model context corresponding to the data table processing intent according to the data table processing intent, the description information and the model system prompt words, the method further includes: Obtain at least one processing example corresponding to the data table processing intent; The constructing a model context corresponding to the data table processing intent according to the data table processing intent, the description information and the model system prompt word includes: A model context corresponding to the data table processing intent is constructed according to the data table processing intent, the description information, the system prompt word and the at least one processing example.

4. The method according to claim 1, characterized in that: Before constructing a model context corresponding to the data table processing intent according to the data table processing intent, the description information and the model system prompt words, the method further includes: Performing a sampling operation on the to-be-processed data table to obtain at least one sampling table item; The constructing a model context corresponding to the data table processing intent according to the data table processing intent, the description information and the model system prompt word includes: A model context corresponding to the data table processing intent is constructed according to the data table processing intent, the description information, the system prompt word and the at least one sampling table item.

5. The method according to claim 1, characterized in that The acquiring, according to the model context and the code generation model, the data table processing code corresponding to the data table processing intent comprises: Inputting the model context into the code generation model, and obtaining the code in the markup language format output by the code generation model; The data table processing code corresponding to the data table processing intent is extracted from the code in the markup language format output by the code generation model.

6. The method according to claim 5, characterized in that The step of extracting the data table processing code corresponding to the data table processing intent from the code in the markup language format output by the code generation model includes: The markup language format code output by the code generation model is parsed, and the code blocks embedded in the markup language format code output by the code generation model are extracted to obtain the data table processing code corresponding to the data table processing intent.

7. The method according to claim 5, characterized in that The step of extracting the data table processing code corresponding to the data table processing intent from the code in the markup language format output by the code generation model includes: The code of the specified pattern in the markup language format code output by the code generation model is matched and extracted through regular expressions to obtain the data table processing code corresponding to the data table processing intent.

8. The method according to claim 5, characterized in that The step of extracting the data table processing code corresponding to the data table processing intent from the code in the markup language format output by the code generation model includes: The code in the markup language format output by the code generation model is extracted through a code providing tool corresponding to the markup language format to obtain the data table processing code corresponding to the data table processing intent.

9. The method according to claim 5, characterized in that The code in the markup language format output by the code generation model is Python code in Markdown format, and the data table processing code corresponding to the data table processing intent is Python code.

10. A data table processing device, characterized in that: include: A user input unit, used to receive a user's data table processing intention and a model system prompt word in a natural language form for a data table to be processed; An information acquisition unit, used to acquire description information of the data table to be processed; A context construction unit, configured to construct a model context corresponding to the data table processing intent according to the data table processing intent, the description information and the model system prompt word; A code acquisition unit, used for acquiring a data table processing code corresponding to the data table processing intent according to the model context and the code generation model; The code generation model is a model obtained by training a machine learning model based on a training data set, wherein the training data set includes a plurality of training data, and any training data includes: a sample data table processing intent in a natural language form and a data table processing code corresponding to the sample data table processing intent; A data table processing unit is used to process the data table to be processed according to the data table processing code.

11. An electronic device, characterized in that: include: A memory and a processor, wherein the memory is used to store a computer program and the processor is used to enable the electronic device to implement the data table processing method described in any one of claims 1 to 9 when executing the computer program.

12. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by a computing device, the computing device implements the data table processing method according to any one of claims 1 to 9.

13. A computer program product, characterized in that When the computer program product is run on a computer, the computer is enabled to implement the data table processing method according to any one of claims 1 to 9.