Generating editable email components utilizing a constraint-based knowledge representation
The present disclosure relates to systems, methods, and non-transitory computer-readable media that generates editable email components by utilizing an Answer Set Programming (ASP) model with hard and soft constraints. For instance, in one or more embodiments, the disclosed systems generate editable email components from email fragments of an email file utilizing an Answer Set Programming (ASP) model. In particular, the disclosed systems extract facts for the ASP model from the email file. In addition, the disclosed systems determine rows or columns defining cells of the email file utilizing ASP hard constraints defined by a first set of ASP atoms corresponding to the facts. Moreover, the disclosed systems determine editable email component classes for the email fragments utilizing ASP soft constraints defined by ASP classification weights and a second set of ASP atoms corresponding to the facts.
1 . A method comprising:
receiving a hypertext markup language (HTML) email file comprising HTML fragments generated utilizing a first email editing application; and
generating editable email components from the HTML fragments for editing by a second email editing application incompatible with the first email editing application utilizing an Answer Set Programming (ASP) model by:
extracting facts for the ASP model from the HTML email file;
determining rows or columns defining cells of the HTML email file utilizing ASP hard constraints defined by a first set of ASP atoms corresponding to the facts;
determining editable email component classes for the HTML fragments utilizing ASP soft constraints defined by ASP classification weights and a second set of ASP atoms corresponding to the facts; and
generating the editable email components from the rows or columns defining the cells of the HTML email file and from the editable email component classes for the HTML fragments.
2 . The method of claim 1 , wherein extracting the facts for the ASP model from the HTML email file further comprises at least one of:
determining the facts based on an embedded style sheet of the HTML email file,
determining fragment width, height, or position from a browser rendering of the HTML email file, or
extracting colors or fonts from the HTML email file utilizing a computer vision library.
3 . The method of claim 1 , wherein the HTML email file is generated utilizing the first email editing application and further comprising generating the editable email components from the HTML email file for editing by the second email editing application by:
identifying incompatible labels for the HTML fragments corresponding to the first email editing application from the HTML email file;
upon determining the editable email component classes, generating labels for the HTML fragments compatible with the second email editing application; and
replacing the incompatible labels with labels compatible with the second email editing application to generate the editable email components.
4 . The method of claim 1 , wherein determining the rows or columns defining the cells of the HTML email file utilizing the ASP hard constraints comprises executing a row detection task of the ASP model by:
determining a set of row partition results utilizing the ASP hard constraints;
determining numbers of row partitions in the set of row partition results utilizing a head ASP atom; and
selecting rows defining the cells of the HTML email file utilizing an ASP objective function based on the head ASP atom.
5 . The method of claim 4 , wherein determining the set of row partition results utilizing the ASP hard constraints comprises determining the set of row partition results by utilizing the ASP model to search for possible row partitions subject to the ASP hard constraints, wherein the ASP hard constraints comprise at least one of: a number of rows hard constraint, an email element overlap hard constraint, or an element cross-row duplication hard constraint.
6 . The method of claim 1 , wherein determining editable email component classes utilizing the ASP soft constraints comprises executing an element classification task of the ASP model by, for a first ASP soft constraint, determining a first weight for an editable email component class of an email fragment of the HTML email file utilizing a first bodiless rule defined by a first ASP atom corresponding to a first email component feature and a first ASP classification weight.
7 . The method of claim 6 , wherein executing the element classification task of the ASP model further comprises for a second ASP soft constraint, determining a second weight for the editable email component class of the email fragment of the HTML email file utilizing a second bodiless rule defined by a second ASP atom corresponding to a second email component feature and a second ASP classification weight.
8 . The method of claim 7 , wherein executing the element classification task of the ASP model further comprises selecting the editable email component class for the email fragment utilizing an ASP objective function based on the first weight and the second weight.
9 . The method of claim 1 , further comprising providing the editable email components, for display, via an email editing user interface of a second email editing application, the email editing user interface comprising one or more cell elements based on the cells and one or more editing options based on the editable email component classes.
10 . A non-transitory computer-readable medium storing executable instructions which, when executed by at least one processing device, cause the at least one processing device to perform operations comprising:
receiving an HTML email file comprising HTML fragments generated utilizing a first email editing application; and
generating editable email components from the HTML fragments by a second email editing application incompatible with the first email editing application utilizing an Answer Set Programming (ASP) model by:
extracting facts for the ASP model from the HTML email file;
determining rows or columns defining cells of the HTML email file utilizing ASP hard constraints defined by a first set of ASP atoms corresponding to the facts;
determining editable email component classes for the HTML fragments utilizing ASP soft constraints defined by ASP classification weights and a second set of ASP atoms corresponding to the facts; and
generating the editable email components from the rows or columns defining the cells of the HTML email file and from the editable email component classes for the HTML fragment.
11 . The non-transitory computer-readable medium of claim 10 , further comprising instructions that, when executed by at least one processing device, cause the at least one processing device to perform operations comprising converting the HTML fragments to editable email components within the second email editing application based on the editable email component classes.
12 . The non-transitory computer-readable medium of claim 10 , wherein determining the rows or columns defining the cells of the HTML email file utilizing the ASP hard constraints comprises:
determining a set of row partition results utilizing the ASP hard constraints; and
selecting rows defining the cells of the HTML email file utilizing an ASP objective function based on the set of row partition results.
13 . The non-transitory computer-readable medium of claim 10 , wherein determining editable email component classes for the HTML fragments comprises:
for a first ASP soft constraint, determining a first weight for a first editable email component class of a first email fragment of the HTML email file utilizing a first bodiless rule defined by a first ASP atom corresponding to a first email component feature and a first ASP classification weight; and
for a second ASP soft constraint, determining a second weight for a second editable email component class of the first email fragment of the HTML email file utilizing a second bodiless rule defined by a second ASP atom corresponding to a second email component feature and a second ASP classification weight.
14 . The non-transitory computer-readable medium of claim 13 , wherein generating editable email components from the HTML email file further comprises selecting the first editable email component class for the first email fragment utilizing an ASP objective function based on the first weight for the first editable email component class and the second weight for the second editable email component class.
15 . A system comprising:
one or more memory components; and
one or more processing devices coupled to the one or more memory components, the one or more processing devices to perform operations comprising:
receiving a hypertext markup language (HTML) email file comprising HTML fragments generated utilizing a first email editing application; and
generating editable email components from the HTML fragments for editing by a second email editing application incompatible with the first email editing application utilizing an Answer Set Programming (ASP) model by:
extracting facts for the ASP model from the HTML email file;
determining rows or columns defining cells of the HTML email file utilizing ASP hard constraints defined by a first set of ASP atoms corresponding to the facts;
determining editable email component classes for the HTML fragments utilizing ASP soft constraints defined by ASP classification weights and a second set of ASP atoms corresponding to the facts; and
generating the editable email components from the rows or columns defining the cells of the HTML email file and from the editable email component classes for the HTML fragments.
16 . The system of claim 15 , wherein extracting the facts for the ASP model from the HTML email file further comprises at least one of:
determining the facts based on an embedded style sheet of the HTML email file,
determining fragment width, height, or position from a browser rendering of the HTML email file, or
extracting colors or fonts from the HTML email file utilizing a computer vision library.
17 . The system of claim 15 , wherein the HTML email file is generated utilizing the first email editing application and further comprising generating the editable email components from the HTML email file for editing by the second email editing application by:
identifying incompatible labels for the HTML fragments corresponding to the first email editing application from the HTML email file;
upon determining the editable email component classes, generating labels for the HTML fragments compatible with the second email editing application; and
replacing the incompatible labels with labels compatible with the second email editing application to generate the editable email components.
18 . The system of claim 15 , wherein determining the rows or columns defining the cells of the HTML email file utilizing the ASP hard constraints comprises executing a row detection task of the ASP model by:
determining a set of row partition results utilizing the ASP hard constraints;
determining numbers of row partitions in the set of row partition results utilizing a head ASP atom; and
selecting rows defining the cells of the HTML email file utilizing an ASP objective function based on the head ASP atom.
19 . The system of claim 18 , wherein determining the set of row partition results utilizing the ASP hard constraints comprises determining the set of row partition results by utilizing the ASP model to search for possible row partitions subject to the ASP hard constraints, wherein the ASP hard constraints comprise at least one of: a number of rows hard constraint, an email element overlap hard constraint, or an element cross-row duplication hard constraint.
20 . The system of claim 15 , wherein determining editable email component classes utilizing the ASP soft constraints comprises executing an element classification task of the ASP model by, for a first ASP soft constraint, determining a first weight for an editable email component class of an email fragment of the HTML email file utilizing a first bodiless rule defined by a first ASP atom corresponding to a first email component feature and a first ASP classification weight.