Detailed Description
The technical solutions of the present invention will be described clearly and completely with reference to the accompanying drawings, and it is obvious that the described embodiments are only some embodiments of the present invention, not all embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
As used herein, the terms "module," "device," and the like are intended to encompass a computer-related entity, such as but not limited to hardware, firmware, a combination of hardware and software, or software in execution. For example, a module may be, but is not limited to: a process running on a processor, an object, an executable, a thread of execution, a program, and/or a computer. For example, an application running on a computing device and the computing device may both be a module. One or more modules may reside within a process and/or thread of execution and a module may be localized on one computer and/or distributed between two or more computers.
The technical scheme of the invention is explained in detail in the following with the accompanying drawings.
Referring to FIG. 1, an exemplary flow diagram of a page display method according to one embodiment of the invention is shown.
As shown in fig. 1, the page display method provided in the embodiment of the present invention may include the following steps:
s110: and extracting page attributes from the page to be displayed.
The page display method provided by the embodiment of the invention is suitable for a scene that a user sends a webpage request through the browser, and the browser displays the page to be displayed after receiving the page to be displayed returned by the target service system.
The execution main body of the page display method provided by the embodiment of the invention can be specifically a browser with a kernel adaptation function; or a device connected to a browser.
In practical applications, the web page request sent by the browser may specifically be an http (hyper text transfer protocol) message request; correspondingly, the page to be displayed returned by the target service system may specifically be an http page. The target service system refers to a service system which is pre-accessed by a user; the user can directly access the target service system or jump to the target service system through the currently accessed service system.
In the embodiment of the present invention, the page attribute extracted from the page to be displayed may include at least one of the following: js (javascript ), css (cascading style sheet), and meta (meta) attributes.
In the embodiment of the present invention, the extraction of js, the extraction of css, and the extraction of meta attribute may adopt technical means commonly used by those skilled in the art, and are not described in detail herein.
S120: and searching out the browser kernel with the highest matching degree with the page to be displayed according to the extracted page attribute and a preset kernel selection model, and taking the browser kernel as a target rendering kernel corresponding to the page to be displayed.
Specifically, the extracted page attribute may be subjected to keyword extraction, and a keyword set corresponding to the page to be displayed is generated according to the extracted keyword.
Then, for each browser kernel, according to a Bayesian algorithm preset in the kernel selection model and a kernel selection model parameter corresponding to the browser kernel, calculating the probability of rendering the kernel by taking the browser kernel as a target when the keyword set appears, and taking the probability as the matching degree between the browser kernel and the page to be displayed. The kernel selection model parameter corresponding to the browser kernel is specifically the occurrence probability of each keyword when the browser kernel is taken as a target to render the kernel.
The rendering display effect of the browser kernel on the page to be displayed is best when the probability that the browser kernel is taken as a target rendering kernel is larger when the keyword set corresponding to the page to be displayed appears is considered.
Therefore, according to the matching degree between each browser kernel and the page to be displayed, the browser kernel with the highest matching degree with the page to be displayed can be found, and the found browser kernel is used as the target rendering kernel corresponding to the page to be displayed.
In the embodiment of the invention, the pages of the webpages of different service systems can be collected in advance; and extracting page attributes aiming at all collected pages, performing word segmentation and keyword identification on all extracted js, css and meta attributes, extracting all keywords, and setting corresponding key fields aiming at each keyword.
In this way, after the page attribute of the page to be displayed is extracted in step S110, the keyword corresponding to the key field may be extracted from the extracted page attribute for each preset key field, and if the keyword corresponding to the key field is extracted, the value of the page to be displayed on the key field is the keyword corresponding to the key field; if the keyword corresponding to the key field is not extracted, the value of the page to be displayed on the key field is represented by a specified identifier, such as "0", "none", and the like.
And forming a keyword set corresponding to the page to be displayed based on the value of the page to be displayed on each key field.
In the embodiment of the invention, the kernel selection model can comprise a preset Bayesian algorithm and pre-trained kernel selection model parameters corresponding to each browser kernel.
After generating the keyword set corresponding to the page to be displayed, selecting model parameters according to a bayesian algorithm and a kernel corresponding to the browser kernel for each browser kernel, calculating the probability of rendering the kernel by taking the browser kernel as a target when the keyword set appears, and taking the probability as the matching degree between the browser kernel and the page to be displayed.
In practical application, the kernel selection model parameter corresponding to the browser kernel refers to the occurrence probability of a keyword corresponding to each key field when the browser kernel is used as a target for rendering the kernel. Can pass through P (w)i|Kj) To indicate with the jth browser kernel KjKeyword w corresponding to ith key field in key set when rendering kernel for targetiThe probability of occurrence of.
Wherein i is an integer from 1 to n, j is an integer from 1 to m, m is the total number of the browser kernels, and n is the total number of the preset key fields.
The bayesian algorithm specifically includes the following equations (1), (2) and (3).
Wherein, P (K)j|Wn) Representing a set of keywords WnBrowser kernel K when presentjA probability of rendering a kernel for the target; p (K)j) Represents the jth browser kernel KjThe value of the occurrence probability of (2) is 1/m.
According to formula (1), formula (2), formula (3) and browser kernel KjThe corresponding kernel selection model parameter P (w)i|Kj) The keyword set W can be calculatednBrowser kernel K when presentjProbability P (K) of rendering kernel for targetj/Wn)。
In the embodiment of the invention, based on the kernel selection model parameters corresponding to each pre-trained browser kernel, namely the occurrence probability of each keyword when each browser kernel is taken as a target rendering kernel, the occurrence probability of a keyword set when different browser kernels are taken as target rendering kernels can be respectively calculated according to the formula (3). And calculating the occurrence probability of a keyword set according to the formula (2) and the occurrence probability of each browser kernel.
Then, according to the formula (1), the occurrence probability of each browser core, the occurrence probability of the keyword set when rendering the core by taking each browser core as a target and the occurrence probability of the keyword set, the probability of rendering the core by taking different browser cores as the target when the keyword set occurs is respectively calculated.
In this way, for each browser kernel, the probability of rendering the kernel with the browser kernel as a target when the keyword set appears can be used as the matching degree between the browser kernel and the page to be displayed. And finally, selecting the browser kernel with the highest matching degree as a target rendering kernel corresponding to the page to be displayed.
S130: and rendering and displaying the page to be displayed through the target rendering kernel.
In the embodiment of the present invention, after the target rendering kernel corresponding to the page to be displayed is found in step S120, the identifier of the target rendering kernel may be obtained, the browser kernel corresponding to the identifier is found from the local or cloud kernel pool according to the identifier of the target rendering kernel, and is loaded, and the page to be displayed is rendered and displayed through the loaded browser kernel.
In the embodiment of the invention, the kernel pool of the cloud and the local kernel pool are kept synchronous. For example, when the kernel pool of the cloud is changed, for example, a newly added browser kernel or a browser kernel is updated, the newly added browser kernel and/or the updated browser in the kernel pool of the cloud are synchronized to the local kernel pool.
In the embodiment of the invention, if the browser kernel corresponding to the identifier is not found from the local kernel pool, the browser kernel in the kernel pool of the cloud can be synchronized to the local kernel pool, so that the target rendering kernel can be loaded from the local kernel pool.
According to the page display method provided by the embodiment of the invention, the page attribute is extracted from the page to be displayed; according to the extracted page attributes and a preset kernel selection model, finding out a browser kernel with the highest matching degree with the page to be displayed, and taking the browser kernel as a target rendering kernel corresponding to the page to be displayed; and rendering and displaying the page to be displayed through the target rendering kernel. Therefore, the corresponding target rendering kernel can be found for the pages to be displayed from different service systems, the compatibility problem existing when a user accesses different service systems is solved, the user experience is improved, and the development cost is low.
On the basis of the above embodiment, in a page display method provided by another embodiment of the present invention, the method further includes: pre-training the kernel selection model parameter P (w) corresponding to the browser kernel according to the following modei|Kj):
From the browser kernel KjExtracting at least one page attribute from the corresponding sample page as a browser kernel KjA corresponding sample page attribute set; wherein the sample page is displayed with the browser kernel KjThe kernel is rendered for the target.
For each preset key field, extracting the key words corresponding to the key field from the sample page attribute set; if the key field is extracted, the value of the sample page on the key field is the key word corresponding to the key field; and if not, representing the value of the sample page on the key field by using a specified identifier.
For the ith key field, if the value of the sample page on the ith key field is the specified identifier, the kernel selects a model parameter P (w)i|Kj) Is 0.
If the value of the sample page on the ith key field is the key word w corresponding to the ith key fieldiThen the kernel selects the model parameter P (w)i|Kj) Comprises the following steps: the keyword w corresponding to the ith key field in the sample page attribute setiAnd the ratio of the number of occurrences of the sample page attribute set to the sum of the number of occurrences of the keywords corresponding to each key field in the sample page attribute set.
Other steps of the embodiment of the present invention are similar to those of the previous embodiment, and are not described again in the embodiment of the present invention.
According to the page display method provided by the embodiment of the invention, the kernel selection model parameters corresponding to the browser kernel are calculated based on the sample page with the browser kernel as the target rendering kernel, so that the accuracy of the adapted browser kernel can be improved, and the user experience is improved.
On the basis of the above embodiment, in a page display method provided by another embodiment of the present invention, the method further includes: and if the browser kernel is updated, according to a sample page of the kernel rendered by taking the updated browser kernel as a target, retraining the kernel selection model parameters corresponding to the browser kernel.
Considering that when the browser kernel is updated, the rendering and displaying effects of the updated browser kernel on the sample page selected when the model parameters are selected by the training kernel may also be changed.
Therefore, in order to improve the accuracy of the kernel selection model, in the embodiment of the present invention, the sample page of the rendering kernel with the updated browser kernel as the target may be reselected. And then, according to a sample page of the kernel rendered by taking the updated browser kernel as a target, retraining the kernel selection model parameters corresponding to the browser kernel.
The method for retraining the kernel selection model parameter corresponding to the browser kernel according to the sample page of the kernel rendered with the updated browser kernel as the target may adopt the training mode of the kernel selection model parameter in the above embodiment.
Other steps of the embodiment of the present invention are similar to those of the previous embodiment, and are not described again in the embodiment of the present invention.
According to the page display method provided by the embodiment of the invention, the kernel selection model parameters are updated in time, so that the effectiveness of the kernel selection model can be ensured, and the accuracy of the finally selected target rendering kernel is improved.
On the basis of the above embodiments, another embodiment of the present invention provides a page display apparatus.
Referring to fig. 2, a schematic structural diagram of a page display apparatus according to an embodiment of the present invention is shown.
As shown in fig. 2, a page display apparatus 200 according to an embodiment of the present invention may include: an attribute extraction unit 201, a kernel adaptation unit 202 and a page display unit 203.
The attribute extraction unit 201 is configured to extract a page attribute from a page to be displayed.
The kernel adaptation unit 202 is configured to find a browser kernel with a highest matching degree with the page to be displayed according to the extracted page attribute and a preset kernel selection model, and use the browser kernel as a target rendering kernel corresponding to the page to be displayed.
The page display unit 203 is configured to render and display the page to be displayed through the target rendering kernel.
In practical applications, the page display apparatus 200 provided in the embodiment of the present invention may be disposed in a browser; or the page display device 200 and the browser are independently arranged, and the page to be displayed is displayed together through the interaction between the page display device 200 and the browser. Alternatively, the units in the page display apparatus 200 may be disposed in different devices, and the display of the page to be displayed is realized through interaction between the different devices and the browser.
Optionally, the page attribute includes at least one of: java script js, cascading style sheet css, and meta attributes.
Optionally, the kernel adaptation unit 202 is specifically configured to perform keyword extraction on the extracted page attribute, and generate a keyword set corresponding to the page to be displayed according to the extracted keyword; aiming at each browser kernel, calculating the probability of rendering the kernel by taking the browser kernel as a target when the keyword set appears according to a Bayesian algorithm preset in the kernel selection model and a kernel selection model parameter corresponding to the browser kernel, and taking the probability as the matching degree between the browser kernel and the page to be displayed; the kernel selection model parameters corresponding to the browser kernel are specifically the occurrence probability of each keyword when the browser kernel is taken as a target to render the kernel; and searching the browser kernel with the highest matching degree with the page to be displayed according to the matching degree between each browser kernel and the page to be displayed.
Optionally, the kernel adaptation unit 202 may extract, for each preset key field, a keyword corresponding to the key field from the extracted page attribute; if the key word is extracted, the value of the page to be displayed on the key field is the key word corresponding to the key field; if not, the value of the page to be displayed on the key field is represented by a designated identifier; and forming a keyword set corresponding to the page to be displayed based on the value of the page to be displayed on each key field.
Alternatively, the kernel adaptation unit 202 may be according to the following formula (1), formula (2), formula (3) and browser kernel KjThe corresponding kernel selection model parameter P (w)i|Kj) Calculate a set of keywords WnBrowser kernel K when presentjProbability P (K) of rendering kernel for targetj/Wn):
Wherein m is the total number of the browser kernels, and n is the total number of the key fields; p (K)j) Denotes the jth browser kernel KjThe occurrence probability of (1/m) is taken as a value; p (w)i|Kj) Denoted as the jth browser kernel KjRendering a kernel for a target, wherein the keyword w corresponding to the ith key field in the key setiI is an integer from 1 to n, and j is an integer from 1 to m.
Optionally, the page display apparatus 200 provided in the embodiment of the present invention may further include: and a parameter training unit.
And the parameter training unit is used for training the kernel selection model parameters corresponding to each browser kernel.
Specifically, the parameter training unit may pre-train the kernel selection model parameter P (w) corresponding to the browser kernel according to the following manneri|Kj):
From the browser kernel KjExtracting at least one page attribute from the corresponding sample page as a browser kernel KjA corresponding sample page attribute set; wherein the sample page is displayed with the browser kernel KjRendering a kernel for the target; for each preset key field, extracting the key words corresponding to the key field from the sample page attribute set; if the key field is extracted, the value of the sample page on the key field is the key word corresponding to the key field; if not, the value of the sample page on the key field is represented by a specified identifier; for the firsti key fields, if the value of the sample page on the ith key field is the designated identification, the kernel selects a model parameter P (w)i|Kj) Is 0; if the value of the sample page on the ith key field is the key word w corresponding to the ith key fieldiThen the kernel selects the model parameter P (w)i|Kj) Comprises the following steps: the keyword w corresponding to the ith key field in the sample page attribute setiAnd the ratio of the number of occurrences of the sample page attribute set to the sum of the number of occurrences of the keywords corresponding to each key field in the sample page attribute set.
Optionally, in the embodiment of the present invention, the parameter training unit is further configured to, if the browser kernel is updated, re-train the kernel selection model parameter corresponding to the browser kernel according to a sample page of a rendering kernel that takes the updated browser kernel as a target.
The page display device 200 provided by the embodiment of the invention extracts the page attribute from the page to be displayed; according to the extracted page attributes and a preset kernel selection model, finding out a browser kernel with the highest matching degree with the page to be displayed, and using the browser kernel as a target rendering kernel corresponding to the page to be displayed; and rendering and displaying the page to be displayed through the target rendering kernel. Therefore, the corresponding target rendering kernel can be found for the pages to be displayed from different service systems, the compatibility problem existing when a user accesses different service systems is solved, the user experience is improved, and the development cost is low.
The embodiment of the page display device provided by the present invention can be specifically used for executing the processing flow of each method embodiment, and the functions thereof are not described herein again, and reference may be made to the detailed description of the method embodiments.
Referring to fig. 3, a physical structure diagram of an electronic device according to an embodiment of the present invention is shown. As shown in fig. 3, the electronic device 300 may include: a processor (processor)301, a memory (memory)302 and a bus 303, wherein the processor 301 and the memory 302 communicate with each other via the bus 303. The processor 301 may call the computer program in the memory 302 to perform the methods provided by the method embodiments described above, including for example:
extracting page attributes from a page to be displayed; according to the extracted page attribute and a preset kernel selection model, finding out a browser kernel with the highest matching degree with the page to be displayed, and taking the browser kernel as a target rendering kernel corresponding to the page to be displayed; and rendering and displaying the page to be displayed through the target rendering kernel.
In another embodiment, the page attribute includes at least one of:
java script js, cascading style sheet css, and meta attributes.
In another embodiment, the processor 301, when executing the computer program, implements the following method:
the method for searching the browser kernel with the highest matching degree with the page to be displayed according to the extracted page attribute and a preset kernel selection model comprises the following steps:
extracting keywords from the extracted page attributes, and generating a keyword set corresponding to the page to be displayed according to the extracted keywords;
aiming at each browser kernel, calculating the probability of rendering the kernel by taking the browser kernel as a target when the keyword set appears according to a Bayesian algorithm preset in the kernel selection model and a kernel selection model parameter corresponding to the browser kernel, and taking the probability as the matching degree between the browser kernel and the page to be displayed; the kernel selection model parameters corresponding to the browser kernel are specifically the occurrence probability of each keyword when the browser kernel is taken as a target to render the kernel;
and searching the browser kernel with the highest matching degree with the page to be displayed according to the matching degree between each browser kernel and the page to be displayed.
In another embodiment, the processor 301, when executing the computer program, implements the following method:
the extracting keywords from the extracted page attributes, and generating a keyword set corresponding to the page to be displayed according to the extracted keywords include:
aiming at each preset key field, extracting the key words corresponding to the key field from the extracted page attribute; if the key field is extracted, the value of the page to be displayed on the key field is the key word corresponding to the key field; if not, the value of the page to be displayed on the key field is represented by a designated identifier;
and forming a keyword set corresponding to the page to be displayed based on the value of the page to be displayed on each key field.
In another embodiment, the processor 301, when executing the computer program, implements the following method:
the calculating the probability of rendering the kernel by taking the browser kernel as a target when the keyword set appears according to the Bayesian algorithm preset in the kernel selection model and the kernel selection model parameters corresponding to the browser kernels respectively comprises the following steps:
selecting model parameters P (w) according to the following formula (1), formula (2), formula (3) and corresponding kernels of the browser kernelsi|Kj) Calculate a set of keywords WnBrowser kernel K when presentjProbability P (K) of rendering kernel for targetj/Wn):
Wherein m is the total number of the browser kernels, and n is the total number of the key fields; p (K)j) Denotes the jth browser kernel KjThe occurrence probability of (1/m) is taken as a value; p (w)i|Kj) Denoted as the jth browser kernel KjRendering a kernel for a target, wherein the keyword w corresponding to the ith key field in the key setiI is an integer from 1 to n, and j is an integer from 1 to m.
In another embodiment, the processor 301, when executing the computer program, implements the following method:
the method further comprises the following steps:
pre-training the kernel selection model parameter P (w) corresponding to the browser kernel according to the following modei|Kj):
From the browser kernel KjExtracting at least one page attribute from the corresponding sample page as a browser kernel KjA corresponding sample page attribute set; wherein the sample page is displayed with the browser kernel KjRendering the kernel for the target;
for each preset key field, extracting the key words corresponding to the key field from the sample page attribute set; if the key field is extracted, the value of the sample page on the key field is the key word corresponding to the key field; if not, the value of the sample page on the key field is represented by a specified identifier;
for the ith key field, if the value of the sample page on the ith key field is the designated identifier, the kernel selects a model parameter P (w)i|Kj) Is 0;
if the value of the sample page on the ith key field is the key word w corresponding to the ith key fieldiThen the kernel selects the model parameter P (w)i|Kj) Comprises the following steps: the keyword w corresponding to the ith key field in the sample page attribute setiAnd the ratio of the number of occurrences of the sample page attribute set to the sum of the number of occurrences of the keywords corresponding to each key field in the sample page attribute set.
In another embodiment, the processor 301, when executing the computer program, implements the following method:
the method further comprises the following steps:
and if the browser kernel is updated, according to a sample page of the kernel rendered by taking the updated browser kernel as a target, retraining the kernel selection model parameters corresponding to the browser kernel.
The electronic equipment provided by the embodiment of the invention at least has the following technical effects: extracting page attributes from a page to be displayed; according to the extracted page attributes and a preset kernel selection model, finding out a browser kernel with the highest matching degree with the page to be displayed, and using the browser kernel as a target rendering kernel corresponding to the page to be displayed; and displaying the page to be displayed through the target rendering kernel. Therefore, for the pages to be displayed and rendered from different service systems, the corresponding target rendering kernel can be found, the compatibility problem existing when a user accesses different service systems is solved, the user experience is improved, and the development cost is low.
An embodiment of the present invention discloses a computer program product, which includes a computer program stored on a non-transitory computer readable storage medium, the computer program including program instructions, when the program instructions are executed by a computer, the computer can execute the methods provided by the above method embodiments, for example, the method includes:
extracting page attributes from a page to be displayed; according to the extracted page attributes and a preset kernel selection model, finding out a browser kernel with the highest matching degree with the page to be displayed, and using the browser kernel as a target rendering kernel corresponding to the page to be displayed; and rendering and displaying the page to be displayed through the target rendering kernel.
An embodiment of the present invention provides a non-transitory computer-readable storage medium, where the non-transitory computer-readable storage medium stores a computer program, where the computer program causes the computer to execute the method provided by the foregoing method embodiments, for example, the method includes:
extracting page attributes from a page to be displayed; according to the extracted page attributes and a preset kernel selection model, finding out a browser kernel with the highest matching degree with the page to be displayed, and using the browser kernel as a target rendering kernel corresponding to the page to be displayed; and rendering and displaying the page to be displayed through the target rendering kernel.
In addition, the logic instructions in the memory may be implemented in the form of software functional units and stored in a computer readable storage medium when the logic instructions are sold or used as independent products. Based on such understanding, the technical solution of the present invention may be embodied in the form of a software product, which is stored in a storage medium and includes instructions for causing a computer device (which may be a personal computer, a server, or a network device) to execute all or part of the steps of the method according to the embodiments of the present invention. And the aforementioned storage medium includes: a U-disk, a removable hard disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk or an optical disk, and other various media capable of storing program codes.
The above-described embodiments of the apparatus are merely illustrative, and the units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of this embodiment. One of ordinary skill in the art can understand and implement it without inventive effort.
Through the above description of the embodiments, those skilled in the art will clearly understand that each embodiment may be implemented by software plus a necessary general hardware platform, and may also be implemented by hardware. With this understanding in mind, the above-described technical solutions may be embodied in the form of a software product, which can be stored in a computer-readable storage medium, such as ROM/RAM, magnetic disk, optical disk, etc., and includes instructions for causing a computer device (which may be a personal computer, a server, or a network device, etc.) to execute the methods according to the various embodiments or some parts of the embodiments.
Finally, it should be noted that: the above examples are only intended to illustrate the technical solution of the present invention, and not to limit it; although the present invention has been described in detail with reference to the foregoing embodiments, it will be understood by those of ordinary skill in the art that: the technical solutions described in the foregoing embodiments may still be modified, or some technical features may be equivalently replaced; and such modifications or substitutions do not depart from the spirit and scope of the corresponding technical solutions of the embodiments of the present invention.