Page code generation method and device

By extracting the feature information of the component area in the page design draft and determining the component type, the problem of standardization dependence on the design draft in the prior art is solved, and more efficient page code generation is achieved.

CN113515280BActive Publication Date: 2025-03-04TENCENT TECHNOLOGY (SHENZHEN) CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202011415178.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2020-12-03
Publication Date
2025-03-04
Estimated Expiration
2040-12-03

AI Technical Summary

Technical Problem

The existing technology has strong dependence on the standardization of design drafts when automatically generating page codes, resulting in low efficiency in page code generation.

Method used

By extracting the feature information of the component area in the page design draft, determining the component type, and calling the associated code blocks, the code blocks are integrated to generate the page code.

Benefits of technology

Reduce the dependence on design draft standardization, improve the efficiency of page code generation, and enable more extensive code generation based on design drafts under different design standards.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN113515280B_ABST
    Figure CN113515280B_ABST
Patent Text Reader

Abstract

The embodiment of the present application provides a method and device for generating page code. The method includes: obtaining a page design draft, wherein the page design draft includes a component area; extracting characteristic information of a target component in the component area, wherein the characteristic information is used to characterize the properties of the target component; based on the characteristic information, determining the target component type to which the target component belongs in the component library; calling a target code block associated with the target component type to integrate the target code block to obtain the page code of the page design draft. The technical solution of the embodiment of the present application can reduce the reliance on the standardization of the design draft when automatically generating page code, thereby improving the efficiency of generating page code.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the fields of artificial intelligence and computer technology, and in particular to a method and device for generating page codes. Background Art

[0002] In the page code generation scenario, the prior art usually parses the page design draft structure and then directly converts it into UI code. Or uses a DSL domain-specific language to convert a customized page design draft structure into code. In this process, components can be distinguished based on the structure and identification of the page design draft, and then the developed components can be directly rendered. However, the above method has a strong reliance on the standardization of the design draft, resulting in low efficiency in page code generation. Based on this, how to reduce the reliance on the standardization of the design draft when automatically generating page code is a technical problem that needs to be solved urgently. Summary of the invention

[0003] The embodiments of the present application provide a page code generation method, device, computer program product or computer program, computer-readable medium and electronic device, which can reduce the reliance on design draft standardization when automatically generating page codes, and improve the efficiency of page code generation, at least to a certain extent.

[0004] Other features and advantages of the present application will become apparent from the following detailed description, or may be learned in part by the practice of the present application.

[0005] According to one aspect of an embodiment of the present application, a page code generation method is provided, the method comprising: obtaining a page design draft, the page design draft including a component area; extracting feature information of a target component in the component area, the feature information being used to characterize properties of the target component; based on the feature information, determining a target component type to which the target component belongs in a component library; calling a target code block associated with the target component type to integrate the target code block to obtain a page code of the page design draft.

[0006] According to one aspect of an embodiment of the present application, a page code generating device is provided, the device comprising: a first acquisition unit, used to acquire a page design draft, the page design draft including a component area; an extraction unit, used to extract feature information of a target component in the component area, the feature information being used to characterize a property of the target component; a first determination unit, used to determine a target component type to which the target component belongs in a component library based on the feature information; and a calling unit, used to call a target code block associated with the target component type to integrate the target code block to obtain the page code of the page design draft.

[0007] In some embodiments of the present application, based on the aforementioned scheme, the extraction unit is configured to: scan the page design draft to obtain at least one component area in the page design draft; and extract feature information of the target component in each component area respectively.

[0008] In some embodiments of the present application, based on the aforementioned solution, the component library includes at least one code block, wherein one code block is associated with one component type.

[0009] In some embodiments of the present application, based on the aforementioned scheme, the first determination unit is configured as: based on the feature information, scoring the target component in the component area through a preset model to obtain a trust score of the target component for each component type, wherein the trust score is used to characterize the degree of trust of the target component as a corresponding component type; determining the target component type to which the target component belongs in the component library according to the trust score of the target component for each component type.

[0010] In some embodiments of the present application, based on the aforementioned scheme, the feature information includes at least two, and the first determination unit is configured to: score the target component in the component area based on each feature information through a preset model, and obtain a sub-trust score of the target component on each component type; for each component type, weightedly evaluate the sub-trust score of the target component based on each feature information according to a preset weight, and obtain a trust score of the target component on each component type.

[0011] In some embodiments of the present application, based on the aforementioned solution, the feature information includes at least two of text feature information, position feature information, and icon feature information.

[0012] In some embodiments of the present application, based on the aforementioned scheme, the first determination unit is configured to: when the trust score reaches a first threshold, determine the component type corresponding to the trust score as the component type to be verified of the target component in the component library; determine the degree of fit between the text in the target component and the text library corresponding to the component type to be verified; when the degree of fit reaches a second threshold, determine the component type to be verified as the target component type to which the target component belongs in the component library.

[0013] In some embodiments of the present application, based on the aforementioned scheme, the device also includes a second determination unit, which is used to determine that the component type to which the target component belongs does not exist in the component library when the trust score does not reach the first threshold, or when the trust score reaches the first threshold and the degree of fit does not reach the second threshold; a writing unit, which is used to write the component type to which the target component belongs into the component library.

[0014] In some embodiments of the present application, based on the aforementioned scheme, the device also includes a training unit, which is used to train the preset model based on the feature information of the target component and the component type to which the target component belongs after writing the component type to which the target component belongs into the component library, so as to update the preset model; a second acquisition unit is used to obtain a code block corresponding to the component type to which the target component belongs, and associate the code block with the component type to which the target component belongs.

[0015] According to one aspect of an embodiment of the present application, a computer program product or a computer program is provided, the computer program product or the computer program includes a computer instruction, and the computer instruction is stored in a computer-readable storage medium. A processor of a computer device reads the computer instruction from the computer-readable storage medium, and the processor executes the computer instruction, so that the computer device executes the page code generation method described in the above embodiment.

[0016] According to one aspect of an embodiment of the present application, a computer-readable medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the page code generation method described in the above embodiment is implemented.

[0017] According to one aspect of an embodiment of the present application, an electronic device is provided, comprising: one or more processors; a storage device for storing one or more programs, and when the one or more programs are executed by the one or more processors, the one or more processors implement the page code generation method as described in the above embodiments.

[0018] In the technical solutions provided in some embodiments of the present application, by extracting the characteristic information used to characterize the properties of the target component in the component area in the page design draft, and determining the target component type to which the target component belongs in the component library through the characteristic information, and further calling the target code block associated with the target component type, the page code of the page design draft is obtained by integrating the target code block. Since this solution can intelligently identify and distinguish component types based on the characteristic information of the components in the design draft during the process of generating page code based on the page design draft, it can remove or reduce the reliance on the standardization of the design draft when automatically generating page code, so that code generation can be more widely performed based on design drafts under different design standards, thereby improving the generation efficiency of page code.

[0019] It should be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the present application. BRIEF DESCRIPTION OF THE DRAWINGS

[0020] The drawings herein are incorporated into the specification and constitute a part of the specification, showing embodiments consistent with the present application, and together with the specification, are used to explain the principles of the present application. Obviously, the drawings described below are only some embodiments of the present application, and for ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work. In the drawings:

[0021] Figure 1 A schematic diagram showing an exemplary system architecture to which the technical solution of the embodiments of the present application can be applied;

[0022] Figure 2 A scene diagram of an application page code generation method according to an embodiment of the present application is shown;

[0023] Figure 3 A flow chart of a page code generation method according to an embodiment of the present application is shown;

[0024] Figure 4 A detailed flow chart of extracting characteristic information of a target component in a component area according to an embodiment of the present application is shown;

[0025] Figure 5 A detailed flow chart of determining the target component type to which a target component belongs in a component library according to an embodiment of the present application is shown;

[0026] Figure 6 A detailed flow chart of determining the trust score of a target component on each component type through a preset model according to an embodiment of the present application is shown;

[0027] Figure 7 A detailed flow chart of determining the target component type to which a target component belongs in a component library according to an embodiment of the present application is shown;

[0028] Figure 8 A detailed flow chart of determining the target component type to which a target component belongs in a component library according to an embodiment of the present application is shown;

[0029] Fig. 9 A flow chart of a method after writing the component type to which the target component belongs into the component library according to an embodiment of the present application is shown;

[0030] Fig.10 A partial flow chart of a page code generation method according to an embodiment of the present application is shown;

[0031] Fig.11 A block diagram of a page code generating device according to an embodiment of the present application is shown;

[0032] Fig.12A schematic diagram of the structure of a computer system suitable for implementing an electronic device of an embodiment of the present application is shown. DETAILED DESCRIPTION

[0033] Example embodiments will now be described more fully with reference to the accompanying drawings. However, example embodiments can be implemented in a variety of forms and should not be construed as limited to the examples set forth herein; rather, these embodiments are provided so that this application will be more comprehensive and complete and fully convey the concept of the example embodiments to those skilled in the art.

[0034] In addition, described feature, structure or characteristic can be combined in one or more embodiments in any suitable manner. In the following description, many specific details are provided to provide a full understanding of the embodiments of the present application. However, those skilled in the art will appreciate that the technical scheme of the present application can be put into practice without one or more of the specific details, or other methods, components, devices, steps, etc. can be adopted. In other cases, known methods, devices, realizations or operations are not shown or described in detail to avoid blurring the various aspects of the application.

[0035] The block diagrams shown in the accompanying drawings are merely functional entities and do not necessarily correspond to physically independent entities. That is, these functional entities may be implemented in software form, or in one or more hardware modules or integrated circuits, or in different networks and / or processor devices and / or microcontroller devices.

[0036] The flowcharts shown in the accompanying drawings are only exemplary and do not necessarily include all the contents and operations / steps, nor must they be executed in the order described. For example, some operations / steps can be decomposed, and some operations / steps can be combined or partially combined, so the actual execution order may change according to actual conditions.

[0037] Figure 1 A schematic diagram of an exemplary system architecture to which the technical solution of the embodiments of the present application can be applied is shown.

[0038] like Figure 1 As shown, the system architecture may include terminal devices (such as Figure 1 The embodiment of the present invention is a schematic diagram of a mobile phone 101, a tablet computer 102, a portable computer 103, a desktop computer, etc., a network 104, and a server 105. The network 104 is used to provide a medium for a communication link between the terminal device and the server 105. The network 104 may include various connection types, such as a wired communication link, a wireless communication link, etc.

[0039] It should be understood that Figure 1The number of terminal devices, networks and servers in the embodiment is only for illustration. According to the implementation requirements, there may be any number of terminal devices, networks and servers. For example, the server 105 may be a server cluster composed of multiple servers.

[0040] In one embodiment of the present application, a user can use a terminal device to upload a page design draft to the server 105 and request to generate page code, wherein the page design draft includes a component area. After obtaining the page design draft, the server 105 extracts feature information used to characterize the attributes of the target component in the component area, and based on the feature information, determines the target component type to which the target component belongs in the component library, and finally calls the target code block associated with the target component type to integrate the target code block to obtain the page code of the page design draft.

[0041] In the process of generating page code according to the page design draft, the server 105 intelligently identifies and distinguishes the component types based on the characteristic information of the components in the design draft, thereby removing or reducing the dependence on the standardization of the design draft when automatically generating page code, thereby improving the efficiency of page code generation.

[0042] It should be noted that the page code generation method provided in the embodiment of the present application is generally executed by the server 105, and accordingly, the page code generation device is generally set in the server 105. However, in other embodiments of the present application, the terminal device may also have similar functions as the server, thereby executing the page code generation solution provided in the embodiment of the present application.

[0043] Figure 2 A scene diagram of an application page code generation method according to an embodiment of the present application is shown.

[0044] like Figure 2 As shown, after obtaining the page design draft 201, the electronic device obtains the page code 202 by executing the page code generation method proposed in this application.

[0045] It should be noted that the page design draft refers to the front end of a web page or mobile page, that is, the interface style and visual presentation of the page. The page design draft includes page elements. In actual use, users operate the page elements in the page design draft to operate the computer. In order to realize the functions of the page elements in the page design draft, it is necessary to generate web page codes corresponding to the page design draft to support the functions of the page elements in the page design draft.

[0046] The implementation details of the technical solution of the embodiment of the present application are described in detail below:

[0047] Figure 3A flow chart of a method for generating a page code according to an embodiment of the present application is shown. The method for generating a page code can be executed by a device having a computing processing function, such as Figure 1 Executed by the server 105 shown in FIG. Figure 3 As shown, the page code generation method at least includes steps 310 to 370, which are described in detail as follows:

[0048] In step 310, a page design draft is obtained, wherein the page design draft includes a component area.

[0049] It should be understood that the page design draft refers to the visual draft data and its carrier having a data structure for describing design elements.

[0050] In this application, the page design draft is designed by the page designer before the page code is generated. According to actual needs, corresponding component areas are divided at corresponding positions in the page design draft, and the component areas include components. Among them, there is at least one component area in a page design draft, and one component area corresponds to one component.

[0051] It is also necessary to understand that a component refers to an abstract concept specific to the front-end development field that has a certain UI and business interaction logic. In terms of intuitive visual effects, the component has text and image content that can be directly seen.

[0052] Continue to refer to Figure 3 In step 330, feature information of the target component in the component area is extracted, and the feature information is used to characterize the properties of the target component.

[0053] In the present application, the feature information may include at least two.

[0054] Specifically, the feature information may include at least two of text feature information, position feature information, and icon feature information.

[0055] Among them, text feature information can refer to specific text, such as "Confirm", "Search", "Next page" and other text content. Position feature information can refer to the position or orientation of the component in the page design draft, such as the coordinates of the component in the page design draft, etc. Icon feature information can refer to specific images or symbols, such as specific pictures, arrow symbols, etc.

[0056] In one embodiment of the present application, the feature information of the target component in the component area can be extracted as follows: Figure 4 Follow the steps shown.

[0057] See also Figure 4, shows a detailed flow chart of extracting characteristic information of a target component in a component area according to an embodiment of the present application. Specifically, it includes steps 331 to 332:

[0058] In step 331, the page design draft is scanned to obtain at least one component area in the page design draft.

[0059] In step 332, feature information of the target component in each component area is extracted respectively.

[0060] In the present application, during the scanning of the page design draft, at least one component area in the page design draft can be obtained by image recognition technology. In addition, feature information of the target component in each component area can be extracted by obtaining corresponding vector features through component position, files, icons and other contents in the component.

[0061] Continue to refer to Figure 3 In step 350, based on the characteristic information, the target component type to which the target component belongs in the component library is determined.

[0062] In the present application, a component library may refer to a collection of components. Specifically, the components in the component library may have classification tags, and the classification tags may be used to identify the component type of the component.

[0063] In one embodiment of the present application, the component library may further include at least one code block, wherein one code block is associated with one component type.

[0064] It should be noted that, in actual applications, when the code block is executed, it can realize the component function of the corresponding component type. For example, when you click "Next Page" on the page, the display screen can jump from the current page to another page by executing the corresponding code in the corresponding code block.

[0065] In one embodiment of the present application, based on the feature information, determining the target component type to which the target component belongs in the component library can be performed as follows: Figure 5 Follow the steps shown.

[0066] See also Figure 5 , shows a detailed flow chart of determining the target component type to which the target component belongs in the component library according to an embodiment of the present application. Specifically, it includes steps 351 to 352:

[0067] In step 351, based on the feature information, the target component in the component area is scored using a preset model to obtain a trust score for the target component in each component type, wherein the trust score is used to characterize the degree of trust of the target component as a corresponding component type.

[0068] In the present application, the preset model may be a machine learning model that has been trained in advance, or may be a controllable recognition program based on data and experience that has been artificially developed and trained.

[0069] In order to help those skilled in the art better understand the training process of the preset model, this will be explained below with reference to the machine learning model:

[0070] In the present application, the "components of identifiable types" accumulated during the development and design process and their corresponding "feature information in the design draft" can be used as a training set to train a machine learning model, so that the model can score candidate component types based on the input feature information (such as text feature information and component location feature information).

[0071] For example, for a component that displays rankings, it is usually presented in a specific position in the page design draft with texts with certain characteristics such as [No. xx], [No. xx], [No. xx], [No. xx], etc. The model is trained with "[component type, content and position of text]" included in the training set, and will play the role of a classification component in the subsequent recognition process, that is, it can score the above-mentioned "ranking component" based on the above-mentioned input text feature information and position feature information to obtain a higher score.

[0072] During the recognition process, for example, the text in the page design is extracted and its position information is recorded in the form of vector features, which are then passed as input to the preset model for scoring and recognition.

[0073] Specifically, in a specific implementation of step 351, based on the feature information, the target component in the component area is scored by a preset model to obtain the trust score of the target component in each component type, which can be as follows: Figure 6 Follow the steps shown.

[0074] See also Figure 6 , shows a detailed flow chart of determining the trust score of a target component on each component type through a preset model according to an embodiment of the present application. Specifically including steps 3511 to 3512:

[0075] In step 3511, based on each piece of feature information, the target component in the component area is scored using a preset model to obtain a sub-trust score of the target component in each component type.

[0076] In step 3512, for each component type, the sub-trust scores of the target component based on each feature information are weighted and evaluated according to preset weights to obtain the trust score of the target component for each component type.

[0077] In order to enable those skilled in the art to better understand Figure 6 The steps shown are described below with reference to the example in Table 1:

[0078] X "Ranking Component" Type "Filter Component" Type <![CDATA[Text feature information x1(0.7)]]> 8 points 3 points <![CDATA[Position feature information x2(0.3)]]> 7 points 1 point Trust Score 7.7 points 2.4 points

[0079] Table 1

[0080] Referring to Table 1, for a target component X, it corresponds to text feature information x1 and position feature information x2, wherein, based on the text feature information x1, the target component X is scored by a preset model, and the first sub-trust score of the target component X on each component type can be obtained (for example, the first sub-trust score on the "ranking component" type is 8 points, and the first sub-trust score on the "screening component" type is 3 points). Based on the position feature information x2, the target component X is scored by a preset model, and the second sub-trust score of the target component X on each component type can be obtained (for example, the first sub-trust score on the "ranking component" type is 7 points, and the first sub-trust score on the "screening component" type is 1 point).

[0081] Furthermore, in the above example, the preset weight for the text feature information x1 is 0.7, and the preset weight for the position feature information x1 is 0.3. Based on this, the trust score of the target component X in the "ranking component" type is: 0.7×8+0.3×7=7.7, and the trust score in the "screening component" type is: 0.7×3+0.3×1=2.4.

[0082] Continue to refer to Figure 5 In step 352, the target component type to which the target component belongs in the component library is determined based on the trust score of the target component on each component type.

[0083] In this application, the preset model scores according to the degree of match between text features and relative positions. When the score meets the standard and matches the text features of a component, the model will identify it as a component.

[0084] In a specific implementation of step 352, based on the trust score of the target component on each component type, determining the target component type in the component library to which the target component belongs can be performed as follows: Figure 7 Follow the steps shown.

[0085] See also Figure 7, shows a detailed flow chart of determining the target component type to which the target component belongs in the component library according to an embodiment of the present application. Specifically, it includes steps 3521 to 3523:

[0086] In step 3521, when the trust score reaches a first threshold, the component type corresponding to the trust score is determined in the component library as the component type to be verified of the target component.

[0087] Specifically, for example, the first threshold is set to 7 points. When the trust score of the "ranking component" type is 7.7 points, it means that the "ranking component" type is the component type to be verified of the target component.

[0088] In step 3522, the degree of consistency between the text in the target component and the text library corresponding to the component type to be verified is determined.

[0089] In step 3523, when the degree of fit reaches a second threshold, the component type to be verified is determined as the target component type to which the target component belongs in the component library.

[0090] In the present application, each component type may correspond to a text library, wherein the text library may include texts closely related to the corresponding component type.

[0091] As mentioned above, the target component also includes text, and the degree of fit between the text in the target component and the text library corresponding to the component type to be verified can be the number of overlaps between the text in the target component and the text in the corresponding text library, or the overlap ratio.

[0092] When the degree of fit reaches a second threshold, the component type to be verified is determined as the target component type to which the target component belongs in the component library. The advantage is that the scoring and recognition results of the model can be verified, thereby improving the accuracy of the entire solution in identifying the target component type.

[0093] In the present application, according to the trust score of the target component on each component type, determining the target component type to which the target component belongs in the component library can also be performed as follows: Figure 8 Follow the steps shown.

[0094] See also Figure 8 , shows a detailed flow chart of determining the target component type to which the target component belongs in the component library according to an embodiment of the present application. Specifically including steps 3524 to 3525:

[0095] In step 3524, when the trust score does not reach the first threshold, or when the trust score reaches the first threshold and the degree of fit does not reach the second threshold, it is determined that the component type to which the target component belongs does not exist in the component library.

[0096] In step 3525, the component type to which the target component belongs is written into the component library.

[0097] In the present application, when the component type to which the target component belongs does not exist in the component library, the component type to which the target component belongs is written into the component library, which can improve the component types in the entire component library, so that to a certain extent, the situation in which the component type to which the target component belongs does not exist in the component library during the subsequent component type identification process can be avoided.

[0098] In one embodiment of the present application, after the component type to which the target component belongs is written into the component library, the following can also be performed: Fig. 9 Steps shown.

[0099] See also Fig. 9 , shows a method flow chart after writing the component type to which the target component belongs into the component library according to an embodiment of the present application. Specifically including steps 3526 to 3527:

[0100] In step 3526, based on the feature information of the target component and the component type to which the target component belongs, the preset model is trained to update the preset model.

[0101] In step 3527, a code block corresponding to the component type to which the target component belongs is obtained, and the code block is associated with the component type to which the target component belongs.

[0102] In the present application, the preset model is trained based on the characteristic information of the target component and the component type to which the target component belongs, which can enhance the component recognition function of the preset model and improve the accuracy of the preset model in identifying the component type.

[0103] In the present application, associating the code block with the component type to which the target component belongs may be writing the code block into the component library.

[0104] Continue to refer to Figure 3 In step 370, the target code block associated with the target component type is called to integrate the target code block to obtain the page code of the page design draft.

[0105] In the present application, by calling the target code block associated with the target component type, at least one target code block is spliced ​​and encapsulated to obtain the page code of the page design draft.

[0106] It can be seen that the page code generation solution proposed in this application can reduce or remove the requirements for page design draft specifications, and improve the credibility of identifying classification components. During the development and joint debugging process, the automation process of converting page design draft to code can be realized.

[0107] In order to make those skilled in the art better understand the present application, Fig.10 The component type identification part in the page code generation solution proposed in this application is generally described as follows:

[0108] See also Fig.10 , shows a partial flow chart of a page code generation method according to an embodiment of the present application.

[0109] like Fig.10 As shown, first, the component area is divided according to the page design draft, and several target components are obtained from the component area. Then, the feature information of the several target components is extracted respectively, and based on the feature information, the component types of the several target components are identified by a preset model trained by a training set to determine whether the target component is a component in the component library. Finally, when the target component is not a component in the library, the target component is marked as a non-library component, and when the target component is a component in the library, the target component is marked as a component in the library.

[0110] In the technical solutions provided in some embodiments of the present application, by extracting the characteristic information used to characterize the properties of the target component in the component area in the page design draft, and determining the target component type to which the target component belongs in the component library through the characteristic information, and further calling the target code block associated with the target component type, the page code of the page design draft is obtained by integrating the target code block. Since this solution can intelligently identify and distinguish component types based on the characteristic information of the components in the design draft during the process of generating page code based on the page design draft, it can remove or reduce the reliance on the standardization of the design draft when automatically generating page code, so that code generation can be more widely performed based on design drafts under different design standards, thereby improving the generation efficiency of page code.

[0111] The following describes an apparatus embodiment of the present application, which can be used to execute the page code generation method in the above embodiment of the present application. For details not disclosed in the apparatus embodiment of the present application, please refer to the above embodiment of the page code generation method of the present application.

[0112] Fig.11A block diagram of a page code generating device according to an embodiment of the present application is shown.

[0113] Reference Fig.11 As shown, according to an embodiment of the present application, a page code generating device 1100 includes: a first acquiring unit 1101 , an extracting unit 1102 , a first determining unit 1103 and a calling unit 1104 .

[0114] Among them, the first acquisition unit 1101 is used to obtain a page design draft, which includes a component area; the extraction unit 1102 is used to extract feature information of a target component in the component area, and the feature information is used to characterize the properties of the target component; the first determination unit 1103 is used to determine the target component type to which the target component belongs in the component library based on the feature information; the calling unit 1104 is used to call a target code block associated with the target component type to integrate the target code block to obtain the page code of the page design draft.

[0115] In some embodiments of the present application, based on the aforementioned scheme, the extraction unit 1102 is configured to: scan the page design draft to obtain at least one component area in the page design draft; and extract feature information of the target component in each component area respectively.

[0116] In some embodiments of the present application, based on the aforementioned solution, the component library includes at least one code block, wherein one code block is associated with one component type.

[0117] In some embodiments of the present application, based on the aforementioned scheme, the first determination unit 1103 is configured as: based on the feature information, scoring the target component in the component area through a preset model to obtain a trust score of the target component for each component type, wherein the trust score is used to characterize the degree of trust of the target component as a corresponding component type; determining the target component type to which the target component belongs in the component library according to the trust score of the target component for each component type.

[0118] In some embodiments of the present application, based on the aforementioned scheme, the feature information includes at least two, and the first determination unit 1103 is configured to: score the target component in the component area based on each feature information through a preset model, and obtain a sub-trust score of the target component on each component type; for each component type, weightedly evaluate the sub-trust score of the target component based on each feature information according to a preset weight, and obtain a trust score of the target component on each component type.

[0119] In some embodiments of the present application, based on the aforementioned solution, the feature information includes at least two of text feature information, position feature information, and icon feature information.

[0120] In some embodiments of the present application, based on the aforementioned scheme, the first determination unit 1103 is configured to: when the trust score reaches a first threshold, determine the component type corresponding to the trust score as the component type to be verified of the target component in the component library; determine the degree of fit between the text in the target component and the text library corresponding to the component type to be verified; when the degree of fit reaches a second threshold, determine the component type to be verified as the target component type to which the target component belongs in the component library.

[0121] In some embodiments of the present application, based on the aforementioned scheme, the device also includes a second determination unit, which is used to determine that the component type to which the target component belongs does not exist in the component library when the trust score does not reach the first threshold, or when the trust score reaches the first threshold and the degree of fit does not reach the second threshold; a writing unit, which is used to write the component type to which the target component belongs into the component library.

[0122] In some embodiments of the present application, based on the aforementioned scheme, the device also includes a training unit, which is used to train the preset model based on the feature information of the target component and the component type to which the target component belongs after writing the component type to which the target component belongs into the component library, so as to update the preset model; a second acquisition unit is used to obtain a code block corresponding to the component type to which the target component belongs, and associate the code block with the component type to which the target component belongs.

[0123] Fig.12 A schematic diagram of the structure of a computer system suitable for implementing an electronic device of an embodiment of the present application is shown.

[0124] It should be noted that Fig.12 The computer system 1200 of the electronic device shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present application.

[0125] like Fig.12As shown, the computer system 1200 includes a central processing unit (CPU) 1201, which can perform various appropriate actions and processes according to the program stored in the read-only memory (ROM) 1202 or the program loaded from the storage part 1208 to the random access memory (RAM) 1203, such as executing the method described in the above embodiment. In the RAM 1203, various programs and data required for system operation are also stored. The CPU 1201, the ROM 1202 and the RAM 1203 are connected to each other through the bus 1204. The input / output (I / O) interface 1205 is also connected to the bus 1204.

[0126] The following components are connected to the I / O interface 1205: an input section 1206 including a keyboard, a mouse, etc.; an output section 1207 including a cathode ray tube (CRT), a liquid crystal display (LCD), etc., and a speaker, etc.; a storage section 1208 including a hard disk, etc.; and a communication section 1209 including a network interface card such as a LAN (Local Area Network) card, a modem, etc. The communication section 1209 performs communication processing via a network such as the Internet. A drive 1210 is also connected to the I / O interface 1205 as needed. A removable medium 1211, such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, etc., is installed on the drive 1210 as needed so that a computer program read therefrom is installed into the storage section 1208 as needed.

[0127] In particular, according to an embodiment of the present application, the process described above with reference to the flowchart can be implemented as a computer software program. For example, an embodiment of the present application includes a computer program product, which includes a computer program carried on a computer-readable medium, and the computer program includes a program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from a network through a communication section 1209, and / or installed from a removable medium 1211. When the computer program is executed by a central processing unit (CPU) 1201, various functions defined in the system of the present application are executed.

[0128] It should be noted that the computer-readable medium shown in the embodiment of the present application may be a computer-readable signal medium or a computer-readable storage medium or any combination of the above two. The computer-readable storage medium may be, for example, - but not limited to - an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM), a flash memory, an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In the present application, a computer-readable storage medium may be any tangible medium containing or storing a program, which may be used by an instruction execution system, device or device or used in combination with it. In the present application, a computer-readable signal medium may include a data signal propagated in a baseband or as part of a carrier wave, wherein a computer-readable program code is carried. Such propagated data signals may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. Computer-readable signal media may also be any computer-readable medium other than computer-readable storage media, which may send, propagate, or transmit programs for use by or in conjunction with an instruction execution system, apparatus, or device. The program code contained on the computer-readable medium may be transmitted using any appropriate medium, including but not limited to: wireless, wired, etc., or any suitable combination of the above.

[0129] The flowchart and block diagram in the accompanying drawings illustrate the possible architecture, functions and operations of the system, method and computer program product according to various embodiments of the present application. Wherein, each box in the flowchart or block diagram can represent a module, a program segment, or a part of the code, and the above-mentioned module, program segment, or a part of the code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in a different order from the order marked in the accompanying drawings. For example, two boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram or flowchart, and the combination of boxes in the block diagram or flowchart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.

[0130] The units involved in the embodiments described in this application may be implemented by software or hardware, and the units described may also be set in a processor. The names of these units do not, in some cases, constitute limitations on the units themselves.

[0131] As another aspect, the present application also provides a computer program product or a computer program, which includes a computer instruction stored in a computer-readable storage medium. A processor of a computer device reads the computer instruction from the computer-readable storage medium, and the processor executes the computer instruction, so that the computer device executes the page code generation method described in the above embodiment.

[0132] As another aspect, the present application also provides a computer-readable medium, which may be included in the electronic device described in the above embodiment; or may exist independently without being assembled into the electronic device. The above computer-readable medium carries one or more programs, and when the above one or more programs are executed by an electronic device, the electronic device implements the method described in the above embodiment.

[0133] It should be noted that, although several modules or units of the equipment for action execution are mentioned in the above detailed description, this division is not mandatory. In fact, according to the embodiments of the present application, the features and functions of two or more modules or units described above can be embodied in one module or unit. On the contrary, the features and functions of one module or unit described above can be further divided into being embodied by multiple modules or units.

[0134] Through the description of the above implementation methods, it is easy for those skilled in the art to understand that the example implementation methods described here can be implemented by software or by combining software with necessary hardware. Therefore, the technical solution according to the implementation methods of the present application can be embodied in the form of a software product, which can be stored in a non-volatile storage medium (which can be a CD-ROM, a USB flash drive, a mobile hard disk, etc.) or on a network, and includes several instructions to enable a computing device (which can be a personal computer, a server, a touch terminal, or a network device, etc.) to execute the method according to the implementation methods of the present application.

[0135] Those skilled in the art will readily appreciate other embodiments of the present application after considering the specification and practicing the embodiments disclosed herein. The present application is intended to cover any variations, uses or adaptations of the present application, which follow the general principles of the present application and include common knowledge or customary technical means in the art that are not disclosed in the present application.

[0136] It should be understood that the present application is not limited to the precise structures that have been described above and shown in the drawings, and that various modifications and changes may be made without departing from the scope thereof. The scope of the present application is limited only by the appended claims.

Claims

1. A page code generation method, characterized in that: The method comprises: Obtaining a page design draft, wherein the page design draft includes a component area; Extracting feature information of a target component in the component area, wherein the feature information is used to characterize a property of the target component, and the feature information includes text and a position of the text; Based on the feature information, scoring the target component in the component area by a preset model trained by a training set to obtain a trust score of the target component in each component type, wherein the trust score is used to characterize the degree of trust of the target component as a corresponding component type, and the training set includes component types and content and location of text; When the trust score reaches a first threshold, determining the component type corresponding to the trust score in the component library as the component type to be verified of the target component; Determine the degree of consistency between the text in the target component and the text library corresponding to the type of component to be verified; When the degree of fit reaches a second threshold, determining the component type to be verified as the target component type to which the target component belongs in a component library, wherein the component library includes at least one code block, wherein one code block is associated with one component type; The target code block associated with the target component type is called to integrate the target code block to obtain the page code of the page design draft.

2. The method according to claim 1, characterized in that: The extracting feature information of the target component in the component area includes: Scanning the page design draft to obtain at least one component area in the page design draft; The characteristic information of the target components in each component area is extracted respectively.

3. The method according to claim 1, characterized in that The feature information includes at least two, and based on the feature information, scoring the target component in the component area by a preset model trained by a training set to obtain a trust score of the target component in each component type includes: Based on each piece of feature information, the target component in the component area is scored by a preset model to obtain a sub-trust score of the target component in each component type; For each component type, the sub-trust scores of the target component based on each feature information are weighted and evaluated according to preset weights to obtain the trust score of the target component on each component type.

4. The method according to claim 1, characterized in that: The method further comprises: When the trust score does not reach the first threshold, or when the trust score reaches the first threshold and the degree of fit does not reach the second threshold, determining that the component type to which the target component belongs does not exist in the component library; The component type to which the target component belongs is written into the component library.

5. The method according to claim 4, characterized in that After writing the component type to which the target component belongs into the component library, the method further includes: Based on the characteristic information of the target component and the component type to which the target component belongs, training the preset model to update the preset model; A code block corresponding to the component type to which the target component belongs is obtained, and the code block is associated with the component type to which the target component belongs.

6. A page code generating device, characterized in that: The device comprises: An acquisition unit is used to acquire a page design draft, wherein the page design draft includes a component area; An extraction unit, used to extract feature information of a target component in the component area, wherein the feature information is used to characterize a property of the target component, and the feature information includes text and a position of the text; A determination unit is used to score the target component in the component area based on the feature information by using a preset model trained by a training set to obtain a trust score of the target component in each component type, wherein the trust score is used to characterize the degree of trust of the target component as a corresponding component type, and the training set includes component types and content and position of texts; when the trust score reaches a first threshold, the component type corresponding to the trust score is determined as the component type to be verified of the target component in the component library; the degree of fit between the text in the target component and the text library corresponding to the component type to be verified is determined; when the degree of fit reaches a second threshold, the component type to be verified is determined as the target component type to which the target component belongs in the component library, and the component library includes at least one code block, wherein one code block is associated with one component type; The calling unit is used to call the target code block associated with the target component type to integrate the target code block to obtain the page code of the page design draft.

7. A computer readable medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the page code generation method according to any one of claims 1 to 5 is implemented.

8. An electronic device, characterized in that: include: one or more processors; A storage device, used for storing one or more programs, when the one or more programs are executed by the one or more processors, enables the one or more processors to implement the page code generation method according to any one of claims 1 to 5.

9. A computer program product, characterized in that The computer program product includes computer instructions, which are stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, so that the computer device executes the page code generation method according to any one of claims 1 to 5.

Citation Information

Patent Citations

  • Website type detection method and apparatus

    CN104978423A

  • Code generation method of application page and related equipment

    CN111324352A