Graphical programming homework correction method, device, electronic equipment, storage medium and program product
By obtaining the program source code and building block logic of graphical programming assignments, constructing a structured description, and using a large language model to correct graphical programming assignments, the problem of the existing technology being unable to analyze programming errors outside the scope of the answer is solved, and accurate error analysis and guidance prompts are achieved.
Patent Information
- Application Number
- CN202510357464.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-03-25
- Publication Date
- 2025-09-12
- Estimated Expiration
- 2045-03-25
AI Technical Summary
Existing technologies cannot effectively analyze programming errors outside the scope of answers in graphical programming assignments, and cannot provide targeted guidance prompts.
By obtaining the program source code of the graphical programming assignment, parsing the configuration information and operation logic of the building blocks, building a structured description, and using the large language model to correct it and provide guidance prompts.
It achieves accurate analysis and targeted guidance of various programming errors in graphical programming assignments, improving the correction effect.
Smart Images

Figure CN120295614B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of graphical programming technology, and in particular to a method, device, electronic device, storage medium and program product for correcting graphical programming assignments. Background Art
[0002] Graphical programming has been widely used in education, particularly for children. Graphical programming platforms use graphical building blocks or modules instead of traditional text-based coding, making programming more visual and user-friendly, lowering the barrier to entry.
[0003] In the teaching practice of graphical programming, students need to do a lot of graphical programming exercises. Correcting students' graphical programming assignments and guiding them to answer correctly will help them understand and master graphical programming skills more quickly.
[0004] Currently, students' graphical programming assignments are typically graded using answer matching methods, along with guidance and prompts. However, these answers typically only cover a few graphical programming errors, while errors in graphical programming assignments are diverse. For errors not covered by the answers, the method cannot analyze the true causes of graphical programming errors, nor can it provide targeted guidance and prompts. Summary of the Invention
[0005] The purpose of the embodiments of the present application is to provide a method, device, electronic device, storage medium and program product for correcting graphical programming assignments, so as to solve the problems existing in the related art, that is, for programming errors outside the scope of the answer, the real cause of the graphical programming errors cannot be analyzed, and targeted guidance prompts cannot be given.
[0006] In a first aspect, an embodiment of the present application provides a method for correcting graphical programming assignments, comprising:
[0007] Obtaining program source code of a graphical programming operation; the graphical programming operation includes a plurality of building blocks having a splicing relationship;
[0008] For each building block, obtaining configuration information of the building block from the program source code; the configuration information includes parameter information of the building block, text display information, and a relative position relationship between the text display information and the parameter information;
[0009] Combining the parameter information and the text display information of the building block according to the relative positional relationship between the text display information and the parameter information to obtain a text description of the building block;
[0010] Obtaining the operation logic between each of the building blocks according to the program source code;
[0011] Combining the text descriptions of the building blocks according to the operation logic between the building blocks to obtain a structured description of the graphical programming operation;
[0012] The structured description of the graphical programming job is input into a preset large language model, so that the large language model corrects the graphical programming job according to the structured description and provides guidance prompts.
[0013] A large language model is a model that can generate natural language text or understand the meaning of language text. The above-mentioned scheme of the embodiment of the present application uses the large language model to correct graphical programming assignments and provide guidance prompts. Based on the ability of the large language model itself to understand the meaning of language text, it can analyze the causes of graphical programming errors for various programming errors (including programming errors outside the scope of answer coverage) and provide targeted guidance prompts, thereby solving to a certain extent the problem existing in the related technology that it is unable to analyze the true causes of graphical programming errors for programming errors outside the scope of answer coverage, and cannot provide targeted guidance prompts.
[0014] In addition, due to the particularity of the field of graphical programming technology, graphical programming jobs are all composed of multiple graphical building blocks, which cannot be recognized by the large language model, so the large language model cannot be directly applied to the graphical programming job correction scenario in the field of graphical programming technology. In the above implementation process, by obtaining the text description of each building block in the graphical programming job and the operating logic between the building blocks, and then combining the text description of the building blocks according to the operating logic between the building blocks, a structured description of the graphical programming job is obtained. In this way, the graphical programming job presented in the form of building blocks can be converted into a structured description that the large language model can understand. In this way, the large language model can understand the true intention of the graphical programming job based on the structured description of the graphical programming job, so that the graphical programming job can be corrected through the large language model, and the cause of the error in the graphical programming job can be known, and then guidance prompts can be given for the cause of the error.
[0015] In addition, since the large language model can understand structured descriptions, the accuracy of the structured descriptions will directly affect the homework correction effect of the large language model. Since the graphical programming homework is formed by the user dragging and dropping building blocks, how to convert the graphical programming homework into a structured description that can more accurately describe the internal logic of the graphical programming homework will directly affect the homework correction effect of the large language model. To this end, in the above-mentioned implementation method of the embodiment of the present application, by obtaining the program source code of the graphical programming homework, the program source code composed of the program code of the building blocks dragged and dropped by the user is obtained. Then, the parameter information and text display information of each building block are obtained from the program source code, and the parameter information and text display information are used to form a text description of each building block. The text description of the building block dragged and dropped by the user can be obtained more accurately, and then the text description of each building block is combined according to the operating logic between the building blocks, so that the structured description of the graphical programming homework obtained can more accurately describe the internal logic of the graphical programming homework.
[0016] Furthermore, obtaining configuration information of the building block from the program source code includes: if a field value of a parameter field corresponding to the building block in the program source code is a parameter value, determining the parameter value as parameter information of the building block.
[0017] Since the parameter value of a building block's corresponding parameter field is a parameter value, the parameter value is the specific information passed to the building block. Therefore, in the above implementation, when the parameter value of a building block's corresponding parameter field is a parameter value, no further processing of the parameter value is required; the parameter value can be directly used as the parameter information of the building block to obtain the specific information actually passed to the building block. This allows the building block's parameter information to be used to more accurately compose a textual description of the building block.
[0018] Furthermore, obtaining configuration information of the building block from the program source code includes: if the field value of the parameter field corresponding to the building block in the program source code is the building block identifier of other building blocks, then using the text description of the other building blocks as the parameter information of the building block.
[0019] Since the field value of the parameter field corresponding to the building block is the building block identifier, the text description of the building block corresponding to the building block identifier is the specific information actually transmitted to the building block. Therefore, in the above implementation process, if in the program source code, the field value of the parameter field corresponding to the building block is the building block identifier of another building block, the text description of the other building block is used as the parameter information of the building block. In this way, the specific information actually transmitted to the building block can be obtained, so that the parameter information of the building block can be used to more accurately combine the text description of the building block. Moreover, this can ensure that building blocks with nested relationships can accurately reflect the original nested relationship when converted into a structured description.
[0020] Furthermore, if in the program source code, the field value of the parameter field corresponding to the building block is the building block identifier of other building blocks, then the text description of the other building blocks is used as the parameter information of the building block, including: when it is determined that the field value of the parameter field corresponding to the building block is the building block identifier of other building blocks, obtaining the configuration information of the other building blocks from the program source code, and combining the parameter information and text display information of the other building blocks according to the relative position relationship between the text display information and the parameter information of the other building blocks to obtain the text description of the other building blocks; and using the text description of the other building blocks as the parameter information of the building block.
[0021] In the above implementation, only when the value of a parameter field of a building block is found to be the building block identifier of another building block, is the configuration information of the other building block retrieved from the program source code? The parameter information and textual information of the other building block are combined using the relative positional relationship between the textual display information and the parameter information of the other building block to obtain a textual description of the other building block. The textual description of the other building block is then used as the parameter information of the building block. This allows for on-demand retrieval of building block textual descriptions, avoiding the need to retrieve a large amount of textual descriptions from the program source code at once, thus reducing server pressure.
[0022] Furthermore, obtaining the operating logic between the building blocks according to the program source code includes: parsing the program source code to obtain an abstract syntax tree corresponding to the program source code; and obtaining the operating logic between the building blocks from the abstract syntax tree.
[0023] Since the large language model cannot directly obtain the operating logic between each building block in the graphical programming job based on the graphical programming job itself or the program source code of the graphical programming job. Therefore, in the above implementation process, the program source code is parsed to obtain the abstract syntax tree corresponding to the program source code. Since the abstract syntax tree can clearly show the hierarchical relationship and nested relationship between each code in the program source code, and the program source code is composed of program codes of multiple building blocks with splicing relationships, the abstract syntax tree actually shows the hierarchical relationship and nested relationship between multiple building blocks with splicing relationships. Therefore, the operating logic between each building block can be obtained from the abstract syntax tree, so that the operating logic between each building block can be used to form a structured description that the large language model can understand, so that the large language model can understand the true meaning of the graphical programming job and realize the correction of the graphical programming job.
[0024] Furthermore, the operation logic includes the operation order and operation conditions between each building block; according to the operation logic between each building block, the text descriptions of each building block are combined to obtain a structured description of the graphical programming operation, including: according to the operation conditions between each building block, determining the separator corresponding to each operation condition; arranging the text descriptions of each building block according to the operation order between each building block, and using the separator corresponding to the operation condition to separate the text descriptions between the arranged building blocks to obtain the structured description of the graphical programming operation.
[0025] Because in the abstract syntax tree, the operating logic between building blocks is implemented through the node type of the abstract syntax tree and the connection structure between each node. Therefore, after obtaining the operating logic between each building block from the abstract syntax tree, the operating logic still cannot be directly understood by the large language model. Therefore, in the above implementation process, the operating conditions that the large language model cannot understand are converted into separators, and the execution order between the building blocks is converted into the arrangement order of the text descriptions of each building block. Finally, the separators corresponding to the operating conditions are used to separate the text descriptions between the arranged building blocks to obtain a structured description of the graphical programming job, so that the large language model can understand the operating logic and operating purpose between the building blocks in the graphical programming job through the structured description of the graphical programming job, so as to facilitate the correction of the graphical programming job.
[0026] Furthermore, inputting the structured description of the graphical programming job into a preset large language model includes: filling the structured description of the graphical programming job into the filling position corresponding to the programming job description in a preset prompt word template; and inputting the filled prompt word template into the large language model.
[0027] In this implementation, the structured description of the graphical programming task is entered into the corresponding field in the preset prompt word template, and then the completed prompt word template is input into the large language model. This standardizes the data format of different graphical programming tasks and avoids the large language model's misunderstanding of graphical programming tasks due to different data formats.
[0028] Furthermore, before inputting the completed prompt word template into the large language model, the method for correcting graphical programming homework further includes:
[0029] Obtaining a role definition for the large language model;
[0030] The role definition for the large language model is filled into the position of the corresponding role description in the prompt word template, so that the large language model outputs a guidance prompt for the graphical programming task according to the prompt form corresponding to the role definition.
[0031] In the above implementation, the role definitions for the large language model are inserted into the corresponding role descriptions in the prompt template. This allows the large language model to clarify its own responsibilities and functions based on the role definitions in the prompt template, and then provide guidance for graphical programming tasks based on these responsibilities. Therefore, by obtaining different role definitions for the large language model, the large language model can be customized, enhancing the user experience.
[0032] Furthermore, before inputting the completed prompt word template into the large language model, the method for correcting the graphical programming homework further includes:
[0033] Obtaining a task objective of the graphical programming operation;
[0034] Fill the task objective into the position corresponding to the task objective description in the prompt word template.
[0035] In the above implementation, the task objective of the graphical programming assignment is obtained and entered into the corresponding position of the task objective description in the prompt word template. In this way, the large language model can obtain the basis for correcting the graphical programming assignment, namely the task objective, from the prompt word template. This allows the large language model to correct the graphical programming assignment by determining whether the graphical programming assignment has achieved the task objective.
[0036] Furthermore, before inputting the completed prompt word template into the large language model, the method for correcting graphical programming homework further includes:
[0037] Obtaining stage description information of the stage corresponding to the graphical programming job;
[0038] Fill the stage description information into the corresponding stage description position in the prompt word template.
[0039] In the above implementation, the stage description information of the stage corresponding to the graphical programming assignment is obtained and filled into the corresponding stage description position in the prompt word template. In this way, the large language model can obtain the stage description information through the prompt word template, thereby enabling the large language model to more accurately correct the graphical programming assignment based on the stage description information.
[0040] Furthermore, before inputting the completed prompt word template into the large language model, the method for correcting the graphical programming homework further includes:
[0041] Obtaining the name and function of each preset building block; the preset building blocks are building blocks allowed to be used in the graphical programming operation;
[0042] Fill the name and function of each preset building block into the corresponding building block description position in the prompt word template.
[0043] In the above implementation process, by filling the names and functions of the preset building blocks into the corresponding building block description positions in the prompt word template, the large language model can obtain the names and functions of the building blocks allowed to be used in the graphical programming job through the prompt word template, so that the real intention of the graphical programming job can be understood more accurately by using the known names and functions of the preset building blocks, so as to more accurately correct the graphical programming job.
[0044] Furthermore, before inputting the completed prompt word template into the large language model, the method for correcting the graphical programming homework further includes:
[0045] Obtaining job inspection information, wherein the job inspection information includes building blocks required for inspection of this job;
[0046] The job inspection information is filled into the position corresponding to the job inspection information description in the prompt word template, so that the large language model corrects the graphical programming job according to the job inspection information.
[0047] In the above implementation, the building blocks required for the current assignment are entered into the corresponding job assessment information description in the prompt word template. In this way, the large language model can obtain the job assessment information through the prompt word template, thereby determining whether the graphical programming assignment utilizes the building blocks required for the current assignment, that is, whether the graphical programming assignment achieves the assessment purpose, thereby helping users better understand the key points of the graphical programming assignment.
[0048] Furthermore, before inputting the completed prompt word template into the large language model, the method for correcting the graphical programming homework further includes:
[0049] Get preset reference answers;
[0050] Fill the reference answer into the corresponding reference answer description position in the prompt word template.
[0051] In the above implementation, the reference answer is filled into the corresponding reference answer description position in the prompt word template. In this way, the large language model can obtain the reference answer through the prompt word template, and then correct the graphical programming homework based on the reference answer, determine the true cause of the error in the graphical programming homework, and provide more targeted guidance prompts.
[0052] In a second aspect, an embodiment of the present application further provides a graphical programming job correction device, comprising:
[0053] A first acquisition module is configured to acquire program source code of the graphical programming operation; the graphical programming operation includes a plurality of building blocks in a splicing relationship;
[0054] a second acquisition module configured to acquire, for each building block, configuration information of the building block from the program source code, the configuration information including parameter information of the building block, text display information, and a relative positional relationship between the text display information and the parameter information;
[0055] a first combining module configured to combine the parameter information and the text display information of the building block according to the relative position relationship between the text display information and the parameter information to obtain a text description of the building block;
[0056] A third acquisition module is configured to acquire the operation logic between the building blocks according to the program source code;
[0057] a second combining module configured to combine the text descriptions of the building blocks according to the operation logic between the building blocks to obtain a structured description of the graphical programming operation;
[0058] The input module is configured to input the structured description of the graphical programming job into a preset large language model, so that the large language model corrects the graphical programming job according to the structured description and gives guidance prompts.
[0059] In a third aspect, an embodiment of the present application further provides an electronic device comprising a processor, a memory and a communication bus; the communication bus is used to realize connection and communication between the processor and the memory; the processor is used to execute one or more programs stored in the memory to realize any of the above-mentioned methods for correcting graphical programming jobs.
[0060] In a fourth aspect, an embodiment of the present application further provides a computer-readable storage medium, wherein the computer-readable storage medium stores one or more programs, and the one or more programs can be executed by one or more processors to implement any of the above-mentioned methods for correcting graphical programming jobs.
[0061] In a fifth aspect, an embodiment of the present application further provides a computer program product, which includes a computer program, and when the computer program is executed by a processor, implements any of the above-mentioned methods for correcting graphical programming jobs. BRIEF DESCRIPTION OF THE DRAWINGS
[0062] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the following is a brief introduction to the drawings required for use in the embodiments of the present application. It should be understood that the following drawings only show certain embodiments of the present application and therefore should not be regarded as limiting the scope. For ordinary technicians in this field, other relevant drawings can be obtained based on these drawings without creative work.
[0063] FIG1( a ) is a schematic diagram of a graphical programming interface capable of performing graphical programming operations provided in an embodiment of the present application;
[0064] FIG1( b ) is a schematic diagram of a stage area provided in an embodiment of the present application;
[0065] FIG1( c ) is a schematic diagram of an object area provided in an embodiment of the present application;
[0066] FIG1( d ) is a schematic diagram of a building block menu bar provided in an embodiment of the present application;
[0067] FIG1( e ) is a schematic diagram of a building block workspace provided in an embodiment of the present application;
[0068] Figure 2 A flowchart of a method for correcting graphical programming assignments provided in an embodiment of the present application;
[0069] Figure 3 A schematic diagram of a graphical programming operation provided in an embodiment of the present application;
[0070] Figure 4 A schematic diagram of a structured description of a graphical programming job provided in an embodiment of the present application;
[0071] Figure 5 A flowchart of a method for constructing a prompt word template provided in an embodiment of the present application;
[0072] FIG6( a ) is a schematic diagram of another graphical programming interface provided in an embodiment of the present application;
[0073] FIG6( b ) is a schematic diagram of the correction results of a large language model provided in an embodiment of the present application;
[0074] FIG7( a ) is a schematic diagram of another graphical programming interface provided in an embodiment of the present application;
[0075] FIG7( b ) is a schematic diagram of the correction results of a large language model provided in an embodiment of the present application;
[0076] FIG8( a ) is a schematic diagram of another graphical programming interface provided in an embodiment of the present application;
[0077] FIG8( b ) is a schematic diagram of the correction results of a large language model provided in an embodiment of the present application;
[0078] Figure 9 A schematic diagram of the structure of a graphical programming homework correction device provided in an embodiment of the present application;
[0079] Figure 10 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0080] The technical solutions in the embodiments of the present application will be described below in conjunction with the drawings in the embodiments of the present application.
[0081] Example 1:
[0082] In order to solve the problem of being unable to analyze the true cause of graphical programming errors and providing targeted guidance prompts for programming errors outside the scope of the answer, an embodiment of the present application provides a method for correcting graphical programming assignments. Figure 1(a) is a schematic diagram of a graphical programming interface provided in this embodiment for performing graphical programming assignments. As shown in Figure 1(a), the graphical programming interface can include a stage area 1, an object area 2, and a code area 3.
[0083] Specifically, the stage area 1 can be as shown in FIG1(b), and the stage area 1 is used to display the stage of the graphical programming operation. The object area 2 can be as shown in FIG1(c), and the object area 2 is used to display the operation objects allowed to be used in the graphical programming operation, such as: Hemu, grid road. The code area 3 includes a building block workspace and a building block menu bar. The building block menu bar can be as shown in FIG1(d), and the building block menu bar is used to display the building blocks allowed to be used in the graphical programming operation, such as "move (10) steps", "face (90) direction", "say (hello) (2) seconds", "play sound (determine Ulahu 24) wait to play", "when (start) is clicked", "wait (1) second", "repeat (10) times". The building block workspace can be as shown in FIG1(e), and the building block workspace is used to splice building blocks to form a graphical programming operation. The building block workspace can also include the task objectives of the graphical programming operation, such as: help Hemu change direction and return to the carrot forest. The block workspace can also include graphical programming prompts, for example: the [Facing...direction] code block is in the [Motion] module.
[0084] In this way, users can analyze the task objectives and stages of graphical programming tasks, obtain the required operation objects and the code execution logic that can achieve the task objectives of graphical programming tasks. Then, they can select the operation objects in the object area and drag blocks from the block menu bar to the block workspace according to the code execution logic to obtain the graphical programming task.
[0085] Similarly, as shown in Figure 1(a), the task objective of a graphical programming task, for example, is to help Hemu turn around and return to the carrot forest. By analyzing the graphical programming task objective, "Help Hemu turn around and return to the carrot forest," we can determine that the graphical programming task's operation target is Hemu. By analyzing the stage area, we can determine that Hemu is four squares away from the carrot forest. Furthermore, Hemu is facing away from the carrot forest. Ten steps of movement represent one square of the stage area. Therefore, the code execution logic to achieve the graphical programming task objective can be to connect four "Move 10 Steps" programming blocks and control Hemu to face the carrot forest.
[0086] The following describes in detail the technical solution of the present application and how the technical solution of the present application solves the above-mentioned technical problems with specific embodiments.
[0087] See also Figure 2 As shown, Figure 2 A flowchart of a method for correcting graphical programming assignments provided in an embodiment of the present application is provided, including:
[0088] Step S201: Obtain program source code of a graphical programming operation, where the graphical programming operation includes a plurality of building blocks having a splicing relationship.
[0089] In an optional embodiment of the present application, the source code of the graphical programming job can be obtained when the graphical programming job is completed. In some embodiments, the graphical programming job can be determined to be completed when a button representing the graphical programming job is clicked. The button representing the graphical programming job is, for example, Submit Job.
[0090] The starting building block of a graphical programming job is an event-triggered block, which represents the execution conditions of the graphical programming job. When the execution conditions in the event-triggered block are met, the graphical programming job can be determined to be completed and can be executed.
[0091] An event trigger block can be, for example, "When Start is clicked." Accordingly, when the user clicks the Start button on the stage, the graphical programming job is determined to be complete and the graphical programming job is executed. Another event trigger block can be, for example, "When the timer value is greater than A." Accordingly, when the timer value is greater than A, the graphical programming job is determined to be complete and the graphical programming job is executed.
[0092] In another optional implementation of the present application, the source code of the graphical programming task can also be obtained during the graphical programming task. The graphical programming task operation process is the process of the user dragging and dropping the building blocks together. Correspondingly, when the user drags and drops the building blocks together, the source code of the already assembled building blocks can be obtained.
[0093] The source code for graphical programming tasks is implemented within a graphical programming environment. Within this environment, code is presented as building blocks. The program code corresponding to each building block can be obtained from the graphical programming environment. Furthermore, the program code can be presented in JSON format. The source code for graphical programming tasks includes the program code for multiple connected building blocks, as well as the operational logic between the program codes for these building blocks.
[0094] Step S202: For each building block, obtain configuration information of the building block from the program source code. The configuration information includes parameter information of the building block, text display information, and the relative position relationship between the text display information and the parameter information.
[0095] The program source code includes program codes corresponding to each building block, and the program code of each building block includes multiple fields, such as a parameter field, a text display field, a building block type field, and a building block identification field.
[0096] Correspondingly, for each building block, a field value can be obtained from the parameter field of the program code of the building block, and when the field value of the parameter field corresponding to the building block is the parameter value, the parameter value is determined to be the parameter information of the building block. Alternatively, for each building block, a field value can be obtained from the corresponding parameter field of the building block, that is, the field value is obtained from the parameter field in the program code of the building block, and when the field value of the parameter field corresponding to the building block is the building block identifier of another building block, the text description of the other building block is used as the parameter information of the building block. The other building block is any building block other than the building block itself.
[0097] For example, if it is determined that the field value of the parameter field corresponding to the building block is the building block identifier of another building block, the building block identifier of the other building block can be used to perform a matching operation in the preset correspondence between the building block identifier and the text description. If the text description of the other building block is obtained, the text description of the other building block is directly used as the parameter information of the building block. If the text description of the other building block is not obtained, the configuration information of the other building block can be obtained from the program source code, and the parameter information and text display information of the other building block are combined according to the relative positional relationship between the text display information and the parameter information of the other building block to obtain the text description of the other building block; and the text description of the other building block is used as the parameter information of the building block.
[0098] In some embodiments, a graphical programming operation includes a building block B1. For building block B1, configuration information for building block B1 can be obtained from the program source code. If, in the program source code, the field value of the parameter field corresponding to building block B1 is the building block identifier of another building block, such as B2, configuration information for building block B2 can be obtained from the program source code. The parameter information and textual display information of building block B2 are combined based on the relative positional relationship between the textual display information and the parameter information of building block B2 to obtain a textual description of building block B2. The textual description of building block B2 is used as the parameter information of building block B1.
[0099] Similarly, the text display information of the building block and the relative positional relationship between the field value of the parameter field of the building block and the text display information of the building block can be obtained from the text display field corresponding to the building block. The display content on the building block includes the text display information and the field value of the parameter field of the building block. Similarly, the building block identifier of the building block can also be obtained from the building block identifier field corresponding to the building block. The building block type of the building block can also be obtained from the building block type field corresponding to the building block. The field value in the building block type field is one of event trigger, control, action, and variable modification. In the case where the building block type is event trigger, the building block is used to express the conditions for triggering the execution of the graphical programming job. For example, the building block type of event trigger is: when [Start] is clicked. In the case where the building block type is control, the building block is used to describe the control logic. For example, the building block type of control is: repeat (10) times, if...then... In the case where the building block type is action, the building block is used to describe a specific operation. For example, an action block is: Move (10) steps, set the variable [sum] to 0. When a variable block is a variable, the block is used to describe the setting and modification of the variable. For example, a variable block is: Add i to [sum], increment the variable [i] by 1.
[0100] Step S203 : combining the parameter information and the text display information of the building block according to the relative position relationship between the text display information and the parameter information to obtain a text description of the building block.
[0101] For example, the relative position relationship between the text display information and the parameter information represents the spatial position of the text display information and the parameter information on the building block, and may specifically include the distance between the text display information and the parameter information, and the direction relationship between the text display information and the parameter information.
[0102] The text description of the building block can be at least one of Chinese description, symbols and English description.
[0103] Step S204: Obtain the operation logic between each building block according to the program source code.
[0104] For example, the program source code can be parsed to obtain an abstract syntax tree corresponding to the program source code, and then the operation logic between each building block can be obtained from the abstract syntax tree.
[0105] Step S205 : combining the text descriptions of the building blocks according to the operation logic between the building blocks to obtain a structured description of the graphical programming operation.
[0106] Exemplarily, the operation logic includes the operation order and operation conditions between each building block. According to the operation logic between each building block, the text description of each building block is combined, and the structured description of the graphical programming operation can be obtained in the following way: according to the operation conditions between each building block, the delimiter corresponding to each operation condition is determined. According to the operation order between each building block, the text description of each building block is arranged, and the delimiter corresponding to the operation condition is used to separate the text descriptions between the arranged building blocks to obtain the structured description of the graphical programming operation. The delimiter can be "space", "\", ";", a new line, the first line is indented by 2 characters, etc.
[0107] In some embodiments, the execution conditions between building blocks include one of sequential execution, conditional execution, and cyclic execution. Sequential execution indicates that the building blocks are executed in a predetermined order. Conditional execution indicates that the building blocks are executed in a predetermined order only when predetermined conditions are met. Circular execution indicates that the building blocks are executed repeatedly.
[0108] Step S206 : inputting the structured description of the graphical programming job into a preset large language model, so that the large language model corrects the graphical programming job according to the structured description and provides guidance prompts.
[0109] A large language model is a model that can generate natural language text or understand the meaning of language text. The above-mentioned scheme of the embodiment of the present application uses the large language model to correct graphical programming assignments and provide guidance prompts. Based on the ability of the large language model itself to understand the meaning of language text, it can analyze the causes of graphical programming errors for various programming errors (including programming errors outside the scope of answer coverage) and provide targeted guidance prompts, thereby solving to a certain extent the problem existing in the related technology that it is unable to analyze the true causes of graphical programming errors for programming errors outside the scope of answer coverage, and cannot provide targeted guidance prompts.
[0110] In addition, due to the particularity of the field of graphical programming technology, graphical programming jobs are all composed of multiple graphical building blocks, which cannot be recognized by the large language model, so the large language model cannot be directly applied to the graphical programming job correction scenario in the field of graphical programming technology. In the above implementation process, by obtaining the text description of each building block in the graphical programming job and the operating logic between the building blocks, and then combining the text description of the building blocks according to the operating logic between the building blocks, a structured description of the graphical programming job is obtained. In this way, the graphical programming job presented in the form of building blocks can be converted into a structured description that the large language model can understand. In this way, the large language model can understand the true intention of the graphical programming job based on the structured description of the graphical programming job, so that the graphical programming job can be corrected through the large language model, and the cause of the error in the graphical programming job can be known, and then guidance prompts can be given for the cause of the error.
[0111] In addition, since the large language model can understand structured descriptions, the accuracy of the structured descriptions will directly affect the homework correction effect of the large language model. Since the graphical programming homework is formed by the user dragging and dropping building blocks, how to convert the graphical programming homework into a structured description that can more accurately describe the internal logic of the graphical programming homework will directly affect the homework correction effect of the large language model. To this end, in the above-mentioned implementation method of the embodiment of the present application, by obtaining the program source code of the graphical programming homework, the program source code composed of the program code of the building blocks dragged and dropped by the user is obtained. Then, the parameter information and text display information of each building block are obtained from the program source code, and the parameter information and text display information are used to form a text description of each building block. The text description of the building block dragged and dropped by the user can be obtained more accurately, and then the text description of each building block is combined according to the operating logic between the building blocks, so that the structured description of the graphical programming homework obtained can more accurately describe the internal logic of the graphical programming homework.
[0112] Example 2
[0113] This embodiment Figure 2 Based on the embodiments, the present application is further illustrated.
[0114] Graphical programming assignments such as Figure 3As shown, the graphical programming operation is composed of the building blocks "When (start) is clicked", "Slide (10) steps", "If (x)? Then (y)", "Slide (10) steps", "Touch (mouse pointer ▼)" and "Say (hello) (2) seconds". Among them, the building block "When (start) is clicked" is spliced with the building block "Slide (10) steps", the building block "Slide (10) steps" is spliced with the building block "If (x)? Then (y)", and the building block "Slide (10) steps" is spliced with the building block "If (x)? Then (y)". In addition, the building block Touch (mouse pointer ▼) is nested in the x position of the building block "If (x)? Then (y)", and the building block "Say (hello) (2) seconds" is nested in the y position of the building block "If (x)? Then (y)". For this graphical programming task, the program source code of the graphical programming task can be obtained first, and then the configuration information of each building block can be obtained from the program source code of the graphical programming task. The parameter information and text information of each building block are combined according to the relative position relationship between the text display information and the parameter information of each building block to obtain a text description of each building block.
[0115] For example, the parameter information of the building block "When (start) is clicked" is start. The relative position relationship between the text display information and parameter information of the building block "When (start) is clicked" is, for example: when () is clicked. Further, the text description of the building block "When (start) is clicked" can be obtained: when start is clicked. Wherein () is the filling position of the parameter information. The parameter information of the building block "Slide (10) steps" is start. The relative position relationship between the text display information and parameter information of the building block "Slide (10) steps" is, for example: slide () steps. Further, the text description of the building block "Slide (10) steps" can be obtained, namely: slide 10 steps.
[0116] For the block "Meet (mouse pointer ▼)", the parameter information of the block "Meet (mouse pointer ▼)" is the mouse pointer. The relative positional relationship between the text display information and the parameter information of the block "Meet (mouse pointer ▼)" is, for example, "Meet ()." Therefore, the text description of the block "Meet (mouse pointer ▼)" is: Meet the mouse pointer.
[0117] For the building block "Say (Hello) (2) Seconds", the parameter information of the building block "Say (Hello) (2) Seconds" includes hello and 2. The relative position relationship between the text display information and the parameter information of the building block "Say (Hello) (2) Seconds" is say () () seconds. Therefore, the text description of the building block "Say (Hello) (2) Seconds" is: say hello for 2 seconds.
[0118] The relative positional relationship between the text display information and parameter information of the building block "If (x)? Then (y)" is, for example: If ()? Then (). The field value of the parameter field of the building block "If (x)? Then (y)" includes the building block identifier S1 of the building block "Touch (mouse pointer ▼)" and the building block identifier S2 of the building block "Say (hello) (2) seconds". The text description of the building block "Touch (mouse pointer ▼)" and the text description of the building block "Say (hello) (2) seconds" can be used as the parameter information of the building block "If (x)? Then (y)", that is, touch the mouse pointer and say hello for 2 seconds.
[0119] At the same time, the graphical programming job can also be parsed to obtain the abstract syntax tree of the graphical programming job. Then, the operating logic between the building blocks in the graphical programming job is obtained from the abstract syntax tree of the graphical programming job. Exemplarily, the operating condition between the building block "when (start) is clicked" and the building block "slide (10) steps" is sequential execution, and the building block "when (start) is clicked" is executed first, and then the building block "slide (10) steps" is executed. The operating condition between the building block "slide (10) steps" and the building block "if (x)? Then (y)" is sequential execution, and the building block "slide (10) steps" is executed first, and then the building block "if (x)? Then (y)" is executed. However, the operating condition between the building block "touch (mouse pointer ▼)" and the building block "say (hello) (2) seconds" is conditional operation, that is, hello will be said only when the mouse pointer is touched. Finally, according to the operating conditions between each building block, determine the separator corresponding to each operating condition, arrange the text descriptions of each building block according to the operating order between each building block, and use the separator corresponding to the operating condition to separate the text descriptions between the arranged building blocks, and obtain the following Figure 4 The structured description of the graphical programming job is shown.
[0120] Example 3:
[0121] Based on the above embodiment, in order to enable the large language model to better understand the true meaning of the graphical programming operation, this embodiment provides a method for constructing a prompt word template based on the structured description of the graphical programming operation. Figure 5 As shown, the method for constructing the prompt word template may include the following steps:
[0122] Step S501: Fill in the structured description of the graphical programming task into the filling position corresponding to the programming task description in the preset prompt word template.
[0123] Step S502 : Obtain a role definition for the large language model, and fill the role definition for the large language model into the position of the corresponding role description in the prompt word template.
[0124] The role definition for the large language model helps the large language model clarify its own responsibilities and functions. This allows the large language model to provide guidance for graphical programming tasks based on its responsibilities.
[0125] For example, if you are a programming teacher, you can define roles for large language models. You can control the characters in the stage area to complete the task objectives by writing code blocks for specific roles.
[0126] Step S503: Obtain the task objective of the graphical programming task; and fill the task objective into the position corresponding to the task objective description in the prompt word template.
[0127] You can get a graphical programming problem and then get the task goal of the graphical programming task from the graphical programming problem. For example, the task goal of the graphical programming task is to control a motorcycle to slide onto an elevator.
[0128] Step S504: obtaining stage description information of the stage corresponding to the graphical programming task, and filling the stage description information into the corresponding stage description position in the prompt word template.
[0129] When the graphical programming platform provides a graphical programming problem, the graphical programming platform will provide a stage corresponding to the graphical programming problem, and the stage includes information such as scenes and operation objects.
[0130] When the graphical programming job is running, in the stage, the operation object specified by the graphical programming job will move, speak, etc. in the scene of the stage according to the running logic of the graphical programming job.
[0131] For example, the user can specify an operation object in the stage area and describe the attributes and status of the operation object. The large language model can generate stage description information using the received operation object and the attributes and status of the operation object.
[0132] Step S505: Obtain the name and function of each preset building block, and fill the name and function of each preset building block into the corresponding building block description position in the prompt word template. The preset building blocks are building blocks allowed to be used in the graphical programming operation.
[0133] For example, the "When Start is Clicked" block indicates that the operation starts. The "Slide 10 Steps" block indicates that the operating object slides 10 steps, representing a distance of 1 square in the stage area. The "Slide 20 Steps" block indicates that the operating object slides 20 steps, representing a distance of 2 squares in the stage area. The "Face →" block indicates that the operating object turns right.
[0134] Step S506: Obtain the job inspection information and fill the job inspection information into the corresponding job inspection information description position in the prompt word template. The job inspection information includes the building blocks required for inspection of this job.
[0135] The large language model can grade graphical programming assignments based on job assessment information. This means it not only determines whether the assignment meets the task objectives but also whether the required building blocks are used. If a graphical programming assignment fails to use the required building blocks, even if the assignment meets the task objectives, a prompt will be issued, prompting the user to use the required building blocks for graphical programming.
[0136] For example, the inspection information is such as: slide 10 steps, and the building block used in the graphical programming operation is jump 10 steps. In this case, even if the graphical programming operation can achieve the task goal, a guidance prompt will be issued.
[0137] Step S507: Obtain a preset reference answer, and fill the reference answer into the position corresponding to the reference answer description in the prompt word template.
[0138] The execution order of steps S501 to S507 can be changed arbitrarily. For example, step S503 can be executed first, followed by the other steps. Alternatively, step S507 can be executed first, followed by the other steps. The execution order of steps S501 to S507 is not limited herein.
[0139] Step S508: input the filled prompt word template into the large language model.
[0140] The method for constructing a prompt word template provided in the embodiment of the present application can unify the data formats of different graphical programming jobs by constructing prompt word templates, thereby avoiding the large language model from having a misunderstanding of the graphical programming jobs due to different expressions of the data formats, thereby improving the accuracy of the large language model in correcting the graphical programming jobs.
[0141] Combining the schematic diagram of the graphical programming interface shown in Figure 6(a), the task objective of the graphical programming task can be obtained from the building block workspace in Figure 6(a): Control the motorcycle to glide onto the elevator. The graphical programming task includes the building blocks "When Start Clicked," "Face ↑," and "Glide 30 Steps." Furthermore, the object area in the graphical programming interface shown in Figure 6(a) indicates that the learner's selected operating object is the motorcycle. Furthermore, the stage area in the graphical programming interface shown in Figure 6(a) indicates the distance of three squares between the motorcycle and the elevator.
[0142] For the graphical programming task shown in Figure 6(a), the correction results of the large language model can be shown in Figure 6(b):
[0143] You choose to face upward and slide for 30 steps. However, the motorcycle's initial direction is to the right. If you let the motorcycle face upward and slide, it may not reach the elevator.
[0144] Tip: The motorcycle starts facing right, and the elevator is three squares to the right of the motorcycle. Try to imagine that the motorcycle will not change direction and will slide directly to the elevator. This way, you can more accurately control the distance the motorcycle moves.
[0145] Try it again! You can use the Slide block to slide a certain number of steps to ensure that the motorcycle slides to the right onto the elevator.
[0146] Furthermore, the large language model can also output a structured description of a graphical programming task as shown in Figure 6(a):
[0147] The student code is as follows:
[0148] <Motorcycle> character code:
[0149] Facing↑
[0150] Slide 30 steps
[0151] Combining the schematic diagram of the graphical programming interface shown in Figure 7(a), the task objective of the graphical programming task can be obtained from the building block workspace in Figure 7(a): Control the motorcycle to glide onto the elevator. The graphical programming task includes the building blocks "When Start is Clicked," "Glide 10 Steps," and "Glide 10 Steps." Furthermore, the object area in the graphical programming interface shown in Figure 7(a) indicates that the learner's selected operating object is the motorcycle. Furthermore, the stage area in the graphical programming interface shown in Figure 7(a) indicates the distance of three squares between the motorcycle and the elevator.
[0152] For the graphical programming task shown in Figure 7(a), the correction results of the large language model can be shown in Figure 7(b):
[0153] You've successfully slid the motorcycle 20 steps (2 squares), which is great! However, according to the mission objective, the motorcycle needs to slide 3 squares to reach the elevator. Currently, you are one square short.
[0154] Think again, how can you make the motorcycle slide one more grid? You can try adding or modifying the existing code blocks to accomplish this task. Come on!
[0155] Furthermore, the large language model can also output a structured description of a graphical programming task as shown in Figure 7(a):
[0156] Hello classmate! Your current code is as follows:
[0157] When Start is clicked
[0158] Slide 10 steps
[0159] Slide 10 steps
[0160] Combining the schematic diagram of the graphical programming interface shown in Figure 8(a), the task objective of the graphical programming task can be obtained from the building block workspace in Figure 8(a): Control the motorcycle to glide onto the elevator. The graphical programming task includes the building blocks "When Start is Clicked," "Glide 20 Steps," and "Glide 10 Steps." Furthermore, the object area in the graphical programming interface shown in Figure 8(a) indicates that the learner's selected operating object is the motorcycle. Furthermore, the stage area in the graphical programming interface shown in Figure 8(a) indicates the distance of three squares between the motorcycle and the elevator.
[0161] For the graphical programming task shown in Figure 8(a), the correction result of the large language model can be shown in Figure 8(b):
[0162] Logically, the student's code should allow the motorcycle to slide onto the elevator. This is because the motorcycle is initially three squares away from the elevator. After sliding 20 steps (2 squares), it slides another 10 steps (1 square), for a total of 3 squares, just enough to reach the elevator. Therefore, the code is correct.
[0163] However, to help students better understand and improve, the following tips can be given:
[0164] Clear thinking: You applied the sliding code block well and understood the concept that every 10 steps represents a grid.
[0165] Code optimization: Even if your code has achieved its goal, in some cases, concise code is easier to maintain and understand. You can consider whether you can complete the same task in fewer steps.
[0166] Coding style: It is also a good programming practice to keep the code consistent. For example, you can consider sliding the same number of steps each time, or indicate in the comments why you choose a different number of steps.
[0167] Encourage students to think about:
[0168] Is there any other way to achieve the same effect?
[0169] If the distance between the motorcycle and the elevator changes, will your code be able to adapt?
[0170] In conclusion, your code is correct, but you could try a more concise and consistent way to accomplish this task. I wish you continued progress in your programming studies!
[0171] In addition, the large language model can also output a structured description of graphical programming operations:
[0172] Hello classmate! Your current code is as follows:
[0173] <Motorcycle> character code:
[0174] When Start is clicked
[0175] Slide 20 steps
[0176] Slide 10 steps
[0177] Example 4:
[0178] Based on the same inventive concept, the present application also provides a graphical programming job correction device 900. Figure 9 , Figure 9 Shows the use of Figure 2 The device 900 is a graphical programming correction device according to the method shown. The specific functions of the device 900 can be found in the description above. To avoid repetition, the detailed description is omitted here. The device 900 includes at least one software function module that can be stored in a memory in the form of software or firmware or fixed in the operating system of the device 900. Specifically:
[0179] See also Figure 9 As shown, the apparatus 900 is applied to a service distribution device and includes: a first acquisition module 901, a second acquisition module 902, a first combination module 903, a third acquisition module 904, a second combination module 905 and an input module 906.
[0180] The first acquisition module 901 is configured to acquire program source code of a graphical programming job; the graphical programming job includes a plurality of building blocks having a splicing relationship.
[0181] The second acquisition module 902 is configured to acquire configuration information of each building block from the program source code, where the configuration information includes parameter information, text display information, and the relative position relationship between the text display information and the parameter information of the building block.
[0182] The first combining module 903 is configured to combine the parameter information and the text display information of the building block according to the relative position relationship between the text display information and the parameter information to obtain a text description of the building block.
[0183] The third acquisition module 904 is configured to acquire the operation logic between each building block according to the program source code.
[0184] The second combining module 905 is configured to combine the text descriptions of the building blocks according to the operation logic between the building blocks to obtain a structured description of the graphical programming operation.
[0185] The input module 906 is configured to input the structured description of the graphical programming job into a preset large language model, so that the large language model corrects the graphical programming job according to the structured description and provides guidance prompts.
[0186] In a feasible implementation of the embodiment of the present application, if in the program source code, the field value of the parameter field corresponding to the building block is a parameter value, the second acquisition module 902 is specifically configured to determine that the parameter value is parameter information of the building block.
[0187] In a feasible implementation of the embodiment of the present application, if in the program source code, the field value of the parameter field corresponding to the building block is the building block identifier of other building blocks, then the second acquisition module 902 is specifically configured to use the text description of the other building blocks as the parameter information of the building block.
[0188] In this embodiment, the second acquisition module 902 is specifically configured to obtain the configuration information of the other building blocks from the program source code when it is determined that the field value of the parameter field corresponding to the building block is the building block identifier of the other building blocks, and combine the parameter information and text display information of the other building blocks according to the relative position relationship between the text display information and the parameter information of the other building blocks to obtain the text description of the other building blocks; and use the text description of the other building blocks as the parameter information of the building block.
[0189] In a feasible implementation of the embodiment of the present application, the third acquisition module 904 is specifically configured to parse the program source code to obtain an abstract syntax tree corresponding to the program source code; and obtain the operating logic between each building block from the abstract syntax tree.
[0190] In a feasible implementation of the embodiment of the present application, the second combination module 905 is specifically configured to determine the delimiter corresponding to each operating condition according to the operating conditions between each building block; arrange the text descriptions of each building block according to the operating order between each building block, and use the delimiter corresponding to the operating condition to separate the text descriptions between the arranged building blocks to obtain a structured description of the graphical programming operation.
[0191] In a feasible implementation of the embodiment of the present application, the input module 906 is specifically configured to fill the structured description of the graphical programming job into the filling position of the corresponding programming job description in the preset prompt word template; and input the filled prompt word template into the large language model.
[0192] In a feasible implementation of an embodiment of the present application, the input module 906 is further configured to obtain a role definition for the large language model; and fill the role definition for the large language model into the corresponding role description position in the prompt word template, so that the large language model outputs a guidance prompt for the graphical programming job according to the prompt form corresponding to the role definition.
[0193] In a feasible implementation of the embodiment of the present application, the input module 906 is further configured to obtain a task objective of the graphical programming job; and fill the task objective into a position corresponding to the task objective description in the prompt word template.
[0194] In a feasible implementation of the embodiment of the present application, the input module 906 is further configured to obtain stage description information of the stage corresponding to the graphical programming task; and fill the stage description information into the corresponding stage description position in the prompt word template.
[0195] In a feasible implementation of an embodiment of the present application, the input module 906 is further configured to obtain the name and function of each preset building block; the preset building blocks are building blocks allowed to be used in graphical programming operations; and fill the name and function of each preset building block into the corresponding building block description position in the prompt word template.
[0196] In a feasible implementation of an embodiment of the present application, the input module 906 is also configured to obtain job inspection information, which includes the building blocks required to be inspected for this job; and fill the job inspection information into the corresponding job inspection information description position in the prompt word template, so that the large language model can correct the graphical programming job according to the job inspection information.
[0197] In a feasible implementation of the embodiment of the present application, the input module 906 is further configured to obtain a preset reference answer; and fill the reference answer into the position corresponding to the reference answer description in the prompt word template.
[0198] It should be understood that, for the sake of brevity, some of the contents described in the first embodiment will not be repeated in this embodiment.
[0199] Embodiment 5:
[0200] Based on the same inventive concept, this embodiment provides an electronic device, see Figure 10 As shown, it includes a processor 101 and a memory 102. Wherein:
[0201] The processor 101 is configured to execute one or more programs stored in the memory 102 to implement the above-mentioned method for correcting graphical programming jobs.
[0202] It is understood that the processor 101 may be a processor core or a processor chip, or other circuit capable of configuring and running programs. The memory 102 may be RAM (Random Access Memory), ROM (Read-Only Memory), flash memory, etc., but is not limited thereto.
[0203] It's understandable. Figure 10 The structure shown is only for illustration, and the electronic device may also include Figure 10 More or fewer components than shown, or with Figure 10 For example, the system may further include an internal communication bus for enabling communication between the processor 101 and the memory 102; another example, the system may further include an external communication interface, such as a USB (Universal Serial Bus) interface, a CAN (Controller Area Network) bus interface, etc.; another example, the system may further include an information display component such as a display screen, but this is not intended to be limiting.
[0204] Based on the same inventive concept, this embodiment further provides a computer-readable storage medium, such as a floppy disk, an optical disk, a hard disk, a flash memory, a USB flash drive, an SD (Secure Digital Memory Card), or an MMC (Multimedia Card). The computer-readable storage medium stores one or more programs for implementing the aforementioned steps. These one or more programs can be executed by one or more processors to implement the aforementioned method for correcting graphical programming assignments. This description is omitted here.
[0205] Based on the same inventive concept, this embodiment further provides a computer program product, which includes a computer program, and when the computer program is executed by a processor, it implements the above-mentioned method for correcting graphical programming jobs, which will not be described in detail here.
[0206] In the embodiments provided in this application, it should be understood that the disclosed devices and methods can be implemented in other ways. The device embodiments described above are merely schematic. For example, the division of the units is only a logical function division. There may be other division methods in actual implementation. For example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some communication interface, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.
[0207] In addition, the units described as separate components may or may not be physically separate, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed across multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0208] Furthermore, the functional modules in each embodiment of the present application can be integrated together to form an independent part, or each module can exist independently, or two or more modules can be integrated to form an independent part.
[0209] In this document, relational terms such as first and second, etc. are used merely to distinguish one entity or operation from another entity or operation, but do not necessarily require or imply any actual relationship or order between these entities or operations.
[0210] As used herein, a plurality refers to two or more than two.
[0211] The above description is merely an embodiment of the present application and is not intended to limit the scope of protection of the present application. For those skilled in the art, various modifications and variations of the present application are possible. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present application shall be included in the scope of protection of the present application.
Claims
1. A method for correcting graphical programming assignments, characterized in that: include: Obtaining program source code of a graphical programming operation; the graphical programming operation includes a plurality of building blocks having a splicing relationship; For each building block, obtaining configuration information of the building block from the program source code; the configuration information includes parameter information of the building block, text display information, and a relative position relationship between the text display information and the parameter information; Combining the parameter information and the text display information of the building block according to the relative positional relationship between the text display information and the parameter information to obtain a text description of the building block; Obtaining the operation logic between each of the building blocks according to the program source code; Combining the text descriptions of the building blocks according to the operation logic between the building blocks to obtain a structured description of the graphical programming operation; The structured description of the graphical programming job is input into a preset large language model, so that the large language model corrects the graphical programming job according to the structured description and provides guidance prompts.
2. The method according to claim 1, characterized in that Obtain the configuration information of the building block from the program source code, including: If, in the program source code, the field value of the parameter field corresponding to the building block is a parameter value, then the parameter value is determined to be parameter information of the building block.
3. The method according to claim 1, characterized in that Obtain the configuration information of the building block from the program source code, including: If, in the program source code, the field value of the parameter field corresponding to the building block is the building block identifier of another building block, the text description of the other building block is used as the parameter information of the building block.
4. The method according to claim 3, characterized in that If the field value of the parameter field corresponding to the building block in the program source code is the building block identifier of another building block, the text description of the other building block is used as the parameter information of the building block, including: When it is determined that the field value of the parameter field corresponding to the building block is the building block identifier of another building block, obtaining configuration information of the other building block from the program source code, and combining the parameter information and the text display information of the other building block according to the relative positional relationship between the text display information and the parameter information of the other building block to obtain a text description of the other building block; The text description of the other building blocks is used as the parameter information of the building block.
5. The method according to claim 1, characterized in that Obtaining the operation logic between the building blocks according to the program source code includes: Parsing the program source code to obtain an abstract syntax tree corresponding to the program source code; The operation logic between the building blocks is obtained from the abstract syntax tree.
6. The method according to claim 1, characterized in that The operation logic includes the operation sequence and operation conditions between the building blocks; according to the operation logic between the building blocks, the text descriptions of the building blocks are combined to obtain the structured description of the graphical programming operation, including: According to the operating conditions between the building blocks, determine the separators corresponding to the operating conditions; The text descriptions of the building blocks are arranged according to the execution order of the building blocks, and the text descriptions between the arranged building blocks are separated by separators corresponding to the execution conditions to obtain a structured description of the graphical programming operation.
7. The method according to any one of claims 1 to 6, characterized in that Inputting the structured description of the graphical programming operation into a preset large language model includes: Filling the structured description of the graphical programming task into the corresponding programming task description filling position in the preset prompt word template; The filled-in prompt word template is input into the large language model.
8. The method according to claim 7, characterized in that Before inputting the completed prompt word template into the large language model, the method further includes: Obtaining a role definition for the large language model; The role definition for the large language model is filled into the position of the corresponding role description in the prompt word template, so that the large language model outputs a guidance prompt for the graphical programming task according to the prompt form corresponding to the role definition.
9. The method according to claim 7, characterized in that Before inputting the completed prompt word template into the large language model, the method further includes: Obtaining a task objective of the graphical programming operation; Fill the task objective into the position corresponding to the task objective description in the prompt word template.
10. The method according to claim 7, characterized in that Before inputting the completed prompt word template into the large language model, the method further includes: Obtaining stage description information of the stage corresponding to the graphical programming job; Fill the stage description information into the corresponding stage description position in the prompt word template.
11. The method according to claim 7, characterized in that Before inputting the completed prompt word template into the large language model, the method further includes: Obtaining the name and function of each preset building block; the preset building blocks are building blocks allowed to be used in the graphical programming operation; Fill the name and function of each preset building block into the corresponding building block description position in the prompt word template.
12. The method according to claim 7, characterized in that Before inputting the completed prompt word template into the large language model, the method further includes: Obtaining job inspection information, wherein the job inspection information includes building blocks required for inspection of this job; The job inspection information is filled into the position corresponding to the job inspection information description in the prompt word template, so that the large language model corrects the graphical programming job according to the job inspection information.
13. The method according to claim 7, characterized in that Before inputting the completed prompt word template into the large language model, the method further includes: Get preset reference answers; Fill the reference answer into the corresponding reference answer description position in the prompt word template.
14. A graphical programming homework correction device, characterized in that: include: A first acquisition module is configured to acquire program source code of the graphical programming operation; the graphical programming operation includes a plurality of building blocks in a splicing relationship; a second acquisition module configured to acquire, for each building block, configuration information of the building block from the program source code, the configuration information including parameter information of the building block, text display information, and a relative positional relationship between the text display information and the parameter information; a first combining module configured to combine the parameter information and the text display information of the building block according to the relative position relationship between the text display information and the parameter information to obtain a text description of the building block; A third acquisition module is configured to acquire the operation logic between the building blocks according to the program source code; a second combining module configured to combine the text descriptions of the building blocks according to the operation logic between the building blocks to obtain a structured description of the graphical programming operation; The input module is configured to input the structured description of the graphical programming job into a preset large language model, so that the large language model corrects the graphical programming job according to the structured description and gives guidance prompts.
15. An electronic device, characterized in that: The system comprises a processor and a memory, wherein the memory stores computer-executable instructions that can be executed by the processor, and the processor executes the computer-executable instructions to implement the method for correcting graphical programming assignments according to any one of claims 1 to 13.
16. A storage medium, characterized in that The storage medium stores computer-executable instructions. When the computer-executable instructions are called and executed by the processor, the computer-executable instructions enable the processor to implement the method for correcting graphical programming assignments according to any one of claims 1 to 13.
17. A computer program product, characterized in that The computer program product includes a computer program, and when the computer program is executed by a processor, the method for correcting graphical programming assignments according to any one of claims 1 to 13 is implemented.
Citation Information
Patent Citations
Graphical programming work evaluation method
CN113220286A
Homework correction method and device based on image recognition, equipment and storage medium
CN115601778A