Given that one website has a particular style and another has another style, could a style transfer be done such that the style of one website was transferred to the other website?

Or in a more simple case, consider just part of a website, a box.


The correct way for website styling to be encapsulated and centralized is through the use of one or more CSS style sheets. For instance, the old tag is frowned upon and using a text-align:center directive a proper class or ID based CSS selector is considered the proper way. In such a case, the copying of a style is simply done by the copying of the appropriate style sheet file.

The place where AI and/or machine learning tools may be best used is in the conversion of non-CSS styling to CSS styling. Once they are in that form, the copying and layering of styling becomes trivial.

To convert a legacy web site to proper CSS style sheet use, the input would be a set of all documents likely to be involved in the styling of a specific page (i.e. its style dependencies). The output would be a set of corresponding documents with the styling moved into classes and IDs that remove styling redundancy (simplify and centralize the style).

The transformation of the document set could be best accomplished with current technique through transformations, much like code refactoring in typical IDE refactoring algorithms in that the output document set must be functionally the same as the input document set. Furthermore, the appearance and responsive (size sensitive) aspects must be preserved in addition to functionality.

The greatest usability could be obtained by adding some automation to these refactoring transformations, as in Maxima simplification functions like trigsimp. This is a typical search of options, perhaps with predictive branching, as in compiler optimizations.

The transformations, to guarantee preservation of function and appearance must essentially be elementary equivalent transformations, but the selection of transformation would probably need to be more advanced than basic antecedent and consequence productions.

Heuristically meta rules, fuzzy logic, neural nets, Bayesian inference, or other tools could be compared in terms of effectiveness in the realm of prioritizing transformations and in terms of scoring results in the search leaves. Here's where machine learning would probably be necessary to have a truly useful tool.

Training could be accomplished through use of an array of input document sets and the careful scoring of transformations and/or outputs of trials could be performed with a software engineer with appropriate expertise in AI and/or machine learning, in conjunction with a CSS expert or a focus group containing two or more of them.

Once this process and the resulting rule set works, it would then be possible to simplify the CSS further by finding styling redundancy across pages and doing transformations that reduce an entire site to a minimal set of style sheets and style specifications within them.

Combining such tools with a simple crawler like wget could permit the copying of a desirable web site style as a starting point for another web site's styling, drastically cutting down the time to create a properly CSS styled result.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.