<!DOCTYPE article PUBLIC "-//NLM//DTD JATS (Z39.96) Journal Archiving and Interchange DTD v1.0 20120330//EN" "JATS-archivearticle1.dtd">
<article xmlns:xlink="http://www.w3.org/1999/xlink">
  <front>
    <journal-meta />
    <article-meta>
      <title-group>
        <article-title>Branching Alignment based Synthesis of Regular Expressions</article-title>
      </title-group>
      <contrib-group>
        <contrib contrib-type="author">
          <string-name>Andreas Scherbakov andreas@softwareengineer.pro</string-name>
          <xref ref-type="aff" rid="aff0">0</xref>
        </contrib>
        <aff id="aff0">
          <label>0</label>
          <institution>The University of Melbourne</institution>
        </aff>
      </contrib-group>
      <abstract>
        <p>We propose a novel Multiple Sequence Alignment algorithm which is able to build an optimized branching graph given a set of positive matching sample strings. The algorithm is principally based on Minimum Edit Distance approach being applied incrementally. However, we essentially extended the set of edit operations. The newly added operations allow implementing an acyclic graph drawing feature. The feature yields a better visual and appropriate representation of partial alignment gaps between sample strings. For instance, it may produce an /abc|de[fg]/ regular expression from a set of "abc", "def", "deg" strings. For further optimization, we adjust edit penalties based on character class hierarchy. The algorithm may be used in Bioinformatics as well as for extracting Regular Expressions (RE, patterns) from sets of observed or prospective documents (that may be useful in Web data mining, Spam ltering, RE design advisory tools and so on). This paper also considers integration of the proposed algorithm into a full stack Regular Expression extraction ow, particularly, in conjunction to Repetition detection.</p>
      </abstract>
      <kwd-group>
        <kwd>Regular expression</kwd>
        <kwd>Sequence</kwd>
        <kwd>Alignment</kwd>
        <kwd>Multiple Sequence Alignment</kwd>
        <kwd>Alignment Gap</kwd>
        <kwd>Regular expression synthesis</kwd>
        <kwd>Regular expression extraction</kwd>
        <kwd>Pattern extraction</kwd>
        <kwd>Hammock graph</kwd>
        <kwd>Branching Regular Expression</kwd>
        <kwd>Edit Distance</kwd>
        <kwd>Character class</kwd>
      </kwd-group>
    </article-meta>
  </front>
  <body>
    <sec id="sec-1">
      <title>-</title>
      <p>
        Regular expressions (RE) are used widely in various applications for the text
data processing. While in many cases the pattern a developer or analyst intends
to establish is clear and formally well de ned, there are many areas where
regular expressions used to recognize and mine a piece of text that is similar to
some sample [6]. Examples are Web data mining, Spam ltering,
Bioinformatics, State machine analysis and plenty of others. In these cases building and
testing a proper RE becomes technically challenging. Algorithms that generate
a RE that matches large number of samples are of high demand in these areas.
Also, such algorithms may provide priceless help to those application developers
who want to obtain necessary RE patterns just by supplying several matching
samples rather than by deepening into RE building details [7]. There exist a
lot of software tools aiding the regular expression building of blocks and testing
but few applications that generate a RE from samples. Examples of the latter
presented in [11],[2],[4],[3] employ genetic algorithms or Machine Learning
approaches directly to the block composition. In order to take an advantage of such
an universal approach, (
        <xref ref-type="bibr" rid="ref1">1</xref>
        ) one needs a big bunch of samples, as every possible
usage of building block adds a feature while the number of test examples should
be su cient to learn e ciently against that number of features [1]; (
        <xref ref-type="bibr" rid="ref2">2</xref>
        ) a set of
negative examples should be provided as well as a set of positive ones which
often does mean extra human work in designing negative samples. Also, character
abstraction rules are mostly beyond user's control.
      </p>
      <p>There are approaches that attempt to build an optimal automaton to
satisfy a given input sequence [5]. They do produce regular expressions solely of
positive samples. However, they are focused on repeated subsequence extraction
while don't mind possible alignments and splitting branches for more neat
representation. In this paper we propose an algorithm that performs alignment and
partial join of input samples. Please note that the repetition extraction itself is
generally beyond our discussion scope here, although being a part of the
proposed technique. In a short word, the new algorithm performs fuzzy alignment
of samples and produces branches while leaving the repetition extraction to an
external method.</p>
      <p>Our major motivation was producing regular expressions for advising
programmers and users and for assisting human's work in areas where a content
schema isn't much strict and clear. Following this, we pay attention to make a
RE concise while adjustable both in terms of look and feel and of degrees of
freedom (perplexity).
2</p>
    </sec>
    <sec id="sec-2">
      <title>Representation of Regular Expressions</title>
      <p>2.1</p>
      <p>Hammock Graph
fork</p>
      <p>4
k
[ij]
3
5
0
\d
join
6
transition
+ bypass
bypass</p>
      <p>zero
transition
Non-exhaustive examples of possible/impossible
new branches which might be added next time</p>
      <p>Fig. 1. An example of regular expression graph</p>
      <p>For the purposes of our algorithm, a regular expression is represented as
a directed acyclic graph (Fig. 1). More precisely, as a "hammock graph" [14],
allowing exactly one entrance and one exit to each area. A node of such a graph
is referred to as a RE position , while an edge as a RE transition (there
may be normal transitions that correspond to a character place as well as zero
transitions shunting constructs like /(abc)?/). For the simplicity, in the current
paper a graph is assumed to be sorted and having all positions enumerated with
a continuous [0::N ] integer range.</p>
      <p>We refer to a sub-graph between some entrance position and some exit
position as a hammock . Thus, for example, all edges in a plain chain are hammocks.
Hammocks of course may be nested. The way from a hammock's entrance
position to it's exit is referred as a bypass. An entrance or exit position shared by
multiple hammocks is referred as a fork or join position, respectively.
2.2</p>
      <p>Character Selection</p>
      <p>We represent every character place in a RE by a character selection . A
character selection is both considered as a concrete character set and as a set
of character classes that t it. A character set in our scope means all characters
really falling to this place in some sample string(s). A character class is en
entity that corresponds to some prede ned group of characters while also
(optionally) restricts the maximum variety of participating characters. For example,
a character class with [a z] character group and maximum allowed variety of 2
matches possible character selection of [ax] but doesn't match the [axz] due to
the variety exceeding. The choice of character classes and their parameters
essentially a ects the resulting regular expression look and actually represents the
user preferences that cannot be deducted from a limited number of samples (like
whether should we display [123] or nd for a concrete selection of digits at some
RE element). Thus, character classes are considered to be user-de ned
parameters in our algorithm. The only mandatory requirement is that every character
should belong to at least one class. Every character class is attributed with a
class cost. The class cost may be treated as an inverse metric to the prettiness of
a class occurrence in a resulting expression record. The cost of a character
selection is de ned as the minimum cost of a character class containing all characters
selected.</p>
      <p>sel(chars) =</p>
      <p>
        min
cls2charClasses
8chcalsr:2mcahxaVrsa!recthyar2cls:chars
jjcharsjj
class(cls)
(
        <xref ref-type="bibr" rid="ref1">1</xref>
        )
When we consider an option to add (merge) a new character to a selection (for
example, /ab/ + /ac/ ! /a[bc]/ { adding the second character `c' into a
position previously occupied by just one character `b'), we must calculate the
selection cost both before and after the planned merge. That (non-negative)
di erence will be the merge cost used in a dynamic programming procedure
described below.
      </p>
      <p>merge(chars; c) =
sel(chars [ fcg)
sel(chars)
As a variant, a character class match may be additionally rewarded by
substituting a zero resulting value with some negative one:</p>
      <p>
        If
merge = 0 then
merge :=
match &lt; 0
(
        <xref ref-type="bibr" rid="ref2">2</xref>
        )
(
        <xref ref-type="bibr" rid="ref3">3</xref>
        )
3
      </p>
    </sec>
    <sec id="sec-3">
      <title>Branching Alignment algorithm</title>
      <p>In order to produce a regular expression from a set of samples, we rst merge
the samples into a hammock graph. The core part of our alignment algorithm
generally looks like an extension of well known Minimum Edit Distance method
[13]. The procedure incrementally transforms the current RE r, attempting to
align it to the next sample s with the minimum penalty score. We use a dynamic
programming algorithm that optimizes the total cost of regular expression
modi cation choosing the best alignment between r and s positions. In order to get
a nal RE, we start with some input sample as an initial RE and then merge all
other samples one by one into it.</p>
      <p>Note. The resulting expression look may depend on the order of sample string
merging. Although the e ect of ordering yet needs exploration, our experiments
showed that following a longer rst, shorter next order ensures an optimal
alignment or a good approximation to it in vast majority of cases.</p>
      <p>Our algorithm adds a new operation to the original operation set consisting of
deletion, insertion and substitution. This new operation enables drawing a new
graph branch instead of mere aligning characters between two given positions
whenever it seems to yield better score. Table 1 displays the list of possible
atomic editing events available at a given (i; j) combination where i is the
target position in r while j is the number of processed characters of s.</p>
      <p>We associate two cumulative costs, JL(i; j) and JS (i; j), to every possible
(i; j) pair. Initially, JL(0; 0) = 0 while all other JL(i; j) and JL(i; j) are set
to +1. (Subscripts L ans S near J stand for the `light' and `shadow' words,
respectively). The di erence between JL and JS lays in the fact that the former
immediately correspond to some position in r while the latter points to a bypass
connection position inside a potential new branch coming "over" ith position in
current RE. For example, if r was /ab/, s is "cd" and r will be /(ab)j(cd)/
then JS (1; 1) may refer to a connection point between a bypass "over" `a' and a
bypass "over" `b'.</p>
      <p>We ll matrices of JL and JS for all possible positions [0::M ] [0::N ] iterating
positions in any convenient non-decreasing order. We use the following equations
in order to take all possible edit events at (i; j) point into account.
8&gt; JL(t:src; j 1) + insert; if j &gt; 1
&gt;&gt;&gt;&gt; 8t 2 trans(i) JL(t:src; j) + delete
JL(i; j) = min &gt;&lt; 8t 2 trans(i) JL(t:src; j 1) + merge(t:sel; s[j]); if j &gt; 1
&gt; 8b 2 bypass(r; i) : :b:f ork JS (b:src; j)
&gt;&gt;&gt;&gt; 8b 2 bypass(r; i) JL(b:src; j) + branch
&gt;
: 8t 2 zerotrans(i) JL(t:src; j)</p>
      <p>&gt;8 8b 2 bypass(r; i) : :b:join ^ :b:f ork; JS (b:src; j)
JS (i; j) = min &gt;&lt;&gt; J8Sb (2i;bjypa1s)s+(r; id)i:sp:;b:jiofinj &gt;J1L(b:src; j) + branch
&gt;: JL(i; j 1) + disp + branch if j &gt; 1</p>
      <p>As seen from the equation, JS (i; j) cannot be used or assigned "through" a
bypass that shares a fork or join, respectively. This restriction prevents
projecting a hammock breaking branch, as discussed in the previous section. Once we
consider a new branch creation, we apply a branch penalty. This penalty (acting
merge
insert
0, if the element
is already marked
optional; insert,
otherwise
disp
branch, once per
branch
like a simpli ed Graph Edit Distance [8]) enforces the willingness to compose a
laconic and uniform regular expression rather than to proliferate branches.</p>
      <p>
        Having the matrix fully constructed, we traverse the lowest total penalty
path from JL(N; length(s)) back to JL(0; 0) in order to extract the least costly
sequence of editing events. To do this, we reuse the same equations (
        <xref ref-type="bibr" rid="ref4">4</xref>
        ), (
        <xref ref-type="bibr" rid="ref5">5</xref>
        )
but in place of calculating minimums (that are already known at this stage) we
notice the choice that yields minimum value to the left hand side. Then we apply
these editing events over elements of r producing a modi ed RE version r0 (See
Fig. 3 for an example). The new branch insertion is a special case. To add each
new projected branch, if any, into the RE, we do the following: (
        <xref ref-type="bibr" rid="ref1">1</xref>
        ) outline a
branch-related subsequence of editing events (consisting of "Insert into branch"
and "Bypass" events); (
        <xref ref-type="bibr" rid="ref2">2</xref>
        ) compose a new branch and (
        <xref ref-type="bibr" rid="ref3">3</xref>
        ) insert the new branch
into r at proper start and end positions.
      </p>
      <p>The idea of algorithm described above may remind the A ne Gap Penalty
concept known in Bioinformatics [9] ; the major di erence is the fact that we
consider the gap not merely as a modi er to an element-by-element edit distance
metric, but also as a reason to draw a new graph branch.</p>
      <p>See Algorithm 1 illustrating the approach discussed.</p>
      <p>
        JL(
        <xref ref-type="bibr" rid="ref5">0,5</xref>
        )
JS(
        <xref ref-type="bibr" rid="ref5">0,5</xref>
        )
e
2
1
x
r
JS(0,0)
JL(0,0)
7
7
6
6
5
5
4
4
3
3
0
∞
7
7
6
6
5
5
4
4
2
3
3
3
7
7
6
6
5
5
2
4
4
4
4
4
7
7
6
6
4
5
5
7
6
7
7
9
7
7
6
6
4
5
5
7
6
7
7
9
a
x ( b
| c
e
f )
6 JS(
        <xref ref-type="bibr" rid="ref5 ref5">5,5</xref>
        )
7 JL(
        <xref ref-type="bibr" rid="ref5 ref5">5,5</xref>
        )
6
6
5
5
5
5
5
5
5
5
      </p>
      <p>
        JS(
        <xref ref-type="bibr" rid="ref5">5,0</xref>
        )
JL(
        <xref ref-type="bibr" rid="ref5">5,0</xref>
        )
ax(be|cf)
ax(be|cf)
ax((2|b)e|cf)
ax((12|b)e|cf)
ax((12|b)e|cf)
[ar]x((12|b)e|cf)
      </p>
      <p>Edit inline
New branch</p>
      <p>Fig. 3. An example: merging "rx12e" string to /ax(bejcf)/ expression
A note on the complexity. The algorithm shows the same complexity as
Minimum Edit Distance (per one sample), of O(M N ), which is meanly
proportional to N 2, where M is the regular expression length, N is the sample string
length. Still there are many known methods aimed to bound the complexity of
Edit Distance minimization, and most of them are directly applicable to the
proposed algorithm. Particularly, it might be bounding of maximum edit distance
to some constant number [12]
4</p>
    </sec>
    <sec id="sec-4">
      <title>Repetition Capture</title>
      <p>A regular expression produced with the algorithm described above yet needs a
repetition capture in order to get its nal form. We may employ any known
method capable of nding and removing repetitions of adjacent substring in a
plain symbol string . Let M (s) ! s0 denote such a method, where s and s0
are input and output strings, respectively. Now, we may process the RE graph
recursively applying M to all edge sequences of the graph, recursively down
up, representing each nested hammock by a single canonical symbol. In more
detail, we use a T : ( ; Rmin; Rmax) tuple in order to represent a hammock,
where is a symbol of some alphabet, Rmin and Rmax are the minimum and
maximum number of 's repetition, respectively. So, we are to slightly modify
the M procedure in order to t the following form.</p>
      <p>
        MT (q) ! q0;
q; q0 : S;
where S denotes the sequence of T tuples. We expect that MT compares two
tuples in a sequence solely relating to the value (ignoring Rmin; Rmax). Once
has found a repetition, the procedure merges it into single tuple with proper
sums for the total Rmin and Rmax:
( ; Rmin1; Rmax1); ( ; Rmin2; Rmax2) ! ( ; Rmin1 + Rmin2; Rmax1 + Rmax2)
(
        <xref ref-type="bibr" rid="ref7">7</xref>
        )
Then, we need a hammock canonical representation function C(si) ! sj . The
aim of such a function is to represent a hammock using a minimal variety of .
It's expected to satisfy, for instance, the following properties.
      </p>
      <p>{ C(fx; []g) = (C(x): ; 0; C(x):Rmax)
{ C(f[x]g) = C(x)
C function may expect that its arguments already represented in a canonical
form.</p>
      <p>
        We initially annotate each character selection cj found in our graph with a
tuple
(cHash(cj );
0; if cj marked as optional
1; otherwise
; 1) : T;
(
        <xref ref-type="bibr" rid="ref8">8</xref>
        )
where cHash(cj ) is a canonical symbol for the best character class that ts cj .
Now we may use a depth- rst search procedure like the following one to capture
repetitions in our RE graph.
(
        <xref ref-type="bibr" rid="ref6">6</xref>
        )
procedure captureRepeat(q : S)
for e 2 q do
if e 2= single char selections then
for b 2 e:branches do
      </p>
      <p>captureRepeat(b);
b C(b);
q</p>
      <p>MT (q)</p>
      <p>Now we have all elements annotated with their repetition bounds [Rmin !
Rmax] and thus we may deliver a RE. However, an user may want to see
unbounded repetitions in it (like in /a+/ or /ab*/ ). We cannot rigorously extract
an unbounded repetition from a nite number of samples, so we have to use
empiric generalization rules. The simplest of them (while working well in practice)
may be assigning Rmax to +1 if Rmax Rmin &gt;= Rbound, where Rbound is
some constant threshold (usually equal to 3).
5</p>
    </sec>
    <sec id="sec-5">
      <title>Experiments</title>
      <p>We applied the proposed algorithm to the Spam classi cation task [10]. We used
195 series of Spam messages (i.e. 195 mimes). We extracted six sample strings
from each message (four headers, a plain text and an HTML). Every series was
split into the train and test sets (60% and 40% of messages, respectively). We
randomly chose the sets three times per mime. As we don't know in advance
which combination of sample strings (like "Subject+body" or "From+Html")
better classi es a Spam mime, we have tried all 26 1 = 32 combinations and
selected one per mime that yields the best F1 metric value once applied for
classifying the union of the test set for this mime (Spam) and a standalone
collection of non-Spam messages. We have repeated these experiments at various
values of the branch cost ratio (that tells one how many avoided highest-cost
character merges "worth" a new branch creation).</p>
      <p>Fig. 4 displays F1 metric values distribution over mimes. It seems that branch
cost should be at least about 3 for the best result. Further increase does not
a ects the quality signi cantly.</p>
      <p>Fig. 5 shows how the precision and the perplexity correlate to the recall. The
precision in most cases equals one and behaves quite irregularly in the remaining
cases that demonstrates a quite low probability of matching against some random
document. A surprisingly inverse overall correlation in the (perplexity, recall)
pair is due to the fact that an increase in perplexity of a generated RE is a
reaction to a high content variety of training samples. A congestion near (50,
0.7) coordinate seems to be caused by the generator's attempts to satisfy the
sets of altering string constants frequently occurring in Spam messages with
the aim to challenge lters. The perplexity of generated regular expression still
seems rather low to cover the expected variety of training set samples. Of course
being a natural consequence of a synthetic approach to RE building, this fact
F1 distribution over Spam mimes
branch cost ratio = 1,
no \d and \w classes
branch cost ratio = 1
branch_cost ratio = 1.75
branch_cost ratio = 2.5
branch cost ratio = 8</p>
      <p>Samples fraction, %
indicates that further adjustments toward the perplexity boosting at "volatile"
sample text regions might improve the recall values.</p>
      <p>Spam messages provide an extremely challenging test bench because they are
specially designed to foolish automated lters as possible. Thus, we didn't expect
the recall to demonstrate as high values as it may be seen in "normal" content
processing. A bunch of expression generated were analyzed and it was found
that it's usually easy to do a manual correction (mostly meaning the removal
of some parts) which results in a recall of 95..100%. Thus, the algorithm at it's
today's stage may be considered as an e ective advisory solution for draft RE
extraction.
6</p>
    </sec>
    <sec id="sec-6">
      <title>Manual Assessment</title>
      <p>We have found that each piece of a generated RE looks reasonable at a proper
selections of major cost and limit parameters. However, the best choice of these
parameters may signi cantly vary through the entire expression. At the same
time, the overall alignment of samples works ne at a wide range of parameters.
Thus we conclude that for the best advisory value the technique should allow
recompilation of any selected part of generated RE at a di erent choice of options.
Meanly, an optimal cost of branch containing 3 characters is expected to be of
0
.
1
●
●</p>
      <p>
        Precision against Recall in Spam tests
● bnroa\ndchancdos\wtrcaltaioss=e1s,
branch cost ratio = 1
branch_cost ratio = 1.75
branch_cost ratio = 2.5
branch cost ratio = 8
0.2
about 1.5..2.5 times the highest cost of single character merge (also referred to as
the Wild card cost). Table 2 displays examples of regular expressions generated
with a set of E-Mail addresses taken from a Spam distribution "From:" eld.
The table also includes manual assessment of expression quality in terms of
readability, recall, and precision. Expressions were taken under various settings of
three major parameters such as (
        <xref ref-type="bibr" rid="ref1">1</xref>
        ) Wild card character class cost (max merge),
(
        <xref ref-type="bibr" rid="ref2">2</xref>
        ) Branch cost ( branch) and (
        <xref ref-type="bibr" rid="ref3">3</xref>
        ) Branch Character cost ( disp). Also, Match
bonus ( match) was varied in some cases.
7
      </p>
    </sec>
    <sec id="sec-7">
      <title>Discussion</title>
      <p>The algorithm has demonstrated its potential as an advisory solution for an
analyst or an engineer willing to compose regular expressions in a semi-automated
manner. Tuning of parameters may be really needed to get the desired look of
Wild
4
4
4
2
4
7
2
2
3
4</p>
      <p>cost</p>
      <p>Branch
Start Char
1..6 1
7
2
2
1
1
10
1
1
1
1
2
2
3
4
1
4
2
1</p>
      <sec id="sec-7-1">
        <title>Match</title>
      </sec>
      <sec id="sec-7-2">
        <title>Regular Expression produced Assessment</title>
        <p>0 (?:Ponto Frio|(?:Sepho|Ext)ra| Ok</p>
        <p>"?InfoJobs"?)&lt; @mail2m\d{1,2}\.info&gt;
0 (?:Ponto Frio|InfoJobs|"InfoJobs" | Ok but less</p>
        <p>(?:Sepho|Ext)ra) &lt; @mail2m\d{1,2}\.info&gt; readable
0 .?\w{3}o?(?:ra|Jobs"?| Frio) too general,</p>
        <p>&lt; @mail2m\d?\d\.info&gt; less readable
0 .?(?:[Io]n)?(?:.{2})?.{5} too general,</p>
        <p>&lt; @mail2m\d?\d\.info&gt; less readable
-2..0 ["P]?\wn?\wo?(?:.\w{3})?. irrelevant</p>
        <p>&lt; @mail2m\d?\d\.info&gt;
-2..0 (?:P|")?\wn?(?:\w{2})?(?: |\w)\w{3} too general</p>
        <p>(?:o|")? &lt; @mail2m\d?\d\.info&gt;
0 (?:.{2})?(?:n[ft]o|f)?.{5} low
rele</p>
        <p>&lt; @mail2m\d?\d\.info&gt; vancy
0 ["P]?.n?.o?(?:.{2})?.{3} too general</p>
        <p>&lt; @mail2m\d?\d\.info&gt;
-2..0 .?\w{3}o?(?:ra|Jobs"?| Frio)
&lt; @mail2m\d?\d\.info&gt;
an expression produced. (And some extra logic/arithmetic in order to have an
easy-to-use parameter control may be desirable in implementations).</p>
        <p>Due to a quadratic complexity of the proposed algorithm, a preliminary
alignment step should be done rst (using less consuming algorithms, for example,
su x tree based ones) in case of long samples. This fact limits the maximum
size of a branched RE region rather than the overall RE size and in such a
way it doesn't principally prevent the usage of the proposed technique with text
samples of arbitrary length.</p>
        <p>Indeed, the proposed algorithm is expected to ll the gap between concrete
substring alignment and the regularity (repetition) extraction. We mean a
cascaded pipeline as follows.
1. A plain string based alignment of input samples splits a RE extraction task
into a set of tasks with shorter text samples (complexity = O(K N log N )
or lower, where K is the sample count, N is a representative sample length).
2. The proposed extraction algorithm aligns characters in a fuzzy (class based)
way and creates branches (complexity = O((N=N1) K N12) = O(K
N N1)), where N1 is a representative length of sample substring produced
by the previous phase.
3. A repetition extraction step over an aligned RE (complexity = O(N22) or
lower, where N2 is a representative length of hammock chain in a graph
resulting from phase 2, N2 &lt;= N1).</p>
        <p>Phase 2 complexity is critical in such a schema. The overall complexity
depends on N1 behavior w.r.t. N . Fortunately, in real documents N1 usually seems
to be bounded as thy contain some non-volatile structure that may be captured
at phase 1. At such an assumption, overall complexity of the pipeline may be
kept 'almost' equal to the complexity of phase 1.</p>
        <p>An internet service demo based on the proposed algorithm is available at
http://regexus.com. All interested people are welcome to test and use it.
8</p>
      </sec>
    </sec>
    <sec id="sec-8">
      <title>Next steps</title>
      <p>We expect the following major directions of further related research.
{ to make parameters adjustable with Machine Learning techniques;
{ to explore an automated ordering of sample string as well as non-sequential
merging methods;
{ to apply a preliminary alignment and partitioning of samples in order to
reduce the overall complexity;
{ to explore an option to extract more 'popular' constructs of RE (say,
references to previously matched substrings).</p>
    </sec>
    <sec id="sec-9">
      <title>Appendix</title>
      <p>newSingle single char selection (s[current:j])
markAsOptional(newSingle)
insert(r; current:i; newSingle)
else
if bestChoice:ancestor:j &lt; current:j then</p>
      <p>markAsOptional(charSelection(bestChoice:transition)))
current bestChoice:ancestor
if not empty(newBranch) then</p>
      <p>addBranch(r; current; newBranch)</p>
    </sec>
  </body>
  <back>
    <ref-list>
      <ref id="ref1">
        <mixed-citation>
          1.
          <string-name>
            <given-names>Hussein</given-names>
            <surname>Almuallim</surname>
          </string-name>
          and Thomas G Dietterich.
          <article-title>Learning boolean concepts in the presence of many irrelevant features</article-title>
          .
          <source>Arti cial Intelligence</source>
          ,
          <volume>69</volume>
          (
          <issue>1-2</issue>
          ):
          <volume>279</volume>
          {
          <fpage>305</fpage>
          ,
          <year>1994</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref2">
        <mixed-citation>
          2.
          <string-name>
            <given-names>Alberto</given-names>
            <surname>Bartoli</surname>
          </string-name>
          , Giorgio Davanzo, Andrea De Lorenzo, Marco Mauri, Eric Medvet, and
          <string-name>
            <given-names>Enrico</given-names>
            <surname>Sorio</surname>
          </string-name>
          .
          <article-title>Automatic generation of regular expressions from examples with genetic programming</article-title>
          .
          <source>In Proceedings of the 14th annual conference companion on Genetic and evolutionary computation</source>
          , pages
          <volume>1477</volume>
          {
          <fpage>1478</fpage>
          . ACM,
          <year>2012</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref3">
        <mixed-citation>
          3.
          <string-name>
            <given-names>Alberto</given-names>
            <surname>Bartoli</surname>
          </string-name>
          , Giorgio Davanzo, Andrea De Lorenzo, Eric Medvet, and
          <string-name>
            <given-names>Enrico</given-names>
            <surname>Sorio</surname>
          </string-name>
          .
          <article-title>Automatic synthesis of regular expressions from examples</article-title>
          .
          <year>2013</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref4">
        <mixed-citation>
          4.
          <string-name>
            <given-names>Alberto</given-names>
            <surname>Bartoli</surname>
          </string-name>
          , Andrea De Lorenzo, Eric Medvet, and
          <string-name>
            <given-names>Fabiano</given-names>
            <surname>Tarlao</surname>
          </string-name>
          .
          <article-title>Playing regex golf with genetic programming</article-title>
          .
          <source>In Proceedings of the 2014 conference on Genetic and evolutionary computation</source>
          , pages
          <volume>1063</volume>
          {
          <fpage>1070</fpage>
          . ACM,
          <year>2014</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref5">
        <mixed-citation>
          5.
          <string-name>
            <given-names>Geert</given-names>
            <surname>Jan</surname>
          </string-name>
          <string-name>
            <surname>Bex</surname>
          </string-name>
          , Wouter Gelade, Frank Neven, and
          <string-name>
            <given-names>Stijn</given-names>
            <surname>Vansummeren</surname>
          </string-name>
          .
          <article-title>Learning deterministic regular expressions for the inference of schemas from xml data</article-title>
          .
          <source>ACM Transactions on the Web (TWEB)</source>
          ,
          <volume>4</volume>
          (
          <issue>4</issue>
          ):
          <fpage>14</fpage>
          ,
          <year>2010</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref6">
        <mixed-citation>
          6.
          <string-name>
            <given-names>Falk</given-names>
            <surname>Brauer</surname>
          </string-name>
          , Robert Rieger, Adrian Mocan, and
          <string-name>
            <surname>Wojciech M Barczynski.</surname>
          </string-name>
          <article-title>Enabling information extraction by inference of regular expressions from sample entities</article-title>
          .
          <source>In Proceedings of the 20th ACM international conference on Information and knowledge management</source>
          , pages
          <volume>1285</volume>
          {
          <fpage>1294</fpage>
          . ACM,
          <year>2011</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref7">
        <mixed-citation>
          7. Je rey Friedl.
          <article-title>Mastering regular expressions. "</article-title>
          <string-name>
            <surname>O'Reilly Media</surname>
          </string-name>
          ,
          <source>Inc."</source>
          ,
          <year>2006</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref8">
        <mixed-citation>
          8.
          <string-name>
            <given-names>Xinbo</given-names>
            <surname>Gao</surname>
          </string-name>
          , Bing Xiao, Dacheng Tao, and
          <string-name>
            <given-names>Xuelong</given-names>
            <surname>Li</surname>
          </string-name>
          .
          <article-title>A survey of graph edit distance</article-title>
          .
          <source>Pattern Analysis and applications</source>
          ,
          <volume>13</volume>
          (
          <issue>1</issue>
          ):
          <volume>113</volume>
          {
          <fpage>129</fpage>
          ,
          <year>2010</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref9">
        <mixed-citation>
          9.
          <string-name>
            <given-names>Osamu</given-names>
            <surname>Gotoh</surname>
          </string-name>
          .
          <article-title>An improved algorithm for matching biological sequences</article-title>
          .
          <source>Journal of molecular biology</source>
          ,
          <volume>162</volume>
          (
          <issue>3</issue>
          ):
          <volume>705</volume>
          {
          <fpage>708</fpage>
          ,
          <year>1982</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref10">
        <mixed-citation>
          10.
          <string-name>
            <surname>Jean-Michel Jolion</surname>
          </string-name>
          .
          <article-title>Some experiments on clustering a set of strings</article-title>
          .
          <source>In Graph Based Representations in Pattern Recognition</source>
          , pages
          <volume>214</volume>
          {
          <fpage>224</fpage>
          . Springer,
          <year>2003</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref11">
        <mixed-citation>
          11. E m Kinber.
          <article-title>Learning regular expressions from representative examples and membership queries</article-title>
          .
          <source>In Grammatical Inference: Theoretical Results and Applications</source>
          , pages
          <volume>94</volume>
          {
          <fpage>108</fpage>
          . Springer,
          <year>2010</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref12">
        <mixed-citation>
          12.
          <string-name>
            <given-names>Esko</given-names>
            <surname>Ukkonen</surname>
          </string-name>
          .
          <article-title>Finding approximate patterns in strings</article-title>
          .
          <source>Journal of algorithms</source>
          ,
          <volume>6</volume>
          (
          <issue>1</issue>
          ):
          <volume>132</volume>
          {
          <fpage>137</fpage>
          ,
          <year>1985</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref13">
        <mixed-citation>
          13.
          <string-name>
            <surname>Robert A Wagner and Michael J Fischer.</surname>
          </string-name>
          <article-title>The string-to-string correction problem</article-title>
          .
          <source>Journal of the ACM (JACM)</source>
          ,
          <volume>21</volume>
          (
          <issue>1</issue>
          ):
          <volume>168</volume>
          {
          <fpage>173</fpage>
          ,
          <year>1974</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref14">
        <mixed-citation>
          14. Fubo Zhang and
          <string-name>
            <surname>Erik H. DHollander</surname>
          </string-name>
          .
          <article-title>Using hammock graphs to structure programs</article-title>
          .
          <source>IEEE TRANSACTIONS ON SOFTWARE ENGINEERING</source>
          ,
          <volume>30</volume>
          (
          <issue>4</issue>
          ):
          <volume>231</volume>
          {
          <fpage>245</fpage>
          ,
          <year>2004</year>
          .
        </mixed-citation>
      </ref>
    </ref-list>
  </back>
</article>