Cross-platform conversion method and device for user interface component, terminal and medium
Through the cross-platform conversion method based on the semantic similarity model, the problem of code repetition when user interface components are adapted across platforms is solved, efficient cross-platform conversion and consistency are achieved, and development efficiency is improved.
Patent Information
- Application Number
- CN202411058263.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-02
- Publication Date
- 2024-11-12
AI Technical Summary
In the prior art, the code is written repeatedly when adapting user interface components from one platform to another, resulting in less development efficiency.
The trained semantic similarity model is used to evaluate the similarity between the source platform and the target platform user interface components, determine the mapping relationship, and generate the equivalent component code of the target platform based on the relationship to avoid repeated writing.
Improve development efficiency, realize cross-platform conversion without repeated writing of user interface component code, and improve conversion accuracy and consistency.
Smart Images

Figure CN118939262A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of user interface technology, and in particular to a method, device, terminal and medium for cross-platform conversion of user interface components. Background Art
[0002] A user interface component encapsulates one or several code segments that complete their respective functions into one or several independent parts. A user interface component contains one or several code segments with their respective functions, and finally completes the representation of the user interface.
[0003] In the prior art, when developers need to adapt a user interface originally used for a certain platform to other platforms, they need to repeatedly write the code of the user interface component, which reduces the development efficiency.
[0004] Therefore, the prior art has defects and needs to be improved and developed. Summary of the invention
[0005] The present application provides a method, device, terminal and medium for cross-platform conversion of user interface components to solve the technical problem in the related art that when adapting a user interface originally used for a certain platform to other platforms, the code of the user interface component needs to be repeatedly written, resulting in low development efficiency.
[0006] To achieve the above objectives, this application adopts the following technical solutions:
[0007] A method for cross-platform conversion of user interface components, wherein the method comprises:
[0008] Evaluate the similarity between user interface components on the source and target platforms based on the trained semantic similarity model;
[0009] Determine a mapping relationship between user interface components of a source platform and a target platform according to the similarity;
[0010] The source platform component code is obtained, and the equivalent component code of the target platform is generated according to the mapping relationship and the source platform component code.
[0011] In one implementation of the present application, the training step of the semantic similarity model includes:
[0012] Acquire a training data set, wherein the training data set includes component description information of user interface components on a plurality of platforms and similarity labels between user interface components;
[0013] An initial semantic similarity model is obtained, and the initial semantic similarity model is trained based on the component description information and the similarity label. After the training is completed, a trained semantic similarity model is obtained.
[0014] In one implementation of the present application, the component description information is obtained based on pre-collected component definitions and documents of different user interface development platforms, and the component description information includes: the name, attributes, function description and usage scenario of the user interface component.
[0015] In one implementation of the present application, the evaluating the similarity between the user interface components on the source platform and the target platform based on the trained semantic similarity model includes:
[0016] Acquire first component description information corresponding to the user interface component of the source platform and second component description information corresponding to the user interface component of the target platform;
[0017] The first component description information and the second component description information are input into a trained semantic similarity model to obtain the similarity between the user interface components on the source platform and the target platform.
[0018] In one implementation of the present application, determining a mapping relationship between user interface components of a source platform and a target platform according to the similarity includes:
[0019] Determining similar component pairs between the source platform and the target platform whose similarity is within a preset threshold range;
[0020] A mapping relationship between the user interface components of the source platform and the target platform is established according to the similar component pairs.
[0021] In one implementation of the present application, after determining the mapping relationship between the user interface components of the source platform and the target platform according to the similarity, the method further includes:
[0022] An adjustment instruction is received, and the mapping relationship is adjusted.
[0023] In one implementation of the present application, the step of obtaining the source platform component code and generating the equivalent component code of the target platform according to the mapping relationship and the source platform component code includes:
[0024] Analyze the component code on the source platform using a code parser to obtain the component code of the source platform;
[0025] Extracting component code snippets corresponding to each interface component in the source platform component code;
[0026] According to the mapping relationship, the component code fragment is mapped to an equivalent component of the target platform to generate an equivalent component code of the target platform.
[0027] The present application also provides a device for cross-platform conversion of user interface components, wherein the device comprises:
[0028] an evaluation module, for evaluating similarities between user interface components on a source platform and a target platform based on a trained semantic similarity model;
[0029] A determination module, configured to determine a mapping relationship between user interface components of a source platform and a target platform according to the similarity;
[0030] The generation module is used to obtain the source platform component code and generate the equivalent component code of the target platform according to the mapping relationship and the source platform component code.
[0031] In one implementation of the present application, the user interface component cross-platform conversion device further includes:
[0032] A data set acquisition module, used to acquire a training data set, wherein the training data set includes component description information of user interface components on a plurality of platforms and similarity labels between user interface components;
[0033] The training module is used to obtain an initial semantic similarity model, and train the initial semantic similarity model based on the component description information and the similarity label. After the training is completed, a trained semantic similarity model is obtained.
[0034] In one implementation of the present application, the component description information is obtained based on pre-collected component definitions and documents of different user interface development platforms, and the component description information includes: the name, attributes, function description and usage scenario of the user interface component.
[0035] In one implementation of the present application, the evaluation module includes:
[0036] An information acquisition unit, used to acquire first component description information corresponding to the user interface component of the source platform, and second component description information corresponding to the user interface component of the target platform;
[0037] An information input unit is used to input the first component description information and the second component description information into a trained semantic similarity model to obtain the similarity between the user interface components on the source platform and the target platform.
[0038] In one implementation of the present application, the determining module includes:
[0039] a component pair determination unit, configured to determine similar component pairs between a source platform and a target platform whose similarity is within a preset threshold range;
[0040] The relationship establishing unit is used to establish a mapping relationship between the user interface components of the source platform and the target platform according to the similar component pairs.
[0041] In one implementation of the present application, the user interface component cross-platform conversion device further includes:
[0042] The instruction receiving module is used to receive an adjustment instruction and adjust the mapping relationship.
[0043] In one implementation of the present application, the generating module includes:
[0044] A code analysis unit, used for analyzing the component code on the source platform by using a code parser to obtain the source platform component code;
[0045] A code extraction unit, used to extract component code snippets corresponding to each interface component in the source platform component code;
[0046] The code generation unit is used to map the component code fragment to an equivalent component of the target platform according to the mapping relationship, and generate an equivalent component code of the target platform.
[0047] The present application also provides a terminal, which includes: a memory, a processor, and a user interface component cross-platform conversion program stored in the memory and executable on the processor, wherein the user interface component cross-platform conversion program implements the steps of the user interface component cross-platform conversion method described above when executed by the processor.
[0048] The present application also provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, and the computer program can be executed to implement the steps of the cross-platform conversion method of the user interface component as described above.
[0049] Beneficial effects of the present invention: The method of the embodiment of the present invention evaluates the similarity between the user interface components on the source platform and the target platform based on a trained semantic similarity model; determines the mapping relationship between the user interface components of the source platform and the target platform according to the similarity; obtains the source platform component code, and generates the equivalent component code of the target platform according to the mapping relationship and the source platform component code. The present application evaluates the similarity between the user interface components on the source platform and the target platform through a trained semantic similarity model, and then can automatically generate the equivalent component code of the target platform according to the source platform component code, thereby achieving cross-platform conversion without repeatedly writing the user interface component code, thereby improving development efficiency. BRIEF DESCRIPTION OF THE DRAWINGS
[0050] Figure 1 It is a flow chart of a preferred embodiment of the method for cross-platform conversion of user interface components in the present invention.
[0051] Figure 2 It is a functional principle block diagram of a preferred embodiment of the cross-platform conversion device for user interface components in the present invention.
[0052] Figure 3 It is a functional principle block diagram of a preferred embodiment of the terminal in the present invention. DETAILED DESCRIPTION
[0053] In order to make the purpose, technical solution and advantages of the present invention clearer and more specific, the present invention is further described in detail below with reference to the accompanying drawings and examples. It should be understood that the specific embodiments described herein are only used to explain the present invention and are not used to limit the present invention.
[0054] The following describes the method, device, terminal and medium for cross-platform conversion of user interface components of the embodiments of the present application with reference to the accompanying drawings. In view of the problem that in the related art mentioned in the above background technology, when adapting the user interface originally used for a certain platform to other platforms, it is necessary to repeatedly write the code of the user interface component, resulting in low development efficiency, the present application provides a method for cross-platform conversion of user interface components, in which the similarity between the user interface components on the source platform and the target platform is evaluated based on a trained semantic similarity model; the mapping relationship between the user interface components of the source platform and the target platform is determined according to the similarity; the source platform component code is obtained, and the equivalent component code of the target platform is generated according to the mapping relationship and the source platform component code. The present application evaluates the similarity between the user interface components on the source platform and the target platform through a trained semantic similarity model, and then can automatically generate the equivalent component code of the target platform according to the source platform component code, so that cross-platform conversion is achieved without repeatedly writing the code of the user interface component, thereby improving development efficiency.
[0055] See also Figure 1 The method for cross-platform conversion of user interface components according to an embodiment of the present invention comprises the following steps:
[0056] Step S100: Evaluate the similarity between the user interface components on the source platform and the target platform based on the trained semantic similarity model.
[0057] In an embodiment of the present application, the training step of the semantic similarity model includes:
[0058] Step S10: obtaining a training data set, wherein the training data set includes component description information of user interface components on a plurality of platforms, and similarity labels between user interface components;
[0059] Step S20: obtaining an initial semantic similarity model, and training the initial semantic similarity model based on the component description information and the similarity label. After the training is completed, a trained semantic similarity model is obtained.
[0060] Specifically, component description information of user interface components on multiple platforms, such as component name, attributes, function description, and usage scenarios, is collected, and the similarity between these components is marked. An initial semantic similarity model (such as BERT or GPT series models) is used to train based on the above component description information and similarity labels. After the model training is completed, the semantic similarity between components on different platforms can be evaluated.
[0061] By acquiring a training data set containing detailed description information of user interface components on multiple platforms and similarity labels between them, the model of the embodiment of the present application can learn the intrinsic connections and similarities between components on different platforms, making the model more accurate in evaluating the similarity between new component pairs, thereby improving the accuracy of cross-platform user interface component conversion; the trained semantic similarity model can automatically evaluate the similarity between components without manual intervention or complex rule writing; it not only saves time and labor costs, but also reduces the possibility of human errors through standardized processes; after the model is trained, it can be easily extended to new platforms or components. It only needs to provide appropriate description information and similarity labels for these new elements to include them in the learning and evaluation scope of the model. This scalability enables the model to adapt to ever-changing development environments and needs; using a trained semantic similarity model can significantly speed up the speed of cross-platform user interface component conversion.
[0062] Therefore, the embodiments of the present application provide a powerful and flexible tool for cross-platform user interface component conversion, which improves conversion accuracy, automation, scalability and development efficiency.
[0063] In one embodiment of the present application, the component description information is obtained based on pre-collected component definitions and documents of different user interface development platforms, and the component description information includes: the name, attributes, functional description and usage scenario of the user interface component.
[0064] Specifically, for names, each component has a unique name or identifier on the platform it belongs to, which is used to refer to and distinguish it in the code. For example, in React Native it might be <button> , while in Flutter it might be ElevatedButton. Some platforms may allow components to have aliases or provide component variants, which should also be mentioned in the description. For example,< / button> <button>In React Native it is possible to have multiple style variants like primary, secondary, etc.
[0065] For properties, there are basic properties, unique properties, and event listeners. Basic properties include basic configuration options of components, such as size, color, font, etc. These properties directly affect the appearance and layout of components. Unique properties refer to platform-specific properties that some components may have. These properties may not exist on other platforms or have different names and usages. For example, Flutter's ElevatedButton has an elevation property to control the shadow effect of the button, while ReactNative's< / button> <button>It may be necessary to use other methods (such as style objects) to achieve similar effects. Components usually support event monitoring, such as click, hover, etc. The names, triggering conditions, and callback functions of these events are also detailed in the description information.
[0066] For functional description, it mainly includes core functions and interactive behaviors. The core function is to outline the main functions and uses of the component; for example,< / button> <button>The core function of a component is to allow users to trigger an action by clicking on it. Interaction behavior describes the behavior of a component during interaction, including state changes (such as activated and disabled states), animation effects (such as feedback animation when clicking), etc. In addition, if the component supports data binding, it should explain how to associate it with the application state or data source, and how the component responds when the data changes.
[0067] For usage scenarios, you can list typical usage scenarios of components in actual applications and provide guidance on how to effectively use components in UI design, including layout suggestions, color schemes, interaction modes, etc. If a component has compatibility issues in certain specific scenarios or platforms, this should be clearly stated in the description information, and solutions or alternatives should be provided.
[0068] The embodiment of the present application can ensure that there is sufficient information to accurately understand the components on different platforms during the cross-platform user interface component conversion process through component description information, thereby improving the quality and efficiency of the conversion.
[0069] In the embodiment of the present application, the step S100 specifically includes:
[0070] Step S110: acquiring first component description information corresponding to the user interface component of the source platform and second component description information corresponding to the user interface component of the target platform;
[0071] Step S120: input the first component description information and the second component description information into a trained semantic similarity model to obtain the similarity between the user interface components on the source platform and the target platform.
[0072] Specifically, the embodiment of the present application formats the description information of all components into a format acceptable to the semantic similarity model, for example, converting the text into a specific data structure (such as JSON or XML), or performing necessary text preprocessing (such as removing stop words, stemming, etc.). The semantic similarity model can process structured text data and extract features for similarity calculation therefrom. A series of complex operations, such as text embedding, feature extraction, vector comparison, etc., are performed inside the semantic similarity model to calculate the similarity between the two component description information. The semantic similarity model will eventually output a similarity score, which reflects the similarity between the source platform and the target platform components. This score can be a numerical value between 0 and 1, where 0 represents completely dissimilar and 1 represents exactly the same.
[0073] The embodiment of the present application can quickly determine which components can be directly converted and which need manual adjustment or redesign by automatically evaluating the similarity between components, thereby greatly improving the efficiency of cross-platform user interface conversion. User interfaces often contain complex components and interaction logic. The semantic similarity model of the embodiment of the present application can handle these complexities and evaluate the similarity of components in multiple dimensions (such as function, appearance, behavior, etc.), thereby supporting more complex cross-platform conversion tasks. In addition, by ensuring that the converted components are consistent with the components on the target platform in terms of function and appearance, the semantic similarity model helps promote the consistency of user interfaces between different platforms.
[0074] like Figure 1 As shown, the method for cross-platform conversion of user interface components also includes the following steps:
[0075] Step S200: Determine a mapping relationship between user interface components of a source platform and a target platform according to the similarity.
[0076] In the embodiment of the present application, the step S200 specifically includes:
[0077] Step S210, determining similar component pairs between the source platform and the target platform whose similarity is within a preset threshold range;
[0078] Step S220: Establish a mapping relationship between the user interface components of the source platform and the target platform according to the similar component pairs.
[0079] Specifically, first, one or more similarity thresholds are set according to the specific needs of the project and the expected conversion quality. These thresholds should be able to distinguish which component pairs are similar enough in function to be directly converted, and which require further review or manual adjustment, and quickly filter out qualified component pairs through programming logic. In addition, the embodiments of the present application can also classify the filtered component pairs according to similarity scores or other criteria. For example, component pairs with very high scores can be marked as "direct conversion", while component pairs with slightly lower scores but still meeting the threshold requirements can be marked as "review required".
[0080] When creating a mapping relationship, first, create a mapping table or data structure to store the component mapping relationship between the source platform and the target platform. This mapping table should be able to clearly indicate the target platform component corresponding to each source platform component. Fill the information of the filtered similar component pairs into the mapping table, including the identifier of the source platform component, the identifier of the target platform component, and the similarity score. In some cases, it is necessary to optimize the conversion logic based on the content of the mapping table. For example, if it is found that multiple source platform components are mapped to the same target platform component, a merge strategy or conversion rules are designed in advance to ensure that the converted user interface not only meets the specifications of the target platform, but also maintains the original functions and layout.
[0081] The embodiment of the present application establishes a mapping relationship by screening component pairs whose similarity is within a preset threshold range, which can ensure that only components that are sufficiently similar in function and appearance are considered during the conversion process, thereby improving the accuracy and reliability of the conversion; the automated mapping process reduces the need for manual review and adjustment, and reduces the labor cost and time cost in the conversion process; the establishment of a mapping relationship helps promote the standardization and consistency of user interface components between different platforms, improve user experience and product maintainability; in the software development process, changes in the user interface are the norm. By maintaining a clear mapping relationship, it is easier to adapt to these changes and support rapid iteration and upgrading of products.
[0082] In one embodiment of the present application, after step S200, the step further includes: receiving an adjustment instruction to adjust the mapping relationship.
[0083] Specifically, the system provides a user interface (such as a graphical interface, a command line tool, or an API interface) so that the user can enter adjustment instructions. These instructions may include adding new mapping relationships, deleting existing mapping relationships, modifying the properties of mapping relationships (such as similarity scores, conversion rules, etc.), etc. After the system receives the adjustment instruction, it needs to parse it to determine the type of adjustment the user wants to make and the specific adjustment content. Before performing the adjustment, the system should verify the adjustment content to ensure its rationality and effectiveness; for example, verify whether the newly added mapping relationship is repeated, whether the modified attribute value is within a reasonable range, etc. After the verification is passed, the system performs corresponding operations according to the adjustment instruction, including updating the mapping table, modifying the conversion rules, generating new conversion codes, etc. After the adjustment operation is performed, the system feedbacks the adjustment results to the user, which can be achieved by displaying a message on the user interface, sending an email, or calling a callback function. The feedback adjustment results are whether the adjustment is successful, the impact after the adjustment, and / or precautions.
[0084] The embodiment of the present application allows the user to adjust the mapping relationship according to actual needs, which can greatly enhance the flexibility and adaptability of the system. Whether it is to cope with the conversion requirements in special scenarios or to correct the errors caused by automatic mapping, the user adjustment instructions provide the necessary means; through user adjustment, the errors or deficiencies that may occur in the automatic mapping process can be corrected, thereby improving the accuracy and quality of the conversion; in the software development process, demand changes and interface adjustments are the norm. By allowing users to adjust the mapping relationship, the system can be supported to maintain flexibility and maintainability in the face of these changes, and promote continuous iteration and upgrading of products.
[0085] like Figure 1 As shown, the method for cross-platform conversion of user interface components also includes the following steps:
[0086] Step S300: Obtain the source platform component code, and generate the equivalent component code of the target platform according to the mapping relationship and the source platform component code.
[0087] In the embodiment of the present application, the step S300 specifically includes:
[0088] Step S310: Analyze the component code on the source platform using a code parser to obtain the source platform component code;
[0089] Step S320, extracting component code snippets corresponding to each interface component in the source platform component code;
[0090] Step S330: Map the component code snippet to an equivalent component of the target platform according to the mapping relationship, and generate an equivalent component code of the target platform.
[0091] Specifically, for step S310, select or configure a code parser suitable for the source platform language. Different programming languages (such as Java, JavaScript, Swift, etc.) require different parsers to accurately understand the code structure and syntax. Loading the source platform component code file or code library into the parser may include reading files from the file system, retrieving code snippets from the database, or obtaining code through a network API. Performing parsing operations to convert source code into an abstract syntax tree (AST) or other intermediate representation helps the program understand and operate the code in a structured manner. Traverse the AST or intermediate representation, extract the necessary code elements, and prepare for subsequent processing.
[0092] For step S320, identify the definition and instantiation code of the interface component, including finding a specific class instantiation, template tag or DOM element creation statement; parse and extract the component code snippet of the component, which defines the appearance and behavior of the component.
[0093] For step S330, when generating equivalent component code of the target platform, the converted component definition, properties and event listeners are inserted into the code template of the target platform to obtain the code snippet corresponding to the equivalent component on the target platform, thereby realizing automatic code conversion.
[0094] The embodiments of the present application realize the automated migration of interface component codes from the source platform to the target platform, greatly reducing the workload of rewriting code and improving development efficiency; automated migration reduces the possibility of human errors, because the code parsing and conversion process follows predefined rules and mapping relationships, avoiding errors caused by negligence or misunderstanding; by accurately mapping the source platform components to the equivalent components of the target platform, it can be ensured that the migrated interface is as consistent as possible with the original interface in terms of function and appearance; when the source platform interface changes, the same process can be used to quickly update the target platform interface, supporting rapid iteration and upgrading of products; through a structured code parsing and conversion process, the generated target platform code is clearer, easier to understand and maintain, allowing developers to more easily migrate applications from one platform to another, enhancing the cross-platform compatibility of user interface applications.
[0095] In one embodiment, if Figure 2 As shown, based on the above-mentioned method for cross-platform conversion of user interface components, the present invention also provides a device for cross-platform conversion of user interface components, including:
[0096] An evaluation module 100, for evaluating the similarity between the user interface components on the source platform and the target platform based on the trained semantic similarity model;
[0097] A determination module 200, configured to determine a mapping relationship between user interface components of a source platform and a target platform according to the similarity;
[0098] The generating module 300 is used to obtain the source platform component code, and generate the equivalent component code of the target platform according to the mapping relationship and the source platform component code.
[0099] In one implementation of the present application, the user interface component cross-platform conversion device further includes:
[0100] A data set acquisition module, used to acquire a training data set, wherein the training data set includes component description information of user interface components on a plurality of platforms and similarity labels between user interface components;
[0101] The training module is used to obtain an initial semantic similarity model, and train the initial semantic similarity model based on the component description information and the similarity label. After the training is completed, a trained semantic similarity model is obtained.
[0102] In one implementation of the present application, the component description information is obtained based on pre-collected component definitions and documents of different user interface development platforms, and the component description information includes: the name, attributes, function description and usage scenario of the user interface component.
[0103] In one implementation of the present application, the evaluation module 100 includes:
[0104] An information acquisition unit, used to acquire first component description information corresponding to the user interface component of the source platform, and second component description information corresponding to the user interface component of the target platform;
[0105] An information input unit is used to input the first component description information and the second component description information into a trained semantic similarity model to obtain the similarity between the user interface components on the source platform and the target platform.
[0106] In one implementation of the present application, the determining module 200 includes:
[0107] a component pair determination unit, configured to determine similar component pairs between a source platform and a target platform whose similarity is within a preset threshold range;
[0108] The relationship establishing unit is used to establish a mapping relationship between the user interface components of the source platform and the target platform according to the similar component pairs.
[0109] In one implementation of the present application, the user interface component cross-platform conversion device further includes:
[0110] The instruction receiving module is used to receive an adjustment instruction and adjust the mapping relationship.
[0111] In one implementation of the present application, the generating module 300 includes:
[0112] A code analysis unit, used for analyzing the component code on the source platform by using a code parser to obtain the source platform component code;
[0113] A code extraction unit, used to extract component code snippets corresponding to each interface component in the source platform component code;
[0114] The code generation unit is used to map the component code fragment to an equivalent component of the target platform according to the mapping relationship, and generate an equivalent component code of the target platform.
[0115] It should be noted that the aforementioned explanation of the embodiment of the method for cross-platform conversion of user interface components is also applicable to the device for cross-platform conversion of user interface components of this embodiment, and will not be repeated here.
[0116] The present invention discloses a device for converting user interface components across platforms, which evaluates the similarity between user interface components on a source platform and a target platform based on a trained semantic similarity model; determines the mapping relationship between the user interface components of the source platform and the target platform according to the similarity; obtains the source platform component code, and generates the equivalent component code of the target platform according to the mapping relationship and the source platform component code. The present application evaluates the similarity between user interface components on a source platform and a target platform through a trained semantic similarity model, and then can automatically generate the equivalent component code of the target platform according to the source platform component code, thereby realizing cross-platform conversion without repeatedly writing the code of the user interface component, thereby improving development efficiency.
[0117] Figure 3 A schematic diagram of the structure of a terminal provided in an embodiment of the present application. The terminal may include:
[0118] A memory 501 , a processor 502 , and a computer program stored in the memory 501 and executable on the processor 502 .
[0119] When the processor 502 executes the program, the cross-platform conversion method of the user interface component provided in the above embodiment is implemented.
[0120] Furthermore, the terminal further includes:
[0121] The communication interface 503 is used for communication between the memory 501 and the processor 502 .
[0122] The memory 501 is used to store computer programs that can be executed on the processor 502 .
[0123] The memory 501 may include a high-speed RAM memory, and may also include a non-volatile memory (non-volatile memory), such as at least one disk memory.
[0124] If the memory 501, the processor 502 and the communication interface 503 are implemented independently, the communication interface 503, the memory 501 and the processor 502 can be connected to each other through a bus and communicate with each other. The bus can be an Industry Standard Architecture (ISA) bus, a Peripheral Component (PCI) bus or an Extended Industry Standard Architecture (EISA) bus. The bus can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, only one line is used in the figure, but it does not mean that there is only one bus or one type of bus.
[0125] Optionally, in a specific implementation, if the memory 501, the processor 502 and the communication interface 503 are integrated on a chip, the memory 501, the processor 502 and the communication interface 503 can communicate with each other through an internal interface.
[0126] The processor 502 may be a central processing unit (CPU), or an application specific integrated circuit (ASIC), or one or more integrated circuits configured to implement the embodiments of the present application.
[0127] This embodiment also provides a computer-readable storage medium on which a computer program is stored. When the program is executed by a processor, the above-mentioned method for cross-platform conversion of user interface components is implemented.
[0128] In the description of this specification, the description with reference to the terms "one embodiment", "some embodiments", "example", "specific example", or "some examples" etc. means that the specific features, structures, materials or characteristics described in conjunction with the embodiment or example are included in at least one embodiment or example of the present application. In this specification, the schematic representations of the above terms do not necessarily refer to the same embodiment or example. Moreover, the specific features, structures, materials or characteristics described may be combined in any one or N embodiments or examples in a suitable manner. In addition, those skilled in the art may combine and combine the different embodiments or examples described in this specification and the features of the different embodiments or examples, without contradiction.
[0129] In addition, the terms "first" and "second" are used for descriptive purposes only and should not be understood as indicating or implying relative importance or implicitly indicating the number of technical features indicated. Therefore, a feature defined as "first" or "second" may explicitly or implicitly include at least one of the features. In the description of this application, "N" means at least two, such as two, three, etc., unless otherwise clearly and specifically defined.
[0130] Any process or method description in a flowchart or otherwise described herein may be understood to represent a module, fragment or portion of code comprising one or N executable instructions for implementing the steps of a custom logical function or process, and the scope of the preferred embodiments of the present application includes additional implementations, in which the order shown or discussed may not be followed, including performing functions in a substantially simultaneous manner or in reverse order depending on the functions involved, which should be understood by technicians in the technical field to which the embodiments of the present application belong.
[0131] The logic and / or steps represented in the flowchart or otherwise described herein, for example, can be considered as an ordered list of executable instructions for implementing logical functions, and can be embodied in any computer-readable medium for use by an instruction execution system, device or apparatus (such as a computer-based system, a system including a processor, or other system that can read instructions from an instruction execution system, device or apparatus and execute instructions), or in combination with these instruction execution systems, devices or apparatuses. For the purpose of this specification, "computer-readable medium" can be any device that can contain, store, communicate, propagate or transmit a program for use by an instruction execution system, device or apparatus, or in combination with these instruction execution systems, devices or apparatuses. More specific examples of computer-readable media (a non-exhaustive list) include the following: an electrical connection with one or N wirings (electronic devices), a portable computer disk box (magnetic device), a random access memory (RAM), a read-only memory (ROM), an erasable and programmable read-only memory (EPROM or flash memory), a fiber optic device, and a portable compact disk read-only memory (CDROM). In addition, the computer-readable medium may even be paper or other suitable medium on which the program is printed, since the program may be obtained electronically by optically scanning the paper or other medium and then editing, interpreting or otherwise processing in a suitable manner if necessary and then storing it in a computer memory.
[0132] It should be understood that the various parts of the present application can be implemented by hardware, software, firmware or a combination thereof. In the above embodiment, the N steps or methods can be implemented by software or firmware stored in a memory and executed by a suitable instruction execution system. If implemented by hardware, as in another embodiment, it can be implemented by any one of the following technologies known in the art or their combination: a discrete logic circuit having a logic gate circuit for implementing a logic function for a data signal, a dedicated integrated circuit having a suitable combination of logic gate circuits, a programmable gate array (PGA), a field programmable gate array (FPGA), etc.
[0133] A person skilled in the art may understand that all or part of the steps in the above-mentioned embodiment method may be completed by instructing related hardware through a program, and the program may be stored in a computer-readable storage medium, which, when executed, includes one or a combination of the steps of the method embodiment.
[0134] In addition, each functional unit in each embodiment of the present application may be integrated into a processing module, or each unit may exist physically separately, or two or more units may be integrated into one module. The above-mentioned integrated module may be implemented in the form of hardware or in the form of a software functional module. If the integrated module is implemented in the form of a software functional module and sold or used as an independent product, it may also be stored in a computer-readable storage medium.
[0135] The storage medium mentioned above may be a read-only memory, a magnetic disk or an optical disk, etc. Although the embodiments of the present application have been shown and described above, it can be understood that the above embodiments are exemplary and cannot be understood as limiting the present application. A person of ordinary skill in the art may change, modify, replace and modify the above embodiments within the scope of the present application.< / button>
Claims
1. A method for converting user interface components across platforms. It is characterized in that The method comprises: Evaluate the similarity between user interface components on the source and target platforms based on the trained semantic similarity model; Determine a mapping relationship between user interface components of a source platform and a target platform according to the similarity; The source platform component code is obtained, and the equivalent component code of the target platform is generated according to the mapping relationship and the source platform component code.
2. The method for cross-platform conversion of user interface components according to claim 1, It is characterized in that The training steps of the semantic similarity model include: Acquire a training data set, wherein the training data set includes component description information of user interface components on a plurality of platforms and similarity labels between user interface components; An initial semantic similarity model is obtained, and the initial semantic similarity model is trained based on the component description information and the similarity label. After the training is completed, a trained semantic similarity model is obtained.
3. The method for cross-platform conversion of user interface components according to claim 2, It is characterized in that The component description information is obtained based on pre-collected component definitions and documents of different user interface development platforms, and the component description information includes: the name, attributes, function description and usage scenario of the user interface component.
4. The method for cross-platform conversion of user interface components according to claim 1, It is characterized in that The evaluating the similarity between the user interface components on the source platform and the target platform based on the trained semantic similarity model includes: Acquire first component description information corresponding to the user interface component of the source platform and second component description information corresponding to the user interface component of the target platform; The first component description information and the second component description information are input into a trained semantic similarity model to obtain the similarity between the user interface components on the source platform and the target platform.
5. The method for cross-platform conversion of user interface components according to claim 1, It is characterized in that Determining a mapping relationship between user interface components of a source platform and a target platform according to the similarity includes: Determining similar component pairs between the source platform and the target platform whose similarity is within a preset threshold range; A mapping relationship between the user interface components of the source platform and the target platform is established according to the similar component pairs.
6. The method for cross-platform conversion of user interface components according to claim 1, It is characterized in that After determining the mapping relationship between the user interface components of the source platform and the target platform according to the similarity, the method further includes: An adjustment instruction is received, and the mapping relationship is adjusted.
7. The method for cross-platform conversion of user interface components according to claim 1, It is characterized in that The obtaining of the source platform component code and generating the equivalent component code of the target platform according to the mapping relationship and the source platform component code includes: Analyze the component code on the source platform using a code parser to obtain the component code of the source platform; Extracting component code snippets corresponding to each interface component in the source platform component code; According to the mapping relationship, the component code fragment is mapped to an equivalent component of the target platform to generate an equivalent component code of the target platform.
8. A cross-platform conversion device for user interface components, It is characterized in that The device comprises: an evaluation module, for evaluating similarities between user interface components on a source platform and a target platform based on a trained semantic similarity model; A determination module, configured to determine a mapping relationship between user interface components of a source platform and a target platform according to the similarity; The generation module is used to obtain the source platform component code and generate the equivalent component code of the target platform according to the mapping relationship and the source platform component code.
9. A terminal, It is characterized in that include: A memory, a processor, and a user interface component cross-platform conversion program stored in the memory and executable on the processor, wherein the user interface component cross-platform conversion program, when executed by the processor, implements the steps of the user interface component cross-platform conversion method as described in any one of claims 1 to 7.
10. A computer-readable storage medium, It is characterized in that The computer-readable storage medium stores a computer program, and the computer program can be executed to implement the steps of the method for cross-platform conversion of user interface components as claimed in any one of claims 1 to 7.
Citation Information
Cited By
Cross-platform kernel adaptation method
CN119311315A
Multi-platform UI adaptation method, system and device
CN120407060A
