CN116166856A - Processing method, device, equipment and storage medium of table data - Google Patents

Processing method, device, equipment and storage medium of table data Download PDF

Info

Publication number
CN116166856A
CN116166856A CN202310186547.4A CN202310186547A CN116166856A CN 116166856 A CN116166856 A CN 116166856A CN 202310186547 A CN202310186547 A CN 202310186547A CN 116166856 A CN116166856 A CN 116166856A
Authority
CN
China
Prior art keywords
command
parsing
analysis
processing
analysis result
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202310186547.4A
Other languages
Chinese (zh)
Inventor
许锴霖
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Zitiao Network Technology Co Ltd
Original Assignee
Beijing Zitiao Network Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing Zitiao Network Technology Co Ltd filed Critical Beijing Zitiao Network Technology Co Ltd
Priority to CN202310186547.4A priority Critical patent/CN116166856A/en
Publication of CN116166856A publication Critical patent/CN116166856A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/90Details of database functions independent of the retrieved data types
    • G06F16/903Querying
    • G06F16/90335Query processing
    • G06F16/90344Query processing by using string matching techniques
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F40/00Handling natural language data
    • G06F40/10Text processing
    • G06F40/166Editing, e.g. inserting or deleting
    • G06F40/177Editing, e.g. inserting or deleting of tables; using ruled lines
    • G06F40/18Editing, e.g. inserting or deleting of tables; using ruled lines of spreadsheets
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F40/00Handling natural language data
    • G06F40/20Natural language analysis
    • G06F40/205Parsing
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F40/00Handling natural language data
    • G06F40/20Natural language analysis
    • G06F40/253Grammatical analysis; Style critique
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F40/00Handling natural language data
    • G06F40/20Natural language analysis
    • G06F40/279Recognition of textual entities
    • G06F40/284Lexical analysis, e.g. tokenisation or collocates
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F40/00Handling natural language data
    • G06F40/30Semantic analysis
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/40Transformation of program code
    • G06F8/41Compilation
    • G06F8/42Syntactic analysis
    • G06F8/427Parsing
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Physics & Mathematics (AREA)
  • Computational Linguistics (AREA)
  • Health & Medical Sciences (AREA)
  • Artificial Intelligence (AREA)
  • Audiology, Speech & Language Pathology (AREA)
  • General Health & Medical Sciences (AREA)
  • Databases & Information Systems (AREA)
  • Data Mining & Analysis (AREA)
  • Software Systems (AREA)
  • Machine Translation (AREA)

Abstract

The application discloses a method, a device, equipment and a storage medium for processing form data, wherein the method comprises the following steps: and acquiring a processing command for the data to be processed in the table, namely a query language command, and then analyzing the query language command based on the lexical analysis rule to acquire a lexical analysis result. And analyzing the lexical analysis result based on the grammar analysis rule to obtain a grammar analysis result, and generating an analysis command based on the grammar analysis result so as to process the data to be processed based on the analysis command. By the method for processing the table data, the table data can be processed by using the query language command, so that the diversity of data processing functions for the table data is improved, processing steps are simplified, and user experience is improved.

Description

Processing method, device, equipment and storage medium of table data
Technical Field
The present invention relates to the field of data processing technologies, and in particular, to a method, an apparatus, a device, and a storage medium for processing table data.
Background
At present, when a user uses an online table to query and analyze data in the table, the user can generally only perform summation processing on the data from the first column to the third column in the first row, for example, the data with a specific value in a certain row/column is screened, while the data processing function with a little complexity, for example, the summation processing is performed after the data meeting the preset condition is screened in the first row and the third row, the data processing function of the table cannot be directly realized, and the data processing function of the table can not be directly realized through a plurality of processing steps, so that the query processing step of the user on the table data is complex, the data processing function of the table is single, and the user experience is affected.
Disclosure of Invention
In view of this, the present application provides a method, apparatus, device and storage medium for processing table data, so as to improve the diversity of data processing functions for the table data, simplify processing steps, and improve user experience.
In order to achieve the above purpose, the technical scheme provided by the application is as follows:
in a first aspect of the present application, there is provided a method for processing table data, the method including:
acquiring a processing command aiming at data to be processed in a table, wherein the processing command is a query language command;
analyzing the query language command based on a lexical analysis rule to obtain a lexical analysis result;
analyzing the lexical analysis result based on a grammar analysis rule to obtain a grammar analysis result;
generating an analysis command based on the syntax analysis result;
and processing the data to be processed based on the analysis command.
In a second aspect of the present application, there is provided a processing apparatus for table data, the apparatus comprising:
the first acquisition unit is used for acquiring a processing command aiming at data to be processed in the table, wherein the processing command is a query language command;
the second acquisition unit is used for analyzing the query language command based on the lexical analysis rule to acquire a lexical analysis result;
The third acquisition unit is used for analyzing the lexical analysis result based on the grammar analysis rule to acquire a grammar analysis result;
the parsing unit is used for generating parsing commands based on the parsing result;
and the processing unit is used for processing the data to be processed based on the analysis command.
In a third aspect of the present application, there is provided an electronic device, the device comprising: a processor and a memory;
the memory is used for storing instructions or computer programs;
the processor is configured to execute the instructions or the computer program in the memory, so that the electronic device performs the method described in the first aspect.
In a fourth aspect of the present application, there is provided a computer readable storage medium having instructions stored therein which, when run on a device, cause the device to perform the method of the first aspect described above.
In a fifth aspect of the present application, there is provided a computer program product comprising a computer program/instruction which, when executed by a processor, implements the method of the first aspect described above.
From this, this application has following beneficial effect:
in the above implementation manner of the present application, the processing function of the table data may be implemented through the query language command, and when the specific implementation is implemented, the processing command for the data to be processed in the table, that is, the query language command, is first acquired, and since the online table product cannot identify the query language command, the query language command needs to be parsed, so as to obtain the command that can be identified by the online table product. The query language command can be analyzed based on the lexical analysis rule, and a lexical analysis result is obtained. And then analyzing the lexical analysis result by using a grammar analysis rule to obtain a grammar analysis result, and generating an analysis command based on the grammar analysis result, namely a command which can be identified by an online form product, so that the data to be processed can be processed based on the analysis command. By the method for processing the table data, the table data can be processed by using the query language command, so that the diversity of data processing functions for the table data is improved, processing steps are simplified, and user experience is improved.
Drawings
In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings that are required to be used in the embodiments or the description of the prior art will be briefly described below, and it is obvious that the drawings in the following description are only some embodiments described in the present application, and other drawings may be obtained according to these drawings without inventive effort for a person skilled in the art.
Fig. 1 is a flowchart of a method for processing table data according to an embodiment of the present application;
fig. 2 is a schematic diagram of a tree-like parsing result according to an embodiment of the present application;
fig. 3 is a schematic diagram of a table data processing device according to an embodiment of the present application;
fig. 4 is a schematic structural diagram of an electronic device according to an embodiment of the present application.
Detailed Description
In order to make the present application solution better understood by those skilled in the art, the following description will clearly and completely describe the technical solution in the embodiments of the present application with reference to the accompanying drawings in the embodiments of the present application, and it is apparent that the described embodiments are only some embodiments of the present application, not all embodiments. All other embodiments, which can be made by one of ordinary skill in the art without undue burden from the present disclosure, are within the scope of the present disclosure.
When a user uses an online form to query and analyze data in the form, the user can generally only perform summation processing on data meeting preset conditions through data processing functions of the form, such as simple data screening and summation, and the data processing functions of a little complicated, such as screening data meeting preset conditions in a first row and a third row, and the data processing functions of the form cannot be directly realized through the data processing functions of the form, and the data processing steps of the form are required to be realized, so that the processing steps of the user on the data of the form are complicated, the processing functions of the form data are single, and user experience is affected.
Based on the above, the embodiment of the application provides a method for processing table data, so as to improve the diversity of data processing functions for the table data, simplify processing steps and improve user experience. In the specific implementation, firstly, a processing command for data to be processed in a form, namely a query language command, is acquired, and because the online form product cannot identify the query language command, the query language command needs to be analyzed to acquire the command which can be identified by the online form product. The query language command can be analyzed based on the lexical analysis rule, and a lexical analysis result is obtained. And then analyzing the lexical analysis result by using a grammar analysis rule to obtain a grammar analysis result, and generating an analysis command based on the grammar analysis result, namely a command which can be identified by an online form product, so that the data to be processed can be processed based on the analysis command. By the method for processing the table data, the table data can be processed by using the query language command, so that the diversity of data processing functions for the table data is improved, processing steps are simplified, and user experience is improved.
In order to facilitate understanding of the technical solutions provided by the embodiments of the present application, the following description will be made with reference to the accompanying drawings.
Referring to fig. 1, fig. 1 is a flowchart of a method for processing table data according to an embodiment of the present application.
The method may be performed by a processing device that may implement the processing functions of the table data. The method may comprise the steps of:
s101: and acquiring a processing command aiming at the data to be processed in the table, wherein the processing command is a query language command.
In order to achieve processing of the table data, a processing command for the data to be processed in the table may be acquired. For example, when the standard deviation is calculated for the data in the first and second columns in the table, the data in the first and second columns are the data to be processed. Wherein the processing command may be a command in a query language format. Optionally, the query language command input by the user is a text string, and the text string cannot be directly recognized by the online form product, so that the processing device is required to analyze the query language command and convert the query language command into a command that can be recognized by the online form product.
S102: and analyzing the query language command based on the lexical analysis rule to obtain a lexical analysis result.
When parsing the query language command, optionally, the query language command may be parsed first using a lexical analysis rule to obtain a lexical analysis result. The lexical analysis rule may be predetermined and configured in the processing device, so that the processing device may parse the query language command based on the lexical analysis rule.
In particular implementations, the lexical analysis rules may be determined by determining a plurality of string types included in the query language, where each string type includes one or more strings. That is, all string types of the query language may be enumerated, each string type corresponding to a string of a particular format. For example, the string type may include: an identifier, a key, a meta-operator, a binary operator, etc. For each type of string, one or more strings may be included under the string type, for example, when the string type is a keyword, 5 kinds of strings may be included, including Select, white, group By, pivot, and Order By.
After determining the lexical analysis rule, a target string that matches any of the string types of the lexical analysis rule may be determined based on the strings of all types specified in the lexical analysis rule traversing the strings of the query language command, where the target string may include a plurality of strings as a final lexical analysis result. In addition, if the word analysis rule is utilized to traverse the character strings of the query language command, the character strings which are not matched with all types of character strings in the word analysis rule are searched, and error reporting can be carried out, so that the user is reminded of the error of the query language command input by the user, and the user can modify the query language command in time.
Taking an application scenario as an example, when the query language command is "Select a white a >1", the lexical analysis result obtained by using the lexical analysis rule may be expressed as: the character string types are "Select", "identifier", "Where", "identifier", "greater than number" and "numerical value", and the corresponding character strings are "Select", "a", "Where", "a", "and" 1 "in order.
S103: and analyzing the lexical analysis result based on the grammar analysis rule to obtain the grammar analysis result.
The parsing rule may be predetermined and configured in the processing device. After the lexical analysis result is obtained, the processing device may parse the lexical analysis result using the parsing rule, thereby obtaining the parsing result.
In one possible implementation, the parsing rules may be determined by first determining a plurality of keywords of the query language, then determining the type of expression that each keyword may refer to, and determining a grammatical priority that meets the query language.
When determining the expression type that the keyword can refer to, according to the above embodiment, it is known that the keyword of the query language may include: for example, only one expression may be referred to after the keyword while, the keyword Select, the Group By, the Pivot, or the Order By, and a plurality of expressions may be referred to after the keyword Select, the Group By, the Pivot, or the Order By, and the plurality of expressions may be separated By commas. Wherein, the expression can be a literal declarative variable, a function, a unary operation, a binary operation, and the like.
Optionally, the grammatical priority of the query language may include: a writing order of a plurality of keywords is set, and the writing order also represents the analysis order of the keywords of the same type. For example, the writing Order of the keywords may be set to be "Select- > white- > Group By- > Pivot- > Order By", and when four keywords are simultaneously included in the query language command, the priority Order is sequentially resolved from left to right, and the condition of the four keywords needs to be satisfied simultaneously. Or in addition the language priority may specify the parsing order of expressions referenced under the same key. For example, when "brackets" exist in an expression, the expression in "brackets" may be first subjected to calculation processing. For ease of understanding, taking the following two expressions as examples, "false and true or true" and "false and (true or true)", it can be known from the grammatical priority that "and" has a priority greater than "or", so the first expression is sequentially parsed in order from left to right, and the result is "true". The second expression has "()", and the "()" has a priority higher than "and", so that the "()" expression needs to be analyzed first, and the result is "false".
It should be noted that, the expression type and the grammar priority of the determined keyword provided in the above embodiment are only exemplary, and are not limited to the above implementation, and the expression type and the language priority may be specifically set according to the actual requirement scenario.
Based on this, when parsing the target character string in the lexical analysis result using the parsing rule, the processing device may parse the target character string into the target phrase based on the expression type and the grammatical priority that each keyword can refer to. Taking the application scenario as an example, after the lexical analysis result is obtained, the target character string can be resolved into two phrases, namely 'Select a' and 'white a > 1', according to the expression types and grammar priorities that can be cited by the keywords Select and white.
S104: and generating an analysis command based on the grammar analysis result.
After determining the parsing result, a parsing command can be generated based on the parsing result so as to process the data to be processed by using the parsing command later.
Optionally, before generating the parsing command, the determined parsing result may be parsed based on the semantic analysis rule to determine whether the parsing result conforms to the semantics. Wherein the semantic analysis rules may be predetermined. Alternatively, the user may enumerate all error information that does not conform to the semantics as error content that does not conform to the semantics analysis rules, and then parse through the parsing result based on the semantics error information. The error information may be an error occurring in the target phrase itself in the parsing result, or an error occurring in a relationship between different phrases. Alternatively, the non-semantically compliant error information may include the following:
Parameters of select, group By, pivot, and Order By keywords cannot be repeated;
group By, pivot, where keywords cannot be followed By an aggregation function;
when select uses an aggregation function, columns that do not use an aggregation function must be used By Group By;
4. when using Group By or Pivot, select must use an aggregation function;
5. in the case of Select using an aggregation function, the columns used in Order By must be referenced in Select at the same time;
6. columns used in Pivot cannot be used in Select;
7. when Pivot is used, the aggregation function cannot be used in Order By.
When the parsing results all conform to the semantic analysis rules, that is, no error information which does not conform to the semantics appears, the processing device can generate the parsing command based on the target phrase in the parsing results so as to process the data to be processed according to the parsing command.
In one possible implementation, the processing device may generate tree parsing results, i.e., parse commands, based on the parsing results. The root node of the tree analysis result is a keyword in the target phrase, and the child nodes connected with the root node are parameter information referenced by the keyword, namely, parameter information in an expression referenced by the keyword. According to the above embodiment, the query language has 5 keywords, so the root nodes of the tree analysis result have 5 root nodes at most. That is, the first layer of the tree analysis result is each keyword included in the syntax analysis result, the second layer includes parameter information referenced by each keyword, each later layer is a node of a parameter, and the type of the parameter, sub-parameters corresponding to the parameter, and the like can be recorded. Taking the above application scenario as an example, the tree analysis result obtained by the processing device analyzing the query language command "Select a white a >1" is shown in fig. 2. The first layer is keywords Select and white, the tree analysis result of Select represents that the column name parameter of the reference and the reference is A, the tree analysis result of white represents that the column name parameter of the reference is A, the digital value of the parameter is 1, and the functional relation between the two is larger than. Because the tree-shaped analysis result can better embody the relation between character strings and grammar priority, the efficiency of analyzing the query language command can be improved.
In addition, when the grammar analysis result does not accord with the semantic analysis rule, that is, the grammar analysis result has errors matched with the error information which does not accord with the semantic, the error information which does not accord with the semantic analysis rule can be output, so that a user can modify the query language command in time, and the efficiency of processing the table data is improved.
S105: and processing the data to be processed based on the analysis command.
After the processing device analyzes the query language command to obtain an analysis command, the data to be processed can be processed based on the analysis command.
In one possible implementation, the parse command includes one or more keywords and their corresponding reference parameters, where each keyword may correspond to implementing a data processing function. For example, the data processing function corresponding to the keyword Select is "return data column", the data processing function corresponding to the keyword Where is "condition judgment (similar screening)" or the like. That is, the data processing function corresponding to each keyword may be predefined. For example, the data processing function to be implemented corresponding to each keyword may be defined by writing a program or the like in a similar manner to the implementation of defining the function, and the defined function program is stored in the processing device in advance. When the processing device acquires the keywords and the reference parameters thereof in the analysis command, the processing function of the table data corresponding to the reference parameters can be realized according to the definition function of the prestored keywords. Taking the tree analysis result shown in fig. 2 as an example, the data processing apparatus may return data greater than 1 (where a > 1) in the field a column (select a) according to the tree analysis result.
Alternatively, the processing device may include an parsing device and a data processing device, where the parsing device may be configured to parse the query language command to obtain a parse command, and then the parsing device may send the parse command to the data processing device, where the data processing device processes the data to be processed according to the parse command.
By the method for processing the table data, the table data can be processed by using the query language command, so that the diversity of data processing functions for the table data is improved, processing steps can be simplified when the complex data processing functions are realized, and user experience is improved.
Based on the method embodiment, the embodiment of the application also provides a table data processing device. Referring to fig. 3, fig. 3 is a schematic diagram of a table data processing apparatus according to an embodiment of the present application.
The apparatus 300 may include:
a first obtaining unit 301, configured to obtain a processing command for data to be processed in a table, where the processing command is a query language command;
a second obtaining unit 302, configured to parse the query language command based on a lexical analysis rule, to obtain a lexical analysis result;
A third obtaining unit 303, configured to parse the lexical analysis result based on a syntax analysis rule, to obtain a syntax analysis result;
a parsing unit 304, configured to generate a parsing command based on the parsing result;
and the processing unit 305 is configured to process the data to be processed based on the parsing command.
In one possible implementation, the lexical analysis rule includes: determining a plurality of character string types included in the query language, each character string type in the plurality of character string types including one or more character strings;
the second obtaining unit 302 is specifically configured to traverse the character string of the query language command, and determine a target character string that matches any one of the plurality of character string types.
In one possible implementation, the parsing rule includes: determining a plurality of keywords of a query language; determining an expression type referenced by each of the plurality of keywords; determining grammar priority;
the third obtaining unit 303 is specifically configured to process the target character string into a target phrase based on the expression type and the grammar priority referred to by each keyword.
In one possible implementation manner, the target phrase includes a keyword and parameter information referenced by the keyword, and the parsing unit 304 is specifically configured to generate a tree parsing result based on the target phrase, where a root node of the tree parsing result is the keyword in the target phrase, and a child node connected to the root node is the parameter information referenced by the keyword.
In one possible implementation, the apparatus 300 further includes: a determination unit; before generating an analysis command based on the syntax analysis result, the determining unit is used for analyzing the syntax analysis result based on a semantic analysis rule and determining that the syntax analysis result accords with the semantic analysis rule.
In one possible implementation, the semantic analysis rule includes: determining error information which does not conform to the semantics in the query language as error content which does not conform to the semantic analysis rules;
the parsing unit 304 is specifically configured to traverse the parsing result based on the error information that does not conform to the semantics.
In a possible implementation manner, the determining unit is further configured to output error content that does not conform to the semantic analysis rule when it is determined that the parsing result does not conform to the semantic analysis rule.
The beneficial effects of the table data processing device provided in the embodiment of the present application can be seen in the above method embodiments, and are not described herein.
It should be noted that, for specific implementation of each unit in this embodiment, reference may be made to the related description in the above method embodiment. The division of the units in the embodiment of the application is schematic, which is merely a logic function division, and other division manners may be adopted in actual implementation. Each functional unit in the embodiments of the present application may be integrated in one processing unit, or each unit may exist alone physically, or two or more units may be integrated in one unit. For example, in the above embodiment, the processing unit and the transmitting unit may be the same unit or may be different units. The integrated units may be implemented in hardware or in software functional units.
Referring to fig. 4, a schematic diagram of an electronic device 400 suitable for use in implementing embodiments of the present application is shown. The terminal device in the embodiments of the present application may include, but is not limited to, mobile terminals such as mobile phones, notebook computers, digital broadcast receivers, PDAs (personal digital assistants), PADs (tablet computers), PMPs (portable multimedia players), in-vehicle terminals (e.g., in-vehicle navigation terminals), and the like, and fixed terminals such as digital TVs, desktop computers, and the like. The electronic device shown in fig. 4 is only an example and should not be construed as limiting the functionality and scope of use of the embodiments herein.
As shown in fig. 4, the electronic device 400 may include a processing means (e.g., a central processing unit, a graphics processor, etc.) 401, which may perform various suitable actions and processes according to a program stored in a Read Only Memory (ROM) 402 or a program loaded from a storage means 408 into a Random Access Memory (RAM) 403. In the RAM403, various programs and data necessary for the operation of the electronic device 400 are also stored. The processing device 401, the ROM 402, and the RAM403 are connected to each other by a bus 404. An input/output (I/O) interface 405 is also connected to bus 404.
In general, the following devices may be connected to the I/O interface 405: input devices 406 including, for example, a touch screen, touchpad, keyboard, mouse, camera, microphone, accelerometer, gyroscope, etc.; an output device 407 including, for example, a Liquid Crystal Display (LCD), a speaker, a vibrator, and the like; storage 408 including, for example, magnetic tape, hard disk, etc.; and a communication device 409. The communication means 409 may allow the electronic device 400 to communicate with other devices wirelessly or by wire to exchange data. While fig. 4 shows an electronic device 400 having various means, it is to be understood that not all of the illustrated means are required to be implemented or provided. More or fewer devices may be implemented or provided instead.
In particular, according to embodiments of the present application, the processes described above with reference to flowcharts may be implemented as computer software programs. For example, embodiments of the present application include a computer program product comprising a computer program embodied on a non-transitory computer readable medium, the computer program comprising program code for performing the method shown in the flow chart. In such an embodiment, the computer program may be downloaded and installed from a network via communications device 409, or from storage 408, or from ROM 402. The above-described functions defined in the methods of the embodiments of the present application are performed when the computer program is executed by the processing means 401.
The electronic device provided in the embodiment of the present application and the method provided in the foregoing embodiment belong to the same inventive concept, and technical details not described in detail in the present embodiment can be seen in the foregoing embodiment, and the present embodiment has the same beneficial effects as the foregoing embodiment.
The present embodiment provides a computer storage medium having stored thereon a computer program which, when executed by a processor, implements the method provided by the above embodiment.
It should be noted that the computer readable medium described in the present application may be a computer readable signal medium or a computer readable storage medium, or any combination of the two. The computer readable storage medium can be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or a combination of any of the foregoing. More specific examples of the computer-readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing. In the context of this document, a computer readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device. In the present application, however, a computer-readable signal medium may include a data signal that propagates in baseband or as part of a carrier wave, with the computer-readable program code embodied therein. Such a propagated data signal may take any of a variety of forms, including, but not limited to, electro-magnetic, optical, or any suitable combination of the foregoing. A computer readable signal medium may also be any computer readable medium that is not a computer readable storage medium and that can communicate, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device. Program code embodied on a computer readable medium may be transmitted using any appropriate medium, including but not limited to: electrical wires, fiber optic cables, RF (radio frequency), and the like, or any suitable combination of the foregoing.
In some implementations, the clients, servers may communicate using any currently known or future developed network protocol, such as HTTP (Hyper Text Transfer Protocol ), and may be interconnected with any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include a local area network ("LAN"), a wide area network ("WAN"), the internet (e.g., the internet), and peer-to-peer networks (e.g., ad hoc peer-to-peer networks), as well as any currently known or future developed networks.
The computer readable medium may be contained in the electronic device; or may exist alone without being incorporated into the electronic device.
The computer readable medium carries one or more programs which, when executed by the electronic device, cause the electronic device to perform the method described above.
Computer program code for carrying out operations of the present application may be written in one or more programming languages, including, but not limited to, an object oriented programming language such as Java, smalltalk, C ++ and conventional procedural programming languages, such as the "C" programming language or similar programming languages. The program code may execute entirely on the user's computer, partly on the user's computer, as a stand-alone software package, partly on the user's computer and partly on a remote computer or entirely on the remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer through any kind of network, including a Local Area Network (LAN) or a Wide Area Network (WAN), or may be connected to an external computer (for example, through the Internet using an Internet service provider).
The flowcharts and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of systems, methods and computer program products according to various embodiments of the present application. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of code, which comprises one or more executable instructions for implementing the specified logical function(s). It should also be noted that, in some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams and/or flowchart illustration, and combinations of blocks in the block diagrams and/or flowchart illustration, can be implemented by special purpose hardware-based systems which perform the specified functions or acts, or combinations of special purpose hardware and computer instructions.
The units involved in the embodiments of the present application may be implemented by software, or may be implemented by hardware. Where the names of the units/modules do not constitute a limitation of the units themselves in some cases.
The functions described above herein may be performed, at least in part, by one or more hardware logic components. For example, without limitation, exemplary types of hardware logic components that may be used include: a Field Programmable Gate Array (FPGA), an Application Specific Integrated Circuit (ASIC), an Application Specific Standard Product (ASSP), a system on a chip (SOC), a Complex Programmable Logic Device (CPLD), and the like.
In the context of this application, a machine-readable medium may be a tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device. The machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium. The machine-readable medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any suitable combination of the foregoing. More specific examples of a machine-readable storage medium would include an electrical connection based on one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
According to one or more embodiments of the present application, there is provided a method for processing table data, which may include:
acquiring a processing command aiming at data to be processed in a table, wherein the processing command is a query language command;
analyzing the query language command based on a lexical analysis rule to obtain a lexical analysis result;
analyzing the lexical analysis result based on a grammar analysis rule to obtain a grammar analysis result;
generating an analysis command based on the syntax analysis result;
and processing the data to be processed based on the analysis command.
According to one or more embodiments of the present application, the lexical analysis rules include:
determining a plurality of character string types included in the query language, each character string type in the plurality of character string types including one or more character strings;
the parsing the query language command based on the lexical analysis rule to obtain a lexical analysis result comprises the following steps:
traversing the character string of the query language command, and determining a target character string matched with any character string type in the plurality of character string types.
According to one or more embodiments of the present application, the parsing rules include:
Determining a plurality of keywords of a query language;
determining an expression type referenced by each of the plurality of keywords;
determining grammar priority;
the parsing rule-based parsing the lexical analysis result to obtain a parsing result comprises the following steps:
the target character string is processed into a target phrase based on the expression type referenced by each keyword and the grammar priority.
According to one or more embodiments of the present application, the target phrase includes a keyword and parameter information referenced by the keyword, and when the parsing result conforms to the semantic parsing rule, generating a parsing command based on the parsing result includes:
and generating a tree-shaped analysis result based on the target phrase, wherein a root node of the tree-shaped analysis result is a keyword in the target phrase, and a child node connected with the root node is parameter information referenced by the keyword.
In accordance with one or more embodiments of the present application, before generating the parse command based on the parsing result, the method further comprises:
analyzing the grammar analysis result based on the semantic analysis rule, and determining that the grammar analysis result accords with the semantic analysis rule.
According to one or more embodiments of the present application, the semantic analysis rules include:
determining error information which does not conform to the semantics in the query language as error content which does not conform to the semantic analysis rules;
the parsing result is parsed based on semantic analysis rules, and the parsing result comprises:
traversing the grammar analysis result based on the error information which does not conform to the semantics.
According to one or more embodiments of the present application, the method further comprises:
and outputting error contents which do not accord with the semantic analysis rules when the grammar analysis results are determined to not accord with the semantic analysis rules.
In accordance with one or more embodiments of the present application, there is provided a processing apparatus of table data, which may include:
the first acquisition unit is used for acquiring a processing command aiming at data to be processed in the table, wherein the processing command is a query language command;
the second acquisition unit is used for analyzing the query language command based on the lexical analysis rule to acquire a lexical analysis result;
the third acquisition unit is used for analyzing the lexical analysis result based on the grammar analysis rule to acquire a grammar analysis result;
the analysis unit is used for analyzing the grammar analysis result based on a semantic analysis rule, and generating an analysis command based on the grammar analysis result when the grammar analysis result accords with the semantic analysis rule, wherein the lexical analysis rule, the grammar analysis rule and the semantic analysis rule are predetermined;
And the processing unit is used for processing the data to be processed based on the analysis command.
In one or more embodiments of the present application, the lexical analysis rules include: determining a plurality of character string types included in the query language, each character string type in the plurality of character string types including one or more character strings;
the second obtaining unit is specifically configured to traverse the character string of the query language command, and determine a target character string that matches any one of the plurality of character string types.
In one or more embodiments of the present application, the parsing rules include: determining a plurality of keywords of a query language; determining an expression type referenced by each of the plurality of keywords; determining grammar priority;
the third obtaining unit is specifically configured to process the target character string into a target phrase based on the expression type and the grammar priority referred to by each keyword.
In one or more embodiments of the present application, the target phrase includes a keyword and parameter information referenced by the keyword, and the parsing unit is specifically configured to generate a tree parsing result based on the target phrase, where a root node of the tree parsing result is the keyword in the target phrase, and a child node connected to the root node is the parameter information referenced by the keyword.
In one or more embodiments of the present application, the apparatus further comprises: a determination unit; before generating an analysis command based on the syntax analysis result, the determining unit is used for analyzing the syntax analysis result based on a semantic analysis rule and determining that the syntax analysis result accords with the semantic analysis rule.
In one or more embodiments of the present application, the semantic analysis rules include: determining error information which does not conform to the semantics in the query language as error content which does not conform to the semantic analysis rules;
the parsing unit is specifically configured to traverse the parsing result based on the error information that does not conform to the semantics.
In one or more embodiments of the present application, the determining unit is further configured to output error content that does not conform to the semantic analysis rule when it is determined that the parsing result does not conform to the semantic analysis rule.
According to one or more embodiments of the present application, there is provided an electronic device, the device comprising: a processor and a memory;
the memory is used for storing instructions or computer programs;
the processor is configured to execute the instructions or the computer program in the memory, so that the electronic device executes the method for processing table data.
According to one or more embodiments of the present application, there is provided a computer-readable storage medium having instructions stored therein, which when executed on a device, cause the device to perform the method of processing tabular data.
It should be noted that, in the present description, each embodiment is described in a progressive manner, and each embodiment is mainly described in a different manner from other embodiments, and identical and similar parts between the embodiments are all enough to refer to each other. For the system or device disclosed in the embodiments, since it corresponds to the method disclosed in the embodiments, the description is relatively simple, and the relevant points refer to the description of the method section.
It should be understood that in this application, "at least one" means one or more, and "a plurality" means two or more. "and/or" for describing the association relationship of the association object, the representation may have three relationships, for example, "a and/or B" may represent: only a, only B and both a and B are present, wherein a, B may be singular or plural. The character "/" generally indicates that the context-dependent object is an "or" relationship. "at least one of" or the like means any combination of these items, including any combination of single item(s) or plural items(s). For example, at least one (one) of a, b or c may represent: a, b, c, "a and b", "a and c", "b and c", or "a and b and c", wherein a, b, c may be single or plural.
It is further noted that relational terms such as first and second, and the like are used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Moreover, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising one … …" does not exclude the presence of other like elements in a process, method, article, or apparatus that comprises the element.
The steps of a method or algorithm described in connection with the embodiments disclosed herein may be embodied directly in hardware, in a software module executed by a processor, or in a combination of the two. The software modules may be disposed in Random Access Memory (RAM), memory, read Only Memory (ROM), electrically programmable ROM, electrically erasable programmable ROM, registers, hard disk, a removable disk, a CD-ROM, or any other form of storage medium known in the art.
The previous description of the disclosed embodiments is provided to enable any person skilled in the art to make or use the present application. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the generic principles defined herein may be applied to other embodiments without departing from the spirit or scope of the application. Thus, the present application is not intended to be limited to the embodiments shown herein but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.

Claims (10)

1. A method of processing form data, the method comprising:
acquiring a processing command aiming at data to be processed in a table, wherein the processing command is a query language command;
analyzing the query language command based on a lexical analysis rule to obtain a lexical analysis result;
analyzing the lexical analysis result based on a grammar analysis rule to obtain a grammar analysis result;
generating an analysis command based on the syntax analysis result;
and processing the data to be processed based on the analysis command.
2. The method of claim 1, wherein the lexical analysis rule comprises:
Determining a plurality of character string types included in the query language, each character string type in the plurality of character string types including one or more character strings;
the parsing the query language command based on the lexical analysis rule to obtain a lexical analysis result comprises the following steps:
traversing the character string of the query language command, and determining a target character string matched with any character string type in the plurality of character string types.
3. The method of claim 1, wherein the parsing rules comprise:
determining a plurality of keywords of a query language;
determining an expression type referenced by each of the plurality of keywords;
determining grammar priority;
the parsing rule-based parsing the lexical analysis result to obtain a parsing result comprises the following steps:
the target character string is processed into a target phrase based on the expression type referenced by each keyword and the grammar priority.
4. The method of claim 3, wherein the target phrase includes a keyword and parameter information referenced by the keyword, the generating a parse command based on the parsing result, comprising:
And generating a tree-shaped analysis result based on the target phrase, wherein a root node of the tree-shaped analysis result is a keyword in the target phrase, and a child node connected with the root node is parameter information referenced by the keyword.
5. The method of claim 1, wherein prior to generating a parse command based on the parsing result, the method further comprises:
analyzing the grammar analysis result based on the semantic analysis rule, and determining that the grammar analysis result accords with the semantic analysis rule.
6. The method of claim 5, wherein the semantic analysis rules comprise:
determining error information which does not conform to the semantics in the query language as error content which does not conform to the semantic analysis rules;
the parsing result is parsed based on semantic analysis rules, and the parsing result comprises:
traversing the grammar analysis result based on the error information which does not conform to the semantics.
7. The method of claim 5, wherein the method further comprises:
and outputting error contents which do not accord with the semantic analysis rules when the grammar analysis results are determined to not accord with the semantic analysis rules.
8. A form data processing apparatus, the apparatus comprising:
the first acquisition unit is used for acquiring a processing command aiming at data to be processed in the table, wherein the processing command is a query language command;
the second acquisition unit is used for analyzing the query language command based on the lexical analysis rule to acquire a lexical analysis result;
the third acquisition unit is used for analyzing the lexical analysis result based on the grammar analysis rule to acquire a grammar analysis result;
the parsing unit is used for generating parsing commands based on the parsing result;
and the processing unit is used for processing the data to be processed based on the analysis command.
9. An electronic device, the device comprising: a processor and a memory;
the memory is used for storing instructions or computer programs;
the processor for executing the instructions or computer program in the memory to cause the electronic device to perform the method of any of claims 1-7.
10. A computer readable storage medium having instructions stored therein which, when executed on a device, cause the device to perform the method of any of claims 1-7.
CN202310186547.4A 2023-03-01 2023-03-01 Processing method, device, equipment and storage medium of table data Pending CN116166856A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202310186547.4A CN116166856A (en) 2023-03-01 2023-03-01 Processing method, device, equipment and storage medium of table data

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202310186547.4A CN116166856A (en) 2023-03-01 2023-03-01 Processing method, device, equipment and storage medium of table data

Publications (1)

Publication Number Publication Date
CN116166856A true CN116166856A (en) 2023-05-26

Family

ID=86418184

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202310186547.4A Pending CN116166856A (en) 2023-03-01 2023-03-01 Processing method, device, equipment and storage medium of table data

Country Status (1)

Country Link
CN (1) CN116166856A (en)

Similar Documents

Publication Publication Date Title
CN111291103B (en) Interface data analysis method and device, electronic equipment and storage medium
CN109522341B (en) Method, device and equipment for realizing SQL-based streaming data processing engine
CN111324342B (en) Method, device, medium and electronic equipment for generating interface layer code
US20170308620A1 (en) Making graph pattern queries bounded in big graphs
CN109189395B (en) Data analysis method and device
CN111506900A (en) Vulnerability detection method and device, electronic equipment and computer storage medium
CN114035805A (en) Code conversion method, apparatus, medium, and device for pre-compiler
CN115221191A (en) Virtual column construction method based on data lake and data query method
CN111666218B (en) Code auditing method, device, electronic equipment and medium
CN113220281A (en) Information generation method and device, terminal equipment and storage medium
CN111124541B (en) Configuration file generation method, device, equipment and medium
CN116860286A (en) Page dynamic update method, device, electronic equipment and computer readable medium
CN111752644A (en) Interface simulation method, device, equipment and storage medium
CN110110032B (en) Method and device for updating index file
CN116166856A (en) Processing method, device, equipment and storage medium of table data
CN111737571B (en) Searching method and device and electronic equipment
CN111399843B (en) Method, system and electronic equipment for mapping SQL running information to SQL file
CN116340591A (en) Processing method, device, equipment and storage medium of table data
CN112069214A (en) Rule processing method, device, equipment and storage medium
CN111078230A (en) Code generation method and device
CN111382389B (en) Multi-theme page generation method and device, electronic equipment and storage medium
CN111221424A (en) Method, apparatus, electronic device, and computer-readable medium for generating information
CN113609309B (en) Knowledge graph construction method and device, storage medium and electronic equipment
CN115374320B (en) Text matching method and device, electronic equipment and computer medium
CN117493375A (en) Structured query statement similarity detection method, device and equipment

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination