WO2021073195A1 - Computer-implemented method and device for generating spreadsheet formula, and storage medium - Google Patents

Computer-implemented method and device for generating spreadsheet formula, and storage medium Download PDF

Info

Publication number
WO2021073195A1
WO2021073195A1 PCT/CN2020/104838 CN2020104838W WO2021073195A1 WO 2021073195 A1 WO2021073195 A1 WO 2021073195A1 CN 2020104838 W CN2020104838 W CN 2020104838W WO 2021073195 A1 WO2021073195 A1 WO 2021073195A1
Authority
WO
WIPO (PCT)
Prior art keywords
level
directed graph
node
current
operator
Prior art date
Application number
PCT/CN2020/104838
Other languages
French (fr)
Chinese (zh)
Inventor
丛明舒
瞿中明
曲嘉宝
Original Assignee
深圳逻辑汇科技有限公司
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 深圳逻辑汇科技有限公司 filed Critical 深圳逻辑汇科技有限公司
Publication of WO2021073195A1 publication Critical patent/WO2021073195A1/en

Links

Images

Classifications

    • 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/174Form filling; Merging
    • 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

Definitions

  • This application relates to electronic form information processing, and in particular to computer-implemented methods, devices and storage media for generating electronic form formulas.
  • Spreadsheets usually include dozens of pages (sheets), thousands of rows (rows), and tens of thousands of cells (Cells), and there is a very complex mutual calculation relationship between each cell.
  • the contents are all formulas.
  • this application proposes a computer-implemented method, device, and storage medium for generating spreadsheet formulas in response to at least one of the above-mentioned problems.
  • a computer-implemented method for generating an electronic form formula comprising: obtaining a hierarchical formula for the electronic form, the hierarchical formula including an operator and a hierarchical reference , Wherein the level reference corresponds to one or more nodes in one or more levels in the hierarchical structure of the spreadsheet, wherein each level has at least one node and has a corresponding level type, and each node corresponds to One or more cells in the electronic form, wherein the hierarchical structure further includes the affiliation relationship between the one or more nodes; based on the correspondence between the hierarchical reference and the one or more nodes Relationship to determine the dependency relationship between the one or more nodes; determine the calculation relationship between the one or more nodes based on the operator and the dependency relationship; and at least based on the use of the spreadsheet
  • the hierarchical structure and the calculation relationship are used to generate the spreadsheet formula.
  • an apparatus for generating an electronic form formula including: components for executing the steps of the method according to any one of the foregoing items.
  • a device for generating spreadsheet formulas including: at least one processor; and at least one storage device, the at least one storage device stores instructions, when the instructions are The execution of the at least one processor causes the at least one processor to execute the method according to any one of the foregoing items.
  • a non-transitory computer-readable storage medium storing instructions that when executed by a processor cause the method as described in any one of the foregoing items to be performed.
  • an apparatus for generating an electronic form formula comprising: a hierarchical formula editor configured to obtain a hierarchical formula for the electronic form ,
  • the level formula includes an operator and a level reference, wherein the level reference corresponds to one or more nodes in one or more levels in the hierarchical structure of the spreadsheet, wherein each level has at least one node and Has a corresponding level type, each node corresponds to one or more cells in the spreadsheet, wherein the hierarchical structure also includes the membership relationship between the one or more nodes; a level formula parser, so
  • the hierarchical formula parser is configured to determine the dependency relationship between the one or more nodes based on the correspondence between the hierarchical reference and the one or more nodes; the hierarchical formula parser is further configured In order to determine the calculation relationship between the one or more nodes based on the operator and the dependency relationship; and a formula translator, the formula translator is configured to be based on at least the The hierarchy structure and the calculation relationship
  • an electronic form formula can be written intuitively. Therefore, you can easily understand the meaning of the formula by reading the formula itself in the spreadsheet.
  • formulas can be automatically written in electronic software. Therefore, you can make intelligent prompts or auto-complete when writing spreadsheet formulas.
  • formulas in the electronic form can be reused easily. Reusable formulas with semantic information can be automatically converted into formulas written with cell location information in the spreadsheet.
  • formula errors in the electronic form can be efficiently avoided or discovered. Therefore, even when the spreadsheet contains many formulas, it is easy to find errors in some of the formulas.
  • Fig. 1 is a flowchart schematically showing a computer-implemented method for generating spreadsheet formulas according to some embodiments of the present application.
  • Fig. 2 is a schematic diagram schematically showing a hierarchical structure for an electronic form according to some embodiments of the present application.
  • Fig. 3 is a schematic diagram schematically showing a hierarchical structure for an electronic form according to some embodiments of the present application.
  • Fig. 4 is a schematic diagram schematically showing a hierarchical calculation diagram for representing a hierarchical structure of an electronic form according to some embodiments of the present application.
  • Fig. 5 is a schematic diagram schematically showing nodes in a hierarchical calculation graph according to some embodiments of the present application.
  • Fig. 6 is a flowchart schematically showing a process for parsing text codes to generate a hierarchical formula according to some embodiments of the present application.
  • FIG. 7 is a schematic diagram schematically showing a directed graph of a compound operator for a hierarchy according to some embodiments of the present application.
  • FIG. 8 is a schematic diagram schematically showing a directed graph of a compound operator for a cell according to some embodiments of the present application.
  • FIG. 9 is a schematic diagram schematically illustrating a process for specifying a dependent cell for an operator according to some embodiments of the present application.
  • FIG. 10 is a schematic diagram schematically showing a process for converting a compound operator for a hierarchy into a compound operator for a cell according to some embodiments of the present application.
  • FIG. 11 is a schematic diagram schematically showing a directed graph of a compound operator for a cell after conversion according to some embodiments of the present application.
  • Fig. 12 is a schematic diagram schematically showing a directed graph of a custom atomic operator according to some embodiments of the present application.
  • FIG. 13 is a block diagram schematically showing an apparatus for generating an electronic form formula according to some embodiments of the present application.
  • Fig. 14 is a schematic block diagram showing an information processing device that can be used to implement an electronic form formula according to some embodiments of the present application.
  • FIG. 1 is a flowchart schematically showing a computer-implemented method 100 for generating spreadsheet formulas according to some embodiments of the present application.
  • a hierarchical formula for the electronic form can be obtained.
  • the hierarchical formula includes an operator and a hierarchical reference, where the hierarchical reference corresponds to one or more levels in the hierarchical structure used for the electronic form. One or more nodes in.
  • each level may have at least one node and a corresponding level type, and each node may correspond to one or more cells in the spreadsheet.
  • the hierarchical structure may also include the affiliation relationship between one or more nodes.
  • Fig. 2 is a schematic diagram schematically showing a hierarchical structure for an electronic form according to some embodiments of the present application.
  • Fig. 3 is a schematic diagram schematically showing a hierarchical structure for an electronic form according to some embodiments of the present application.
  • the hierarchical structure used for the electronic form may include, for example, the following levels obtained by dividing the electronic form: book, sheet, section, table, Block, row, column, interval, cell, etc. Note that the above-mentioned division method for the hierarchical structure of the electronic form is only exemplary, and other division methods may also be adopted.
  • the workbook can be a spreadsheet file (such as a file in .xls or .xlsx format), and the workbook can include multiple pages. Pages can include sections or tables, and each section can also include subsections and tables.
  • the table can include rows, columns, or blocks. A block can be a collection of closely related rows or columns, and each block can also include sub-blocks.
  • FIG. 2 shows an example of the hierarchical structure of pages in an electronic form.
  • the first-level heading 1 and the first-level heading 2 can divide the pages in the spreadsheet into the first section and the second section.
  • Section 1 may further include second-level heading 1.1 and second-level heading 1.2.
  • Second-level heading 1.1 and second-level heading 1.2 may divide section 1 into section 1.1 and section 1.2 (in this example, section 1.2 Section is empty).
  • Section 1.1 can include two tables, namely Table 1.1.A and Table 1.1.B.
  • section 2 may further include second-level heading 2.1 and second-level heading 2.2, and second-level heading 2.1 and second-level heading 2.2 may divide section 2 into section 2.1 and section 2.2.
  • Section 2 can also include Table 2.A.
  • Section 2.1 may include third-level heading 2.1.1 and third-level heading 2.1.2.
  • the third level heading 2.1.2 may include section 2.1.2.
  • Section 2.1.2 may include Table 2.1.2.A.
  • Section 2.2 may include Table 2.2.A and Table 2.2.B. Note that you can add names to both the title and the table.
  • a table can include rows, columns, or blocks, and a block can include multiple rows or columns.
  • FIG. 3 shows an example of the hierarchical structure of the table in the page in the spreadsheet.
  • the table may include, for example, 11 rows/columns, in which there may be 4 first-level rows/columns, namely, first-level rows/columns 1, first-level rows/columns, and first-level rows/columns. Row/column 4 and first-level row/column 6.
  • the second-level row/column 3.1, the second-level row/column 3.2, and the second-level row/column 3.3 are second-level rows/columns, and they can form the first-level block 3.
  • third-level row/column 5.2.1 and the third-level row/column 5.2.2 are the third-level rows/columns, and they can form the second-level block 5.2.
  • the second-level row/column 5.1, the second-level block 5.2, and the second-level row/column 5.3 may constitute the first-level block 5.
  • Cells at intersections of rows (or row blocks including multiple rows) and certain columns (or column blocks including multiple columns) may form intervals.
  • rows, row blocks, columns, and column blocks can all include intervals.
  • the hierarchical structure of the electronic form can be represented by a hierarchical calculation graph.
  • the hierarchical calculation diagram can contain all the information in the electronic form, which can form a one-to-one correspondence with the electronic form.
  • FIG. 4 is a schematic diagram schematically showing a hierarchical calculation diagram 301 for representing the hierarchical structure of an electronic form according to some embodiments of the present application.
  • each of the nodes 302 to 311 in the hierarchical calculation graph 301 may represent various levels in the hierarchical structure for the spreadsheet.
  • Each node 302 to 311 may have a corresponding type, which may be various levels in the hierarchical structure of the spreadsheet, such as workbook, page, section, table, block, row, column, interval, cell, and so on.
  • different shapes can be used to represent different types of nodes.
  • the shape of the nodes 307 to 311 is a rhombus, which means that the type of the node is a cell.
  • the edges between the various nodes in the hierarchical calculation graph 301 can be divided into two types, for example.
  • one type of edge in the hierarchical calculation graph 301 may be a membership relationship edge, which represents the membership relationship between one or more nodes.
  • solid arrows can be used to indicate the edges of the membership relationship.
  • the membership edge 316 from the node 302 to the node 303 may represent that the node 303 is a child of the node 302, that is, the node 303 belongs to the node 302.
  • another type of edge in the hierarchical calculation graph 301 may be a calculation relationship edge, which represents a calculation relationship between one or more nodes. Dotted arrows can be used in the figure to indicate the calculation relationship edge.
  • the calculation relationship edge 314 from the node 303 to the node 305 may represent that the node 305 is calculated by the node 303.
  • Fig. 5 is a schematic diagram schematically showing a node 305 in a hierarchical calculation diagram according to some embodiments of the present application.
  • the node 305 in the hierarchical calculation graph may include: the type 402 of the corresponding level of the node, and the child nodes 403 connected by the affiliation edge of the node (for example, for the node 305, a node 309 is stored).
  • Pointer the operator 404 of the node, the dependent node 405 on which the node depends (for example, for the node 305, a pointer to the node 303 is stored), the semantic information 406 of the node (for example, the name of the node, the label, etc.) ,
  • Other information related to the node (optional) 407 for example, node modifiers, attribute tags, etc.).
  • nodes in the hierarchical calculation graph may have a configuration similar to that of the node 305, which will not be repeated here.
  • the step S101 of obtaining the level formula for the electronic form may include: providing a graphical user interface editor, wherein the graphical user interface editor includes a user interface for specifying nodes and/or operators of different levels. Components; receiving input for components used to specify nodes and/or operators of different levels; and generating a level formula based on the input.
  • the user can specify different levels of nodes and/or operators by clicking and/or dragging the visual components provided in the graphical user interface editor, so that the level formula can be constructed more intuitively.
  • the graphical user interface editor can provide visual components, it can enable users to construct hierarchical formulas more intuitively, which improves the convenience of users.
  • the above step S101 of obtaining a hierarchical formula for an electronic form may also include: receiving a text code input by a user; and parsing the text code to generate a hierarchical formula.
  • a user can input a level formula in a plain text format through a text editor, and can generate a level formula by parsing the level formula in a plain text format, so that the level formula can be generated more efficiently.
  • operators may include atomic operators, and atomic operators may include one or more of the following: mathematical operators, mathematical functions, constants, system-defined functions, user-defined atomic operations symbol.
  • the mathematical operator can be "+”, “-", “*", "/” and other mathematical operators.
  • the mathematical function may be a mathematical function such as a summing function "SUM()", an averaging function “AVERAGE()” and the like.
  • the constant may be a constant such as "10" or "1 year”.
  • the system-defined function can be the data source function "SOURCE()”, the lag operation function ".lag(1 year)” and other system-defined functions. Among them, the data source function "SOURCE()” means receiving the data input by the user.
  • the lag calculation function ".lag(1 year)” represents the calculation that lags the data by 1 year.
  • the hierarchical reference may correspond to one or more nodes in one or more hierarchies in the hierarchical structure used for the electronic form.
  • the hierarchical reference can be referred to by a character string.
  • This level reference (a) represents a row (ROW) named "Revenue”. This row is named “Financial Statement” under the workbook (BOOK) named “DCF Model”. In the block named “US” under the table (TABLE) named “Income Statement” under the "SHEET” page (SHEET).
  • This level reference (b) represents the same meaning as the above level reference (a), but allows users to omit the level type without causing ambiguity, such as row (ROW), workbook (BOOK), page (SHEET) ), table (TABLE), block (BLOCK), etc.
  • This level reference (c) represents the same meaning as the above level reference (b).
  • the path represents the level passed through in the process of finding the referred level from the top to the bottom of the hierarchical structure representing the spreadsheet.
  • the path can be an absolute path, such as "DCF Model/Financial Statement/Income Statement/US" in the above-mentioned hierarchical reference (b); the path can also be a relative path, "./” indicates the current level, and "../” indicates the current The level to which the level belongs. For example, when the user is already under the page (SHEET) named “Financial Statement” under the workbook (BOOK) named “DCF Model”, the relative The path is expressed as "./Income Statement/US”.
  • the path can also be omitted. For example, if there is only one row named “Revenue” under the current table, then "Revenue” itself can refer to this row.
  • This level reference (f) represents all the rows from the row of "Revenue” (ROW) to the row of “Profit” (ROW).
  • This level reference (g) represents a block named “US” (BLOCK).
  • This block (BLOCK) is named “Financial Statement” under the workbook (BOOK) named “DCF Model”.
  • Under the table (TABLE) named “Income Statement” under "SHEET” page (SHEET).
  • This level reference (h) represents a column (COLUMN) named "2018". This column (COLUMN) is named “Financial Statement” under the workbook (BOOK) named “DCF Model”. Under the table (TABLE) named “Income Statement” under "SHEET” page (SHEET).
  • This level reference (i) represents all the columns from the column named “2018” (COLUMN) to the column named “2020” (COLUMN) in the current table.
  • This level reference (j) represents the cell named “2018” in the row named "Revenue”.
  • This hierarchical reference represents an interval composed of cells corresponding to all rows with the label "Inventory” in the column named "2018”.
  • the hierarchical structure used for the spreadsheet can be expressed as elements in the visual view in the graphical user interface, so that the hierarchical reference can be implemented directly through the elements in the visual view in the graphical user interface.
  • a level formula can be regarded as a series of atomic operators (or a compound operator composed of a series of atomic operators) acting on a parameter list composed of hierarchical references, and will act The result of is assigned to the left value of the hierarchy formula.
  • hierarchical formulas are shown below. Note that in some implementations of this application, the content within " ⁇ " can be used to represent hierarchical references.
  • ⁇ Total income ⁇ SUM( ⁇ US income: China income ⁇ )
  • the hierarchical formula entered by the user includes operators and hierarchical references. According to the different input methods of the level formula, it is recognized that the operators included in the level formula and the complexity of the level reference are different. If the user constructs the hierarchical formula by clicking and/or dragging the visual components in the graphical user interface, since the hierarchical reference or operator of the spreadsheet corresponding to each component is determined, only the corresponding graphical user interface component needs to be identified The hierarchical reference or operator of the spreadsheet is sufficient. If the user inputs a level formula in the form of a text code (that is, the input is a string), the text code needs to be parsed to identify operators and level references in the string.
  • a text code that is, the input is a string
  • FIG. 6 is a flowchart schematically showing a process 600 for parsing text codes to generate a hierarchical formula according to some embodiments of the present application.
  • step S601 the text code may be segmented to obtain a word segmentation stream.
  • the result of word segmentation is a word segmentation stream including the following word segmentation list:
  • step S601 the process 600 for parsing the text code to generate a hierarchical formula may proceed to step S603 and step S605.
  • step S603 the word segmentation related to the operator in the word segmentation stream can be identified to determine the operator.
  • the operator can be determined.
  • the atomic operator can be determined.
  • step S605 the word segmentation related to one or more nodes in one or more levels in the hierarchical structure of the electronic table in the word segmentation stream may be identified to determine the level reference.
  • the word segmentation related to one or more nodes in one or more levels in the hierarchical structure of the spreadsheet in the above word segmentation stream includes: “ ⁇ ”, “income”, “ ⁇ ”, “[ “, “forecast period”, “]”, “ ⁇ ", “income”, “:”, “..”, “/”, "income statement", " ⁇ ", " ⁇ ", "average revenue growth rate ", " ⁇ ”.
  • a hierarchical reference can be determined. Each level of reference can be referred to by one or more consecutive participles.
  • the matching process from word segmentation to hierarchical citation can support fuzzy matching. For example, if the above “revenue” is written as “Sales”, it can also be matched to the same level of reference.
  • hierarchical references that follow a specific syntax may be supported, but the supported syntax for referring to hierarchical references may be arbitrary.
  • step S607 a hierarchical formula may be generated according to the determined operator and hierarchical reference.
  • the hierarchical formula can be generated according to the determined operator and the hierarchical reference.
  • a hierarchical formula can be generated according to the determined atomic operator and hierarchical reference.
  • a compound operator may be constructed based on the atomic operators in the hierarchical formula, where the compound operator may include a combination of all the atomic operators in the hierarchical formula.
  • a compound operator that can include a combination of all atomic operators in the hierarchy formula can be constructed based on the identified atomic operator and its position in the word segmentation stream (such as relative position) .
  • step S607 may include generating a hierarchical formula according to the determined compound operator and a hierarchical reference.
  • a compound operator can be stored using one or more of the following items: a character string; a computer-implemented function pointed to by a function pointer; and a directed graph.
  • the compound operator can also be stored in the form of a computer-implemented function pointed to by a function pointer, where this function receives two parameters ⁇ x1 ⁇ and ⁇ x2 ⁇ .
  • the compound operator can also be stored in the form of a directed graph.
  • each node in a directed graph may represent an operator in a hierarchical formula
  • the directed edges between each node in a directed graph may represent a combination of operators in a hierarchical formula relationship.
  • each node in a directed graph can represent an atomic operator, a placeholder for a parameter, or a constant operator, and the directed edge between each node in a directed graph can represent a relationship between each node, such as an operation relationship.
  • the combination of classes can represent an atomic operator, a placeholder for a parameter, or a constant operator, and the directed edge between each node in a directed graph can represent a relationship between each node, such as an operation relationship.
  • FIG. 7 is a schematic diagram schematically showing a directed graph of a compound operator for a hierarchy according to some embodiments of the present application.
  • nodes 802 to 804 in the directed graph represent atomic operators
  • nodes 805 and 807 in the directed graph represent placeholders for parameters
  • node 806 in the directed graph represents constant operators.
  • the uppermost atomic operator is the atomic operator "*" in node 802 in the directed graph, which is based on the atomic operator ".lag(1)” in node 803 and node
  • the calculation results of the two atomic operators "+” in 804 are used as input variables, and the atomic operator ".lag(1)" in node 803 takes the parameter "x1" in node 805 as input variables.
  • the "+” in the node 804 takes the constant operator "1" in the node 806 and the parameter "x2" in the node 807 as input variables.
  • step S103 the dependency relationship between one or more nodes may be determined based on the correspondence relationship between the hierarchical reference and the one or more nodes.
  • the level reference may include the first level reference located on the left side of the equal sign in the level formula and the second level reference located on the right side of the equal sign in the level formula, where the first level reference (also Called lvalue) corresponds to the first node in one or more nodes, and the second-level reference corresponds to the second node in the one or more nodes (the second-level reference may be an empty set).
  • a hierarchical formula can be seen as a series of atomic operators (or a compound operator composed of a series of atomic operators) acting on a parameter list composed of hierarchical references, and assigning the result of the effect to The left value of the level formula.
  • each hierarchical reference in the hierarchical formula can uniquely correspond to a certain level in the hierarchical structure of the spreadsheet and a certain node in the hierarchical calculation graph.
  • the level reference on the left side of the equal sign in the level formula can be called the first level reference, and the node in the level calculation graph corresponding to the first level reference can be called the first node (or lvalue node) of this level formula (leftNode)).
  • the level reference on the right side of the equal sign in the level formula can be called the second level reference, and the node in the level calculation graph corresponding to the second level reference can be called the second node (or dependent node ( inNodes)).
  • Each level formula can uniquely correspond to a compound operator, a first node (or lvalue node), and a group of second nodes (or dependent nodes).
  • each compound operator and a matching first node (or lvalue node) and a set of second nodes (or dependent nodes) can also uniquely specify a level formula.
  • the meaning of the hierarchical formula can be to pass the second node (or dependent node) to the parameter placeholder in the compound operator, and assign the result obtained to the first node (or lvalue node).
  • the level reference " ⁇ income ⁇ [forecast period]” can be called the first level reference
  • the level on the right side of the equal sign in the level formula references " ⁇ income:../income statement ⁇ ” and " ⁇ average income Growth rate ⁇ ” can be referred to as a second-level citation.
  • the first node (or lvalue node) corresponding to the first-level reference " ⁇ income ⁇ [forecast period]" can be defined by the column label in the row named "income” in the spreadsheet including "forecast period”
  • the second node (or dependent node) corresponding to the second-level reference " ⁇ income:../income statement ⁇ " can be the one named "income” in the table named "income statement” in the spreadsheet
  • the nodes in the hierarchy calculation graph corresponding to the rows, and the second node (or dependent node) corresponding to the second-level reference " ⁇ average revenue growth rate ⁇ " can be the name "average revenue growth rate” in the spreadsheet
  • the step S103 of determining the dependency relationship between one or more nodes based on the correspondence between the level reference and the one or more nodes may include: at least based on the first level reference and the first The correspondence between the nodes and the correspondence between the second-level reference and the second node are used to determine the dependency between the first node and the second node.
  • the above example it can be based at least on the first-level reference " ⁇ income ⁇ [forecast period]" and the interval composed of the cells whose column label in the row named "income” in the spreadsheet includes “forecast period”
  • the corresponding relationship between the nodes in the hierarchical calculation graph corresponding to the rows of, and the second-level reference " ⁇ average income growth rate ⁇ ” and the level corresponding to the cell named "average income growth rate” in the spreadsheet Calculate the correspondence between the nodes in the graph, and determine the level corresponding to the interval composed of cells whose column label in the row named "Income” in the spreadsheet includes the "prediction period”.
  • the nodes in the calculation graph and the spreadsheet are determined
  • the node in the hierarchical calculation graph corresponding to the row named "income” in the table named "Income Statement”, and the hierarchical calculation corresponding to the cell named "Average Income Growth Rate” in the spreadsheet The dependencies between the nodes in the graph.
  • step S105 the calculation relationship between one or more nodes may be determined based on the operator and the dependency relationship.
  • the step S105 of determining the calculation relationship between one or more nodes based on the operator and the dependency relationship may further include: determining one or more nodes based on at least the compound operator and the dependency relationship. The calculation relationship between.
  • the calculation relationship between the node and other nodes may be stored via a hierarchical calculation graph.
  • the relationship between the node and other nodes can be stored in the hierarchical calculation graph shown in Figure 4
  • the calculation relationship between For example, for the node 305 shown in FIG. 4, when it is determined that the node 305 is calculated by the node 303, the calculation relationship edge 314 from the node 303 to the node 305 can be used to store the relationship between the node 305 and the node 303.
  • the dependency relationship, and the compound operator (404) of the calculation relationship is stored in the node 305, and the corresponding relationship between the dependent node of the node 305 and the placeholder in the compound operator.
  • the step S105 of determining the calculation relationship between one or more nodes based on the operator and the dependency relationship may include: determining the calculation relationship between the one or more nodes based on the operator and the dependency relationship between the first node and the second node. Determine the calculation relationship between the first node and the second node.
  • the calculation relationship between the first node and the second node may be stored via a hierarchical calculation graph.
  • the calculation relationship between the first node and the second node may be stored in the hierarchical calculation graph shown in FIG. 4 .
  • the calculation relationship edge 314 from the second node 303 to the first node 305 can be used to Store the dependency relationship between the first node 305 and the second node 303, and store the compound operator (404) of the calculation relationship in the node 305, and between the dependent node of the node 305 and the placeholder in the compound operator The corresponding relationship.
  • step S107 an electronic form formula may be generated based at least on the hierarchical structure and calculation relationship used for the electronic form.
  • Each level formula corresponds to one or more spreadsheet formulas.
  • the above step S107 of generating an electronic form formula based on at least the hierarchical structure and calculation relationship used for the electronic form may include: for each current node of the one or more nodes, based on one or more The calculation relationship between the current node and other nodes in the node determines the one or more second cells corresponding to each of the one or more first cells corresponding to the current node and one or more second cells corresponding to other nodes. The calculated relationship between each second cell in the cell; and at least based on each first cell in one or more first cells and each second cell in one or more second cells The calculation relationship between the cells generates a spreadsheet formula for each first cell of the one or more first cells.
  • each node in the hierarchical calculation graph corresponding to the spreadsheet can be traversed according to various graph traversal algorithms.
  • various graph traversal algorithms known in the art can be used when traversing the hierarchical calculation graph, which is not limited in this application, and will not be described in detail.
  • the calculation relationship between the current node and other nodes can be converted into each first cell and other nodes corresponding to the current node The calculation relationship between the corresponding second cells.
  • the current node “ ⁇ income ⁇ [prediction period]” when traversing to the current node " ⁇ income ⁇ [prediction period]" in the hierarchical calculation graph, the current node “ ⁇ income ⁇ [prediction period]” can be compared with other nodes " ⁇ income:.
  • the calculation relationship between "./income statement ⁇ ” and " ⁇ average revenue growth rate ⁇ ” is converted to the first cell F10, G10, and H10 in the total table corresponding to the current node " ⁇ income ⁇ [forecast period]”
  • the second cell E30, F30, G30 in the income statement corresponding to other nodes " ⁇ income:../profit statement ⁇ ” and the value in the total table corresponding to the values of other nodes " ⁇ average revenue growth rate ⁇ " The calculation relationship between the second cell C12.
  • the calculation relationship between each first cell and each second cell may be used to generate the calculation relationship between each first cell and each second cell.
  • Spreadsheet formula for the cell may be used to generate the calculation relationship between each first cell and each second cell.
  • the step of calculating the relationship between the second cells may include: determining each of the one or more first cells corresponding to the current node based at least on the operator corresponding to the current node in the one or more nodes. Operator corresponding to a first cell; and at least based on the dependency relationship between the current node and other nodes in one or more nodes, determine the one or more first cells corresponding to the current node The dependency relationship between each first cell and each of the one or more second cells corresponding to other nodes.
  • FIG. 8 is a schematic diagram schematically showing a directed graph of a compound operator for a cell according to some embodiments of the present application.
  • the operator corresponding to the current node in the one or more nodes is related to one of the one or more nodes in the hierarchical structure of the spreadsheet.
  • the corresponding first-level compound operator includes one or more first-level atomic operators; the operator corresponding to each first cell in the one or more first cells Is a second-level compound operator corresponding to one of the one or more cells in the spreadsheet, and the second-level compound operator includes one or more second-level atomic operators; and Based on at least the first-level compound operator corresponding to the current node in the one or more nodes, determine the corresponding one of the one or more first cells corresponding to the current node The second level compound operator.
  • the compound operator for the cell (which is also referred to as the second-level compound operator in this article) and the compound operator for the level in the hierarchical calculation graph (which is also called the first-level compound operator in this article) Operator) is very similar in form, both are a directed graph, but have different meanings. Since each cell in the spreadsheet can only store one number or other variable, each parameter of the compound operator used in the cell can only be a scalar, and its calculation result is also a scalar. In contrast, the parameter of the compound operator used for the level is a level. This level is generally a collection of multiple variables, and its calculation result is also a collection of multiple calculation results.
  • the lvalue node contains three cells F10, G10, and H10, it is necessary to generate a second-level compound operator for the three cells F10, G10, and H10 respectively.
  • the generated compound operators for these three cells F10, G10, and H10 are all the same (but the dependent cells passed to the placeholder are different), as shown in Figure 8.
  • the hierarchical atomic operator "*" 802 in Figure 7 is converted to the cell atomic operator "*" 1002; the hierarchical atomic operator ".lag(1)” 803 is converted to the cell atom Operator "id (equal)" 1003; level atomic operator "+” 804 is converted into cell atomic operator "+” 1004; level constant atomic operator "1” 806 is converted into cell constant atomic operation
  • the symbol "1" 1006; the two types of hierarchical parameter placeholders "x1" 805 and “x2" 807 are converted into two parameter placeholders "x1" 1005 and "x2" 1007 that are cell references.
  • the dependency relationship between the current node and other nodes in one or more nodes can be converted into each first cell corresponding to the current node and each second cell corresponding to other nodes. Dependencies between cells.
  • FIG. 9 is a schematic diagram schematically illustrating a process for specifying a dependent cell for an operator according to some embodiments of the present application.
  • the dependent node " ⁇ income:../income statement ⁇ " can be converted into the dependent cell E$30 of cell F10, the dependent cell F$30 of cell G10, and the dependent cell G$30 of cell H10; Convert the dependent node " ⁇ average income growth rate ⁇ " into the dependent cell $C$12 of cell F10, the dependent cell $C$12 of cell G10, and the dependent cell $C$12 of cell H10. Therefore, the dependent cells of the three cells F10, G10, and H10 are [E$30,$C$12], [F$30,$C$12], [G$30,$C$12], respectively.
  • the step of generating the spreadsheet formula for each of the one or more first cells may include: at least based on one or more first cells corresponding to the current node.
  • the operator corresponding to each first cell in a cell, and one or more corresponding to each first cell in the one or more first cells corresponding to the current node and other nodes The dependency relationship between each second cell in the second cell generates a spreadsheet formula for each first cell in the one or more first cells.
  • the first-level compound operator uses a first-level directed graph for storage, and each directed graph node in the first-level directed graph represents each first-level of the first-level compound operator Atomic operators, and the directed edges between each directed graph node in the first-level directed graph represent the combination relationship between each first-level atomic operator in the first-level compound operator; the second-level compound Operators are stored in the second-level directed graph.
  • Each directed graph node in the second-level directed graph represents each second-level atomic operator in the second-level compound operator, and the second-level directed graph
  • the directed edges between the nodes of the directed graph represent the combination relationship between the second-level atomic operators in the second-level compound operator; and the first-level corresponding to the first-level compound operator through traversal
  • the directed graph is used to determine the second-level directed graph, and the second-level compound operator is determined according to the second-level directed graph.
  • FIG. 10 is a schematic diagram schematically showing a process for converting a compound operator for a hierarchy into a compound operator for a cell according to some embodiments of the present application.
  • FIG. 11 is a schematic diagram schematically showing a directed graph of a compound operator for a cell after conversion according to some embodiments of the present application.
  • the parameter placeholders ⁇ y ⁇ , ⁇ x1 ⁇ , ⁇ x2 ⁇ , ⁇ x3 ⁇ represent the first-level directed graph nodes whose type is row
  • the parameter placeholders ⁇ x4 ⁇ , ⁇ x5 ⁇ Represents the first-level directed graph node whose type is a cell.
  • a directed graph (referred to as a first-level directed graph in this article) of a compound operator (referred to as the first-level compound operator in this article) used in the hierarchy.
  • Figure 11 shows the conversion of the compound operator (referred to as the second-level compound operator in this article) for the cell with the column label of “2018” in the row " ⁇ y ⁇ " in Figure 10 after conversion.
  • a directed graph (referred to as a second-level directed graph in this article).
  • the determining the second-level directed graph by traversing the first-level directed graph corresponding to the first-level compound operator may include: traversing the first level in the order of post-order traversal Directed graph, so that the child directed graph nodes in the first-level directed graph are traversed first, and then the parent directed graph nodes in the first-level directed graph are traversed.
  • the first-level atomic operator represented by the graph node and the attribute information of the first-level child directed graph node of the current first-level directed graph node determine the attribute information of the current first-level directed graph node, where each The attribute information of a first-level directed graph node includes one or more of the following: the location information of the cell in the spreadsheet, the label information corresponding to the cell in the spreadsheet, and the Cell location information, label information and intermediate directed graph nodes corresponding to the cells in the spreadsheet, intermediate directed graph nodes corresponding to the cells in the spreadsheet, and can be based on the first level
  • the attribute information of each first-level directed graph node in the one or more first-level directed graph nodes in the first-level directed graph determines the set of each intermediate-level directed graph node in the intermediate-level directed graph, according to The dependency relationship between the one or more first-level directed graph
  • each node in the first-level directed graph of the first-level compound operator used for the hierarchy also stores additional attribute information (1212-1219, 1231 as shown on the right in Figure 10). ⁇ 1233).
  • the attribute information is used to record the intermediate calculation process of transforming the first-level directed graph into the second-level directed graph.
  • the attribute information can be a labeled row (a list of column labels (called a column label group)) and an intermediate directed graph Graph node list), where the intermediate-level directed graph node stores the position of a cell or a cell atomic operator (called intermediate-level atomic operator), and other intermediate nodes that the atomic operator depends on), or Is a scalar (an intermediate-level directed graph node without a label).
  • the attribute information can also be a labeled column (a list of row labels (called a row label group) and an intermediate level A directed graph node list) can also be a two-dimensional list of a row label group, a column label group, and a corresponding intermediate-level directed graph node. All intermediate-level directed graph nodes corresponding to all first-level directed graph nodes constitute an intermediate-level directed graph.
  • the attribute information of the leaf node of the compound operator of the hierarchy can be obtained directly from the position of the row or cell corresponding to the leaf node.
  • the attribute information consists of the column label group of this row and the intermediate directed graph node that stores the position of each cell in this row (for example, as shown on the right in Figure 10 1212, 1213, 1217); if the leaf node corresponds to a cell (for example, 1221, 1222 shown on the left in Figure 10), then its attribute information is the middle-level directed Graph nodes (for example, 1231 and 1232 shown on the right in FIG. 10).
  • a post-order traversal method can be used to traverse the directed graph for the compound operator of the hierarchy (the child node is traversed first, and then the parent node).
  • the attribute information of the node can be determined according to the atomic operator of the node and the attribute information of the child nodes of the node. For example, by performing post-order traversal on the directed graph of the compound operator for the hierarchy shown on the left in FIG. 10, the intermediate directed graph shown on the right in FIG.
  • each first-level directed graph node in the one or more first-level directed graph nodes in the first-level directed graph determines the set of each intermediate-level directed graph node in the intermediate-level directed graph , At least according to the dependency relationship between the one or more first-level directed graph nodes in the first-level directed graph to determine each of the set of each intermediate-level directed graph node in the intermediate-level directed graph. The dependency relationship between the intermediate-level directed graph node and each intermediate-level directed graph node in the set of other intermediate-level directed graph nodes in the intermediate-level directed graph.
  • the first-level atomic operators are divided into elementwise atomic operators (Elementwise Atomic Operators), dimensionality-reduction atomic operators (Dimension-Reduction Atomic Operators), and transposition atomic operators (Transposition Atomic Operators). , One of user-defined atomic operators.
  • Element-wise atomic operators can include mathematical operators such as "+, -, *, /”, and functions expressed in capital letters, such as "SUM(), AVERAGE()", and so on.
  • the element-wise atomic operator is applied to two rows, the cells with the same column label corresponding positions in the two rows can be added.
  • Dimensionality reduction atomic operators can be expressed in lowercase letters and connected to variables with ".”, excluding misplaced atomic operators.
  • Misplaced atomic operators can refer to atomic operators such as "lag(1), lead(1), shift(1)", etc. When determining the label information in the attribute information of the nodes of these misplaced atomic operators, these misplaced operations need to be performed The label information of the child nodes of the symbol node is obtained by dislocation.
  • the following operations can be performed.
  • each first-level sub-directed graph node of the current first-level directed graph node contains the label information corresponding to the cell in the spreadsheet
  • the attribute information of each first-level sub-directed graph node The intersection of the label information contained in the attribute information sets the label information in the attribute information of the current first-level directed graph node, and sets the current first-level atomic operator represented by the current first-level directed graph node.
  • the intermediate-level atomic operator in the attribute information of the first-level directed graph node is determined to be related to the current first-level based on the label information and the intermediate-level atomic operator in the attribute information of the current first-level directed graph node.
  • the current intermediate-level directed graph node set corresponding to the directed graph node, and at least according to the dependency relationship between the current first-level directed graph node and its first-level child directed graph nodes and according to the current first-level directed graph node The label information in the attribute information of the graph node and its first-level child directed graph node is used to determine each intermediate-level directed graph node in the current intermediate-level directed graph node set corresponding to the current first-level directed graph node.
  • the dependent intermediate node is set to the intermediate directed graph node corresponding to the position of the "2018" label in 1212 and 1214; the intermediate directed graph node that the intermediate directed graph node at the corresponding position of the "2019" label depends on is set to The middle-level directed graph node corresponding to the "2019" label in 1212 and 1214.
  • the first-level atomic operator represented by the current first-level directed graph node sets the intermediate-level atomic operator in the attribute information of the current first-level directed graph node, at least according to the current first-level directed graph node
  • the intermediate-level atomic operator in the attribute information of the current first-level directed graph node is used to determine the current intermediate-level directed graph node set corresponding to the current first-level directed graph node, and at least according to the current first-level directed graph node and its first-level
  • the dependency relationship between the sub-directed graph nodes is used to determine the current intermediate-level directed graph node corresponding to the current first-level directed graph node in each intermediate-level directed graph node and the intermediate-level directed graph.
  • the dependency relationship between each intermediate-level directed graph node in the set of other intermediate-level directed graph nodes is used to determine the current intermediate-level directed graph node.
  • the attribute information of the child nodes are all intermediate-level directed graph nodes without labels (for example, node 1223), the attribute information (1233) of the node is also set as an intermediate-level directed graph node without labels,
  • the atomic operator of the 1233 intermediate-level directed graph node is the cell atomic operator ("*") corresponding to the element-wise atomic operator, and the dependent intermediate-level directed graph node is the intermediate level in the attribute information of the child node.
  • the attribute information of a part of the current first-level directed graph node of the first-level child directed graph node contains the label information corresponding to the cell in the spreadsheet and the other part of the current first-level directed graph node is the first
  • the attribute information of the first-level child directed graph node does not contain the label information corresponding to the cell in the spreadsheet, then according to the intersection of the label information contained in the attribute information of the first-level child directed graph node that contains the label information
  • the intermediate level atomic operator in the current first level directed graph node determines the current intermediate level corresponding to the current first level directed graph node based on the label information and the intermediate level atomic operator in the attribute information of the current first level directed graph node
  • the attribute information of the child node has both a labeled row and a scalar (such as node 1208), first use the intersection of the column label group ([2017,2018,2019]) of the attribute information of the child node as the attribute information of the node ( 1218) column label group ([2017,2018,2019]), set the atomic operator of the intermediate node in 1218 to the cell atomic operator "sum” corresponding to the first-level atomic operator of 1208, and set "2017
  • the intermediate node on which the intermediate node corresponding to the position of the label depends is set to the intermediate node corresponding to the position of the "2017" label in 1217, as well as the intermediate node 1216 and the intermediate node 1233; in addition, for the positions corresponding to the "2018” and "2019” labels in 1218
  • the operation of the intermediate node is similar, so I won't repeat it here.
  • the following operations can be performed.
  • the attribute information of the current first-level directed graph node does not contain label information or includes a subset of the label information in the attribute information of the first-level child directed graph node of the current first-level directed graph node, Set the intermediate-level atomic operator in the attribute information of the current first-level directed graph node at least according to the first-level atomic operator represented by the current first-level directed graph node, and at least according to the current first-level directed graph node
  • the intermediate-level atomic operator in the attribute information of the graph node determines the current intermediate-level directed graph node set corresponding to the current first-level directed graph node, and at least according to the current first-level directed graph node and its first-level directed graph node
  • the dependency relationship between the first-level sub-directed graph nodes is used to determine each intermediate-level directed graph node and the intermediate-level directed graph in the current intermediate-level directed graph node set corresponding to the current first-level directed graph node
  • the attribute information of the node is set to a scalar
  • the operator of the intermediate-level directed graph node (1216) corresponding to this scalar is set to the dimensionality reduction operation
  • the cell atomic operator (“sum") corresponding to the symbol, the dependent node of the intermediate-level directed graph node is all the intermediate-level directed graph nodes in the attribute information (1215) of the child node (1205) of 1206.
  • the following operations can be performed.
  • the attribute information of the first-level child directed graph node of the current first-level directed graph node contains the label information corresponding to the cell in the spreadsheet
  • the attribute information of the first-level child directed graph node contains the label information corresponding to the cell in the spreadsheet
  • the label information contained in the information is set to the label information in the attribute information of the current first-level directed graph node
  • the “equal” atomic operator is set to the current first-level directed graph node.
  • the intermediate-level atomic operator in the attribute information of the directed graph node is determined to be relative to the current first-level directed graph node according to the label information and the intermediate-level atomic operator in the attribute information of the current first-level directed graph node.
  • the corresponding set of current intermediate-level directed graph nodes and at least according to the dependency relationship between the current first-level directed graph node and its first-level child directed graph nodes, and according to the current first-level directed graph node and its first level
  • the label information in the attribute information of the first-level sub-directed graph node determines the current intermediate-level directed graph node set corresponding to the current first-level directed graph node.
  • a sub-directed graph with the root node of each intermediate-level directed graph in the set of intermediate-level directed graph root nodes as the root node may be extracted from the intermediate-level directed graph, and the The extracted sub-directed graph is used as the second-level directed graph to determine the second-level compound operator according to the second-level directed graph.
  • the position of each intermediate-level directed graph root node in the intermediate-level directed graph root node set can be compared with that of the intermediate-level directed graph.
  • the positions of the left-value nodes of each intermediate-level directed graph in the set of left-value nodes correspond to each other.
  • the label information in the attribute information of the root node of each intermediate-level directed graph can be matched with the label information in the attribute information of the left-value node of each intermediate-level directed graph.
  • the position corresponds to the position of the left value node of each intermediate-level directed graph.
  • the sub-directed graph with the root node of the intermediate-level directed graph at the corresponding matching position as the root node can be extracted as the second-level directed graph to determine the middle-level left-value node corresponding to the second-level directed graph
  • the second level compound operator of the cell can be extracted as the second-level directed graph to determine the middle-level left-value node corresponding to the second-level directed graph The second level compound operator of the cell.
  • each intermediate node in 1218 corresponds to a compound operator for the cell, and this only needs to be the sub-directed graph with the intermediate node as the root node Just pull it out.
  • the compound operator of the cell corresponding to the position of the label "2018" in 1218 is shown in Figure 11. Assign the compound operator of these cells to the cell with the same label position as the left value.
  • the compound operator in Fig. 11 can be assigned to the cell corresponding to the intermediate node in the row corresponding to 1219 in Fig. 10 and the column label is “2018”.
  • the position of each attribute information 1218 may be corresponded to the position of each attribute information 1219 of the node 1209.
  • the attribute information 1218 can be matched by matching the label information "2017”, “2018”, and “2019” in each attribute information 1218 with the labels "2018", "2019", and "2020” in each attribute information 1219.
  • the position of the intermediate-level directed graph node corresponding to the label information "2018" in the attribute information 1219 corresponds to the intermediate-level directed graph node position corresponding to the label information "2018” in the attribute information 1219, and the label information in the attribute information 1218
  • the position of the intermediate-level directed graph node corresponding to “2019” corresponds to the position of the intermediate-level directed graph node corresponding to the label information “2019” in the attribute information 1219.
  • the sub-directed graph with the node "2018" in the attribute information 1218 as the root node can be extracted as the second-level compound operator and assigned to the middle-level directed graph at the position of the label "2018” in the attribute information 1219
  • the row label group in the first-level directed graph node attribute information can be operated according to the method for operating the column label group in the above steps.
  • the column label group contained in the attribute information of the first-level sub-directed graph node of the current first-level directed graph node when each element-wise atomic operator is traversed, the column label group contained in the attribute information of the first-level sub-directed graph node of the current first-level directed graph node The intersection of is set as the column label group in the attribute information of the current first-level directed graph node, and the row label contained in the attribute information of the first-level child directed graph node of the current first-level directed graph node The intersection of the groups is set as the row label group in the attribute information of the current first-level directed graph node; when traversing to the dimensionality reduction atomic operator, the attribute information of the current first-level directed graph node does not contain the label Information, or only a subset of the label information contained in the attribute information of the first-level child directed graph node of the current first-level directed graph node (for example, only one row label group or only one column label Group); when traversing to the dislocation atomic operator, the row label group contained
  • step S107 the computer-implemented method 100 for generating spreadsheet formulas may end.
  • the generated spreadsheet formula for each first cell of the one or more first cells may be stored in a corresponding cell in the spreadsheet file.
  • the generated spreadsheet formula strings of the three cells F10, G10, and H10 can be written into a spreadsheet file in a common format (for example, .xls or .xlsx). Format file) in the corresponding cell.
  • a common format for example, .xls or .xlsx. Format file
  • the step of storing the generated spreadsheet formula for each first cell of the one or more first cells in the corresponding first cell is also It may include: automatically naming a part or all of the cell names of the one or more first cells and the one or more second cells in the electronic table; and using automatically named cells
  • the grid name is used to rewrite the spreadsheet formula and store the rewritten spreadsheet formula.
  • an intelligent suggestion knowledge base may be updated based on the already acquired hierarchical formula, the intelligent suggestion knowledge base including information related to the hierarchical formula or hierarchical structure; and the intelligent suggestion may be The knowledge base provides intelligent suggestions when a new level formula is about to be obtained.
  • the knowledge base of intelligent prompts can be updated according to the content that has been entered. For example, if the user adds three rows of "mobile phone”, “personal computer”, and “tablet” under the block named “income”, then these three terms can be added to the smart reminder knowledge base and combined with " “Income”. For another example, the user creates a new table named "Income Statement” under the page named “Financial Statement” under the workbook named “Valuation Model”. And add a row named "Revenue (revenue)", then, in the knowledge base of the hierarchical path, add a path such as "Valuation Model/Financial Statement/Income Statement/Revenue". Depending on the expected intelligent prompt information, the knowledge base may also include other prompt information related to the hierarchical formula and/or the hierarchical calculation graph, which is not limited in this application.
  • users can combine atomic operators preset by the system into custom atomic operators.
  • FIG. 12 is a schematic diagram schematically showing a directed graph of a custom atomic operator according to some embodiments of the present application.
  • the custom atomic operator "growth rate ()” can also be represented by a directed graph.
  • the custom atomic operator "growth rate ()” can be represented by a directed graph 1511.
  • the compound operator used in the hierarchical formula of the spreadsheet can also be represented by a directed graph.
  • the hierarchical formula for the spreadsheet can be represented by the original directed graph 1512, where the original directed graph 1512 includes an operator 1508 and two child directed graphs with the operator 1508 as the parent node.
  • the first sub-directed graph " ⁇ x1 ⁇ .lag(1)" 1504 and the second sub-directed graph " ⁇ x2 ⁇ ” 1506, the parameter placeholders "x1" and "x2" correspond to the same level of the calculation graph
  • the operator 1508 is a custom atomic operator "growth rate".
  • the hierarchical formula used in the spreadsheet includes custom atomic operators
  • the custom atomic operator "growth rate" 1508 in the original directed graph 1512 of the above level formula can be replaced with a directed graph 1511 representing the custom atomic operator "growth rate" (In the replaced directed graph 1513, the subgraph 1503 corresponds to the subgraph 1502 of the directed graph 1511) root node 1517, and the custom atomic operator "growth rate” in the original directed graph 1512 with the hierarchical formula
  • the first sub-directed graph " ⁇ x1 ⁇ .lag(1)" 1504 of "1508 replaces the placeholder representing the leaf node "x1" in the directed graph 1511 (it becomes the sub-graph 1505 of the directed graph 1513),
  • use the second sub-directed graph " ⁇ x2 ⁇ ” 1506 of the custom atomic operator "growth rate” 1508 to replace the placeholder representing the leaf node "x2" in the directed graph 1502 (it becomes the direction of the directed graph 1513
  • the sub-directed graph 1507) so that the converted directed graph 1513 shown in FIG. 12 can be obtained. Then, the
  • defects existing in the acquired hierarchy formula can be automatically detected; and debugging information can be automatically generated based on the defects and prompt the debugging information, wherein the debugging information includes errors or warnings .
  • the user may make different degrees of errors when entering the level formula, or the input format is not standard.
  • the system can automatically generate debugging information.
  • the debugging information includes errors (Error) and warnings (Warning). Error means that the entered level formula does not conform to the grammar of the level formula, and the correct spreadsheet model cannot be generated; the warning means that the entered level formula conforms to the grammar of the level formula, but the generated spreadsheet model is likely not to meet the level formula writer’s True intentions.
  • Error means that the entered level formula does not conform to the grammar of the level formula, and the correct spreadsheet model cannot be generated
  • the warning means that the entered level formula conforms to the grammar of the level formula, but the generated spreadsheet model is likely not to meet the level formula writer’s True intentions.
  • users are allowed to quote this row in the hierarchy formula before defining the “Revenue” row under the “Income Statement” table. This is called “undefined”. Reference” (Undefined Reference).
  • the debugging information may include accounting equations, and if the entered hierarchical formula is inconsistent with the accounting equation, a warning message is generated.
  • the debugging information knowledge base may include algorithms for judging and correcting error level formulas. When the wrong level formula is input, error information can be generated, and possible correction suggestions can be automatically generated. In other implementation manners of this application, more complicated debugging information may also be included, which is not limited in this application.
  • an electronic form model may be stored, the electronic form model including one or more of the following: a hierarchical structure for the electronic form, a hierarchical calculation diagram for the electronic form, and an electronic form file .
  • the spreadsheet model can be imported and/or exported.
  • an apparatus for generating an electronic form formula including: components for executing the steps of the method as described above.
  • a device for generating spreadsheet formulas including: at least one processor; and at least one storage device, the at least one storage device stores instructions, when the instructions are The execution of the at least one processor causes the at least one processor to execute the aforementioned method.
  • a non-transitory computer-readable storage medium which stores instructions, which when executed by a processor causes the aforementioned method to be performed.
  • FIG. 13 is a block diagram schematically showing an apparatus 1300 for generating spreadsheet formulas according to some embodiments of the present application.
  • the apparatus 1300 for generating an electronic form formula may include: a hierarchical formula editor 1301, the hierarchical formula editor 1301 is configured to obtain a hierarchical formula for the electronic form, the hierarchical formula includes Operators and level references, where the level references correspond to one or more nodes in one or more levels in the hierarchy of the spreadsheet, where each level has at least one node and has a corresponding level type, Each node corresponds to one or more cells in the spreadsheet, wherein the hierarchical structure further includes the membership relationship between the one or more nodes; a hierarchical formula parser 1303, the hierarchical formula parser 1303 is configured to determine the dependency relationship between the one or more nodes based on the correspondence between the hierarchical reference and the one or more nodes; the hierarchical formula parser is further configured to be based on the corresponding relationship between the one or more nodes; Operator and the dependency relationship to determine the calculation relationship between the one or more nodes; and a formula translator 1305 configured to be based at least on the
  • the hierarchical formula editor 1301 may include a graphical user interface editor, where the graphical user interface editor includes components for specifying nodes and/or operators at different levels, and The graphical user interface editor may also be configured to: receive input for components for specifying nodes and/or operators of different levels; and generate the level formula based on the input.
  • the hierarchical formula editor 1301 may include a text editor, and the text editor may be configured to: receive a text code input by a user; and parse the text code to generate the hierarchical formula .
  • the operator may include an atomic operator, and the atomic operator includes one or more of the following: mathematical operators, mathematical functions, constants, system-defined functions, user-defined Define atomic operators.
  • the hierarchical formula parser 1303 may be further configured to construct a compound operator according to the atomic operator in the hierarchical formula, wherein the compound operator includes the hierarchical The combination of all atomic operators in the formula.
  • the hierarchical formula parser 1303 may be further configured to determine the calculation relationship between the one or more nodes based at least on the compound operator and the dependency relationship.
  • the level reference may include a first level reference located on the left side of the equal sign in the level formula and a second level reference located on the right side of the equal sign in the level formula, wherein, The first-level reference corresponds to the first node in the one or more nodes, and the second-level reference corresponds to the second node in the one or more nodes.
  • the hierarchical formula parser 1303 may be further configured to be based at least on the correspondence between the first-level reference and the first node and the correspondence between the second-level reference and the second node. To determine the dependency between the first node and the second node.
  • the apparatus 1300 for generating spreadsheet formulas may further include a hierarchical calculation graph storage 1307, and the hierarchical calculation graph storage 1307 may be configured to: for each of the one or more nodes The node stores the calculation relationship between the node and other nodes via the hierarchical calculation graph.
  • the hierarchical formula parser 1303 may be further configured to determine the relationship between the first node and the second node based on the operator and the dependency relationship between the first node and the second node. The calculation relationship.
  • the hierarchical calculation graph storage 1307 may also be configured to store the calculation relationship between the first node and the second node via the hierarchical calculation graph for the first node.
  • the formula translator 1305 may also be configured to: for each current node in the one or more nodes, based on the current node and other nodes in the one or more nodes The calculation relationship between nodes is used to determine each first cell in one or more first cells corresponding to the current node and each second cell in one or more second cells corresponding to other nodes. Calculation relationship between cells; and based at least on the relationship between each first cell in the one or more first cells and each second cell in the one or more second cells The calculation relationship of, generates a spreadsheet formula for each first cell of the one or more first cells.
  • the formula translator 1305 may also be configured to determine one or more corresponding operators of the current node based at least on the operator corresponding to the current node among the one or more nodes. The operator corresponding to each first cell in the first cell; and at least based on the dependency relationship between the current node and other nodes in the one or more nodes, determine the operator corresponding to the current node The dependency relationship between each first cell in the one or more first cells and each second cell in the one or more second cells corresponding to other nodes.
  • the formula translator 1305 may also be configured to: at least be based on the operator corresponding to each of the one or more first cells corresponding to the current node, And the dependency relationship between each first cell in one or more first cells corresponding to the current node and each second cell in one or more second cells corresponding to other nodes To generate a spreadsheet formula for each of the one or more first cells.
  • the formula translator 1305 may also be configured to: the operator corresponding to the current node in the one or more nodes is the same as that used in the hierarchical structure of the spreadsheet
  • the first-level compound operator corresponding to one of the one or more nodes the first-level compound operator includes one or more first-level atomic operators; in the one or more first cells
  • the operator corresponding to each first cell of is a second-level compound operator corresponding to one of the one or more cells in the spreadsheet, and the second-level compound operator includes One or more second-level atomic operators; and determining one or more first units corresponding to the current node based at least on the first-level compound operator corresponding to the current node in the one or more nodes
  • the second-level compound operator corresponding to each first cell in the grid the operator corresponding to each first cell in the grid.
  • the formula translator 1305 may also be configured as: the first-level compound operator is stored in a first-level directed graph, and each directed graph node in the first-level directed graph represents Each first-level atomic operator in the first-level compound operator, and the directed edges between each directed graph node in the first-level directed graph represent each first-level atom in the first-level compound operator The combination relationship between operators; the second-level compound operator is stored in the second-level directed graph, and each directed graph node in the second-level directed graph represents each second-level in the second-level compound operator Atomic operators, and the directed edges between each directed graph node in the second-level directed graph represent the combination relationship between each second-level atomic operator in the second-level compound operator; and through traversal and The first-level directed graph corresponding to the first-level compound operator determines the second-level directed graph, and the second-level compound operator is determined according to the second-level directed graph.
  • the formula translator 1305 may also be configured to traverse the first-level directed graph in the order of post-order traversal, so as to first traverse the sub-directed graphs in the first-level directed graph. Node, and then traverse the parent directed graph node in the first level directed graph.
  • the formula translator 1305 may also be configured to: traverse to the current first-level directed graph node among one or more first-level directed graph nodes in the first-level directed graph.
  • the current first level is determined according to the first level atomic operator represented by the current first level directed graph node and the attribute information of the first level child directed graph node of the current first level directed graph node
  • the attribute information of the directed graph node, where the attribute information of each first-level directed graph node includes one or more of the following: the location information of the cell in the spreadsheet, and the cell in the spreadsheet
  • the label information corresponding to the cell and the location information of the cell in the spreadsheet, the label information corresponding to the cell in the spreadsheet and the middle-level directed graph node, and the middle-level corresponding to the cell in the spreadsheet has Nodes in a directed graph; determine the middle-level directed graph based on the attribute information of each first-level directed graph node in the one or more first-level directed graph nodes in the first-
  • the first-level atomic operators are classified into one of element-wise atomic operators, dimensionality reduction atomic operators, misplaced atomic operators, and user-defined atomic operators.
  • the formula translator 1305 may also be configured to: when the first-level atomic operator represented by the current first-level directed graph node in the traversed first-level directed graph is When an element-wise atomic operator is used, the following operations are performed:
  • each first-level sub-directed graph node of the current first-level directed graph node contains the label information corresponding to the cell in the spreadsheet
  • the attribute information of each first-level sub-directed graph node The intersection of the label information contained in the attribute information sets the label information in the attribute information of the current first-level directed graph node, and sets the current first-level atomic operator represented by the current first-level directed graph node.
  • the intermediate-level atomic operator in the attribute information of the first-level directed graph node is determined to be related to the current first-level based on the label information and the intermediate-level atomic operator in the attribute information of the current first-level directed graph node.
  • the current intermediate-level directed graph node set corresponding to the directed graph node, and at least according to the dependency relationship between the current first-level directed graph node and its first-level child directed graph nodes and according to the current first-level directed graph node The label information in the attribute information of the graph node and its first-level child directed graph node is used to determine each intermediate-level directed graph node in the current intermediate-level directed graph node set corresponding to the current first-level directed graph node
  • the first-level atomic operator represented by the current first-level directed graph node sets the intermediate-level atomic operator in the attribute information of the current first-level directed graph node, at least according to the current first-level directed graph node
  • the intermediate-level atomic operator in the attribute information of the current first-level directed graph node is used to determine the current intermediate-level directed graph node set corresponding to the current first-level directed graph node, and at least according to the current first-level directed graph node and its first-level
  • the dependency relationship between the sub-directed graph nodes is used to determine the current intermediate-level directed graph node corresponding to the current first-level directed graph node in each intermediate-level directed graph node and the intermediate-level directed graph.
  • the attribute information of a part of the current first-level directed graph node of the first-level child directed graph node contains the label information corresponding to the cell in the spreadsheet and the other part of the current first-level directed graph node is the first If the attribute information of the first-level child directed graph node does not contain label information, the current first-level directed graph node is set according to the intersection of the label information contained in the attribute information of the first-level child directed graph node containing the label information According to the label information in the attribute information of the current first-level directed graph node, the middle-level atomic operator in the attribute information of the current first-level directed graph node is set according to the first-level atomic operator represented by the current first-level directed graph node.
  • the label information and intermediate atomic operators in the attribute information of the current first-level directed graph node are used to determine the current intermediate-level directed graph node set corresponding to the current first-level directed graph node, and at least according to the current
  • the dependency relationship between the first-level directed graph node and its first-level child directed graph node is determined according to the label information in the attribute information of the current first-level directed graph node and its first-level child directed graph node.
  • Each intermediate-level directed graph node in the current intermediate-level directed graph node set corresponding to the current first-level directed graph node and each intermediate-level directed graph node set in the intermediate-level directed graph The dependency relationship between the nodes of the hierarchical directed graph.
  • the formula translator 1305 may also be configured to: when the first-level atomic operator represented by the current first-level directed graph node in the traversed first-level directed graph is When reducing dimensionality atomic operators, perform the following operations:
  • the attribute information of the current first-level directed graph node does not contain label information or includes a subset of the label information in the attribute information of the first-level child directed graph node of the current first-level directed graph node, Set the intermediate-level atomic operator in the attribute information of the current first-level directed graph node at least according to the first-level atomic operator represented by the current first-level directed graph node, and at least according to the current first-level directed graph node
  • the intermediate-level atomic operator in the attribute information of the graph node determines the current intermediate-level directed graph node set corresponding to the current first-level directed graph node, and at least according to the current first-level directed graph node and its first-level directed graph node
  • the dependency relationship between the first-level sub-directed graph nodes is used to determine each intermediate-level directed graph node and the intermediate-level directed graph in the current intermediate-level directed graph node set corresponding to the current first-level directed graph node
  • the formula translator 1305 may also be configured to: when the first-level atomic operator represented by the current first-level directed graph node in the traversed first-level directed graph is When misplaced atomic operators, do the following:
  • the attribute information of the first-level sub-directed graph node of the current first-level directed graph node contains the label information corresponding to the cell in the spreadsheet, according to the attributes of the first-level sub-directed graph node
  • the post-dislocation label information obtained after misalignment of the label information contained in the information sets the label information in the attribute information of the current first-level directed graph node, and sets the "equivalence" atomic operator to the current first-level
  • the intermediate-level atomic operator in the attribute information of the directed graph node is determined to be relative to the current first-level directed graph node according to the label information and the intermediate-level atomic operator in the attribute information of the current first-level directed graph node.
  • the corresponding set of current intermediate-level directed graph nodes and at least according to the dependency relationship between the current first-level directed graph node and its first-level child directed graph nodes, and according to the current first-level directed graph node and its first level
  • the label information in the attribute information of the first-level sub-directed graph node determines the current intermediate-level directed graph node set corresponding to the current first-level directed graph node.
  • the formula translator 1305 may also be configured to extract from the intermediate-level directed graph to each intermediate-level directed graph root node in the set of intermediate-level directed graph root nodes. It is the sub-directed graph of the root node, and the extracted sub-directed graph is used as the second-level directed graph to determine the second-level compound operator according to the second-level directed graph.
  • the formula translator 1305 may also be configured to: combine the label information in the attribute information of the root node of each intermediate-level directed graph with the attribute information of the left-value node of each intermediate-level directed graph.
  • the label information in the middle-level directed graph is matched, and the position of each intermediate-level directed graph root node in the intermediate-level directed graph root node set is matched with the position of each intermediate-level directed graph left-value node in the intermediate-level directed graph left-value node set Position correspondence; and extracting the sub-directed graph with the root node of the intermediate-level directed graph at the corresponding matching position as the root node as the second-level directed graph to determine the intermediate-level left value according to the second-level directed graph The second level compound operator of the cell corresponding to the node.
  • the apparatus 1300 for generating an electronic form formula may further include an electronic form formula writer 1309, and the electronic form formula writer 1309 may be configured to use the generated formula for the The spreadsheet formula of each of the one or more first cells is stored in the corresponding cell in the spreadsheet file.
  • the custom atomic operator may be defined by combining the atomic operators preset by the system.
  • the formula translator 1305 may be further configured to convert the custom atomic operator when the custom atomic operator is included in the hierarchical formula used in the spreadsheet. Atomic operator preset for the system.
  • the formula translator 1305 may also be configured to: replace the custom atomic operator in the original directed graph of the hierarchical formula with a directed The root node of the graph; and the child directed graph with the custom atomic operator as the parent node in the original directed graph of the hierarchical formula is used to replace the leaf nodes in the directed graph of the custom atomic operator.
  • the apparatus 1300 for generating an electronic form formula may further include an intelligent suggestion module 1311, and the intelligent suggestion module 1311 may be configured to update the intelligent suggestion knowledge base based on the obtained hierarchical formula
  • the intelligent suggestion knowledge base includes information related to the hierarchical formula or hierarchical structure; and based on the intelligent suggestion knowledge base, intelligent suggestions are made when a new hierarchical formula is about to be obtained.
  • the apparatus 1300 for generating an electronic form formula may further include a defect detection module 1313, and the defect detection module 1313 may be configured to automatically detect defects existing in the acquired hierarchical formula; And automatically generate debugging information based on the defect and prompt the debugging information, wherein the debugging information includes errors or warnings.
  • the apparatus 1300 for generating spreadsheet formulas may further include a spreadsheet model storage module 1315, and the spreadsheet model storage module 1315 may be configured to store a spreadsheet model, the spreadsheet model including One or more of the following: hierarchical structure for spreadsheets, hierarchical calculation diagrams for spreadsheets, and spreadsheet files.
  • the apparatus 1300 for generating spreadsheet formulas may further include a spreadsheet model import/export module 1317, and the spreadsheet model import/export module 1317 may be configured to import and/or export the spreadsheet model.
  • the text editor may be configured to: perform word segmentation on the text code to obtain a word segmentation stream; identify the word segmentation related to the operator in the word segmentation stream to determine the operation Identify the word segmentation related to the one or more nodes in the one or more levels in the hierarchy structure of the spreadsheet in the word segmentation stream to determine the level reference; and according to the determined Operators and hierarchical references are used to generate the hierarchical formula.
  • the compound operator may use one or more of the following items to store: a character string; a computer-implemented function pointed to by a function pointer; and a directed graph.
  • each node in the directed graph may represent the operator in the hierarchical formula
  • the directed edge between each node in the directed graph may represent the The combination relationship between the operators in the hierarchy formula
  • the spreadsheet formula writer 1309 may also be configured to: compare the one or more first cells and the one or more second cells in the spreadsheet Part or all of the cell names in the grid are automatically named; and the automatically named cell names are used to rewrite the spreadsheet formula and store the rewritten spreadsheet formula.
  • Hierarchical calculation graph memory 1307 the spreadsheet formula writer 1309, the smart suggestion module 1311, the defect detection module 1313, the spreadsheet model storage module 1315, and the spreadsheet model import/export module 1317 in Figure 13 are optional, so The box is a dashed line.
  • This application supports inputting calculation relationships between levels in an electronic form model in the form of level formulas, and generating electronic form formulas in batches based on them, which has the advantages of at least one of intuitive, automatic, reusable, and less error-prone.
  • the lvalues and parameters used in the level formula are all levels of the spreadsheet.
  • the level reference has clear semantics. The meaning of the level can be intuitively seen through the name of the level reference. Therefore, the level formula is more intuitive than the formula in the spreadsheet format.
  • Hierarchical formulas can automatically generate spreadsheet formulas in batches. In some implementations, even hierarchical formulas can be automatically generated or prompted to users, so this method is automatic and intelligent.
  • This application may also include a debugging function, which can identify possible errors in the electronic form model and provide corresponding debugging information. Therefore, it is not easy to make mistakes in the electronic form formula generated by this application.
  • Fig. 14 is a schematic block diagram showing an information processing device that can be used to implement an electronic form formula according to some embodiments of the present application.
  • a central processing unit (CPU) 1401 performs various processes in accordance with a program stored in a read only memory (ROM) 1402 or a program loaded from a storage portion 1408 to a random access memory (RAM) 1403.
  • ROM read only memory
  • RAM random access memory
  • data required when the CPU 1401 executes various processes and the like is also stored as needed.
  • the CPU 1401, the ROM 1402, and the RAM 1403 are connected to each other via a bus 1404.
  • the input/output interface 1405 is also connected to the bus 1404.
  • the following components are connected to the input/output interface 1405: input part 1406 (including keyboard, mouse, etc.), output part 1407 (including display, such as cathode ray tube (CRT), liquid crystal display (LCD), etc., and speakers, etc.), Storage part 1408 (including hard disk, etc.), communication part 1409 (including network interface card such as LAN card, modem, etc.).
  • the communication section 1409 performs communication processing via a network such as the Internet.
  • the driver 1410 can also be connected to the input/output interface 1405 according to needs.
  • Removable media 1411 such as magnetic disks, optical disks, magneto-optical disks, semiconductor memories, etc. are mounted on the drive 1410 as needed, so that the computer programs read from them are installed into the storage portion 1408 as needed.
  • a program constituting the software is installed from a network such as the Internet or a storage medium such as a removable medium 1411.
  • this storage medium is not limited to the removable medium 1411 shown in FIG. 14 where the program is stored and distributed separately from the device to provide the program to the user.
  • removable media 1411 include magnetic disks (including floppy disks (registered trademarks)), optical disks (including compact disk read-only memory (CD-ROM) and digital versatile disks (DVD)), magneto-optical disks (including mini disks (MD) (registered trademarks) )) and semiconductor memory.
  • the storage medium may be a ROM 1402, a hard disk included in the storage portion 1408, etc., in which programs are stored and distributed to users together with the devices containing them.
  • the computer program code used to perform the operations of the various aspects of the application can be written in any combination of one or more programming languages.
  • the programming languages include object-oriented programming languages—such as Java, Smalltalk, C++, etc., Also includes conventional procedural programming languages-such as "C" language or similar programming languages.
  • the program code can be executed entirely on the user's computer, partly on the user's computer, executed as an independent software package, partly on the user's computer and partly executed on a remote computer, or entirely executed on the remote computer or server.
  • the remote computer can 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 it can be connected to an external computer (for example, using an Internet service provider to pass Internet connection).
  • LAN local area network
  • WAN wide area network
  • each block of the flowchart and/or block diagram and the combination of each block in the flowchart and/or block diagram can be implemented by computer program instructions.
  • These computer program instructions can be provided to the processors of general-purpose computers, special-purpose computers, or other programmable data processing devices, thereby producing a machine that makes these computer program instructions when executed by the processors of the computer or other programmable data processing devices , A device that implements the functions/actions specified in one or more blocks in the flowcharts and/or block diagrams is produced.
  • each block in the flowchart or block diagram may represent a module, program segment, or part of the code, and the module, program segment, or part of the code contains one or more functions for realizing the specified logic function.
  • Executable instructions may also occur in a different order from the order marked in the drawings. For example, two consecutive blocks can actually be executed substantially in parallel, or they can sometimes be executed in the reverse order, depending on the functions involved.
  • each block in the block diagram and/or flowchart, and the combination of the blocks in the block diagram and/or flowchart can be implemented by a dedicated hardware-based system that performs the specified functions or actions Or it can be realized by a combination of dedicated hardware and computer instructions.
  • This application can also be configured as follows:
  • a computer-implemented method for generating spreadsheet formulas comprising:
  • Hierarchical formula for the electronic form, the hierarchical formula including an operator and a hierarchical reference, wherein the hierarchical reference corresponds to one or more nodes in one or more levels in the hierarchical structure of the electronic form , Wherein each level has at least one node and has a corresponding level type, and each node corresponds to one or more cells in the spreadsheet, wherein the level structure further includes the one or more nodes Affiliation;
  • the spreadsheet formula is generated based at least on the hierarchical structure and the calculation relationship for the spreadsheet.
  • graphical user interface editor includes components for specifying nodes and/or operators at different levels;
  • the hierarchical formula is generated based on the input.
  • the text code is parsed to generate the hierarchical formula.
  • a compound operator is constructed according to the atomic operator in the hierarchical formula, wherein the compound operator includes a combination of all the atomic operators in the hierarchical formula.
  • step of determining the calculation relationship between the one or more nodes based on the operator and the dependency relationship further includes:
  • the calculation relationship between the one or more nodes is determined based on at least the compound operator and the dependency relationship.
  • the level reference includes the first level reference located to the left of the equal sign in the level formula and the first level reference located in the level formula The second-level reference on the right side of the equal sign of, where the first-level reference corresponds to the first of the one or more nodes, and the second-level reference corresponds to the second of the one or more nodes node.
  • the dependency relationship between the first node and the second node is determined based at least on the correspondence between the first-level reference and the first node and the correspondence between the second-level reference and the second node.
  • the calculation relationship between the node and other nodes is stored via a hierarchical calculation graph.
  • the calculation relationship between the first node and the second node is determined based on the operator and the dependency relationship between the first node and the second node.
  • the calculation relationship between the first node and the second node is stored via the hierarchical calculation graph.
  • one or more first nodes corresponding to the current node are determined based on the calculation relationship between the current node and other nodes in the one or more nodes.
  • the The spreadsheet formula for each of the one or more first cells.
  • each first cell of the one or more first cells corresponding to the current node is connected to other nodes.
  • each second cell corresponds to the dependency relationship between each second cell in one or more second cells.
  • the operator corresponding to the current node in the one or more nodes is a first-level compound operator corresponding to one of the one or more nodes in the hierarchical structure of the spreadsheet ,
  • the first-level compound operator includes one or more first-level atomic operators;
  • the operator corresponding to each first cell in the one or more first cells is the second level corresponding to one cell in the one or more cells in the spreadsheet Compound operators, the second-level compound operators include one or more second-level atomic operators; and
  • the first-level compound operator uses the first-level directed graph for storage.
  • Each directed graph node in the first-level directed graph represents each first-level atomic operator in the first-level compound operator, and the first-level
  • the directed edges between each directed graph node in the directed graph represent the combination relationship between each first-level atomic operator in the first-level compound operator;
  • the second-level compound operator uses a second-level directed graph for storage.
  • Each directed graph node in the second-level directed graph represents each second-level atomic operator in the second-level compound operator, and the second-level
  • the directed edges between each directed graph node in the directed graph represent the combination relationship between each second-level atomic operator in the second-level compound operator;
  • the second-level directed graph is determined by traversing the first-level directed graph corresponding to the first-level compound operator, and the second-level compound operator is determined according to the second-level directed graph.
  • the attribute information includes one or more of the following items: the location information of the cells in the spreadsheet, the label information corresponding to the cells in the spreadsheet, and the location information of the cells in the spreadsheet, and the location information of the cells in the spreadsheet. Label information and intermediate nodes corresponding to the cells in, and intermediate nodes corresponding to the cells in the spreadsheet, wherein the intermediate nodes are used to store intermediate calculation results;
  • each intermediate-level directed graph in the intermediate-level directed graph is determined The graph node set is determined according to the dependency relationship between the one or more first-level directed graph nodes in the first-level directed graph in each intermediate-level directed graph node set in the intermediate-level directed graph The dependency between each intermediate-level directed graph node in the intermediate-level directed graph and each intermediate-level directed graph node in the set of other intermediate-level directed graph nodes in the intermediate-level directed graph.
  • each first-level sub-directed graph node of the current first-level directed graph node contains the label information corresponding to the cell in the spreadsheet
  • the attribute information of each first-level sub-directed graph node The intersection of the label information contained in the attribute information sets the label information in the attribute information of the current first-level directed graph node, and sets the current first-level atomic operator represented by the current first-level directed graph node.
  • the intermediate-level atomic operator in the attribute information of the first-level directed graph node is determined to be related to the current first-level based on the label information and the intermediate-level atomic operator in the attribute information of the current first-level directed graph node.
  • the label information in the attribute information of the graph node and its first-level child directed graph node is used to determine each intermediate-level directed graph node in the current intermediate-level directed graph node set corresponding to the current first-level directed graph node
  • the first-level atomic operator represented by the current first-level directed graph node sets the intermediate-level atomic operator in the attribute information of the current first-level directed graph node, at least according to the current first-level directed graph node
  • the intermediate-level atomic operator in the attribute information of the current first-level directed graph node is used to determine the current intermediate-level directed graph node set corresponding to the current first-level directed graph node, and at least according to the current first-level directed graph node and its first-level
  • the dependency relationship between the sub-directed graph nodes is used to determine the current intermediate-level directed graph node corresponding to the current first-level directed graph node in each intermediate-level directed graph node and the intermediate-level directed graph.
  • the attribute information of a part of the current first-level directed graph node of the first-level child directed graph node contains the label information corresponding to the cell in the spreadsheet and the other part of the current first-level directed graph node is the first If the attribute information of the first-level child directed graph node does not contain label information, the current first-level directed graph node is set according to the intersection of the label information contained in the attribute information of the first-level child directed graph node containing the label information According to the label information in the attribute information of the current first-level directed graph node, the intermediate-level atomic operator in the attribute information of the current first-level directed graph node is set according to the first-level atomic operator represented by the current first-level directed graph node.
  • the label information and intermediate atomic operators in the attribute information of the current first-level directed graph node are used to determine the current intermediate-level directed graph node set corresponding to the current first-level directed graph node, and at least according to the current
  • the dependency relationship between the first-level directed graph node and its first-level child directed graph node is determined according to the label information in the attribute information of the current first-level directed graph node and its first-level child directed graph node.
  • Each intermediate-level directed graph node in the current intermediate-level directed graph node set corresponding to the current first-level directed graph node and each intermediate-level directed graph node set in the intermediate-level directed graph The dependency relationship between the nodes of the hierarchical directed graph.
  • the attribute information of the current first-level directed graph node does not contain label information or includes a subset of the label information in the attribute information of the first-level child directed graph node of the current first-level directed graph node, Set the intermediate-level atomic operator in the attribute information of the current first-level directed graph node at least according to the first-level atomic operator represented by the current first-level directed graph node, and at least according to the current first-level directed graph node
  • the intermediate-level atomic operator in the attribute information of the graph node determines the current intermediate-level directed graph node set corresponding to the current first-level directed graph node, and at least according to the current first-level directed graph node and its first-level directed graph node
  • the dependency relationship between the first-level sub-directed graph nodes is used to determine each intermediate-level directed graph node and the intermediate-level directed graph in the current intermediate-level directed graph node set corresponding to the current first-level directed graph node
  • the attribute information of the first-level child directed graph node of the current first-level directed graph node contains the label information corresponding to the cell in the spreadsheet
  • the attribute information of the first-level child directed graph node contains the label information corresponding to the cell in the spreadsheet
  • the label information contained in the information is set to the label information in the attribute information of the current first-level directed graph node
  • the “equal” atomic operator is set to the current first-level directed graph node.
  • the intermediate-level atomic operator in the attribute information of the directed graph node is determined to be relative to the current first-level directed graph node according to the label information and the intermediate-level atomic operator in the attribute information of the current first-level directed graph node.
  • the corresponding set of current intermediate-level directed graph nodes and at least according to the dependency relationship between the current first-level directed graph node and its first-level child directed graph nodes, and according to the current first-level directed graph node and its first level
  • the label information in the attribute information of the first-level sub-directed graph node is used to determine the current intermediate-level directed graph node set corresponding to the current first-level directed graph node.
  • the second-level directed graph is used to determine the second-level compound operator based on the second-level directed graph.
  • each intermediate-level directed graph root node set The position of the root node of the level directed graph corresponds to the position of the left value node of each intermediate level directed graph in the set of left value nodes of the intermediate level directed graph;
  • the sub-directed graph with the root node of the intermediate-level directed graph at the corresponding matching position as the root node is extracted as the second-level directed graph to determine the cell corresponding to the intermediate-level lvalue node according to the second-level directed graph
  • the second-level compound operator is extracted as the second-level directed graph to determine the cell corresponding to the intermediate-level lvalue node according to the second-level directed graph.
  • the generated spreadsheet formula for each first cell of the one or more first cells is stored in a corresponding cell in the spreadsheet file.
  • the custom atomic operator is defined by combining the atomic operators preset by the system.
  • the custom atomic operator is included in the hierarchical formula used in the spreadsheet, the custom atomic operator is converted into a system preset atomic operator.
  • the knowledge base of intelligent suggestions Updating the knowledge base of intelligent suggestions based on the obtained hierarchy formula, the knowledge base of intelligent suggestions including information related to the hierarchy formula or hierarchy structure;
  • intelligent suggestions are made when a new level formula is about to be obtained.
  • the debugging information includes errors or warnings.
  • An electronic form model is stored, and the electronic form model includes one or more of the following: a hierarchical structure for the electronic form, a hierarchical calculation diagram for the electronic form, and an electronic form file.
  • the hierarchical formula is generated according to the determined operator and hierarchical reference.
  • each node in the directed graph represents the operator in the hierarchical formula
  • the directed graph between each node in the directed graph The edges represent the combination relationship between the operators in the hierarchical formula.
  • a device for generating spreadsheet formulas including: components for performing the steps of the method described in any one of (1) to (36).
  • a device for generating spreadsheet formulas including:
  • At least one processor At least one processor
  • At least one storage device stores instructions, and when the instructions are executed by the at least one processor, the at least one processor executes the instructions as described in any one of (1)-(36) The method described.
  • a non-transitory computer-readable storage medium storing instructions that, when executed by a processor, cause the method described in any one of (1) to (36) to be performed.
  • a device for generating an electronic form formula comprising:
  • a hierarchical formula editor configured to obtain a hierarchical formula for the electronic form, the hierarchical formula including an operator and a hierarchical reference, wherein the hierarchical reference corresponds to a hierarchical structure for the electronic form
  • the hierarchical reference corresponds to a hierarchical structure for the electronic form
  • the hierarchical structure also includes the affiliation relationship between the one or more nodes;
  • a hierarchical formula parser configured to determine the dependency relationship between the one or more nodes based on the correspondence between the hierarchical reference and the one or more nodes; the hierarchy The formula parser is further configured to determine the calculation relationship between the one or more nodes based on the operator and the dependency relationship; and
  • a formula translator configured to generate the spreadsheet formula based on at least the hierarchical structure and the calculation relationship for the spreadsheet.
  • the hierarchical formula editor includes a graphical user interface editor, wherein the graphical user interface editor includes components for specifying nodes and/or operators of different levels , And wherein the graphical user interface editor is further configured to:
  • the hierarchical formula is generated based on the input.
  • the text code is parsed to generate the hierarchical formula.
  • a compound operator is constructed according to the atomic operator in the hierarchical formula, wherein the compound operator includes a combination of all the atomic operators in the hierarchical formula.
  • the calculation relationship between the one or more nodes is determined based on at least the compound operator and the dependency relationship.
  • level reference includes the first level reference located to the left of the equal sign in the level formula and the first level reference located in the level formula The second-level reference on the right side of the equal sign of, where the first-level reference corresponds to the first of the one or more nodes, and the second-level reference corresponds to the second of the one or more nodes node.
  • the dependency relationship between the first node and the second node is determined based at least on the correspondence between the first-level reference and the first node and the correspondence between the second-level reference and the second node.
  • the calculation relationship between the node and other nodes is stored via a hierarchical calculation graph.
  • the calculation relationship between the first node and the second node is determined based on the operator and the dependency relationship between the first node and the second node.
  • the calculation relationship between the first node and the second node is stored via the hierarchical calculation graph.
  • one or more first nodes corresponding to the current node are determined based on the calculation relationship between the current node and other nodes in the one or more nodes.
  • the The spreadsheet formula for each of the one or more first cells.
  • each first cell of the one or more first cells corresponding to the current node is connected to other nodes.
  • each second cell corresponds to the dependency relationship between each second cell in one or more second cells.
  • the operator corresponding to the current node in the one or more nodes is a first-level compound operator corresponding to one of the one or more nodes in the hierarchical structure of the spreadsheet ,
  • the first-level compound operator includes one or more first-level atomic operators;
  • the operator corresponding to each first cell in the one or more first cells is the second level corresponding to one cell in the one or more cells in the spreadsheet Compound operators, the second-level compound operators include one or more second-level atomic operators; and
  • the first-level compound operator uses the first-level directed graph for storage.
  • Each directed graph node in the first-level directed graph represents each first-level atomic operator in the first-level compound operator, and the first-level
  • the directed edges between each directed graph node in the directed graph represent the combination relationship between each first-level atomic operator in the first-level compound operator;
  • the second-level compound operator uses a second-level directed graph for storage.
  • Each directed graph node in the second-level directed graph represents each second-level atomic operator in the second-level compound operator, and the second-level
  • the directed edges between each directed graph node in the directed graph represent the combination relationship between each second-level atomic operator in the second-level compound operator;
  • the second-level directed graph is determined by traversing the first-level directed graph corresponding to the first-level compound operator, and the second-level compound operator is determined according to the second-level directed graph.
  • the attribute information includes one or more of the following items: the location information of the cells in the spreadsheet, the label information corresponding to the cells in the spreadsheet, and the location information of the cells in the spreadsheet, and the location information of the cells in the spreadsheet. Label information and intermediate nodes corresponding to the cells in, and intermediate nodes corresponding to the cells in the spreadsheet, wherein the intermediate nodes are used to store intermediate calculation results;
  • each intermediate-level directed graph in the intermediate-level directed graph is determined The graph node set is determined according to the dependency relationship between the one or more first-level directed graph nodes in the first-level directed graph in each intermediate-level directed graph node set in the intermediate-level directed graph The dependency between each intermediate-level directed graph node in the intermediate-level directed graph and each intermediate-level directed graph node in the set of other intermediate-level directed graph nodes in the intermediate-level directed graph.
  • each first-level sub-directed graph node of the current first-level directed graph node contains the label information corresponding to the cell in the spreadsheet
  • the attribute information of each first-level sub-directed graph node The intersection of the label information contained in the attribute information sets the label information in the attribute information of the current first-level directed graph node, and sets the current first-level atomic operator represented by the current first-level directed graph node.
  • the intermediate-level atomic operator in the attribute information of the first-level directed graph node is determined to be related to the current first-level based on the label information and the intermediate-level atomic operator in the attribute information of the current first-level directed graph node.
  • the label information in the attribute information of the graph node and its first-level child directed graph node is used to determine each intermediate-level directed graph node in the current intermediate-level directed graph node set corresponding to the current first-level directed graph node
  • the first-level atomic operator represented by the current first-level directed graph node sets the intermediate-level atomic operator in the attribute information of the current first-level directed graph node, at least according to the current first-level directed graph node
  • the intermediate-level atomic operator in the attribute information of the current first-level directed graph node is used to determine the current intermediate-level directed graph node set corresponding to the current first-level directed graph node, and at least according to the current first-level directed graph node and its first-level
  • the dependency relationship between the sub-directed graph nodes is used to determine the current intermediate-level directed graph node corresponding to the current first-level directed graph node in each intermediate-level directed graph node and the intermediate-level directed graph.
  • the attribute information of a part of the current first-level directed graph node of the first-level child directed graph node contains the label information corresponding to the cell in the spreadsheet and the other part of the current first-level directed graph node is the first If the attribute information of the first-level child directed graph node does not contain label information, the current first-level directed graph node is set according to the intersection of the label information contained in the attribute information of the first-level child directed graph node containing the label information According to the label information in the attribute information of the current first-level directed graph node, the middle-level atomic operator in the attribute information of the current first-level directed graph node is set according to the first-level atomic operator represented by the current first-level directed graph node.
  • the label information and intermediate atomic operators in the attribute information of the current first-level directed graph node are used to determine the current intermediate-level directed graph node set corresponding to the current first-level directed graph node, and at least according to the current
  • the dependency relationship between the first-level directed graph node and its first-level child directed graph node is determined according to the label information in the attribute information of the current first-level directed graph node and its first-level child directed graph node.
  • Each intermediate-level directed graph node in the current intermediate-level directed graph node set corresponding to the current first-level directed graph node and each intermediate-level directed graph node set in the intermediate-level directed graph The dependency relationship between the nodes of the hierarchical directed graph.
  • the attribute information of the current first-level directed graph node does not contain label information or includes a subset of the label information in the attribute information of the first-level child directed graph node of the current first-level directed graph node, Set the intermediate-level atomic operator in the attribute information of the current first-level directed graph node at least according to the first-level atomic operator represented by the current first-level directed graph node, and at least according to the current first-level directed graph node
  • the intermediate-level atomic operator in the attribute information of the graph node determines the current intermediate-level directed graph node set corresponding to the current first-level directed graph node, and at least according to the current first-level directed graph node and its first-level directed graph node
  • the dependency relationship between the first-level sub-directed graph nodes is used to determine each intermediate-level directed graph node and the intermediate-level directed graph in the current intermediate-level directed graph node set corresponding to the current first-level directed graph node
  • the attribute information of the first-level child directed graph node of the current first-level directed graph node contains the label information corresponding to the cell in the spreadsheet
  • the attribute information of the first-level child directed graph node contains the label information corresponding to the cell in the spreadsheet
  • the label information contained in the information is set to the label information in the attribute information of the current first-level directed graph node
  • the “equal” atomic operator is set to the current first-level node.
  • the intermediate-level atomic operator in the attribute information of the directed graph node is determined to be relative to the current first-level directed graph node according to the label information and the intermediate-level atomic operator in the attribute information of the current first-level directed graph node.
  • the corresponding set of current intermediate-level directed graph nodes and at least according to the dependency relationship between the current first-level directed graph node and its first-level child directed graph nodes, and according to the current first-level directed graph node and its first level
  • the label information in the attribute information of the first-level sub-directed graph node is used to determine the current intermediate-level directed graph node set corresponding to the current first-level directed graph node.
  • the second-level directed graph is used to determine the second-level compound operator based on the second-level directed graph.
  • each intermediate-level directed graph root node set The position of the root node of the level directed graph corresponds to the position of the left value node of each intermediate level directed graph in the set of left value nodes of the intermediate level directed graph;
  • the sub-directed graph with the root node of the intermediate-level directed graph at the corresponding matching position as the root node is extracted as the second-level directed graph to determine the cell corresponding to the intermediate-level lvalue node according to the second-level directed graph
  • the second-level compound operator is extracted as the second-level directed graph to determine the cell corresponding to the intermediate-level lvalue node according to the second-level directed graph.
  • the generated spreadsheet formula for each first cell of the one or more first cells is stored in a corresponding cell in the spreadsheet file.
  • the custom atomic operator is defined by combining the atomic operators preset by the system.
  • the custom atomic operator is included in the hierarchical formula used in the spreadsheet, the custom atomic operator is converted into a system preset atomic operator.
  • the knowledge base of intelligent suggestions Updating the knowledge base of intelligent suggestions based on the obtained hierarchy formula, the knowledge base of intelligent suggestions including information related to the hierarchy formula or hierarchy structure;
  • intelligent suggestions are made when a new level formula is about to be obtained.
  • the debugging information includes errors or warnings.
  • An electronic form model storage module configured to store an electronic form model, the electronic form model includes one or more of the following: for the hierarchical structure of the electronic form, used for the electronic form Hierarchical calculation diagrams and spreadsheet files.
  • An electronic form model import and export module configured to import and/or export the electronic form model.
  • the hierarchical formula is generated according to the determined operator and hierarchical reference.
  • each node in the directed graph represents the operator in the hierarchical formula
  • the directed graph between each node in the directed graph The edges represent the combination relationship between the operators in the hierarchical formula.

Abstract

The present application discloses a computer-implemented method and device for generating a spreadsheet formula, and a storage medium. The method comprises: acquiring a hierarchical formula for a spreadsheet, the hierarchical formula comprising an operator and a hierarchical reference, wherein the hierarchical reference corresponds to one or more nodes in one or more hierarchies in a hierarchical structure for the spreadsheet; determining dependency between one or more nodes on the basis of the correlation between the hierarchical reference and the one or more nodes; determining a computational relationship between one or more nodes on the basis of the operator and the dependency; and generating a spreadsheet formula at least on the basis of the hierarchical structure and the computational relationship for the spreadsheet.

Description

生成电子表格公式的计算机实现的方法、设备和存储介质Computer-implemented method, device and storage medium for generating spreadsheet formula
交叉引用cross reference
本申请要求于2019年10月15日提交的中国专利申请第201910977971.4号的优先权,其全部内容通过引用合并于此。This application claims the priority of Chinese Patent Application No. 201910977971.4 filed on October 15, 2019, the entire content of which is incorporated herein by reference.
技术领域Technical field
本申请涉及电子表格信息处理,尤其涉及用于生成电子表格公式的计算机实现的方法、设备和存储介质。This application relates to electronic form information processing, and in particular to computer-implemented methods, devices and storage media for generating electronic form formulas.
背景技术Background technique
在很多行业领域,经常需要编写包含大量公式的电子表格(Spreadsheet)。电子表格通常包括数十页(sheet)、数千行(row)、数万个单元格(Cell),并且各个单元格之间又存在非常复杂的相互计算关系,其中绝大部分单元格中的内容都是公式。In many industries, it is often necessary to write spreadsheets containing a large number of formulas (Spreadsheet). Spreadsheets usually include dozens of pages (sheets), thousands of rows (rows), and tens of thousands of cells (Cells), and there is a very complex mutual calculation relationship between each cell. The contents are all formulas.
发明内容Summary of the invention
在传统的电子表格处理软件(例如微软Excel、谷歌Sheet)中,如果单元格中存储的是公式,则电子表格默认显示的是公式的计算结果,并且公式缺乏代表其真实含义的语义信息。这使得编辑电子表格中的公式费时费力,而且容易出错,难以调试,并且难以被除了电子表格作者以外的其他人理解或更改。目前并没有可行的方案能够解决这些问题。In traditional spreadsheet processing software (such as Microsoft Excel, Google Sheet), if a formula is stored in a cell, the spreadsheet defaults to displaying the calculation result of the formula, and the formula lacks semantic information representing its true meaning. This makes editing the formulas in the spreadsheets time-consuming and laborious, error-prone, difficult to debug, and difficult to understand or change by people other than the spreadsheet author. There is currently no feasible solution to solve these problems.
因此,本申请针对上述问题中的至少一个问题提出了一种用于生成电子表格公式的计算机实现的方法、设备和存储介质。Therefore, this application proposes a computer-implemented method, device, and storage medium for generating spreadsheet formulas in response to at least one of the above-mentioned problems.
根据本申请的第一方面,提供了一种用于生成电子表格公式的计算机实现的方法,所述方法包括:获取用于所述电子表格的层级公式,所述层级公式包括运算符和层级引用,其中所述层级引用对应于用于电子表格的层级结构中的一个或多个层级中的一个或多个节点,其中每个层级具有至少一个节点并且具有相应的层级类型,每个节点对应于所述电子表格中的一个或多个单元格,其中所述层级结构还包括所述一个或多个节点之间的隶属关系;基于所述层级引用与所述一个或多个节点之间的对应关系来确定所述一个或多个节点之间的依赖关系;基于所述运算符和所述依赖关系来确 定所述一个或多个节点之间的计算关系;以及至少基于用于所述电子表格的所述层级结构和所述计算关系来生成所述电子表格公式。According to a first aspect of the present application, there is provided a computer-implemented method for generating an electronic form formula, the method comprising: obtaining a hierarchical formula for the electronic form, the hierarchical formula including an operator and a hierarchical reference , Wherein the level reference corresponds to one or more nodes in one or more levels in the hierarchical structure of the spreadsheet, wherein each level has at least one node and has a corresponding level type, and each node corresponds to One or more cells in the electronic form, wherein the hierarchical structure further includes the affiliation relationship between the one or more nodes; based on the correspondence between the hierarchical reference and the one or more nodes Relationship to determine the dependency relationship between the one or more nodes; determine the calculation relationship between the one or more nodes based on the operator and the dependency relationship; and at least based on the use of the spreadsheet The hierarchical structure and the calculation relationship are used to generate the spreadsheet formula.
根据本申请的第二方面,提供了一种用于生成电子表格公式的装置,包括:用于执行如前述各项中的任一项所述的方法的步骤的部件。According to a second aspect of the present application, there is provided an apparatus for generating an electronic form formula, including: components for executing the steps of the method according to any one of the foregoing items.
根据本申请的第三方面,提供了一种用于生成电子表格公式的设备,包括:至少一个处理器;以及至少一个存储设备,所述至少一个存储设备存储有指令,当所述指令由所述至少一个处理器执行时使得所述至少一个处理器执行如前述各项中的任一项所述的方法。According to a third aspect of the present application, there is provided a device for generating spreadsheet formulas, including: at least one processor; and at least one storage device, the at least one storage device stores instructions, when the instructions are The execution of the at least one processor causes the at least one processor to execute the method according to any one of the foregoing items.
根据本申请的第四方面,提供了一种非瞬态计算机可读存储介质,存储有指令,当所述指令由处理器执行时使得执行如前述各项中的任一项所述的方法。According to a fourth aspect of the present application, there is provided a non-transitory computer-readable storage medium storing instructions that when executed by a processor cause the method as described in any one of the foregoing items to be performed.
根据本申请的第五方面,提供了一种用于生成电子表格公式的装置,所述装置包括:层级公式编辑器,所述层级公式编辑器被配置为获取用于所述电子表格的层级公式,所述层级公式包括运算符和层级引用,其中所述层级引用对应于用于电子表格的层级结构中的一个或多个层级中的一个或多个节点,其中每个层级具有至少一个节点并且具有相应的层级类型,每个节点对应于所述电子表格中的一个或多个单元格,其中所述层级结构还包括所述一个或多个节点之间的隶属关系;层级公式解析器,所述层级公式解析器被配置为基于所述层级引用与所述一个或多个节点之间的对应关系来确定所述一个或多个节点之间的依赖关系;所述层级公式解析器还被配置为基于所述运算符和所述依赖关系来确定所述一个或多个节点之间的计算关系;以及公式转译器,所述公式转译器被配置为至少基于用于所述电子表格的所述层级结构和所述计算关系来生成所述电子表格公式。According to a fifth aspect of the present application, there is provided an apparatus for generating an electronic form formula, the apparatus comprising: a hierarchical formula editor configured to obtain a hierarchical formula for the electronic form , The level formula includes an operator and a level reference, wherein the level reference corresponds to one or more nodes in one or more levels in the hierarchical structure of the spreadsheet, wherein each level has at least one node and Has a corresponding level type, each node corresponds to one or more cells in the spreadsheet, wherein the hierarchical structure also includes the membership relationship between the one or more nodes; a level formula parser, so The hierarchical formula parser is configured to determine the dependency relationship between the one or more nodes based on the correspondence between the hierarchical reference and the one or more nodes; the hierarchical formula parser is further configured In order to determine the calculation relationship between the one or more nodes based on the operator and the dependency relationship; and a formula translator, the formula translator is configured to be based on at least the The hierarchy structure and the calculation relationship are used to generate the spreadsheet formula.
根据本申请的一些实施例,可以直观地编写电子表格公式。因此,可以容易地通过阅读电子表格中的公式本身来理解这个公式所代表的含义。According to some embodiments of the present application, an electronic form formula can be written intuitively. Therefore, you can easily understand the meaning of the formula by reading the formula itself in the spreadsheet.
另外,根据本申请的一些实施例,可以自动地在电子软件中编写公式。因此,可以在编写电子表格公式时进行智能提示或自动补全。In addition, according to some embodiments of the present application, formulas can be automatically written in electronic software. Therefore, you can make intelligent prompts or auto-complete when writing spreadsheet formulas.
另外,根据本申请的一些实施例,可以容易地对电子表格中的公式进行复用。可以将可重复使用的具有语义信息的公式自动转化成电子表格中的以单元格位置信息编写的公式。In addition, according to some embodiments of the present application, formulas in the electronic form can be reused easily. Reusable formulas with semantic information can be automatically converted into formulas written with cell location information in the spreadsheet.
另外,根据本申请的一些实施例,可以高效地避免或发现电子表格中的公式错误。因此,即使当电子表格中包含很多公式时,也很容易发现其中部分公式存在的错误。In addition, according to some embodiments of the present application, formula errors in the electronic form can be efficiently avoided or discovered. Therefore, even when the spreadsheet contains many formulas, it is easy to find errors in some of the formulas.
本领域技术人员应当理解,上述技术效果是示例性的,而非限制性的。通过以下参照附图对本申请的示例性实施例的详细描述,本申请的其它特征及其优点将会变得清楚。Those skilled in the art should understand that the above technical effects are exemplary rather than restrictive. Through the following detailed description of exemplary embodiments of the present application with reference to the accompanying drawings, other features and advantages of the present application will become clear.
附图说明Description of the drawings
构成说明书的一部分的附图描述了本申请的实施例,并且连同说明书一起用于解释本申请的原理。The drawings constituting a part of the specification describe the embodiments of the present application, and together with the specification are used to explain the principle of the present application.
参照附图,根据下面的详细描述,可以更加清楚地理解本申请,其中:With reference to the drawings, the application can be understood more clearly according to the following detailed description, in which:
图1是示意性地示出根据本申请的一些实施例的用于生成电子表格公式的计算机实现的方法的流程图。Fig. 1 is a flowchart schematically showing a computer-implemented method for generating spreadsheet formulas according to some embodiments of the present application.
图2是示意性地示出根据本申请的一些实施例的用于电子表格的层级结构的示意图。Fig. 2 is a schematic diagram schematically showing a hierarchical structure for an electronic form according to some embodiments of the present application.
图3是示意性地示出根据本申请的一些实施例的用于电子表格的层级结构的示意图。Fig. 3 is a schematic diagram schematically showing a hierarchical structure for an electronic form according to some embodiments of the present application.
图4是示意性地示出根据本申请的一些实施例的用于表示电子表格的层级结构的层级计算图的示意图。Fig. 4 is a schematic diagram schematically showing a hierarchical calculation diagram for representing a hierarchical structure of an electronic form according to some embodiments of the present application.
图5是示意性地示出根据本申请的一些实施例的层级计算图中的节点的示意图。Fig. 5 is a schematic diagram schematically showing nodes in a hierarchical calculation graph according to some embodiments of the present application.
图6是示意性地示出根据本申请的一些实施例的用于解析文本代码以生成层级公式的过程的流程图。Fig. 6 is a flowchart schematically showing a process for parsing text codes to generate a hierarchical formula according to some embodiments of the present application.
图7是示意性地示出根据本申请的一些实施例的用于层级的复合运算符的有向图的示意图。FIG. 7 is a schematic diagram schematically showing a directed graph of a compound operator for a hierarchy according to some embodiments of the present application.
图8是示意性地示出根据本申请的一些实施例的用于单元格的复合运算符的有向图的示意图。FIG. 8 is a schematic diagram schematically showing a directed graph of a compound operator for a cell according to some embodiments of the present application.
图9是示意性地示出根据本申请的一些实施例的用于为运算符指定依赖单元格的过程的示意图。FIG. 9 is a schematic diagram schematically illustrating a process for specifying a dependent cell for an operator according to some embodiments of the present application.
图10是示意性地示出根据本申请的一些实施例的用于将用于层级的复合运算符转换为用于单元格的复合运算符的过程的示意图。FIG. 10 is a schematic diagram schematically showing a process for converting a compound operator for a hierarchy into a compound operator for a cell according to some embodiments of the present application.
图11是示意性地示出根据本申请的一些实施例的转换后的用于单元格的复合运算符的有向图的示意图。FIG. 11 is a schematic diagram schematically showing a directed graph of a compound operator for a cell after conversion according to some embodiments of the present application.
图12是示意性地示出根据本申请的一些实施例的自定义原子运算符的有向图的 示意图。Fig. 12 is a schematic diagram schematically showing a directed graph of a custom atomic operator according to some embodiments of the present application.
图13是示意性地示出根据本申请的一些实施例的用于生成电子表格公式的装置的框图。FIG. 13 is a block diagram schematically showing an apparatus for generating an electronic form formula according to some embodiments of the present application.
图14是示出可用于实施根据本申请的一些实施例的用于生成电子表格公式的信息处理设备的示意性框图。Fig. 14 is a schematic block diagram showing an information processing device that can be used to implement an electronic form formula according to some embodiments of the present application.
具体实施方式Detailed ways
现在将参照附图来详细描述本申请的各种示例性实施例。应注意到:除非另外具体说明,否则在这些实施例中阐述的模块和步骤的相对布置、数字表达式和数值不限制本申请的范围。Various exemplary embodiments of the present application will now be described in detail with reference to the accompanying drawings. It should be noted that unless specifically stated otherwise, the relative arrangement, numerical expressions and numerical values of the modules and steps set forth in these embodiments do not limit the scope of the present application.
同时,应当明白,为了便于描述,附图中所示出的各个部分的尺寸并不是按照实际的比例关系绘制的。At the same time, it should be understood that, for ease of description, the sizes of the various parts shown in the drawings are not drawn in accordance with actual proportional relationships.
以下对至少一个示例性实施例的描述实际上仅仅是说明性的,决不作为对本申请及其应用或使用的任何限制。The following description of at least one exemplary embodiment is actually only illustrative, and in no way serves as any restriction on the application and its application or use.
对于相关领域普通技术人员已知的技术、方法和设备可能不作详细讨论,但在适当情况下,所述技术、方法和设备应当被视为说明书的一部分。The technologies, methods, and equipment known to those of ordinary skill in the relevant fields may not be discussed in detail, but where appropriate, the technologies, methods, and equipment should be regarded as part of the specification.
在这里示出和讨论的所有示例中,任何具体值应被解释为仅仅是示例性的,而不是作为限制。因此,示例性实施例的其它示例可以具有不同的值。In all examples shown and discussed herein, any specific value should be interpreted as merely exemplary, rather than as a limitation. Therefore, other examples of the exemplary embodiment may have different values.
应注意,相似的标号和字母在下面的附图中表示类似项,因此,一旦某一项在一个附图中被定义,则在随后的附图中不需要对其进行进一步讨论。It should be noted that similar reference numerals and letters indicate similar items in the following drawings, and therefore, once an item is defined in one drawing, it does not need to be further discussed in the subsequent drawings.
图1是示意性地示出根据本申请的一些实施例的用于生成电子表格公式的计算机实现的方法100的流程图。FIG. 1 is a flowchart schematically showing a computer-implemented method 100 for generating spreadsheet formulas according to some embodiments of the present application.
如图1中所示,在步骤S101中,可以获取用于电子表格的层级公式,层级公式包括运算符和层级引用,其中层级引用对应于用于电子表格的层级结构中的一个或多个层级中的一个或多个节点。As shown in FIG. 1, in step S101, a hierarchical formula for the electronic form can be obtained. The hierarchical formula includes an operator and a hierarchical reference, where the hierarchical reference corresponds to one or more levels in the hierarchical structure used for the electronic form. One or more nodes in.
根据本申请的一些实施例,每个层级可以具有至少一个节点并且具有相应的层级类型,每个节点可以对应于电子表格中的一个或多个单元格。另外,例如,层级结构还可以包括一个或多个节点之间的隶属关系。According to some embodiments of the present application, each level may have at least one node and a corresponding level type, and each node may correspond to one or more cells in the spreadsheet. In addition, for example, the hierarchical structure may also include the affiliation relationship between one or more nodes.
下面参考图2和图3来描述用于电子表格的层级结构。图2是示意性地示出根据本申请的一些实施例的用于电子表格的层级结构的示意图。图3是示意性地示出根据 本申请的一些实施例的用于电子表格的层级结构的示意图。The following describes the hierarchical structure for the electronic form with reference to FIGS. 2 and 3. Fig. 2 is a schematic diagram schematically showing a hierarchical structure for an electronic form according to some embodiments of the present application. Fig. 3 is a schematic diagram schematically showing a hierarchical structure for an electronic form according to some embodiments of the present application.
根据本申请的一些实施例,用于电子表格的层级结构例如可以包括对电子表格进行划分所得到的以下层级:工作簿(book)、页(sheet)、节(section)、表(table)、块(block)、行(row)、列(column)、区间(interval)、单元格(cell)等。注意,用于电子表格的层级结构的上述划分方式仅仅是示例性的,还可以采用其他划分方式。According to some embodiments of the present application, the hierarchical structure used for the electronic form may include, for example, the following levels obtained by dividing the electronic form: book, sheet, section, table, Block, row, column, interval, cell, etc. Note that the above-mentioned division method for the hierarchical structure of the electronic form is only exemplary, and other division methods may also be adopted.
工作簿可以是电子表格文件(比如.xls或.xlsx格式的文件),工作簿可以包括多个页。页可以包括节或表,每个节还可以包括子节和表。表可以包括行、列或块。块可以是紧密联系的行或列的集合,每个块还可以包括子块。The workbook can be a spreadsheet file (such as a file in .xls or .xlsx format), and the workbook can include multiple pages. Pages can include sections or tables, and each section can also include subsections and tables. The table can include rows, columns, or blocks. A block can be a collection of closely related rows or columns, and each block can also include sub-blocks.
页可以被不同级别的标题划分为不同的节。图2示出了电子表格中的页的层级结构的示例。如图2中所示,第一级标题1和第一级标题2可以将电子表格中的页划分为第1节和第2节。第1节可以进一步包括第二级标题1.1和第二级标题1.2,第二级标题1.1和第二级标题1.2可以将第1节划分为第1.1节和第1.2节(在该示例中第1.2节为空)。第1.1节可以包括两个表,分别为表1.1.A和表1.1.B。类似地,第2节可以进一步包括第二级标题2.1和第二级标题2.2,第二级标题2.1和第二级标题2.2可以将第2节划分为第2.1节和第2.2节。另外,第2节还可以包括表2.A。第2.1节可以包括第三级标题2.1.1和第三级标题2.1.2。第三级标题2.1.2可以包括第2.1.2节。第2.1.2节可以包括表2.1.2.A。另外,第2.2节可以包括表2.2.A和表2.2.B。注意,标题和表都可以添加名称。Pages can be divided into different sections by different levels of headings. FIG. 2 shows an example of the hierarchical structure of pages in an electronic form. As shown in Figure 2, the first-level heading 1 and the first-level heading 2 can divide the pages in the spreadsheet into the first section and the second section. Section 1 may further include second-level heading 1.1 and second-level heading 1.2. Second-level heading 1.1 and second-level heading 1.2 may divide section 1 into section 1.1 and section 1.2 (in this example, section 1.2 Section is empty). Section 1.1 can include two tables, namely Table 1.1.A and Table 1.1.B. Similarly, section 2 may further include second-level heading 2.1 and second-level heading 2.2, and second-level heading 2.1 and second-level heading 2.2 may divide section 2 into section 2.1 and section 2.2. In addition, Section 2 can also include Table 2.A. Section 2.1 may include third-level heading 2.1.1 and third-level heading 2.1.2. The third level heading 2.1.2 may include section 2.1.2. Section 2.1.2 may include Table 2.1.2.A. In addition, Section 2.2 may include Table 2.2.A and Table 2.2.B. Note that you can add names to both the title and the table.
表可以包括行、列或块,块可以包括多个行或列。图3示出了电子表格中的页中的表的层级结构的示例。如图3中所示,表例如可以包括11行/列,其中,可以存在4个第一级行/列,分别为第一级行/列1、第一级行/列2、第一级行/列4和第一级行/列6。另外,第二级行/列3.1、第二级行/列3.2和第二级行/列3.3是第二级行/列,他们可以组成第一级块3。另外,第三级行/列5.2.1和第三级行/列5.2.2是第三级行/列,它们可以组成第二级块5.2。另外,第二级行/列5.1、第二级块5.2和第二级行/列5.3可以组成第一级块5。A table can include rows, columns, or blocks, and a block can include multiple rows or columns. FIG. 3 shows an example of the hierarchical structure of the table in the page in the spreadsheet. As shown in FIG. 3, the table may include, for example, 11 rows/columns, in which there may be 4 first-level rows/columns, namely, first-level rows/columns 1, first-level rows/columns, and first-level rows/columns. Row/column 4 and first-level row/column 6. In addition, the second-level row/column 3.1, the second-level row/column 3.2, and the second-level row/column 3.3 are second-level rows/columns, and they can form the first-level block 3. In addition, the third-level row/column 5.2.1 and the third-level row/column 5.2.2 are the third-level rows/columns, and they can form the second-level block 5.2. In addition, the second-level row/column 5.1, the second-level block 5.2, and the second-level row/column 5.3 may constitute the first-level block 5.
行(或包括多个行的行块)与某些列(或包括多个列的列块)的交叉位置处的单元格可以组成区间。例如,行、行块、列、列块都可以包括区间。Cells at intersections of rows (or row blocks including multiple rows) and certain columns (or column blocks including multiple columns) may form intervals. For example, rows, row blocks, columns, and column blocks can all include intervals.
根据本申请的一些实施例,电子表格的层级结构可以利用层级计算图来表示。层级计算图可以包含电子表格中的全部信息,从而可以与电子表格形成一一对应的关 系。According to some embodiments of the present application, the hierarchical structure of the electronic form can be represented by a hierarchical calculation graph. The hierarchical calculation diagram can contain all the information in the electronic form, which can form a one-to-one correspondence with the electronic form.
下面参考图4来描述用于表示电子表格的层级结构的层级计算图。图4是示意性地示出根据本申请的一些实施例的用于表示电子表格的层级结构的层级计算图301的示意图。The following describes a hierarchical calculation diagram for representing the hierarchical structure of the electronic form with reference to FIG. 4. FIG. 4 is a schematic diagram schematically showing a hierarchical calculation diagram 301 for representing the hierarchical structure of an electronic form according to some embodiments of the present application.
如图4中所示,层级计算图301中的每个节点302至311可以表示用于电子表格的层级结构中的各个层级。每个节点302至311可以具有相应的类型,该类型可以是用于电子表格的层级结构中的各个层级,诸如工作簿、页、节、表、块、行、列、区间、单元格等。在图4中,可以用不同的形状来表示节点的不同类型。例如,节点307至311的形状为菱形,这表示节点的类型为单元格。As shown in FIG. 4, each of the nodes 302 to 311 in the hierarchical calculation graph 301 may represent various levels in the hierarchical structure for the spreadsheet. Each node 302 to 311 may have a corresponding type, which may be various levels in the hierarchical structure of the spreadsheet, such as workbook, page, section, table, block, row, column, interval, cell, and so on. In Figure 4, different shapes can be used to represent different types of nodes. For example, the shape of the nodes 307 to 311 is a rhombus, which means that the type of the node is a cell.
另外,如图4中所示,层级计算图301中的各个节点之间的边例如可以分为两种类型。例如,层级计算图301中的一种类型的边可以是隶属关系边,其代表一个或多个节点之间的隶属关系。在图4中可以使用实线箭头来表示隶属关系边。例如,从节点302指向节点303的隶属关系边316可以代表节点303是节点302的子层级,即节点303隶属于节点302。另外,例如,层级计算图301中的另一种类型的边可以是计算关系边,其代表一个或多个节点之间的计算关系。在图中可以使用虚线箭头来表示计算关系边。例如,从节点303指向节点305的计算关系边314可以代表节点305是由节点303计算得到的。In addition, as shown in FIG. 4, the edges between the various nodes in the hierarchical calculation graph 301 can be divided into two types, for example. For example, one type of edge in the hierarchical calculation graph 301 may be a membership relationship edge, which represents the membership relationship between one or more nodes. In Figure 4, solid arrows can be used to indicate the edges of the membership relationship. For example, the membership edge 316 from the node 302 to the node 303 may represent that the node 303 is a child of the node 302, that is, the node 303 belongs to the node 302. In addition, for example, another type of edge in the hierarchical calculation graph 301 may be a calculation relationship edge, which represents a calculation relationship between one or more nodes. Dotted arrows can be used in the figure to indicate the calculation relationship edge. For example, the calculation relationship edge 314 from the node 303 to the node 305 may represent that the node 305 is calculated by the node 303.
下面参考图5来描述层级计算图中的节点。图5是示意性地示出根据本申请的一些实施例的层级计算图中的节点305的示意图。The nodes in the hierarchical calculation graph are described below with reference to FIG. 5. Fig. 5 is a schematic diagram schematically showing a node 305 in a hierarchical calculation diagram according to some embodiments of the present application.
如图5中所示,层级计算图中的节点305可以包括:该节点对应层级的类型402、该节点通过隶属关系边所连接的子节点403(例如,对于节点305,存储有指向节点309的指针)、该节点的运算符404、该节点所依赖的依赖节点405(例如,对于节点305,存储有指向节点303的指针)、该节点的语义信息406(例如,节点的名称、标签等)、与该节点有关的其他信息(可选)407(例如,节点的修饰器、属性标签等)。As shown in FIG. 5, the node 305 in the hierarchical calculation graph may include: the type 402 of the corresponding level of the node, and the child nodes 403 connected by the affiliation edge of the node (for example, for the node 305, a node 309 is stored). Pointer), the operator 404 of the node, the dependent node 405 on which the node depends (for example, for the node 305, a pointer to the node 303 is stored), the semantic information 406 of the node (for example, the name of the node, the label, etc.) , Other information related to the node (optional) 407 (for example, node modifiers, attribute tags, etc.).
本领域技术人员可以理解,层级计算图中的其他节点可以具有与节点305相类似的配置,此处不再赘述。Those skilled in the art can understand that other nodes in the hierarchical calculation graph may have a configuration similar to that of the node 305, which will not be repeated here.
根据本申请的一些实施例,上述获取用于电子表格的层级公式的步骤S101可以包括:提供图形用户界面编辑器,其中图形用户界面编辑器包括用于指定不同层级的节点和/或运算符的组件;接收针对用于指定不同层级的节点和/或运算符的组件的输入;以及基于该输入来生成层级公式。According to some embodiments of the present application, the step S101 of obtaining the level formula for the electronic form may include: providing a graphical user interface editor, wherein the graphical user interface editor includes a user interface for specifying nodes and/or operators of different levels. Components; receiving input for components used to specify nodes and/or operators of different levels; and generating a level formula based on the input.
例如,用户可以通过点击和/或拖拽图形用户界面编辑器中提供的可视化组件来指定不同层级的节点和/或运算符,从而可以更直观地构建层级公式。由于图形用户界面编辑器可以提供可视化组件,从而可以使得用户能够更直观地构建层级公式,提高了用户的便利性。For example, the user can specify different levels of nodes and/or operators by clicking and/or dragging the visual components provided in the graphical user interface editor, so that the level formula can be constructed more intuitively. Since the graphical user interface editor can provide visual components, it can enable users to construct hierarchical formulas more intuitively, which improves the convenience of users.
根据本申请的一些实施例,上述获取用于电子表格的层级公式的步骤S101也可以包括:接收用户输入的文本代码;以及解析文本代码以生成层级公式。According to some embodiments of the present application, the above step S101 of obtaining a hierarchical formula for an electronic form may also include: receiving a text code input by a user; and parsing the text code to generate a hierarchical formula.
例如,用户可以通过文本编辑器输入纯文本格式的层级公式,并且可以通过对纯文本格式的层级公式进行解析来生成层级公式,从而可以更高效地生成层级公式。For example, a user can input a level formula in a plain text format through a text editor, and can generate a level formula by parsing the level formula in a plain text format, so that the level formula can be generated more efficiently.
根据本申请的一些实施例,运算符可以包括原子运算符,原子运算符可以包括以下各项中的一种或多种:数学运算符、数学函数、常量、系统定义函数、用户自定义原子运算符。According to some embodiments of the present application, operators may include atomic operators, and atomic operators may include one or more of the following: mathematical operators, mathematical functions, constants, system-defined functions, user-defined atomic operations symbol.
例如,数学运算符可以是“+”、“-”、“*”、“/”等数学运算符。另外,例如,数学函数可以是求和函数“SUM()”、求平均值函数“AVERAGE()”等数学函数。另外,例如,常数可以是“10”、“1年”等常数。另外,例如,系统定义函数可以为数据源函数“SOURCE()”、滞后运算函数“.lag(1年)”等系统定义函数,其中,数据源函数“SOURCE()”表示接收用户输入的数据,滞后运算函数“.lag(1年)”表示将数据滞后1年的运算。用户自定义原子运算符是用户通过对其他类型的原子运算符进行组合而定义的。例如,用户可以通过输入“增长率({x1},{x2})={x2}/{x1}-1”来定制新的自定义原子运算符“增长率()”。For example, the mathematical operator can be "+", "-", "*", "/" and other mathematical operators. In addition, for example, the mathematical function may be a mathematical function such as a summing function "SUM()", an averaging function "AVERAGE()" and the like. In addition, for example, the constant may be a constant such as "10" or "1 year". In addition, for example, the system-defined function can be the data source function "SOURCE()", the lag operation function ".lag(1 year)" and other system-defined functions. Among them, the data source function "SOURCE()" means receiving the data input by the user. , The lag calculation function ".lag(1 year)" represents the calculation that lags the data by 1 year. User-defined atomic operators are defined by users by combining other types of atomic operators. For example, the user can customize a new custom atomic operator "growth rate ()" by entering "growth rate ({x1}, {x2})={x2}/{x1}-1".
根据本申请的一些实施例,层级引用可以对应于用于电子表格的层级结构中的一个或多个层级中的一个或多个节点。例如,根据本申请的一些实施例,层级引用可以采用字符串来指代。According to some embodiments of the present application, the hierarchical reference may correspond to one or more nodes in one or more hierarchies in the hierarchical structure used for the electronic form. For example, according to some embodiments of the present application, the hierarchical reference can be referred to by a character string.
作为举例,下面给出层级引用的一些示例:As an example, here are some examples of hierarchical references:
(a)“ROW!Revenue>>BOOK!DCF Model/SHEET!Financial Statement/TABLE!Income Statement/BLOCK!US”:(a) "ROW! Revenue>>BOOK! DCF Model/SHEET! Financial Statement/TABLE! Income Statement/BLOCK! US":
该层级引用(a)代表一个名称为“Revenue(收入)”的行(ROW),这个行在名为“DCF Model(DCF模型)”的工作簿(BOOK)下的名为“Financial Statement(财务报表)”的页(SHEET)下的名为“Income Statement(利润表)”的表(TABLE)下的名为“US”的块(BLOCK)内。This level reference (a) represents a row (ROW) named "Revenue". This row is named "Financial Statement" under the workbook (BOOK) named "DCF Model". In the block named "US" under the table (TABLE) named "Income Statement" under the "SHEET" page (SHEET).
(b)“Revenue>>DCF Model/Financial Statement/Income Statement/US”:(b) "Revenue>>DCF Model/Financial Statement/Income Statement/US":
该层级引用(b)代表与上述层级引用(a)相同的含义,只是可以在不会引起歧义的情况下允许用户省略了层级类型,诸如行(ROW)、工作簿(BOOK)、页(SHEET)、表(TABLE)、块(BLOCK)等。This level reference (b) represents the same meaning as the above level reference (a), but allows users to omit the level type without causing ambiguity, such as row (ROW), workbook (BOOK), page (SHEET) ), table (TABLE), block (BLOCK), etc.
(c)“Revenue>>./Income Statement/US”:(c) "Revenue>>./Income Statement/US":
该层级引用(c)代表与上述层级引用(b)相同的含义。注意,“>>”后面的字符串被称为路径(Path),路径表示在代表电子表格的层级结构自上而下中找到被指代层级的过程中所经过的层级。路径可以是绝对路径,例如上述层级引用(b)中的“DCF Model/Financial Statement/Income Statement/US”;路径也可以是相对路径,“./”表示当前层级,“../”表示当前层级所隶属的层级,例如当用户已经在名为“DCF Model(DCF模型)”的工作簿(BOOK)下的名为“Financial Statement(财务报表)”的页(SHEET)下时,可以将相对路径表示为“./Income Statement/US”。This level reference (c) represents the same meaning as the above level reference (b). Note that the character string after ">>" is called the path (Path), and the path represents the level passed through in the process of finding the referred level from the top to the bottom of the hierarchical structure representing the spreadsheet. The path can be an absolute path, such as "DCF Model/Financial Statement/Income Statement/US" in the above-mentioned hierarchical reference (b); the path can also be a relative path, "./" indicates the current level, and "../" indicates the current The level to which the level belongs. For example, when the user is already under the page (SHEET) named "Financial Statement" under the workbook (BOOK) named "DCF Model", the relative The path is expressed as "./Income Statement/US".
(d)“Revenue”:(d) "Revenue":
在不会引起歧义时,路径也可以省略。例如,如果当前表下只有一个名为“Revenue(收入)”的行,那么“Revenue(收入)”本身则可以指代该行。If it does not cause ambiguity, the path can also be omitted. For example, if there is only one row named "Revenue" under the current table, then "Revenue" itself can refer to this row.
(e)“[[Europe]]Revenue”:(e) "[[Europe]]Revenue":
可以加入标签(label)来进一步区分不同的行,例如“[[Europe]]Revenue”代表了一个名为“Revenue(收入)”的行,这个行具有标签“Europe(欧洲)”,以区分于其他同样名为“Revenue(收入)”的行,例如,以区分于具有标签“US(美国)”的行“[[US]]Revenue”。You can add a label to further distinguish different rows. For example, "[[Europe]]Revenue" represents a row named "Revenue", and this row has the label "Europe (Europe)" to distinguish it from Other rows that are also named "Revenue (Income)", for example, are distinguished from the row "[[US]]Revenue" with the label "US (美国)".
(f)“ROW!Revenue:ROW!Profit”:(f) "ROW! Revenue: ROW! Profit":
该层级引用(f)代表了从“Revenue(收入)”的行(ROW)到“Profit(利润)”的行(ROW)之间的所有行。This level reference (f) represents all the rows from the row of "Revenue" (ROW) to the row of "Profit" (ROW).
(g)“BLOCK!US>>BOOK!DCF Model/SHEET!Financial Statement/TABLE!Income Statement”:(g) "BLOCK! US>>BOOK! DCF Model/SHEET! Financial Statement/TABLE! Income Statement":
该层级引用(g)代表一个名为“US”的块(BLOCK),这个块(BLOCK)在名为“DCF Model(DCF模型)”的工作簿(BOOK)下的名为“Financial Statement(财务报表)”的页(SHEET)下的名为“Income Statement(利润表)”的表(TABLE)下。This level reference (g) represents a block named "US" (BLOCK). This block (BLOCK) is named "Financial Statement" under the workbook (BOOK) named "DCF Model". Under the table (TABLE) named "Income Statement" under "SHEET" page (SHEET).
(h)“COLUMN!2018>>BOOK!DCF Model/SHEET!Financial Statement/TABLE!Income Statement”:(h) "COLUMN! 2018>>BOOK! DCF Model/SHEET! Financial Statement/TABLE! Income Statement":
该层级引用(h)代表一个名为“2018”的列(COLUMN),这个列(COLUMN)在名为“DCF Model(DCF模型)”的工作簿(BOOK)下的名为“Financial Statement(财务报表)”的页(SHEET)下的名为“Income Statement(利润表)”的表(TABLE)下。This level reference (h) represents a column (COLUMN) named "2018". This column (COLUMN) is named "Financial Statement" under the workbook (BOOK) named "DCF Model". Under the table (TABLE) named "Income Statement" under "SHEET" page (SHEET).
(i)“COLUMN!2018:COLUMN!2020”:(i) "COLUMN! 2018: COLUMN! 2020":
该层级引用(i)代表了当前表中名为“2018”的列(COLUMN)至名为“2020”的列(COLUMN)之间的所有列。This level reference (i) represents all the columns from the column named "2018" (COLUMN) to the column named "2020" (COLUMN) in the current table.
(j)“Revenue[2018]”:(j) "Revenue[2018]":
该层级引用(j)代表了名为“Revenue(收入)”这一行中列名为“2018”的单元格。This level reference (j) represents the cell named "2018" in the row named "Revenue".
(k)“Revenue[2018:2020]”:(k) "Revenue[2018:2020]":
该层级引用代表了名为“Revenue(收入)”这一行中列名为“2018”至“2020”的区间。This level of reference represents the range named "2018" to "2020" in the row named "Revenue".
(l)“Revenue[hist]”:(l) "Revenue[hist]":
代表了名为“Revenue”这一行中所有具有“hist(历史期)”标签的列对应的单元格组成的区间。Represents the range of cells corresponding to all the columns with the label "hist" in the row named "Revenue".
(m)“COLUMN!2018[存量]”(m) "COLUMN! 2018[Inventory]"
该层级引用代表名为“2018”这一列中所有具有“存量”这一标签的行对应的单元格组成的区间。This hierarchical reference represents an interval composed of cells corresponding to all rows with the label "Inventory" in the column named "2018".
注意,层级引用的上述实现方式仅仅是示例性的,还可以采用其他方式来实现层级引用。例如,可以将用于电子表格的层级结构表示为图形用户界面中的可视化视图中的元素,从而可以直接通过图形用户界面中的可视化视图中的元素来实现层级引用。Note that the above implementation of the hierarchical reference is only exemplary, and other methods may also be used to implement the hierarchical reference. For example, the hierarchical structure used for the spreadsheet can be expressed as elements in the visual view in the graphical user interface, so that the hierarchical reference can be implemented directly through the elements in the visual view in the graphical user interface.
根据本申请的一些实施例,层级公式可以看成是由一系列原子运算符(或者由一系列原子运算符构成的复合运算符)作用于一个由层级引用构成的参数列表之上,并且将作用的结果赋值给层级公式的左值。作为示例,下面示出了层级公式的一些示例。注意,在本申请的一些实现方式中,可以利用“{}”内的内容来代表层级引用。According to some embodiments of the present application, a level formula can be regarded as a series of atomic operators (or a compound operator composed of a series of atomic operators) acting on a parameter list composed of hierarchical references, and will act The result of is assigned to the left value of the hierarchy formula. As an example, some examples of hierarchical formulas are shown below. Note that in some implementations of this application, the content within "{}" can be used to represent hierarchical references.
{利润}={收入}-{成本}{Profit}={income}-{cost}
{收入增长率}={收入}/{收入}.lag(1年)-1{Income growth rate}={income}/{income}.lag(1 year)-1
{平均收入增长率}={收入增长率}.average(){Average income growth rate}={Income growth rate}.average()
{收入}[预测期]={收入:../利润表}.lag(1)*(1+{平均收入增长率}){Income}[forecast period]={income: ../income statement}.lag(1)*(1+{average revenue growth rate})
{全年}[存量]={Q1}+{Q2}+{Q3}+{Q4}{Full year}[Inventory]={Q1}+{Q2}+{Q3}+{Q4}
{总收入}=SUM({美国收入:中国收入}){Total income}=SUM({US income: China income})
{BLOCK!利润}={BLOCK!收入}-{BLOCK!成本}{BLOCK! Profit}={BLOCK! Income}-{BLOCK! cost}
如上所述,用户输入的层级公式中包括运算符和层级引用。根据层级公式的输入方法不同,识别出层级公式中包括的运算符和层级引用的复杂度不同。如果用户通过点击和/或拖拽图形用户界面中的可视化组件的方式构建层级公式,由于每一个组件所对应的电子表格的层级引用或运算符是确定的,所以只需要识别图形用户界面组件对应的电子表格的层级引用或运算符即可。如果用户以文本代码的形式输入层级公式(即,输入的是字符串),则需要解析文本代码以识别出字符串中的运算符和层级引用。As mentioned above, the hierarchical formula entered by the user includes operators and hierarchical references. According to the different input methods of the level formula, it is recognized that the operators included in the level formula and the complexity of the level reference are different. If the user constructs the hierarchical formula by clicking and/or dragging the visual components in the graphical user interface, since the hierarchical reference or operator of the spreadsheet corresponding to each component is determined, only the corresponding graphical user interface component needs to be identified The hierarchical reference or operator of the spreadsheet is sufficient. If the user inputs a level formula in the form of a text code (that is, the input is a string), the text code needs to be parsed to identify operators and level references in the string.
下面参考图6来描述用于解析文本代码以生成层级公式的过程。图6是示意性地示出根据本申请的一些实施例的用于解析文本代码以生成层级公式的过程600的流程图。The process for parsing text codes to generate hierarchical formulas is described below with reference to FIG. 6. FIG. 6 is a flowchart schematically showing a process 600 for parsing text codes to generate a hierarchical formula according to some embodiments of the present application.
如图6中所示,在步骤S601中,可以对文本代码进行分词以得到分词流。As shown in FIG. 6, in step S601, the text code may be segmented to obtain a word segmentation stream.
例如,对于以下层级公式:For example, for the following level formula:
{收入}[预测期]={收入:../利润表}.lag(1)*(1+{平均收入增长率}){Income}[forecast period]={income: ../income statement}.lag(1)*(1+{average revenue growth rate})
分词的结果是包括如下分词列表的分词流:The result of word segmentation is a word segmentation stream including the following word segmentation list:
“{”,“收入”,“}”,“[”,“预测期”,“]”,“=”,“{”,“收入”,“:”,“..”,“/”,“利润表”,“}”,“.lag”,“(”,“1”,“)”,“*”,“(”,“1”,“+”,“{”,“平均收入增长率”,“}”,“)”"{", "Income", "}", "[", "Forecast period", "]", "=", "{", "Income", ":", "..", "/", "Income Statement", "}", ".lag", "(", "1", ")", "*", "(", "1", "+", "{", "Average revenue growth rate","}",")"
注意,上述分词方式仅仅是示例性的,还可以有其他的分词方式。Note that the above word segmentation methods are only exemplary, and other word segmentation methods are also possible.
返回参考图6,在步骤S601之后,用于解析文本代码以生成层级公式的过程600可以进行到步骤S603和步骤S605。Referring back to FIG. 6, after step S601, the process 600 for parsing the text code to generate a hierarchical formula may proceed to step S603 and step S605.
在步骤S603中,可以识别分词流中与运算符相关的分词,以确定运算符。In step S603, the word segmentation related to the operator in the word segmentation stream can be identified to determine the operator.
例如,在上述示例中,上述分词流中与运算符相关的分词包括:“=”、“.lag”、“(”、“1”、“)”、“*”、“(”、“1”、“+”、“)”。For example, in the above example, the word segmentation related to the operator in the word segmentation stream includes: "=", ".lag", "(", "1", ")", "*", "(", "1 ", "+", ")".
根据所识别的与运算符相关的分词,可以确定运算符。根据本申请的一些实施例,根据所识别的与运算符相关的分词,可以确定原子运算符。Based on the identified word segmentation related to the operator, the operator can be determined. According to some embodiments of the present application, based on the identified word segmentation related to the operator, the atomic operator can be determined.
例如,在上述示例中,根据与运算符相关的分词“=”、“.lag”、“(”、“1”、 “)”、“*”、“(”、“1”、“+”、“)”,可以确定原子运算符包括:“.lag(1)”、“*”、“+”。For example, in the above example, according to the participles "=", ".lag", "(", "1", ")", "*", "(", "1", "+" related to the operator , ")", you can determine the atomic operators include: ".lag(1)", "*", "+".
在步骤S605中,可以识别分词流中与电子表格的层级结构中的一个或多个层级中的一个或多个节点相关的分词,以确定层级引用。In step S605, the word segmentation related to one or more nodes in one or more levels in the hierarchical structure of the electronic table in the word segmentation stream may be identified to determine the level reference.
例如,在上述示例中,上述分词流中与电子表格的层级结构中的一个或多个层级中的一个或多个节点相关的分词包括:“{”、“收入”、“}”、“[”、“预测期”、“]”、“{”、“收入”、“:”、“..”、“/”、“利润表”、“}”、“{”、“平均收入增长率”、“}”。For example, in the above example, the word segmentation related to one or more nodes in one or more levels in the hierarchical structure of the spreadsheet in the above word segmentation stream includes: "{", "income", "}", "[ ", "forecast period", "]", "{", "income", ":", "..", "/", "income statement", "}", "{", "average revenue growth rate ", "}".
根据所识别的与电子表格的层级结构中的一个或多个层级中的一个或多个节点相关的分词,可以确定层级引用。每一个层级引用可以由连续的一个或多个分词指代。Based on the identified word segmentation related to one or more nodes in one or more levels in the hierarchical structure of the electronic form, a hierarchical reference can be determined. Each level of reference can be referred to by one or more consecutive participles.
例如,在上述示例中,“{”、“收入”、“}”、“[”、“预测期”、“]”指代了名为“收入”的行中列标签包括“预测期”的单元格组成的区间。又例如,“{”、“收入”、“:”、“..”、“/”、“利润表”、“}”指代了名为“利润表”的表下面的名为“收入”的行。再例如,“{”、“平均收入增长率”、“}”指代了一个名为“平均收入增长率”的单元格。For example, in the above example, "{", "income", "}", "[", "forecast period", "]" refer to those whose column label in the row named "income" includes "forecast period" The range of cells. For another example, "{", "income", ":", "..", "/", "income statement", "}" refer to the table named "income statement" under the name "income" Line. For another example, "{", "average income growth rate", "}" refer to a cell named "average income growth rate".
注意,根据本申请的一些实现方式,从分词流到层级引用的匹配过程可以支持模糊匹配。例如,如果上述“收入”写成了“Sales(销售额)”,也可以匹配到相同的层级引用。另外,在另一些实现方式中,可以支持遵循特定语法的层级引用,但是支持的指代层级引用的语法可以是任意的。Note that according to some implementations of the present application, the matching process from word segmentation to hierarchical citation can support fuzzy matching. For example, if the above "revenue" is written as "Sales", it can also be matched to the same level of reference. In addition, in other implementations, hierarchical references that follow a specific syntax may be supported, but the supported syntax for referring to hierarchical references may be arbitrary.
返回参考图6,在步骤S603和步骤S605之后,用于解析文本代码以生成层级公式的过程600可以进行到步骤S607。在步骤S607中,可以根据所确定的运算符和层级引用来生成层级公式。Referring back to FIG. 6, after step S603 and step S605, the process 600 for parsing the text code to generate a hierarchical formula may proceed to step S607. In step S607, a hierarchical formula may be generated according to the determined operator and hierarchical reference.
在确定了运算符和层级引用的情况下,可以根据所确定的运算符和层级引用来生成层级公式。根据本申请的一些实施例,可以根据所确定的原子运算符和层级引用来生成层级公式。When the operator and the hierarchical reference are determined, the hierarchical formula can be generated according to the determined operator and the hierarchical reference. According to some embodiments of the present application, a hierarchical formula can be generated according to the determined atomic operator and hierarchical reference.
例如,在上述示例中,根据所确定的原子运算符“.lag(1)”、“*”、“+”和所确定的层级引用“{收入}[预测期]”、“{收入:../利润表}”、“{平均收入增长率}”,就可以识别并生成层级公式:{收入}[预测期]={收入:../利润表}.lag(1)*(1+{平均收入增长率})。For example, in the above example, according to the determined atomic operators ".lag(1)", "*", "+" and the determined level reference "{income}[forecast period]", "{income:. ./Income Statement}", "{Average Revenue Growth Rate}", you can identify and generate a level formula: {Income}[Forecast Period]={Income: ../Income Statement}.lag(1)*(1+ {Average income growth rate}).
根据本申请的一些实施例,可以根据层级公式中的原子运算符来构建复合运算 符,其中,复合运算符可以包括层级公式中的所有原子运算符的组合。According to some embodiments of the present application, a compound operator may be constructed based on the atomic operators in the hierarchical formula, where the compound operator may include a combination of all the atomic operators in the hierarchical formula.
例如,在识别出原子运算符的情况下,可以根据识别出的原子运算符及其在分词流中的位置(例如相对位置)构建可以包括层级公式中的所有原子运算符的组合的复合运算符。For example, in the case of identifying an atomic operator, a compound operator that can include a combination of all atomic operators in the hierarchy formula can be constructed based on the identified atomic operator and its position in the word segmentation stream (such as relative position) .
例如,在上述示例中,根据识别出的原子运算符“.lag(1)”、“*”、“+”构建出的复合运算符的一种表现形式是如下字符串:For example, in the above example, one expression of the compound operator constructed from the identified atomic operators ".lag(1)", "*", "+" is the following string:
{y}={x1}.lag(1)*(1+{x2}){y}={x1}.lag(1)*(1+{x2})
其中{y}、{x1}、{x2}是占位符,代表这里需要填入参数。Where {y}, {x1}, {x2} are placeholders, which means that parameters need to be filled in here.
在根据原子运算符构建出复合运算符的情况下,上述步骤S607可以包括根据所确定的复合运算符和层级引用来生成层级公式。In the case of constructing a compound operator based on an atomic operator, the above step S607 may include generating a hierarchical formula according to the determined compound operator and a hierarchical reference.
例如,在上述示例中,根据构建出的复合运算符“{y}={x1}.lag(1)*(1+{x2})”和所确定的层级引用“{收入}[预测期]”、“{收入:../利润表}”、“{平均收入增长率}”,就可以识别并生成层级公式:{收入}[预测期]={收入:../利润表}.lag(1)*(1+{平均收入增长率})。For example, in the above example, according to the constructed compound operator "{y}={x1}.lag(1)*(1+{x2})" and the determined level reference "{income}[forecast period] ", "{income:../income statement}", "{average revenue growth rate}", you can identify and generate a level formula: {income}[forecast period]={income:../income statement}.lag (1)*(1+{average income growth rate}).
根据本申请的一些实施例,复合运算符可以采用以下各项中的一个或多个来存储:字符串;由函数指针指向的计算机实现的函数;和有向图。According to some embodiments of the present application, a compound operator can be stored using one or more of the following items: a character string; a computer-implemented function pointed to by a function pointer; and a directed graph.
例如,在上述的示例中,复合运算符可以以字符串“{y}={x1}.lag(1)*(1+{x2})”的形式来存储。For example, in the above example, the compound operator can be stored in the form of a character string "{y}={x1}.lag(1)*(1+{x2})".
例如,在上述的示例中,复合运算符也可以以由函数指针指向的计算机实现的函数的形式来存储,其中这个函数接收{x1}和{x2}这两个参数。For example, in the above example, the compound operator can also be stored in the form of a computer-implemented function pointed to by a function pointer, where this function receives two parameters {x1} and {x2}.
例如,在上述的示例中,复合运算符也可以以有向图的形式来存储。For example, in the above example, the compound operator can also be stored in the form of a directed graph.
根据本申请的一些实施例,有向图中的各个节点可以代表层级公式中的运算符,以及有向图中的各个节点之间的有向边可以代表层级公式中的运算符之间的组合关系。According to some embodiments of the present application, each node in a directed graph may represent an operator in a hierarchical formula, and the directed edges between each node in a directed graph may represent a combination of operators in a hierarchical formula relationship.
例如,有向图中的每个节点可以代表原子运算符、参数的占位符或常量运算符,有向图中的各个节点之间的有向边可以代表各个节点之间的诸如运算关系之类的组合关系。For example, each node in a directed graph can represent an atomic operator, a placeholder for a parameter, or a constant operator, and the directed edge between each node in a directed graph can represent a relationship between each node, such as an operation relationship. The combination of classes.
下面参考图7来描述用于层级的复合运算符的有向图。图7是示意性地示出根据本申请的一些实施例的用于层级的复合运算符的有向图的示意图。The directed graph for the compound operator of the hierarchy is described below with reference to FIG. 7. FIG. 7 is a schematic diagram schematically showing a directed graph of a compound operator for a hierarchy according to some embodiments of the present application.
图7示出了用于存储上述示例中的用于层级的复合运算符“{y}={x1}.lag(1)* (1+{x2})”的有向图。如图7中所示,有向图中的节点802至804代表原子运算符,有向图中的节点805和807代表参数的占位符,有向图中的节点806代表常量运算符。FIG. 7 shows a directed graph for storing the compound operator "{y}={x1}.lag(1)* (1+{x2})" for the hierarchy in the above example. As shown in FIG. 7, nodes 802 to 804 in the directed graph represent atomic operators, nodes 805 and 807 in the directed graph represent placeholders for parameters, and node 806 in the directed graph represents constant operators.
另外,如图7中所示,最上级的原子运算符是有向图中的节点802中的原子运算符“*”,它以节点803中的原子运算符“.lag(1)”和节点804中的原子运算符“+”这两个原子运算符的计算结果作为输入变量,节点803中的原子运算符“.lag(1)”又以节点805中的参数“x1”作为输入变量,节点804中的“+”以节点806中的常量运算符“1”和节点807中的参数“x2”作为输入变量。In addition, as shown in Figure 7, the uppermost atomic operator is the atomic operator "*" in node 802 in the directed graph, which is based on the atomic operator ".lag(1)" in node 803 and node The calculation results of the two atomic operators "+" in 804 are used as input variables, and the atomic operator ".lag(1)" in node 803 takes the parameter "x1" in node 805 as input variables. The "+" in the node 804 takes the constant operator "1" in the node 806 and the parameter "x2" in the node 807 as input variables.
返回参考图1,在步骤S101之后,用于生成电子表格公式的计算机实现的方法100进行到步骤S103。在步骤S103中,可以基于层级引用与一个或多个节点之间的对应关系来确定一个或多个节点之间的依赖关系。Referring back to FIG. 1, after step S101, the computer-implemented method 100 for generating spreadsheet formulas proceeds to step S103. In step S103, the dependency relationship between one or more nodes may be determined based on the correspondence relationship between the hierarchical reference and the one or more nodes.
根据本申请的一些实施例,层级引用可以包括位于层级公式中的等号左侧的第一层级引用和位于层级公式中的等号右侧的第二层级引用,其中,第一层级引用(也称为左值)对应于一个或多个节点中的第一节点,而第二层级引用对应于一个或多个节点中的第二节点(第二层级引用可以为空集)。According to some embodiments of the present application, the level reference may include the first level reference located on the left side of the equal sign in the level formula and the second level reference located on the right side of the equal sign in the level formula, where the first level reference (also Called lvalue) corresponds to the first node in one or more nodes, and the second-level reference corresponds to the second node in the one or more nodes (the second-level reference may be an empty set).
如上所述,层级公式可以看成是由一系列原子运算符(或者由一系列原子运算符构成的复合运算符)作用于一个由层级引用构成的参数列表之上,并且将作用的结果赋值给层级公式的左值。As mentioned above, a hierarchical formula can be seen as a series of atomic operators (or a compound operator composed of a series of atomic operators) acting on a parameter list composed of hierarchical references, and assigning the result of the effect to The left value of the level formula.
在以层级计算图来表示层级公式的情况下,层级公式中的每个层级引用可以唯一地对应于电子表格的层级结构中的某个层级以及层级计算图中的某个节点。位于层级公式中的等号左侧的层级引用可以被称为第一层级引用,第一层级引用所对应的层级计算图中的节点可以被称为这个层级公式的第一节点(或左值节点(leftNode))。位于层级公式中的等号右侧的层级引用可以被称为第二层级引用,第二层级引用所对应的层级计算图中的节点可以被称为这个层级公式的第二节点(或依赖节点(inNodes))。In the case of expressing the hierarchical formula with a hierarchical calculation graph, each hierarchical reference in the hierarchical formula can uniquely correspond to a certain level in the hierarchical structure of the spreadsheet and a certain node in the hierarchical calculation graph. The level reference on the left side of the equal sign in the level formula can be called the first level reference, and the node in the level calculation graph corresponding to the first level reference can be called the first node (or lvalue node) of this level formula (leftNode)). The level reference on the right side of the equal sign in the level formula can be called the second level reference, and the node in the level calculation graph corresponding to the second level reference can be called the second node (or dependent node ( inNodes)).
每个层级公式可以唯一地对应于一个复合运算符、一个第一节点(或左值节点)和一组第二节点(或依赖节点)。另一方面,每个复合运算符以及与之匹配的一个第一节点(或左值节点)和一组第二节点(或依赖节点)也可以唯一地指定一个层级公式。层级公式的意义可以是将第二节点(或依赖节点)传递给复合运算符中的参数占位符,并且将得到的结果赋值给第一节点(或左值节点)。Each level formula can uniquely correspond to a compound operator, a first node (or lvalue node), and a group of second nodes (or dependent nodes). On the other hand, each compound operator and a matching first node (or lvalue node) and a set of second nodes (or dependent nodes) can also uniquely specify a level formula. The meaning of the hierarchical formula can be to pass the second node (or dependent node) to the parameter placeholder in the compound operator, and assign the result obtained to the first node (or lvalue node).
例如,对于层级公式“{收入}[预测期]={收入:../利润表}.lag(1)*(1+{平均 收入增长率})”,位于层级公式中的等号左侧的层级引用“{收入}[预测期]”可以被称为第一层级引用,而位于等级公式中的等号右侧的层级引用“{收入:../利润表}”和“{平均收入增长率}”可以被称为第二层级引用。For example, for the level formula "{income}[forecast period]={income:../profit statement}.lag(1)*(1+{average revenue growth rate})", it is located on the left side of the equal sign in the level formula The level reference "{income}[forecast period]" can be called the first level reference, and the level on the right side of the equal sign in the level formula references "{income:../income statement}" and "{average income Growth rate}" can be referred to as a second-level citation.
例如,第一层级引用“{收入}[预测期]”所对应的第一节点(或左值节点)可以是由电子表格中的名为“收入”的行中列标签包括“预测期”的单元格组成的区间所对应的层级计算图中的节点。例如,第二层级引用“{收入:../利润表}”所对应的第二节点(或依赖节点)可以是电子表格中的名为“利润表”的表中的名为“收入”的行所对应的层级计算图中的节点,而第二层级引用“{平均收入增长率}”所对应的第二节点(或依赖节点)可以是电子表格中的名为“平均收入增长率”的单元格所对应的层级计算图中的节点。For example, the first node (or lvalue node) corresponding to the first-level reference "{income}[forecast period]" can be defined by the column label in the row named "income" in the spreadsheet including "forecast period" The nodes in the hierarchical calculation graph corresponding to the interval composed of cells. For example, the second node (or dependent node) corresponding to the second-level reference "{income:../income statement}" can be the one named "income" in the table named "income statement" in the spreadsheet The nodes in the hierarchy calculation graph corresponding to the rows, and the second node (or dependent node) corresponding to the second-level reference "{average revenue growth rate}" can be the name "average revenue growth rate" in the spreadsheet The node in the hierarchical calculation graph corresponding to the cell.
根据本申请的一些实施例,上述基于层级引用与一个或多个节点之间的对应关系来确定一个或多个节点之间的依赖关系的步骤S103可以包括:至少基于第一层级引用与第一节点之间的对应关系以及第二层级引用与第二节点之间的对应关系来确定第一节点与第二节点之间的依赖关系。According to some embodiments of the present application, the step S103 of determining the dependency relationship between one or more nodes based on the correspondence between the level reference and the one or more nodes may include: at least based on the first level reference and the first The correspondence between the nodes and the correspondence between the second-level reference and the second node are used to determine the dependency between the first node and the second node.
例如,在上述示例中,可以至少基于第一层级引用“{收入}[预测期]”与由电子表格中的名为“收入”的行中列标签包括“预测期”的单元格组成的区间所对应的层级计算图中的节点之间的对应关系、第二层级引用“{收入:../利润表}”与电子表格中的名为“利润表”的表中的名为“收入”的行所对应的层级计算图中的节点之间的对应关系、和第二层级引用“{平均收入增长率}”与电子表格中的名为“平均收入增长率”的单元格所对应的层级计算图中的节点之间的对应关系,确定由电子表格中的名为“收入”的行中列标签包括“预测期”的单元格组成的区间所对应的层级计算图中的节点与电子表格中的名为“利润表”的表中的名为“收入”的行所对应的层级计算图中的节点、以及电子表格中的名为“平均收入增长率”的单元格所对应的层级计算图中的节点之间的依赖关系。For example, in the above example, it can be based at least on the first-level reference "{income}[forecast period]" and the interval composed of the cells whose column label in the row named "income" in the spreadsheet includes "forecast period" The corresponding relationship between the nodes in the corresponding hierarchical calculation graph, the second-level reference "{income:../ income statement}" and the spreadsheet named "income statement" in the table named "income" The corresponding relationship between the nodes in the hierarchical calculation graph corresponding to the rows of, and the second-level reference "{average income growth rate}" and the level corresponding to the cell named "average income growth rate" in the spreadsheet Calculate the correspondence between the nodes in the graph, and determine the level corresponding to the interval composed of cells whose column label in the row named "Income" in the spreadsheet includes the "prediction period". The nodes in the calculation graph and the spreadsheet are determined The node in the hierarchical calculation graph corresponding to the row named "income" in the table named "Income Statement", and the hierarchical calculation corresponding to the cell named "Average Income Growth Rate" in the spreadsheet The dependencies between the nodes in the graph.
返回参考图1,在步骤S103之后,用于生成电子表格公式的计算机实现的方法100进行到步骤S105。在步骤S105中,可以基于运算符和依赖关系来确定一个或多个节点之间的计算关系。Referring back to FIG. 1, after step S103, the computer-implemented method 100 for generating spreadsheet formulas proceeds to step S105. In step S105, the calculation relationship between one or more nodes may be determined based on the operator and the dependency relationship.
例如,在上述示例中,可以基于原子运算符“.lag(1)”、“*”、“+”以及层级引用“{收入}[预测期]”所对应的节点与层级引用“{收入:../利润表}”和“{平均收入增长率}”所对应的节点之间的依赖关系来确定上述各个节点之间的计算关系。For example, in the above example, it can be based on the nodes corresponding to the atomic operators ".lag(1)", "*", "+" and the level reference "{income}[forecast period]" and the level reference "{income: ../Income Statement}" and "{Average Income Growth Rate}" correspond to the dependency relationship between the nodes to determine the calculation relationship between the above nodes.
根据本申请的一些实施例,上述基于运算符和依赖关系来确定一个或多个节点之间的计算关系的步骤S105还可以包括:至少基于复合运算符和依赖关系来确定一个或多个节点之间的计算关系。According to some embodiments of the present application, the step S105 of determining the calculation relationship between one or more nodes based on the operator and the dependency relationship may further include: determining one or more nodes based on at least the compound operator and the dependency relationship. The calculation relationship between.
例如,在上述示例中,可以基于由原子运算符“.lag(1)”、“*”、“+”构成的复合运算符“{y}={x1}.lag(1)*(1+{x2})”以及层级引用“{收入}[预测期]”所对应的节点与层级引用“{收入:../利润表}”和“{平均收入增长率}”所对应的节点之间的依赖关系来确定上述各个节点之间的计算关系。For example, in the above example, it can be based on the compound operator "{y}={x1}.lag(1)*(1+" composed of the atomic operators ".lag(1)", "*", and "+" {x2})" and the node corresponding to the level reference "{income}[forecast period]" and the node corresponding to the level reference "{income: ../income statement}" and "{average revenue growth rate}" Dependency relationship to determine the calculation relationship between the above-mentioned various nodes.
根据本申请的一些实施例,可以针对一个或多个节点中的每个节点,经由层级计算图存储该节点与其他节点之间的计算关系。According to some embodiments of the present application, for each node of one or more nodes, the calculation relationship between the node and other nodes may be stored via a hierarchical calculation graph.
例如,参考图4,在确定了一个或多个节点中的每个节点与其他节点之间的计算关系的情况下,可以在图4中所示的层级计算图中存储该节点与其他节点之间的计算关系。例如,对于图4中所示的节点305,在确定节点305是由节点303计算得到的情况下,可以利用从节点303指向节点305的计算关系边314来存储该节点305与节点303之间的依赖关系,并在节点305中存储该计算关系的复合运算符(404),以及节点305的依赖节点与复合运算符中的占位符之间的对应关系。For example, referring to Figure 4, in the case where the calculation relationship between each node of one or more nodes and other nodes is determined, the relationship between the node and other nodes can be stored in the hierarchical calculation graph shown in Figure 4 The calculation relationship between. For example, for the node 305 shown in FIG. 4, when it is determined that the node 305 is calculated by the node 303, the calculation relationship edge 314 from the node 303 to the node 305 can be used to store the relationship between the node 305 and the node 303. The dependency relationship, and the compound operator (404) of the calculation relationship is stored in the node 305, and the corresponding relationship between the dependent node of the node 305 and the placeholder in the compound operator.
根据本申请的一些实施例,上述基于运算符和依赖关系来确定一个或多个节点之间的计算关系的步骤S105可以包括:基于运算符以及第一节点与第二节点之间的依赖关系来确定第一节点与第二节点之间的计算关系。According to some embodiments of the present application, the step S105 of determining the calculation relationship between one or more nodes based on the operator and the dependency relationship may include: determining the calculation relationship between the one or more nodes based on the operator and the dependency relationship between the first node and the second node. Determine the calculation relationship between the first node and the second node.
例如,在上述示例中,可以基于原子运算符“.lag(1)”、“*”、“+”或由上述原子运算符组成的复合运算符“{y}={x1}.lag(1)*(1+{x2})”以及第一层级引用“{收入}[预测期]”所对应的第一节点与第二层级引用“{收入:../利润表}”和“{平均收入增长率}”所分别对应的相应第二节点之间的依赖关系来确定第一节点与第二节点之间的计算关系。For example, in the above example, it can be based on the atomic operators ".lag(1)", "*", "+" or the compound operator "{y}={x1}.lag(1 )*(1+{x2})" and the first node corresponding to the first level reference "{income}[forecast period]" and the second level reference "{income: ../income statement}" and "{average Income growth rate}" corresponds to the dependency relationship between the corresponding second nodes to determine the calculation relationship between the first node and the second node.
根据本申请的一些实施例,可以针对第一节点,经由层级计算图存储第一节点与第二节点之间的计算关系。According to some embodiments of the present application, for the first node, the calculation relationship between the first node and the second node may be stored via a hierarchical calculation graph.
例如,参考图4,在确定了第一节点与第二节点之间的计算关系的情况下,可以在图4中所示的层级计算图中存储第一节点与第二节点之间的计算关系。例如,对于图4中所示的第一节点305,在确定第一节点305是由第二节点303计算得到的情况下,可以利用从第二节点303指向第一节点305的计算关系边314来存储第一节点305与第二节点303之间的依赖关系,并在节点305中存储该计算关系的复合运算符 (404),以及节点305的依赖节点与复合运算符中的占位符之间的对应关系。For example, referring to FIG. 4, in the case where the calculation relationship between the first node and the second node is determined, the calculation relationship between the first node and the second node may be stored in the hierarchical calculation graph shown in FIG. 4 . For example, for the first node 305 shown in FIG. 4, when it is determined that the first node 305 is calculated by the second node 303, the calculation relationship edge 314 from the second node 303 to the first node 305 can be used to Store the dependency relationship between the first node 305 and the second node 303, and store the compound operator (404) of the calculation relationship in the node 305, and between the dependent node of the node 305 and the placeholder in the compound operator The corresponding relationship.
返回参考图1,在步骤S105之后,用于生成电子表格公式的计算机实现的方法100进行到步骤S107。在步骤S107中,可以至少基于用于电子表格的层级结构和计算关系来生成电子表格公式。Referring back to FIG. 1, after step S105, the computer-implemented method 100 for generating spreadsheet formulas proceeds to step S107. In step S107, an electronic form formula may be generated based at least on the hierarchical structure and calculation relationship used for the electronic form.
每个层级公式会对应一个或者多个电子表格公式。例如,对于层级公式“{收入}[预测期]={收入:../利润表}.lag(1)*(1+{平均收入增长率})”,参考下面的“表:总计表”,假设层级公式中的第一节点(或左值节点)的“收入”这一行在电子表格中的总计表中的第10行,以及总计表中的“2019”年、“2020”年、“2021”年所在的列分别为“F”、“G”、“H”。如果“2019”年、“2020”年、“2021”年这三列都带有标签“预测期”,那么在目标电子表格中的总计表中的“收入”这一行(即第10行)与“2019”年(即第F列)、“2020”年(即第G列)、“2021”年(即第H列)交叉处的单元格(即单元格F10、G10和H10)中都需要生成电子表格公式。Each level formula corresponds to one or more spreadsheet formulas. For example, for the level formula "{income}[forecast period]={income:../profit statement}.lag(1)*(1+{average revenue growth rate})", refer to the following "table: total table" , Assuming that the “income” row of the first node (or left value node) in the hierarchy formula is in row 10 of the total table in the spreadsheet, and “2019”, “2020” and “ The columns for 2021" are "F", "G", and "H" respectively. If the three columns of "2019", "2020", and "2021" all have the label "forecast period", then the "income" row (that is, row 10) in the total table in the target spreadsheet and Required in the cells at the intersection of "2019" (ie column F), "2020" (ie column G), and "2021" (ie column H) (ie cells F10, G10, and H10) Generate spreadsheet formulas.
表:总计表Table: Total table
Figure PCTCN2020104838-appb-000001
Figure PCTCN2020104838-appb-000001
另外,例如,参考下面的“表:利润表”,假设层级公式中的第二节点(依赖节点)的“收入:../利润表”这一行在电子表格中的利润表中的第30行。In addition, for example, referring to the following "table: income statement", suppose that the second node (dependent node) in the hierarchy formula, the line "income:../income statement" is on the 30th line of the income statement in the spreadsheet .
表:利润表Table: Income Statement
Figure PCTCN2020104838-appb-000002
Figure PCTCN2020104838-appb-000002
此外,例如,参考下面的“表:总计表”,假设层级公式中的另一个第二节点(依赖节点)的“平均收入增长率”的值“10%”所对应的单元格在电子表格中的总计表中的第12行第C列。In addition, for example, referring to the following "table: total table", suppose the cell corresponding to the value "10%" of the "average income growth rate" of another second node (dependent node) in the hierarchy formula is in the spreadsheet Row 12 and column C in the total table.
表:总计表Table: Total table
Figure PCTCN2020104838-appb-000003
Figure PCTCN2020104838-appb-000003
因此,可以根据电子表格的层级结构(诸如如上所述的总计表、利润表等)、以及原子运算符“.lag(1)”、“*”、“+”或由上述原子运算符组成的复合运算符“{y}={x1}.lag(1)*(1+{x2})”,对于电子表格中的总计表中的单元格F10、G10和H10,分别生成以下三个电子表格公式:Therefore, it can be based on the hierarchical structure of the spreadsheet (such as the above-mentioned total table, income statement, etc.), as well as the atomic operators ".lag(1)", "*", "+" or composed of the above atomic operators The compound operator "{y}={x1}.lag(1)*(1+{x2})" will generate the following three spreadsheets for cells F10, G10, and H10 in the total table in the spreadsheet formula:
对于总计表中的单元格F10,生成电子表格公式“=E$30*(1+$C$12)”;对于总计表中的单元格G10,生成电子表格公式“=F$30*(1+$C$12)”;对于总计表中的单元格H10,生成电子表格公式“=G$30*(1+$C$12)”。For cell F10 in the total table, generate the spreadsheet formula "=E$30*(1+$C$12)"; for cell G10 in the total table, generate the spreadsheet formula "=F$30*(1+$C $12)"; For cell H10 in the total table, generate the spreadsheet formula "=G$30*(1+$C$12)".
根据本申请的一些实施例,上述至少基于用于电子表格的层级结构和计算关系来生成电子表格公式的步骤S107可以包括:对于一个或多个节点中的每个当前节点,基于一个或多个节点中的该当前节点与其他节点之间的计算关系来确定该当前节点所对应的一个或多个第一单元格中的每个第一单元格与其他节点所对应的一个或多个第二单元格中的每个第二单元格之间的计算关系;以及至少基于一个或多个第一单元格中的每个第一单元格与一个或多个第二单元格中的每个第二单元格之间的计算关系,生成用于所述一个或多个第一单元格中的每个第一单元格的电子表格公式。According to some embodiments of the present application, the above step S107 of generating an electronic form formula based on at least the hierarchical structure and calculation relationship used for the electronic form may include: for each current node of the one or more nodes, based on one or more The calculation relationship between the current node and other nodes in the node determines the one or more second cells corresponding to each of the one or more first cells corresponding to the current node and one or more second cells corresponding to other nodes. The calculated relationship between each second cell in the cell; and at least based on each first cell in one or more first cells and each second cell in one or more second cells The calculation relationship between the cells generates a spreadsheet formula for each first cell of the one or more first cells.
根据本申请的一些实施例,可以按照各种图遍历算法来遍历与电子表格相对应的层级计算图中的每个节点。注意,在对层级计算图进行遍历时可以采用本领域已知的各种图遍历算法,本申请对此不做限制,并且不再赘述。According to some embodiments of the present application, each node in the hierarchical calculation graph corresponding to the spreadsheet can be traversed according to various graph traversal algorithms. Note that various graph traversal algorithms known in the art can be used when traversing the hierarchical calculation graph, which is not limited in this application, and will not be described in detail.
当遍历到层级计算图中的一个或多个节点中的每个当前节点时,可以将该当前节点与其他节点之间的计算关系转换成该当前节点所对应的各个第一单元格与其他节点所对应的各个第二单元格之间的计算关系。When traversing to each current node in one or more nodes in the hierarchical calculation graph, the calculation relationship between the current node and other nodes can be converted into each first cell and other nodes corresponding to the current node The calculation relationship between the corresponding second cells.
例如,在上述示例中,当遍历到层级计算图中的当前节点“{收入}[预测期]”时,可以将该当前节点“{收入}[预测期]”与其他节点“{收入:../利润表}”和“{平均收入增长率}”之间的计算关系转换为该当前节点“{收入}[预测期]”所对应的总计表中的第一单元格F10、G10和H10与其他节点“{收入:../利润表}”所对应的利润表中的第二单元格E30、F30、G30以及其他节点“{平均收入增长率}”的值所对应的 总计表中的第二单元格C12之间的计算关系。For example, in the above example, when traversing to the current node "{income}[prediction period]" in the hierarchical calculation graph, the current node "{income}[prediction period]" can be compared with other nodes "{income:. The calculation relationship between "./income statement}" and "{average revenue growth rate}" is converted to the first cell F10, G10, and H10 in the total table corresponding to the current node "{income}[forecast period]" The second cell E30, F30, G30 in the income statement corresponding to other nodes "{income:../profit statement}" and the value in the total table corresponding to the values of other nodes "{average revenue growth rate}" The calculation relationship between the second cell C12.
在已经得到了各个第一单元格与各个第二单元格之间的计算关系的情况下,可以至少基于各个第一单元格与各个第二单元格之间的计算关系来生成用于各个第一单元格的电子表格公式。In the case where the calculation relationship between each first cell and each second cell has been obtained, the calculation relationship between each first cell and each second cell may be used to generate the calculation relationship between each first cell and each second cell. Spreadsheet formula for the cell.
例如,在上述示例中,对于总计表中的单元格F10,可以生成电子表格公式“=E$30*(1+$C$12)”;对于总计表中的单元格G10,可以生成电子表格公式“=F$30*(1+$C$12)”;对于总计表中的单元格H10,可以生成电子表格公式“=G$30*(1+$C$12)”。For example, in the above example, for cell F10 in the total table, you can generate a spreadsheet formula "=E$30*(1+$C$12)"; for cell G10 in the total table, you can generate a spreadsheet formula " =F$30*(1+$C$12)"; For cell H10 in the total table, a spreadsheet formula "=G$30*(1+$C$12)" can be generated.
根据本申请的一些实施例,上述确定该当前节点所对应的一个或多个第一单元格中的每个第一单元格与其他节点所对应的一个或多个第二单元格中的每个第二单元格之间的计算关系的步骤可以包括:至少基于一个或多个节点中的该当前节点所对应的运算符,确定该当前节点所对应的一个或多个第一单元格中的每个第一单元格所对应的运算符;以及至少基于一个或多个节点中的该当前节点与其他节点之间的依赖关系,确定该当前节点所对应的一个或多个第一单元格中的每个第一单元格与其他节点所对应的一个或多个第二单元格中的每个第二单元格之间的依赖关系。According to some embodiments of the present application, it is determined above that each of the one or more first cells corresponding to the current node and each of the one or more second cells corresponding to other nodes The step of calculating the relationship between the second cells may include: determining each of the one or more first cells corresponding to the current node based at least on the operator corresponding to the current node in the one or more nodes. Operator corresponding to a first cell; and at least based on the dependency relationship between the current node and other nodes in one or more nodes, determine the one or more first cells corresponding to the current node The dependency relationship between each first cell and each of the one or more second cells corresponding to other nodes.
下面参考图8来描述用于单元格的复合运算符的有向图。图8是示意性地示出根据本申请的一些实施例的用于单元格的复合运算符的有向图的示意图。The directed graph of the compound operator for the cell is described below with reference to FIG. 8. FIG. 8 is a schematic diagram schematically showing a directed graph of a compound operator for a cell according to some embodiments of the present application.
根据本申请的一些实施例,所述一个或多个节点中的该当前节点所对应的运算符是与用于所述电子表格的层级结构中的所述一个或多个节点中的一个节点相对应的第一级复合运算符,第一级复合运算符包括一个或多个第一级原子运算符;所述一个或多个第一单元格中的每个第一单元格所对应的运算符是与所述电子表格中的所述一个或多个单元格中的一个单元格相对应的第二级复合运算符,第二级复合运算符包括一个或多个第二级原子运算符;以及至少基于所述一个或多个节点中的该当前节点所对应的第一级复合运算符,确定该当前节点所对应的一个或多个第一单元格中的每个第一单元格所对应的第二级复合运算符。According to some embodiments of the present application, the operator corresponding to the current node in the one or more nodes is related to one of the one or more nodes in the hierarchical structure of the spreadsheet. The corresponding first-level compound operator, the first-level compound operator includes one or more first-level atomic operators; the operator corresponding to each first cell in the one or more first cells Is a second-level compound operator corresponding to one of the one or more cells in the spreadsheet, and the second-level compound operator includes one or more second-level atomic operators; and Based on at least the first-level compound operator corresponding to the current node in the one or more nodes, determine the corresponding one of the one or more first cells corresponding to the current node The second level compound operator.
用于单元格的复合运算符(其在本文中也被称为第二级复合运算符)和用于层级计算图中的层级的复合运算符(其在本文中也被称为第一级复合运算符)在形式上很类似,都是一个有向图,但是意义不同。由于电子表格中的每个单元格只能存储一个数字或其他变量,所以用于单元格的复合运算符的每个参数都只能是一个标量(scalar),其计算结果也是标量。与之相比,用于层级的复合运算符的参数是一个 层级,这个层级一般是多个变量的集合,其计算结果也是多个计算结果的集合。The compound operator for the cell (which is also referred to as the second-level compound operator in this article) and the compound operator for the level in the hierarchical calculation graph (which is also called the first-level compound operator in this article) Operator) is very similar in form, both are a directed graph, but have different meanings. Since each cell in the spreadsheet can only store one number or other variable, each parameter of the compound operator used in the cell can only be a scalar, and its calculation result is also a scalar. In contrast, the parameter of the compound operator used for the level is a level. This level is generally a collection of multiple variables, and its calculation result is also a collection of multiple calculation results.
例如,在上述示例中,由于左值节点包含F10、G10、H10这三个单元格,所以需要对这三个单元格F10、G10、H10分别生成一个第二级复合运算符。在这个例子中,所生成的用于这三个单元格F10、G10、H10的复合运算符都相同(但是传给占位符的依赖单元格不同),如图8中所示。For example, in the above example, since the lvalue node contains three cells F10, G10, and H10, it is necessary to generate a second-level compound operator for the three cells F10, G10, and H10 respectively. In this example, the generated compound operators for these three cells F10, G10, and H10 are all the same (but the dependent cells passed to the placeholder are different), as shown in Figure 8.
在图8中,图7中的层级的原子运算符“*”802转换成单元格的原子运算符“*”1002;层级的原子运算符“.lag(1)”803转换成单元格的原子运算符“id(等同)”1003;层级的原子运算符“+”804转换成单元格的原子运算符“+”1004;层级的常量原子运算符“1”806转换成单元格的常量原子运算符“1”1006;两个类型为层级的参数占位符“x1”805和“x2”807转换为两个类型为单元格引用的参数占位符“x1”1005和“x2”1007。In Figure 8, the hierarchical atomic operator "*" 802 in Figure 7 is converted to the cell atomic operator "*" 1002; the hierarchical atomic operator ".lag(1)" 803 is converted to the cell atom Operator "id (equal)" 1003; level atomic operator "+" 804 is converted into cell atomic operator "+" 1004; level constant atomic operator "1" 806 is converted into cell constant atomic operation The symbol "1" 1006; the two types of hierarchical parameter placeholders "x1" 805 and "x2" 807 are converted into two parameter placeholders "x1" 1005 and "x2" 1007 that are cell references.
图7和图8中的原子运算符“*”、“+”、“1”虽然名称相同,但是不同的类的对象。同样,参数占位符“x1”和“x2”在图7和图8中也是不同的类的对象,前者是层级计算图中的节点,后者用于存储电子表格中的单元格的引用。Although the atomic operators "*", "+", and "1" in Figure 7 and Figure 8 have the same name, they are objects of different classes. Similarly, the parameter placeholders "x1" and "x2" are also objects of different classes in Figure 7 and Figure 8. The former is a node in the hierarchical calculation graph, and the latter is used to store references to cells in the spreadsheet.
根据本申请的一些实施例,可以将一个或多个节点中的该当前节点与其他节点之间的依赖关系转换为该当前节点所对应的各个第一单元格与其他节点所对应的各个第二单元格之间的依赖关系。According to some embodiments of the present application, the dependency relationship between the current node and other nodes in one or more nodes can be converted into each first cell corresponding to the current node and each second cell corresponding to other nodes. Dependencies between cells.
下面参考图9来描述用于为运算符指定依赖单元格的过程。图9是示意性地示出根据本申请的一些实施例的用于为运算符指定依赖单元格的过程的示意图。The process for specifying dependent cells for operators is described below with reference to FIG. 9. FIG. 9 is a schematic diagram schematically illustrating a process for specifying a dependent cell for an operator according to some embodiments of the present application.
如图9中所示,在已经为总计表中的单元格F10、G10、H10分别构建了复合运算符的情况下,可以确定这些复合运算符中的各个参数占位符分别依赖于哪些单元格。层级计算图中的层级“收入[预测期]”对应的节点存储的依赖节点是“{收入:../利润表}”和“{平均收入增长率}”,前者是一个行,后者是一个单元格。由于对“{收入:../利润表}”做了“.lag(1)”的操作,依赖的单元格的位置需要向左移1位。所以,可以将依赖节点“{收入:../利润表}”转换为单元格F10的依赖单元格E$30、单元格G10的依赖单元格F$30、单元格H10的依赖单元格G$30;可以将依赖节点“{平均收入增长率}”转换为单元格F10的依赖单元格$C$12、单元格G10的依赖单元格$C$12、单元格H10的依赖单元格$C$12。因此,F10、G10、H10这三个单元格的依赖单元格分别为[E$30,$C$12]、[F$30,$C$12]、[G$30,$C$12]。As shown in Figure 9, in the case where compound operators have been constructed for cells F10, G10, and H10 in the total table, it is possible to determine which cells each parameter placeholder in these compound operators depends on. . The dependent nodes of the node storage corresponding to the level "income [prediction period]" in the level calculation graph are "{income: ../income statement}" and "{average income growth rate}". The former is a row and the latter is A cell. Due to the ".lag(1)" operation on "{income:../income statement}", the position of the dependent cell needs to be shifted 1 bit to the left. Therefore, the dependent node "{income:../income statement}" can be converted into the dependent cell E$30 of cell F10, the dependent cell F$30 of cell G10, and the dependent cell G$30 of cell H10; Convert the dependent node "{average income growth rate}" into the dependent cell $C$12 of cell F10, the dependent cell $C$12 of cell G10, and the dependent cell $C$12 of cell H10. Therefore, the dependent cells of the three cells F10, G10, and H10 are [E$30,$C$12], [F$30,$C$12], [G$30,$C$12], respectively.
根据本申请的一些实施例,上述生成用于一个或多个第一单元格中的每个第一单 元格的电子表格公式的步骤可以包括:至少基于该当前节点所对应的一个或多个第一单元格中的每个第一单元格所对应的运算符、以及该当前节点所对应的一个或多个第一单元格中的每个第一单元格与其他节点所对应的一个或多个第二单元格中的每个第二单元格之间的依赖关系,生成用于所述一个或多个第一单元格中的每个第一单元格的电子表格公式。According to some embodiments of the present application, the step of generating the spreadsheet formula for each of the one or more first cells may include: at least based on one or more first cells corresponding to the current node. The operator corresponding to each first cell in a cell, and one or more corresponding to each first cell in the one or more first cells corresponding to the current node and other nodes The dependency relationship between each second cell in the second cell generates a spreadsheet formula for each first cell in the one or more first cells.
例如,在上述的示例中,对于单元格F10,根据图8中所示的复合运算符和依赖单元格[E$30,$C$12],可以生成单元格F10的电子表格公式为“=E$30*(1+$C$12)”。类似地,对于单元格G10,根据图8中所示的复合运算符和依赖单元格[F$30,$C$12],可以生成单元格G10的电子表格公式为“=F$30*(1+$C$12)”。类似地,对于单元格H10,根据图8中所示的复合运算符和依赖单元格[G$30,$C$12],可以生成单元格H10的电子表格公式为“=G$30*(1+$C$12)”。For example, in the above example, for cell F10, according to the compound operator shown in Figure 8 and dependent cells [E$30, $C$12], the spreadsheet formula for cell F10 can be generated as "=E$30 *(1+$C$12)". Similarly, for cell G10, according to the compound operator shown in Figure 8 and dependent cells [F$30, $C$12], the spreadsheet formula for cell G10 can be generated as "=F$30*(1+$ C$12)". Similarly, for cell H10, according to the compound operator shown in Figure 8 and dependent cells [G$30, $C$12], the spreadsheet formula for cell H10 can be generated as "=G$30*(1+$ C$12)".
根据本申请的一些实施例,第一级复合运算符采用第一级有向图来存储,第一级有向图中的各个有向图节点代表第一级复合运算符中的各个第一级原子运算符,以及第一级有向图中的各个有向图节点之间的有向边代表第一级复合运算符中的各个第一级原子运算符之间的组合关系;第二级复合运算符采用第二级有向图来存储,第二级有向图中的各个有向图节点代表第二级复合运算符中的各个第二级原子运算符,以及第二级有向图中的各个有向图节点之间的有向边代表第二级复合运算符中的各个第二级原子运算符之间的组合关系;以及通过遍历与第一级复合运算符相对应的第一级有向图来确定第二级有向图,并且根据第二级有向图来确定第二级复合运算符。According to some embodiments of the present application, the first-level compound operator uses a first-level directed graph for storage, and each directed graph node in the first-level directed graph represents each first-level of the first-level compound operator Atomic operators, and the directed edges between each directed graph node in the first-level directed graph represent the combination relationship between each first-level atomic operator in the first-level compound operator; the second-level compound Operators are stored in the second-level directed graph. Each directed graph node in the second-level directed graph represents each second-level atomic operator in the second-level compound operator, and the second-level directed graph The directed edges between the nodes of the directed graph represent the combination relationship between the second-level atomic operators in the second-level compound operator; and the first-level corresponding to the first-level compound operator through traversal The directed graph is used to determine the second-level directed graph, and the second-level compound operator is determined according to the second-level directed graph.
下面参考图10和图11来描述用于将用于层级的复合运算符转换为用于单元格的复合运算符的过程。图10是示意性地示出根据本申请的一些实施例的用于将用于层级的复合运算符转换为用于单元格的复合运算符的过程的示意图。图11是示意性地示出根据本申请的一些实施例的转换后的用于单元格的复合运算符的有向图的示意图。The following describes the process of converting the compound operator for the hierarchy into the compound operator for the cell with reference to FIG. 10 and FIG. 11. FIG. 10 is a schematic diagram schematically showing a process for converting a compound operator for a hierarchy into a compound operator for a cell according to some embodiments of the present application. FIG. 11 is a schematic diagram schematically showing a directed graph of a compound operator for a cell after conversion according to some embodiments of the present application.
例如,以层级公式中的复合运算符“{y}=SUM(({x1}+{x2}.lag(1)).sum(),{x3},{x4}*{x5})”为例进行说明,其中,参数占位符{y}、{x1}、{x2}、{x3}代表类型为行的第一级有向图节点,而参数占位符{x4}、{x5}代表类型为单元格的第一级有向图节点。For example, the compound operator "{y}=SUM(({x1}+{x2}.lag(1)).sum(),{x3},{x4}*{x5})" in the hierarchy formula is For example, the parameter placeholders {y}, {x1}, {x2}, {x3} represent the first-level directed graph nodes whose type is row, and the parameter placeholders {x4}, {x5} Represents the first-level directed graph node whose type is a cell.
图10的左侧示出了上述层级公式“{y}=SUM(({x1}+{x2}.lag(1)).sum(),{x3},{x4}*{x5})”中的用于层级的复合运算符(在本文中被称为第一级复合运算符) 的有向图(在本文中被称为第一级有向图)。图11示出了转换后的用于图10中的行“{y}”中列标签为“2018”的单元格的复合运算符(在本文中被称为第二级复合运算符)的有向图(在本文中被称为第二级有向图)。The left side of Figure 10 shows the above-mentioned hierarchical formula "{y}=SUM(({x1}+{x2}.lag(1)).sum(),{x3},{x4}*{x5})" A directed graph (referred to as a first-level directed graph in this article) of a compound operator (referred to as the first-level compound operator in this article) used in the hierarchy. Figure 11 shows the conversion of the compound operator (referred to as the second-level compound operator in this article) for the cell with the column label of “2018” in the row "{y}" in Figure 10 after conversion. A directed graph (referred to as a second-level directed graph in this article).
根据本申请的一些实施例,所述通过遍历与第一级复合运算符相对应的第一级有向图来确定第二级有向图可以包括:按照后序遍历的顺序来遍历第一级有向图,从而先遍历第一级有向图中的子有向图节点,再遍历第一级有向图中的父有向图节点。According to some embodiments of the present application, the determining the second-level directed graph by traversing the first-level directed graph corresponding to the first-level compound operator may include: traversing the first level in the order of post-order traversal Directed graph, so that the child directed graph nodes in the first-level directed graph are traversed first, and then the parent directed graph nodes in the first-level directed graph are traversed.
根据本申请的一些实施例,可以在遍历到第一级有向图中的一个或多个第一级有向图节点中的当前第一级有向图节点时,根据当前第一级有向图节点所代表的第一级原子运算符、以及当前第一级有向图节点的第一级子有向图节点的属性信息来确定当前第一级有向图节点的属性信息,其中,每个第一级有向图节点的属性信息包括以下各项中的一种或多种:电子表格中的单元格的位置信息,与电子表格中的单元格相对应的标签信息和电子表格中的单元格的位置信息,与电子表格中的单元格相对应的标签信息和中间级有向图节点,与电子表格中的单元格相对应的中间级有向图节点,以及可以根据第一级有向图中的所述一个或多个第一级有向图节点中的每个第一级有向图节点的属性信息来确定中间级有向图中的各个中间级有向图节点集合,根据第一级有向图中的所述一个或多个第一级有向图节点之间的依赖关系来确定中间级有向图中的每个中间级有向图节点集合中的各个中间级有向图节点与中间级有向图中的其他中间级有向图节点集合中的各个中间级有向图节点之间的依赖关系。According to some embodiments of the present application, when traversing to the current first-level directed graph node in one or more first-level directed graph nodes, according to the current first-level directed graph node The first-level atomic operator represented by the graph node and the attribute information of the first-level child directed graph node of the current first-level directed graph node determine the attribute information of the current first-level directed graph node, where each The attribute information of a first-level directed graph node includes one or more of the following: the location information of the cell in the spreadsheet, the label information corresponding to the cell in the spreadsheet, and the Cell location information, label information and intermediate directed graph nodes corresponding to the cells in the spreadsheet, intermediate directed graph nodes corresponding to the cells in the spreadsheet, and can be based on the first level The attribute information of each first-level directed graph node in the one or more first-level directed graph nodes in the first-level directed graph determines the set of each intermediate-level directed graph node in the intermediate-level directed graph, according to The dependency relationship between the one or more first-level directed graph nodes in the first-level directed graph determines that each intermediate level in each intermediate-level directed graph node set in the intermediate-level directed graph has The dependency relationship between a directed graph node and each intermediate-level directed graph node in the set of other intermediate-level directed graph nodes in the intermediate-level directed graph.
用于层级的第一级复合运算符的第一级有向图中的每个节点除了存储原子运算符外,还额外地存储属性信息(如图10中右侧所示的1212~1219,1231~1233)。属性信息用以记录将第一级有向图转化为第二级有向图的中间计算过程。对于针对行的层级公式中的第一级有向图中的每个节点,该属性信息可以是一个带有标签的行(一个列标签的列表(称为列标签组)以及一个中间级有向图节点列表),其中,中间级有向图节点存储一个单元格的位置或者一个单元格原子运算符(称为中间级原子运算符),以及该原子运算符依赖的其他中间节点),也可以是一个标量(一个不带有标签的中间级有向图节点)。对于针对其他层级类型的层级公式的第一级有向图中的每个节点,属性信息也可以是一个带有标签的列(一个行标签的列表(称为行标签组)以及一个中间级有向图节点列表),还可以是一个行标签组、一个列标签组以及与之对应的一个中间级有向图节点的二维列表。对应于所有第一级有向图节点的所有中间级有向图节点构成中间级有向图。对于针对行的层级公式,层级的复合运算符的叶子 节点的属性信息可以直接由该叶子节点对应的行或单元格的位置得到,如果这个叶子节点对应的是一个行(例如图10中左侧所示的1202、1203、1207),则其属性信息由这个行的列标签组和存储有这个行中的每个单元格的位置的中间级有向图节点(例如图10中右侧所示的1212、1213、1217);如果这个叶子节点对应的是一个单元格(例如图10中左侧所示的1221、1222),则其属性信息是存储有这个单元格的位置的中间级有向图节点(例如图10中右侧所示的1231、1232)。In addition to storing atomic operators, each node in the first-level directed graph of the first-level compound operator used for the hierarchy also stores additional attribute information (1212-1219, 1231 as shown on the right in Figure 10). ~1233). The attribute information is used to record the intermediate calculation process of transforming the first-level directed graph into the second-level directed graph. For each node in the first-level directed graph in the row-oriented hierarchy formula, the attribute information can be a labeled row (a list of column labels (called a column label group)) and an intermediate directed graph Graph node list), where the intermediate-level directed graph node stores the position of a cell or a cell atomic operator (called intermediate-level atomic operator), and other intermediate nodes that the atomic operator depends on), or Is a scalar (an intermediate-level directed graph node without a label). For each node in the first-level directed graph of the hierarchical formula for other hierarchical types, the attribute information can also be a labeled column (a list of row labels (called a row label group) and an intermediate level A directed graph node list) can also be a two-dimensional list of a row label group, a column label group, and a corresponding intermediate-level directed graph node. All intermediate-level directed graph nodes corresponding to all first-level directed graph nodes constitute an intermediate-level directed graph. For the row-specific formula, the attribute information of the leaf node of the compound operator of the hierarchy can be obtained directly from the position of the row or cell corresponding to the leaf node. If the leaf node corresponds to a row (for example, the left side in Figure 10) Shown as 1202, 1203, 1207), the attribute information consists of the column label group of this row and the intermediate directed graph node that stores the position of each cell in this row (for example, as shown on the right in Figure 10 1212, 1213, 1217); if the leaf node corresponds to a cell (for example, 1221, 1222 shown on the left in Figure 10), then its attribute information is the middle-level directed Graph nodes (for example, 1231 and 1232 shown on the right in FIG. 10).
如上所述,可以采用后序遍历的方法来遍历用于层级的复合运算符的有向图(先遍历子节点,再遍历父节点)。在遍历到每个节点时,可以根据该节点的原子运算符、以及该节点的子节点的属性信息来确定该节点的属性信息。例如,通过对图10中左侧所示的用于层级的复合运算符的有向图进行后序遍历,可以得到图10中右侧所示的中间级有向图,其中,可以根据第一级有向图中的所述一个或多个第一级有向图节点中的每个第一级有向图节点的属性信息来确定中间级有向图中的各个中间级有向图节点集合,至少根据第一级有向图中的所述一个或多个第一级有向图节点之间的依赖关系来确定中间级有向图中的每个中间级有向图节点集合中的各个中间级有向图节点与中间级有向图中的其他中间级有向图节点集合中的各个中间级有向图节点之间的依赖关系。As described above, a post-order traversal method can be used to traverse the directed graph for the compound operator of the hierarchy (the child node is traversed first, and then the parent node). When traversing to each node, the attribute information of the node can be determined according to the atomic operator of the node and the attribute information of the child nodes of the node. For example, by performing post-order traversal on the directed graph of the compound operator for the hierarchy shown on the left in FIG. 10, the intermediate directed graph shown on the right in FIG. 10 can be obtained, wherein, according to the first The attribute information of each first-level directed graph node in the one or more first-level directed graph nodes in the first-level directed graph determines the set of each intermediate-level directed graph node in the intermediate-level directed graph , At least according to the dependency relationship between the one or more first-level directed graph nodes in the first-level directed graph to determine each of the set of each intermediate-level directed graph node in the intermediate-level directed graph The dependency relationship between the intermediate-level directed graph node and each intermediate-level directed graph node in the set of other intermediate-level directed graph nodes in the intermediate-level directed graph.
根据本申请的一些实施例,第一级原子运算符被划分为逐元素原子运算符(Elementwise Atomic Operators)、降维原子运算符(Dimension-Reduction Atomic Operators)、错位原子运算符(Transposition Atomic Operators)、用户自定义原子运算符中的一种。According to some embodiments of the present application, the first-level atomic operators are divided into elementwise atomic operators (Elementwise Atomic Operators), dimensionality-reduction atomic operators (Dimension-Reduction Atomic Operators), and transposition atomic operators (Transposition Atomic Operators). , One of user-defined atomic operators.
逐元素原子运算符可以包括“+、-、*、/”等数学运算符、以及用大写字母表示的函数,诸如“SUM()、AVERAGE()”等。当逐元素原子运算符作用在两个行上的时候,可以将这两个行中具有相同列标签对应位置的单元格相加。Element-wise atomic operators can include mathematical operators such as "+, -, *, /", and functions expressed in capital letters, such as "SUM(), AVERAGE()", and so on. When the element-wise atomic operator is applied to two rows, the cells with the same column label corresponding positions in the two rows can be added.
降维原子运算符可以用小写字母表示,并用“.”与变量连接,不包括错位原子运算符。Dimensionality reduction atomic operators can be expressed in lowercase letters and connected to variables with ".", excluding misplaced atomic operators.
错位原子运算符可以指“lag(1)、lead(1)、shift(1)”等原子运算符,当确定这些错位原子运算符的节点的属性信息中的标签信息时,需要对这些错位运算符的节点的子节点的标签信息进行错位得到。Misplaced atomic operators can refer to atomic operators such as "lag(1), lead(1), shift(1)", etc. When determining the label information in the attribute information of the nodes of these misplaced atomic operators, these misplaced operations need to be performed The label information of the child nodes of the symbol node is obtained by dislocation.
根据本申请的一些实施例,当遍历到的第一级有向图中的当前第一级有向图节点所代表的第一级原子运算符为逐元素原子运算符时,可执行以下操作。According to some embodiments of the present application, when the first-level atomic operator represented by the current first-level directed graph node in the traversed first-level directed graph is an element-wise atomic operator, the following operations can be performed.
如果该当前第一级有向图节点的各个第一级子有向图节点的属性信息都包含与电子表格中的单元格相对应的标签信息,则根据各个第一级子有向图节点的属性信息中所包含的标签信息的交集设置该当前第一级有向图节点的属性信息中的标签信息,根据该当前第一级有向图节点所代表的第一级原子运算符设置该当前第一级有向图节点的属性信息中的中间级原子运算符,根据该当前第一级有向图节点的属性信息中的标签信息和中间级原子运算符来确定与该当前第一级有向图节点相对应的当前中间级有向图节点集合,以及至少根据该当前第一级有向图节点与其第一级子有向图节点之间的依赖关系并且根据该当前第一级有向图节点与其第一级子有向图节点的属性信息中的标签信息来确定与该当前第一级有向图节点相对应的当前中间级有向图节点集合中的各个中间级有向图节点与中间级有向图中的其他中间级有向图节点集合中的各个中间级有向图节点之间的依赖关系。If the attribute information of each first-level sub-directed graph node of the current first-level directed graph node contains the label information corresponding to the cell in the spreadsheet, then the attribute information of each first-level sub-directed graph node The intersection of the label information contained in the attribute information sets the label information in the attribute information of the current first-level directed graph node, and sets the current first-level atomic operator represented by the current first-level directed graph node. The intermediate-level atomic operator in the attribute information of the first-level directed graph node is determined to be related to the current first-level based on the label information and the intermediate-level atomic operator in the attribute information of the current first-level directed graph node. The current intermediate-level directed graph node set corresponding to the directed graph node, and at least according to the dependency relationship between the current first-level directed graph node and its first-level child directed graph nodes and according to the current first-level directed graph node The label information in the attribute information of the graph node and its first-level child directed graph node is used to determine each intermediate-level directed graph node in the current intermediate-level directed graph node set corresponding to the current first-level directed graph node The dependency relationship between each intermediate-level directed graph node in the set of other intermediate-level directed graph nodes in the intermediate-level directed graph.
例如,对于针对行的层级公式,当遍历到逐元素原子运算符时(例如当遍历到图10中左侧所示的1205、1208、1223):如果子节点的属性信息都是带标签的行,则将这些行的列标签组取交集作为该节点的列标签组。例如,当遍历到图10中左侧所示的1205时,其子节点的属性信息1212和1214都是带标签的行,列标签组分别为“[2017,2018,2019]”和“[2018,2019,2020]”,将这两个列标签组的交集“[2018,2019]”作为1205的属性信息(1215)的标签。将1215中的中间级有向图节点的中间级原子运算符设置为1205的逐元素原子运算符对应的单元格原子运算符“+”,将“2018”标签对应位置的中间级有向图节点所依赖的中间节点设为1212和1214中“2018”标签对应位置的中间级有向图节点;将“2019”标签对应位置的中间级有向图节点所依赖的中间级有向图节点设为1212和1214中“2019”标签对应位置的中间级有向图节点。For example, for a row-oriented hierarchical formula, when traversing to element-wise atomic operators (for example, when traversing to 1205, 1208, and 1223 shown on the left in Figure 10): If the attribute information of the child nodes are all labeled rows , The intersection of the column label groups of these rows is taken as the column label group of the node. For example, when traversing to 1205 shown on the left in Figure 10, the attribute information 1212 and 1214 of its child nodes are all labeled rows, and the column label groups are "[2017,2018,2019]" and "[2018 ,2019,2020]", and use the intersection "[2018,2019]" of the two column label groups as the label of the attribute information (1215) of 1205. Set the intermediate atomic operator of the intermediate directed graph node in 1215 to the cell atomic operator "+" corresponding to the element-wise atomic operator of 1205, and the intermediate directed graph node corresponding to the position of the "2018" label The dependent intermediate node is set to the intermediate directed graph node corresponding to the position of the "2018" label in 1212 and 1214; the intermediate directed graph node that the intermediate directed graph node at the corresponding position of the "2019" label depends on is set to The middle-level directed graph node corresponding to the "2019" label in 1212 and 1214.
如果该当前第一级有向图节点的各个第一级子有向图节点的属性信息都不包含标签信息,则使得该当前第一级有向图节点的属性信息中不包含标签信息,根据该当前第一级有向图节点所代表的第一级原子运算符设置该当前第一级有向图节点的属性信息中的中间级原子运算符,至少根据该当前第一级有向图节点的属性信息中的中间级原子运算符来确定与该当前第一级有向图节点相对应的当前中间级有向图节点集合,以及至少根据该当前第一级有向图节点与其第一级子有向图节点之间的依赖关系来确定与该当前第一级有向图节点相对应的当前中间级有向图节点集合中的各个中间级有向图节点与中间级有向图中的其他中间级有向图节点集合中的各个中间级 有向图节点之间的依赖关系。If the attribute information of each first-level child directed graph node of the current first-level directed graph node does not contain label information, then the attribute information of the current first-level directed graph node does not include label information, according to The first-level atomic operator represented by the current first-level directed graph node sets the intermediate-level atomic operator in the attribute information of the current first-level directed graph node, at least according to the current first-level directed graph node The intermediate-level atomic operator in the attribute information of the current first-level directed graph node is used to determine the current intermediate-level directed graph node set corresponding to the current first-level directed graph node, and at least according to the current first-level directed graph node and its first-level The dependency relationship between the sub-directed graph nodes is used to determine the current intermediate-level directed graph node corresponding to the current first-level directed graph node in each intermediate-level directed graph node and the intermediate-level directed graph. The dependency relationship between each intermediate-level directed graph node in the set of other intermediate-level directed graph nodes.
如果子节点的属性信息全是不带有标签的中间级有向图节点(例如节点1223),则该节点的属性信息(1233)也设置为一个不带有标签的中间级有向图节点,1233的中间级有向图节点的原子运算符为逐元素原子运算符对应的单元格原子运算符(“*”),依赖的中间级有向图节点为子节点的属性信息中的中间级有向图节点(1231、1232)。If the attribute information of the child nodes are all intermediate-level directed graph nodes without labels (for example, node 1223), the attribute information (1233) of the node is also set as an intermediate-level directed graph node without labels, The atomic operator of the 1233 intermediate-level directed graph node is the cell atomic operator ("*") corresponding to the element-wise atomic operator, and the dependent intermediate-level directed graph node is the intermediate level in the attribute information of the child node. Graph nodes (1231, 1232).
如果该当前第一级有向图节点的一部分第一级子有向图节点的属性信息包含与电子表格中的单元格相对应的标签信息并且该当前第一级有向图节点的另一部分第一级子有向图节点的属性信息不包含与电子表格中的单元格相对应的标签信息,则根据包含标签信息的第一级子有向图节点的属性信息中所包含的标签信息的交集设置该当前第一级有向图节点的属性信息中的标签信息,根据该当前第一级有向图节点所代表的第一级原子运算符设置该当前第一级有向图节点的属性信息中的中间级原子运算符,根据该当前第一级有向图节点的属性信息中的标签信息和中间级原子运算符来确定与该当前第一级有向图节点相对应的当前中间级有向图节点集合,以及至少根据该当前第一级有向图节点与其第一级子有向图节点之间的依赖关系并且根据该当前第一级有向图节点与其第一级子有向图节点的属性信息中的标签信息来确定与该当前第一级有向图节点相对应的当前中间级有向图节点集合中的各个中间级有向图节点与中间级有向图中的其他中间级有向图节点集合中的各个中间级有向图节点之间的依赖关系。If the attribute information of a part of the current first-level directed graph node of the first-level child directed graph node contains the label information corresponding to the cell in the spreadsheet and the other part of the current first-level directed graph node is the first The attribute information of the first-level child directed graph node does not contain the label information corresponding to the cell in the spreadsheet, then according to the intersection of the label information contained in the attribute information of the first-level child directed graph node that contains the label information Set the label information in the attribute information of the current first-level directed graph node, and set the attribute information of the current first-level directed graph node according to the first-level atomic operator represented by the current first-level directed graph node The intermediate level atomic operator in the current first level directed graph node determines the current intermediate level corresponding to the current first level directed graph node based on the label information and the intermediate level atomic operator in the attribute information of the current first level directed graph node The set of directed graph nodes, and at least according to the dependency relationship between the current first-level directed graph node and its first-level child directed graph nodes, and according to the current first-level directed graph node and its first-level child directed graph The label information in the attribute information of the node determines each intermediate-level directed graph node in the current intermediate-level directed graph node set corresponding to the current first-level directed graph node and other intermediates in the intermediate-level directed graph The dependency relationship between each intermediate-level directed graph node in the set of one-level directed graph nodes.
如果子节点的属性信息既有带标签的行也有标量(比如节点1208),则先将子节点的属性信息的列标签组([2017,2018,2019])的交集作为该节点的属性信息(1218)的列标签组([2017,2018,2019]),将1218中的中间节点的原子运算符设置为1208的第一级原子运算符对应的单元格原子运算符“sum”,将“2017”标签对应位置的中间节点所依赖的中间节点设为1217中“2017”标签对应位置的中间节点、以及中间节点1216和中间节点1233;另外,对于1218中“2018”和“2019”标签对应位置的中间节点的操作类似,此处不再赘述。If the attribute information of the child node has both a labeled row and a scalar (such as node 1208), first use the intersection of the column label group ([2017,2018,2019]) of the attribute information of the child node as the attribute information of the node ( 1218) column label group ([2017,2018,2019]), set the atomic operator of the intermediate node in 1218 to the cell atomic operator "sum" corresponding to the first-level atomic operator of 1208, and set "2017 The intermediate node on which the intermediate node corresponding to the position of the label depends is set to the intermediate node corresponding to the position of the "2017" label in 1217, as well as the intermediate node 1216 and the intermediate node 1233; in addition, for the positions corresponding to the "2018" and "2019" labels in 1218 The operation of the intermediate node is similar, so I won't repeat it here.
根据本申请的一些实施例,当遍历到的第一级有向图中的当前第一级有向图节点所代表的第一级原子运算符为降维原子运算符时,可以执行以下操作。According to some embodiments of the present application, when the first-level atomic operator represented by the current first-level directed graph node in the traversed first-level directed graph is a dimensionality reduction atomic operator, the following operations can be performed.
使得该当前第一级有向图节点的属性信息中不包含标签信息或包含该当前第一级有向图节点的第一级子有向图节点的属性信息中的标签信息的一个子集,至少根据 该当前第一级有向图节点所代表的第一级原子运算符设置该当前第一级有向图节点的属性信息中的中间级原子运算符,至少根据该当前第一级有向图节点的属性信息中的中间级原子运算符来确定与该当前第一级有向图节点相对应的当前中间级有向图节点集合,以及至少根据该当前第一级有向图节点与其第一级子有向图节点之间的依赖关系来确定与该当前第一级有向图节点相对应的当前中间级有向图节点集合中的各个中间级有向图节点与中间级有向图中的其他中间级有向图节点集合中的各个中间级有向图节点之间的依赖关系。So that the attribute information of the current first-level directed graph node does not contain label information or includes a subset of the label information in the attribute information of the first-level child directed graph node of the current first-level directed graph node, Set the intermediate-level atomic operator in the attribute information of the current first-level directed graph node at least according to the first-level atomic operator represented by the current first-level directed graph node, and at least according to the current first-level directed graph node The intermediate-level atomic operator in the attribute information of the graph node determines the current intermediate-level directed graph node set corresponding to the current first-level directed graph node, and at least according to the current first-level directed graph node and its first-level directed graph node The dependency relationship between the first-level sub-directed graph nodes is used to determine each intermediate-level directed graph node and the intermediate-level directed graph in the current intermediate-level directed graph node set corresponding to the current first-level directed graph node The dependency relationship between each intermediate-level directed graph node in the set of other intermediate-level directed graph nodes in.
例如,当遍历到降维运算符(比如节点1206)时,将该节点的属性信息设为一个标量,将这个标量对应的中间级有向图节点(1216)的运算符设置为该降维运算符对应的单元格原子运算符(“sum”),该中间级有向图节点的依赖节点为1206的子节点(1205)的属性信息(1215)中的所有中间级有向图节点。For example, when traversing to a dimensionality reduction operator (such as node 1206), the attribute information of the node is set to a scalar, and the operator of the intermediate-level directed graph node (1216) corresponding to this scalar is set to the dimensionality reduction operation The cell atomic operator ("sum") corresponding to the symbol, the dependent node of the intermediate-level directed graph node is all the intermediate-level directed graph nodes in the attribute information (1215) of the child node (1205) of 1206.
根据本申请的一些实施例,当遍历到的第一级有向图中的当前第一级有向图节点所代表的第一级原子运算符为错位原子运算符时,可以执行以下操作。According to some embodiments of the present application, when the first-level atomic operator represented by the current first-level directed graph node in the traversed first-level directed graph is a misplaced atomic operator, the following operations can be performed.
在该当前第一级有向图节点的第一级子有向图节点的属性信息包含与电子表格中的单元格相对应的标签信息的情况下,将第一级子有向图节点的属性信息中所包含的标签信息进行错位后获得的错位后标签信息设置为该当前第一级有向图节点的属性信息中的标签信息,将“等同”原子运算符设置为该当前第一级有向图节点的属性信息中的中间级原子运算符,根据该当前第一级有向图节点的属性信息中的标签信息和中间级原子运算符来确定与该当前第一级有向图节点相对应的当前中间级有向图节点集合,以及至少根据该当前第一级有向图节点与其第一级子有向图节点之间的依赖关系并且根据该当前第一级有向图节点与其第一级子有向图节点的属性信息中的标签信息来确定与该当前第一级有向图节点相对应的当前中间级有向图节点集合中的各个中间级有向图节点与中间级有向图中的其他中间级有向图节点集合中的各个中间级有向图节点之间的依赖关系。In the case that the attribute information of the first-level child directed graph node of the current first-level directed graph node contains the label information corresponding to the cell in the spreadsheet, the attribute information of the first-level child directed graph node The label information contained in the information is set to the label information in the attribute information of the current first-level directed graph node, and the “equal” atomic operator is set to the current first-level directed graph node. The intermediate-level atomic operator in the attribute information of the directed graph node is determined to be relative to the current first-level directed graph node according to the label information and the intermediate-level atomic operator in the attribute information of the current first-level directed graph node. The corresponding set of current intermediate-level directed graph nodes, and at least according to the dependency relationship between the current first-level directed graph node and its first-level child directed graph nodes, and according to the current first-level directed graph node and its first level The label information in the attribute information of the first-level sub-directed graph node determines the current intermediate-level directed graph node set corresponding to the current first-level directed graph node. The dependency relationship between each intermediate-level directed graph node in the set of other intermediate-level directed graph nodes in the directed graph.
例如,当遍历到1204时,由于1204的原子运算符是“.lag(1)”,所以将1204的子节点1203的属性信息(1213)的列标签组“[2017,2018,2019]”错1位变成“[2018,2019,2020]”。将1214中“2018”、“2019”位置的中间节点的单元格原子运算符设为“id(等同)”,依赖节点设置为1213中“2018”、“2019”位置对应的中间节点。For example, when traversing to 1204, since the atomic operator of 1204 is ".lag(1)", the column label group "[2017,2018,2019]" of the attribute information (1213) of the child node 1203 of 1204 is wrong The first place becomes "[2018,2019,2020]". Set the cell atomic operator of the intermediate node at positions "2018" and "2019" in 1214 to "id (equivalent)", and set the dependent node to the intermediate node corresponding to positions "2018" and "2019" in 1213.
根据本申请的一些实施例,可以分别从所述中间级有向图中抽取以中间级有向图 根节点集合中的各个中间级有向图根节点为根节点的子有向图,并且将所抽取的子有向图作为第二级有向图以根据第二级有向图来确定第二级复合运算符。According to some embodiments of the present application, a sub-directed graph with the root node of each intermediate-level directed graph in the set of intermediate-level directed graph root nodes as the root node may be extracted from the intermediate-level directed graph, and the The extracted sub-directed graph is used as the second-level directed graph to determine the second-level compound operator according to the second-level directed graph.
根据本申请的一些实施例,在得到中间级有向图根节点集合的情况下,可以将中间级有向图根节点集合中的各个中间级有向图根节点的位置与中间级有向图左值节点集合中的各个中间级有向图左值节点的位置相对应。例如,可以通过将各个中间级有向图根节点的属性信息中的标签信息与各个中间级有向图左值节点的属性信息中的标签信息进行匹配,将各个中间级有向图根节点的位置与各个中间级有向图左值节点的位置相对应。然后,可以将以相应的匹配位置处的中间级有向图根节点为根节点的子有向图抽出作为第二级有向图以根据第二级有向图来确定中间级左值节点对应的单元格的第二级复合运算符。According to some embodiments of the present application, when the root node set of the intermediate-level directed graph is obtained, the position of each intermediate-level directed graph root node in the intermediate-level directed graph root node set can be compared with that of the intermediate-level directed graph. The positions of the left-value nodes of each intermediate-level directed graph in the set of left-value nodes correspond to each other. For example, the label information in the attribute information of the root node of each intermediate-level directed graph can be matched with the label information in the attribute information of the left-value node of each intermediate-level directed graph. The position corresponds to the position of the left value node of each intermediate-level directed graph. Then, the sub-directed graph with the root node of the intermediate-level directed graph at the corresponding matching position as the root node can be extracted as the second-level directed graph to determine the middle-level left-value node corresponding to the second-level directed graph The second level compound operator of the cell.
例如,在得到节点1208的属性信息1218的情况下,1218中的每个中间节点都对应于一个用于单元格的复合运算符,这只需要将以该中间节点为根节点的子有向图抽出即可。例如,1218中标签“2018”位置对应的单元格的复合运算符如图11所示。将这些单元格的复合运算符赋给左值相同标签位置的单元格。例如,可以将图11的复合运算符赋给图10中1219对应的行中列标签为“2018”的中间节点对应的单元格。具体地,例如,在得到节点1208的属性信息1218的情况下,可以将各个属性信息1218的位置与节点1209的各个属性信息1219的位置相对应。例如,可以通过将各个属性信息1218中的标签信息“2017”、“2018”、“2019”与各个属性信息1219中的标签“2018”、“2019”、“2020”进行匹配,将属性信息1218中的标签信息“2018”所对应的中间级有向图节点位置与属性信息1219中的标签信息“2018”所对应的中间级有向图节点位置相对应,以及将属性信息1218中的标签信息“2019”所对应的中间级有向图节点位置与属性信息1219中的标签信息“2019”所对应的中间级有向图节点位置相对应。然后,可以将以属性信息1218中的节点“2018”为根节点的子有向图抽出作为第二级复合运算符并将其赋给属性信息1219中的标签“2018”位置的中间级有向图节点对应的单元格。For example, in the case of obtaining the attribute information 1218 of the node 1208, each intermediate node in 1218 corresponds to a compound operator for the cell, and this only needs to be the sub-directed graph with the intermediate node as the root node Just pull it out. For example, the compound operator of the cell corresponding to the position of the label "2018" in 1218 is shown in Figure 11. Assign the compound operator of these cells to the cell with the same label position as the left value. For example, the compound operator in Fig. 11 can be assigned to the cell corresponding to the intermediate node in the row corresponding to 1219 in Fig. 10 and the column label is “2018”. Specifically, for example, in a case where the attribute information 1218 of the node 1208 is obtained, the position of each attribute information 1218 may be corresponded to the position of each attribute information 1219 of the node 1209. For example, the attribute information 1218 can be matched by matching the label information "2017", "2018", and "2019" in each attribute information 1218 with the labels "2018", "2019", and "2020" in each attribute information 1219. The position of the intermediate-level directed graph node corresponding to the label information "2018" in the attribute information 1219 corresponds to the intermediate-level directed graph node position corresponding to the label information "2018" in the attribute information 1219, and the label information in the attribute information 1218 The position of the intermediate-level directed graph node corresponding to “2019” corresponds to the position of the intermediate-level directed graph node corresponding to the label information “2019” in the attribute information 1219. Then, the sub-directed graph with the node "2018" in the attribute information 1218 as the root node can be extracted as the second-level compound operator and assigned to the middle-level directed graph at the position of the label "2018" in the attribute information 1219 The cell corresponding to the graph node.
注意,对于针对诸如列、块、区间、单元格等不同层级的层级公式,可以用类似的步骤将第一级有向图转化为第二级有向图。例如,对于针对列的层级公式,可以按照上述步骤中对列标签组进行操作的方法对第一级有向图节点属性信息中的行标签组进行操作。又例如,对于针对块的层级公式,在遍历到每个逐元素原子运算符时,将该当前第一级有向图节点的第一级子有向图节点的属性信息中包含的列标签组的 交集设置为该当前第一级有向图节点的属性信息中的列标签组,以及将该当前第一级有向图节点的第一级子有向图节点的属性信息中包含的行标签组的交集设置为该当前第一级有向图节点的属性信息中的行标签组;在遍历到降维原子运算符时,使得该当前第一级有向图节点的属性信息中不包含标签信息,或者仅包含当前第一级有向图节点的第一级子有向图节点的属性信息中所包含的标签信息的一个子集(例如,仅包含一个行标签组或者仅包含一个列标签组);在遍历到错位原子运算符时,将第一级子有向图节点的属性信息中所包含的行标签组进行错位后获得的错位后行标签组设置为该当前第一级有向图节点的属性信息中的标签信息中的行标签组,或者将第一级子有向图节点的属性信息中所包含的列标签组进行错位后获得的错位后列标签组设置为该当前第一级有向图节点的属性信息中的标签信息中的列标签组,或者同时执行对上述行标签组和列标签组的错位。再例如,对于针对区间和单元格的层级公式,也可以采用与针对行和列的层级公式的类似的步骤。为了简洁起见,具体细节在此不再赘述。Note that for different levels of formulas such as columns, blocks, intervals, cells, etc., similar steps can be used to convert the first-level directed graph to the second-level directed graph. For example, for a column-level formula, the row label group in the first-level directed graph node attribute information can be operated according to the method for operating the column label group in the above steps. For another example, for a block-level formula, when each element-wise atomic operator is traversed, the column label group contained in the attribute information of the first-level sub-directed graph node of the current first-level directed graph node The intersection of is set as the column label group in the attribute information of the current first-level directed graph node, and the row label contained in the attribute information of the first-level child directed graph node of the current first-level directed graph node The intersection of the groups is set as the row label group in the attribute information of the current first-level directed graph node; when traversing to the dimensionality reduction atomic operator, the attribute information of the current first-level directed graph node does not contain the label Information, or only a subset of the label information contained in the attribute information of the first-level child directed graph node of the current first-level directed graph node (for example, only one row label group or only one column label Group); when traversing to the dislocation atomic operator, the row label group contained in the attribute information of the first-level sub-directed graph node is dislocated and the post-dislocation row label group is set as the current first-level directed The row label group in the label information in the attribute information of the graph node, or the column label group contained in the attribute information of the first-level sub-directed graph node is misaligned and the post-dislocation column label group is set as the current first The column label group in the label information in the attribute information of the first-level directed graph node, or the misalignment of the row label group and the column label group is performed at the same time. For another example, for hierarchical formulas for intervals and cells, similar steps to those for hierarchical formulas for rows and columns can also be adopted. For the sake of brevity, the specific details will not be repeated here.
返回参考图1,在步骤S107之后,用于生成电子表格公式的计算机实现的方法100可以结束。Referring back to FIG. 1, after step S107, the computer-implemented method 100 for generating spreadsheet formulas may end.
根据本申请的一些实施例,可以将所生成的用于所述一个或多个第一单元格中的每个第一单元格的电子表格公式存储到电子表格文件中的相应单元格中。According to some embodiments of the present application, the generated spreadsheet formula for each first cell of the one or more first cells may be stored in a corresponding cell in the spreadsheet file.
例如,在上述图9所示的示例中,可以分别将所生成的F10、G10、H10这三个单元格的电子表格公式字符串写入通用格式的电子表格文件(例如,.xls或.xlsx格式的文件)中的相应单元格。另外,如果用通用电子表格处理软件打开,则可以计算出这三个单元格F10、G10、H10的结果。For example, in the example shown in Figure 9 above, the generated spreadsheet formula strings of the three cells F10, G10, and H10 can be written into a spreadsheet file in a common format (for example, .xls or .xlsx). Format file) in the corresponding cell. In addition, if you open it with general spreadsheet processing software, you can calculate the results of these three cells F10, G10, and H10.
根据本申请的一些实施例,所述将所生成的用于所述一个或多个第一单元格中的每个第一单元格的电子表格公式存储到相应的第一单元格中的步骤还可以包括:对所述电子表格中的所述一个或多个第一单元格和所述一个或多个第二单元格中的一部分或全部的单元格名称进行自动命名;以及利用自动命名的单元格名称来改写所述电子表格公式并且存储改写后的电子表格公式。According to some embodiments of the present application, the step of storing the generated spreadsheet formula for each first cell of the one or more first cells in the corresponding first cell is also It may include: automatically naming a part or all of the cell names of the one or more first cells and the one or more second cells in the electronic table; and using automatically named cells The grid name is used to rewrite the spreadsheet formula and store the rewritten spreadsheet formula.
例如,在写入电子表格文件时可以将电子表格中的部分或者全部单元格自动命名(.xls或.xlsx格式的文件中的单元格命名),并写入同样意义的电子表格公式。比如,可以将单元格C12命名为“平均收入增长率”,并将写入单元格F10、G10、H10中的公式改写为“=E$30*(1+平均收入增长率)”、“=F$30*(1+平均收入增长率)”、 “=G$30*(1+平均收入增长率)”。For example, when writing a spreadsheet file, you can automatically name some or all of the cells in the spreadsheet (name the cells in a file in .xls or .xlsx format), and write the spreadsheet formulas with the same meaning. For example, you can name cell C12 "average income growth rate", and rewrite the formula written in cells F10, G10, H10 as "=E$30*(1+average income growth rate)", "=F $30*(1+average income growth rate)", "=G$30*(1+average income growth rate)".
根据本申请的一些实施例,可以基于已经获取的所述层级公式,更新智能建议知识库,所述智能建议知识库包括与所述层级公式或者层级结构有关的信息;以及可以基于所述智能建议知识库,在将要获取新的层级公式时进行智能建议。According to some embodiments of the present application, an intelligent suggestion knowledge base may be updated based on the already acquired hierarchical formula, the intelligent suggestion knowledge base including information related to the hierarchical formula or hierarchical structure; and the intelligent suggestion may be The knowledge base provides intelligent suggestions when a new level formula is about to be obtained.
例如,可以根据已经输入的内容来更新智能提示的知识库。例如,如果用户在名为“收入”的块下增加了“手机”、“个人计算机”、“平板电脑”三个行,那么可以将这三个名词加入智能提示知识库,并将其与“收入”关联起来。再例如,用户在名为“Valuation Model(估值模型)”的工作簿下的名为“Financial Statement(财务报表)”的页下新建了一个名为“Income Statement(利润表)”的表,并在其中添加了一个名为“Revenue(收入)”的行,那么,在层级路径的知识库中则要添加进“Valuation Model/Financial Statement/Income Statement/Revenue”这样一个路径。根据所期望的智能提示信息不同,知识库中还可以包括其他与层级公式及/或层级计算图相关的提示信息,本申请对此不做限制。For example, the knowledge base of intelligent prompts can be updated according to the content that has been entered. For example, if the user adds three rows of "mobile phone", "personal computer", and "tablet" under the block named "income", then these three terms can be added to the smart reminder knowledge base and combined with " "Income". For another example, the user creates a new table named "Income Statement" under the page named "Financial Statement" under the workbook named "Valuation Model". And add a row named "Revenue (revenue)", then, in the knowledge base of the hierarchical path, add a path such as "Valuation Model/Financial Statement/Income Statement/Revenue". Depending on the expected intelligent prompt information, the knowledge base may also include other prompt information related to the hierarchical formula and/or the hierarchical calculation graph, which is not limited in this application.
可以根据智能提示知识库在用户编辑层级公式对用户进行智能提示。例如,在上面的示例中,在更新了智能提示的知识库之后,知识库中“手机”、“个人计算机”、“平板电脑”已经与“收入”关联了起来,在用户编辑一个名为“收入”的行的层级公式时,对用户进行智能提示“=SUM({手机}、{个人计算机}、{平板电脑})”以及其他所有高概率出现的层级公式,以供用户选择。再例如,当用户在一个名为“SUMMARY(总计表)”的表下编辑层级公式时希望引用一个“利润表”的表下面的“收入”行,则在输入“收入”后,会提示层级计算图中所有名为“收入”(或者名称与“收入”相似)的节点的路径,供用户从中选择。The user can be intelligently prompted according to the intelligent prompt knowledge base in the user edit level formula. For example, in the above example, after updating the knowledge base of smart tips, "mobile phone", "personal computer", and "tablet" in the knowledge base have been associated with "income". For the hierarchical formula of the line of “Income”, the user will be intelligently prompted “=SUM({phone}, {personal computer}, {tablet})" and all other hierarchical formulas with high probability for users to choose. For another example, when a user edits a level formula under a table named "SUMMARY" and wants to refer to the "income" row under the table of an "income statement", after entering "income", the level will be prompted Calculate the path of all nodes named "income" (or similar in name to "income") in the graph for the user to choose from.
根据本申请的一些实施例,用户可以通过系统预设的原子运算符组合成自定义原子运算符。According to some embodiments of the present application, users can combine atomic operators preset by the system into custom atomic operators.
下面参考图12来描述自定义原子运算符。图12是示意性地示出根据本申请的一些实施例的自定义原子运算符的有向图的示意图。The following describes the custom atomic operator with reference to Figure 12. FIG. 12 is a schematic diagram schematically showing a directed graph of a custom atomic operator according to some embodiments of the present application.
例如,用户可以通过输入“增长率({x1},{x2})={x2}/{x1}-1”来定制新的自定义原子运算符“增长率()”。根据本申请的一些实施例,自定义原子运算符“增长率()”也可以用有向图来表示。例如,如图12中所示,自定义原子运算符“增长率()”可以用有向图1511来表示。For example, the user can customize a new custom atomic operator "growth rate ()" by entering "growth rate ({x1}, {x2})={x2}/{x1}-1". According to some embodiments of the present application, the custom atomic operator "growth rate ()" can also be represented by a directed graph. For example, as shown in FIG. 12, the custom atomic operator "growth rate ()" can be represented by a directed graph 1511.
在定制了新的自定义原子运算符的情况下,可以在输入用于电子表格的层级公式 时使用所定制的自定义原子运算符。例如,利用上述定制的自定义原子运算符“增长率()”,可以输入如下用于电子表格的层级公式:In the case of customizing a new custom atomic operator, you can use the custom atomic operator when entering the hierarchical formula used in the spreadsheet. For example, using the customized custom atomic operator "growth rate ()" above, you can enter the following hierarchical formula for spreadsheets:
“{收入增长率}=增长率({收入}.lag(1),{收入})”"{Income growth rate} = growth rate ({income}.lag(1), {income})"
该用于电子表格的层级公式的复合运算符也可以用有向图来表示。例如,参考图12,该用于电子表格的层级公式可以用原始有向图1512来表示,其中,该原始有向图1512包括运算符1508和以运算符1508为父节点的两个子有向图:第一子有向图“{x1}.lag(1)”1504和第二子有向图“{x2}”1506,参数占位符“x1”和“x2”对应于同一层级计算图的节点“收入”。其中运算符1508为自定义原子运算符“增长率”。The compound operator used in the hierarchical formula of the spreadsheet can also be represented by a directed graph. For example, referring to FIG. 12, the hierarchical formula for the spreadsheet can be represented by the original directed graph 1512, where the original directed graph 1512 includes an operator 1508 and two child directed graphs with the operator 1508 as the parent node. : The first sub-directed graph "{x1}.lag(1)" 1504 and the second sub-directed graph "{x2}" 1506, the parameter placeholders "x1" and "x2" correspond to the same level of the calculation graph The node "Income". The operator 1508 is a custom atomic operator "growth rate".
如果用于电子表格的层级公式中包括自定义原子运算符,则需要将自定义原子运算符转换为系统预设的其他类型的原子运算符。例如,对于每个自定义原子运算符,可以在用于电子表格的层级公式的原始有向图中将该自定义原子运算符替换为代表该自定义原子运算符的有向图的根节点,并且用层级公式的原始有向图中的以自定义原子运算符为父节点的子有向图来替换该自定义原子运算符的有向图中的叶子节点。然后,可以利用转换后的复合运算符的有向图来执行图10中所示的步骤。If the hierarchical formula used in the spreadsheet includes custom atomic operators, you need to convert the custom atomic operators to other types of atomic operators preset by the system. For example, for each custom atomic operator, you can replace the custom atomic operator with the root node of the directed graph representing the custom atomic operator in the original directed graph of the hierarchical formula used in the spreadsheet. And replace the leaf nodes in the directed graph of the custom atomic operator with the child directed graph with the custom atomic operator as the parent node in the original directed graph of the hierarchical formula. Then, the converted directed graph of the compound operator can be used to perform the steps shown in FIG. 10.
例如,参考图12,对于上述层级公式的原始有向图1512中的自定义原子运算符“增长率”1508,可以将其替换为代表该自定义原子运算符“增长率”的有向图1511(在替换后的有向图1513中,子图1503和有向图1511的子图1502对应)的根节点1517,并且用层级公式的原始有向图1512中的自定义原子运算符“增长率”1508的第一子有向图“{x1}.lag(1)”1504来替换代表有向图1511中的叶子节点“x1”的占位符(成为有向图1513的子图1505),并且用自定义原子运算符“增长率”1508的第二子有向图“{x2}”1506来替换代表有向图1502中的叶子节点“x2”的占位符(成为有向图1513的子有向图1507),从而可以得到图12中所示的转换后的有向图1513。然后,可以利用转换后的复合运算符的有向图1513来执行图10中所示的步骤。For example, referring to Figure 12, for the custom atomic operator "growth rate" 1508 in the original directed graph 1512 of the above level formula, it can be replaced with a directed graph 1511 representing the custom atomic operator "growth rate" (In the replaced directed graph 1513, the subgraph 1503 corresponds to the subgraph 1502 of the directed graph 1511) root node 1517, and the custom atomic operator "growth rate" in the original directed graph 1512 with the hierarchical formula The first sub-directed graph "{x1}.lag(1)" 1504 of "1508 replaces the placeholder representing the leaf node "x1" in the directed graph 1511 (it becomes the sub-graph 1505 of the directed graph 1513), And use the second sub-directed graph "{x2}" 1506 of the custom atomic operator "growth rate" 1508 to replace the placeholder representing the leaf node "x2" in the directed graph 1502 (it becomes the direction of the directed graph 1513 The sub-directed graph 1507), so that the converted directed graph 1513 shown in FIG. 12 can be obtained. Then, the directed graph 1513 of the converted compound operator can be used to perform the steps shown in FIG. 10.
根据本申请的一些实施例,可以自动检测所获取的所述层级公式中存在的缺陷;以及可以基于所述缺陷自动生成调试信息并且提示所述调试信息,其中,所述调试信息包括错误或警告。According to some embodiments of the present application, defects existing in the acquired hierarchy formula can be automatically detected; and debugging information can be automatically generated based on the defects and prompt the debugging information, wherein the debugging information includes errors or warnings .
用户在输入层级公式时可能产生不同程度的错误,或者输入的格式不标准。在本申请的一些实现方式中,系统可以自动生成调试信息。调试信息包括错误(Error)和警告(Warning)。错误是指输入的层级公式不符合层级公式的语法,无法生成正 确的电子表格模型;警告是指输入的层级公式符合层级公式的语法,但生成的电子表格模型很可能不符合层级公式编写者的真实意图。例如,在本申请的一些实现方式中,允许用户在定义“Income Statement(利润表)”表下的“Revenue(收入)”行之前就去在层级公式中引用这个行,这称为“未定义引用”(Undefined Reference)。在用户结束输入之前,这只是一个警告信息,因为用户可能会在之后定义这些暂时的未定义引用。但是如果在用户完成了整个电子表格模型中的层级公式的输入时这些未定义引用还没有被定义,这就成为了错误。由于调试信息是随着用户的输入不断在变化的,所以在用户输入新的层级公式后需要更新调试信息。在本申请的不同实现方式中,可能包括不同种类的调试信息。例如,在针对财务模型的实现中,调试信息的知识库中可以包括会计等式,如果输入的层级公式和会计等式相悖,则生成警告信息。再例如,调试信息知识库中可以包括判断更正错误层级公式的算法,当输入错误的层级公式时,可以生成错误信息,并自动生成可能的改正建议。在本申请的其他实现方式中,还可能包括更加复杂的调试信息,本申请对此不做限制。The user may make different degrees of errors when entering the level formula, or the input format is not standard. In some implementations of this application, the system can automatically generate debugging information. The debugging information includes errors (Error) and warnings (Warning). Error means that the entered level formula does not conform to the grammar of the level formula, and the correct spreadsheet model cannot be generated; the warning means that the entered level formula conforms to the grammar of the level formula, but the generated spreadsheet model is likely not to meet the level formula writer’s True intentions. For example, in some implementations of this application, users are allowed to quote this row in the hierarchy formula before defining the “Revenue” row under the “Income Statement” table. This is called “undefined”. Reference" (Undefined Reference). This is just a warning message before the user finishes typing, because the user may define these temporary undefined references later. However, if these undefined references have not been defined when the user completes the input of the hierarchical formula in the entire spreadsheet model, this becomes an error. Since the debugging information is constantly changing with the user's input, the debugging information needs to be updated after the user enters a new level formula. In different implementations of this application, different types of debugging information may be included. For example, in the implementation of a financial model, the knowledge base of debugging information may include accounting equations, and if the entered hierarchical formula is inconsistent with the accounting equation, a warning message is generated. For another example, the debugging information knowledge base may include algorithms for judging and correcting error level formulas. When the wrong level formula is input, error information can be generated, and possible correction suggestions can be automatically generated. In other implementation manners of this application, more complicated debugging information may also be included, which is not limited in this application.
可以以某种形式向用户提示所生成的调试信息。例如,当层级公式中出现未定义引用时,将它们高亮显示,当输入层级公式后定义可能与之匹配的层级时,在未定义引用处标注数字“n”表示存在n个可能与之匹配的层级,当选中其中某一个层级后,该未定义引用的高亮显示被取消。再例如,如果层级公式中输入“={手机}++{个人计算机}”时,则提示错误信息“无意义的运算符++,考虑将其更改为+”。再例如,如果用户在“利润”这一行中输入层级公式“={收入}+{成本}”,则提示警告信息“可能错误的公式,考虑更改为={收入}-{成本}”。The generated debugging information can be prompted to the user in some form. For example, when undefined references appear in the level formula, highlight them. When the level formula is entered and the level that may match with it is defined, the number "n" is marked at the undefined reference to indicate that there are n possible matches. When selecting one of the levels, the highlighting of the undefined reference is cancelled. For another example, if "={mobile}++{personal computer}" is entered in the level formula, the error message "meaningless operator++, consider changing it to +" will be prompted. For another example, if the user enters the hierarchical formula "={income}+{cost}" in the "profit" row, the warning message "may be wrong formula, consider changing it to ={income}-{cost}".
根据本申请的一些实施例,可以存储电子表格模型,所述电子表格模型包括以下各项中的一个或多个:用于电子表格的层级结构、用于电子表格的层级计算图和电子表格文件。According to some embodiments of the present application, an electronic form model may be stored, the electronic form model including one or more of the following: a hierarchical structure for the electronic form, a hierarchical calculation diagram for the electronic form, and an electronic form file .
根据本申请的一些实施例,可以导入和/或导出所述电子表格模型。According to some embodiments of the present application, the spreadsheet model can be imported and/or exported.
根据本申请的另一方面,可以提供一种用于生成电子表格公式的装置,包括:用于执行如前所述的方法的步骤的部件。According to another aspect of the present application, an apparatus for generating an electronic form formula may be provided, including: components for executing the steps of the method as described above.
根据本申请的另一方面,可以提供一种用于生成电子表格公式的设备,包括:至少一个处理器;以及至少一个存储设备,所述至少一个存储设备存储有指令,当所述指令由所述至少一个处理器执行时使得所述至少一个处理器执行如前所述的方法。According to another aspect of the present application, there may be provided a device for generating spreadsheet formulas, including: at least one processor; and at least one storage device, the at least one storage device stores instructions, when the instructions are The execution of the at least one processor causes the at least one processor to execute the aforementioned method.
根据本申请的另一方面,可以提供一种非瞬态计算机可读存储介质,存储有指令, 当所述指令由处理器执行时使得执行如前所述的方法。According to another aspect of the present application, a non-transitory computer-readable storage medium may be provided, which stores instructions, which when executed by a processor causes the aforementioned method to be performed.
根据本申请的另一方面,可以提供一种用于生成电子表格公式的装置。下面参考图13来描述用于生成电子表格公式的装置。图13是示意性地示出根据本申请的一些实施例的用于生成电子表格公式的装置1300的框图。According to another aspect of the present application, an apparatus for generating an electronic form formula can be provided. The apparatus for generating spreadsheet formulas will be described below with reference to FIG. 13. FIG. 13 is a block diagram schematically showing an apparatus 1300 for generating spreadsheet formulas according to some embodiments of the present application.
如图13所示,用于生成电子表格公式的装置1300可以包括:层级公式编辑器1301,所述层级公式编辑器1301被配置为获取用于所述电子表格的层级公式,所述层级公式包括运算符和层级引用,其中所述层级引用对应于用于电子表格的层级结构中的一个或多个层级中的一个或多个节点,其中每个层级具有至少一个节点并且具有相应的层级类型,每个节点对应于所述电子表格中的一个或多个单元格,其中所述层级结构还包括所述一个或多个节点之间的隶属关系;层级公式解析器1303,所述层级公式解析器1303被配置为基于所述层级引用与所述一个或多个节点之间的对应关系来确定所述一个或多个节点之间的依赖关系;所述层级公式解析器还被配置为基于所述运算符和所述依赖关系来确定所述一个或多个节点之间的计算关系;以及公式转译器1305,所述公式转译器1305被配置为至少基于用于所述电子表格的所述层级结构和所述计算关系来生成所述电子表格公式。As shown in FIG. 13, the apparatus 1300 for generating an electronic form formula may include: a hierarchical formula editor 1301, the hierarchical formula editor 1301 is configured to obtain a hierarchical formula for the electronic form, the hierarchical formula includes Operators and level references, where the level references correspond to one or more nodes in one or more levels in the hierarchy of the spreadsheet, where each level has at least one node and has a corresponding level type, Each node corresponds to one or more cells in the spreadsheet, wherein the hierarchical structure further includes the membership relationship between the one or more nodes; a hierarchical formula parser 1303, the hierarchical formula parser 1303 is configured to determine the dependency relationship between the one or more nodes based on the correspondence between the hierarchical reference and the one or more nodes; the hierarchical formula parser is further configured to be based on the corresponding relationship between the one or more nodes; Operator and the dependency relationship to determine the calculation relationship between the one or more nodes; and a formula translator 1305 configured to be based at least on the hierarchical structure for the spreadsheet And the calculation relationship to generate the spreadsheet formula.
根据本申请的一些实施例,所述层级公式编辑器1301可以包括图形用户界面编辑器,其中所述图形用户界面编辑器包括用于指定不同层级的节点和/或运算符的组件,并且其中所述图形用户界面编辑器还可以被配置为:接收针对用于指定不同层级的节点和/或运算符的组件的输入;以及基于所述输入来生成所述层级公式。According to some embodiments of the present application, the hierarchical formula editor 1301 may include a graphical user interface editor, where the graphical user interface editor includes components for specifying nodes and/or operators at different levels, and The graphical user interface editor may also be configured to: receive input for components for specifying nodes and/or operators of different levels; and generate the level formula based on the input.
根据本申请的一些实施例,所述层级公式编辑器1301可以包括文本编辑器,所述文本编辑器可以被配置为:接收用户输入的文本代码;以及解析所述文本代码以生成所述层级公式。According to some embodiments of the present application, the hierarchical formula editor 1301 may include a text editor, and the text editor may be configured to: receive a text code input by a user; and parse the text code to generate the hierarchical formula .
根据本申请的一些实施例,所述运算符可以包括原子运算符,所述原子运算符包括以下各项中的一种或多种:数学运算符、数学函数、常量、系统定义函数、用户自定义原子运算符。According to some embodiments of the present application, the operator may include an atomic operator, and the atomic operator includes one or more of the following: mathematical operators, mathematical functions, constants, system-defined functions, user-defined Define atomic operators.
根据本申请的一些实施例,所述层级公式解析器1303还可以被配置为:根据所述层级公式中的所述原子运算符来构建复合运算符,其中,所述复合运算符包括所述层级公式中的所有原子运算符的组合。According to some embodiments of the present application, the hierarchical formula parser 1303 may be further configured to construct a compound operator according to the atomic operator in the hierarchical formula, wherein the compound operator includes the hierarchical The combination of all atomic operators in the formula.
根据本申请的一些实施例,所述层级公式解析器1303还可以被配置为:至少基于所述复合运算符和所述依赖关系来确定所述一个或多个节点之间的计算关系。According to some embodiments of the present application, the hierarchical formula parser 1303 may be further configured to determine the calculation relationship between the one or more nodes based at least on the compound operator and the dependency relationship.
根据本申请的一些实施例,所述层级引用可以包括位于所述层级公式中的等号左侧的第一层级引用和位于所述层级公式中的等号右侧的第二层级引用,其中,第一层级引用对应于所述一个或多个节点中的第一节点,而第二层级引用对应于所述一个或多个节点中的第二节点。According to some embodiments of the present application, the level reference may include a first level reference located on the left side of the equal sign in the level formula and a second level reference located on the right side of the equal sign in the level formula, wherein, The first-level reference corresponds to the first node in the one or more nodes, and the second-level reference corresponds to the second node in the one or more nodes.
根据本申请的一些实施例,所述层级公式解析器1303还可以被配置为:至少基于第一层级引用与第一节点之间的对应关系以及第二层级引用与第二节点之间的对应关系来确定第一节点与第二节点之间的依赖关系。According to some embodiments of the present application, the hierarchical formula parser 1303 may be further configured to be based at least on the correspondence between the first-level reference and the first node and the correspondence between the second-level reference and the second node. To determine the dependency between the first node and the second node.
根据本申请的一些实施例,用于生成电子表格公式的装置1300还可以包括层级计算图存储器1307,所述层级计算图存储器1307可以被配置为:针对所述一个或多个节点中的每个节点,经由层级计算图存储该节点与其他节点之间的计算关系。According to some embodiments of the present application, the apparatus 1300 for generating spreadsheet formulas may further include a hierarchical calculation graph storage 1307, and the hierarchical calculation graph storage 1307 may be configured to: for each of the one or more nodes The node stores the calculation relationship between the node and other nodes via the hierarchical calculation graph.
根据本申请的一些实施例,所述层级公式解析器1303还可以被配置为:基于所述运算符以及第一节点与第二节点之间的依赖关系来确定第一节点与第二节点之间的计算关系。According to some embodiments of the present application, the hierarchical formula parser 1303 may be further configured to determine the relationship between the first node and the second node based on the operator and the dependency relationship between the first node and the second node. The calculation relationship.
根据本申请的一些实施例,所述层级计算图存储器1307还可以被配置为:针对第一节点,经由层级计算图存储第一节点与第二节点之间的计算关系。According to some embodiments of the present application, the hierarchical calculation graph storage 1307 may also be configured to store the calculation relationship between the first node and the second node via the hierarchical calculation graph for the first node.
根据本申请的一些实施例,所述公式转译器1305还可以被配置为:对于所述一个或多个节点中的每个当前节点,基于所述一个或多个节点中的该当前节点与其他节点之间的计算关系来确定该当前节点所对应的一个或多个第一单元格中的每个第一单元格与其他节点所对应的一个或多个第二单元格中的每个第二单元格之间的计算关系;以及至少基于所述一个或多个第一单元格中的每个第一单元格与所述一个或多个第二单元格中的每个第二单元格之间的计算关系,生成用于所述一个或多个第一单元格中的每个第一单元格的电子表格公式。According to some embodiments of the present application, the formula translator 1305 may also be configured to: for each current node in the one or more nodes, based on the current node and other nodes in the one or more nodes The calculation relationship between nodes is used to determine each first cell in one or more first cells corresponding to the current node and each second cell in one or more second cells corresponding to other nodes. Calculation relationship between cells; and based at least on the relationship between each first cell in the one or more first cells and each second cell in the one or more second cells The calculation relationship of, generates a spreadsheet formula for each first cell of the one or more first cells.
根据本申请的一些实施例,所述公式转译器1305还可以被配置为:至少基于所述一个或多个节点中的该当前节点所对应的运算符,确定该当前节点所对应的一个或多个第一单元格中的每个第一单元格所对应的运算符;以及至少基于所述一个或多个节点中的该当前节点与其他节点之间的依赖关系,确定该当前节点所对应的一个或多个第一单元格中的每个第一单元格与其他节点所对应的一个或多个第二单元格中的每个第二单元格之间的依赖关系。According to some embodiments of the present application, the formula translator 1305 may also be configured to determine one or more corresponding operators of the current node based at least on the operator corresponding to the current node among the one or more nodes. The operator corresponding to each first cell in the first cell; and at least based on the dependency relationship between the current node and other nodes in the one or more nodes, determine the operator corresponding to the current node The dependency relationship between each first cell in the one or more first cells and each second cell in the one or more second cells corresponding to other nodes.
根据本申请的一些实施例,所述公式转译器1305还可以被配置为:至少基于该当前节点所对应的一个或多个第一单元格中的每个第一单元格所对应的运算符、以及 该当前节点所对应的一个或多个第一单元格中的每个第一单元格与其他节点所对应的一个或多个第二单元格中的每个第二单元格之间的依赖关系,生成用于所述一个或多个第一单元格中的每个第一单元格的电子表格公式。According to some embodiments of the present application, the formula translator 1305 may also be configured to: at least be based on the operator corresponding to each of the one or more first cells corresponding to the current node, And the dependency relationship between each first cell in one or more first cells corresponding to the current node and each second cell in one or more second cells corresponding to other nodes To generate a spreadsheet formula for each of the one or more first cells.
根据本申请的一些实施例,所述公式转译器1305还可以被配置为:所述一个或多个节点中的该当前节点所对应的运算符是与用于所述电子表格的层级结构中的所述一个或多个节点中的一个节点相对应的第一级复合运算符,第一级复合运算符包括一个或多个第一级原子运算符;所述一个或多个第一单元格中的每个第一单元格所对应的运算符是与所述电子表格中的所述一个或多个单元格中的一个单元格相对应的第二级复合运算符,第二级复合运算符包括一个或多个第二级原子运算符;以及至少基于所述一个或多个节点中的该当前节点所对应的第一级复合运算符,确定该当前节点所对应的一个或多个第一单元格中的每个第一单元格所对应的第二级复合运算符。According to some embodiments of the present application, the formula translator 1305 may also be configured to: the operator corresponding to the current node in the one or more nodes is the same as that used in the hierarchical structure of the spreadsheet The first-level compound operator corresponding to one of the one or more nodes, the first-level compound operator includes one or more first-level atomic operators; in the one or more first cells The operator corresponding to each first cell of is a second-level compound operator corresponding to one of the one or more cells in the spreadsheet, and the second-level compound operator includes One or more second-level atomic operators; and determining one or more first units corresponding to the current node based at least on the first-level compound operator corresponding to the current node in the one or more nodes The second-level compound operator corresponding to each first cell in the grid.
根据本申请的一些实施例,所述公式转译器1305还可以被配置为:第一级复合运算符采用第一级有向图来存储,第一级有向图中的各个有向图节点代表第一级复合运算符中的各个第一级原子运算符,以及第一级有向图中的各个有向图节点之间的有向边代表第一级复合运算符中的各个第一级原子运算符之间的组合关系;第二级复合运算符采用第二级有向图来存储,第二级有向图中的各个有向图节点代表第二级复合运算符中的各个第二级原子运算符,以及第二级有向图中的各个有向图节点之间的有向边代表第二级复合运算符中的各个第二级原子运算符之间的组合关系;以及通过遍历与第一级复合运算符相对应的第一级有向图来确定第二级有向图,并且根据第二级有向图来确定第二级复合运算符。According to some embodiments of the present application, the formula translator 1305 may also be configured as: the first-level compound operator is stored in a first-level directed graph, and each directed graph node in the first-level directed graph represents Each first-level atomic operator in the first-level compound operator, and the directed edges between each directed graph node in the first-level directed graph represent each first-level atom in the first-level compound operator The combination relationship between operators; the second-level compound operator is stored in the second-level directed graph, and each directed graph node in the second-level directed graph represents each second-level in the second-level compound operator Atomic operators, and the directed edges between each directed graph node in the second-level directed graph represent the combination relationship between each second-level atomic operator in the second-level compound operator; and through traversal and The first-level directed graph corresponding to the first-level compound operator determines the second-level directed graph, and the second-level compound operator is determined according to the second-level directed graph.
根据本申请的一些实施例,所述公式转译器1305还可以被配置为:按照后序遍历的顺序来遍历第一级有向图,从而先遍历第一级有向图中的子有向图节点,再遍历第一级有向图中的父有向图节点。According to some embodiments of the present application, the formula translator 1305 may also be configured to traverse the first-level directed graph in the order of post-order traversal, so as to first traverse the sub-directed graphs in the first-level directed graph. Node, and then traverse the parent directed graph node in the first level directed graph.
根据本申请的一些实施例,所述公式转译器1305还可以被配置为:在遍历到第一级有向图中的一个或多个第一级有向图节点中的当前第一级有向图节点时,根据当前第一级有向图节点所代表的第一级原子运算符、以及当前第一级有向图节点的第一级子有向图节点的属性信息来确定当前第一级有向图节点的属性信息,其中,每个第一级有向图节点的属性信息包括以下各项中的一种或多种:电子表格中的单元格的位置信息,与电子表格中的单元格相对应的标签信息和电子表格中的单元格的位置信息,与电子表格中的单元格相对应的标签信息和中间级有向图节点,与电子表格中的 单元格相对应的中间级有向图中节点;根据第一级有向图中的所述一个或多个第一级有向图节点中的每个第一级有向图节点的属性信息来确定中间级有向图中的各个中间级有向图节点集合,根据第一级有向图中的所述一个或多个第一级有向图节点之间的依赖关系来确定中间级有向图中的每个中间级有向图节点集合中的各个中间级有向图节点与中间级有向图中的其他中间级有向图节点集合中的各个中间级有向图节点之间的依赖关系。According to some embodiments of the present application, the formula translator 1305 may also be configured to: traverse to the current first-level directed graph node among one or more first-level directed graph nodes in the first-level directed graph. In the case of a graph node, the current first level is determined according to the first level atomic operator represented by the current first level directed graph node and the attribute information of the first level child directed graph node of the current first level directed graph node The attribute information of the directed graph node, where the attribute information of each first-level directed graph node includes one or more of the following: the location information of the cell in the spreadsheet, and the cell in the spreadsheet The label information corresponding to the cell and the location information of the cell in the spreadsheet, the label information corresponding to the cell in the spreadsheet and the middle-level directed graph node, and the middle-level corresponding to the cell in the spreadsheet has Nodes in a directed graph; determine the middle-level directed graph based on the attribute information of each first-level directed graph node in the one or more first-level directed graph nodes in the first-level directed graph Each intermediate-level directed graph node set determines that each intermediate level in the intermediate-level directed graph has a dependency relationship between the one or more first-level directed graph nodes in the first-level directed graph. The dependency relationship between each intermediate-level directed graph node in the set of directed graph nodes and each intermediate-level directed graph node in the set of other intermediate-level directed graph nodes in the intermediate-level directed graph.
根据本申请的一些实施例,第一级原子运算符被划分为逐元素原子运算符、降维原子运算符、错位原子运算符、用户自定义原子运算符中的一种。According to some embodiments of the present application, the first-level atomic operators are classified into one of element-wise atomic operators, dimensionality reduction atomic operators, misplaced atomic operators, and user-defined atomic operators.
根据本申请的一些实施例,所述公式转译器1305还可以被配置为:当遍历到的第一级有向图中的当前第一级有向图节点所代表的第一级原子运算符为逐元素原子运算符时,执行以下操作:According to some embodiments of the present application, the formula translator 1305 may also be configured to: when the first-level atomic operator represented by the current first-level directed graph node in the traversed first-level directed graph is When an element-wise atomic operator is used, the following operations are performed:
如果该当前第一级有向图节点的各个第一级子有向图节点的属性信息都包含与电子表格中的单元格相对应的标签信息,则根据各个第一级子有向图节点的属性信息中所包含的标签信息的交集设置该当前第一级有向图节点的属性信息中的标签信息,根据该当前第一级有向图节点所代表的第一级原子运算符设置该当前第一级有向图节点的属性信息中的中间级原子运算符,根据该当前第一级有向图节点的属性信息中的标签信息和中间级原子运算符来确定与该当前第一级有向图节点相对应的当前中间级有向图节点集合,以及至少根据该当前第一级有向图节点与其第一级子有向图节点之间的依赖关系并且根据该当前第一级有向图节点与其第一级子有向图节点的属性信息中的标签信息来确定与该当前第一级有向图节点相对应的当前中间级有向图节点集合中的各个中间级有向图节点与中间级有向图中的其他中间级有向图节点集合中的各个中间级有向图节点之间的依赖关系;If the attribute information of each first-level sub-directed graph node of the current first-level directed graph node contains the label information corresponding to the cell in the spreadsheet, then the attribute information of each first-level sub-directed graph node The intersection of the label information contained in the attribute information sets the label information in the attribute information of the current first-level directed graph node, and sets the current first-level atomic operator represented by the current first-level directed graph node. The intermediate-level atomic operator in the attribute information of the first-level directed graph node is determined to be related to the current first-level based on the label information and the intermediate-level atomic operator in the attribute information of the current first-level directed graph node. The current intermediate-level directed graph node set corresponding to the directed graph node, and at least according to the dependency relationship between the current first-level directed graph node and its first-level child directed graph nodes and according to the current first-level directed graph node The label information in the attribute information of the graph node and its first-level child directed graph node is used to determine each intermediate-level directed graph node in the current intermediate-level directed graph node set corresponding to the current first-level directed graph node The dependency relationship with each intermediate-level directed graph node in the set of other intermediate-level directed graph nodes in the intermediate-level directed graph;
如果该当前第一级有向图节点的各个第一级子有向图节点的属性信息都不包含标签信息,则使得该当前第一级有向图节点的属性信息中不包含标签信息,根据该当前第一级有向图节点所代表的第一级原子运算符设置该当前第一级有向图节点的属性信息中的中间级原子运算符,至少根据该当前第一级有向图节点的属性信息中的中间级原子运算符来确定与该当前第一级有向图节点相对应的当前中间级有向图节点集合,以及至少根据该当前第一级有向图节点与其第一级子有向图节点之间的依赖关系来确定与该当前第一级有向图节点相对应的当前中间级有向图节点集合中的各个中间级有向图节点与中间级有向图中的其他中间级有向图节点集合中的各个中间级 有向图节点之间的依赖关系;If the attribute information of each first-level child directed graph node of the current first-level directed graph node does not contain label information, then the attribute information of the current first-level directed graph node does not include label information, according to The first-level atomic operator represented by the current first-level directed graph node sets the intermediate-level atomic operator in the attribute information of the current first-level directed graph node, at least according to the current first-level directed graph node The intermediate-level atomic operator in the attribute information of the current first-level directed graph node is used to determine the current intermediate-level directed graph node set corresponding to the current first-level directed graph node, and at least according to the current first-level directed graph node and its first-level The dependency relationship between the sub-directed graph nodes is used to determine the current intermediate-level directed graph node corresponding to the current first-level directed graph node in each intermediate-level directed graph node and the intermediate-level directed graph. The dependency relationship between each intermediate-level directed graph node in the set of other intermediate-level directed graph nodes;
如果该当前第一级有向图节点的一部分第一级子有向图节点的属性信息包含与电子表格中的单元格相对应的标签信息并且该当前第一级有向图节点的另一部分第一级子有向图节点的属性信息不包含标签信息,则根据包含标签信息的第一级子有向图节点的属性信息中所包含的标签信息的交集设置该当前第一级有向图节点的属性信息中的标签信息,根据该当前第一级有向图节点所代表的第一级原子运算符设置该当前第一级有向图节点的属性信息中的中间级原子运算符,根据该当前第一级有向图节点的属性信息中的标签信息和中间级原子运算符来确定与该当前第一级有向图节点相对应的当前中间级有向图节点集合,以及至少根据该当前第一级有向图节点与其第一级子有向图节点之间的依赖关系并且根据该当前第一级有向图节点与其第一级子有向图节点的属性信息中的标签信息来确定与该当前第一级有向图节点相对应的当前中间级有向图节点集合中的各个中间级有向图节点与中间级有向图中的其他中间级有向图节点集合中的各个中间级有向图节点之间的依赖关系。If the attribute information of a part of the current first-level directed graph node of the first-level child directed graph node contains the label information corresponding to the cell in the spreadsheet and the other part of the current first-level directed graph node is the first If the attribute information of the first-level child directed graph node does not contain label information, the current first-level directed graph node is set according to the intersection of the label information contained in the attribute information of the first-level child directed graph node containing the label information According to the label information in the attribute information of the current first-level directed graph node, the middle-level atomic operator in the attribute information of the current first-level directed graph node is set according to the first-level atomic operator represented by the current first-level directed graph node. The label information and intermediate atomic operators in the attribute information of the current first-level directed graph node are used to determine the current intermediate-level directed graph node set corresponding to the current first-level directed graph node, and at least according to the current The dependency relationship between the first-level directed graph node and its first-level child directed graph node is determined according to the label information in the attribute information of the current first-level directed graph node and its first-level child directed graph node Each intermediate-level directed graph node in the current intermediate-level directed graph node set corresponding to the current first-level directed graph node and each intermediate-level directed graph node set in the intermediate-level directed graph The dependency relationship between the nodes of the hierarchical directed graph.
根据本申请的一些实施例,所述公式转译器1305还可以被配置为:当遍历到的第一级有向图中的当前第一级有向图节点所代表的第一级原子运算符为降维原子运算符时,执行以下操作:According to some embodiments of the present application, the formula translator 1305 may also be configured to: when the first-level atomic operator represented by the current first-level directed graph node in the traversed first-level directed graph is When reducing dimensionality atomic operators, perform the following operations:
使得该当前第一级有向图节点的属性信息中不包含标签信息或包含该当前第一级有向图节点的第一级子有向图节点的属性信息中的标签信息的一个子集,至少根据该当前第一级有向图节点所代表的第一级原子运算符设置该当前第一级有向图节点的属性信息中的中间级原子运算符,至少根据该当前第一级有向图节点的属性信息中的中间级原子运算符来确定与该当前第一级有向图节点相对应的当前中间级有向图节点集合,以及至少根据该当前第一级有向图节点与其第一级子有向图节点之间的依赖关系来确定与该当前第一级有向图节点相对应的当前中间级有向图节点集合中的各个中间级有向图节点与中间级有向图中的其他中间级有向图节点集合中的各个中间级有向图节点之间的依赖关系。So that the attribute information of the current first-level directed graph node does not contain label information or includes a subset of the label information in the attribute information of the first-level child directed graph node of the current first-level directed graph node, Set the intermediate-level atomic operator in the attribute information of the current first-level directed graph node at least according to the first-level atomic operator represented by the current first-level directed graph node, and at least according to the current first-level directed graph node The intermediate-level atomic operator in the attribute information of the graph node determines the current intermediate-level directed graph node set corresponding to the current first-level directed graph node, and at least according to the current first-level directed graph node and its first-level directed graph node The dependency relationship between the first-level sub-directed graph nodes is used to determine each intermediate-level directed graph node and the intermediate-level directed graph in the current intermediate-level directed graph node set corresponding to the current first-level directed graph node The dependency relationship between each intermediate-level directed graph node in the set of other intermediate-level directed graph nodes in.
根据本申请的一些实施例,所述公式转译器1305还可以被配置为:当遍历到的第一级有向图中的当前第一级有向图节点所代表的第一级原子运算符为错位原子运算符时,执行以下操作:According to some embodiments of the present application, the formula translator 1305 may also be configured to: when the first-level atomic operator represented by the current first-level directed graph node in the traversed first-level directed graph is When misplaced atomic operators, do the following:
在该当前第一级有向图节点的第一级子有向图节点的属性信息包含与电子表格中的单元格相对应的标签信息的情况下,根据第一级子有向图节点的属性信息中所包 含的标签信息的进行错位后获得的错位后标签信息设置该当前第一级有向图节点的属性信息中的标签信息,将“等同”原子运算符设置为该当前第一级有向图节点的属性信息中的中间级原子运算符,根据该当前第一级有向图节点的属性信息中的标签信息和中间级原子运算符来确定与该当前第一级有向图节点相对应的当前中间级有向图节点集合,以及至少根据该当前第一级有向图节点与其第一级子有向图节点之间的依赖关系并且根据该当前第一级有向图节点与其第一级子有向图节点的属性信息中的标签信息来确定与该当前第一级有向图节点相对应的当前中间级有向图节点集合中的各个中间级有向图节点与中间级有向图中的其他中间级有向图节点集合中的各个中间级有向图节点之间的依赖关系。In the case that the attribute information of the first-level sub-directed graph node of the current first-level directed graph node contains the label information corresponding to the cell in the spreadsheet, according to the attributes of the first-level sub-directed graph node The post-dislocation label information obtained after misalignment of the label information contained in the information sets the label information in the attribute information of the current first-level directed graph node, and sets the "equivalence" atomic operator to the current first-level The intermediate-level atomic operator in the attribute information of the directed graph node is determined to be relative to the current first-level directed graph node according to the label information and the intermediate-level atomic operator in the attribute information of the current first-level directed graph node. The corresponding set of current intermediate-level directed graph nodes, and at least according to the dependency relationship between the current first-level directed graph node and its first-level child directed graph nodes, and according to the current first-level directed graph node and its first level The label information in the attribute information of the first-level sub-directed graph node determines the current intermediate-level directed graph node set corresponding to the current first-level directed graph node. The dependency relationship between each intermediate-level directed graph node in the set of other intermediate-level directed graph nodes in the directed graph.
根据本申请的一些实施例,所述公式转译器1305还可以被配置为:分别从所述中间级有向图中抽取以中间级有向图根节点集合中的各个中间级有向图根节点为根节点的子有向图,并且将所抽取的子有向图作为第二级有向图以根据第二级有向图来确定第二级复合运算符。According to some embodiments of the present application, the formula translator 1305 may also be configured to extract from the intermediate-level directed graph to each intermediate-level directed graph root node in the set of intermediate-level directed graph root nodes. It is the sub-directed graph of the root node, and the extracted sub-directed graph is used as the second-level directed graph to determine the second-level compound operator according to the second-level directed graph.
根据本申请的一些实施例,所述公式转译器1305还可以被配置为:通过将各个中间级有向图根节点的属性信息中的标签信息与各个中间级有向图左值节点的属性信息中的标签信息进行匹配,将中间级有向图根节点集合中的各个中间级有向图根节点的位置与中间级有向图左值节点集合中的各个中间级有向图左值节点的位置相对应;以及将以相应的匹配位置处的中间级有向图根节点为根节点的子有向图抽出作为第二级有向图以根据第二级有向图来确定中间级左值节点对应的单元格的第二级复合运算符。According to some embodiments of the present application, the formula translator 1305 may also be configured to: combine the label information in the attribute information of the root node of each intermediate-level directed graph with the attribute information of the left-value node of each intermediate-level directed graph. The label information in the middle-level directed graph is matched, and the position of each intermediate-level directed graph root node in the intermediate-level directed graph root node set is matched with the position of each intermediate-level directed graph left-value node in the intermediate-level directed graph left-value node set Position correspondence; and extracting the sub-directed graph with the root node of the intermediate-level directed graph at the corresponding matching position as the root node as the second-level directed graph to determine the intermediate-level left value according to the second-level directed graph The second level compound operator of the cell corresponding to the node.
根据本申请的一些实施例,用于生成电子表格公式的装置1300还可以包括电子表格公式写入器1309,所述电子表格公式写入器1309可以被配置为:将所生成的用于所述一个或多个第一单元格中的每个第一单元格的电子表格公式存储到电子表格文件中的相应单元格中。According to some embodiments of the present application, the apparatus 1300 for generating an electronic form formula may further include an electronic form formula writer 1309, and the electronic form formula writer 1309 may be configured to use the generated formula for the The spreadsheet formula of each of the one or more first cells is stored in the corresponding cell in the spreadsheet file.
根据本申请的一些实施例,所述自定义原子运算符可以是通过对系统预设的原子运算符进行组合而定义的。According to some embodiments of the present application, the custom atomic operator may be defined by combining the atomic operators preset by the system.
根据本申请的一些实施例,所述公式转译器1305还可以被配置为:在用于电子表格的层级公式中包括所述自定义原子运算符的情况下,将所述自定义原子运算符转换为系统预设的原子运算符。According to some embodiments of the present application, the formula translator 1305 may be further configured to convert the custom atomic operator when the custom atomic operator is included in the hierarchical formula used in the spreadsheet. Atomic operator preset for the system.
根据本申请的一些实施例,所述公式转译器1305还可以被配置为:将层级公式 的原始有向图中的所述自定义原子运算符替换为代表所述自定义原子运算符的有向图的根节点;以及用层级公式的原始有向图中的以所述自定义原子运算符为父节点的子有向图来替换所述自定义原子运算符的有向图中的叶子节点。According to some embodiments of the present application, the formula translator 1305 may also be configured to: replace the custom atomic operator in the original directed graph of the hierarchical formula with a directed The root node of the graph; and the child directed graph with the custom atomic operator as the parent node in the original directed graph of the hierarchical formula is used to replace the leaf nodes in the directed graph of the custom atomic operator.
根据本申请的一些实施例,用于生成电子表格公式的装置1300还可以包括智能建议模块1311,所述智能建议模块1311可以被配置为:基于已经获取的所述层级公式,更新智能建议知识库,所述智能建议知识库包括与所述层级公式或者层级结构有关的信息;以及基于所述智能建议知识库,在将要获取新的层级公式时进行智能建议。According to some embodiments of the present application, the apparatus 1300 for generating an electronic form formula may further include an intelligent suggestion module 1311, and the intelligent suggestion module 1311 may be configured to update the intelligent suggestion knowledge base based on the obtained hierarchical formula The intelligent suggestion knowledge base includes information related to the hierarchical formula or hierarchical structure; and based on the intelligent suggestion knowledge base, intelligent suggestions are made when a new hierarchical formula is about to be obtained.
根据本申请的一些实施例,用于生成电子表格公式的装置1300还可以包括缺陷检测模块1313,所述缺陷检测模块1313可以被配置为:自动检测所获取的所述层级公式中存在的缺陷;以及基于所述缺陷自动生成调试信息并且提示所述调试信息,其中,所述调试信息包括错误或警告。According to some embodiments of the present application, the apparatus 1300 for generating an electronic form formula may further include a defect detection module 1313, and the defect detection module 1313 may be configured to automatically detect defects existing in the acquired hierarchical formula; And automatically generate debugging information based on the defect and prompt the debugging information, wherein the debugging information includes errors or warnings.
根据本申请的一些实施例,用于生成电子表格公式的装置1300还可以包括电子表格模型存储模块1315,所述电子表格模型存储模块1315可以被配置为存储电子表格模型,所述电子表格模型包括以下各项中的一个或多个:用于电子表格的层级结构、用于电子表格的层级计算图和电子表格文件。According to some embodiments of the present application, the apparatus 1300 for generating spreadsheet formulas may further include a spreadsheet model storage module 1315, and the spreadsheet model storage module 1315 may be configured to store a spreadsheet model, the spreadsheet model including One or more of the following: hierarchical structure for spreadsheets, hierarchical calculation diagrams for spreadsheets, and spreadsheet files.
根据本申请的一些实施例,用于生成电子表格公式的装置1300还可以包括电子表格模型导入导出模块1317,所述电子表格模型导入导出模块1317可以被配置为导入和/或导出所述电子表格模型。According to some embodiments of the present application, the apparatus 1300 for generating spreadsheet formulas may further include a spreadsheet model import/export module 1317, and the spreadsheet model import/export module 1317 may be configured to import and/or export the spreadsheet model.
根据本申请的一些实施例,所述文本编辑器可以被配置为:对所述文本代码进行分词以得到分词流;识别所述分词流中与所述运算符相关的分词,以确定所述运算符;识别所述分词流中与所述电子表格的层级结构中的所述一个或多个层级中的所述一个或多个节点相关的分词,以确定所述层级引用;以及根据所确定的运算符和层级引用来生成所述层级公式。According to some embodiments of the present application, the text editor may be configured to: perform word segmentation on the text code to obtain a word segmentation stream; identify the word segmentation related to the operator in the word segmentation stream to determine the operation Identify the word segmentation related to the one or more nodes in the one or more levels in the hierarchy structure of the spreadsheet in the word segmentation stream to determine the level reference; and according to the determined Operators and hierarchical references are used to generate the hierarchical formula.
根据本申请的一些实施例,所述复合运算符可以采用以下各项中的一个或多个来存储:字符串;由函数指针指向的计算机实现的函数;和有向图。According to some embodiments of the present application, the compound operator may use one or more of the following items to store: a character string; a computer-implemented function pointed to by a function pointer; and a directed graph.
根据本申请的一些实施例,所述有向图中的各个节点可以代表所述层级公式中的所述运算符,以及所述有向图中的各个节点之间的有向边可以代表所述层级公式中的所述运算符之间的组合关系。According to some embodiments of the present application, each node in the directed graph may represent the operator in the hierarchical formula, and the directed edge between each node in the directed graph may represent the The combination relationship between the operators in the hierarchy formula.
根据本申请的一些实施例,所述电子表格公式写入器1309还可以被配置为:对所述电子表格中的所述一个或多个第一单元格和所述一个或多个第二单元格中的一 部分或全部的单元格名称进行自动命名;以及利用自动命名的单元格名称来改写所述电子表格公式并且存储改写后的电子表格公式。According to some embodiments of the present application, the spreadsheet formula writer 1309 may also be configured to: compare the one or more first cells and the one or more second cells in the spreadsheet Part or all of the cell names in the grid are automatically named; and the automatically named cell names are used to rewrite the spreadsheet formula and store the rewritten spreadsheet formula.
注意,图13中的层级计算图存储器1307、电子表格公式写入器1309、智能建议模块1311、缺陷检测模块1313、电子表格模型存储模块1315和电子表格模型导入导出模块1317为可选的,因此其方框为虚线。Note that the hierarchical calculation graph memory 1307, the spreadsheet formula writer 1309, the smart suggestion module 1311, the defect detection module 1313, the spreadsheet model storage module 1315, and the spreadsheet model import/export module 1317 in Figure 13 are optional, so The box is a dashed line.
注意,用于生成电子表格公式的装置1300的具体细节可以参考上面针对用于生成电子表格公式的计算机实现的方法的详细描述,其具体内容在此不再赘述。Note that for the specific details of the apparatus 1300 for generating electronic form formulas, reference may be made to the above detailed description of the computer-implemented method for generating electronic form formulas, and the specific content is not repeated here.
本申请支持以层级公式的形式输入电子表格模型中层级之间的计算关系,并根据其批量生成电子表格公式,具有直观、自动、可复用、不易出错中至少一者的优点。用于层级公式的左值和参数都是电子表格的层级,层级引用具有清晰的语义,可以通过层级引用的名称直观看出该层级的意义,所以层级公式比电子表格格式的公式更加直观。层级公式可以批量自动生成电子表格公式,在一些实现方式中,甚至可以自动生成或者向用户提示层级公式,所以该方法是自动且智能的。由于层级公式具有清晰的语义,而这些语义是相对固定的,所以层级公式可以被复用,一个电子表格模型中的层级公式可以被复用到其他电子表格模型而不会出现逻辑错误。本申请还可以包括调试功能,可以识别电子表格模型中可能的错误,给出相应的调试信息,所以使用本申请生成电子表格公式不易出错。This application supports inputting calculation relationships between levels in an electronic form model in the form of level formulas, and generating electronic form formulas in batches based on them, which has the advantages of at least one of intuitive, automatic, reusable, and less error-prone. The lvalues and parameters used in the level formula are all levels of the spreadsheet. The level reference has clear semantics. The meaning of the level can be intuitively seen through the name of the level reference. Therefore, the level formula is more intuitive than the formula in the spreadsheet format. Hierarchical formulas can automatically generate spreadsheet formulas in batches. In some implementations, even hierarchical formulas can be automatically generated or prompted to users, so this method is automatic and intelligent. Since the hierarchical formulas have clear semantics and these semantics are relatively fixed, the hierarchical formulas can be reused, and the hierarchical formulas in one spreadsheet model can be reused to other spreadsheet models without logic errors. This application may also include a debugging function, which can identify possible errors in the electronic form model and provide corresponding debugging information. Therefore, it is not easy to make mistakes in the electronic form formula generated by this application.
图14是示出可用于实施根据本申请的一些实施例的用于生成电子表格公式的信息处理设备的示意性框图。Fig. 14 is a schematic block diagram showing an information processing device that can be used to implement an electronic form formula according to some embodiments of the present application.
在图14中,中央处理单元(CPU)1401根据只读存储器(ROM)1402中存储的程序或从存储部分1408加载到随机存取存储器(RAM)1403的程序执行各种处理。在RAM 1403中,也根据需要存储当CPU 1401执行各种处理等等时所需的数据。CPU 1401、ROM 1402和RAM 1403经由总线1404彼此连接。输入/输出接口1405也连接到总线1404。In FIG. 14, a central processing unit (CPU) 1401 performs various processes in accordance with a program stored in a read only memory (ROM) 1402 or a program loaded from a storage portion 1408 to a random access memory (RAM) 1403. In the RAM 1403, data required when the CPU 1401 executes various processes and the like is also stored as needed. The CPU 1401, the ROM 1402, and the RAM 1403 are connected to each other via a bus 1404. The input/output interface 1405 is also connected to the bus 1404.
下述部件连接到输入/输出接口1405:输入部分1406(包括键盘、鼠标等等)、输出部分1407(包括显示器,比如阴极射线管(CRT)、液晶显示器(LCD)等,和扬声器等)、存储部分1408(包括硬盘等)、通信部分1409(包括网络接口卡比如LAN卡、调制解调器等)。通信部分1409经由网络比如因特网执行通信处理。根据需要,驱动器1410也可连接到输入/输出接口1405。可拆卸介质1411比如磁盘、光盘、磁光盘、半导体存储器等等根据需要被安装在驱动器1410上,使得从中读出的计算机 程序根据需要被安装到存储部分1408中。The following components are connected to the input/output interface 1405: input part 1406 (including keyboard, mouse, etc.), output part 1407 (including display, such as cathode ray tube (CRT), liquid crystal display (LCD), etc., and speakers, etc.), Storage part 1408 (including hard disk, etc.), communication part 1409 (including network interface card such as LAN card, modem, etc.). The communication section 1409 performs communication processing via a network such as the Internet. The driver 1410 can also be connected to the input/output interface 1405 according to needs. Removable media 1411 such as magnetic disks, optical disks, magneto-optical disks, semiconductor memories, etc. are mounted on the drive 1410 as needed, so that the computer programs read from them are installed into the storage portion 1408 as needed.
在通过软件实现上述系列处理的情况下,从网络比如因特网或存储介质比如可拆卸介质1411安装构成软件的程序。In the case of implementing the above-mentioned series of processing by software, a program constituting the software is installed from a network such as the Internet or a storage medium such as a removable medium 1411.
本领域的技术人员应当理解,这种存储介质不局限于图14所示的其中存储有程序、与设备相分离地分发以向用户提供程序的可拆卸介质1411。可拆卸介质1411的例子包含磁盘(包含软盘(注册商标))、光盘(包含光盘只读存储器(CD-ROM)和数字通用盘(DVD))、磁光盘(包含迷你盘(MD)(注册商标))和半导体存储器。或者,存储介质可以是ROM 1402、存储部分1408中包含的硬盘等等,其中存有程序,并且与包含它们的设备一起被分发给用户。Those skilled in the art should understand that this storage medium is not limited to the removable medium 1411 shown in FIG. 14 where the program is stored and distributed separately from the device to provide the program to the user. Examples of removable media 1411 include magnetic disks (including floppy disks (registered trademarks)), optical disks (including compact disk read-only memory (CD-ROM) and digital versatile disks (DVD)), magneto-optical disks (including mini disks (MD) (registered trademarks) )) and semiconductor memory. Alternatively, the storage medium may be a ROM 1402, a hard disk included in the storage portion 1408, etc., in which programs are stored and distributed to users together with the devices containing them.
所述指令代码由机器读取并执行时,可执行上述根据本申请实施例的方法。When the instruction code is read and executed by a machine, the above-mentioned method according to the embodiment of the present application can be executed.
可以以一种或多种程序设计语言的任意组合来编写用于执行本申请各个方面的操作的计算机程序代码,所述程序设计语言包括面向对象的程序设计语言—诸如Java、Smalltalk、C++等,还包括常规的过程式程序设计语言—诸如“C”语言或类似的程序设计语言。程序代码可以完全地在用户计算机上执行、部分地在用户计算机上执行、作为一个独立的软件包执行、部分在用户计算机上部分在远程计算机上执行、或者完全在远程计算机或服务器上执行。在涉及远程计算机的情形中,远程计算机可以通过任意种类的网络——包括局域网(LAN)或广域网(WAN)—连接到用户计算机,或者,可以连接到外部计算机(例如利用因特网服务提供商来通过因特网连接)。The computer program code used to perform the operations of the various aspects of the application can be written in any combination of one or more programming languages. The programming languages include object-oriented programming languages—such as Java, Smalltalk, C++, etc., Also includes conventional procedural programming languages-such as "C" language or similar programming languages. The program code can be executed entirely on the user's computer, partly on the user's computer, executed as an independent software package, partly on the user's computer and partly executed on a remote computer, or entirely executed on the remote computer or server. In the case of a remote computer, the remote computer can 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 it can be connected to an external computer (for example, using an Internet service provider to pass Internet connection).
应当理解,流程图和/或框图的每个方框以及流程图和/或框图中各方框的组合,都可以由计算机程序指令实现。这些计算机程序指令可以提供给通用计算机、专用计算机或其它可编程数据处理装置的处理器,从而生产出一种机器,使得这些计算机程序指令在通过计算机或其它可编程数据处理装置的处理器执行时,产生了实现流程图和/或框图中的一个或多个方框中规定的功能/动作的装置。It should be understood that each block of the flowchart and/or block diagram and the combination of each block in the flowchart and/or block diagram can be implemented by computer program instructions. These computer program instructions can be provided to the processors of general-purpose computers, special-purpose computers, or other programmable data processing devices, thereby producing a machine that makes these computer program instructions when executed by the processors of the computer or other programmable data processing devices , A device that implements the functions/actions specified in one or more blocks in the flowcharts and/or block diagrams is produced.
也可以把这些计算机程序指令存储在计算机可读介质中,这些指令使得计算机、其它可编程数据处理装置、或其他设备以特定方式工作,从而,存储在计算机可读介质中的指令就产生出包括实现流程图和/或框图中的一个或多个方框中规定的功能/动作的指令的制造品(article of manufacture)。It is also possible to store these computer program instructions in a computer-readable medium. These instructions make computers, other programmable data processing devices, or other devices work in a specific manner, so that the instructions stored in the computer-readable medium generate An article of manufacture that implements instructions for the functions/actions specified in one or more blocks in the flowchart and/or block diagram.
也可以把计算机程序指令加载到计算机、其它可编程数据处理装置、或其它设备上,使得在计算机、其它可编程数据处理装置或其它设备上执行一系列操作步骤,以产生计算机实现的过程,从而使得在计算机或其它可编程装置上执行的指令能够提供 实现流程图和/或框图中的方框中规定的功能/操作的过程。It is also possible to load computer program instructions onto a computer, other programmable data processing device, or other equipment, so that a series of operation steps are executed on the computer, other programmable data processing device, or other equipment to produce a computer-implemented process, thereby The instructions executed on the computer or other programmable device can provide a process for realizing the functions/operations specified in the blocks in the flowcharts and/or block diagrams.
附图中的流程图和框图显示了根据本申请的多个实施例的系统、方法和计算机程序产品的可能实现的体系架构、功能和操作。在这点上,流程图或框图中的每个方框可以代表一个模块、程序段或代码的一部分,所述模块、程序段或代码的一部分包含一个或多个用于实现规定的逻辑功能的可执行指令。也应当注意,在有些作为替换的实现中,方框中所标注的功能也可以以不同于附图中所标注的顺序发生。例如,两个连续的方框实际上可以基本并行地执行,它们有时也可以按相反的顺序执行,这依所涉及的功能而定。也要注意的是,框图和/或流程图中的每个方框、以及框图和/或流程图中的方框的组合,可以用执行规定的功能或动作的专用的基于硬件的系统来实现,或者可以用专用硬件与计算机指令的组合来实现。The flowcharts and block diagrams in the accompanying drawings show the possible implementation architecture, functions, and operations of the system, method, and computer program product according to multiple embodiments of the present application. In this regard, each block in the flowchart or block diagram may represent a module, program segment, or part of the code, and the module, program segment, or part of the code contains one or more functions for realizing the specified logic function. Executable instructions. It should also be noted that, in some alternative implementations, the functions marked in the block may also occur in a different order from the order marked in the drawings. For example, two consecutive blocks can actually be executed substantially in parallel, or they can sometimes be executed in the reverse order, depending on the functions involved. It should also be noted that each block in the block diagram and/or flowchart, and the combination of the blocks in the block diagram and/or flowchart, can be implemented by a dedicated hardware-based system that performs the specified functions or actions Or it can be realized by a combination of dedicated hardware and computer instructions.
注意,为了避免遮蔽本申请的构思,没有描述本领域所公知的一些细节。本领域技术人员根据上面的描述,完全可以明白如何实施这里公开的技术方案。Note that in order to avoid obscuring the concept of this application, some details that are well known in the art are not described. Based on the above description, those skilled in the art can fully understand how to implement the technical solutions disclosed herein.
本申请也可以被配置如下:This application can also be configured as follows:
(1)一种用于生成电子表格公式的计算机实现的方法,所述方法包括:(1) A computer-implemented method for generating spreadsheet formulas, the method comprising:
获取用于所述电子表格的层级公式,所述层级公式包括运算符和层级引用,其中所述层级引用对应于用于电子表格的层级结构中的一个或多个层级中的一个或多个节点,其中每个层级具有至少一个节点并且具有相应的层级类型,每个节点对应于所述电子表格中的一个或多个单元格,其中所述层级结构还包括所述一个或多个节点之间的隶属关系;Acquire a hierarchical formula for the electronic form, the hierarchical formula including an operator and a hierarchical reference, wherein the hierarchical reference corresponds to one or more nodes in one or more levels in the hierarchical structure of the electronic form , Wherein each level has at least one node and has a corresponding level type, and each node corresponds to one or more cells in the spreadsheet, wherein the level structure further includes the one or more nodes Affiliation;
基于所述层级引用与所述一个或多个节点之间的对应关系来确定所述一个或多个节点之间的依赖关系;Determine the dependency relationship between the one or more nodes based on the correspondence relationship between the hierarchical reference and the one or more nodes;
基于所述运算符和所述依赖关系来确定所述一个或多个节点之间的计算关系;以及Determining the calculation relationship between the one or more nodes based on the operator and the dependency relationship; and
至少基于用于所述电子表格的所述层级结构和所述计算关系来生成所述电子表格公式。The spreadsheet formula is generated based at least on the hierarchical structure and the calculation relationship for the spreadsheet.
(2)根据(1)所述的方法,其中,所述获取用于所述电子表格的层级公式的步骤包括:(2) The method according to (1), wherein the step of obtaining the hierarchical formula for the electronic form includes:
提供图形用户界面编辑器,其中所述图形用户界面编辑器包括用于指定不同层级的节点和/或运算符的组件;Provide a graphical user interface editor, wherein the graphical user interface editor includes components for specifying nodes and/or operators at different levels;
接收针对用于指定不同层级的节点和/或运算符的组件的输入;以及Receive input for components used to specify nodes and/or operators at different levels; and
基于所述输入来生成所述层级公式。The hierarchical formula is generated based on the input.
(3)根据(1)所述的方法,其中,所述获取用于所述电子表格的层级公式的步骤包括:(3) The method according to (1), wherein the step of obtaining a hierarchical formula for the electronic form includes:
接收用户输入的文本代码;以及Receive the text code entered by the user; and
解析所述文本代码以生成所述层级公式。The text code is parsed to generate the hierarchical formula.
(4)根据(1)所述的方法,其中,所述运算符包括原子运算符,所述原子运算符包括以下各项中的一种或多种:数学运算符、数学函数、常量、系统定义函数、用户自定义原子运算符。(4) The method according to (1), wherein the operators include atomic operators, and the atomic operators include one or more of the following: mathematical operators, mathematical functions, constants, systems Define functions and user-defined atomic operators.
(5)根据(4)所述的方法,还包括:(5) The method according to (4), further including:
根据所述层级公式中的所述原子运算符来构建复合运算符,其中,所述复合运算符包括所述层级公式中的所有原子运算符的组合。A compound operator is constructed according to the atomic operator in the hierarchical formula, wherein the compound operator includes a combination of all the atomic operators in the hierarchical formula.
(6)根据(5)所述的方法,其中,所述基于所述运算符和所述依赖关系来确定所述一个或多个节点之间的计算关系的步骤还包括:(6) The method according to (5), wherein the step of determining the calculation relationship between the one or more nodes based on the operator and the dependency relationship further includes:
至少基于所述复合运算符和所述依赖关系来确定所述一个或多个节点之间的计算关系。The calculation relationship between the one or more nodes is determined based on at least the compound operator and the dependency relationship.
(7)根据(1)至(6)中任一项所述的方法,其中,所述层级引用包括位于所述层级公式中的等号左侧的第一层级引用和位于所述层级公式中的等号右侧的第二层级引用,其中,第一层级引用对应于所述一个或多个节点中的第一节点,而第二层级引用对应于所述一个或多个节点中的第二节点。(7) The method according to any one of (1) to (6), wherein the level reference includes the first level reference located to the left of the equal sign in the level formula and the first level reference located in the level formula The second-level reference on the right side of the equal sign of, where the first-level reference corresponds to the first of the one or more nodes, and the second-level reference corresponds to the second of the one or more nodes node.
(8)根据(7)所述的方法,其中,所述基于所述层级引用与所述一个或多个节点之间的对应关系来确定所述一个或多个节点之间的依赖关系的步骤包括:(8) The method according to (7), wherein the step of determining the dependency relationship between the one or more nodes based on the correspondence relationship between the hierarchical reference and the one or more nodes include:
至少基于第一层级引用与第一节点之间的对应关系以及第二层级引用与第二节点之间的对应关系来确定第一节点与第二节点之间的依赖关系。The dependency relationship between the first node and the second node is determined based at least on the correspondence between the first-level reference and the first node and the correspondence between the second-level reference and the second node.
(9)根据(1)至(6)中任一项所述的方法,还包括:(9) The method according to any one of (1) to (6), further comprising:
针对所述一个或多个节点中的每个节点,经由层级计算图存储该节点与其他节点之间的计算关系。For each node of the one or more nodes, the calculation relationship between the node and other nodes is stored via a hierarchical calculation graph.
(10)根据(8)所述的方法,其中,所述基于所述运算符和所述依赖关系来确定所述一个或多个节点之间的计算关系包括:(10) The method according to (8), wherein the determining the calculation relationship between the one or more nodes based on the operator and the dependency relationship includes:
基于所述运算符以及第一节点与第二节点之间的依赖关系来确定第一节点与第二节点之间的计算关系。The calculation relationship between the first node and the second node is determined based on the operator and the dependency relationship between the first node and the second node.
(11)根据(10)所述的方法,还包括:(11) The method according to (10), further comprising:
针对第一节点,经由层级计算图存储第一节点与第二节点之间的计算关系。For the first node, the calculation relationship between the first node and the second node is stored via the hierarchical calculation graph.
(12)根据(1)至(6)中任一项所述的方法,其中,所述至少基于用于所述电子表格的所述层级结构和所述计算关系来生成所述电子表格公式包括:(12) The method according to any one of (1) to (6), wherein the generating the spreadsheet formula based at least on the hierarchical structure for the spreadsheet and the calculation relationship includes :
对于所述一个或多个节点中的每个当前节点,基于所述一个或多个节点中的该当前节点与其他节点之间的计算关系来确定该当前节点所对应的一个或多个第一单元格中的每个第一单元格与其他节点所对应的一个或多个第二单元格中的每个第二单元格之间的计算关系;以及For each current node in the one or more nodes, one or more first nodes corresponding to the current node are determined based on the calculation relationship between the current node and other nodes in the one or more nodes. The calculation relationship between each first cell in the cell and each second cell in the one or more second cells corresponding to other nodes; and
至少基于所述一个或多个第一单元格中的每个第一单元格与所述一个或多个第二单元格中的每个第二单元格之间的计算关系,生成用于所述一个或多个第一单元格中的每个第一单元格的电子表格公式。Based on at least the calculated relationship between each first cell in the one or more first cells and each second cell in the one or more second cells, the The spreadsheet formula for each of the one or more first cells.
(13)根据(12)所述的方法,其中,所述确定该当前节点所对应的一个或多个第一单元格中的每个第一单元格与其他节点所对应的一个或多个第二单元格中的每个第二单元格之间的计算关系的步骤包括:(13) The method according to (12), wherein the determining that each of the one or more first cells corresponding to the current node corresponds to one or more first cells corresponding to other nodes The steps of calculating the relationship between each second cell in the second cell include:
至少基于所述一个或多个节点中的该当前节点所对应的运算符,确定该当前节点所对应的一个或多个第一单元格中的每个第一单元格所对应的运算符;以及Determine the operator corresponding to each first cell in the one or more first cells corresponding to the current node based at least on the operator corresponding to the current node in the one or more nodes; and
至少基于所述一个或多个节点中的该当前节点与其他节点之间的依赖关系,确定该当前节点所对应的一个或多个第一单元格中的每个第一单元格与其他节点所对应的一个或多个第二单元格中的每个第二单元格之间的依赖关系。At least based on the dependency relationship between the current node and other nodes in the one or more nodes, it is determined that each first cell of the one or more first cells corresponding to the current node is connected to other nodes. Corresponding to the dependency relationship between each second cell in one or more second cells.
(14)根据(13)所述的方法,其中,所述生成用于所述一个或多个第一单元格中的每个第一单元格的电子表格公式的步骤包括:(14) The method according to (13), wherein the step of generating a spreadsheet formula for each first cell of the one or more first cells includes:
至少基于该当前节点所对应的一个或多个第一单元格中的每个第一单元格所对应的运算符、以及该当前节点所对应的一个或多个第一单元格中的每个第一单元格与其他节点所对应的一个或多个第二单元格中的每个第二单元格之间的依赖关系,生成用于所述一个或多个第一单元格中的每个第一单元格的电子表格公式。At least based on the operator corresponding to each first cell in the one or more first cells corresponding to the current node, and each first cell in the one or more first cells corresponding to the current node The dependency relationship between a cell and each second cell in one or more second cells corresponding to other nodes is generated for each first cell in the one or more first cells Spreadsheet formula for the cell.
(15)根据(14)所述的方法,其中,(15) The method according to (14), wherein:
所述一个或多个节点中的该当前节点所对应的运算符是与用于所述电子表格的层级结构中的所述一个或多个节点中的一个节点相对应的第一级复合运算符,第一级复合运算符包括一个或多个第一级原子运算符;The operator corresponding to the current node in the one or more nodes is a first-level compound operator corresponding to one of the one or more nodes in the hierarchical structure of the spreadsheet , The first-level compound operator includes one or more first-level atomic operators;
所述一个或多个第一单元格中的每个第一单元格所对应的运算符是与所述电子 表格中的所述一个或多个单元格中的一个单元格相对应的第二级复合运算符,第二级复合运算符包括一个或多个第二级原子运算符;以及The operator corresponding to each first cell in the one or more first cells is the second level corresponding to one cell in the one or more cells in the spreadsheet Compound operators, the second-level compound operators include one or more second-level atomic operators; and
至少基于所述一个或多个节点中的该当前节点所对应的第一级复合运算符,确定该当前节点所对应的一个或多个第一单元格中的每个第一单元格所对应的第二级复合运算符。Based on at least the first-level compound operator corresponding to the current node in the one or more nodes, determine the corresponding one of the one or more first cells corresponding to the current node The second level compound operator.
(16)根据(15)所述的方法,其中,(16) The method according to (15), wherein
第一级复合运算符采用第一级有向图来存储,第一级有向图中的各个有向图节点代表第一级复合运算符中的各个第一级原子运算符,以及第一级有向图中的各个有向图节点之间的有向边代表第一级复合运算符中的各个第一级原子运算符之间的组合关系;The first-level compound operator uses the first-level directed graph for storage. Each directed graph node in the first-level directed graph represents each first-level atomic operator in the first-level compound operator, and the first-level The directed edges between each directed graph node in the directed graph represent the combination relationship between each first-level atomic operator in the first-level compound operator;
第二级复合运算符采用第二级有向图来存储,第二级有向图中的各个有向图节点代表第二级复合运算符中的各个第二级原子运算符,以及第二级有向图中的各个有向图节点之间的有向边代表第二级复合运算符中的各个第二级原子运算符之间的组合关系;以及The second-level compound operator uses a second-level directed graph for storage. Each directed graph node in the second-level directed graph represents each second-level atomic operator in the second-level compound operator, and the second-level The directed edges between each directed graph node in the directed graph represent the combination relationship between each second-level atomic operator in the second-level compound operator; and
通过遍历与第一级复合运算符相对应的第一级有向图来确定第二级有向图,并且根据第二级有向图来确定第二级复合运算符。The second-level directed graph is determined by traversing the first-level directed graph corresponding to the first-level compound operator, and the second-level compound operator is determined according to the second-level directed graph.
(17)根据(16)所述的方法,其中,所述通过遍历与第一级复合运算符相对应的第一级有向图来确定第二级有向图包括:(17) The method according to (16), wherein the determining the second-level directed graph by traversing the first-level directed graph corresponding to the first-level compound operator includes:
按照后序遍历的顺序来遍历第一级有向图,从而先遍历第一级有向图中的子有向图节点,再遍历第一级有向图中的父有向图节点。Traverse the first-level directed graph in the order of post-order traversal, so that the child directed graph nodes in the first-level directed graph are traversed first, and then the parent directed graph nodes in the first-level directed graph are traversed.
(18)根据(17)所述的方法,还包括:(18) The method according to (17), further comprising:
在遍历到第一级有向图中的一个或多个第一级有向图节点中的当前第一级有向图节点时,根据当前第一级有向图节点所代表的第一级原子运算符、以及当前第一级有向图节点的第一级子有向图节点的属性信息来确定当前第一级有向图节点的属性信息,其中,每个第一级有向图节点的属性信息包括以下各项中的一种或多种:电子表格中的单元格的位置信息,与电子表格中的单元格相对应的标签信息和电子表格中的单元格的位置信息,与电子表格中的单元格相对应的标签信息和中间级节点,与电子表格中的单元格相对应的中间级节点,其中所述中间级节点用以存储中间计算结果;When traversing to the current first-level directed graph node in one or more first-level directed graph nodes in the first-level directed graph, according to the first-level atom represented by the current first-level directed graph node Operator and the attribute information of the first-level child directed graph node of the current first-level directed graph node to determine the attribute information of the current first-level directed graph node. The attribute information includes one or more of the following items: the location information of the cells in the spreadsheet, the label information corresponding to the cells in the spreadsheet, and the location information of the cells in the spreadsheet, and the location information of the cells in the spreadsheet. Label information and intermediate nodes corresponding to the cells in, and intermediate nodes corresponding to the cells in the spreadsheet, wherein the intermediate nodes are used to store intermediate calculation results;
根据第一级有向图中的所述一个或多个第一级有向图节点中的每个第一级有向 图节点的属性信息来确定中间级有向图中的各个中间级有向图节点集合,根据第一级有向图中的所述一个或多个第一级有向图节点之间的依赖关系来确定中间级有向图中的每个中间级有向图节点集合中的各个中间级有向图节点与中间级有向图中的其他中间级有向图节点集合中的各个中间级有向图节点之间的依赖关系。According to the attribute information of each first-level directed graph node in the one or more first-level directed graph nodes in the first-level directed graph, each intermediate-level directed graph in the intermediate-level directed graph is determined The graph node set is determined according to the dependency relationship between the one or more first-level directed graph nodes in the first-level directed graph in each intermediate-level directed graph node set in the intermediate-level directed graph The dependency between each intermediate-level directed graph node in the intermediate-level directed graph and each intermediate-level directed graph node in the set of other intermediate-level directed graph nodes in the intermediate-level directed graph.
(19)根据(18)所述的方法,其中,第一级原子运算符被划分为逐元素原子运算符、降维原子运算符、错位原子运算符、和用户自定义原子运算符中的一种。(19) The method according to (18), wherein the first-level atomic operators are divided into one of element-wise atomic operators, dimensionality reduction atomic operators, misplaced atomic operators, and user-defined atomic operators. Kind.
(20)根据(19)所述的方法,其中,当遍历到的第一级有向图中的当前第一级有向图节点所代表的第一级原子运算符为逐元素原子运算符时,(20) The method according to (19), wherein, when the first-level atomic operator represented by the current first-level directed graph node in the traversed first-level directed graph is an element-wise atomic operator ,
如果该当前第一级有向图节点的各个第一级子有向图节点的属性信息都包含与电子表格中的单元格相对应的标签信息,则根据各个第一级子有向图节点的属性信息中所包含的标签信息的交集设置该当前第一级有向图节点的属性信息中的标签信息,根据该当前第一级有向图节点所代表的第一级原子运算符设置该当前第一级有向图节点的属性信息中的中间级原子运算符,根据该当前第一级有向图节点的属性信息中的标签信息和中间级原子运算符来确定与该当前第一级有向图节点相对应的当前中间级有向图节点集合,以及至少根据该当前第一级有向图节点与其第一级子有向图节点之间的依赖关系并且根据该当前第一级有向图节点与其第一级子有向图节点的属性信息中的标签信息来确定与该当前第一级有向图节点相对应的当前中间级有向图节点集合中的各个中间级有向图节点与中间级有向图中的其他中间级有向图节点集合中的各个中间级有向图节点之间的依赖关系;If the attribute information of each first-level sub-directed graph node of the current first-level directed graph node contains the label information corresponding to the cell in the spreadsheet, then the attribute information of each first-level sub-directed graph node The intersection of the label information contained in the attribute information sets the label information in the attribute information of the current first-level directed graph node, and sets the current first-level atomic operator represented by the current first-level directed graph node. The intermediate-level atomic operator in the attribute information of the first-level directed graph node is determined to be related to the current first-level based on the label information and the intermediate-level atomic operator in the attribute information of the current first-level directed graph node. The current intermediate-level directed graph node set corresponding to the directed graph node, and at least according to the dependency relationship between the current first-level directed graph node and its first-level child directed graph nodes, and according to the current first-level directed graph node The label information in the attribute information of the graph node and its first-level child directed graph node is used to determine each intermediate-level directed graph node in the current intermediate-level directed graph node set corresponding to the current first-level directed graph node The dependency relationship between each intermediate-level directed graph node in the set of other intermediate-level directed graph nodes in the intermediate-level directed graph;
如果该当前第一级有向图节点的各个第一级子有向图节点的属性信息都不包含标签信息,则使得该当前第一级有向图节点的属性信息中不包含标签信息,根据该当前第一级有向图节点所代表的第一级原子运算符设置该当前第一级有向图节点的属性信息中的中间级原子运算符,至少根据该当前第一级有向图节点的属性信息中的中间级原子运算符来确定与该当前第一级有向图节点相对应的当前中间级有向图节点集合,以及至少根据该当前第一级有向图节点与其第一级子有向图节点之间的依赖关系来确定与该当前第一级有向图节点相对应的当前中间级有向图节点集合中的各个中间级有向图节点与中间级有向图中的其他中间级有向图节点集合中的各个中间级有向图节点之间的依赖关系;If the attribute information of each first-level child directed graph node of the current first-level directed graph node does not contain label information, then the attribute information of the current first-level directed graph node does not include label information, according to The first-level atomic operator represented by the current first-level directed graph node sets the intermediate-level atomic operator in the attribute information of the current first-level directed graph node, at least according to the current first-level directed graph node The intermediate-level atomic operator in the attribute information of the current first-level directed graph node is used to determine the current intermediate-level directed graph node set corresponding to the current first-level directed graph node, and at least according to the current first-level directed graph node and its first-level The dependency relationship between the sub-directed graph nodes is used to determine the current intermediate-level directed graph node corresponding to the current first-level directed graph node in each intermediate-level directed graph node and the intermediate-level directed graph. The dependency relationship between each intermediate-level directed graph node in the set of other intermediate-level directed graph nodes;
如果该当前第一级有向图节点的一部分第一级子有向图节点的属性信息包含与电子表格中的单元格相对应的标签信息并且该当前第一级有向图节点的另一部分第 一级子有向图节点的属性信息不包含标签信息,则根据包含标签信息的第一级子有向图节点的属性信息中所包含的标签信息的交集设置该当前第一级有向图节点的属性信息中的标签信息,根据该当前第一级有向图节点所代表的第一级原子运算符设置该当前第一级有向图节点的属性信息中的中间级原子运算符,根据该当前第一级有向图节点的属性信息中的标签信息和中间级原子运算符来确定与该当前第一级有向图节点相对应的当前中间级有向图节点集合,以及至少根据该当前第一级有向图节点与其第一级子有向图节点之间的依赖关系并且根据该当前第一级有向图节点与其第一级子有向图节点的属性信息中的标签信息来确定与该当前第一级有向图节点相对应的当前中间级有向图节点集合中的各个中间级有向图节点与中间级有向图中的其他中间级有向图节点集合中的各个中间级有向图节点之间的依赖关系。If the attribute information of a part of the current first-level directed graph node of the first-level child directed graph node contains the label information corresponding to the cell in the spreadsheet and the other part of the current first-level directed graph node is the first If the attribute information of the first-level child directed graph node does not contain label information, the current first-level directed graph node is set according to the intersection of the label information contained in the attribute information of the first-level child directed graph node containing the label information According to the label information in the attribute information of the current first-level directed graph node, the intermediate-level atomic operator in the attribute information of the current first-level directed graph node is set according to the first-level atomic operator represented by the current first-level directed graph node. The label information and intermediate atomic operators in the attribute information of the current first-level directed graph node are used to determine the current intermediate-level directed graph node set corresponding to the current first-level directed graph node, and at least according to the current The dependency relationship between the first-level directed graph node and its first-level child directed graph node is determined according to the label information in the attribute information of the current first-level directed graph node and its first-level child directed graph node Each intermediate-level directed graph node in the current intermediate-level directed graph node set corresponding to the current first-level directed graph node and each intermediate-level directed graph node set in the intermediate-level directed graph The dependency relationship between the nodes of the hierarchical directed graph.
(21)根据(19)所述的方法,其中,当遍历到的第一级有向图中的当前第一级有向图节点所代表的第一级原子运算符为降维原子运算符时,(21) The method according to (19), wherein, when the first-level atomic operator represented by the current first-level directed graph node in the traversed first-level directed graph is a dimensionality reduction atomic operator ,
使得该当前第一级有向图节点的属性信息中不包含标签信息或包含该当前第一级有向图节点的第一级子有向图节点的属性信息中的标签信息的一个子集,至少根据该当前第一级有向图节点所代表的第一级原子运算符设置该当前第一级有向图节点的属性信息中的中间级原子运算符,至少根据该当前第一级有向图节点的属性信息中的中间级原子运算符来确定与该当前第一级有向图节点相对应的当前中间级有向图节点集合,以及至少根据该当前第一级有向图节点与其第一级子有向图节点之间的依赖关系来确定与该当前第一级有向图节点相对应的当前中间级有向图节点集合中的各个中间级有向图节点与中间级有向图中的其他中间级有向图节点集合中的各个中间级有向图节点之间的依赖关系。So that the attribute information of the current first-level directed graph node does not contain label information or includes a subset of the label information in the attribute information of the first-level child directed graph node of the current first-level directed graph node, Set the intermediate-level atomic operator in the attribute information of the current first-level directed graph node at least according to the first-level atomic operator represented by the current first-level directed graph node, and at least according to the current first-level directed graph node The intermediate-level atomic operator in the attribute information of the graph node determines the current intermediate-level directed graph node set corresponding to the current first-level directed graph node, and at least according to the current first-level directed graph node and its first-level directed graph node The dependency relationship between the first-level sub-directed graph nodes is used to determine each intermediate-level directed graph node and the intermediate-level directed graph in the current intermediate-level directed graph node set corresponding to the current first-level directed graph node The dependency relationship between each intermediate-level directed graph node in the set of other intermediate-level directed graph nodes in.
(22)根据(19)所述的方法,其中,当遍历到的第一级有向图中的当前第一级有向图节点所代表的第一级原子运算符为错位原子运算符时,(22) The method according to (19), wherein, when the first-level atomic operator represented by the current first-level directed graph node in the traversed first-level directed graph is a misplaced atomic operator,
在该当前第一级有向图节点的第一级子有向图节点的属性信息包含与电子表格中的单元格相对应的标签信息的情况下,将第一级子有向图节点的属性信息中所包含的标签信息进行错位后获得的错位后标签信息设置为该当前第一级有向图节点的属性信息中的标签信息,将“等同”原子运算符设置为该当前第一级有向图节点的属性信息中的中间级原子运算符,根据该当前第一级有向图节点的属性信息中的标签信息和中间级原子运算符来确定与该当前第一级有向图节点相对应的当前中间级有向图节点集合,以及至少根据该当前第一级有向图节点与其第一级子有向图节点之间的依 赖关系并且根据该当前第一级有向图节点与其第一级子有向图节点的属性信息中的标签信息来确定与该当前第一级有向图节点相对应的当前中间级有向图节点集合中的各个中间级有向图节点与中间级有向图中的其他中间级有向图节点集合中的各个中间级有向图节点之间的依赖关系。In the case that the attribute information of the first-level child directed graph node of the current first-level directed graph node contains the label information corresponding to the cell in the spreadsheet, the attribute information of the first-level child directed graph node The label information contained in the information is set to the label information in the attribute information of the current first-level directed graph node, and the “equal” atomic operator is set to the current first-level directed graph node. The intermediate-level atomic operator in the attribute information of the directed graph node is determined to be relative to the current first-level directed graph node according to the label information and the intermediate-level atomic operator in the attribute information of the current first-level directed graph node. The corresponding set of current intermediate-level directed graph nodes, and at least according to the dependency relationship between the current first-level directed graph node and its first-level child directed graph nodes, and according to the current first-level directed graph node and its first level The label information in the attribute information of the first-level sub-directed graph node is used to determine the current intermediate-level directed graph node set corresponding to the current first-level directed graph node. The dependency relationship between each intermediate-level directed graph node in the set of other intermediate-level directed graph nodes in the directed graph.
(23)根据(18)至(22)中任一项所述的方法,还包括:(23) The method according to any one of (18) to (22), further comprising:
分别从所述中间级有向图中抽取以中间级有向图根节点集合中的各个中间级有向图根节点为根节点的子有向图,并且将所抽取的子有向图作为第二级有向图以根据第二级有向图来确定第二级复合运算符。Extract the sub-directed graphs with each intermediate-level directed graph root node in the set of intermediate-level directed graph root nodes as the root node from the intermediate-level directed graph, and use the extracted sub-directed graph as the first The second-level directed graph is used to determine the second-level compound operator based on the second-level directed graph.
(24)根据(23)所述的方法,其中,所述抽取的步骤包括:(24) The method according to (23), wherein the step of extracting includes:
通过将各个中间级有向图根节点的属性信息中的标签信息与各个中间级有向图左值节点的属性信息中的标签信息进行匹配,将中间级有向图根节点集合中的各个中间级有向图根节点的位置与中间级有向图左值节点集合中的各个中间级有向图左值节点的位置相对应;以及By matching the label information in the attribute information of the root node of each intermediate-level directed graph with the label information in the attribute information of the left-value node of each intermediate-level directed graph, each intermediate-level directed graph root node set The position of the root node of the level directed graph corresponds to the position of the left value node of each intermediate level directed graph in the set of left value nodes of the intermediate level directed graph; and
将以相应的匹配位置处的中间级有向图根节点为根节点的子有向图抽出作为第二级有向图以根据第二级有向图来确定中间级左值节点对应的单元格的第二级复合运算符。The sub-directed graph with the root node of the intermediate-level directed graph at the corresponding matching position as the root node is extracted as the second-level directed graph to determine the cell corresponding to the intermediate-level lvalue node according to the second-level directed graph The second-level compound operator.
(25)根据(12)所述的方法,还包括:(25) The method according to (12), further comprising:
将所生成的用于所述一个或多个第一单元格中的每个第一单元格的电子表格公式存储到电子表格文件中的相应单元格中。The generated spreadsheet formula for each first cell of the one or more first cells is stored in a corresponding cell in the spreadsheet file.
(26)根据(4)所述的方法,其中,(26) The method according to (4), wherein:
所述自定义原子运算符是通过对系统预设的原子运算符进行组合而定义的。The custom atomic operator is defined by combining the atomic operators preset by the system.
(27)根据(26)所述的方法,其中,(27) The method according to (26), wherein:
在用于电子表格的层级公式中包括所述自定义原子运算符的情况下,将所述自定义原子运算符转换为系统预设的原子运算符。In the case that the custom atomic operator is included in the hierarchical formula used in the spreadsheet, the custom atomic operator is converted into a system preset atomic operator.
(28)根据(27)所述的方法,其中,所述展开的步骤包括:(28) The method according to (27), wherein the step of unfolding includes:
将层级公式的原始有向图中的所述自定义原子运算符替换为代表所述自定义原子运算符的有向图的根节点;以及Replacing the custom atomic operator in the original directed graph of the hierarchical formula with the root node of the directed graph representing the custom atomic operator; and
用层级公式的原始有向图中的以所述自定义原子运算符为父节点的子有向图来替换所述自定义原子运算符的有向图中的叶子节点。Replace the leaf nodes in the directed graph of the custom atomic operator with the child directed graph in the original directed graph of the hierarchical formula with the custom atomic operator as the parent node.
(29)根据(1)所述的方法,还包括:(29) The method according to (1), further comprising:
基于已经获取的所述层级公式,更新智能建议知识库,所述智能建议知识库包括与所述层级公式或者层级结构有关的信息;以及Updating the knowledge base of intelligent suggestions based on the obtained hierarchy formula, the knowledge base of intelligent suggestions including information related to the hierarchy formula or hierarchy structure; and
基于所述智能建议知识库,在将要获取新的层级公式时进行智能建议。Based on the intelligent suggestion knowledge base, intelligent suggestions are made when a new level formula is about to be obtained.
(30)根据(1)所述的方法,还包括:(30) The method according to (1), further including:
自动检测所获取的所述层级公式中存在的缺陷;以及Automatically detect defects in the obtained hierarchy formula; and
基于所述缺陷自动生成调试信息并且提示所述调试信息,Automatically generate debugging information based on the defect and prompt the debugging information,
其中,所述调试信息包括错误或警告。Wherein, the debugging information includes errors or warnings.
(31)根据(1)所述的方法,还包括:(31) The method according to (1), further comprising:
存储电子表格模型,所述电子表格模型包括以下各项中的一个或多个:用于电子表格的层级结构、用于电子表格的层级计算图和电子表格文件。An electronic form model is stored, and the electronic form model includes one or more of the following: a hierarchical structure for the electronic form, a hierarchical calculation diagram for the electronic form, and an electronic form file.
(32)根据(31)所述的方法,还包括:(32) The method according to (31), further comprising:
导入和/或导出所述电子表格模型。Import and/or export the spreadsheet model.
(33)根据(3)所述的方法,其中,所述解析所述文本代码以生成所述层级公式的步骤包括:(33) The method according to (3), wherein the step of parsing the text code to generate the hierarchical formula includes:
对所述文本代码进行分词以得到分词流;Perform word segmentation on the text code to obtain a word stream;
识别所述分词流中与所述运算符相关的分词,以确定所述运算符;Identifying the word segmentation related to the operator in the word segmentation stream to determine the operator;
识别所述分词流中与所述电子表格的层级结构中的所述一个或多个层级中的所述一个或多个节点相关的分词,以确定所述层级引用;以及Identifying the word segmentation related to the one or more nodes in the one or more levels in the hierarchical structure of the spreadsheet in the word segmentation stream to determine the level reference; and
根据所确定的运算符和层级引用来生成所述层级公式。The hierarchical formula is generated according to the determined operator and hierarchical reference.
(34)根据(5)所述的方法,其中,所述复合运算符采用以下各项中的一个或多个来存储:(34) The method according to (5), wherein the compound operator adopts one or more of the following items to store:
字符串;String
由函数指针指向的计算机实现的函数;和The computer-implemented function pointed to by the function pointer; and
有向图。Directed graph.
(35)根据(34)所述的方法,其中,所述有向图中的各个节点代表所述层级公式中的所述运算符,以及所述有向图中的各个节点之间的有向边代表所述层级公式中的所述运算符之间的组合关系。(35) The method according to (34), wherein each node in the directed graph represents the operator in the hierarchical formula, and the directed graph between each node in the directed graph The edges represent the combination relationship between the operators in the hierarchical formula.
(36)根据(25)所述的方法,其中,所述将所生成的用于所述一个或多个第一单元格中的每个第一单元格的电子表格公式存储到相应的第一单元格中的步骤还包括:(36) The method according to (25), wherein the generated spreadsheet formula for each first cell of the one or more first cells is stored in the corresponding first cell. The steps in the cell also include:
对所述电子表格中的所述一个或多个第一单元格和所述一个或多个第二单元格中的一部分或全部的单元格名称进行自动命名;以及Automatically naming a part or all of the cell names of the one or more first cells and the one or more second cells in the electronic table; and
利用自动命名的单元格名称来改写所述电子表格公式并且存储改写后的电子表格公式。Utilize automatically named cell names to rewrite the spreadsheet formula and store the rewritten spreadsheet formula.
(37)一种用于生成电子表格公式的装置,包括:用于执行如(1)-(36)中的任一项所述的方法的步骤的部件。(37) A device for generating spreadsheet formulas, including: components for performing the steps of the method described in any one of (1) to (36).
(38)一种用于生成电子表格公式的设备,包括:(38) A device for generating spreadsheet formulas, including:
至少一个处理器;以及At least one processor; and
至少一个存储设备,所述至少一个存储设备存储有指令,当所述指令由所述至少一个处理器执行时使得所述至少一个处理器执行如(1)-(36)中的任一项所述的方法。At least one storage device, the at least one storage device stores instructions, and when the instructions are executed by the at least one processor, the at least one processor executes the instructions as described in any one of (1)-(36) The method described.
(39)一种非瞬态计算机可读存储介质,存储有指令,当所述指令由处理器执行时使得执行如(1)-(36)中的任一项所述的方法。(39) A non-transitory computer-readable storage medium storing instructions that, when executed by a processor, cause the method described in any one of (1) to (36) to be performed.
(40)一种用于生成电子表格公式的装置,所述装置包括:(40) A device for generating an electronic form formula, the device comprising:
层级公式编辑器,所述层级公式编辑器被配置为获取用于所述电子表格的层级公式,所述层级公式包括运算符和层级引用,其中所述层级引用对应于用于电子表格的层级结构中的一个或多个层级中的一个或多个节点,其中每个层级具有至少一个节点并且具有相应的层级类型,每个节点对应于所述电子表格中的一个或多个单元格,其中所述层级结构还包括所述一个或多个节点之间的隶属关系;A hierarchical formula editor configured to obtain a hierarchical formula for the electronic form, the hierarchical formula including an operator and a hierarchical reference, wherein the hierarchical reference corresponds to a hierarchical structure for the electronic form One or more nodes in one or more levels in each level, where each level has at least one node and has a corresponding level type, and each node corresponds to one or more cells in the spreadsheet, where all The hierarchical structure also includes the affiliation relationship between the one or more nodes;
层级公式解析器,所述层级公式解析器被配置为基于所述层级引用与所述一个或多个节点之间的对应关系来确定所述一个或多个节点之间的依赖关系;所述层级公式解析器还被配置为基于所述运算符和所述依赖关系来确定所述一个或多个节点之间的计算关系;以及A hierarchical formula parser, the hierarchical formula parser is configured to determine the dependency relationship between the one or more nodes based on the correspondence between the hierarchical reference and the one or more nodes; the hierarchy The formula parser is further configured to determine the calculation relationship between the one or more nodes based on the operator and the dependency relationship; and
公式转译器,所述公式转译器被配置为至少基于用于所述电子表格的所述层级结构和所述计算关系来生成所述电子表格公式。A formula translator configured to generate the spreadsheet formula based on at least the hierarchical structure and the calculation relationship for the spreadsheet.
(41)根据(40)所述的装置,其中,所述层级公式编辑器包括图形用户界面编辑器,其中所述图形用户界面编辑器包括用于指定不同层级的节点和/或运算符的组件,并且其中所述图形用户界面编辑器还被配置为:(41) The device according to (40), wherein the hierarchical formula editor includes a graphical user interface editor, wherein the graphical user interface editor includes components for specifying nodes and/or operators of different levels , And wherein the graphical user interface editor is further configured to:
接收针对用于指定不同层级的节点和/或运算符的组件的输入;以及Receive input for components used to specify nodes and/or operators at different levels; and
基于所述输入来生成所述层级公式。The hierarchical formula is generated based on the input.
(42)根据(40)所述的装置,其中,所述层级公式编辑器包括文本编辑器,所述文本编辑器被配置为:(42) The device according to (40), wherein the hierarchical formula editor includes a text editor, and the text editor is configured to:
接收用户输入的文本代码;以及Receive the text code entered by the user; and
解析所述文本代码以生成所述层级公式。The text code is parsed to generate the hierarchical formula.
(43)根据(40)所述的装置,其中,所述运算符包括原子运算符,所述原子运算符包括以下各项中的一种或多种:数学运算符、数学函数、常量、系统定义函数、用户自定义原子运算符。(43) The device according to (40), wherein the operator includes an atomic operator, and the atomic operator includes one or more of the following: mathematical operator, mathematical function, constant, system Define functions and user-defined atomic operators.
(44)根据(43)所述的装置,其中,所述层级公式解析器还被配置为:(44) The device according to (43), wherein the hierarchical formula parser is further configured to:
根据所述层级公式中的所述原子运算符来构建复合运算符,其中,所述复合运算符包括所述层级公式中的所有原子运算符的组合。A compound operator is constructed according to the atomic operator in the hierarchical formula, wherein the compound operator includes a combination of all the atomic operators in the hierarchical formula.
(45)根据(44)所述的装置,其中,所述层级公式解析器还被配置为:(45) The device according to (44), wherein the hierarchical formula parser is further configured to:
至少基于所述复合运算符和所述依赖关系来确定所述一个或多个节点之间的计算关系。The calculation relationship between the one or more nodes is determined based on at least the compound operator and the dependency relationship.
(46)根据(40)至(45)中任一项所述的装置,其中,所述层级引用包括位于所述层级公式中的等号左侧的第一层级引用和位于所述层级公式中的等号右侧的第二层级引用,其中,第一层级引用对应于所述一个或多个节点中的第一节点,而第二层级引用对应于所述一个或多个节点中的第二节点。(46) The device according to any one of (40) to (45), wherein the level reference includes the first level reference located to the left of the equal sign in the level formula and the first level reference located in the level formula The second-level reference on the right side of the equal sign of, where the first-level reference corresponds to the first of the one or more nodes, and the second-level reference corresponds to the second of the one or more nodes node.
(47)根据(46)所述的装置,其中,所述层级公式解析器还被配置为:(47) The device according to (46), wherein the hierarchical formula parser is further configured to:
至少基于第一层级引用与第一节点之间的对应关系以及第二层级引用与第二节点之间的对应关系来确定第一节点与第二节点之间的依赖关系。The dependency relationship between the first node and the second node is determined based at least on the correspondence between the first-level reference and the first node and the correspondence between the second-level reference and the second node.
(48)根据(40)至(45)中任一项所述的装置,还包括层级计算图存储器,所述层级计算图存储器被配置为:(48) The device according to any one of (40) to (45), further comprising a hierarchical calculation graph memory, and the hierarchical calculation graph memory is configured to:
针对所述一个或多个节点中的每个节点,经由层级计算图存储该节点与其他节点之间的计算关系。For each node of the one or more nodes, the calculation relationship between the node and other nodes is stored via a hierarchical calculation graph.
(49)根据(48)所述的装置,其中,所述层级公式解析器还被配置为:(49) The device according to (48), wherein the hierarchical formula parser is further configured to:
基于所述运算符以及第一节点与第二节点之间的依赖关系来确定第一节点与第二节点之间的计算关系。The calculation relationship between the first node and the second node is determined based on the operator and the dependency relationship between the first node and the second node.
(50)根据(49)所述的装置,还包括层级计算图存储器,所述层级计算图存储器被配置为:(50) The device according to (49), further comprising a hierarchical calculation graph memory, and the hierarchical calculation graph memory is configured to:
针对第一节点,经由层级计算图存储第一节点与第二节点之间的计算关系。For the first node, the calculation relationship between the first node and the second node is stored via the hierarchical calculation graph.
(51)根据(40)至(45)中任一项所述的装置,其中,所述公式转译器还被配置为:(51) The device according to any one of (40) to (45), wherein the formula translator is further configured to:
对于所述一个或多个节点中的每个当前节点,基于所述一个或多个节点中的该当前节点与其他节点之间的计算关系来确定该当前节点所对应的一个或多个第一单元格中的每个第一单元格与其他节点所对应的一个或多个第二单元格中的每个第二单元格之间的计算关系;以及For each current node in the one or more nodes, one or more first nodes corresponding to the current node are determined based on the calculation relationship between the current node and other nodes in the one or more nodes. The calculation relationship between each first cell in the cell and each second cell in the one or more second cells corresponding to other nodes; and
至少基于所述一个或多个第一单元格中的每个第一单元格与所述一个或多个第二单元格中的每个第二单元格之间的计算关系,生成用于所述一个或多个第一单元格中的每个第一单元格的电子表格公式。Based on at least the calculated relationship between each first cell in the one or more first cells and each second cell in the one or more second cells, the The spreadsheet formula for each of the one or more first cells.
(52)根据(51)所述的装置,其中,所述公式转译器还被配置为:(52) The device according to (51), wherein the formula translator is further configured to:
至少基于所述一个或多个节点中的该当前节点所对应的运算符,确定该当前节点所对应的一个或多个第一单元格中的每个第一单元格所对应的运算符;以及Determine the operator corresponding to each first cell in the one or more first cells corresponding to the current node based at least on the operator corresponding to the current node in the one or more nodes; and
至少基于所述一个或多个节点中的该当前节点与其他节点之间的依赖关系,确定该当前节点所对应的一个或多个第一单元格中的每个第一单元格与其他节点所对应的一个或多个第二单元格中的每个第二单元格之间的依赖关系。At least based on the dependency relationship between the current node and other nodes in the one or more nodes, it is determined that each first cell of the one or more first cells corresponding to the current node is connected to other nodes. Corresponding to the dependency relationship between each second cell in one or more second cells.
(53)根据(52)所述的装置,其中,所述公式转译器还被配置为:(53) The device according to (52), wherein the formula translator is further configured to:
至少基于该当前节点所对应的一个或多个第一单元格中的每个第一单元格所对应的运算符、以及该当前节点所对应的一个或多个第一单元格中的每个第一单元格与其他节点所对应的一个或多个第二单元格中的每个第二单元格之间的依赖关系,生成用于所述一个或多个第一单元格中的每个第一单元格的电子表格公式。At least based on the operator corresponding to each first cell in the one or more first cells corresponding to the current node, and each first cell in the one or more first cells corresponding to the current node The dependency relationship between a cell and each second cell in one or more second cells corresponding to other nodes is generated for each first cell in the one or more first cells Spreadsheet formula for the cell.
(54)根据(53)所述的装置,其中,所述公式转译器还被配置为:(54) The device according to (53), wherein the formula translator is further configured to:
所述一个或多个节点中的该当前节点所对应的运算符是与用于所述电子表格的层级结构中的所述一个或多个节点中的一个节点相对应的第一级复合运算符,第一级复合运算符包括一个或多个第一级原子运算符;The operator corresponding to the current node in the one or more nodes is a first-level compound operator corresponding to one of the one or more nodes in the hierarchical structure of the spreadsheet , The first-level compound operator includes one or more first-level atomic operators;
所述一个或多个第一单元格中的每个第一单元格所对应的运算符是与所述电子表格中的所述一个或多个单元格中的一个单元格相对应的第二级复合运算符,第二级复合运算符包括一个或多个第二级原子运算符;以及The operator corresponding to each first cell in the one or more first cells is the second level corresponding to one cell in the one or more cells in the spreadsheet Compound operators, the second-level compound operators include one or more second-level atomic operators; and
至少基于所述一个或多个节点中的该当前节点所对应的第一级复合运算符,确定该当前节点所对应的一个或多个第一单元格中的每个第一单元格所对应的第二级复合运算符。Based on at least the first-level compound operator corresponding to the current node in the one or more nodes, determine the corresponding one of the one or more first cells corresponding to the current node The second level compound operator.
(55)根据(54)所述的装置,其中,所述公式转译器还被配置为:(55) The device according to (54), wherein the formula translator is further configured to:
第一级复合运算符采用第一级有向图来存储,第一级有向图中的各个有向图节点代表第一级复合运算符中的各个第一级原子运算符,以及第一级有向图中的各个有向图节点之间的有向边代表第一级复合运算符中的各个第一级原子运算符之间的组合关系;The first-level compound operator uses the first-level directed graph for storage. Each directed graph node in the first-level directed graph represents each first-level atomic operator in the first-level compound operator, and the first-level The directed edges between each directed graph node in the directed graph represent the combination relationship between each first-level atomic operator in the first-level compound operator;
第二级复合运算符采用第二级有向图来存储,第二级有向图中的各个有向图节点代表第二级复合运算符中的各个第二级原子运算符,以及第二级有向图中的各个有向图节点之间的有向边代表第二级复合运算符中的各个第二级原子运算符之间的组合关系;以及The second-level compound operator uses a second-level directed graph for storage. Each directed graph node in the second-level directed graph represents each second-level atomic operator in the second-level compound operator, and the second-level The directed edges between each directed graph node in the directed graph represent the combination relationship between each second-level atomic operator in the second-level compound operator; and
通过遍历与第一级复合运算符相对应的第一级有向图来确定第二级有向图,并且根据第二级有向图来确定第二级复合运算符。The second-level directed graph is determined by traversing the first-level directed graph corresponding to the first-level compound operator, and the second-level compound operator is determined according to the second-level directed graph.
(56)根据(55)所述的装置,其中,所述公式转译器还被配置为:(56) The device according to (55), wherein the formula translator is further configured to:
按照后序遍历的顺序来遍历第一级有向图,从而先遍历第一级有向图中的子有向图节点,再遍历第一级有向图中的父有向图节点。Traverse the first-level directed graph in the order of post-order traversal, so that the child directed graph nodes in the first-level directed graph are traversed first, and then the parent directed graph nodes in the first-level directed graph are traversed.
(57)根据(56)所述的装置,其中,所述公式转译器还被配置为:(57) The device according to (56), wherein the formula translator is further configured to:
在遍历到第一级有向图中的一个或多个第一级有向图节点中的当前第一级有向图节点时,根据当前第一级有向图节点所代表的第一级原子运算符、以及当前第一级有向图节点的第一级子有向图节点的属性信息来确定当前第一级有向图节点的属性信息,其中,每个第一级有向图节点的属性信息包括以下各项中的一种或多种:电子表格中的单元格的位置信息,与电子表格中的单元格相对应的标签信息和电子表格中的单元格的位置信息,与电子表格中的单元格相对应的标签信息和中间级节点,与电子表格中的单元格相对应的中间级节点,其中所述中间级节点用以存储中间计算结果;When traversing to the current first-level directed graph node in one or more first-level directed graph nodes in the first-level directed graph, according to the first-level atom represented by the current first-level directed graph node Operator and the attribute information of the first-level child directed graph node of the current first-level directed graph node to determine the attribute information of the current first-level directed graph node. The attribute information includes one or more of the following items: the location information of the cells in the spreadsheet, the label information corresponding to the cells in the spreadsheet, and the location information of the cells in the spreadsheet, and the location information of the cells in the spreadsheet. Label information and intermediate nodes corresponding to the cells in, and intermediate nodes corresponding to the cells in the spreadsheet, wherein the intermediate nodes are used to store intermediate calculation results;
根据第一级有向图中的所述一个或多个第一级有向图节点中的每个第一级有向图节点的属性信息来确定中间级有向图中的各个中间级有向图节点集合,根据第一级有向图中的所述一个或多个第一级有向图节点之间的依赖关系来确定中间级有向图中的每个中间级有向图节点集合中的各个中间级有向图节点与中间级有向图中的其他中间级有向图节点集合中的各个中间级有向图节点之间的依赖关系。According to the attribute information of each first-level directed graph node in the one or more first-level directed graph nodes in the first-level directed graph, each intermediate-level directed graph in the intermediate-level directed graph is determined The graph node set is determined according to the dependency relationship between the one or more first-level directed graph nodes in the first-level directed graph in each intermediate-level directed graph node set in the intermediate-level directed graph The dependency between each intermediate-level directed graph node in the intermediate-level directed graph and each intermediate-level directed graph node in the set of other intermediate-level directed graph nodes in the intermediate-level directed graph.
(58)根据(57)所述的装置,其中,第一级原子运算符被划分为逐元素原子运算符、降维原子运算符、错位原子运算符、和用户自定义原子运算符中的一种。(58) The device according to (57), wherein the first-level atomic operators are divided into one of element-wise atomic operators, dimensionality reduction atomic operators, misplaced atomic operators, and user-defined atomic operators. Kind.
(59)根据(58)所述的装置,其中,所述公式转译器还被配置为:当遍历到的第一级有向图中的当前第一级有向图节点所代表的第一级原子运算符为逐元素原子运算符时,(59) The device according to (58), wherein the formula translator is further configured to: when traversed to the first-level directed graph, the current first-level directed graph node represents the first level When the atomic operator is an element-wise atomic operator,
如果该当前第一级有向图节点的各个第一级子有向图节点的属性信息都包含与电子表格中的单元格相对应的标签信息,则根据各个第一级子有向图节点的属性信息中所包含的标签信息的交集设置该当前第一级有向图节点的属性信息中的标签信息,根据该当前第一级有向图节点所代表的第一级原子运算符设置该当前第一级有向图节点的属性信息中的中间级原子运算符,根据该当前第一级有向图节点的属性信息中的标签信息和中间级原子运算符来确定与该当前第一级有向图节点相对应的当前中间级有向图节点集合,以及至少根据该当前第一级有向图节点与其第一级子有向图节点之间的依赖关系并且根据该当前第一级有向图节点与其第一级子有向图节点的属性信息中的标签信息来确定与该当前第一级有向图节点相对应的当前中间级有向图节点集合中的各个中间级有向图节点与中间级有向图中的其他中间级有向图节点集合中的各个中间级有向图节点之间的依赖关系;If the attribute information of each first-level sub-directed graph node of the current first-level directed graph node contains the label information corresponding to the cell in the spreadsheet, then the attribute information of each first-level sub-directed graph node The intersection of the label information contained in the attribute information sets the label information in the attribute information of the current first-level directed graph node, and sets the current first-level atomic operator represented by the current first-level directed graph node. The intermediate-level atomic operator in the attribute information of the first-level directed graph node is determined to be related to the current first-level based on the label information and the intermediate-level atomic operator in the attribute information of the current first-level directed graph node. The current intermediate-level directed graph node set corresponding to the directed graph node, and at least according to the dependency relationship between the current first-level directed graph node and its first-level child directed graph nodes, and according to the current first-level directed graph node The label information in the attribute information of the graph node and its first-level child directed graph node is used to determine each intermediate-level directed graph node in the current intermediate-level directed graph node set corresponding to the current first-level directed graph node The dependency relationship between each intermediate-level directed graph node in the set of other intermediate-level directed graph nodes in the intermediate-level directed graph;
如果该当前第一级有向图节点的各个第一级子有向图节点的属性信息都不包含标签信息,则使得该当前第一级有向图节点的属性信息中不包含标签信息,根据该当前第一级有向图节点所代表的第一级原子运算符设置该当前第一级有向图节点的属性信息中的中间级原子运算符,至少根据该当前第一级有向图节点的属性信息中的中间级原子运算符来确定与该当前第一级有向图节点相对应的当前中间级有向图节点集合,以及至少根据该当前第一级有向图节点与其第一级子有向图节点之间的依赖关系来确定与该当前第一级有向图节点相对应的当前中间级有向图节点集合中的各个中间级有向图节点与中间级有向图中的其他中间级有向图节点集合中的各个中间级有向图节点之间的依赖关系;If the attribute information of each first-level child directed graph node of the current first-level directed graph node does not contain label information, then the attribute information of the current first-level directed graph node does not include label information, according to The first-level atomic operator represented by the current first-level directed graph node sets the intermediate-level atomic operator in the attribute information of the current first-level directed graph node, at least according to the current first-level directed graph node The intermediate-level atomic operator in the attribute information of the current first-level directed graph node is used to determine the current intermediate-level directed graph node set corresponding to the current first-level directed graph node, and at least according to the current first-level directed graph node and its first-level The dependency relationship between the sub-directed graph nodes is used to determine the current intermediate-level directed graph node corresponding to the current first-level directed graph node in each intermediate-level directed graph node and the intermediate-level directed graph. The dependency relationship between each intermediate-level directed graph node in the set of other intermediate-level directed graph nodes;
如果该当前第一级有向图节点的一部分第一级子有向图节点的属性信息包含与电子表格中的单元格相对应的标签信息并且该当前第一级有向图节点的另一部分第一级子有向图节点的属性信息不包含标签信息,则根据包含标签信息的第一级子有向图节点的属性信息中所包含的标签信息的交集设置该当前第一级有向图节点的属性信息中的标签信息,根据该当前第一级有向图节点所代表的第一级原子运算符设置该当前第一级有向图节点的属性信息中的中间级原子运算符,根据该当前第一级有向图节点的属性信息中的标签信息和中间级原子运算符来确定与该当前第一级有向图节 点相对应的当前中间级有向图节点集合,以及至少根据该当前第一级有向图节点与其第一级子有向图节点之间的依赖关系并且根据该当前第一级有向图节点与其第一级子有向图节点的属性信息中的标签信息来确定与该当前第一级有向图节点相对应的当前中间级有向图节点集合中的各个中间级有向图节点与中间级有向图中的其他中间级有向图节点集合中的各个中间级有向图节点之间的依赖关系。If the attribute information of a part of the current first-level directed graph node of the first-level child directed graph node contains the label information corresponding to the cell in the spreadsheet and the other part of the current first-level directed graph node is the first If the attribute information of the first-level child directed graph node does not contain label information, the current first-level directed graph node is set according to the intersection of the label information contained in the attribute information of the first-level child directed graph node containing the label information According to the label information in the attribute information of the current first-level directed graph node, the middle-level atomic operator in the attribute information of the current first-level directed graph node is set according to the first-level atomic operator represented by the current first-level directed graph node. The label information and intermediate atomic operators in the attribute information of the current first-level directed graph node are used to determine the current intermediate-level directed graph node set corresponding to the current first-level directed graph node, and at least according to the current The dependency relationship between the first-level directed graph node and its first-level child directed graph node is determined according to the label information in the attribute information of the current first-level directed graph node and its first-level child directed graph node Each intermediate-level directed graph node in the current intermediate-level directed graph node set corresponding to the current first-level directed graph node and each intermediate-level directed graph node set in the intermediate-level directed graph The dependency relationship between the nodes of the hierarchical directed graph.
(60)根据(58)所述的装置,其中,所述公式转译器还被配置为:当遍历到的第一级有向图中的当前第一级有向图节点所代表的第一级原子运算符为降维原子运算符时,(60) The device according to (58), wherein the formula translator is further configured to: when traversed to the first-level directed graph, the current first-level directed graph node represents the first level When the atomic operator is a dimensionality reduction atomic operator,
使得该当前第一级有向图节点的属性信息中不包含标签信息或包含该当前第一级有向图节点的第一级子有向图节点的属性信息中的标签信息的一个子集,至少根据该当前第一级有向图节点所代表的第一级原子运算符设置该当前第一级有向图节点的属性信息中的中间级原子运算符,至少根据该当前第一级有向图节点的属性信息中的中间级原子运算符来确定与该当前第一级有向图节点相对应的当前中间级有向图节点集合,以及至少根据该当前第一级有向图节点与其第一级子有向图节点之间的依赖关系来确定与该当前第一级有向图节点相对应的当前中间级有向图节点集合中的各个中间级有向图节点与中间级有向图中的其他中间级有向图节点集合中的各个中间级有向图节点之间的依赖关系。So that the attribute information of the current first-level directed graph node does not contain label information or includes a subset of the label information in the attribute information of the first-level child directed graph node of the current first-level directed graph node, Set the intermediate-level atomic operator in the attribute information of the current first-level directed graph node at least according to the first-level atomic operator represented by the current first-level directed graph node, and at least according to the current first-level directed graph node The intermediate-level atomic operator in the attribute information of the graph node determines the current intermediate-level directed graph node set corresponding to the current first-level directed graph node, and at least according to the current first-level directed graph node and its first-level directed graph node The dependency relationship between the first-level sub-directed graph nodes is used to determine each intermediate-level directed graph node and the intermediate-level directed graph in the current intermediate-level directed graph node set corresponding to the current first-level directed graph node The dependency relationship between each intermediate-level directed graph node in the set of other intermediate-level directed graph nodes in.
(61)根据(58)所述的装置,其中,所述公式转译器还被配置为:当遍历到的第一级有向图中的当前第一级有向图节点所代表的第一级原子运算符为错位原子运算符时,(61) The device according to (58), wherein the formula translator is further configured to: when traversed to the first-level directed graph, the current first-level directed graph node represents the first level When the atomic operator is a misplaced atomic operator,
在该当前第一级有向图节点的第一级子有向图节点的属性信息包含与电子表格中的单元格相对应的标签信息的情况下,将第一级子有向图节点的属性信息中所包含的标签信息进行错位后获得的错位后标签信息设置为该当前第一级有向图节点的属性信息中的标签信息,将“等同”原子运算符设置为该当前第一级有向图节点的属性信息中的中间级原子运算符,根据该当前第一级有向图节点的属性信息中的标签信息和中间级原子运算符来确定与该当前第一级有向图节点相对应的当前中间级有向图节点集合,以及至少根据该当前第一级有向图节点与其第一级子有向图节点之间的依赖关系并且根据该当前第一级有向图节点与其第一级子有向图节点的属性信息中的标签信息来确定与该当前第一级有向图节点相对应的当前中间级有向图节点集合中的各个中间级有向图节点与中间级有向图中的其他中间级有向图节点集合中的各个 中间级有向图节点之间的依赖关系。In the case that the attribute information of the first-level child directed graph node of the current first-level directed graph node contains the label information corresponding to the cell in the spreadsheet, the attribute information of the first-level child directed graph node The label information contained in the information is set to the label information in the attribute information of the current first-level directed graph node, and the “equal” atomic operator is set to the current first-level node. The intermediate-level atomic operator in the attribute information of the directed graph node is determined to be relative to the current first-level directed graph node according to the label information and the intermediate-level atomic operator in the attribute information of the current first-level directed graph node. The corresponding set of current intermediate-level directed graph nodes, and at least according to the dependency relationship between the current first-level directed graph node and its first-level child directed graph nodes, and according to the current first-level directed graph node and its first level The label information in the attribute information of the first-level sub-directed graph node is used to determine the current intermediate-level directed graph node set corresponding to the current first-level directed graph node. The dependency relationship between each intermediate-level directed graph node in the set of other intermediate-level directed graph nodes in the directed graph.
(62)根据(57)至(61)中任一项所述的装置,其中,所述公式转译器还被配置为:(62) The device according to any one of (57) to (61), wherein the formula translator is further configured to:
分别从所述中间级有向图中抽取以中间级有向图根节点集合中的各个中间级有向图根节点为根节点的子有向图,并且将所抽取的子有向图作为第二级有向图以根据第二级有向图来确定第二级复合运算符。Extract the sub-directed graphs with each intermediate-level directed graph root node in the set of intermediate-level directed graph root nodes as the root node from the intermediate-level directed graph, and use the extracted sub-directed graph as the first The second-level directed graph is used to determine the second-level compound operator based on the second-level directed graph.
(63)根据(62)所述的装置,其中,所述公式转译器还被配置为:(63) The device according to (62), wherein the formula translator is further configured to:
通过将各个中间级有向图根节点的属性信息中的标签信息与各个中间级有向图左值节点的属性信息中的标签信息进行匹配,将中间级有向图根节点集合中的各个中间级有向图根节点的位置与中间级有向图左值节点集合中的各个中间级有向图左值节点的位置相对应;以及By matching the label information in the attribute information of the root node of each intermediate-level directed graph with the label information in the attribute information of the left-value node of each intermediate-level directed graph, each intermediate-level directed graph root node set The position of the root node of the level directed graph corresponds to the position of the left value node of each intermediate level directed graph in the set of left value nodes of the intermediate level directed graph; and
将以相应的匹配位置处的中间级有向图根节点为根节点的子有向图抽出作为第二级有向图以根据第二级有向图来确定中间级左值节点对应的单元格的第二级复合运算符。The sub-directed graph with the root node of the intermediate-level directed graph at the corresponding matching position as the root node is extracted as the second-level directed graph to determine the cell corresponding to the intermediate-level lvalue node according to the second-level directed graph The second-level compound operator.
(64)根据(51)所述的装置,还包括电子表格公式写入器,所述电子表格公式写入器被配置为:(64) The device according to (51), further comprising a spreadsheet formula writer, the spreadsheet formula writer being configured to:
将所生成的用于所述一个或多个第一单元格中的每个第一单元格的电子表格公式存储到电子表格文件中的相应单元格中。The generated spreadsheet formula for each first cell of the one or more first cells is stored in a corresponding cell in the spreadsheet file.
(65)根据(43)所述的装置,其中,(65) The device according to (43), wherein
所述自定义原子运算符是通过对系统预设的原子运算符进行组合而定义的。The custom atomic operator is defined by combining the atomic operators preset by the system.
(66)根据(65)所述的装置,其中,所述公式转译器还被配置为:(66) The device according to (65), wherein the formula translator is further configured to:
在用于电子表格的层级公式中包括所述自定义原子运算符的情况下,将所述自定义原子运算符转换为系统预设的原子运算符。In the case that the custom atomic operator is included in the hierarchical formula used in the spreadsheet, the custom atomic operator is converted into a system preset atomic operator.
(67)根据(66)所述的方法,其中,所述公式转译器还被配置为:(67) The method according to (66), wherein the formula translator is further configured to:
将层级公式的原始有向图中的所述自定义原子运算符替换为代表所述自定义原子运算符的有向图的根节点;以及Replacing the custom atomic operator in the original directed graph of the hierarchical formula with the root node of the directed graph representing the custom atomic operator; and
用层级公式的原始有向图中的以所述自定义原子运算符为父节点的子有向图来替换所述自定义原子运算符的有向图中的叶子节点。Replace the leaf nodes in the directed graph of the custom atomic operator with the child directed graph in the original directed graph of the hierarchical formula with the custom atomic operator as the parent node.
(68)根据(40)所述的装置,还包括智能建议模块,所述智能建议模块被配置为:(68) The device according to (40), further comprising an intelligent suggestion module, the intelligent suggestion module being configured to:
基于已经获取的所述层级公式,更新智能建议知识库,所述智能建议知识库包括与所述层级公式或者层级结构有关的信息;以及Updating the knowledge base of intelligent suggestions based on the obtained hierarchy formula, the knowledge base of intelligent suggestions including information related to the hierarchy formula or hierarchy structure; and
基于所述智能建议知识库,在将要获取新的层级公式时进行智能建议。Based on the intelligent suggestion knowledge base, intelligent suggestions are made when a new level formula is about to be obtained.
(69)根据(40)所述的装置,还包括缺陷检测模块,所述缺陷检测模块被配置为:(69) The device according to (40), further comprising a defect detection module configured to:
自动检测所获取的所述层级公式中存在的缺陷;以及Automatically detect defects in the obtained hierarchy formula; and
基于所述缺陷自动生成调试信息并且提示所述调试信息,Automatically generate debugging information based on the defect and prompt the debugging information,
其中,所述调试信息包括错误或警告。Wherein, the debugging information includes errors or warnings.
(70)根据(40)所述的装置,还包括:(70) The device according to (40), further comprising:
电子表格模型存储模块,所述电子表格模型存储模块被配置为存储电子表格模型,所述电子表格模型包括以下各项中的一个或多个:用于电子表格的层级结构、用于电子表格的层级计算图和电子表格文件。An electronic form model storage module, the electronic form model storage module is configured to store an electronic form model, the electronic form model includes one or more of the following: for the hierarchical structure of the electronic form, used for the electronic form Hierarchical calculation diagrams and spreadsheet files.
(71)根据(70)所述的装置,还包括:(71) The device according to (70), further comprising:
电子表格模型导入导出模块,所述电子表格模型导入导出模块被配置为导入和/或导出所述电子表格模型。An electronic form model import and export module, the electronic form model import and export module is configured to import and/or export the electronic form model.
(72)根据(42)所述的装置,其中,所述文本编辑器被配置为:(72) The device according to (42), wherein the text editor is configured to:
对所述文本代码进行分词以得到分词流;Perform word segmentation on the text code to obtain a word stream;
识别所述分词流中与所述运算符相关的分词,以确定所述运算符;Identifying the word segmentation related to the operator in the word segmentation stream to determine the operator;
识别所述分词流中与所述电子表格的层级结构中的所述一个或多个层级中的所述一个或多个节点相关的分词,以确定所述层级引用;以及Identifying the word segmentation related to the one or more nodes in the one or more levels in the hierarchical structure of the spreadsheet in the word segmentation stream to determine the level reference; and
根据所确定的运算符和层级引用来生成所述层级公式。The hierarchical formula is generated according to the determined operator and hierarchical reference.
(73)根据(44)所述的装置,其中,所述复合运算符采用以下各项中的一个或多个来存储:(73) The device according to (44), wherein the compound operator adopts one or more of the following items to store:
字符串;String
由函数指针指向的计算机实现的函数;和The computer-implemented function pointed to by the function pointer; and
有向图。Directed graph.
(74)根据(73)所述的装置,其中,所述有向图中的各个节点代表所述层级公式中的所述运算符,以及所述有向图中的各个节点之间的有向边代表所述层级公式中的所述运算符之间的组合关系。(74) The device according to (73), wherein each node in the directed graph represents the operator in the hierarchical formula, and the directed graph between each node in the directed graph The edges represent the combination relationship between the operators in the hierarchical formula.
(75)根据(64)所述的装置,其中,所述电子表格公式写入器被配置为:(75) The device according to (64), wherein the spreadsheet formula writer is configured to:
对所述电子表格中的所述一个或多个第一单元格和所述一个或多个第二单元格中的一部分或全部的单元格名称进行自动命名;以及Automatically naming a part or all of the cell names of the one or more first cells and the one or more second cells in the electronic table; and
利用自动命名的单元格名称来改写所述电子表格公式并且存储改写后的电子表格公式。Utilize automatically named cell names to rewrite the spreadsheet formula and store the rewritten spreadsheet formula.

Claims (75)

  1. 一种用于生成电子表格公式的计算机实现的方法,所述方法包括:A computer-implemented method for generating spreadsheet formulas, the method comprising:
    获取用于所述电子表格的层级公式,所述层级公式包括运算符和层级引用,其中所述层级引用对应于用于电子表格的层级结构中的一个或多个层级中的一个或多个节点,其中每个层级具有至少一个节点并且具有相应的层级类型,每个节点对应于所述电子表格中的一个或多个单元格,其中所述层级结构还包括所述一个或多个节点之间的隶属关系;Acquire a hierarchical formula for the electronic form, the hierarchical formula including an operator and a hierarchical reference, wherein the hierarchical reference corresponds to one or more nodes in one or more levels in the hierarchical structure of the electronic form , Wherein each level has at least one node and has a corresponding level type, and each node corresponds to one or more cells in the spreadsheet, wherein the level structure further includes the one or more nodes Affiliation;
    基于所述层级引用与所述一个或多个节点之间的对应关系来确定所述一个或多个节点之间的依赖关系;Determine the dependency relationship between the one or more nodes based on the correspondence relationship between the hierarchical reference and the one or more nodes;
    基于所述运算符和所述依赖关系来确定所述一个或多个节点之间的计算关系;以及Determining the calculation relationship between the one or more nodes based on the operator and the dependency relationship; and
    至少基于用于所述电子表格的所述层级结构和所述计算关系来生成所述电子表格公式。The spreadsheet formula is generated based at least on the hierarchical structure and the calculation relationship for the spreadsheet.
  2. 根据权利要求1所述的方法,其中,所述获取用于所述电子表格的层级公式的步骤包括:The method according to claim 1, wherein the step of obtaining a hierarchical formula for the electronic form comprises:
    提供图形用户界面编辑器,其中所述图形用户界面编辑器包括用于指定不同层级的节点和/或运算符的组件;Provide a graphical user interface editor, wherein the graphical user interface editor includes components for specifying nodes and/or operators at different levels;
    接收针对用于指定不同层级的节点和/或运算符的组件的输入;以及Receive input for components used to specify nodes and/or operators at different levels; and
    基于所述输入来生成所述层级公式。The hierarchical formula is generated based on the input.
  3. 根据权利要求1所述的方法,其中,所述获取用于所述电子表格的层级公式的步骤包括:The method according to claim 1, wherein the step of obtaining a hierarchical formula for the electronic form comprises:
    接收用户输入的文本代码;以及Receive the text code entered by the user; and
    解析所述文本代码以生成所述层级公式。The text code is parsed to generate the hierarchical formula.
  4. 根据权利要求1所述的方法,其中,所述运算符包括原子运算符,所述原子运算符包括以下各项中的一种或多种:数学运算符、数学函数、常量、系统定义函数、用户自定义原子运算符。The method of claim 1, wherein the operator includes an atomic operator, and the atomic operator includes one or more of the following: mathematical operators, mathematical functions, constants, system-defined functions, User-defined atomic operators.
  5. 根据权利要求4所述的方法,还包括:The method according to claim 4, further comprising:
    根据所述层级公式中的所述原子运算符来构建复合运算符,其中,所述复合运算符包括所述层级公式中的所有原子运算符的组合。A compound operator is constructed according to the atomic operator in the hierarchical formula, wherein the compound operator includes a combination of all the atomic operators in the hierarchical formula.
  6. 根据权利要求5所述的方法,其中,所述基于所述运算符和所述依赖关系来确定所述一个或多个节点之间的计算关系的步骤还包括:The method according to claim 5, wherein the step of determining the calculation relationship between the one or more nodes based on the operator and the dependency relationship further comprises:
    至少基于所述复合运算符和所述依赖关系来确定所述一个或多个节点之间的计算关系。The calculation relationship between the one or more nodes is determined based on at least the compound operator and the dependency relationship.
  7. 根据权利要求1至6中任一项所述的方法,其中,所述层级引用包括位于所述层级公式中的等号左侧的第一层级引用和位于所述层级公式中的等号右侧的第二层级引用,其中,第一层级引用对应于所述一个或多个节点中的第一节点,而第二层级引用对应于所述一个或多个节点中的第二节点。The method according to any one of claims 1 to 6, wherein the level reference includes a first level reference located on the left side of the equal sign in the level formula and a first level reference located on the right side of the equal sign in the level formula The second-level reference of, wherein the first-level reference corresponds to the first node in the one or more nodes, and the second-level reference corresponds to the second node in the one or more nodes.
  8. 根据权利要求7所述的方法,其中,所述基于所述层级引用与所述一个或多个节点之间的对应关系来确定所述一个或多个节点之间的依赖关系的步骤包括:The method according to claim 7, wherein the step of determining the dependency relationship between the one or more nodes based on the correspondence relationship between the hierarchical reference and the one or more nodes comprises:
    至少基于第一层级引用与第一节点之间的对应关系以及第二层级引用与第二节点之间的对应关系来确定第一节点与第二节点之间的依赖关系。The dependency relationship between the first node and the second node is determined based at least on the correspondence between the first-level reference and the first node and the correspondence between the second-level reference and the second node.
  9. 根据权利要求1至6中任一项所述的方法,还包括:The method according to any one of claims 1 to 6, further comprising:
    针对所述一个或多个节点中的每个节点,经由层级计算图存储该节点与其他节点之间的计算关系。For each node of the one or more nodes, the calculation relationship between the node and other nodes is stored via a hierarchical calculation graph.
  10. 根据权利要求8所述的方法,其中,所述基于所述运算符和所述依赖关系来确定所述一个或多个节点之间的计算关系包括:The method according to claim 8, wherein the determining the calculation relationship between the one or more nodes based on the operator and the dependency relationship comprises:
    基于所述运算符以及第一节点与第二节点之间的依赖关系来确定第一节点与第二节点之间的计算关系。The calculation relationship between the first node and the second node is determined based on the operator and the dependency relationship between the first node and the second node.
  11. 根据权利要求10所述的方法,还包括:The method according to claim 10, further comprising:
    针对第一节点,经由层级计算图存储第一节点与第二节点之间的计算关系。For the first node, the calculation relationship between the first node and the second node is stored via the hierarchical calculation graph.
  12. 根据权利要求1至6中任一项所述的方法,其中,所述至少基于用于所述电子表格的所述层级结构和所述计算关系来生成所述电子表格公式包括:The method according to any one of claims 1 to 6, wherein the generating the spreadsheet formula based at least on the hierarchical structure for the spreadsheet and the calculation relationship comprises:
    对于所述一个或多个节点中的每个当前节点,基于所述一个或多个节点中的该当前节点与其他节点之间的计算关系来确定该当前节点所对应的一个或多个第一单元格中的每个第一单元格与其他节点所对应的一个或多个第二单元格中的每个第二单元格之间的计算关系;以及For each current node in the one or more nodes, one or more first nodes corresponding to the current node are determined based on the calculation relationship between the current node and other nodes in the one or more nodes. The calculation relationship between each first cell in the cell and each second cell in the one or more second cells corresponding to other nodes; and
    至少基于所述一个或多个第一单元格中的每个第一单元格与所述一个或多个第二单元格中的每个第二单元格之间的计算关系,生成用于所述一个或多个第一单元格中的每个第一单元格的电子表格公式。Based on at least the calculated relationship between each first cell in the one or more first cells and each second cell in the one or more second cells, the The spreadsheet formula for each of the one or more first cells.
  13. 根据权利要求12所述的方法,其中,所述确定该当前节点所对应的一个或多个第一单元格中的每个第一单元格与其他节点所对应的一个或多个第二单元格中的每个第二单元格之间的计算关系的步骤包括:The method according to claim 12, wherein said determining each first cell of the one or more first cells corresponding to the current node and one or more second cells corresponding to other nodes The steps of calculating the relationship between each second cell include:
    至少基于所述一个或多个节点中的该当前节点所对应的运算符,确定该当前节点所对应的一个或多个第一单元格中的每个第一单元格所对应的运算符;以及Determine the operator corresponding to each first cell in the one or more first cells corresponding to the current node based at least on the operator corresponding to the current node in the one or more nodes; and
    至少基于所述一个或多个节点中的该当前节点与其他节点之间的依赖关系,确定该当前节点所对应的一个或多个第一单元格中的每个第一单元格与其他节点所对应的一个或多个第二单元格中的每个第二单元格之间的依赖关系。At least based on the dependency relationship between the current node and other nodes in the one or more nodes, it is determined that each first cell of the one or more first cells corresponding to the current node is connected to other nodes. Corresponding to the dependency relationship between each second cell in one or more second cells.
  14. 根据权利要求13所述的方法,其中,所述生成用于所述一个或多个第一单元格中的每个第一单元格的电子表格公式的步骤包括:The method according to claim 13, wherein the step of generating a spreadsheet formula for each first cell of the one or more first cells comprises:
    至少基于该当前节点所对应的一个或多个第一单元格中的每个第一单元格所对应的运算符、以及该当前节点所对应的一个或多个第一单元格中的每个第一单元格与其他节点所对应的一个或多个第二单元格中的每个第二单元格之间的依赖关系,生成用于所述一个或多个第一单元格中的每个第一单元格的电子表格公式。At least based on the operator corresponding to each first cell in the one or more first cells corresponding to the current node, and each first cell in the one or more first cells corresponding to the current node The dependency relationship between a cell and each second cell in one or more second cells corresponding to other nodes is generated for each first cell in the one or more first cells Spreadsheet formula for the cell.
  15. 根据权利要求14所述的方法,其中,The method of claim 14, wherein:
    所述一个或多个节点中的该当前节点所对应的运算符是与用于所述电子表格的层级结构中的所述一个或多个节点中的一个节点相对应的第一级复合运算符,第一级复合运算符包括一个或多个第一级原子运算符;The operator corresponding to the current node in the one or more nodes is a first-level compound operator corresponding to one of the one or more nodes in the hierarchical structure of the spreadsheet , The first-level compound operator includes one or more first-level atomic operators;
    所述一个或多个第一单元格中的每个第一单元格所对应的运算符是与所述电子表格中的所述一个或多个单元格中的一个单元格相对应的第二级复合运算符,第二级复合运算符包括一个或多个第二级原子运算符;以及The operator corresponding to each first cell in the one or more first cells is the second level corresponding to one cell in the one or more cells in the spreadsheet Compound operators, the second-level compound operators include one or more second-level atomic operators; and
    至少基于所述一个或多个节点中的该当前节点所对应的第一级复合运算符,确定该当前节点所对应的一个或多个第一单元格中的每个第一单元格所对应的第二级复合运算符。Based on at least the first-level compound operator corresponding to the current node in the one or more nodes, determine the corresponding one of the one or more first cells corresponding to the current node The second level compound operator.
  16. 根据权利要求15所述的方法,其中,The method according to claim 15, wherein:
    第一级复合运算符采用第一级有向图来存储,第一级有向图中的各个有向图节点代表第一级复合运算符中的各个第一级原子运算符,以及第一级有向图中的各个有向图节点之间的有向边代表第一级复合运算符中的各个第一级原子运算符之间的组合关系;The first-level compound operator uses the first-level directed graph for storage. Each directed graph node in the first-level directed graph represents each first-level atomic operator in the first-level compound operator, and the first-level The directed edges between each directed graph node in the directed graph represent the combination relationship between each first-level atomic operator in the first-level compound operator;
    第二级复合运算符采用第二级有向图来存储,第二级有向图中的各个有向图节点代表第二级复合运算符中的各个第二级原子运算符,以及第二级有向图中的各个有向图节点之间的有向边代表第二级复合运算符中的各个第二级原子运算符之间的组合关系;以及The second-level compound operator uses a second-level directed graph for storage. Each directed graph node in the second-level directed graph represents each second-level atomic operator in the second-level compound operator, and the second-level The directed edges between each directed graph node in the directed graph represent the combination relationship between each second-level atomic operator in the second-level compound operator; and
    通过遍历与第一级复合运算符相对应的第一级有向图来确定第二级有向图,并且根据第二级有向图来确定第二级复合运算符。The second-level directed graph is determined by traversing the first-level directed graph corresponding to the first-level compound operator, and the second-level compound operator is determined according to the second-level directed graph.
  17. 根据权利要求16所述的方法,其中,所述通过遍历与第一级复合运算符相对应的第一级有向图来确定第二级有向图包括:The method according to claim 16, wherein the determining the second-level directed graph by traversing the first-level directed graph corresponding to the first-level compound operator comprises:
    按照后序遍历的顺序来遍历第一级有向图,从而先遍历第一级有向图中的子有向图节点,再遍历第一级有向图中的父有向图节点。Traverse the first-level directed graph in the order of post-order traversal, so that the child directed graph nodes in the first-level directed graph are traversed first, and then the parent directed graph nodes in the first-level directed graph are traversed.
  18. 根据权利要求17所述的方法,还包括:The method according to claim 17, further comprising:
    在遍历到第一级有向图中的一个或多个第一级有向图节点中的当前第一级有向图节点时,根据当前第一级有向图节点所代表的第一级原子运算符、以及当前第一级有向图节点的第一级子有向图节点的属性信息来确定当前第一级有向图节点的属性信息,其中,每个第一级有向图节点的属性信息包括以下各项中的一种或多种:电子表格中的单元格的位置信息,与电子表格中的单元格相对应的标签信息和电子表格中 的单元格的位置信息,与电子表格中的单元格相对应的标签信息和中间级节点,与电子表格中的单元格相对应的中间级节点,其中所述中间级节点用以存储中间计算结果;When traversing to the current first-level directed graph node in one or more first-level directed graph nodes in the first-level directed graph, according to the first-level atom represented by the current first-level directed graph node Operator and the attribute information of the first-level child directed graph node of the current first-level directed graph node to determine the attribute information of the current first-level directed graph node. The attribute information includes one or more of the following items: the location information of the cells in the spreadsheet, the label information corresponding to the cells in the spreadsheet, and the location information of the cells in the spreadsheet, and the location information of the cells in the spreadsheet. Label information and intermediate nodes corresponding to the cells in, and intermediate nodes corresponding to the cells in the spreadsheet, wherein the intermediate nodes are used to store intermediate calculation results;
    根据第一级有向图中的所述一个或多个第一级有向图节点中的每个第一级有向图节点的属性信息来确定中间级有向图中的各个中间级有向图节点集合,根据第一级有向图中的所述一个或多个第一级有向图节点之间的依赖关系来确定中间级有向图中的每个中间级有向图节点集合中的各个中间级有向图节点与中间级有向图中的其他中间级有向图节点集合中的各个中间级有向图节点之间的依赖关系。According to the attribute information of each first-level directed graph node in the one or more first-level directed graph nodes in the first-level directed graph, each intermediate-level directed graph in the intermediate-level directed graph is determined The graph node set is determined according to the dependency relationship between the one or more first-level directed graph nodes in the first-level directed graph in each intermediate-level directed graph node set in the intermediate-level directed graph The dependency between each intermediate-level directed graph node in the intermediate-level directed graph and each intermediate-level directed graph node in the set of other intermediate-level directed graph nodes in the intermediate-level directed graph.
  19. 根据权利要求18所述的方法,其中,第一级原子运算符被划分为逐元素原子运算符、降维原子运算符、错位原子运算符、和用户自定义原子运算符中的一种。The method according to claim 18, wherein the first-level atomic operators are classified into one of element-wise atomic operators, dimensionality reduction atomic operators, misplaced atomic operators, and user-defined atomic operators.
  20. 根据权利要求19所述的方法,其中,当遍历到的第一级有向图中的当前第一级有向图节点所代表的第一级原子运算符为逐元素原子运算符时,The method according to claim 19, wherein, when the first-level atomic operator represented by the current first-level directed graph node in the traversed first-level directed graph is an element-wise atomic operator,
    如果该当前第一级有向图节点的各个第一级子有向图节点的属性信息都包含与电子表格中的单元格相对应的标签信息,则根据各个第一级子有向图节点的属性信息中所包含的标签信息的交集设置该当前第一级有向图节点的属性信息中的标签信息,根据该当前第一级有向图节点所代表的第一级原子运算符设置该当前第一级有向图节点的属性信息中的中间级原子运算符,根据该当前第一级有向图节点的属性信息中的标签信息和中间级原子运算符来确定与该当前第一级有向图节点相对应的当前中间级有向图节点集合,以及至少根据该当前第一级有向图节点与其第一级子有向图节点之间的依赖关系并且根据该当前第一级有向图节点与其第一级子有向图节点的属性信息中的标签信息来确定与该当前第一级有向图节点相对应的当前中间级有向图节点集合中的各个中间级有向图节点与中间级有向图中的其他中间级有向图节点集合中的各个中间级有向图节点之间的依赖关系;If the attribute information of each first-level sub-directed graph node of the current first-level directed graph node contains the label information corresponding to the cell in the spreadsheet, then the attribute information of each first-level sub-directed graph node The intersection of the label information contained in the attribute information sets the label information in the attribute information of the current first-level directed graph node, and sets the current first-level atomic operator represented by the current first-level directed graph node. The intermediate-level atomic operator in the attribute information of the first-level directed graph node is determined to be related to the current first-level based on the label information and the intermediate-level atomic operator in the attribute information of the current first-level directed graph node. The current intermediate-level directed graph node set corresponding to the directed graph node, and at least according to the dependency relationship between the current first-level directed graph node and its first-level child directed graph nodes, and according to the current first-level directed graph node The label information in the attribute information of the graph node and its first-level child directed graph node is used to determine each intermediate-level directed graph node in the current intermediate-level directed graph node set corresponding to the current first-level directed graph node The dependency relationship between each intermediate-level directed graph node in the set of other intermediate-level directed graph nodes in the intermediate-level directed graph;
    如果该当前第一级有向图节点的各个第一级子有向图节点的属性信息都不包含标签信息,则使得该当前第一级有向图节点的属性信息中不包含标签信息,根据该当前第一级有向图节点所代表的第一级原子运算符设置该当前第一级有向图节点的属性信息中的中间级原子运算符,至少根据该当前第一级有向图节点的属性信息中的中间级原子运算符来确定与该当前第一级有向图节点相对应的当前中间级有向图节点 集合,以及至少根据该当前第一级有向图节点与其第一级子有向图节点之间的依赖关系来确定与该当前第一级有向图节点相对应的当前中间级有向图节点集合中的各个中间级有向图节点与中间级有向图中的其他中间级有向图节点集合中的各个中间级有向图节点之间的依赖关系;If the attribute information of each first-level child directed graph node of the current first-level directed graph node does not contain label information, then the attribute information of the current first-level directed graph node does not include label information, according to The first-level atomic operator represented by the current first-level directed graph node sets the intermediate-level atomic operator in the attribute information of the current first-level directed graph node, at least according to the current first-level directed graph node The intermediate-level atomic operator in the attribute information of the current first-level directed graph node is used to determine the current intermediate-level directed graph node set corresponding to the current first-level directed graph node, and at least according to the current first-level directed graph node and its first-level The dependency relationship between the sub-directed graph nodes is used to determine the current intermediate-level directed graph node corresponding to the current first-level directed graph node in each intermediate-level directed graph node and the intermediate-level directed graph. The dependency relationship between each intermediate-level directed graph node in the set of other intermediate-level directed graph nodes;
    如果该当前第一级有向图节点的一部分第一级子有向图节点的属性信息包含与电子表格中的单元格相对应的标签信息并且该当前第一级有向图节点的另一部分第一级子有向图节点的属性信息不包含标签信息,则根据包含标签信息的第一级子有向图节点的属性信息中所包含的标签信息的交集设置该当前第一级有向图节点的属性信息中的标签信息,根据该当前第一级有向图节点所代表的第一级原子运算符设置该当前第一级有向图节点的属性信息中的中间级原子运算符,根据该当前第一级有向图节点的属性信息中的标签信息和中间级原子运算符来确定与该当前第一级有向图节点相对应的当前中间级有向图节点集合,以及至少根据该当前第一级有向图节点与其第一级子有向图节点之间的依赖关系并且根据该当前第一级有向图节点与其第一级子有向图节点的属性信息中的标签信息来确定与该当前第一级有向图节点相对应的当前中间级有向图节点集合中的各个中间级有向图节点与中间级有向图中的其他中间级有向图节点集合中的各个中间级有向图节点之间的依赖关系。If the attribute information of a part of the current first-level directed graph node of the first-level child directed graph node contains the label information corresponding to the cell in the spreadsheet and the other part of the current first-level directed graph node is the first If the attribute information of the first-level child directed graph node does not contain label information, the current first-level directed graph node is set according to the intersection of the label information contained in the attribute information of the first-level child directed graph node containing the label information According to the label information in the attribute information of the current first-level directed graph node, the middle-level atomic operator in the attribute information of the current first-level directed graph node is set according to the first-level atomic operator represented by the current first-level directed graph node. The label information and intermediate atomic operators in the attribute information of the current first-level directed graph node are used to determine the current intermediate-level directed graph node set corresponding to the current first-level directed graph node, and at least according to the current The dependency relationship between the first-level directed graph node and its first-level child directed graph node is determined according to the label information in the attribute information of the current first-level directed graph node and its first-level child directed graph node Each intermediate-level directed graph node in the current intermediate-level directed graph node set corresponding to the current first-level directed graph node and each intermediate-level directed graph node set in the intermediate-level directed graph The dependency relationship between the nodes of the hierarchical directed graph.
  21. 根据权利要求19所述的方法,其中,当遍历到的第一级有向图中的当前第一级有向图节点所代表的第一级原子运算符为降维原子运算符时,The method according to claim 19, wherein, when the first-level atomic operator represented by the current first-level directed graph node in the traversed first-level directed graph is a dimensionality reduction atomic operator,
    使得该当前第一级有向图节点的属性信息中不包含标签信息或包含该当前第一级有向图节点的第一级子有向图节点的属性信息中的标签信息的一个子集,至少根据该当前第一级有向图节点所代表的第一级原子运算符设置该当前第一级有向图节点的属性信息中的中间级原子运算符,至少根据该当前第一级有向图节点的属性信息中的中间级原子运算符来确定与该当前第一级有向图节点相对应的当前中间级有向图节点集合,以及至少根据该当前第一级有向图节点与其第一级子有向图节点之间的依赖关系来确定与该当前第一级有向图节点相对应的当前中间级有向图节点集合中的各个中间级有向图节点与中间级有向图中的其他中间级有向图节点集合中的各个中间级有向图节点之间的依赖关系。So that the attribute information of the current first-level directed graph node does not contain label information or includes a subset of the label information in the attribute information of the first-level child directed graph node of the current first-level directed graph node, Set the intermediate-level atomic operator in the attribute information of the current first-level directed graph node at least according to the first-level atomic operator represented by the current first-level directed graph node, and at least according to the current first-level directed graph node The intermediate-level atomic operator in the attribute information of the graph node determines the current intermediate-level directed graph node set corresponding to the current first-level directed graph node, and at least according to the current first-level directed graph node and its first-level directed graph node The dependency relationship between the first-level sub-directed graph nodes is used to determine each intermediate-level directed graph node and the intermediate-level directed graph in the current intermediate-level directed graph node set corresponding to the current first-level directed graph node The dependency relationship between each intermediate-level directed graph node in the set of other intermediate-level directed graph nodes in.
  22. 根据权利要求19所述的方法,其中,当遍历到的第一级有向图中的当前第 一级有向图节点所代表的第一级原子运算符为错位原子运算符时,The method according to claim 19, wherein, when the first-level atomic operator represented by the current first-level directed graph node in the traversed first-level directed graph is a misplaced atomic operator,
    在该当前第一级有向图节点的第一级子有向图节点的属性信息包含与电子表格中的单元格相对应的标签信息的情况下,将第一级子有向图节点的属性信息中所包含的标签信息进行错位后获得的错位后标签信息设置为该当前第一级有向图节点的属性信息中的标签信息,将“等同”原子运算符设置为该当前第一级有向图节点的属性信息中的中间级原子运算符,根据该当前第一级有向图节点的属性信息中的标签信息和中间级原子运算符来确定与该当前第一级有向图节点相对应的当前中间级有向图节点集合,以及至少根据该当前第一级有向图节点与其第一级子有向图节点之间的依赖关系并且根据该当前第一级有向图节点与其第一级子有向图节点的属性信息中的标签信息来确定与该当前第一级有向图节点相对应的当前中间级有向图节点集合中的各个中间级有向图节点与中间级有向图中的其他中间级有向图节点集合中的各个中间级有向图节点之间的依赖关系。In the case that the attribute information of the first-level child directed graph node of the current first-level directed graph node contains the label information corresponding to the cell in the spreadsheet, the attribute information of the first-level child directed graph node The label information contained in the information is set to the label information in the attribute information of the current first-level directed graph node, and the “equal” atomic operator is set to the current first-level directed graph node. The intermediate-level atomic operator in the attribute information of the directed graph node is determined to be relative to the current first-level directed graph node according to the label information and the intermediate-level atomic operator in the attribute information of the current first-level directed graph node. The corresponding set of current intermediate-level directed graph nodes, and at least according to the dependency relationship between the current first-level directed graph node and its first-level child directed graph nodes, and according to the current first-level directed graph node and its first level The label information in the attribute information of the first-level sub-directed graph node determines the current intermediate-level directed graph node set corresponding to the current first-level directed graph node. The dependency relationship between each intermediate-level directed graph node in the set of other intermediate-level directed graph nodes in the directed graph.
  23. 根据权利要求18至22中任一项所述的方法,还包括:The method according to any one of claims 18 to 22, further comprising:
    分别从所述中间级有向图中抽取以中间级有向图根节点集合中的各个中间级有向图根节点为根节点的子有向图,并且将所抽取的子有向图作为第二级有向图以根据第二级有向图来确定第二级复合运算符。Extract the sub-directed graphs with each intermediate-level directed graph root node in the set of intermediate-level directed graph root nodes as the root node from the intermediate-level directed graph, and use the extracted sub-directed graph as the first The second-level directed graph is used to determine the second-level compound operator based on the second-level directed graph.
  24. 根据权利要求23所述的方法,其中,所述抽取的步骤包括:The method according to claim 23, wherein the step of extracting comprises:
    通过将各个中间级有向图根节点的属性信息中的标签信息与各个中间级有向图左值节点的属性信息中的标签信息进行匹配,将中间级有向图根节点集合中的各个中间级有向图根节点的位置与中间级有向图左值节点集合中的各个中间级有向图左值节点的位置相对应;以及By matching the label information in the attribute information of the root node of each intermediate-level directed graph with the label information in the attribute information of the left-value node of each intermediate-level directed graph, each intermediate-level directed graph root node set The position of the root node of the level directed graph corresponds to the position of the left value node of each intermediate level directed graph in the set of left value nodes of the intermediate level directed graph; and
    将以相应的匹配位置处的中间级有向图根节点为根节点的子有向图抽出作为第二级有向图以根据第二级有向图来确定中间级左值节点对应的单元格的第二级复合运算符。The sub-directed graph with the root node of the intermediate-level directed graph at the corresponding matching position as the root node is extracted as the second-level directed graph to determine the cell corresponding to the intermediate-level lvalue node according to the second-level directed graph The second-level compound operator.
  25. 根据权利要求12所述的方法,还包括:The method according to claim 12, further comprising:
    将所生成的用于所述一个或多个第一单元格中的每个第一单元格的电子表格公式存储到电子表格文件中的相应单元格中。The generated spreadsheet formula for each first cell of the one or more first cells is stored in a corresponding cell in the spreadsheet file.
  26. 根据权利要求4所述的方法,其中,The method of claim 4, wherein:
    所述自定义原子运算符是通过对系统预设的原子运算符进行组合而定义的。The custom atomic operator is defined by combining the atomic operators preset by the system.
  27. 根据权利要求26所述的方法,其中,The method of claim 26, wherein:
    在用于电子表格的层级公式中包括所述自定义原子运算符的情况下,将所述自定义原子运算符转换为系统预设的原子运算符。In the case that the custom atomic operator is included in the hierarchical formula used in the spreadsheet, the custom atomic operator is converted into a system preset atomic operator.
  28. 根据权利要求27所述的方法,其中,所述展开的步骤包括:The method according to claim 27, wherein the step of unfolding comprises:
    将层级公式的原始有向图中的所述自定义原子运算符替换为代表所述自定义原子运算符的有向图的根节点;以及Replacing the custom atomic operator in the original directed graph of the hierarchical formula with the root node of the directed graph representing the custom atomic operator; and
    用层级公式的原始有向图中的以所述自定义原子运算符为父节点的子有向图来替换所述自定义原子运算符的有向图中的叶子节点。Replace the leaf nodes in the directed graph of the custom atomic operator with the child directed graph in the original directed graph of the hierarchical formula with the custom atomic operator as the parent node.
  29. 根据权利要求1所述的方法,还包括:The method according to claim 1, further comprising:
    基于已经获取的所述层级公式,更新智能建议知识库,所述智能建议知识库包括与所述层级公式或者层级结构有关的信息;以及Updating the knowledge base of intelligent suggestions based on the obtained hierarchy formula, the knowledge base of intelligent suggestions including information related to the hierarchy formula or hierarchy structure; and
    基于所述智能建议知识库,在将要获取新的层级公式时进行智能建议。Based on the intelligent suggestion knowledge base, intelligent suggestions are made when a new level formula is about to be obtained.
  30. 根据权利要求1所述的方法,还包括:The method according to claim 1, further comprising:
    自动检测所获取的所述层级公式中存在的缺陷;以及Automatically detect defects in the obtained hierarchy formula; and
    基于所述缺陷自动生成调试信息并且提示所述调试信息,Automatically generate debugging information based on the defect and prompt the debugging information,
    其中,所述调试信息包括错误或警告。Wherein, the debugging information includes errors or warnings.
  31. 根据权利要求1所述的方法,还包括:The method according to claim 1, further comprising:
    存储电子表格模型,所述电子表格模型包括以下各项中的一个或多个:用于电子表格的层级结构、用于电子表格的层级计算图和电子表格文件。An electronic form model is stored, and the electronic form model includes one or more of the following: a hierarchical structure for the electronic form, a hierarchical calculation diagram for the electronic form, and an electronic form file.
  32. 根据权利要求31所述的方法,还包括:The method of claim 31, further comprising:
    导入和/或导出所述电子表格模型。Import and/or export the spreadsheet model.
  33. 根据权利要求3所述的方法,其中,所述解析所述文本代码以生成所述层级公式的步骤包括:The method according to claim 3, wherein the step of parsing the text code to generate the hierarchical formula comprises:
    对所述文本代码进行分词以得到分词流;Perform word segmentation on the text code to obtain a word stream;
    识别所述分词流中与所述运算符相关的分词,以确定所述运算符;Identifying the word segmentation related to the operator in the word segmentation stream to determine the operator;
    识别所述分词流中与所述电子表格的层级结构中的所述一个或多个层级中的所述一个或多个节点相关的分词,以确定所述层级引用;以及Identifying the word segmentation related to the one or more nodes in the one or more levels in the hierarchical structure of the spreadsheet in the word segmentation stream to determine the level reference; and
    根据所确定的运算符和层级引用来生成所述层级公式。The hierarchical formula is generated according to the determined operator and hierarchical reference.
  34. 根据权利要求5所述的方法,其中,所述复合运算符采用以下各项中的一个或多个来存储:The method according to claim 5, wherein the compound operator adopts one or more of the following to store:
    字符串;String
    由函数指针指向的计算机实现的函数;和The computer-implemented function pointed to by the function pointer; and
    有向图。Directed graph.
  35. 根据权利要求34所述的方法,其中,所述有向图中的各个节点代表所述层级公式中的所述运算符,以及所述有向图中的各个节点之间的有向边代表所述层级公式中的所述运算符之间的组合关系。The method according to claim 34, wherein each node in the directed graph represents the operator in the hierarchical formula, and the directed edge between each node in the directed graph represents the The combinatorial relationship between the operators in the hierarchical formula.
  36. 根据权利要求25所述的方法,其中,所述将所生成的用于所述一个或多个第一单元格中的每个第一单元格的电子表格公式存储到相应的第一单元格中的步骤还包括:The method according to claim 25, wherein the generated spreadsheet formula for each first cell of the one or more first cells is stored in the corresponding first cell The steps also include:
    对所述电子表格中的所述一个或多个第一单元格和所述一个或多个第二单元格中的一部分或全部的单元格名称进行自动命名;以及Automatically naming a part or all of the cell names of the one or more first cells and the one or more second cells in the electronic table; and
    利用自动命名的单元格名称来改写所述电子表格公式并且存储改写后的电子表格公式。Utilize automatically named cell names to rewrite the spreadsheet formula and store the rewritten spreadsheet formula.
  37. 一种用于生成电子表格公式的装置,包括:用于执行如权利要求1-36中的任一项所述的方法的步骤的部件。An apparatus for generating electronic form formulas, comprising: components for performing the steps of the method according to any one of claims 1-36.
  38. 一种用于生成电子表格公式的设备,包括:A device used to generate spreadsheet formulas, including:
    至少一个处理器;以及At least one processor; and
    至少一个存储设备,所述至少一个存储设备存储有指令,当所述指令由所述至少一个处理器执行时使得所述至少一个处理器执行如权利要求1-36中的任一项所述的方法。At least one storage device, the at least one storage device stores instructions, and when the instructions are executed by the at least one processor, the at least one processor is caused to execute the method according to any one of claims 1-36 method.
  39. 一种非瞬态计算机可读存储介质,存储有指令,当所述指令由处理器执行时使得执行如权利要求1-36中的任一项所述的方法。A non-transitory computer-readable storage medium storing instructions, which when executed by a processor, cause the method according to any one of claims 1-36 to be executed.
  40. 一种用于生成电子表格公式的装置,所述装置包括:A device for generating an electronic form formula, the device comprising:
    层级公式编辑器,所述层级公式编辑器被配置为获取用于所述电子表格的层级公式,所述层级公式包括运算符和层级引用,其中所述层级引用对应于用于电子表格的层级结构中的一个或多个层级中的一个或多个节点,其中每个层级具有至少一个节点并且具有相应的层级类型,每个节点对应于所述电子表格中的一个或多个单元格,其中所述层级结构还包括所述一个或多个节点之间的隶属关系;A hierarchical formula editor configured to obtain a hierarchical formula for the electronic form, the hierarchical formula including an operator and a hierarchical reference, wherein the hierarchical reference corresponds to a hierarchical structure for the electronic form One or more nodes in one or more levels in each level, where each level has at least one node and has a corresponding level type, and each node corresponds to one or more cells in the spreadsheet, where all The hierarchical structure also includes the affiliation relationship between the one or more nodes;
    层级公式解析器,所述层级公式解析器被配置为基于所述层级引用与所述一个或多个节点之间的对应关系来确定所述一个或多个节点之间的依赖关系;所述层级公式解析器还被配置为基于所述运算符和所述依赖关系来确定所述一个或多个节点之间的计算关系;以及A hierarchical formula parser, the hierarchical formula parser is configured to determine the dependency relationship between the one or more nodes based on the correspondence between the hierarchical reference and the one or more nodes; the hierarchy The formula parser is further configured to determine the calculation relationship between the one or more nodes based on the operator and the dependency relationship; and
    公式转译器,所述公式转译器被配置为至少基于用于所述电子表格的所述层级结构和所述计算关系来生成所述电子表格公式。A formula translator configured to generate the spreadsheet formula based on at least the hierarchical structure and the calculation relationship for the spreadsheet.
  41. 根据权利要求40所述的装置,其中,所述层级公式编辑器包括图形用户界面编辑器,其中所述图形用户界面编辑器包括用于指定不同层级的节点和/或运算符的组件,并且其中所述图形用户界面编辑器还被配置为:The apparatus of claim 40, wherein the hierarchical formula editor includes a graphical user interface editor, wherein the graphical user interface editor includes components for specifying nodes and/or operators of different hierarchies, and wherein The graphical user interface editor is also configured to:
    接收针对用于指定不同层级的节点和/或运算符的组件的输入;以及Receive input for components used to specify nodes and/or operators at different levels; and
    基于所述输入来生成所述层级公式。The hierarchical formula is generated based on the input.
  42. 根据权利要求40所述的装置,其中,所述层级公式编辑器包括文本编辑器,所述文本编辑器被配置为:The apparatus of claim 40, wherein the hierarchical formula editor comprises a text editor, and the text editor is configured to:
    接收用户输入的文本代码;以及Receive the text code entered by the user; and
    解析所述文本代码以生成所述层级公式。The text code is parsed to generate the hierarchical formula.
  43. 根据权利要求40所述的装置,其中,所述运算符包括原子运算符,所述原子运算符包括以下各项中的一种或多种:数学运算符、数学函数、常量、系统定义函数、用户自定义原子运算符。The device of claim 40, wherein the operator includes an atomic operator, and the atomic operator includes one or more of the following: mathematical operators, mathematical functions, constants, system-defined functions, User-defined atomic operators.
  44. 根据权利要求43所述的装置,其中,所述层级公式解析器还被配置为:The device of claim 43, wherein the hierarchical formula parser is further configured to:
    根据所述层级公式中的所述原子运算符来构建复合运算符,其中,所述复合运算符包括所述层级公式中的所有原子运算符的组合。A compound operator is constructed according to the atomic operator in the hierarchical formula, wherein the compound operator includes a combination of all the atomic operators in the hierarchical formula.
  45. 根据权利要求44所述的装置,其中,所述层级公式解析器还被配置为:The device of claim 44, wherein the hierarchical formula parser is further configured to:
    至少基于所述复合运算符和所述依赖关系来确定所述一个或多个节点之间的计算关系。The calculation relationship between the one or more nodes is determined based on at least the compound operator and the dependency relationship.
  46. 根据权利要求40至45中任一项所述的装置,其中,所述层级引用包括位于所述层级公式中的等号左侧的第一层级引用和位于所述层级公式中的等号右侧的第二层级引用,其中,第一层级引用对应于所述一个或多个节点中的第一节点,而第二层级引用对应于所述一个或多个节点中的第二节点。The device according to any one of claims 40 to 45, wherein the level reference includes a first level reference located on the left side of the equal sign in the level formula and a first level reference located on the right side of the equal sign in the level formula The second-level reference of, wherein the first-level reference corresponds to the first node of the one or more nodes, and the second-level reference corresponds to the second node of the one or more nodes.
  47. 根据权利要求46所述的装置,其中,所述层级公式解析器还被配置为:The apparatus of claim 46, wherein the hierarchical formula parser is further configured to:
    至少基于第一层级引用与第一节点之间的对应关系以及第二层级引用与第二节点之间的对应关系来确定第一节点与第二节点之间的依赖关系。The dependency relationship between the first node and the second node is determined based at least on the correspondence between the first-level reference and the first node and the correspondence between the second-level reference and the second node.
  48. 根据权利要求40至45中任一项所述的装置,还包括层级计算图存储器,所述层级计算图存储器被配置为:The device according to any one of claims 40 to 45, further comprising a hierarchical calculation graph memory, the hierarchical calculation graph memory being configured to:
    针对所述一个或多个节点中的每个节点,经由层级计算图存储该节点与其他节点之间的计算关系。For each node of the one or more nodes, the calculation relationship between the node and other nodes is stored via a hierarchical calculation graph.
  49. 根据权利要求48所述的装置,其中,所述层级公式解析器还被配置为:The apparatus of claim 48, wherein the hierarchical formula parser is further configured to:
    基于所述运算符以及第一节点与第二节点之间的依赖关系来确定第一节点与第 二节点之间的计算关系。The calculation relationship between the first node and the second node is determined based on the operator and the dependency relationship between the first node and the second node.
  50. 根据权利要求49所述的装置,还包括层级计算图存储器,所述层级计算图存储器被配置为:The apparatus according to claim 49, further comprising a hierarchical calculation graph memory, the hierarchical calculation graph memory being configured to:
    针对第一节点,经由层级计算图存储第一节点与第二节点之间的计算关系。For the first node, the calculation relationship between the first node and the second node is stored via the hierarchical calculation graph.
  51. 根据权利要求40至45中任一项所述的装置,其中,所述公式转译器还被配置为:The device according to any one of claims 40 to 45, wherein the formula translator is further configured to:
    对于所述一个或多个节点中的每个当前节点,基于所述一个或多个节点中的该当前节点与其他节点之间的计算关系来确定该当前节点所对应的一个或多个第一单元格中的每个第一单元格与其他节点所对应的一个或多个第二单元格中的每个第二单元格之间的计算关系;以及For each current node in the one or more nodes, one or more first nodes corresponding to the current node are determined based on the calculation relationship between the current node and other nodes in the one or more nodes. The calculation relationship between each first cell in the cell and each second cell in the one or more second cells corresponding to other nodes; and
    至少基于所述一个或多个第一单元格中的每个第一单元格与所述一个或多个第二单元格中的每个第二单元格之间的计算关系,生成用于所述一个或多个第一单元格中的每个第一单元格的电子表格公式。Based on at least the calculated relationship between each first cell in the one or more first cells and each second cell in the one or more second cells, the The spreadsheet formula for each of the one or more first cells.
  52. 根据权利要求51所述的装置,其中,所述公式转译器还被配置为:The device of claim 51, wherein the formula translator is further configured to:
    至少基于所述一个或多个节点中的该当前节点所对应的运算符,确定该当前节点所对应的一个或多个第一单元格中的每个第一单元格所对应的运算符;以及Determine the operator corresponding to each first cell in the one or more first cells corresponding to the current node based at least on the operator corresponding to the current node in the one or more nodes; and
    至少基于所述一个或多个节点中的该当前节点与其他节点之间的依赖关系,确定该当前节点所对应的一个或多个第一单元格中的每个第一单元格与其他节点所对应的一个或多个第二单元格中的每个第二单元格之间的依赖关系。At least based on the dependency relationship between the current node and other nodes in the one or more nodes, it is determined that each first cell of the one or more first cells corresponding to the current node is connected to other nodes. Corresponding to the dependency relationship between each second cell in one or more second cells.
  53. 根据权利要求52所述的装置,其中,所述公式转译器还被配置为:The apparatus of claim 52, wherein the formula translator is further configured to:
    至少基于该当前节点所对应的一个或多个第一单元格中的每个第一单元格所对应的运算符、以及该当前节点所对应的一个或多个第一单元格中的每个第一单元格与其他节点所对应的一个或多个第二单元格中的每个第二单元格之间的依赖关系,生成用于所述一个或多个第一单元格中的每个第一单元格的电子表格公式。At least based on the operator corresponding to each first cell in the one or more first cells corresponding to the current node, and each first cell in the one or more first cells corresponding to the current node The dependency relationship between a cell and each second cell in one or more second cells corresponding to other nodes is generated for each first cell in the one or more first cells Spreadsheet formula for the cell.
  54. 根据权利要求53所述的装置,其中,所述公式转译器还被配置为:The device of claim 53, wherein the formula translator is further configured to:
    所述一个或多个节点中的该当前节点所对应的运算符是与用于所述电子表格的层级结构中的所述一个或多个节点中的一个节点相对应的第一级复合运算符,第一级复合运算符包括一个或多个第一级原子运算符;The operator corresponding to the current node in the one or more nodes is a first-level compound operator corresponding to one of the one or more nodes in the hierarchical structure of the spreadsheet , The first-level compound operator includes one or more first-level atomic operators;
    所述一个或多个第一单元格中的每个第一单元格所对应的运算符是与所述电子表格中的所述一个或多个单元格中的一个单元格相对应的第二级复合运算符,第二级复合运算符包括一个或多个第二级原子运算符;以及The operator corresponding to each first cell in the one or more first cells is the second level corresponding to one cell in the one or more cells in the spreadsheet Compound operators, the second-level compound operators include one or more second-level atomic operators; and
    至少基于所述一个或多个节点中的该当前节点所对应的第一级复合运算符,确定该当前节点所对应的一个或多个第一单元格中的每个第一单元格所对应的第二级复合运算符。Based on at least the first-level compound operator corresponding to the current node in the one or more nodes, determine the corresponding one of the one or more first cells corresponding to the current node The second level compound operator.
  55. 根据权利要求54所述的装置,其中,所述公式转译器还被配置为:The device of claim 54, wherein the formula translator is further configured to:
    第一级复合运算符采用第一级有向图来存储,第一级有向图中的各个有向图节点代表第一级复合运算符中的各个第一级原子运算符,以及第一级有向图中的各个有向图节点之间的有向边代表第一级复合运算符中的各个第一级原子运算符之间的组合关系;The first-level compound operator uses the first-level directed graph for storage. Each directed graph node in the first-level directed graph represents each first-level atomic operator in the first-level compound operator, and the first-level The directed edges between each directed graph node in the directed graph represent the combination relationship between each first-level atomic operator in the first-level compound operator;
    第二级复合运算符采用第二级有向图来存储,第二级有向图中的各个有向图节点代表第二级复合运算符中的各个第二级原子运算符,以及第二级有向图中的各个有向图节点之间的有向边代表第二级复合运算符中的各个第二级原子运算符之间的组合关系;以及The second-level compound operator uses a second-level directed graph for storage. Each directed graph node in the second-level directed graph represents each second-level atomic operator in the second-level compound operator, and the second-level The directed edges between each directed graph node in the directed graph represent the combination relationship between each second-level atomic operator in the second-level compound operator; and
    通过遍历与第一级复合运算符相对应的第一级有向图来确定第二级有向图,并且根据第二级有向图来确定第二级复合运算符。The second-level directed graph is determined by traversing the first-level directed graph corresponding to the first-level compound operator, and the second-level compound operator is determined according to the second-level directed graph.
  56. 根据权利要求55所述的装置,其中,所述公式转译器还被配置为:The device of claim 55, wherein the formula translator is further configured to:
    按照后序遍历的顺序来遍历第一级有向图,从而先遍历第一级有向图中的子有向图节点,再遍历第一级有向图中的父有向图节点。Traverse the first-level directed graph in the order of post-order traversal, so that the child directed graph nodes in the first-level directed graph are traversed first, and then the parent directed graph nodes in the first-level directed graph are traversed.
  57. 根据权利要求56所述的装置,其中,所述公式转译器还被配置为:The device of claim 56, wherein the formula translator is further configured to:
    在遍历到第一级有向图中的一个或多个第一级有向图节点中的当前第一级有向图节点时,根据当前第一级有向图节点所代表的第一级原子运算符、以及当前第一级有向图节点的第一级子有向图节点的属性信息来确定当前第一级有向图节点的属性 信息,其中,每个第一级有向图节点的属性信息包括以下各项中的一种或多种:电子表格中的单元格的位置信息,与电子表格中的单元格相对应的标签信息和电子表格中的单元格的位置信息,与电子表格中的单元格相对应的标签信息和中间级节点,与电子表格中的单元格相对应的中间级节点,其中所述中间级节点用以存储中间计算结果;When traversing to the current first-level directed graph node in one or more first-level directed graph nodes in the first-level directed graph, according to the first-level atom represented by the current first-level directed graph node Operator and the attribute information of the first-level child directed graph node of the current first-level directed graph node to determine the attribute information of the current first-level directed graph node. The attribute information includes one or more of the following items: the location information of the cells in the spreadsheet, the label information corresponding to the cells in the spreadsheet, and the location information of the cells in the spreadsheet, and the location information of the cells in the spreadsheet. Label information and intermediate nodes corresponding to the cells in, and intermediate nodes corresponding to the cells in the spreadsheet, wherein the intermediate nodes are used to store intermediate calculation results;
    根据第一级有向图中的所述一个或多个第一级有向图节点中的每个第一级有向图节点的属性信息来确定中间级有向图中的各个中间级有向图节点集合,根据第一级有向图中的所述一个或多个第一级有向图节点之间的依赖关系来确定中间级有向图中的每个中间级有向图节点集合中的各个中间级有向图节点与中间级有向图中的其他中间级有向图节点集合中的各个中间级有向图节点之间的依赖关系。According to the attribute information of each first-level directed graph node in the one or more first-level directed graph nodes in the first-level directed graph, each intermediate-level directed graph in the intermediate-level directed graph is determined The graph node set is determined according to the dependency relationship between the one or more first-level directed graph nodes in the first-level directed graph in each intermediate-level directed graph node set in the intermediate-level directed graph The dependency between each intermediate-level directed graph node in the intermediate-level directed graph and each intermediate-level directed graph node in the set of other intermediate-level directed graph nodes in the intermediate-level directed graph.
  58. 根据权利要求57所述的装置,其中,第一级原子运算符被划分为逐元素原子运算符、降维原子运算符、错位原子运算符、和用户自定义原子运算符中的一种。The device of claim 57, wherein the first-level atomic operators are classified into one of element-wise atomic operators, dimensionality reduction atomic operators, misplaced atomic operators, and user-defined atomic operators.
  59. 根据权利要求58所述的装置,其中,所述公式转译器还被配置为:当遍历到的第一级有向图中的当前第一级有向图节点所代表的第一级原子运算符为逐元素原子运算符时,The device according to claim 58, wherein the formula translator is further configured to: when traversed to the first-level directed graph, the current first-level directed graph node represents the first-level atomic operator When it is an element-wise atomic operator,
    如果该当前第一级有向图节点的各个第一级子有向图节点的属性信息都包含与电子表格中的单元格相对应的标签信息,则根据各个第一级子有向图节点的属性信息中所包含的标签信息的交集设置该当前第一级有向图节点的属性信息中的标签信息,根据该当前第一级有向图节点所代表的第一级原子运算符设置该当前第一级有向图节点的属性信息中的中间级原子运算符,根据该当前第一级有向图节点的属性信息中的标签信息和中间级原子运算符来确定与该当前第一级有向图节点相对应的当前中间级有向图节点集合,以及至少根据该当前第一级有向图节点与其第一级子有向图节点之间的依赖关系并且根据该当前第一级有向图节点与其第一级子有向图节点的属性信息中的标签信息来确定与该当前第一级有向图节点相对应的当前中间级有向图节点集合中的各个中间级有向图节点与中间级有向图中的其他中间级有向图节点集合中的各个中间级有向图节点之间的依赖关系;If the attribute information of each first-level sub-directed graph node of the current first-level directed graph node contains the label information corresponding to the cell in the spreadsheet, then the attribute information of each first-level sub-directed graph node The intersection of the label information contained in the attribute information sets the label information in the attribute information of the current first-level directed graph node, and sets the current first-level atomic operator represented by the current first-level directed graph node. The intermediate-level atomic operator in the attribute information of the first-level directed graph node is determined to be related to the current first-level based on the label information and the intermediate-level atomic operator in the attribute information of the current first-level directed graph node. The current intermediate-level directed graph node set corresponding to the directed graph node, and at least according to the dependency relationship between the current first-level directed graph node and its first-level child directed graph nodes, and according to the current first-level directed graph node The label information in the attribute information of the graph node and its first-level child directed graph node is used to determine each intermediate-level directed graph node in the current intermediate-level directed graph node set corresponding to the current first-level directed graph node The dependency relationship between each intermediate-level directed graph node in the set of other intermediate-level directed graph nodes in the intermediate-level directed graph;
    如果该当前第一级有向图节点的各个第一级子有向图节点的属性信息都不包含标签信息,则使得该当前第一级有向图节点的属性信息中不包含标签信息,根据该当 前第一级有向图节点所代表的第一级原子运算符设置该当前第一级有向图节点的属性信息中的中间级原子运算符,至少根据该当前第一级有向图节点的属性信息中的中间级原子运算符来确定与该当前第一级有向图节点相对应的当前中间级有向图节点集合,以及至少根据该当前第一级有向图节点与其第一级子有向图节点之间的依赖关系来确定与该当前第一级有向图节点相对应的当前中间级有向图节点集合中的各个中间级有向图节点与中间级有向图中的其他中间级有向图节点集合中的各个中间级有向图节点之间的依赖关系;If the attribute information of each first-level child directed graph node of the current first-level directed graph node does not contain label information, then the attribute information of the current first-level directed graph node does not include label information, according to The first-level atomic operator represented by the current first-level directed graph node sets the intermediate-level atomic operator in the attribute information of the current first-level directed graph node, at least according to the current first-level directed graph node The intermediate-level atomic operator in the attribute information of the current first-level directed graph node is used to determine the current intermediate-level directed graph node set corresponding to the current first-level directed graph node, and at least according to the current first-level directed graph node and its first-level The dependency relationship between the sub-directed graph nodes is used to determine the current intermediate-level directed graph node corresponding to the current first-level directed graph node in each intermediate-level directed graph node and the intermediate-level directed graph. The dependency relationship between each intermediate-level directed graph node in the set of other intermediate-level directed graph nodes;
    如果该当前第一级有向图节点的一部分第一级子有向图节点的属性信息包含与电子表格中的单元格相对应的标签信息并且该当前第一级有向图节点的另一部分第一级子有向图节点的属性信息不包含标签信息,则根据包含标签信息的第一级子有向图节点的属性信息中所包含的标签信息的交集设置该当前第一级有向图节点的属性信息中的标签信息,根据该当前第一级有向图节点所代表的第一级原子运算符设置该当前第一级有向图节点的属性信息中的中间级原子运算符,根据该当前第一级有向图节点的属性信息中的标签信息和中间级原子运算符来确定与该当前第一级有向图节点相对应的当前中间级有向图节点集合,以及至少根据该当前第一级有向图节点与其第一级子有向图节点之间的依赖关系并且根据该当前第一级有向图节点与其第一级子有向图节点的属性信息中的标签信息来确定与该当前第一级有向图节点相对应的当前中间级有向图节点集合中的各个中间级有向图节点与中间级有向图中的其他中间级有向图节点集合中的各个中间级有向图节点之间的依赖关系。If the attribute information of a part of the current first-level directed graph node of the first-level child directed graph node contains the label information corresponding to the cell in the spreadsheet and the other part of the current first-level directed graph node is the first If the attribute information of the first-level child directed graph node does not contain label information, the current first-level directed graph node is set according to the intersection of the label information contained in the attribute information of the first-level child directed graph node containing the label information According to the label information in the attribute information of the current first-level directed graph node, the middle-level atomic operator in the attribute information of the current first-level directed graph node is set according to the first-level atomic operator represented by the current first-level directed graph node. The label information and intermediate atomic operators in the attribute information of the current first-level directed graph node are used to determine the current intermediate-level directed graph node set corresponding to the current first-level directed graph node, and at least according to the current The dependency relationship between the first-level directed graph node and its first-level child directed graph node is determined according to the label information in the attribute information of the current first-level directed graph node and its first-level child directed graph node Each intermediate-level directed graph node in the current intermediate-level directed graph node set corresponding to the current first-level directed graph node and each intermediate-level directed graph node set in the intermediate-level directed graph The dependency relationship between the nodes of the hierarchical directed graph.
  60. 根据权利要求58所述的装置,其中,所述公式转译器还被配置为:当遍历到的第一级有向图中的当前第一级有向图节点所代表的第一级原子运算符为降维原子运算符时,The device according to claim 58, wherein the formula translator is further configured to: when traversed to the first-level directed graph, the current first-level directed graph node represents the first-level atomic operator When it is a dimensionality reduction atomic operator,
    使得该当前第一级有向图节点的属性信息中不包含标签信息或包含该当前第一级有向图节点的第一级子有向图节点的属性信息中的标签信息的一个子集,至少根据该当前第一级有向图节点所代表的第一级原子运算符设置该当前第一级有向图节点的属性信息中的中间级原子运算符,至少根据该当前第一级有向图节点的属性信息中的中间级原子运算符来确定与该当前第一级有向图节点相对应的当前中间级有向图节点集合,以及至少根据该当前第一级有向图节点与其第一级子有向图节点之间的依赖关系来确定与该当前第一级有向图节点相对应的当前中间级有向图节点集合中的 各个中间级有向图节点与中间级有向图中的其他中间级有向图节点集合中的各个中间级有向图节点之间的依赖关系。So that the attribute information of the current first-level directed graph node does not contain label information or includes a subset of the label information in the attribute information of the first-level child directed graph node of the current first-level directed graph node, Set the intermediate atomic operator in the attribute information of the current first-level directed graph node at least according to the first-level atomic operator represented by the current first-level directed graph node, and at least according to the current first-level directed graph node The intermediate-level atomic operator in the attribute information of the graph node determines the current intermediate-level directed graph node set corresponding to the current first-level directed graph node, and at least according to the current first-level directed graph node and its first level The dependency relationship between the first-level sub-directed graph nodes is used to determine each intermediate-level directed graph node and the intermediate-level directed graph in the current intermediate-level directed graph node set corresponding to the current first-level directed graph node The dependency relationship between each intermediate-level directed graph node in the set of other intermediate-level directed graph nodes in.
  61. 根据权利要求58所述的装置,其中,所述公式转译器还被配置为:当遍历到的第一级有向图中的当前第一级有向图节点所代表的第一级原子运算符为错位原子运算符时,The device according to claim 58, wherein the formula translator is further configured to: when traversed to the first-level directed graph, the current first-level directed graph node represents the first-level atomic operator When it is a misplaced atomic operator,
    在该当前第一级有向图节点的第一级子有向图节点的属性信息包含与电子表格中的单元格相对应的标签信息的情况下,将第一级子有向图节点的属性信息中所包含的标签信息进行错位后获得的错位后标签信息设置为该当前第一级有向图节点的属性信息中的标签信息,将“等同”原子运算符设置为该当前第一级有向图节点的属性信息中的中间级原子运算符,根据该当前第一级有向图节点的属性信息中的标签信息和中间级原子运算符来确定与该当前第一级有向图节点相对应的当前中间级有向图节点集合,以及至少根据该当前第一级有向图节点与其第一级子有向图节点之间的依赖关系并且根据该当前第一级有向图节点与其第一级子有向图节点的属性信息中的标签信息来确定与该当前第一级有向图节点相对应的当前中间级有向图节点集合中的各个中间级有向图节点与中间级有向图中的其他中间级有向图节点集合中的各个中间级有向图节点之间的依赖关系。In the case that the attribute information of the first-level child directed graph node of the current first-level directed graph node contains the label information corresponding to the cell in the spreadsheet, the attribute information of the first-level child directed graph node The label information contained in the information is set to the label information in the attribute information of the current first-level directed graph node, and the “equal” atomic operator is set to the current first-level directed graph node. The intermediate-level atomic operator in the attribute information of the directed graph node is determined to be relative to the current first-level directed graph node according to the label information and the intermediate-level atomic operator in the attribute information of the current first-level directed graph node. The corresponding set of current intermediate-level directed graph nodes, and at least according to the dependency relationship between the current first-level directed graph node and its first-level child directed graph nodes, and according to the current first-level directed graph node and its first level The label information in the attribute information of the first-level sub-directed graph node determines the current intermediate-level directed graph node set corresponding to the current first-level directed graph node. The dependency relationship between each intermediate-level directed graph node in the set of other intermediate-level directed graph nodes in the directed graph.
  62. 根据权利要求57至61中任一项所述的装置,其中,所述公式转译器还被配置为:The device according to any one of claims 57 to 61, wherein the formula translator is further configured to:
    分别从所述中间级有向图中抽取以中间级有向图根节点集合中的各个中间级有向图根节点为根节点的子有向图,并且将所抽取的子有向图作为第二级有向图以根据第二级有向图来确定第二级复合运算符。Extract the sub-directed graphs with each intermediate-level directed graph root node in the set of intermediate-level directed graph root nodes as the root node from the intermediate-level directed graph, and use the extracted sub-directed graph as the first The second-level directed graph is used to determine the second-level compound operator based on the second-level directed graph.
  63. 根据权利要求62所述的装置,其中,所述公式转译器还被配置为:The device of claim 62, wherein the formula translator is further configured to:
    通过将各个中间级有向图根节点的属性信息中的标签信息与各个中间级有向图左值节点的属性信息中的标签信息进行匹配,将中间级有向图根节点集合中的各个中间级有向图根节点的位置与中间级有向图左值节点集合中的各个中间级有向图左值节点的位置相对应;以及By matching the label information in the attribute information of the root node of each intermediate-level directed graph with the label information in the attribute information of the left-value node of each intermediate-level directed graph, each intermediate-level directed graph root node set The position of the root node of the level directed graph corresponds to the position of the left value node of each intermediate level directed graph in the set of left value nodes of the intermediate level directed graph; and
    将以相应的匹配位置处的中间级有向图根节点为根节点的子有向图抽出作为第 二级有向图以根据第二级有向图来确定中间级左值节点对应的单元格的第二级复合运算符。The sub-directed graph with the root node of the intermediate-level directed graph at the corresponding matching position as the root node is extracted as the second-level directed graph to determine the cell corresponding to the intermediate-level left-value node according to the second-level directed graph The second level compound operator.
  64. 根据权利要求51所述的装置,还包括电子表格公式写入器,所述电子表格公式写入器被配置为:The apparatus according to claim 51, further comprising an electronic form formula writer, the electronic form formula writer being configured to:
    将所生成的用于所述一个或多个第一单元格中的每个第一单元格的电子表格公式存储到电子表格文件中的相应单元格中。The generated spreadsheet formula for each first cell of the one or more first cells is stored in a corresponding cell in the spreadsheet file.
  65. 根据权利要求43所述的装置,其中,The device of claim 43, wherein:
    所述自定义原子运算符是通过对系统预设的原子运算符进行组合而定义的。The custom atomic operator is defined by combining the atomic operators preset by the system.
  66. 根据权利要求65所述的装置,其中,所述公式转译器还被配置为:The device of claim 65, wherein the formula translator is further configured to:
    在用于电子表格的层级公式中包括所述自定义原子运算符的情况下,将所述自定义原子运算符转换为系统预设的原子运算符。In the case that the custom atomic operator is included in the hierarchical formula used in the spreadsheet, the custom atomic operator is converted into a system preset atomic operator.
  67. 根据权利要求66所述的方法,其中,所述公式转译器还被配置为:The method of claim 66, wherein the formula translator is further configured to:
    将层级公式的原始有向图中的所述自定义原子运算符替换为代表所述自定义原子运算符的有向图的根节点;以及Replacing the custom atomic operator in the original directed graph of the hierarchical formula with the root node of the directed graph representing the custom atomic operator; and
    用层级公式的原始有向图中的以所述自定义原子运算符为父节点的子有向图来替换所述自定义原子运算符的有向图中的叶子节点。Replace the leaf nodes in the directed graph of the custom atomic operator with the child directed graph in the original directed graph of the hierarchical formula with the custom atomic operator as the parent node.
  68. 根据权利要求40所述的装置,还包括智能建议模块,所述智能建议模块被配置为:The device according to claim 40, further comprising an intelligent suggestion module, the intelligent suggestion module being configured to:
    基于已经获取的所述层级公式,更新智能建议知识库,所述智能建议知识库包括与所述层级公式或者层级结构有关的信息;以及Updating the knowledge base of intelligent suggestions based on the obtained hierarchy formula, the knowledge base of intelligent suggestions including information related to the hierarchy formula or hierarchy structure; and
    基于所述智能建议知识库,在将要获取新的层级公式时进行智能建议。Based on the intelligent suggestion knowledge base, intelligent suggestions are made when a new level formula is about to be obtained.
  69. 根据权利要求40所述的装置,还包括缺陷检测模块,所述缺陷检测模块被配置为:The device according to claim 40, further comprising a defect detection module configured to:
    自动检测所获取的所述层级公式中存在的缺陷;以及Automatically detect defects in the obtained hierarchy formula; and
    基于所述缺陷自动生成调试信息并且提示所述调试信息,Automatically generate debugging information based on the defect and prompt the debugging information,
    其中,所述调试信息包括错误或警告。Wherein, the debugging information includes errors or warnings.
  70. 根据权利要求40所述的装置,还包括:The device according to claim 40, further comprising:
    电子表格模型存储模块,所述电子表格模型存储模块被配置为存储电子表格模型,所述电子表格模型包括以下各项中的一个或多个:用于电子表格的层级结构、用于电子表格的层级计算图和电子表格文件。An electronic form model storage module, the electronic form model storage module is configured to store an electronic form model, the electronic form model includes one or more of the following: for the hierarchical structure of the electronic form, used for the electronic form Hierarchical calculation diagrams and spreadsheet files.
  71. 根据权利要求70所述的装置,还包括:The device of claim 70, further comprising:
    电子表格模型导入导出模块,所述电子表格模型导入导出模块被配置为导入和/或导出所述电子表格模型。An electronic form model import and export module, the electronic form model import and export module is configured to import and/or export the electronic form model.
  72. 根据权利要求42所述的装置,其中,所述文本编辑器被配置为:The device of claim 42, wherein the text editor is configured to:
    对所述文本代码进行分词以得到分词流;Perform word segmentation on the text code to obtain a word stream;
    识别所述分词流中与所述运算符相关的分词,以确定所述运算符;Identifying the word segmentation related to the operator in the word segmentation stream to determine the operator;
    识别所述分词流中与所述电子表格的层级结构中的所述一个或多个层级中的所述一个或多个节点相关的分词,以确定所述层级引用;以及Identifying the word segmentation related to the one or more nodes in the one or more levels in the hierarchical structure of the spreadsheet in the word segmentation stream to determine the level reference; and
    根据所确定的运算符和层级引用来生成所述层级公式。The hierarchical formula is generated according to the determined operator and hierarchical reference.
  73. 根据权利要求44所述的装置,其中,所述复合运算符采用以下各项中的一个或多个来存储:The device of claim 44, wherein the compound operator is stored using one or more of the following:
    字符串;String
    由函数指针指向的计算机实现的函数;和The computer-implemented function pointed to by the function pointer; and
    有向图。Directed graph.
  74. 根据权利要求73所述的装置,其中,所述有向图中的各个节点代表所述层级公式中的所述运算符,以及所述有向图中的各个节点之间的有向边代表所述层级公式中的所述运算符之间的组合关系。The device according to claim 73, wherein each node in the directed graph represents the operator in the hierarchical formula, and the directed edge between each node in the directed graph represents the The combinatorial relationship between the operators in the hierarchical formula.
  75. 根据权利要求64所述的装置,其中,所述电子表格公式写入器被配置为:The device of claim 64, wherein the spreadsheet formula writer is configured to:
    对所述电子表格中的所述一个或多个第一单元格和所述一个或多个第二单元格中的一部分或全部的单元格名称进行自动命名;以及Automatically naming a part or all of the cell names of the one or more first cells and the one or more second cells in the electronic table; and
    利用自动命名的单元格名称来改写所述电子表格公式并且存储改写后的电子表格公式。Utilize automatically named cell names to rewrite the spreadsheet formula and store the rewritten spreadsheet formula.
PCT/CN2020/104838 2019-10-15 2020-07-27 Computer-implemented method and device for generating spreadsheet formula, and storage medium WO2021073195A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201910977971.4 2019-10-15
CN201910977971.4A CN110738027B (en) 2019-10-15 2019-10-15 Computer-implemented method, apparatus, and storage medium for generating spreadsheet formulas

Publications (1)

Publication Number Publication Date
WO2021073195A1 true WO2021073195A1 (en) 2021-04-22

Family

ID=69268900

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2020/104838 WO2021073195A1 (en) 2019-10-15 2020-07-27 Computer-implemented method and device for generating spreadsheet formula, and storage medium

Country Status (2)

Country Link
CN (1) CN110738027B (en)
WO (1) WO2021073195A1 (en)

Families Citing this family (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110738027B (en) * 2019-10-15 2023-07-14 深圳逻辑汇科技有限公司 Computer-implemented method, apparatus, and storage medium for generating spreadsheet formulas
CN111930776B (en) * 2020-09-10 2021-01-05 北京维数统计事务所有限公司 Form processing method and device, electronic equipment and readable storage medium
CN112560414A (en) * 2020-12-16 2021-03-26 建信金融科技有限责任公司 Method and device for automatically generating accounting report
CN112861492A (en) * 2021-01-27 2021-05-28 亿企赢网络科技有限公司 Method and device for linkage calculation between internal tables of report table and electronic equipment
CN113420537B (en) * 2021-06-22 2023-01-31 平安科技(深圳)有限公司 Method, device, equipment and storage medium for processing electronic form data
CN114357944B (en) * 2021-12-17 2024-02-20 永中软件股份有限公司 Layout method of large operator formula and computer device
CN116302513A (en) * 2023-02-28 2023-06-23 易方达基金管理有限公司 Quantization factor processing method, quantization factor processing device, computer equipment and readable storage medium
CN116881675B (en) * 2023-09-07 2023-12-08 南京中鑫智电科技有限公司 Power equipment state monitoring method based on Bayesian algorithm

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7984371B2 (en) * 2005-02-18 2011-07-19 Andrew Joseph Zdenek Method and system for the graphical modeling of data and calculations of a spreadsheet
CN103164393A (en) * 2013-04-12 2013-06-19 中国农业银行股份有限公司 Method and system of report formula processing
CN106980856A (en) * 2016-01-15 2017-07-25 上海谦问万答吧云计算科技有限公司 Formula identification method and system and symbolic reasoning computational methods and system
CN108170638A (en) * 2017-12-21 2018-06-15 平安科技(深圳)有限公司 Computational methods, device, equipment and storage medium based on Excel tables
CN108829653A (en) * 2018-05-04 2018-11-16 山东中创软件工程股份有限公司 A kind of generation method of report, device, equipment and medium
CN110738027A (en) * 2019-10-15 2020-01-31 深圳逻辑汇科技有限公司 Computer-implemented method, apparatus, and storage medium for generating spreadsheet formulas

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US8577704B2 (en) * 2007-12-10 2013-11-05 Modelsheet Software, Llc Automatically generating formulas based on parameters of a model

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7984371B2 (en) * 2005-02-18 2011-07-19 Andrew Joseph Zdenek Method and system for the graphical modeling of data and calculations of a spreadsheet
CN103164393A (en) * 2013-04-12 2013-06-19 中国农业银行股份有限公司 Method and system of report formula processing
CN106980856A (en) * 2016-01-15 2017-07-25 上海谦问万答吧云计算科技有限公司 Formula identification method and system and symbolic reasoning computational methods and system
CN108170638A (en) * 2017-12-21 2018-06-15 平安科技(深圳)有限公司 Computational methods, device, equipment and storage medium based on Excel tables
CN108829653A (en) * 2018-05-04 2018-11-16 山东中创软件工程股份有限公司 A kind of generation method of report, device, equipment and medium
CN110738027A (en) * 2019-10-15 2020-01-31 深圳逻辑汇科技有限公司 Computer-implemented method, apparatus, and storage medium for generating spreadsheet formulas

Also Published As

Publication number Publication date
CN110738027A (en) 2020-01-31
CN110738027B (en) 2023-07-14

Similar Documents

Publication Publication Date Title
WO2021073195A1 (en) Computer-implemented method and device for generating spreadsheet formula, and storage medium
JP6916403B2 (en) Specifying and applying logical validation rules to data
US10755053B1 (en) Applied artificial intelligence technology for story outline formation using composable communication goals to support natural language generation (NLG)
KR102432104B1 (en) Systems and methods for determining relationships between data elements
CN108959433B (en) Method and system for extracting knowledge graph from software project data and asking for questions and answers
JP6753596B2 (en) Processes and systems that automatically generate functional architecture documents and software design / analysis specifications in natural language
CA2924083C (en) Syntactic tagging in a domain-specific context
US8060391B2 (en) Analogy based workflow identification
Leopold et al. Detection of naming convention violations in process models for different languages
US9075787B2 (en) Defining a reusable spreadsheet-function by extracting the function from a complex calculation in a spreadsheet document
WO2021073077A1 (en) Method, apparatus and device for automatically generating spreadsheet, and storage medium
US11106906B2 (en) Systems and methods for information extraction from text documents with spatial context
US11537797B2 (en) Hierarchical entity recognition and semantic modeling framework for information extraction
US20090199156A1 (en) Constraint language editing for generating model-related constraint expressions
CN109325217B (en) File conversion method, system, device and computer readable storage medium
JP2007527058A (en) Form composition mechanism and method for linking data and meta data
El-Mahgary et al. A form-based query interface for complex queries
Kumar et al. Exploring the application of property graph model in visualizing COBie data
US9208224B2 (en) Business content hierarchy
CN116595192B (en) Technological front information acquisition method and device, electronic equipment and readable storage medium
US11972627B2 (en) Intelligent data extraction system and method
CN116560662A (en) Code file difference analysis method and device based on abstract syntax tree iterative mapping
US20230196813A1 (en) Intelligent data extraction system and method
Jin Democratizing Self-Service Data Preparation through Example Guided Program Synthesis
Azmi et al. Test management traceability model to support software testing documentation

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 20876456

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

32PN Ep: public notification in the ep bulletin as address of the adressee cannot be established

Free format text: NOTING OF LOSS OF RIGHTS PURSUANT TO RULE 112(1) EPC (EPO FORM 1205A DATED 180822)

122 Ep: pct application non-entry in european phase

Ref document number: 20876456

Country of ref document: EP

Kind code of ref document: A1