CN112307235B - Naming method and device of front-end page element and electronic equipment - Google Patents

Naming method and device of front-end page element and electronic equipment Download PDF

Info

Publication number
CN112307235B
CN112307235B CN202011325561.0A CN202011325561A CN112307235B CN 112307235 B CN112307235 B CN 112307235B CN 202011325561 A CN202011325561 A CN 202011325561A CN 112307235 B CN112307235 B CN 112307235B
Authority
CN
China
Prior art keywords
target page
page element
image
determining
name
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
CN202011325561.0A
Other languages
Chinese (zh)
Other versions
CN112307235A (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.)
Alipay Hangzhou Information Technology Co Ltd
Original Assignee
Alipay Hangzhou Information Technology 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 Alipay Hangzhou Information Technology Co Ltd filed Critical Alipay Hangzhou Information Technology Co Ltd
Priority to CN202011325561.0A priority Critical patent/CN112307235B/en
Publication of CN112307235A publication Critical patent/CN112307235A/en
Application granted granted Critical
Publication of CN112307235B publication Critical patent/CN112307235B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/50Information retrieval; Database structures therefor; File system structures therefor of still image data
    • G06F16/51Indexing; Data structures therefor; Storage structures
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/50Information retrieval; Database structures therefor; File system structures therefor of still image data
    • G06F16/55Clustering; Classification
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/50Information retrieval; Database structures therefor; File system structures therefor of still image data
    • G06F16/58Retrieval characterised by using metadata, e.g. metadata not derived from the content or metadata generated manually
    • G06F16/5866Retrieval characterised by using metadata, e.g. metadata not derived from the content or metadata generated manually using information manually generated, e.g. tags, keywords, comments, manually generated location and time information
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F18/00Pattern recognition
    • G06F18/20Analysing
    • G06F18/24Classification techniques
    • G06F18/241Classification techniques relating to the classification model, e.g. parametric or non-parametric approaches
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F40/00Handling natural language data
    • G06F40/20Natural language analysis
    • G06F40/279Recognition of textual entities
    • G06F40/289Phrasal analysis, e.g. finite state techniques or chunking
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F40/00Handling natural language data
    • G06F40/40Processing or translation of natural language
    • G06F40/58Use of machine translation, e.g. for multi-lingual retrieval, for server-side translation for client devices or for real-time translation
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/30Creation or generation of source code
    • G06F8/38Creation or generation of source code for implementing user interfaces
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V10/00Arrangements for image or video recognition or understanding
    • G06V10/70Arrangements for image or video recognition or understanding using pattern recognition or machine learning
    • G06V10/74Image or video pattern matching; Proximity measures in feature spaces
    • G06V10/75Organisation of the matching processes, e.g. simultaneous or sequential comparisons of image or video features; Coarse-fine approaches, e.g. multi-scale approaches; using context analysis; Selection of dictionaries
    • G06V10/751Comparing pixel values or logical combinations thereof, or feature values having positional relevance, e.g. template matching
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V20/00Scenes; Scene-specific elements
    • G06V20/60Type of objects
    • G06V20/62Text, e.g. of license plates, overlay texts or captions on TV images
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V30/00Character recognition; Recognising digital ink; Document-oriented image-based pattern recognition
    • G06V30/10Character recognition
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • Data Mining & Analysis (AREA)
  • Software Systems (AREA)
  • Artificial Intelligence (AREA)
  • Databases & Information Systems (AREA)
  • Computer Vision & Pattern Recognition (AREA)
  • Health & Medical Sciences (AREA)
  • General Health & Medical Sciences (AREA)
  • Evolutionary Computation (AREA)
  • Computational Linguistics (AREA)
  • Audiology, Speech & Language Pathology (AREA)
  • Multimedia (AREA)
  • Bioinformatics & Cheminformatics (AREA)
  • Computing Systems (AREA)
  • Medical Informatics (AREA)
  • Life Sciences & Earth Sciences (AREA)
  • Bioinformatics & Computational Biology (AREA)
  • Evolutionary Biology (AREA)
  • Human Computer Interaction (AREA)
  • Library & Information Science (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

One or more embodiments of the present application provide a method, an apparatus, and an electronic device for naming a front-end page element. The method includes calculating the similarity between the target page element and each image in a preset image library when the target page element is an image element. And determining the maximum similarity in the calculated similarity. And determining the names of the images in the preset image library corresponding to the maximum similarity calculation as the names of the target page elements.

Description

Naming method and device of front-end page element and electronic equipment
Technical Field
The present disclosure relates to the field of computer networks, and in particular, to a method and an apparatus for naming a front-end page element, and an electronic device.
Background
In front-end page development operations, developers often need to name front-end page elements in order to help improve the readability of the front-end page code, as well as the convenience of post-maintenance code.
Currently, when naming page elements, developers typically need to name by hand. Because the naming of the elements has strict specifications and the number of page elements included in front-end development is numerous, the naming efficiency is low in a mode of manually naming the elements, and the naming cannot strictly follow the naming specifications, naming errors and the like.
Disclosure of Invention
The application provides a naming method of a front-end page element, which comprises the following steps:
when the target page element is an image element, calculating the similarity between the target page element and each image in a preset image library;
determining the maximum similarity among the calculated similarities;
and determining the names of the images in the preset image library corresponding to the maximum similarity calculation as the names of the target page elements.
In an embodiment, the calculating the similarity between the target page element and each image in the preset image library includes:
inputting element data of the target page element into a pre-trained classification model for calculation to obtain a classification result of the target page element; the classification model is a neural network model obtained based on training of a plurality of samples marked with classification results;
searching images with the same classification result as the target page elements from a preset image library;
and calculating the similarity between the target page element and each searched image.
In an embodiment shown, the method further comprises:
when the target page element is a text element, inputting element data of the target page element into a pre-trained translation model for calculation to obtain an English character string corresponding to the target page element;
And determining the English character string as the name of the target page element.
In an embodiment shown, the method further comprises:
based on a pre-constructed mapping algorithm, the traditional Chinese characters in the target page elements are converted into simplified Chinese characters.
In an embodiment, the determining the english character string as the name of the target page element includes:
inputting the English character string into a pre-trained keyword extraction model for calculation to obtain a keyword corresponding to the English character string;
and determining the keywords as the names of the target page elements.
In an embodiment shown, the method further comprises:
and if the target page element is a container element, adding an identification indicating that the target page element is the container element in the name of the target page element.
In an embodiment, adding, to the name of the target page element, an identifier indicating that the target page element is a container element includes:
extracting keywords from the names of the elements in the container elements;
combining the keywords to obtain the names of the target page elements;
And adding an identification indicating that the target page element is a container element in the name.
The application also provides a naming device of the front-end page element, which comprises:
the calculation module is used for calculating the similarity between the target page element and each image in a preset image library when the target page element is an image element;
a first determining module for determining the maximum similarity among the calculated similarities;
and the second determining module is used for determining the names of the images in the preset image library corresponding to the maximum similarity calculation as the names of the target page elements.
In one embodiment, the computing module includes:
inputting element data of the target page element into a pre-trained classification model for calculation to obtain a classification result of the target page element; the classification model is a neural network model obtained based on training of a plurality of samples marked with classification results;
searching images with the same classification result as the target page elements from a preset image library;
and calculating the similarity between the target page element and each searched image.
In one embodiment shown, the apparatus further comprises:
The model calculation module inputs element data of the target page element into a pre-trained translation model for calculation when the target page element is a text element, and an English character string corresponding to the target page element is obtained;
and a third determining module for determining the English character string as the name of the target page element.
In one embodiment shown, the apparatus further comprises:
and the conversion module is used for converting the traditional Chinese characters in the target page elements into simplified Chinese characters based on a pre-constructed mapping algorithm.
In an embodiment shown, the third determining module includes:
inputting the English character string into a pre-trained keyword extraction model for calculation to obtain a keyword corresponding to the English character string;
and determining the keywords as the names of the target page elements.
In one embodiment shown, the apparatus further comprises:
and the adding module is used for adding an identifier indicating that the target page element is the container element in the name of the target page element if the target page element is the container element.
In one embodiment, the adding module includes:
Extracting keywords from the names of the elements in the container elements;
combining the keywords to obtain the names of the target page elements;
and adding an identification indicating that the target page element is a container element in the name.
According to the technical scheme, on the one hand, when the element is an image element, the system can calculate the similarity between the target page element and each image in a preset image library, and determine the name of the image corresponding to the maximum similarity in the calculated similarity in the preset image library as the name of the target page element.
On the other hand, when the element is a text element, the system may extract a keyword from the text element and use the extracted keyword as a name of the text element.
In still another aspect, when the element is a container element, the system may add an identifier indicating that the target page element is a container element to the name of the target page element, so as to implement naming for the container element.
Therefore, the element naming method disclosed by the application can realize automatic naming of the elements, so that the element naming efficiency, the element naming standardization and the correctness are improved, and the problems that the naming efficiency is low, naming standards cannot be strictly complied with during naming, naming errors are avoided.
Drawings
FIG. 1 is a method flow diagram of a method for naming a front-end page element shown in the present application;
FIG. 2 is a method flow diagram of a text element naming method shown in the present application;
FIG. 3 is a method flow diagram of a container element naming method shown in the present application;
FIG. 4 is a block diagram of a naming apparatus for a front page element shown in the present application;
fig. 5 is a hardware structure diagram of a naming device of a front-end page element shown in the present application.
Detailed Description
Reference will now be made in detail to exemplary embodiments, examples of which are illustrated in the accompanying drawings. When the following description refers to the accompanying drawings, the same numbers in different drawings refer to the same or similar elements, unless otherwise indicated. The implementations described in the following exemplary examples are not representative of all implementations consistent with the present application. Rather, they are merely examples of apparatus and methods consistent with some aspects of the present application as detailed in the accompanying claims.
The terminology used in the present application is for the purpose of describing particular embodiments only and is not intended to be limiting of the present application. As used in this application and the appended claims, the singular forms "a," "an," and "the" are intended to include the plural forms as well, unless the context clearly indicates otherwise. It should also be understood that the term "and/or" as used herein refers to and encompasses any or all possible combinations of one or more of the associated listed items. It will also be appreciated that the term "if," as used herein, may be interpreted as "at … …" or "at … …" or "responsive to a determination," depending on the context.
The application aims to provide a naming method of a front-end page element, so that when the name of the page element is determined, a page element name determining system realizes naming for different types of page elements, and the problems that naming efficiency is low, naming standards cannot be strictly complied with, naming errors are avoided when the naming is performed due to manual participation.
The technical scheme disclosed in the application is described below with reference to specific embodiments.
Referring to fig. 1, fig. 1 is a flowchart of a method for naming a front-end page element according to the present application. The method is applied to a page element naming system. As shown in fig. 1, the method includes:
s102, when the target page element is an image element, calculating the similarity between the target page element and each image in a preset image library.
S104, determining the maximum similarity in the calculated similarity.
And S106, determining the names of the images in the preset image library corresponding to the maximum similarity calculation as the names of the target page elements.
The page element naming system (hereinafter referred to as "system") may be a piece of logic code installed in a terminal device. The page element naming system needs to provide computing power by the terminal device mounted therein when executing the element extraction method as an execution subject.
In practical applications, the system can provide an interaction platform for interacting with a developer. Through the interactive platform, on one hand, a developer can provide page elements to be named to the system and initiate related instructions for naming the page elements to the system; on the other hand, when naming the page element is finished, the system can output the named page element to the developer.
The front page image is specifically a page image designed by a page image designer. In practical situations, when developing a front-end page, a developer usually needs to refer to a page image designed by a page image designer to develop the front-end page, so that the display effect of the finally developed front-end page can be the same as that of the page image.
The above-mentioned front page element (hereinafter referred to as "element"), which is specifically a main constituent part constituting the front page, may include an image element, a text element, and a container element.
The image element specifically refers to an element including content that is an image.
The text element specifically refers to an element including text. Wherein, the characters may comprise traditional or simplified characters.
The container element specifically refers to an element set composed of a plurality of elements. In practice, several image elements may constitute one container element. Several text elements may constitute one container element. The text elements and the image elements may also together form a container element.
It will be appreciated that in practical applications, the naming convention for the different types of elements will also be different. Thus, in performing element naming, it is necessary to determine the element type of an element.
In one embodiment, when a developer needs to name an element, the developer may provide the element and the element type of the element to the system through an interaction platform provided by the system.
For example, the interactive platform may provide a window for a developer to input the element type of the element to be named. When the developer provides the element data of the element to the system, the developer may also input the element type of the element in the window to identify the element type by the system.
In another embodiment, to improve element naming efficiency, and accuracy. When a developer needs to name a certain element, the developer can only provide the element to the system through the interaction platform provided by the system.
In the above case, the system may automatically recognize the element type of the element.
In one implementation manner, when the element type of the element is identified, the system may first perform OCR recognition on the element data corresponding to the element to obtain a recognition result corresponding to the element, and then determine the element type of each element according to the recognition result.
Before introducing specific steps, the present application first introduces the principle of determining element types by OCR recognition.
OCR (Optical Character Recognition ) technology, specifically, technology that directly converts text content on images and photographs into editable text. The principle is that the image characteristics of the target image are compared with the image characteristics of the Chinese characters in the existing Chinese character library, and the Chinese characters which are most matched with the image characteristics of the target image are output as the recognition results, and the recognition confidence of the recognition results is achieved. The recognition confidence may indicate a degree of similarity between the image feature of the target image and the recognition result to some extent.
For example, if the text content included in the target image is "medium", the recognition confidence of the recognition result obtained after OCR detection will be higher because the target image includes exactly one kanji. The specific content included in the target image is assumed to be a pattern similar to a Chinese character, and at this time, after OCR recognition is performed on the target image, although a corresponding recognition result can be obtained, since the specific content included in the target image is only a pattern similar to a Chinese character, the recognition confidence is relatively low.
It can be seen that, when determining the element type of the element by means of OCR recognition, the element type of the element may be determined by determining whether the recognition confidence corresponding to the recognition result reaches a preset threshold after OCR recognition is performed on the element image of the element. The preset threshold may be specifically set by a developer according to experience, or trained through a large number of samples, which is not limited herein. When the identification confidence coefficient reaches the preset threshold value, determining that the element type of the element is a text element; otherwise, determining the element type of the element as the image element.
It will be appreciated that in the above case, if a plurality of recognition results are obtained after OCR recognition for the above element, the above element is described as a plurality of text elements or a set of image elements, and it may be determined that the above element is a container element.
In another embodiment, when determining the element type of the element, the system may input the element data corresponding to the element into a pre-trained classifier to perform calculation, and determine the element type of the element based on a calculation result.
The classifier is specifically obtained by training based on a plurality of element image samples marked with element types; the element types include image elements, text elements, and container elements.
It should be noted that the structure and type of the classifier are not limited herein. The classifier may be a multi-classifier constructed based on a neural network.
The image library may specifically be a preconfigured image library. The above-described image library may typically include several named images (images named according to a naming convention).
In practical applications, in order to store images in a standardized manner and improve naming accuracy, the images included in the image library may be stored in a classified manner. For example, the image library may be divided into several storage spaces; wherein each memory space may store images of the same image type.
In one way of configuring an image library, a developer may obtain an image collection comprising a number of common element images. Then, the developer can name each image in the image set according to the naming standards, classify the named images (manually or by a classifier), and store the images in the storage space corresponding to the image library. It will be appreciated that the configured image library may be repeatedly duplicated and used, and need not be configured each time a target element is named. Of course, the configured image library may be updated. For example, adding a new image or updating the name of an existing image, etc.
When it is determined that the target element is an image element, the system may execute S102 to calculate a similarity between the target element and each image in the preset image library.
In an embodiment, when calculating the similarity between the target element and each image in the preset image library, the system may sort the element data of the target element into a feature vector form, so as to facilitate similarity calculation.
For example, the system may first extract image features (e.g., harris corner points or SIFT features) of the target element and form corresponding feature vectors.
Thereafter, the system may perform the following steps S1022 to S1028 for each image in the preset image library:
s1022, extracting image features of the image to form feature vectors.
S1024, after extracting the feature vectors, calculating the Euclidean distance between the feature vectors corresponding to the image and the feature vectors corresponding to the target elements, and counting the number of the feature vectors with the Euclidean distance smaller than a preset reference threshold.
And S1026, mapping the number of the feature vectors included in the counted image and the feature vectors included in the target element into the similarity between the image and the target element through a preset mapping algorithm (for example, a normalization or standardization algorithm) by using the number that the Euclidean distance between the feature vectors included in the counted image and the feature vectors included in the target element is smaller than a preset reference threshold.
S1028, recording the corresponding relation between the similarity of the mapping and the image.
Here, the method of calculating the similarity is not limited in this application. For example, the method for calculating the similarity may also be a method for calculating cosine distance, manhattan distance, mahalanobis distance, etc. between feature vectors.
After the steps are completed for each image in the preset image library, the system obtains the similarity between the target element and each image, and the correspondence between the similarity and each image.
Then, the system may perform S104-S106 to determine a maximum similarity among the calculated similarities, and determine a name of an image in the preset image library corresponding to the maximum similarity as a name of the target page element.
In an embodiment, to improve the efficiency of determining the maximum similarity, the system may push the obtained similarity into a large top heap (where a value corresponding to each parent node in the large top heap is greater than or equal to a value corresponding to its left and right child nodes). The system may then read the similarity stored in the root node of the large top heap and determine the read similarity as a maximum similarity.
It will be appreciated that since the characteristics of the large top heap are such that the value corresponding to each parent node is greater than or equal to the value corresponding to its left and right child nodes, the root node of the large top heap records the maximum value maintained in the large top heap. It can be seen that the similarity stored in the root node of the large top heap is the maximum similarity among the obtained similarities.
When the maximum similarity is determined, the system may determine an image corresponding to the maximum similarity from the recorded correspondence. After determining the image, the system may determine a name of the image as a name of the target element.
The system thus completes naming the target element.
According to the technical scheme, when the front-end page element is named, the system can calculate the similarity between the target page element and each image in the preset image library, and determine the name of the image corresponding to the maximum similarity in the calculated similarity in the preset image library as the name of the target page element, so that the automatic naming of the element can be realized, the naming efficiency of the element, the naming standardization and the correctness of the element are improved, and the problems that the naming efficiency is low due to manual participation, the naming standardization cannot be strictly adhered to during naming, the naming error and the like are avoided.
In an embodiment, in order to improve naming accuracy, when executing S102 to calculate the similarity between the target page element and each image in the preset image library, the system may first input the element data of the target page element into a pre-trained classification model for calculation, so as to obtain a classification result of the target page element.
The classification model is a neural network model trained based on a plurality of samples marked with classification results.
When the classification model is trained, a plurality of sample data marked with classification results can be acquired first. After a plurality of sample data are acquired, the sample data can be input into a classification model for iterative training until the classification model converges. At this time, the converged classification model may be used as a trained classification model.
After determining the image type of the target element, the system may search the image with the same classification result as the target page element from a preset image library, and then calculate the similarity between the target page element and each searched image.
In one mode, when searching for the image identical to the classification result of the target page element, the system may directly read the image recorded in the storage space corresponding to the classification result.
In another mode, when searching the image with the same classification result as the target page element, the system may input the image data of each image in the preset image library into the classification model to perform calculation, so as to obtain the image type of each image. The system may then determine an image of the same image type as the image type of the target element as the same image as the classification result of the target page element.
After determining the similarity between the target element and each image, the system may continue to execute S104-S106 to determine a maximum similarity among the calculated similarities; the names of the images in the preset image library corresponding to the maximum similarity calculation are determined as the names of the target page elements (the detailed steps are referred to in the foregoing and will not be described in detail).
In this embodiment, since the system determines, among images of the same type as the image of the target element, the image most similar to the target element, and uses the name of the most similar image as the name of the target element, the element naming accuracy can be improved.
Referring to fig. 2, fig. 2 is a method flowchart of the text element naming method shown in the present application.
When it is determined that the target element is a text element, as shown in fig. 2, the system may first perform complex conversion on the text content of the text element.
In practical application, the mapping algorithm for converting the traditional Chinese characters into the simplified Chinese characters can be pre-installed in the system. Through the mapping algorithm, the system can convert the traditional Chinese characters in the text elements into simplified Chinese characters.
For example, the mapping algorithm may be an algorithm for converting a traditional Chinese character constructed based on the hanlp tool into a simplified Chinese character. After receiving the text content of the text element, the algorithm can divide the text content according to the characters, then detect whether the divided characters are traditional characters one by one, and if so, convert the characters into corresponding simplified characters for output; if not, the divided characters are directly output. After the complex conversion is performed for each divided group, the algorithm may recombine the output simplified words into the text content of the text element.
Here, the present application is not limited to the mapping algorithm described above.
After the text elements after complex and simple conversion are obtained, the system can input element data of the target page elements into a pre-trained translation model for calculation to obtain English character strings corresponding to the target page elements.
In practical application, the system can be preloaded with a trained translation model. The translation model can convert the input Chinese text content into English text content.
For example, the translation model may be a seq2 seq-based NLP (Natural Language Processing ) model. After receiving the text content of the text element, the model may divide the text content according to the text, and then semantically encode the divided text as input to obtain a vector corresponding to the text content. After the semantic encoding is completed, the vectors may be decoded into english text content based on the semantic encoding and an english word stock.
Here, the present application is not limited to the translation model described above.
After converting the text content of the text element into english text content (text content composed of english character strings), the system may select a plurality of keywords from the english text content as the names of the text elements.
In practical application, the system may be preloaded with a keyword extraction model. The keyword extraction model can be used for extracting keywords from the input English text content.
For example, the keyword extraction model may be a model constructed based on the TF-IDF algorithm. After receiving the english text content of the text element, the model may divide each word in the english text, and then count the occurrence Frequency (TF) of the divided words in the text. After counting the frequency of each word in the text, the words can be ranked by combining the frequency of each word in other English texts (IDF, inverse Documnet Frequency, inverse document frequency), and the word ranked in the first N bits is used as a keyword; wherein N is a positive integer preset according to experience.
For another example, the keyword extraction model may be a textword-based NLP model. After receiving the english text content of the text element, the model may divide each word in the english text. After obtaining the segmented words, the system can combine two adjacent segmented words two by two to obtain all possible combinations, and then calculate the connection weights between the words in the combinations. After calculating the connection weights between the words in each combination, the system can calculate the sum of the connection weights corresponding to each word, and sort the words in the English text according to the sum. At this time, the above system may use the word ranked in the top N bits as a keyword; wherein N is a positive integer preset according to experience.
Here, the keyword extraction model is not limited to the above.
After determining a keyword from the english text content of the text element, the system may determine the keyword as a name of the text element.
When the target element is determined to be the container element, the system can add an identifier indicating that the target page element is the container element in the name of the target page element.
Referring to fig. 3, fig. 3 is a method flowchart of the container element naming method shown in the present application.
When it is determined that the target element is a container element, as shown in fig. 3, the system may first determine an element type of each element included in the container element.
In practical applications, the system may determine the element types of the elements one by one using the method for determining the element types disclosed in the present application.
When only a unique text element is included in the container element, the system may name the text element in the container element using the naming method disclosed in the present application for the text element. After naming is completed, the system may add an identifier indicating that the target page element is a container element to the name of the text element, as the name of the container element. For example, the character "container" is added before the name of the text element.
When the container element includes a plurality of text elements, in one embodiment, the system may first determine the text element for naming from the container element. The system may then name the determined text element using the naming method disclosed in the present application for the text element. After naming is completed, the system may add an identifier indicating that the target page element is a container element to the name of the text element, as the name of the container element.
For example, the system may determine the first (last) text element of the container elements as the text element for naming and perform subsequent naming.
For another example, the system may determine the text element with the largest data amount in the container elements as the text element for naming, and perform subsequent naming.
For example, the text element carries an identifier indicating the importance of the text element (the larger the number indicated by the identifier is, the higher the importance of the text element is). The system may determine the text element with the largest numerical value of the identifier carried in the container element as the text element for naming, and perform subsequent naming.
Here, it should be noted that the method for determining the text element for naming may be set according to the actual situation, and is not limited herein.
In another embodiment, the system may first use the naming method for text elements disclosed in the present application to extract keywords of each text element. Then, the system may combine the keywords to obtain a combined keyword, and add an identifier indicating that the target page element is a container element to the combined keyword as a name of the container element.
In another embodiment, the system may first use the naming method for text elements disclosed in the present application to extract keywords of each text element. Then, the system may determine the most important keyword among the proposed keywords, and add an identifier indicating that the target page element is a container element to the most important keyword as a name of the container element.
For example, when determining the most important keyword, the system may input each keyword into the keyword extraction model described in the present application to perform calculation, and then use the calculation result as the most important keyword.
When only a unique image element is included in the container element, the system may name the text element in the container element using the naming method disclosed in the present application for the image element. After the naming is completed, the system may add an identifier indicating that the target page element is a container element to the name of the image element, as the name of the container element. For example, the character "container" is added before the name of the text element.
When a plurality of image elements are included in the container element, in one embodiment, the system may first determine the image element to name from the container element. The system may then name the determined image element using the naming method disclosed in the present application for the text element. After the naming is completed, the system may add an identifier indicating that the target page element is a container element to the name of the image element, as the name of the container element.
For example, the system may determine the first (last) image element of the container elements as the image element for naming, and perform subsequent naming.
For another example, the system may determine the image element with the largest data amount in the container elements as the image element for naming, and perform subsequent naming.
For example, the image element carries an identifier indicating the importance of the image element (the larger the number indicated by the identifier is, the higher the importance of the image element is). The system may determine the image element with the largest value of the identifier carried in the container element as the image element for naming, and perform subsequent naming.
Here, it should be noted that the method for determining the named image element may be set according to the actual situation, and is not limited herein.
In another embodiment, the system may determine the name of each image element by using the method for naming image elements disclosed in the present application. Then, the system may combine the names of the image elements to obtain a combined name, and add an identifier indicating that the target page element is a container element in the combined name as the name of the container element.
In another embodiment, the system may determine the name of each image element by using the method for naming image elements disclosed in the present application. Then, the system may extract a keyword from the determined names of the image elements, and add an identifier indicating that the target page element is a container element to the keyword as the name of the container element.
For example, when extracting the keyword, the system may input the name of each image element into the keyword extraction model described in the present application, calculate the name, and then use the calculation result as the keyword.
It should be noted that, when the container element includes both text elements and image elements, the naming method for the container element may refer to the foregoing, and will not be described in detail herein.
When the container element does not include any element, the system may combine an identifier indicating that the target page element is the container element with a sequence number to which the container element is assigned, and use the combined result as a name of the container element.
The sequence numbers to which the container elements are assigned may be assigned according to actual situations, and are not limited herein. For example, in one case, the sequence number to which the container elements are assigned may indicate the order in which the container elements were created. In another case, the sequence number allocated to the container element may be a manually allocated sequence number.
According to the technical scheme, on the one hand, when the element is an image element, the system can calculate the similarity between the target page element and each image in a preset image library, and determine the name of the image corresponding to the maximum similarity in the calculated similarity in the preset image library as the name of the target page element.
On the other hand, when the element is a text element, the system may extract a keyword from the text element and use the extracted keyword as a name of the text element.
In still another aspect, when the element is a container element, the system may add an identifier indicating that the target page element is a container element to the name of the target page element, so as to implement naming for the container element.
Therefore, the element naming method disclosed by the application can realize automatic naming of the elements, so that the element naming efficiency, the element naming standardization and the correctness are improved, and the problems that the naming efficiency is low, naming standards cannot be strictly complied with during naming, naming errors are avoided.
Correspondingly, the application also provides a naming device of the front-end page element. Referring to fig. 4, fig. 4 is a block diagram of a naming apparatus of a front-end page element shown in the present application.
As shown in fig. 4, the apparatus 400 may include:
the calculating module 410 calculates the similarity between the target page element and each image in the preset image library when the target page element is an image element;
the first determining module 420 determines the maximum similarity among the calculated similarities;
The second determining module 430 determines the name of the image in the preset image library corresponding to the maximum similarity as the name of the target page element.
In one embodiment, the computing module 410 includes:
inputting element data of the target page element into a pre-trained classification model for calculation to obtain a classification result of the target page element; the classification model is a neural network model obtained based on training of a plurality of samples marked with classification results;
searching images with the same classification result as the target page elements from a preset image library;
and calculating the similarity between the target page element and each searched image.
In the illustrated embodiment, the apparatus 400 further includes:
the model calculation module inputs element data of the target page element into a pre-trained translation model for calculation when the target page element is a text element, and an English character string corresponding to the target page element is obtained;
and a third determining module for determining the English character string as the name of the target page element.
In the illustrated embodiment, the apparatus 400 further includes:
And the conversion module is used for converting the traditional Chinese characters in the target page elements into simplified Chinese characters based on a pre-constructed mapping algorithm.
In an embodiment shown, the third determining module includes:
inputting the English character string into a pre-trained keyword extraction model for calculation to obtain a keyword corresponding to the English character string;
and determining the keywords as the names of the target page elements.
In the illustrated embodiment, the apparatus 400 further includes:
and the adding module is used for adding an identifier indicating that the target page element is the container element in the name of the target page element if the target page element is the container element.
In one embodiment, the adding module includes:
extracting keywords from the names of the elements in the container elements;
combining the keywords to obtain the names of the target page elements;
and adding an identification indicating that the target page element is a container element in the name.
The embodiment of the naming device of the front-end page element shown in the application can be applied to naming equipment of the front-end page element. The apparatus embodiments may be implemented by software, or may be implemented by hardware or a combination of hardware and software. Taking software implementation as an example, the device in a logic sense is formed by reading corresponding computer program instructions in a nonvolatile memory into a memory by a processor of an electronic device where the device is located for operation. In terms of hardware, as shown in fig. 5, a hardware structure diagram of a naming device of a front-end page element shown in the present application is shown, and in addition to the processor, the memory, the network interface, and the nonvolatile memory shown in fig. 5, the electronic device in which the device is located in the embodiment generally may further include other hardware according to the actual function of the electronic device, which is not described herein.
Referring to fig. 5, a naming apparatus for a front page element includes: a processor;
a memory for storing processor-executable instructions;
the processor is configured to call the executable instructions stored in the memory to implement the naming method of the front-end page element disclosed in any embodiment.
It is to be understood that the present 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.
The foregoing description of the preferred embodiments of the present application is not intended to be limiting, but rather is intended to cover any and all modifications, equivalents, alternatives, and improvements that fall within the spirit and principles of the present application.

Claims (13)

1. A method for naming a front-end page element, comprising:
determining the element type of the target page element;
when the target page element is an image element, calculating the similarity between the target page element and each image in a preset image library;
determining the maximum similarity among the calculated similarities;
Determining the names of the images in the preset image library corresponding to the calculated maximum similarity as the names of the target page elements;
when the target page element is a text element, inputting element data of the target page element into a pre-trained translation model for calculation to obtain an English character string corresponding to the target page element;
determining the English character string as the name of the target page element;
the determining the element type of the target page element comprises the following steps:
determining the element type of the target page element through the recognition confidence corresponding to the recognition result of the target page element by OCR;
the determining the element type of the target page element through the recognition confidence corresponding to the recognition result of the target page element by OCR comprises the following steps:
performing OCR (optical character recognition) on the element image data corresponding to the element to obtain a recognition result corresponding to the element;
determining whether the recognition confidence included in the recognition result reaches a preset threshold;
if yes, determining the element type of the element as a text element;
if not, determining the element type of the element as the image element.
2. The method of claim 1, wherein the calculating the similarity between the target page element and each image in the preset image library includes:
inputting element data of the target page element into a pre-trained classification model for calculation to obtain a classification result of the target page element; the classification model is a neural network model obtained based on training of a plurality of samples marked with classification results;
searching images which are the same as the classification result of the target page element from a preset image library;
and calculating the similarity between the target page element and each searched image.
3. The method of claim 1, further comprising:
and converting the traditional Chinese characters in the target page element into simplified Chinese characters based on a pre-constructed mapping algorithm.
4. The method of claim 1, the determining the english string as the name of the target page element, comprising:
inputting the English character string into a pre-trained keyword extraction model for calculation to obtain a keyword corresponding to the English character string;
and determining the keyword as the name of the target page element.
5. The method of any of claims 1-4, further comprising:
and if the target page element is a container element, adding an identification indicating that the target page element is the container element in the name of the target page element.
6. The method of claim 5, wherein adding the identifier indicating that the target page element is a container element to the name of the target page element comprises:
extracting keywords from names of elements included in the container elements;
combining the keywords to obtain the names of the target page elements;
and adding an identification indicating that the target page element is a container element in the name.
7. A naming apparatus for front-end page elements, comprising:
the identification module is used for determining the element type of the target page element;
the computing module is used for computing the similarity between the target page element and each image in a preset image library when the target page element is an image element;
a first determining module for determining the maximum similarity among the calculated similarities;
the second determining module determines the names of the images in the preset image library corresponding to the calculated maximum similarity as the names of the target page elements;
The model calculation module inputs element data of the target page element into a pre-trained translation model for calculation when the target page element is a text element, and an English character string corresponding to the target page element is obtained;
the third determining module is used for determining the English character string as the name of the target page element;
the identification module comprises:
determining the element type of the target page element through the recognition confidence corresponding to the recognition result of the target page element by OCR;
the identification module comprises:
performing OCR (optical character recognition) on the element image data corresponding to the element to obtain a recognition result corresponding to the element;
determining whether the recognition confidence included in the recognition result reaches a preset threshold;
if yes, determining the element type of the element as a text element;
if not, determining the element type of the element as the image element.
8. The apparatus of claim 7, the computing module comprising:
inputting element data of the target page element into a pre-trained classification model for calculation to obtain a classification result of the target page element; the classification model is a neural network model obtained based on training of a plurality of samples marked with classification results;
Searching images which are the same as the classification result of the target page element from a preset image library;
and calculating the similarity between the target page element and each searched image.
9. The apparatus of claim 7, further comprising:
and the conversion module is used for converting the traditional Chinese characters in the target page element into simplified Chinese characters based on a pre-constructed mapping algorithm.
10. The apparatus of claim 7, the third determination module comprising:
inputting the English character string into a pre-trained keyword extraction model for calculation to obtain a keyword corresponding to the English character string;
and determining the keyword as the name of the target page element.
11. The apparatus of any of claims 7-10, further comprising:
and the adding module is used for adding an identification indicating that the target page element is the container element in the name of the target page element if the target page element is the container element.
12. The apparatus of claim 11, the adding module comprising:
extracting keywords from names of elements included in the container elements;
combining the keywords to obtain the names of the target page elements;
And adding an identification indicating that the target page element is a container element in the name.
13. A naming apparatus for a front-end page element, comprising:
a processor;
a memory for storing the processor-executable instructions;
wherein the processor is configured to invoke executable instructions stored in the memory implementing the naming method of the front-end page element of any of claims 1 to 6.
CN202011325561.0A 2020-05-09 2020-05-09 Naming method and device of front-end page element and electronic equipment Active CN112307235B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202011325561.0A CN112307235B (en) 2020-05-09 2020-05-09 Naming method and device of front-end page element and electronic equipment

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202011325561.0A CN112307235B (en) 2020-05-09 2020-05-09 Naming method and device of front-end page element and electronic equipment
CN202010384139.6A CN111291208B (en) 2020-05-09 2020-05-09 Front-end page element naming method and device and electronic equipment

Related Parent Applications (1)

Application Number Title Priority Date Filing Date
CN202010384139.6A Division CN111291208B (en) 2020-05-09 2020-05-09 Front-end page element naming method and device and electronic equipment

Publications (2)

Publication Number Publication Date
CN112307235A CN112307235A (en) 2021-02-02
CN112307235B true CN112307235B (en) 2024-02-20

Family

ID=71021032

Family Applications (2)

Application Number Title Priority Date Filing Date
CN202011325561.0A Active CN112307235B (en) 2020-05-09 2020-05-09 Naming method and device of front-end page element and electronic equipment
CN202010384139.6A Active CN111291208B (en) 2020-05-09 2020-05-09 Front-end page element naming method and device and electronic equipment

Family Applications After (1)

Application Number Title Priority Date Filing Date
CN202010384139.6A Active CN111291208B (en) 2020-05-09 2020-05-09 Front-end page element naming method and device and electronic equipment

Country Status (2)

Country Link
CN (2) CN112307235B (en)
WO (1) WO2021227951A1 (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112307235B (en) * 2020-05-09 2024-02-20 支付宝(杭州)信息技术有限公司 Naming method and device of front-end page element and electronic equipment

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106339479A (en) * 2016-08-30 2017-01-18 深圳市金立通信设备有限公司 Picture naming method and terminal
CN107463683A (en) * 2017-08-09 2017-12-12 上海壹账通金融科技有限公司 The naming method and terminal device of code element
CN109828748A (en) * 2018-12-15 2019-05-31 深圳壹账通智能科技有限公司 Code naming method, system, computer installation and computer readable storage medium
CN109992266A (en) * 2017-12-29 2019-07-09 阿里巴巴集团控股有限公司 A kind for the treatment of method and apparatus of interface element
CN110399586A (en) * 2019-07-31 2019-11-01 深圳前海微众银行股份有限公司 Automatic processing method, device, equipment and the medium of web interface element
WO2020077895A1 (en) * 2018-10-16 2020-04-23 深圳壹账通智能科技有限公司 Signing intention determining method and apparatus, computer device, and storage medium

Family Cites Families (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20140189642A1 (en) * 2013-01-03 2014-07-03 International Business Machines Corporation Native Language IDE Code Assistance
US9978025B2 (en) * 2013-03-20 2018-05-22 Cisco Technology, Inc. Ordered-element naming for name-based packet forwarding
CN107291430A (en) * 2016-03-31 2017-10-24 富士通株式会社 Naming method and naming system
JP6881990B2 (en) * 2017-01-30 2021-06-02 キヤノン株式会社 Image processing device, its control method, and program
CN107239490B (en) * 2017-04-24 2021-01-15 北京小米移动软件有限公司 Method and device for naming face image and computer readable storage medium
AU2019346440B2 (en) * 2018-09-26 2024-09-12 Leverton Holding Llc Named entity recognition with convolutional networks
CN109508191B (en) * 2018-11-22 2022-03-22 北京腾云天下科技有限公司 Code generation method and system
CN109933528A (en) * 2019-03-11 2019-06-25 恒生电子股份有限公司 A kind of method and device of automatized script encapsulation
CN112307235B (en) * 2020-05-09 2024-02-20 支付宝(杭州)信息技术有限公司 Naming method and device of front-end page element and electronic equipment

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106339479A (en) * 2016-08-30 2017-01-18 深圳市金立通信设备有限公司 Picture naming method and terminal
CN107463683A (en) * 2017-08-09 2017-12-12 上海壹账通金融科技有限公司 The naming method and terminal device of code element
CN109992266A (en) * 2017-12-29 2019-07-09 阿里巴巴集团控股有限公司 A kind for the treatment of method and apparatus of interface element
WO2020077895A1 (en) * 2018-10-16 2020-04-23 深圳壹账通智能科技有限公司 Signing intention determining method and apparatus, computer device, and storage medium
CN109828748A (en) * 2018-12-15 2019-05-31 深圳壹账通智能科技有限公司 Code naming method, system, computer installation and computer readable storage medium
CN110399586A (en) * 2019-07-31 2019-11-01 深圳前海微众银行股份有限公司 Automatic processing method, device, equipment and the medium of web interface element

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
基于视觉词袋与文本分析的成人图像判定算法;傅泉生;董开坤;尹璐;;计算机工程与应用(04);全文 *

Also Published As

Publication number Publication date
CN111291208A (en) 2020-06-16
CN111291208B (en) 2020-11-10
WO2021227951A1 (en) 2021-11-18
CN112307235A (en) 2021-02-02

Similar Documents

Publication Publication Date Title
CN113011533B (en) Text classification method, apparatus, computer device and storage medium
CN109960724B (en) Text summarization method based on TF-IDF
EP3819785A1 (en) Feature word determining method, apparatus, and server
Hämäläinen et al. From the paft to the fiiture: a fully automatic NMT and word embeddings method for OCR post-correction
CN107229627B (en) Text processing method and device and computing equipment
CN110334209B (en) Text classification method, device, medium and electronic equipment
WO2021068683A1 (en) Method and apparatus for generating regular expression, server, and computer-readable storage medium
CN108027814B (en) Stop word recognition method and device
CN110580308A (en) information auditing method and device, electronic equipment and storage medium
WO2019028990A1 (en) Code element naming method, device, electronic equipment and medium
CN112784009B (en) Method and device for mining subject term, electronic equipment and storage medium
CN111782892B (en) Similar character recognition method, device, apparatus and storage medium based on prefix tree
CN108052509A (en) A kind of Text similarity computing method, apparatus and server
CN110263127A (en) Text search method and device is carried out based on user query word
CN111723192B (en) Code recommendation method and device
US8224642B2 (en) Automated identification of documents as not belonging to any language
CN113986950A (en) SQL statement processing method, device, equipment and storage medium
CN115953123A (en) Method, device and equipment for generating robot automation flow and storage medium
CN115146062A (en) Intelligent event analysis method and system fusing expert recommendation and text clustering
CN112307235B (en) Naming method and device of front-end page element and electronic equipment
CN113468339A (en) Label extraction method, system, electronic device and medium based on knowledge graph
CN117435189A (en) Test case analysis method, device, equipment and medium of financial system interface
CN115080748B (en) Weak supervision text classification method and device based on learning with noise label
CN116578700A (en) Log classification method, log classification device, equipment and medium
CN112446204B (en) Method, system and computer equipment for determining document label

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
REG Reference to a national code

Ref country code: HK

Ref legal event code: DE

Ref document number: 40045461

Country of ref document: HK

GR01 Patent grant
GR01 Patent grant