CN113515280A - Page code generation method and device - Google Patents

Page code generation method and device Download PDF

Info

Publication number
CN113515280A
CN113515280A CN202011415178.4A CN202011415178A CN113515280A CN 113515280 A CN113515280 A CN 113515280A CN 202011415178 A CN202011415178 A CN 202011415178A CN 113515280 A CN113515280 A CN 113515280A
Authority
CN
China
Prior art keywords
component
target
type
target component
page
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202011415178.4A
Other languages
Chinese (zh)
Inventor
罗宇舟
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Tencent Technology Shenzhen Co Ltd
Original Assignee
Tencent Technology Shenzhen Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Tencent Technology Shenzhen Co Ltd filed Critical Tencent Technology Shenzhen Co Ltd
Priority to CN202011415178.4A priority Critical patent/CN113515280A/en
Publication of CN113515280A publication Critical patent/CN113515280A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/30Creation or generation of source code
    • G06F8/38Creation or generation of source code for implementing user interfaces
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/30Creation or generation of source code
    • G06F8/33Intelligent editors
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N20/00Machine learning

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • General Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Human Computer Interaction (AREA)
  • Artificial Intelligence (AREA)
  • Computer Vision & Pattern Recognition (AREA)
  • Data Mining & Analysis (AREA)
  • Evolutionary Computation (AREA)
  • Medical Informatics (AREA)
  • Computing Systems (AREA)
  • Mathematical Physics (AREA)
  • Stored Programmes (AREA)

Abstract

The embodiment of the application provides a page code generation method and device. The method comprises the following steps: acquiring a page design draft, wherein the page design draft comprises a component area; extracting feature information of a target component in the component area, wherein the feature information is used for representing the attribute of the target component; determining the type of the target component to which the target component belongs in a component library based on the characteristic information; and 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. According to the technical scheme of the embodiment of the application, the dependence on design draft standardization during automatic generation of the page codes can be reduced, and therefore the generation efficiency of the page codes is improved.

Description

Page code generation method and device
Technical Field
The application relates to the technical field of artificial intelligence and computers, in particular to a method and a device for generating a page code.
Background
In the page code generation scenario, in the prior art, a page design structure is generally analyzed and then directly converted into a UI code, or a DSL domain specific language is used to perform conversion from a customized page design structure to a code, in this process, component differentiation can be performed for the structure and the identifier of the page design, and then a developed component is directly rendered. However, the method has strong dependence on design draft standardization, and therefore page code generation efficiency is not high. Therefore, how to reduce the dependence on design draft standardization when automatically generating page codes is an urgent technical problem to be solved.
Disclosure of Invention
Embodiments of the present application provide a page code generation method, an apparatus, a computer program product or a computer program, a computer readable medium, and an electronic device, so that at least to a certain extent, a dependency on design draft standardization in automatically generating a page code may be reduced, and generation efficiency of the page code may be improved.
Other features and advantages of the present application will be apparent from the following detailed description, or may be learned by practice of the application.
According to an aspect of an embodiment of the present application, there is provided a page code generating method, including: acquiring a page design draft, wherein the page design draft comprises a component area; extracting feature information of a target component in the component area, wherein the feature information is used for representing the attribute of the target component; determining the type of the target component to which the target component belongs in a component library based on the characteristic information; and 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.
According to an aspect of an embodiment of the present application, there is provided a page code generating apparatus, including: the device comprises a first acquisition unit, a second acquisition unit and a third acquisition unit, wherein the first acquisition unit is used for acquiring a page design draft which comprises a component area; an extracting unit, configured to extract feature information of a target component in the component region, where the feature information is used to characterize an attribute of the target component; a first determination unit, configured to determine, based on the feature information, a target component type to which the target component belongs in a component library; and the calling unit is used for calling the target code block associated with the target component type so as to integrate the target code block and obtain the page code of the page design draft.
In some embodiments of the present application, based on the foregoing solution, the extracting unit is configured to: scanning the page design draft to obtain at least one component area in the page design draft; and respectively extracting the characteristic information of the target assembly in each assembly area.
In some embodiments of the present application, based on the foregoing scheme, the component library includes at least one code block, where one code block is associated with one component type.
In some embodiments of the present application, based on the foregoing scheme, the first determining unit is configured to: based on the characteristic information, scoring a target assembly in the assembly area through a preset model to obtain trust scores of the target assembly on each assembly type, wherein the trust scores are used for representing the trust degree of the target assembly as the corresponding assembly type; and determining the target component type of the target component in the component library according to the trust scores of the target component on each component type.
In some embodiments of the present application, based on the foregoing scheme, the feature information includes at least two, and the first determining unit is configured to: respectively scoring the target assembly in the assembly area through a preset model based on each piece of characteristic information to obtain sub-trust scores of the target assembly on each assembly type; and for each component type, carrying out weighted evaluation on the sub-trust scores of the target component based on the characteristic information according to preset weight to obtain the trust scores of the target component on the component types.
In some embodiments of the present application, based on the foregoing scheme, the feature information includes at least two of text feature information, position feature information, and icon feature information.
In some embodiments of the present application, based on the foregoing scheme, the first determining unit is configured to: when the trust score reaches a first threshold value, determining a component type corresponding to the trust score as a component type to be verified of the target component in a component library; determining the matching degree between the characters in the target assembly and the character library corresponding to the type of the assembly to be verified; and when the goodness of fit reaches a second threshold value, determining the type of the component to be verified as the target component type to which the target component belongs in the component library.
In some embodiments of the present application, based on the foregoing solution, the apparatus further includes a second determining unit, configured 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 agreement does not reach the second threshold; and the writing unit is used for writing the component type of the target component into the component library.
In some embodiments of the present application, based on the foregoing scheme, the apparatus further includes a training unit, configured 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 obtaining unit, configured 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.
According to an aspect of embodiments herein, there is provided a computer program product or computer program comprising computer instructions stored in a computer readable storage medium. The processor of the 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 described in the above embodiments.
According to an aspect of the embodiments of the present application, there is provided a computer readable medium on which a computer program is stored, the computer program, when executed by a processor, implementing the page code generating method as described in the above embodiments.
According to an aspect of an embodiment of the present application, there is provided an electronic device including: one or more processors; a storage device for storing one or more programs which, when executed by the one or more processors, cause the one or more processors to implement the page code generation method as described in the above embodiments.
In the technical solutions provided by some embodiments of the present application, feature information used for characterizing attributes of the target component in a component area in a page design draft is extracted, a target component type to which the target component belongs in a component library is determined according to the feature information, a target code block associated with the target component type is further called, and a page code of the page design draft is obtained by integrating the target code block. According to the scheme, in the process of generating the page codes according to the page design draft, the intelligent identification and distinguishing of the component types can be carried out according to the characteristic information of the components in the design draft, so that the dependence on design draft standardization in the process of automatically generating the page codes can be eliminated or lightened, the codes can be generated based on the design drafts under different design standards more widely, and the generation efficiency of the page codes is improved.
It is to be understood that both the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the application.
Drawings
The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present application and together with the description, serve to explain the principles of the application. It is obvious that the drawings in the following description are only some embodiments of the application, and that for a person skilled in the art, other drawings can be derived from them without inventive effort. In the drawings:
FIG. 1 shows a schematic diagram of an exemplary system architecture to which aspects of embodiments of the present application may be applied;
FIG. 2 illustrates a scene diagram of an application page code generation method according to one embodiment of the present application;
FIG. 3 shows a flow diagram of a page code generation method according to one embodiment of the present application;
FIG. 4 illustrates a detailed flow diagram for extracting feature information of a target component in a component region according to one embodiment of the present application;
FIG. 5 illustrates a detailed flow diagram for determining a target component type to which a target component belongs in a component library according to one embodiment of the present application;
FIG. 6 illustrates a detailed flow diagram for determining trust scores for target components on various component types via a pre-set model according to one embodiment of the present application;
FIG. 7 illustrates a detailed flow diagram for determining a target component type to which a target component belongs in a component library according to one embodiment of the present application;
FIG. 8 illustrates a detailed flow diagram for determining a target component type to which a target component belongs in a component library according to one embodiment of the present application;
FIG. 9 illustrates a flowchart of a method after writing a component type to which a target component belongs to the component library, according to one embodiment of the present application;
FIG. 10 illustrates a partial flow diagram of a method of page code generation according to one embodiment of the present application;
FIG. 11 shows a block diagram of a page code generation apparatus according to an embodiment of the present application;
FIG. 12 illustrates a schematic structural diagram of a computer system suitable for use in implementing the electronic device of an embodiment of the present application.
Detailed Description
Example embodiments will now be described more fully with reference to the accompanying drawings. Example embodiments may, however, be embodied in many different forms and should not be construed as limited to the examples set forth herein; rather, these embodiments are provided so that this disclosure will be thorough and complete, and will fully convey the concept of example embodiments to those skilled in the art.
Furthermore, the described features, structures, or characteristics may be combined in any suitable manner in one or more embodiments. In the following description, numerous specific details are provided to give a thorough understanding of embodiments of the application. One skilled in the relevant art will recognize, however, that the subject matter of the present application can be practiced without one or more of the specific details, or with other methods, components, devices, steps, and so forth. In other instances, well-known methods, devices, implementations, or operations have not been shown or described in detail to avoid obscuring aspects of the application.
The block diagrams shown in the figures are functional entities only and do not necessarily correspond to physically separate entities. I.e. these functional entities may be implemented in the form of software, or in one or more hardware modules or integrated circuits, or in different networks and/or processor means and/or microcontroller means.
The flow charts shown in the drawings are merely illustrative and do not necessarily include all of the contents and operations/steps, nor do they necessarily have to be performed in the order described. For example, some operations/steps may be decomposed, and some operations/steps may be combined or partially combined, so that the actual execution sequence may be changed according to the actual situation.
Fig. 1 shows a schematic diagram of an exemplary system architecture to which the technical solution of the embodiments of the present application can be applied.
As shown in fig. 1, the system architecture may include a terminal device (e.g., one or more of a smartphone 101, a tablet computer 102, and a portable computer 103 shown in fig. 1, but may also be a desktop computer, etc.), a network 104, and a server 105. The network 104 serves as a medium for providing communication links between terminal devices and the server 105. Network 104 may include various connection types, such as wired communication links, wireless communication links, and so forth.
It should be understood that the number of terminal devices, networks, and servers in fig. 1 is merely illustrative. There may be any number of terminal devices, networks, and servers, as desired for implementation. For example, server 105 may be a server cluster comprised of multiple servers, or the like.
In an embodiment of the application, a user may upload a page design draft to the server 105 by using a terminal device, and request to generate a page code, where the page design draft includes a component area, the server 105 extracts feature information used for characterizing attributes of a target component in the component area after acquiring the page design draft, determines a target component type of the target component in a component library based on the feature information, and finally calls a target code block associated with the target component type to integrate the target code block, so as to obtain the page code of the page design draft.
In the process of generating the page code according to the page design draft, the server 105 intelligently identifies and distinguishes the component types based on the feature information of the components in the design draft, so that the dependence on design draft standardization in the process of automatically generating the page code can be removed or lightened, and the generation efficiency of the page code is improved.
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 apparatus is generally disposed in the server 105. However, in other embodiments of the present application, the terminal device may also have a similar function as the server, so as to execute the page code generation scheme provided in the embodiments of the present application.
FIG. 2 shows a scene diagram of an application page code generation method according to an embodiment of the present application.
As shown in fig. 2, after acquiring a page design draft 201, an electronic device obtains a page code 202 by executing a page code generation method provided by the present application.
It should be noted that the page design draft refers to a front end of a web page or a mobile phone page, that is, an interface style and a visual presentation of the page, the page design draft includes page elements, and in actual use, a user operates the page elements in the page design draft to implement operation on a computer. In order to implement the function of the page elements in the page design draft, a webpage code corresponding to the page design draft needs to be generated to support the function of the page elements in the page design draft.
The implementation details of the technical solution of the embodiment of the present application are set forth in detail below:
fig. 3 shows a flowchart of a page code generation method according to an embodiment of the present application, which may be performed by a device having a computing processing function, such as the server 105 shown in fig. 1. Referring to fig. 3, the page code generation method at least includes steps 310 to 370, which are described in detail as follows:
in step 310, a page design is obtained, wherein the page design includes a component area.
It should be understood that the page design refers to visual design data and its carrier having a data structure to describe the design elements.
In the application, a page design draft is designed by a page designer before page codes are generated, corresponding component areas are divided at corresponding positions of the page design draft according to actual needs, the component areas comprise components, wherein at least one component area is arranged in one page design draft, and one component area corresponds to one component.
It should also be understood that a component refers to an abstract concept with certain UI and business interaction logic, which is specific to the field of front-end development, and has text content and image content that can be visually seen in an intuitive visual effect.
With continued reference to fig. 3, in step 330, feature information of the target component in the component region is extracted, the feature information being used to characterize the properties of the target component.
In the present application, the characteristic information may include at least two.
Specifically, the feature information may include at least two of text feature information, position feature information, and icon feature information.
The text feature information may refer to specific text, such as text contents of "confirm", "search", "next page", and the like. The position characteristic information may refer to a position or orientation of the component in the page design, such as coordinates of the component in the page design, and so on. The icon characteristic information may refer to a specific image or symbol, such as a specific picture, an arrow symbol, and the like.
In one embodiment of the present application, extracting feature information of a target component in a component region may be performed according to the steps shown in fig. 4.
Referring to FIG. 4, a detailed flow diagram for extracting feature information of a target component in a component region according to one embodiment of the present application is shown. Specifically, the method comprises steps 331 to 332:
in step 331, the page design is scanned to obtain at least one component area in the page design.
In step 332, feature information of the target component in each component region is extracted, respectively.
In the application, in the process of scanning the page design, at least one component area in the page design may be obtained through an image recognition technology. In addition, the feature information of the target component in each component area may be obtained by obtaining corresponding vector features through the component position, files in the component, icons and the like.
With continued reference to FIG. 3, in step 350, a target component type to which the target component belongs in the component library is determined based on the characteristic information.
In this application, a component library may refer to a collection of components, and specifically, a component in the component library may have a classification label, and the classification label may be used to identify a component type of the component.
In an embodiment of the present application, the component library may further include at least one code block, where one code block is associated with one component type.
It should be noted that, in practical applications, the code blocks may implement component functions of component types corresponding to the code blocks when executed, for example, when "next page" is clicked in a page, the display screen may be caused to jump from the current page to another page by executing corresponding code in the code blocks corresponding to the code blocks.
In one embodiment of the present application, determining the target component type to which the target component belongs in the component library based on the feature information may be performed according to the steps shown in fig. 5.
Referring to FIG. 5, a detailed flow diagram for determining a target component type to which a target component belongs in a component library according to one embodiment of the present application is shown. Specifically, the method includes steps 351 to 352:
in step 351, based on the feature information, scoring is performed on the target component in the component region through a preset model, so as to obtain a trust score of the target component on each component type, wherein the trust score is used for representing the trust degree of the target component as the corresponding component type.
In the present application, the preset model may be a machine learning model trained in advance, or may be a controllable identification program developed and trained manually and based on data and experience.
In order to better understand the training process of the preset model, the following will be explained with reference to a machine learning model:
in the present application, a machine learning model may be trained by developing, as a training set, "component of a determinable type" corresponding to "feature information in a design draft" accumulated in a design process, so that the model can score candidate component types according to input feature information (e.g., text feature information and position feature information of a component).
For example, for a component showing a rank, it usually presents a certain character with [ xx name ], [ xx position ] etc. in a specific position in the page design draft, and a model is obtained after training through "[ component type, content and position of character ]" included in the training set, which will function as a classification component in the next recognition process, i.e. the "rank component" can be scored based on the input character characteristic information and position characteristic information, so as to obtain a higher score.
In the recognition process, for example, the characters in the page design draft are extracted, the position information of the characters is recorded, the characters are recorded in the form of vector features, and the vector features are transmitted to a preset model as input to be scored and recognized.
Specifically, in a specific implementation of step 351, based on the feature information, a target component in the component region is scored through a preset model to obtain a trust score of the target component on each component type, which may be performed according to the steps shown in fig. 6.
Referring to FIG. 6, a detailed flow diagram of determining trust scores for target components on various component types through a pre-set model according to one embodiment of the present application is shown. Specifically, the method comprises steps 3511 to 3512:
in step 3511, based on each piece of feature information, scoring is performed on the target component in the component region through a preset model, so that a sub-trust score of the target component on each component type is obtained.
In step 3512, for each component type, performing weighted evaluation on the sub-trust scores of the target component based on the feature information according to preset weights, so as to obtain the trust scores of the target component on the component types.
In order to better understand the steps shown in fig. 6, the following will be explained with reference to the examples in table 1:
X "ranking Components" type Type of "screening assemblies
Character feature information x1(0.7) 8 is divided into 3 points of
Position feature information x2(0.3) 7 points of 1 minute (1)
Trust scoring 7.7 points 2.4 points
TABLE 1
Referring to table 1, for a target component X, it corresponds to a text feature information X1And position feature information x2Wherein, based on the character characteristic information x1And scoring the target component X through a preset model to obtain a first sub-trust score of the target component X on each component type (for example, 8 scores of the first sub-trust score on the ranking component type and 3 scores of the first sub-trust score on the screening component type). Based on location feature information x2And scoring the target component X through a preset model to obtain a second sub-trust score of the target component X on each component type (for example, 7 scores of the first sub-trust score on the ranking component type and 1 score of the first sub-trust score on the screening component type).
Further, in the above example, the character feature information x is specified1Is 0.7, for the position feature information x1Is 0.3, based on which the trust score of the target component X on the "rank component" type is: 0.7 × 8+0.3 × 7 ═ 7.7, the trust score on the "filter assembly" type was: 0.7 × 3+0.3 × 1 ═ 2.4.
With continued reference to fig. 5, in step 352, the target component type to which the target component belongs in the component library is determined according to the trust score of the target component on each component type.
In the application, the preset model is scored according to the matching degree of the character feature matching degree and the relative position, and when the score reaches the standard and matches with the character feature of a certain component, the model can identify the component as the certain component.
In one specific implementation of step 352, determining the target component type of the target component in the component library according to the trust score of the target component on each component type may be performed according to the steps shown in fig. 7.
Referring to FIG. 7, a detailed flow diagram for determining a target component type to which a target component belongs in a component library according to one embodiment of the present application is shown. Specifically, the method comprises steps 3521 to 3523:
in step 3521, when the trust score reaches a first threshold, determining a component type corresponding to the trust score as a to-be-verified component type of the target component in a component library.
Specifically, for example, the first threshold is set to 7 points, and when the trust score of the "ranking component" type is 7.7 points, it indicates that the "ranking component" type is the to-be-verified component type of the target component.
In step 3522, the matching degree between the characters in the target component and the character library corresponding to the type of the component to be verified is determined.
In step 3523, when the goodness of fit reaches a second threshold, the component type to be verified is determined as a target component type to which the target component belongs in a component library.
In the present application, there may be a text library corresponding to each component type, wherein the text library may include text closely related to the corresponding component type.
As described above, the target component also includes the characters, and the matching degree between the characters in the target component and the character library corresponding to the type of the component to be verified may be the number of overlapping of the characters in the target component and the characters in the corresponding character library, or may be the overlapping proportion.
When the goodness of fit reaches a second threshold value, the type of the component to be verified is determined as the type of the target component to which the target component belongs in the component library.
In the present application, determining the target component type of the target component in the component library according to the trust score of the target component on each component type may also be performed according to the steps shown in fig. 8.
Referring to FIG. 8, a detailed flow diagram for determining a target component type to which a target component belongs in a component library according to one embodiment of the present application is shown. Specifically, the method comprises steps 3524 to 3525:
in step 3524, it is determined 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 matching degree does not reach the second threshold.
In step 3525, the component type to which the target component belongs is written into the component library.
In the application, when the component library does not have the component type to which the target component belongs, the component type to which the target component belongs is written into the component library, so that the component type in the whole component library can be perfected, and the situation that the component type to which the target component belongs does not exist in the component library in the subsequent component type identification process can be avoided to a certain extent.
In one embodiment of the present application, after writing the component type to which the target component belongs into the component library, the steps shown in fig. 9 may also be performed.
Referring to FIG. 9, a flowchart of a method after writing a component type to which a target component belongs in the component library is shown, according to one embodiment of the present application. Specifically, the method comprises steps 3526 to 3527:
in step 3526, the preset model is trained to update the preset model based on the feature information of the target component and the component type to which the target component belongs.
In step 3527, a code block corresponding to the component type to which the target component belongs is obtained and associated with the component type to which the target component belongs.
In the 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, so that the component recognition function of the preset model can be enhanced, and the accuracy of recognizing the component type by the preset model is improved.
In this application, associating the code block with the component type to which the target component belongs may be writing the code into the component library.
With continued reference to fig. 3, in step 370, a 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.
In the application, at least one target code block is spliced and encapsulated by calling the target code block associated with the target component type, so that the page code of the page design draft is obtained.
Therefore, through the page code generation scheme provided by the application, the requirement on the specification of the page design draft can be reduced or removed, the reliability of the recognition and classification component is improved, and the automatic process of enabling the page design draft to reach the code can be realized in the development joint debugging process.
In order to make the present application better understood, the following will make reference to fig. 10 to set forth the component type identification part of the page code generation scheme proposed in the present application in its entirety:
referring to FIG. 10, a partial flow diagram of a page code generation method according to one embodiment of the present application is shown.
As shown in fig. 10, firstly, a component region is divided for a page design draft, a plurality of target components are obtained from the component region, then feature information in the plurality of target components is extracted respectively, component types of the plurality of target components are identified by a preset model trained by a training set based on the feature information, whether the target components are components in a component library is judged, and finally, when the target components are not in-library components, the target components are marked as non-in-library components, and when the target components are in-library components, the target components are marked as in-library components.
In the technical solutions provided by some embodiments of the present application, feature information used for characterizing attributes of the target component in a component area in a page design draft is extracted, a target component type to which the target component belongs in a component library is determined according to the feature information, a target code block associated with the target component type is further called, and a page code of the page design draft is obtained by integrating the target code block. According to the scheme, in the process of generating the page codes according to the page design draft, the intelligent identification and distinguishing of the component types can be carried out according to the characteristic information of the components in the design draft, so that the dependence on design draft standardization in the process of automatically generating the page codes can be eliminated or lightened, the codes can be generated based on the design drafts under different design standards more widely, and the generation efficiency of the page codes is improved.
The following describes embodiments of an apparatus of the present application, which may be used to execute a page code generation method in the foregoing embodiments of the present application. For details that are not disclosed in the embodiments of the apparatus of the present application, please refer to the embodiments of the page code generating method described above in the present application.
FIG. 11 shows a block diagram of a page code generation apparatus according to an embodiment of the present application.
Referring to fig. 11, a page code generation apparatus 1100 according to an embodiment of the present application includes: a first acquisition unit 1101, an extraction unit 1102, a first determination unit 1103, and a call unit 1104.
The first acquiring unit 1101 is configured to acquire a page design draft, where the page design draft includes a component area; an extracting unit 1102, configured to extract feature information of a target component in the component region, where the feature information is used to characterize an attribute of the target component; a first determining unit 1103, configured to determine, based on the feature information, a target component type to which the target component belongs in a component library; and the calling unit 1104 is used for calling the target code blocks associated with the target component types to integrate the target code blocks to obtain the page codes of the page design draft.
In some embodiments of the present application, based on the foregoing scheme, the extracting unit 1102 is configured to: scanning the page design draft to obtain at least one component area in the page design draft; and respectively extracting the characteristic information of the target assembly in each assembly area.
In some embodiments of the present application, based on the foregoing scheme, the component library includes at least one code block, where one code block is associated with one component type.
In some embodiments of the present application, based on the foregoing scheme, the first determining unit 1103 is configured to: based on the characteristic information, scoring a target assembly in the assembly area through a preset model to obtain trust scores of the target assembly on each assembly type, wherein the trust scores are used for representing the trust degree of the target assembly as the corresponding assembly type; and determining the target component type of the target component in the component library according to the trust scores of the target component on each component type.
In some embodiments of the present application, based on the foregoing scheme, the feature information includes at least two, and the first determining unit 1103 is configured to: respectively scoring the target assembly in the assembly area through a preset model based on each piece of characteristic information to obtain sub-trust scores of the target assembly on each assembly type; and for each component type, carrying out weighted evaluation on the sub-trust scores of the target component based on the characteristic information according to preset weight to obtain the trust scores of the target component on the component types.
In some embodiments of the present application, based on the foregoing scheme, the feature information includes at least two of text feature information, position feature information, and icon feature information.
In some embodiments of the present application, based on the foregoing scheme, the first determining unit 1103 is configured to: when the trust score reaches a first threshold value, determining a component type corresponding to the trust score as a component type to be verified of the target component in a component library; determining the matching degree between the characters in the target assembly and the character library corresponding to the type of the assembly to be verified; and when the goodness of fit reaches a second threshold value, determining the type of the component to be verified as the target component type to which the target component belongs in the component library.
In some embodiments of the present application, based on the foregoing solution, the apparatus further includes a second determining unit, configured 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 agreement does not reach the second threshold; and the writing unit is used for writing the component type of the target component into the component library.
In some embodiments of the present application, based on the foregoing scheme, the apparatus further includes a training unit, configured 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 obtaining unit, configured 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.
FIG. 12 illustrates a schematic structural diagram of a computer system suitable for use in implementing the electronic device of an embodiment of the present application.
It should be noted that the computer system 1200 of the electronic device shown in fig. 12 is only an example, and should not bring any limitation to the functions and the scope of use of the embodiments of the present application.
As shown in fig. 12, the computer system 1200 includes a Central Processing Unit (CPU)1201, which can perform various appropriate actions and processes, such as performing the methods described in the above embodiments, according to a program stored in a Read-Only Memory (ROM) 1202 or a program loaded from a storage section 1208 into a Random Access Memory (RAM) 1203. In the RAM 1203, various programs and data necessary for system operation are also stored. The CPU 1201, ROM 1202, and RAM 1203 are connected to each other by a bus 1204. An Input/Output (I/O) interface 1205 is also connected to bus 1204.
The following components are connected to the I/O interface 1205: an input section 1206 including a keyboard, a mouse, and the like; an output section 1207 including a Display device such as a Cathode Ray Tube (CRT), a Liquid Crystal Display (LCD), and a speaker; a storage section 1208 including a hard disk and the like; and a communication section 1209 including a Network interface card such as a LAN (Local Area Network) card, a modem, or the like. The communication section 1209 performs communication processing via a network such as the internet. A driver 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, or the like, is mounted on the drive 1210 as necessary, so that a computer program read out therefrom is mounted into the storage section 1208 as necessary.
In particular, according to embodiments of the application, the processes described above with reference to the flow diagrams may be implemented as computer software programs. For example, embodiments of the present application include a computer program product comprising a computer program embodied on a computer readable medium, the computer program comprising program code for performing the method illustrated by the flow chart. In such an embodiment, the computer program may be downloaded and installed from a network through the communication section 1209, and/or installed from the removable medium 1211. The computer program executes various functions defined in the system of the present application when executed by a Central Processing Unit (CPU) 1201.
It should be noted that the computer readable medium shown in the embodiments of the present application may be a computer readable signal medium or a computer readable storage medium or any combination of the two. A computer readable storage medium may be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination of the foregoing. More specific examples of the computer readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a Read-Only Memory (ROM), an Erasable Programmable Read-Only Memory (EPROM), a flash Memory, an optical fiber, a portable Compact Disc Read-Only Memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing. In the present application, a computer readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device. In this application, however, a computer readable signal medium may include a propagated data signal with computer readable program code embodied therein, for example, in baseband or as part of a carrier wave. Such a propagated data signal may take many forms, including, but not limited to, electro-magnetic, optical, or any suitable combination thereof. A computer readable signal medium may also be any computer readable medium that is not a computer readable storage medium and that can communicate, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device. Program code embodied on a computer readable medium may be transmitted using any appropriate medium, including but not limited to: wireless, wired, etc., or any suitable combination of the foregoing.
The flowchart and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of systems, methods and computer program products according to various embodiments of the present application. Each block in the flowchart or block diagrams may represent a module, segment, or portion of code, which comprises one or more executable instructions for implementing the specified logical function(s). It should also be noted that, in some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams or flowchart illustration, and combinations of blocks in the block diagrams or flowchart illustration, can be implemented by special purpose hardware-based systems which perform the specified functions or acts, or combinations of special purpose hardware and computer instructions.
The units described in the embodiments of the present application may be implemented by software, or may be implemented by hardware, and the described units may also be disposed in a processor. Wherein the names of the elements do not in some way constitute a limitation on the elements themselves.
As another aspect, the present application also provides a computer program product or computer program comprising computer instructions stored in a computer readable storage medium. The processor of the 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 described in the above embodiments.
As another aspect, the present application also provides a computer-readable medium, which may be contained in the electronic device described in the above embodiments; or may exist separately without being assembled into the electronic device. The computer readable medium carries one or more programs which, when executed by an electronic device, cause the electronic device to implement the method described in the above embodiments.
It should be noted that although in the above detailed description several modules or units of the device for action execution are mentioned, such a division is not mandatory. Indeed, the features and functionality of two or more modules or units described above may be embodied in one module or unit, according to embodiments of the application. Conversely, the features and functions of one module or unit described above may be further divided into embodiments by a plurality of modules or units.
Through the above description of the embodiments, those skilled in the art will readily understand that the exemplary embodiments described herein may be implemented by software, or by software in combination with necessary hardware. Therefore, the technical solution according to the embodiments 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 disk, a removable 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 embodiments of the present application.
Other embodiments of the present application will be apparent to those skilled in the art from consideration of the specification and practice of the embodiments disclosed herein. This application is intended to cover any variations, uses, or adaptations of the invention following, in general, the principles of the application and including such departures from the present disclosure as come within known or customary practice within the art to which the invention pertains.
It will be understood that the present application is not limited to the precise arrangements 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 application is limited only by the appended claims.

Claims (10)

1. A method for generating page codes, the method comprising:
acquiring a page design draft, wherein the page design draft comprises a component area;
extracting feature information of a target component in the component area, wherein the feature information is used for representing the attribute of the target component;
determining the type of the target component to which the target component belongs in a component library based on the characteristic information;
and 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.
2. The method of claim 1, wherein the extracting feature information of the target component in the component region comprises:
scanning the page design draft to obtain at least one component area in the page design draft;
and respectively extracting the characteristic information of the target assembly in each assembly area.
3. The method of claim 1, wherein the component library comprises at least one code block, and wherein one code block is associated with one component type.
4. The method of claim 1, wherein determining the target component type to which the target component belongs in the component library based on the characteristic information comprises:
based on the characteristic information, scoring a target assembly in the assembly area through a preset model to obtain trust scores of the target assembly on each assembly type, wherein the trust scores are used for representing the trust degree of the target assembly as the corresponding assembly type;
and determining the target component type of the target component in the component library according to the trust scores of the target component on each component type.
5. The method according to claim 4, wherein the feature information includes at least two, and the scoring a target component in the component region through a preset model based on the feature information to obtain a trust score of the target component on each component type includes:
respectively scoring the target assembly in the assembly area through a preset model based on each piece of characteristic information to obtain sub-trust scores of the target assembly on each assembly type;
and for each component type, carrying out weighted evaluation on the sub-trust scores of the target component based on the characteristic information according to preset weight to obtain the trust scores of the target component on the component types.
6. The method of claim 5, wherein the feature information comprises at least two of text feature information, position feature information, and icon feature information.
7. The method of claim 4, wherein the determining the target component type to which the target component belongs in the component library according to the trust score of the target component on each component type comprises:
when the trust score reaches a first threshold value, determining a component type corresponding to the trust score as a component type to be verified of the target component in a component library;
determining the matching degree between the characters in the target assembly and the character library corresponding to the type of the assembly to be verified;
and when the goodness of fit reaches a second threshold value, determining the type of the component to be verified as the target component type to which the target component belongs in the component library.
8. The method of claim 7, further comprising:
when the trust score does not reach the first threshold value, or when the trust score reaches the first threshold value and the goodness of fit does not reach the second threshold value, determining that the component type to which the target component belongs does not exist in the component library;
and writing the component type to which the target component belongs into the component library.
9. The method of claim 8, wherein after writing the component type to which the target component belongs in the component library, the method further comprises:
training the preset model based on the feature information of the target component and the component type of the target component to update the preset model;
and acquiring a code block corresponding to the component type to which the target component belongs, and associating the code block with the component type to which the target component belongs.
10. An apparatus for generating a page code, the apparatus comprising:
the system comprises an acquisition unit, a processing unit and a display unit, wherein the acquisition unit is used for acquiring a page design draft which comprises a component area;
an extracting unit, configured to extract feature information of a target component in the component region, where the feature information is used to characterize an attribute of the target component;
a determining unit, configured to determine, based on the feature information, a target component type to which the target component belongs in a component library;
and the calling unit is used for calling the target code block associated with the target component type so as to integrate the target code block and obtain the page code of the page design draft.
CN202011415178.4A 2020-12-03 2020-12-03 Page code generation method and device Pending CN113515280A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202011415178.4A CN113515280A (en) 2020-12-03 2020-12-03 Page code generation method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202011415178.4A CN113515280A (en) 2020-12-03 2020-12-03 Page code generation method and device

Publications (1)

Publication Number Publication Date
CN113515280A true CN113515280A (en) 2021-10-19

Family

ID=78060898

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202011415178.4A Pending CN113515280A (en) 2020-12-03 2020-12-03 Page code generation method and device

Country Status (1)

Country Link
CN (1) CN113515280A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114237600A (en) * 2021-12-20 2022-03-25 北京字节跳动网络技术有限公司 Code generation method, device and equipment of front-end page and storage medium

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114237600A (en) * 2021-12-20 2022-03-25 北京字节跳动网络技术有限公司 Code generation method, device and equipment of front-end page and storage medium
CN114237600B (en) * 2021-12-20 2023-08-11 抖音视界有限公司 Method, device, equipment and storage medium for generating code of front page

Similar Documents

Publication Publication Date Title
CN110287479B (en) Named entity recognition method, electronic device and storage medium
US20200004815A1 (en) Text entity detection and recognition from images
CN109828906B (en) UI (user interface) automatic testing method and device, electronic equipment and storage medium
CN107436916B (en) Intelligent answer prompting method and device
CN114610845B (en) Intelligent question-answering method, device and equipment based on multiple systems
CN113382279A (en) Live broadcast recommendation method, device, equipment, storage medium and computer program product
CN116501960B (en) Content retrieval method, device, equipment and medium
CN110990627A (en) Knowledge graph construction method and device, electronic equipment and medium
CN115101069A (en) Voice control method, device, equipment, storage medium and program product
CN111400575A (en) User identification generation method, user identification method and device
CN110532404A (en) One provenance multimedia determines method, apparatus, equipment and storage medium
CN107992872B (en) Method for carrying out text recognition on picture and mobile terminal
CN112464927B (en) Information extraction method, device and system
CN113515280A (en) Page code generation method and device
US10963690B2 (en) Method for identifying main picture in web page
CN114880498B (en) Event information display method and device, equipment and medium
CN111144345A (en) Character recognition method, device, equipment and storage medium
CN114265777B (en) Application program testing method and device, electronic equipment and storage medium
CN115934928A (en) Information extraction method, device, equipment and storage medium
CN115909357A (en) Target identification method based on artificial intelligence, model training method and device
CN114067343A (en) Data set construction method, model training method and corresponding device
CN112487164A (en) Artificial intelligence interaction method
CN113569091A (en) Video data processing method and device
CN113010812B (en) Information acquisition method, device, electronic equipment and storage medium
CN113190779B (en) Webpage evaluation method and device

Legal Events

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