[go: up one dir, main page]

CN113515280B - Page code generation method and device - Google Patents

Page code generation method and device Download PDF

Info

Publication number
CN113515280B
CN113515280B CN202011415178.4A CN202011415178A CN113515280B CN 113515280 B CN113515280 B CN 113515280B CN 202011415178 A CN202011415178 A CN 202011415178A CN 113515280 B CN113515280 B CN 113515280B
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.)
Active
Application number
CN202011415178.4A
Other languages
Chinese (zh)
Other versions
CN113515280A (en
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/CN113515280B/en
Publication of CN113515280A publication Critical patent/CN113515280A/en
Application granted granted Critical
Publication of CN113515280B publication Critical patent/CN113515280B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING OR CALCULATING; 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 OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/30Creation or generation of source code
    • G06F8/33Intelligent editors
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; 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)
  • Evolutionary Computation (AREA)
  • Medical Informatics (AREA)
  • Data Mining & Analysis (AREA)
  • Computing Systems (AREA)
  • Computer Vision & Pattern Recognition (AREA)
  • Mathematical Physics (AREA)
  • Artificial Intelligence (AREA)
  • Human Computer Interaction (AREA)
  • Stored Programmes (AREA)

Abstract

The embodiment of the application provides a page code generation method and device. The method comprises the steps of obtaining a page design manuscript, wherein the page design manuscript comprises a component area, extracting characteristic information of target components in the component area, wherein the characteristic information is used for representing the attribute of the target components, determining the type of the target components which the target components belong to in a component library based on the characteristic information, and calling target code blocks associated with the type of the target components to integrate the target code blocks so as to obtain page codes of the page design manuscript. The technical scheme of the embodiment of the application can reduce the dependence on standardization of the design manuscript when automatically generating the page code, thereby improving the generation efficiency of the page code.

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 page code generation method and device.
Background
In the page code generation scene, the page design manuscript structure is usually analyzed in the prior art and is further directly converted into the UI code, or the custom page design manuscript structure is converted into the code by using DSL domain specific language, in the process, the component distinction can be carried out according to the structure and the identification of the page design manuscript, and further the developed component is directly rendered. However, the above method has a strong dependence on design draft standardization, resulting in inefficiency in page code generation. Based on this, how to reduce the dependence on design draft standardization in automatically generating page codes is a technical problem to be solved.
Disclosure of Invention
The embodiment of the application provides a page code generation method, a device, a computer program product or a computer program, a computer readable medium and electronic equipment, which can reduce the dependence on design draft standardization when automatically generating page codes and improve the generation efficiency of the page codes.
Other features and advantages of the application will be apparent from the following detailed description, or may be learned by the practice of the application.
According to one aspect of the embodiment of the application, a page code generation method is provided, and the method comprises the steps of obtaining a page design draft, wherein the page design draft comprises a component area, extracting characteristic information of a target component in the component area, wherein the characteristic information is used for representing the attribute of the target component, determining the type of the target component which the target component belongs to in a component library based on the characteristic information, and calling a target code block associated with the type of the target component to integrate the target code block so as to obtain a page code of the page design draft.
According to one aspect of the embodiment of the application, a page code generating device is provided, and the device comprises a first obtaining unit, an extracting unit and a first determining unit, wherein the first obtaining unit is used for obtaining a page design draft, the page design draft comprises a component area, the extracting unit is used for extracting characteristic information of a target component in the component area, the characteristic information is used for representing the attribute of the target component, the first determining unit is used for determining the type of the target component in a component library based on the characteristic information, and the calling unit is used for calling a target code block associated with the type of the target component to integrate the target code block so as to obtain the page code of the page design draft.
In some embodiments of the present application, based on the foregoing solutions, the extracting 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 a target component in each component area respectively.
In some embodiments of the present application, based on the foregoing, the component library includes at least one code block, wherein one code block is associated with one component type.
In some embodiments of the present application, based on the foregoing solutions, the first determining unit is configured to score, based on the feature information, a target component in the component area through a preset model, to obtain a trust score of the target component on each component type, where the trust score is used to characterize the trust degree of the target component as a corresponding component type, and determine, according to the trust score of the target component on each component type, a target component type to which the target component belongs in a component library.
In some embodiments of the present application, based on the foregoing solutions, the feature information includes at least two features, and the first determining unit is configured to score, based on each feature information, a target component in the component area through a preset model to obtain a sub-trust score of the target component on each component type, and for each component type, perform weighted evaluation on the sub-trust score of the target component based on each feature information according to a preset weight to obtain a trust score of the target component on each component type.
In some embodiments of the present application, based on the foregoing, the feature information includes at least two of text feature information, location feature information, and icon feature information.
In some embodiments of the present application, based on the foregoing solutions, the first determining unit is configured to determine, in a component library, a component type corresponding to the trust score as a component type to be verified of the target component, determine, when the trust score reaches a first threshold, a degree of matching between text in the target component and a text library corresponding to the component type to be verified, and determine, when the degree of matching reaches a second threshold, the component type to be verified as a 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, when the trust score does not reach the first threshold, or when the trust score does not reach the first threshold, and the fitness does not reach the second threshold, there is no component type to which the target component belongs in the component library, and a writing unit configured to write the 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 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, to update the preset model, and a second acquiring unit configured to acquire 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 of the present application, 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 performs the page code generation method described in the above embodiment.
According to an aspect of the embodiments of the present application, there is provided a computer-readable medium having stored thereon a computer program which, when executed by a processor, implements a page code generation 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, and storage means 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 embodiment.
In the technical solutions provided in some embodiments of the present application, a page code of a page design draft is obtained by extracting feature information for characterizing an attribute of the target component in a component area in the page design draft, determining a type of the target component to which the target component belongs in a component library according to the feature information, further calling a target code block associated with the type of the target component, and integrating the target code block. In the scheme, in the process of generating the page code according to the page design manuscript, the intelligent identification and the distinction of the component types can be carried out according to the characteristic information of the components in the design manuscript, so that the dependence on standardization of the design manuscript in the process of automatically generating the page code can be removed or lightened, the code generation can be carried out more widely on the basis of the design manuscripts under different design standards, and the generation efficiency of the page code 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 as claimed.
Drawings
The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the application and together with the description, serve to explain the principles of the application. It is evident that the drawings in the following description are only some embodiments of the present application and that other drawings may be obtained from these drawings without inventive effort for a person of ordinary skill in the art. In the drawings:
FIG. 1 shows a schematic diagram of an exemplary system architecture to which the technical solution of an embodiment of the application may be applied;
FIG. 2 illustrates a scene graph of an application page code generation method according to one embodiment of the application;
FIG. 3 shows a flow chart of a page code generation method according to one embodiment of the application;
FIG. 4 illustrates a detailed flow diagram of extracting feature information of a target component in a component area according to one embodiment of the application;
FIG. 5 is a detailed flow diagram of determining the type of target component to which a target component belongs in a component library according to one embodiment of the application;
FIG. 6 illustrates a detailed flow diagram of determining trust scores for target components over various component types by a pre-set model according to one embodiment of the application;
FIG. 7 is a detailed flow diagram of determining the type of target component to which a target component belongs in a component library according to one embodiment of the application;
FIG. 8 is a detailed flow diagram of determining the type of target component to which a target component belongs in a component library according to one embodiment of the application;
FIG. 9 shows a flow chart of a method after writing the component type to which the target component belongs to the component library, in accordance with one embodiment of the application;
FIG. 10 illustrates a partial flow chart of a page code generation method according to one embodiment of the application;
FIG. 11 shows a block diagram of a page code generating apparatus according to one embodiment of the application;
Fig. 12 shows a schematic diagram of a computer system suitable for use in implementing an embodiment of the application.
Detailed Description
Example embodiments will now be described more fully with reference to the accompanying drawings. However, the exemplary embodiments can be embodied in many different forms and should not be construed as limited to the examples set forth herein, but rather, these embodiments are provided so that this disclosure will be thorough and complete, and will fully convey the concept of the exemplary 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 application may be practiced without one or more of the specific details, or with other methods, components, devices, steps, etc. In other instances, well-known methods, devices, implementations, or operations are not shown or described in detail to avoid obscuring aspects of the application.
The block diagrams depicted in the figures are merely functional entities and do not necessarily correspond to physically separate entities. That is, the functional entities may be implemented in software, or in one or more hardware modules or integrated circuits, or in different networks and/or processor devices and/or microcontroller devices.
The flow diagrams depicted in the figures are exemplary only, and do not necessarily include all of the elements and operations/steps, nor must they 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 order of actual execution may be changed according to actual situations.
Fig. 1 shows a schematic diagram of an exemplary system architecture to which the technical solution of an embodiment of the present application may be applied.
As shown in fig. 1, the system architecture may include a terminal device (such as one or more of the smartphone 101, tablet 102, and portable computer 103 shown in fig. 1, but of course, a desktop computer, etc.), a network 104, and a server 105. The network 104 is the medium used to provide communication links between the terminal devices and the server 105. The network 104 may include various connection types, such as wired communication links, wireless communication links, and the like.
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, the server 105 may be a server cluster formed by a plurality of servers.
In one embodiment of the present application, a user may upload a page design draft to a server 105 by using a terminal device and request to generate a page code, where the page design draft includes a component area, after acquiring the page design draft, the server 105 extracts feature information for characterizing an attribute of a target component in the component area, determines, based on the feature information, a target component type to which the target component belongs in a component library, and finally invokes 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 manuscript, the server 105 performs intelligent recognition and distinction of the component types based on the characteristic information of the components in the design manuscript, so that the dependence on standardization of the design manuscript in the process of automatically generating the page code can be removed or reduced, and the generation efficiency of the page code is improved.
It should be noted that, the page code generating method provided in the embodiment of the present application is generally executed by the server 105, and accordingly, the page code generating device 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 by the embodiments of the present application.
Fig. 2 shows a scene graph of an application page code generation method according to an embodiment of the present application.
As shown in fig. 2, after acquiring the page design draft 201, the electronic device obtains the page code 202 by executing the page code generating method provided by the application.
It should be noted that, the page design manuscript refers to the front end of the web page or the mobile phone page, that is, the interface style and visual presentation of the page, the page design manuscript includes page elements, in actual use, the user realizes the operation of the computer by operating the page elements in the page design manuscript. In order to realize the function of the page elements in the page design manuscript, the webpage codes corresponding to the page design manuscript are required to be generated so as to support the function of the page elements in the page design manuscript.
The implementation details of the technical scheme of the embodiment of the application are described in detail below:
Fig. 3 shows a flow chart of a page code generation method according to an embodiment of the application, which may be performed by a device with a computing processing function, such as the server 105 shown in fig. 1. Referring to fig. 3, the page code generating method at least includes steps 310 to 370, and is described in detail as follows:
in step 310, a page design script is obtained, the page design script including a component area.
It should be understood that page design script refers to visual script data and its carrier having a data structure to describe design elements.
In the application, a page design manuscript is designed by a page designer before page code generation, and corresponding component areas are divided at corresponding positions of the page design manuscript according to actual needs, wherein the component areas comprise components, at least one component area is arranged in one page design manuscript, and one component area corresponds to one component.
It should also be understood that the component refers to an abstract concept with a certain UI and business interaction logic, which is specific to the front-end development field, and on the visual effect, the component has text content and image content that can be visually seen.
With continued reference to FIG. 3, in step 330, feature information of the target component in the component area is extracted, the feature information being used to characterize 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 "confirm", "search", "next page", and the like. The location feature information may refer to a location or orientation of the component in the page design script, such as coordinates of the component in the page design script, and so forth. Icon feature information may refer to specific images or symbols, such as specific pictures, arrow symbols, and the like.
In one embodiment of the application, extracting feature information of the target component in the component area may be performed in accordance with the steps shown in fig. 4.
Referring to FIG. 4, a detailed flow diagram of extracting feature information of a target component in a component area is shown, according to one embodiment of the application. Specifically, steps 331 to 332 are included:
In step 331, the page design draft is scanned to obtain at least one component area in the page design draft.
In step 332, feature information of the target component in each component area is extracted, respectively.
In the application, in the process of scanning the page design manuscript, at least one component area in the page design manuscript can be obtained through an image recognition technology. In addition, the feature information of the target component in each component area can be extracted, so that corresponding vector features can be obtained through the component positions, files, icons and other contents in the component.
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 the present application, a component library may refer to a collection of components, and in particular, components in the component library may have a classification flag, which may be used to identify a component type of a component.
In one embodiment of the present application, the component library may further include at least one code block, where a code block is associated with a component type.
It should be noted that, in practical application, the code block may implement a component function corresponding to the component type when being executed, for example, when clicking "next page" in a page, the display screen may be jumped from the current page to another page by executing the corresponding code in the code block corresponding to the code block.
In one embodiment of the present application, determining, based on the feature information, a target component type to which the target component belongs in the component library may be performed according to the steps shown in fig. 5.
Referring to FIG. 5, a detailed flow diagram of determining the type of target component to which the target component belongs in a component library is shown, according to one embodiment of the application. Specifically, the method comprises steps 351 to 352:
In step 351, a trust score of the target component on each component type is obtained by scoring the target component in the component area through a preset model based on the feature information, where the trust score is used to characterize the trust degree of the target component as the corresponding component type.
In the application, the preset model can be a machine learning model trained in advance, and also can be a controllable recognition program which is manually developed and trained and is based on data and experience.
In order to better understand the training process of the preset model by those skilled in the art, the following will be described with reference to a machine learning model:
In the application, the machine learning model can be trained by developing and designing the components with the determinable types and the corresponding characteristic information in the design manuscript as a training set, so that the model can score according to the input characteristic information (such as text characteristic information and position characteristic information of the components) as candidate component types.
For example, for a component showing ranking, a text with a certain characteristic, such as [ xx name ], [ xx bit ], is usually presented at a specific position in a page design manuscript, and a model is obtained after training by using "[ component type, content and position ] included in a training set, which plays a role of a classification component in the following recognition process, namely, the" ranking component "can be scored based on the input text characteristic information and position characteristic information, so as to obtain a higher score.
In the recognition process, for example, characters in the page design manuscript are extracted, position information of the characters is recorded, the characters are recorded in a vector characteristic mode, and the characters are transmitted to a preset model as input to be scored and recognized.
Specifically, in one implementation of step 351, scoring, based on the feature information, the target component in the component area through the preset model, to obtain the trust score of the target component on each component type 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 individual component types by a pre-set model is shown, according to one embodiment of the application. Specifically, the method comprises the steps 3511 to 3512:
In step 3511, the target component in the component area is scored through a preset model based on each feature information, so as to obtain a sub-trust score of the target component on each component type.
In step 3512, for each component type, the sub-trust score of the target component based on the feature information is weighted and evaluated according to a preset weight, so as to obtain the trust score of the target component on each component type.
For a better understanding of the steps shown in fig. 6 by those skilled in the art, this will be elucidated with reference to the examples in table 1 below:
X "ranking component" type Type of "screening component
Text characteristic information x 1 (0.7) 8 Minutes 3 Minutes
Position characteristic information x 2 (0.3) 7 Minutes 1 Minute
Trust scoring 7.7 Minutes 2.4 Minutes
TABLE 1
Referring to table 1, for a target component X, the target component X corresponds to text feature information X 1 and location feature information X 2, where the target component X is scored by a preset model based on the text feature information X 1, so as to obtain a first sub-trust score of the target component X on each component type (e.g. a first sub-trust score of 8 points on a "ranking component" type and a first sub-trust score of 3 points on a "screening component" type). Based on the location feature information X 2, the target component X is scored by a preset model, so that a second sub-trust score of the target component X on each component type (for example, a first sub-trust score of 7 points on a "ranking component" type and a first sub-trust score of 1 point on a "screening component" type) can be obtained.
Further, in the above example, the preset weight for text feature information X 1 is 0.7, the preset weight for location feature information X 1 is 0.3, based on which the trust score of the target component X on the "rank component" type is 0.7x8+0.3x7=7.7, and the trust score on the "filter component" type is 0.7x3+0.3x1=2.4.
With continued reference to FIG. 5, in step 352, a target component type to which the target component belongs in the component library is determined based on the trust scores of the target component on the respective component types.
In the application, scoring is carried out in a preset model according to the matching degree of the character feature matching degree and the relative position, and when the score meets 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, according to the trust scores of the target component on the respective component types, the target component types to which the target component belongs in the component library may be performed according to the steps shown in fig. 7.
Referring to FIG. 7, a detailed flow diagram of determining the type of target component to which the target component belongs in a component library is shown, according to one embodiment of the application. Specifically, the method comprises the steps 3521 to 3523:
in step 3521, when the trust score reaches a first threshold, determining a component type corresponding to the trust score in a component library as a component type to be verified of the target component.
Specifically, for example, the first threshold is set to 7 points, and when the trust score of the "ranking component" type is 7.7, the ranking component "type is illustrated as the component type to be verified of the target component.
In step 3522, a degree of matching between the text in the target component and the text library corresponding to the component type to be verified is determined.
In step 3523, when the fitness 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 application, each component type can be correspondingly provided with a text library, wherein the text library can comprise texts closely related to the corresponding component type.
As described above, the target component also includes 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 can be the matching number of the characters in the target component and the characters in the corresponding character library, or can be the matching proportion.
When the matching degree reaches a second threshold value, the type of the component to be verified is determined to be the type of the target component to which the target component belongs in the component library, and the method has the advantages that the scoring and the identification result of the model can be verified, so that the accuracy of identifying the type of the target component by the whole scheme is improved.
In the present application, determining the 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 of determining the type of target component to which the target component belongs in a component library is shown, according to one embodiment of the application. Specifically, the method comprises the steps 3524 to 3525:
In step 3524, when the trust score does not reach the first threshold, or when the trust score reaches the first threshold and the fitness does not reach the second threshold, it is determined that there is no component type in the component library to which the target component belongs.
In step 3525, the component type to which the target component belongs is written into the component library.
In the application, when the component type of the target component does not exist in the component library, the component type of the target component is written into the component library, so that the component type in the whole component library can be perfected, and the condition that the component type of the target component 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 application, the steps shown in FIG. 9 may also be performed after the component type to which the target component belongs is written into the component library.
Referring to FIG. 9, a flowchart of a method is shown after writing the component type to which the target component belongs to the component library, in accordance with one embodiment of the present application. Specifically, the method comprises the steps 3526 to 3527:
in step 3526, the preset model is trained based on the feature information of the target component and the component type to which the target component belongs, so as to update the preset model.
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.
According to the application, the preset model is trained based on the characteristic information of the target component and the component type of the target component, so that the component identification function of the preset model can be enhanced, and the accuracy of identifying the component type by the preset model is improved.
In the application, the code block is associated with the component type of the target component, and the code can be quickly written into the component library.
With continued reference to FIG. 3, in step 370, an object code block associated with the object component type is invoked to integrate the object code block to obtain a page code of the page design script.
In the application, at least one target code block is spliced and packaged 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 page design manuscript specification can be reduced or removed, the credibility of the identification classification component is improved, and the automation process of leading the page design manuscript to the code can be realized in the development joint debugging process.
For a better understanding of the present application, the component type identification portion of the page code generation scheme proposed by the present application will be described in its entirety with reference to fig. 10:
referring to FIG. 10, a partial flow chart of a page code generation method according to one embodiment of the application is shown.
As shown in fig. 10, the component area is firstly divided for the page design manuscript, a plurality of target components are obtained from the component area, then characteristic information in the plurality of target components is respectively extracted, the component types of the plurality of target components are identified by a preset model trained by a training set based on the characteristic information, whether the target components are components in a component library is judged, finally, when the target components are not components in the library, the target components are marked as non-components in the library, and when the target components are components in the library, the target components are marked as components in the library.
In the technical solutions provided in some embodiments of the present application, a page code of a page design draft is obtained by extracting feature information for characterizing an attribute of the target component in a component area in the page design draft, determining a type of the target component to which the target component belongs in a component library according to the feature information, further calling a target code block associated with the type of the target component, and integrating the target code block. In the scheme, in the process of generating the page code according to the page design manuscript, the intelligent identification and the distinction of the component types can be carried out according to the characteristic information of the components in the design manuscript, so that the dependence on standardization of the design manuscript in the process of automatically generating the page code can be removed or lightened, the code generation can be carried out more widely on the basis of the design manuscripts under different design standards, and the generation efficiency of the page code is improved.
The following describes an embodiment of the apparatus of the present application, which may be used to execute the page code generation method in the above embodiment of the present application. For details not disclosed in the embodiments of the apparatus of the present application, please refer to the embodiments of the page code generation method of the present application.
Fig. 11 shows a block diagram of a page code generating apparatus according to an embodiment of the present application.
Referring to fig. 11, a page code generating 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 calling unit 1104.
The page code generation method comprises a first obtaining unit 1101, an extracting unit 1102, a first determining unit 1103 and a calling unit 1104, wherein the first obtaining unit 1101 is used for obtaining a page design manuscript, the page design manuscript comprises a component area, the extracting unit 1102 is used for extracting characteristic information of target components in the component area, the characteristic information is used for representing the attribute of the target components, the first determining unit 1103 is used for determining the type of the target components in a component library based on the characteristic information, and the calling unit 1104 is used for calling target code blocks associated with the type of the target components to integrate the target code blocks so as to obtain page codes of the page design manuscript.
In some embodiments of the present application, based on the foregoing solution, the extracting 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 a target component in each component area respectively.
In some embodiments of the present application, based on the foregoing, the component library includes at least one code block, wherein one code block is associated with one component type.
In some embodiments of the present application, based on the foregoing solution, the first determining unit 1103 is configured to score, based on the feature information, a target component in the component area through a preset model, to obtain a trust score of the target component on each component type, where the trust score is used to characterize the trust degree of the target component as a corresponding component type, and determine, according to the trust score of the target component on each component type, a target component type to which the target component belongs in a component library.
In some embodiments of the present application, based on the foregoing solutions, the feature information includes at least two features, and the first determining unit 1103 is configured to score, based on each feature information, a target component in the component area through a preset model to obtain a sub-trust score of the target component on each component type, and for each component type, perform weighted evaluation on the sub-trust score of the target component based on each feature information according to a preset weight to obtain a trust score of the target component on each component type.
In some embodiments of the present application, based on the foregoing, the feature information includes at least two of text feature information, location feature information, and icon feature information.
In some embodiments of the present application, based on the foregoing solution, the first determining unit 1103 is configured to determine, in a component library, a component type corresponding to the trust score as a component type to be verified of the target component, determine, when the trust score reaches a first threshold, a degree of matching between text in the target component and a text library corresponding to the component type to be verified, and determine, when the degree of matching reaches a second threshold, the component type to be verified as a 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, when the trust score does not reach the first threshold, or when the trust score does not reach the first threshold, and the fitness does not reach the second threshold, there is no component type to which the target component belongs in the component library, and a writing unit configured to write the 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 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, to update the preset model, and a second acquiring unit configured to acquire 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 shows a schematic diagram of a computer system suitable for use in implementing an embodiment of the 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 impose any limitation on the functions and the application scope of the embodiments of the present application.
As shown in fig. 12, the computer system 1200 includes a central processing unit (Central Processing Unit, CPU) 1201 that 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 (Random Access Memory, RAM) 1203. In the RAM 1203, various programs and data required for the system operation are also stored. The CPU 1201, ROM 1202, and RAM 1203 are connected to each other through a bus 1204. An Input/Output (I/O) interface 1205 is also connected to bus 1204.
Connected to the I/O interface 1205 are an input section 1206 including a keyboard, a mouse, and the like, an output section 1207 including a display such as a Cathode Ray Tube (CRT), a Liquid crystal display (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, and the like. The communication section 1209 performs communication processing via a network such as the internet. The 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, or the like is installed as needed on the drive 1210 so that a computer program read out therefrom is installed into the storage section 1208 as needed.
In particular, according to embodiments of the present application, the processes described above with reference to flowcharts may be implemented as computer software programs. For example, embodiments of the present application include a computer program product comprising a computer program embodied on a computer readable medium, the computer program comprising program code for performing the method shown in the flowcharts. In such an embodiment, the computer program can be downloaded and installed from a network via the communication portion 1209, and/or installed from the removable media 1211. When executed by a Central Processing Unit (CPU) 1201, performs the various functions defined in the system of the present application.
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. The computer readable storage medium can be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or a combination of any of the foregoing. More specific examples of a 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 (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 context of this document, a computer readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device. In the present application, however, the computer-readable signal medium may include a data signal propagated in baseband or as part of a carrier wave, with the computer-readable program code embodied therein. Such a propagated data signal may take any of a variety of forms, including, but not limited to, electro-magnetic, optical, or any suitable combination of the foregoing. A computer readable signal medium may also be any computer readable medium that is not a computer readable storage medium and that can communicate, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device. Program code embodied on a computer readable medium may be transmitted using any appropriate medium, including but not limited to wireless, wireline, etc., or any suitable combination of the foregoing.
The flowcharts and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of systems, methods and computer program products according to various embodiments of the present application. Where 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 involved 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 provided in a processor. Wherein the names of the units do not constitute a limitation of the units themselves in some cases.
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 performs the page code generation method described in the above embodiment.
As another aspect, the present application also provides a computer-readable medium that may be included in the electronic device described in the above embodiment, or may exist alone without being incorporated into the electronic device. The computer-readable medium carries one or more programs which, when executed by the electronic device, cause the electronic device to implement the methods described in the above embodiments.
It should be noted that although in the above detailed description several modules or units of a device for action execution are mentioned, such a division is not mandatory. Indeed, the features and functions of two or more modules or units described above may be embodied in one module or unit in accordance with embodiments of the application. Conversely, the features and functions of one module or unit described above may be further divided into a plurality of modules or units to be embodied.
From the above description of embodiments, those skilled in the art will readily appreciate that the example embodiments described herein may be implemented in software, or may be implemented in software in combination with the necessary hardware. Thus, the technical solution according to the embodiments of the present application may be embodied in the form of a software product, which may be stored in a non-volatile storage medium (may be a CD-ROM, a U-disk, a mobile hard disk, etc.) or on a network, and includes several instructions to cause a computing device (may be a personal computer, a server, a touch terminal, or a network device, etc.) to perform the method according to the embodiments of the present application.
Other embodiments of the 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 application 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 application pertains.
It is to be understood that the application is not limited to the precise arrangements and instrumentalities shown in the drawings, which have been described above, and that various modifications and changes may be effected without departing from the scope thereof. The scope of the application is limited only by the appended claims.

Claims (9)

1. A method for generating a page code, the method comprising:
acquiring a page design draft, wherein the page design draft comprises a component area;
extracting characteristic information of a target component in the component area, wherein the characteristic information is used for representing the attribute of the target component and comprises characters and the positions of the characters;
based on the characteristic information, scoring a target component in the component area through a preset model trained by a training set, so as to obtain trust scores of the target component on each component type, wherein the trust scores are used for representing the trust degree of the target component as a corresponding component type, and the training set comprises the component types, the content and the position of characters;
When the trust score reaches a first threshold, 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 coincidence degree between the characters in the target component and the character library corresponding to the type of the component to be verified;
When the fitness reaches a second threshold, determining the type of the component to be verified as a target component type of the target component in a component library, wherein the component library comprises at least one code block, and one code block is associated with one component type;
And calling an object code block associated with the object component type to integrate the object code block to obtain the page code of the page design draft.
2. The method of claim 1, wherein extracting feature information of a target component in the component area comprises:
Scanning the page design manuscript to obtain at least one component area in the page design manuscript;
and extracting the characteristic information of the target component in each component area respectively.
3. The method according to claim 1, wherein the feature information includes at least two, the scoring the target components in the component area by a preset model trained by a training set based on the feature information to obtain trust scores of the target components on each component type, including:
Scoring a target component in the component area through a preset model based on each piece of characteristic information to obtain sub-trust scores of the target component on each component type;
And aiming at each component type, carrying out weighted evaluation on the sub-trust scores of the target component based on the characteristic information according to preset weights to obtain the trust scores of the target component on each component type.
4. The method according to claim 1, wherein the method further comprises:
When the trust score does not reach the first threshold value, or when the trust score reaches the first threshold value and the fitness does not reach the second threshold value, determining that the component type of the target component does not exist in the component library;
And writing the component type of the target component into the component library.
5. The method of claim 4, wherein after writing the component type to which the target component belongs into the component library, the method further comprises:
training the preset model based on the characteristic information of the target component and the component type of the target component so as to update the preset model;
and acquiring a code block corresponding to the component type of the target component, and associating the code block with the component type of the target component.
6. A page code generating apparatus, the apparatus comprising:
the system comprises an acquisition unit, a processing unit and a processing unit, wherein the acquisition unit is used for acquiring a page design manuscript, and the page design manuscript comprises a component area;
The extraction unit is used for extracting characteristic information of a target component in the component area, wherein the characteristic information is used for representing the attribute of the target component and comprises characters and positions of the characters;
The device comprises a training set, a determining unit and a verifying unit, wherein the training set is used for training a preset model through the training set to obtain a trust score of a target component in a component area through the characteristic information, the trust score is used for representing the trust degree of the target component in a corresponding component type, the training set comprises the component type and the content and the position of characters, when the trust score reaches a first threshold, the component type corresponding to the trust score is determined to be the component type to be verified of the target component in a component library, the consistency degree between the characters in the target component and the character library corresponding to the component type to be verified is determined, and when the consistency degree reaches a second threshold, the component type to be verified is determined to be the target component type of the target component in the component library, the component library comprises at least one code block, and one code block is associated with one component type;
and the calling unit is used for calling 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 on which a computer program is stored, characterized in that the computer program, when executed by a processor, implements the page code generation method according to any one of claims 1 to 5.
8. An electronic device, comprising:
One or more processors;
Storage means 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 of any of claims 1 to 5.
9. A computer program product, characterized in that the computer program product comprises computer instructions stored in a computer-readable storage medium, from which computer instructions a processor of a computer device reads, the processor executing the computer instructions, causing the computer device to perform the page code generation method according to any one of claims 1 to 5.
CN202011415178.4A 2020-12-03 2020-12-03 Page code generation method and device Active CN113515280B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202011415178.4A CN113515280B (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 CN113515280B (en) 2020-12-03 2020-12-03 Page code generation method and device

Publications (2)

Publication Number Publication Date
CN113515280A CN113515280A (en) 2021-10-19
CN113515280B true CN113515280B (en) 2025-03-04

Family

ID=78060898

Family Applications (1)

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

Country Status (1)

Country Link
CN (1) CN113515280B (en)

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114064010A (en) * 2021-11-22 2022-02-18 中国工商银行股份有限公司 Front-end code generation method, device, system and storage medium
CN114237600B (en) * 2021-12-20 2023-08-11 抖音视界有限公司 Method, device, equipment and storage medium for generating code of front page

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104978423A (en) * 2015-06-30 2015-10-14 北京奇虎科技有限公司 Website type detection method and apparatus
CN111324352A (en) * 2020-02-27 2020-06-23 中国平安人寿保险股份有限公司 Code generation method of application page and related equipment

Family Cites Families (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7584465B1 (en) * 2004-09-20 2009-09-01 The Mathworks, Inc. Memory mapping for single and multi-processing implementations of code generated from a block diagram model
TW201142630A (en) * 2009-12-21 2011-12-01 Ibm Method for training and using a classification model with association rule models
US9785767B2 (en) * 2013-03-15 2017-10-10 Imagine Communications Corp. Systems and methods for determining trust levels for computing components
CN105930159B (en) * 2016-04-20 2019-09-17 中山大学 A kind of method and system that the GUI code based on image generates
CN107508809B (en) * 2017-08-17 2020-10-23 腾讯科技(深圳)有限公司 Method and device for identifying website type
CN110096275B (en) * 2018-01-30 2023-06-23 阿里健康信息技术有限公司 Page processing method and device
CN111475613A (en) * 2020-03-06 2020-07-31 深圳壹账通智能科技有限公司 Case classification method and device, computer equipment and storage medium

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104978423A (en) * 2015-06-30 2015-10-14 北京奇虎科技有限公司 Website type detection method and apparatus
CN111324352A (en) * 2020-02-27 2020-06-23 中国平安人寿保险股份有限公司 Code generation method of application page and related equipment

Also Published As

Publication number Publication date
CN113515280A (en) 2021-10-19

Similar Documents

Publication Publication Date Title
CN108595583B (en) Dynamic graph page data crawling method, device, terminal and storage medium
US20200004815A1 (en) Text entity detection and recognition from images
CN113360699A (en) Model training method and device, image question answering method and device
CN109828906B (en) UI (user interface) automatic testing method and device, electronic equipment and storage medium
CN110765973B (en) Account type identification method and device
JP2019536171A (en) Web page clustering method and apparatus
CN117494693B (en) Evaluation document generation method, device and equipment
CN112464927B (en) Information extraction method, device and system
CN114067343B (en) A data set construction method, model training method and corresponding device
CN113704623A (en) Data recommendation method, device, equipment and storage medium
CN115562656A (en) Page generation method and device, storage medium and computer equipment
CN112800305A (en) Knowledge graph data extraction method and device based on web crawler
CN113515280B (en) Page code generation method and device
CN111488732A (en) Deformed keyword detection method, system and related equipment
CN114003725A (en) Information annotation model construction method and information annotation generation method
JP2014056503A (en) Computer packaging method, program, and system for specifying non-text element matching communication in multilingual environment
CN113742485A (en) A method and apparatus for processing text
CN113051235A (en) Document loading method and device, terminal and storage medium
CN114579796B (en) Machine reading understanding method and device
CN114386013A (en) Automatic student status authentication method and device, computer equipment and storage medium
CN111144345A (en) Character recognition method, device, equipment and storage medium
CN116774973A (en) Data rendering method, device, computer equipment and storage medium
JP2020077054A (en) Selection device and selection method
CN112783501B (en) Hotspot compilation unit determination method, device and server
CN114036415B (en) Web page validity identification method, device, electronic device and storage medium

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
GR01 Patent grant
GR01 Patent grant