<!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>
      <journal-title-group>
        <journal-title>Series</journal-title>
      </journal-title-group>
      <issn pub-type="ppub">1613-0073</issn>
    </journal-meta>
    <article-meta>
      <title-group>
        <article-title>Approximate Pattern Matching using Fuzzy Logic ∗</article-title>
      </title-group>
      <contrib-group>
        <contrib contrib-type="author">
          <string-name>Gabriela Andrejková</string-name>
          <email>gabriela.andrejkova@upjs.sk</email>
          <xref ref-type="aff" rid="aff0">0</xref>
        </contrib>
        <contrib contrib-type="author">
          <string-name>Abdulwahed Almarimi</string-name>
          <xref ref-type="aff" rid="aff0">0</xref>
        </contrib>
        <contrib contrib-type="author">
          <string-name>Asmaa Mahmoud</string-name>
          <xref ref-type="aff" rid="aff0">0</xref>
        </contrib>
        <aff id="aff0">
          <label>0</label>
          <institution>Institute of Computer Science, Faculty of Science P. J. Šafárik University in Košice</institution>
          ,
          <country country="SK">Slovakia</country>
        </aff>
        <aff id="aff1">
          <label>1</label>
          <institution>Supported by the Slovak Scientific Grant Agency VEGA</institution>
          ,
          <addr-line>Grant No. 1/0479/12</addr-line>
        </aff>
      </contrib-group>
      <pub-date>
        <year>2013</year>
      </pub-date>
      <volume>1003</volume>
      <fpage>52</fpage>
      <lpage>57</lpage>
      <abstract>
        <p>Pattern matching problem is still very interesting and important problem. Algorithms for the exact pattern matching search for exact patterns in some texts or figures. Algorithms for an approximate pattern matching search for exact and similar patterns with some errors. They use some measures to evaluate a similarity of found similar patterns. In the area of the pattern matching allowing errors is possible to use fuzzy logic theory. In the paper we present the algorithm for a fuzzification of a deterministic finite state automaton using a similarity function of characters. The fuzzified automaton will accept exact and similar words. The second presented algorithm is a fuzzy modification of Aho-Corasick pattern matching algorithm which still work in linear time with respect to the length of the searching text.</p>
      </abstract>
    </article-meta>
  </front>
  <body>
    <sec id="sec-1">
      <title>-</title>
      <p>
        The motivation to the Fuzzy Pattern Matching Problem
(FPMP) can be found in Exact Pattern Matching Problem
(EPMP). Words they are very closed to patterns (maybe
words with one error) will not be found in EPMP. A quite
good example is the typing of some text on the keyboard
[
        <xref ref-type="bibr" rid="ref2">2</xref>
        ]. The following errors can be done in typing some text:
      </p>
    </sec>
    <sec id="sec-2">
      <title>1. Typing a different character, usually from the neigh</title>
      <p>borhood of the current character on a keyboard.</p>
    </sec>
    <sec id="sec-3">
      <title>2. Inserting one or more characters into the source text.</title>
    </sec>
    <sec id="sec-4">
      <title>3. Omitting any single character from the text.</title>
    </sec>
    <sec id="sec-5">
      <title>4. Transposition of neighbor elements in the source text.</title>
    </sec>
    <sec id="sec-6">
      <title>The most frequent error is the following: instead of</title>
      <p>the required character is typed a character from the
area on the keyboard adjacent to the required
character. For example, the neighborhood of the character f
is the set fn = {f, d, g, r, t, c, v}. The set of characters
A = {f, r, o, l, i, c} belongs to the pattern frolic. In this case
of typing errors, let us assign similarity value ( f ) to each
element of the neighborhood in such way that the
character itself has f equal to 1 and the characters from the f ’s
neighborhood have f value &lt; 1, because they really
represent some error.</p>
    </sec>
    <sec id="sec-7">
      <title>The similarity values of characters could be prepared</title>
      <p>in many ways, for example the closest characters to the
character on keyboard, the similar characters to the given
character because of they have the same shape, and so on.</p>
    </sec>
    <sec id="sec-8">
      <title>And it is possible to use similarity values as some fuzzy</title>
      <p>
        values of characters [
        <xref ref-type="bibr" rid="ref3">3</xref>
        ]. Several fuzzifications of formal
concept analysis have been proposed in [
        <xref ref-type="bibr" rid="ref8">8</xref>
        ]. For example,
for the set fn should be f (f,f) = 1, f (f,d) = 0.4, f (f,r ) =
0, f (f,g) = 0.1, f (f,t) = 0.4, f (f,c) = 0.3, f (f,v) = 0.3.
We consider that in the text, it is necessary to find the
words they are very closed to the pattern frolic. We could
consider the sum of f ’s of a given string as a measure of its
similarity of the found string to the pattern frolic [
        <xref ref-type="bibr" rid="ref2">2</xref>
        ]. But
we can lose the information if the found word is exact or
not if the pattern is a subsequence of the found word. For
example, if the pattern frolic is found in the text then the
measure of the similarity to the found word frolic is the
length of the word frolic (equal to 6). The word froolic is
very closed to the pattern and the measure of the
similarity is 6 too, because the symbol o can be deleted. But the
word froolic is not exact word. The used measure of the
similarity words has some problems in this case. We will
apply measures based on fuzzy logic.
      </p>
      <p>
        In the string matching problem allowing errors, an
input text, maybe containing errors, and a pattern string are
compared in order to find an imperfect pattern in input
text. Very interesting fuzzy measure between strings
using fuzzy automata with ε -moves was given in [
        <xref ref-type="bibr" rid="ref4">4</xref>
        ].
Fuzzified Aho-Corasick (FAC) search automata were described
in [
        <xref ref-type="bibr" rid="ref10">10</xref>
        ]. Some examples of an application of a similarity
function to nondeterministic finite automata is described
in [
        <xref ref-type="bibr" rid="ref9">9</xref>
        ]. We propose a theoretical description of fuzzy
operations in a fuzzy automaton using relations on fuzzy
sets. We developed a modified fuzzy automaton, named
a FAC automaton working in a linear time in the length of
searched texts. In the applied FAC algorithm we did some
restrictions coming from practice: (1) restrictions on sets
of similar symbols, (2) restrictions on the number of
mistakes in words. The applied FAC automaton was tested on
some small texts with acceptable results.
      </p>
    </sec>
    <sec id="sec-9">
      <title>The paper is organized as follows: Section 2 presents</title>
      <p>used notions and concepts needed to understand the
problem, mainly fuzzy logic connectives and fuzzy automata.</p>
    </sec>
    <sec id="sec-10">
      <title>In Section 3 we built fuzzy automaton from a deterministic finite state automaton and a similarity function. In the following sections we present the algorithm for fuzzy pattern matching and some results of its using.</title>
      <p>2</p>
      <sec id="sec-10-1">
        <title>Preliminaries</title>
      </sec>
    </sec>
    <sec id="sec-11">
      <title>A fuzzy set A in a referential universal set U is character</title>
      <p>
        ized by a membership function which associates to each
element x ∈ U a real number A(x) ∈ [
        <xref ref-type="bibr" rid="ref1">0, 1</xref>
        ], [
        <xref ref-type="bibr" rid="ref1">0, 1</xref>
        ] is the
interval of real numbers, {0, 1} is the set of two numbers.
      </p>
      <sec id="sec-11-1">
        <title>The value of the membership function of x ∈ U represents</title>
        <p>the membership degree of x in A. We use F (U ) to
denote the set of all fuzzy sets on U . As the basic book for
notions in the theory of fuzzy sets and fuzzy logic, we used</p>
      </sec>
    </sec>
    <sec id="sec-12">
      <title>Gottwald’s book [5].</title>
    </sec>
    <sec id="sec-13">
      <title>In the theory of fuzzy sets, triangular norms have been used for defining the intersection of fuzzy sets and for modeling the logical conjunction in fuzzy logic.</title>
      <p>
        Definition 1. A mapping T : [
        <xref ref-type="bibr" rid="ref1">0, 1</xref>
        ] × [
        <xref ref-type="bibr" rid="ref1">0, 1</xref>
        ] → [
        <xref ref-type="bibr" rid="ref1">0, 1</xref>
        ] is called
a triangular norm, or t-norm, if it satisfies at least
axioms of
• identity element, 1, i. e. T (x, 1) = T (1, x) = 1 T x =
x T 1 = x for each x ∈ [
        <xref ref-type="bibr" rid="ref1">0, 1</xref>
        ].
• monotonicity, non-decreasing in each argument,
• commutativity and associativity.
      </p>
      <p>t-norms are considered as truth functions of generalized
conjunction operators. s-conorms are considered as truth
functions of generalized disjunction operators.</p>
      <p>Remark 1. Well known t-norms:
1. Gödel conjunction: x TG y = TG(x, y) = min(x, y),
2. Lukasiewicz conjunction: x TL y = TL(x, y) = max{x +
y − 1, 0},
3. Product conjunction: x TP y = TP(x, y) = x ∗ y.</p>
    </sec>
    <sec id="sec-14">
      <title>Let A be a fuzzy set of set U . A binary fuzzy relation on</title>
      <sec id="sec-14-1">
        <title>A is any fuzzy set of A × A.</title>
        <p>Definition 2. For a fuzzy subset V of A and a binary fuzzy
relation R on A, the compositions V • R and R •V are fuzzy
subsets of A defined, for any x∈ A, by
(V • R)(x)
(R • V )(x)
=
=
max{T (V (y), R(y, x))},
y∈A
max{T (R(x, y),V (y))}
y∈A
Example 1. Let V = {(a, 0.4), (b, 0.7), (c, 0.5)} be the
fuzzy subset of A. Let A × A be the binary fuzzy relation
defined by the Table 1. The composition of V by A× A can
be done from the left and from the right side. If A × A is
not symmetric relation then we can get different fuzzy sets.
Definition 3. A fuzzy finite state automaton FA is a
quintuple (Σ, Q, μ , S, F ), where:
2
(1)
(2)
2
2
a
b
c</p>
        <p>
          For each x ∈ Σ, μx is binary fuzzy relation on a set of
states Q. It is a fuzzy set of the Cartesian product Q × Q.
μx(p, q) ∈ [
          <xref ref-type="bibr" rid="ref1">0, 1</xref>
          ] for each pair (p, q) ∈ Q × Q and it can be
explained as the compliance degree of interaction between
states p and q ∈ Q in symbol x ∈ Σ.
        </p>
        <p>μ
Sts
.1
0
0
Example 2. The fuzzy finite automaton FA1 = (Σ, Q,
μ , S, F ), Σ = {a, b, c}, Q = {q0, q1, q2}, S = {q0}, S(q0) =
1, F = {q2}, F (q2) = 1, and transition functions for
symbols in Σ are in the Table 2, the automaton is drawn in the
Figure 1 . μb(q0, q1) = 0.1 and it can be explained as the
compliance degree of interaction between states q0 and q1
for the symbol b. μa(q0, q0) = 0.4 is the compliance degree
of interaction between states q0 and q0 for the symbol a.
• Σ is a non-empty finite set of input characters (input
alphabet),
• Q is a non-empty finite set of states,
• S, S ⊆ Q is a fuzzy set of a starting states on Q,
• F, F ⊆ Q is a fuzzy set of final (accepting) states on</p>
        <p>
          Q,
• μ : Q × Q × Σ → [
          <xref ref-type="bibr" rid="ref1">0, 1</xref>
          ] is the state transition function,
• μ can be decomposed to |Σ| binary relations, for each
character x ∈ Σ, in the following way:
μx : Q × Q → [
          <xref ref-type="bibr" rid="ref1">0, 1</xref>
          ] is a binary fuzzy relation on Q
fuzzy transition matrix of order |Q|.
• μ can be decomposed to |Q| binary relations, for
each state q ∈ Q, in the following way:
qμ : Q × Σ → [
          <xref ref-type="bibr" rid="ref1">0, 1</xref>
          ] is a binary fuzzy relation on Q × Σ
- fuzzy transition matrix of order |Q| × |Σ|.
1. Σ+ is the set of all non-empty strings over Σ and Σ∗ =
Σ+ ∪ {ε}.
2. The term fuzzy state of an automaton (shortly
fuzzy state) is used to refer to a fuzzy set of states
over Q. Fuzzy state V ∈ F (Q) is some set of
states with membership values. For example, V =
{(q0, 1), (q1, 0), (q2, 0)} is a fuzzy state.
3. The composition of a fuzzy state V ∈ F (Q) and a
binary fuzzy relation μx, x ∈ Σ, on Q × Q is defined,
for each p ∈ Q, by
(V •T μx)(p) = max{T (V (q), μx(q, p))}
q∈Q
(3)
Example 3. The composition of a state V1 =
{(q0, 1), (q1, 0), (q2, 0)} and the binary fuzzy relation
μb from the example 1 using Gödel norm TG gives the new
fuzzy state V2:
        </p>
        <p>(V1 •TG μb)(q0) = maxq∈Q{TG(V1(q), μb(q, q0))} =
V2(q0) = 0,</p>
        <p>(V1 •TG μb)(q1) = maxq∈Q{TG(V1(q), μb(q, q1))} =
V2(q1) = 0.1,</p>
        <p>(V1 •TG μb)(q2) = maxq∈Q{TG(V1(q), μb(q, q2))} =
V2(q2) = 0,</p>
        <p>V2 = {(q0, 0), (q1, 0.1), (q2, 0)}.</p>
        <p>Definition 4. Let R1 and R2 be two fuzzy binary relations
on Q × Q, T be some t-norm. The max-T composition
between R1 and R2, denoted R1 ◦T R2, is the fuzzy set on
Q × Q such that for all (p, q) ∈ Q × Q</p>
        <p>R1 ◦T R2(p, q) = maxr∈Q{T (R1(p, r), R2(r, q))}.
(4)
2
Example 4. Let R1 = μa and R2 = μb be two fuzzy
relations on Q × Q in the Example 2. Let TG be Gödel t-norm.
The max − TG composition between μa and μb, is given in
the Table 3. For example, μa ◦TG μb(q0, q1) can be
computed as
μa ◦TG μb(q0, q1) = maxr∈Q{TG{μa(q0, r), μb(r, q1)}} = .1,
where
min{μa(q0, q0), μb(q0, q1)} = min{0.4, 0.1} = 0.1,
min{μa(q0, q1), μb(q1, q1)} = min{0, 0} = 0,
min{μa(q0, q2), μb(q2, q1)} = min{0, 0} = 0,
max{0.1, 0, 0} = 0.1
μ
Sts
.1
0
0</p>
      </sec>
    </sec>
    <sec id="sec-15">
      <title>The computation of a fuzzy finite state automaton FA is formally described in terms of strings of input symbols that are accepted by it.</title>
      <p>Definition 5. Let FA = (Σ, Q, μ, S, F) be a fuzzy finite state
automaton.</p>
      <p>(i) μˆ: F (Q) × Σ → F (Q) is the fuzzy state transition
function. Given a fuzzy state V ∈ F (Q) and a
symbol a ∈ Σ it is μˆ(V, a) = V •T μa, the result is a fuzzy
state.
(ii) μ∗ : F (Q) × Σ∗ → F (Q) is the extended transition
function defined as
(a) μ∗(V, ε) = V, for all V ∈ F (Q) (the result is a
fuzzy state).
(b) μ∗(V, αx) = μˆ(μ∗(V, α), x) = μ∗(V, α) •T μx,
for all V ∈ F (Q), α ∈ Σ∗ and x ∈ Σ.
• The language accepted by FA, denoted L (FA),
is the fuzzy set on Σ∗ such that L (FA)(α) =
maxq∈Q{T (μ∗(S, α)(q), F(q))} for all α ∈ Σ∗.
Example 5. The value of the membership function for
some word in L (FA) depends on used t-norm. For
example, the word α =0 bca0 is accepted by FA1 in the Example
1. The starting fuzzy state is S = {(q0, 1), (q1, 0), (q2, 0)}
and the finite fuzzy state is S= {(q0, 0), (q1, 0), (q2, 1)}.
The membership values are:
• TG: L (FA1)(α) = maxq∈Q{TG(μ∗(S, α)(q), F(q))},
μ∗(S,0 bca0) = μˆ(μ∗(S,0 bc0), a),
μ∗(S,0 bc0) = μˆ(μ∗(S,0 b0), c),
μ∗(S,0 b0) = μˆ(μ∗(S, ε), b) =
{(q0, 0), (q1, 0.1), (q2, 0)} = S1,
μ∗(S,0 bc0) = μˆ(μ∗(S,0 b0), c)
{(q0, 0), (q1, 0.1), (q2, 0)} = S2,
μ∗(S,0 bca0) = μˆ(μ∗(S,0 bc0), a) = μˆ(S2, a) =
{(q0, 0), (q1, 0), (q2, 0.1)} = S3.</p>
      <p>
        S •TG μb
=
μˆ(S1, c)
2
=
=
Using the Gödel conjunction the membership value
of the word is 0.1.
f : Σ × Σ → [
        <xref ref-type="bibr" rid="ref1">0, 1</xref>
        ] defined by (5) is calledsimilarity
function.
• TL: L (FA1)(α) = maxq∈Q{TL(μ∗(S, α)(q), F(q))},
Using the Lukasiewics conjunction the membership
value of the word is 0. It means the word is not
accepted by the automaton.
• TP: L (FA1)(α) = maxq∈Q{TP(μ∗(S, α)(q), F(q))},
Using the Product conjunction the membership value
of the word is 0.02.
3
      </p>
      <p>
        Fuzzification of DFA using a similarity
function
We will work with some deterministic finite state
automaton (DFA) M defined by [
        <xref ref-type="bibr" rid="ref6">6</xref>
        ], M = (Σ, Q, δ , q0, F), where
Σ is non-empty finite set of characters, Q is a non-empty
finite set of states, q0 is the starting state, F is the set of
finite states, andδ : Q × Σ → Q is the state transition
function. δ can be decomposed to binary relations according
to states in Q, δq : Q × Σ → {0, 1}, q ∈ Q.
      </p>
      <p>Example 6. Let A be a deterministic finite state
automaton A = (Σ, Q, δ , q0, F), Σ = {A, B,C}, Q = {q0, . . . , q7},
F = {q4, q6, q7}, δ is in the Table 6. Some results of the
decomposition of δ according to states is in the Table 5.</p>
      <p>Sts
→ q0
q1
q2
q3
q4 →
q5
q6 →
q7 →</p>
      <p>A
q1
−
q3
−
−
−
−
−</p>
      <p>B
q5
q2
q5
q4
q5
q6
−
−</p>
      <p>C
−
−
−
−
−
q7
−
−
• R is reflexive if R(p, p) is defined for each p∈ Q.
• R is symmetric if R(p, q) = R(q, p) for all p, q ∈ Q.
If R is reflexive, and symmetric then R is called
proximity relation. If R is also t-transitive, then R is called
tsimilarity relation.</p>
      <p>Definition 7. Let Σ = {a1, a2, . . . an} be some finite
alphabet of characters used in some text. Each function
f (ai, a j) = f (a j, ai) =
1, if ai = a j,
v, v ∈ [0, 1), if ai 6= a j.
δ∗
Sts</p>
    </sec>
    <sec id="sec-16">
      <title>The similarity function defines similarity level between</title>
      <p>
        each pair of characters in Σ. A value v ∈ [
        <xref ref-type="bibr" rid="ref1">0, 1</xref>
        ] is depending
on the similarity of characters ai and a j. The similarity
function can be used as a proximity relation, it is a binary
symmetric and reflexive fuzzy relation on Σ × Σ.
      </p>
    </sec>
    <sec id="sec-17">
      <title>To the composition of the state transition function δ and</title>
      <p>the similarity function it is necessary to choose some
adequate fuzzy logic connectives. One of them is a max-T
composition of two binary relations defined by (6).
Definition 8. Let R1 be a fuzzy binary relation on Q × Σ
and R2 be a fuzzy binary relation on Σ × Σ. The max − T
composition between R1 and R2, denoted R1 ◦T R2, is the
fuzzy set on Q × Σ such that for all p ∈ Q and a ∈ Σ
R1 ◦T R2(p, a) = maxx∈Σ{T (R1(p, x), R2(x, a))}.</p>
      <sec id="sec-17-1">
        <title>Let δq, for some q ∈ Q, be a binary (fuzzy) relation on</title>
        <p>
          Q × Σ and R2 be a proximity relation representing a
similarity function f . Using (6) we will get the decomposed
(according to states) fuzzy transition functions of the
corresponding fuzzy automaton qμ : Q × Σ → [
          <xref ref-type="bibr" rid="ref1">0, 1</xref>
          ] for each
q ∈ Q. The fuzzy transition function is μ : Q × Q × Σ →
[
          <xref ref-type="bibr" rid="ref1">0, 1</xref>
          ].
        </p>
        <p>μ(q, p, a) =
=
qμ(p, a) = (δq ◦T f )(p, a)
maxx∈Σ{T (δq(p, x), f (x, a))}
Example 7. The application of max − TG (Gödel
conjunction) composition to δq and the similarity function f .
Similarity function:
f (A, A) = f (B, B) = f (C,C) = 1, f (A, B) = f (B, A) = 0,
f (B,C) = f (C, B) = 0, f (C, A) = f (A,C) = 0.3.
(5)
2
(6)
2
(7)
μ
Sts</p>
        <p>If we analyze the formula (7), we should see that the
value δq(p, x) represent the transition value in DFA, it
means δq(p, x) ∈ {0, 1}. From the property follows that
in the formula (7) should be used arbitrary t-norm T . The
algorithm needs information about DFA and the
similarity function. Using nested four cycles to formula (7) we
will get the fuzzy transition function of the new
automaton FA = (Σ, Q, μ , {q0f }, F f ), where {q0f }, F f ) are sets
of fuzzy states. The time complexity is O(|Q|2.|Σ|2) in the
worst case. In the common case, FA can be a
nondeterministic finite automaton. Using some special conditions
in DFA or in similarity functions FA can be
deterministic.
4</p>
        <sec id="sec-17-1-1">
          <title>Pattern matching</title>
        </sec>
      </sec>
    </sec>
    <sec id="sec-18">
      <title>Aho-Corasick algorithm (ACA) [1] is used to search the</title>
      <p>small number of exact key words in some long texts.</p>
    </sec>
    <sec id="sec-19">
      <title>AC algorithm constructs the special automaton to accept</title>
      <p>key words, the automaton is DFA. The construction is
modified using a similarity function using composition
operation of binary relations described by formula (7).</p>
    </sec>
    <sec id="sec-20">
      <title>The similarity function will be prepared according to errors done by a typing of people on keyboard. We suppose that each set of similar characters has less or equal two elements and the similarity function is symmetric one.</title>
      <p>The three basic functions of Aho-Corasick algorithm are:
• a Goto function based on an automaton DFA, which
maps (state, character) pairs to states and
occasionally emits an output,
• a Failure function, which tells the Goto function
which state to jump into when the character it just
read doesn’t match anything,
• an Output function, which maps states to outputs
sometimes more outputs than one per state.
4.1</p>
      <p>Failure function</p>
    </sec>
    <sec id="sec-21">
      <title>The construction of failure function f ail depends on some transitions with fuzzy values greater than 0. The construc</title>
      <p>tion is done in a recursive way using a queue of states they
are waiting for processing.</p>
    </sec>
    <sec id="sec-22">
      <title>Method:</title>
    </sec>
    <sec id="sec-23">
      <title>1. All states in the automaton for them exists some tran</title>
      <p>sition from state q0 will be put into the queue. The
queue in our Example 7: (: 1, 5 :).</p>
      <p>The value of the failure function f ail in the state q0
and in all states with possible transition from the state
q0 will be q0, f ail[q0] = q0. f ail[s] = q0 if there exists
some transition from state q0 to s.
2. While the queue is not empty the first element is taken
from the queue to r and transitions from r for all
symbols of alphabet are analyzed. If the transition for
symbol i is possible then to t is assigned f ail(r) and
to s the result state of the transition from the state
r through symbol i. While a transition from state t
through symbol i is not possible then t := f ail(t).
After finding the possible transition from statet through
symbol i to state v, the value of the failure function
in the state s is put to state v. The state s is put in the
end of the queue.
4.2</p>
      <p>Fuzzy Aho-Corasick algorithm:
1. To prepare the searched patterns, let P be the length
of all patterns. To build the alphabet of used
characters Σ, |Σ| ≤ P. Σ will be the alphabet of DFA. To
prepare the function f of similarity for characters. The
similarity function describes the measure of character
similarities.</p>
    </sec>
    <sec id="sec-24">
      <title>2. To process all searched patterns and built the Aho</title>
      <p>Corasick Automaton (ACA) with the transition
function δ . |Q|, |Q| ≤ P is the number of states. To
remove all transitions from q0 to q0. Let Σq0 be the
alphabet of characters of possible transitions from state
q0 to the some other state (not to q0). The time
complexity is O(|Q|2.|Σ|).
3. To prepare the fuzzification of ACA and to process
the output of each state together with membership
values. To return all removed transitions from q0 to
q0 using the alphabet Σq0 . We get FACA. The time
complexity is O(|Q|2.|Σ|2) = O(P4) in the worst case.
4. To build failure function f ail and modified output of
all states in FACA. The time complexity is O(|Q|2).
5. To use FACA for a searching of patterns in some text
given in the file and to print all founded positions of
the found patterns. The FACA finds the patterns and
their membership values. the text is read is analyzed
in one step, it means, the linear time in the length
of the text. Many texts should be searched by the
prepared automaton and they will be read once only.
5</p>
      <sec id="sec-24-1">
        <title>Results in the application</title>
      </sec>
    </sec>
    <sec id="sec-25">
      <title>In the application we used the following restrictions: (a) one error at most in the word, (b) the set of similar characters has two characters at most.</title>
      <p>Example 8. We construct the fuzzy automaton to the
following patterns.</p>
      <p>Patterns: "ABAB", "BB", "BC".</p>
      <p>Alphabet: Σ = {A, B,C}.</p>
      <p>The deterministic finite state automaton is A =
(Σ, Q, δ , q0, F ), Q = {q0, . . . , q7}, F = {q4, q6, q7}. δ is in
the Table 6.</p>
      <p>We will use the similarity function from Example 7.</p>
      <p>The fuzzy transition function from a state using a
character to some state. The value −1 means any transition.</p>
      <p>Real numbers present membership values. In the
output, there are exact and similar words together with their
membership values to the accepted language.</p>
      <p>Failure function f ail:</p>
    </sec>
    <sec id="sec-26">
      <title>From</title>
      <p>To state
Transition function of the FACA</p>
      <p>A
q1 : 1.0
-1 : 0.0
q3 : 1.0
-1 : 0.0</p>
      <p>B
q5 : 1.0
q2 : 1.0
-1 : 0.0
q4 : 1.0</p>
    </sec>
    <sec id="sec-27">
      <title>The application of the constructed automaton to the fol</title>
      <p>lowing text string: ’ABABBCCCBAB’ gives the
following results:</p>
    </sec>
    <sec id="sec-28">
      <title>The number of found words: 5</title>
      <p>pattern</p>
    </sec>
    <sec id="sec-29">
      <title>ABAB BC BB BC</title>
      <p>ABAB
fuzzy value</p>
      <sec id="sec-29-1">
        <title>Conclusion</title>
      </sec>
    </sec>
    <sec id="sec-30">
      <title>In the paper we give some information about possibility to</title>
      <p>use fuzzy logic theory in the area of the pattern matching.</p>
    </sec>
    <sec id="sec-31">
      <title>The exact pattern matching will find the exact words only</title>
      <p>and do not give any information about words with one
error only. The information that the word is very closed to
the pattern should be very important. It is enough for
people to analyze this word in next time.</p>
    </sec>
    <sec id="sec-32">
      <title>We developed the fuzzy version of Aho-Corrasick algorithm which can find the similar fuzzy words. In the following work we will test some fuzzy aggregate functions to evaluate a similarity of the words.</title>
    </sec>
  </body>
  <back>
    <ref-list>
      <ref id="ref1">
        <mixed-citation>
          [1]
          <string-name>
            <given-names>A. V.</given-names>
            <surname>Aho</surname>
          </string-name>
          ,
          <string-name>
            <given-names>M. J.</given-names>
            <surname>Corasick</surname>
          </string-name>
          :
          <article-title>Efficient string matching: an aid to bibliographic search</article-title>
          .
          <source>Communications of the ACM</source>
          , Vol.
          <volume>18</volume>
          ,
          <year>1975</year>
          , p.
          <fpage>333</fpage>
          -
          <lpage>340</lpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref2">
        <mixed-citation>
          [2]
          <string-name>
            <given-names>G.</given-names>
            <surname>Andrejková:</surname>
          </string-name>
          <article-title>The set closest common subsequence problem</article-title>
          .
          <source>In: Proceedings of 4th International Conference on Applied Informatics9´9</source>
          ,
          <string-name>
            <surname>Eger -</surname>
          </string-name>
          Noszvaj
          <year>1999</year>
          , p.
          <fpage>8</fpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref3">
        <mixed-citation>
          [3]
          <string-name>
            <given-names>G.</given-names>
            <surname>Andrejková:</surname>
          </string-name>
          <article-title>The similarity of two strings of fuzzy sets</article-title>
          .
          <source>Kybernetika</source>
          , vol.
          <volume>36</volume>
          (
          <year>2000</year>
          ), issue 6, pp.
          <fpage>671</fpage>
          -
          <lpage>687</lpage>
        </mixed-citation>
      </ref>
      <ref id="ref4">
        <mixed-citation>
          [4]
          <string-name>
            <given-names>J. J.</given-names>
            <surname>Astrain</surname>
          </string-name>
          ,
          <string-name>
            <surname>J. R</surname>
          </string-name>
          . Gonzalez de Mendivil,
          <string-name>
            <given-names>J. R.</given-names>
            <surname>Garitagoitia</surname>
          </string-name>
          :
          <article-title>Fuzzy automata with ε-moves compute fuzzy measures between strings</article-title>
          .
          <source>Fuzzy Sets and Systems</source>
          <volume>157</volume>
          (
          <year>2006</year>
          ) p.
          <fpage>1550</fpage>
          -
          <lpage>1559</lpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref5">
        <mixed-citation>
          [5]
          <string-name>
            <given-names>S.</given-names>
            <surname>Gottwald</surname>
          </string-name>
          :
          <article-title>Fuzzy sets and fuzzy logic</article-title>
          .
          <source>Verlag Vieweg, Braunschweig</source>
          ,
          <year>1993</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref6">
        <mixed-citation>
          [6]
          <string-name>
            <given-names>J. E.</given-names>
            <surname>Hopcroft</surname>
          </string-name>
          ,
          <string-name>
            <given-names>J. D.</given-names>
            <surname>Ullman</surname>
          </string-name>
          :
          <article-title>Introduction to Automata Theory, Languages and Computation</article-title>
          . Addison-Wesley, Reading, MA, USA,
          <year>1979</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref7">
        <mixed-citation>
          [7]
          <string-name>
            <given-names>Z.</given-names>
            <surname>Horák</surname>
          </string-name>
          ,
          <string-name>
            <given-names>V.</given-names>
            <surname>Snášel</surname>
          </string-name>
          ,
          <string-name>
            <given-names>A.</given-names>
            <surname>Abraham</surname>
          </string-name>
          ,
          <string-name>
            <given-names>A. E.</given-names>
            <surname>Hassanien</surname>
          </string-name>
          <article-title>: Fuzzified Aho-Corrasick Search Automata</article-title>
          .
          <source>In Proceedings of IAS</source>
          ,
          <year>2010</year>
          , p.
          <fpage>338</fpage>
          -
          <lpage>342</lpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref8">
        <mixed-citation>
          [8]
          <string-name>
            <given-names>J.</given-names>
            <surname>Medina</surname>
          </string-name>
          ,
          <string-name>
            <given-names>M.</given-names>
            <surname>Ojeda-Aciego</surname>
          </string-name>
          ,
          <string-name>
            <given-names>J.</given-names>
            <surname>Ruiz-Calvino</surname>
          </string-name>
          :
          <article-title>Formal concept analysis via multi-adjoint concept lattices</article-title>
          .
          <source>Fuzzy Sets and Systems</source>
          , Volume
          <volume>160</volume>
          Issue 2,
          <string-name>
            <surname>January</surname>
          </string-name>
          ,
          <year>2009</year>
          , p.
          <fpage>130</fpage>
          -
          <lpage>144</lpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref9">
        <mixed-citation>
          [9]
          <string-name>
            <given-names>V.</given-names>
            <surname>Ramaswamy</surname>
          </string-name>
          ,
          <string-name>
            <given-names>H. A.</given-names>
            <surname>Girijamma</surname>
          </string-name>
          <article-title>: Fuzzy Automata for String Comparison</article-title>
          .
          <source>International Journal of Computer Application</source>
          , Vol.
          <volume>37</volume>
          , No.
          <volume>8</volume>
          ,
          <issue>2012</issue>
          , p.
          <fpage>1</fpage>
          -
          <lpage>4</lpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref10">
        <mixed-citation>
          [10]
          <string-name>
            <given-names>V.</given-names>
            <surname>Snášel</surname>
          </string-name>
          ,
          <string-name>
            <given-names>A.</given-names>
            <surname>Keprt</surname>
          </string-name>
          ,
          <string-name>
            <given-names>A.</given-names>
            <surname>Abraham</surname>
          </string-name>
          ,
          <article-title>and</article-title>
          <string-name>
            <given-names>A. E.</given-names>
            <surname>Hassanien</surname>
          </string-name>
          <article-title>: Approximate pattern matching using fuzzy automata</article-title>
          .
          <source>In: K. A. Cyran</source>
          et (Eds.):
          <string-name>
            <surname>Man-Machine</surname>
            <given-names>Interactions</given-names>
          </string-name>
          ,
          <source>AISC 59</source>
          , Springer-Verlag Berlin Heidelberg 2009, p.
          <fpage>281</fpage>
          -
          <lpage>290</lpage>
          .
        </mixed-citation>
      </ref>
    </ref-list>
  </back>
</article>