×

Method and device for creating pattern matching state machine

  • US 8,583,961 B2
  • Filed: 05/17/2010
  • Issued: 11/12/2013
  • Est. Priority Date: 02/01/2008
  • Status: Active Grant
First Claim
Patent Images

1. A method for creating a pattern matching state machine, comprising:

  • obtaining a predefined keyword set;

    generating a Goto function according to the keyword set;

    constructing a Failure function according to the generated Goto function, and setting that an acceptable input set of a Failure state of each state is not a subset of an acceptable input set of the state, wherein the acceptable input set of the state indicates that when any symbol within the symbol set is input in the state, the Goto function of the state does not fail; and

    generating an Output function according to the Goto function and the Failure function;

    wherein the constructing the Failure function according to the generated Goto function comprises;

    setting the Failure state of all states having a depth of 1 to an initial state, and indicating the initial state with state 0;

    executing the following steps on state r having a depth of d-1 in sequence, for determining the Failure state of state s having a depth of d;

    obtaining the Failure state of state r having the depth of d-1 as a current state, and executing the following steps;

    traversing the input symbol set, determining whether the Goto function fails when the input symbols are input in the current state, and determining whether an acceptable input set of a goto state obtained by the Goto function when the input symbols are input in the current state is a subset of an acceptable input set of state s, wherein the input symbol set comprises all the input symbol capable of being used by the pattern matching state machine;

    continuing the determination step by using the Failure state of the current state as the new current state, if the Goto function fails when the input symbols are input in the current state, or the acceptable input set of the goto state obtained through the Goto function when the input symbols are input in the current state is the subset of the acceptable input set of state s;

    using a value of the Goto function when the input symbols are input in the current state as the Failure state of state s having the depth of d if the Goto function does not fail when the input symbols are input in the current state, and the acceptable input set of the goto state obtained through the Goto function when the input symbols are input in the current state is not the subset of the acceptable input set of state s; and

    ending processing state r, if the Goto function fails when all the input symbols are input in state r.

View all claims
  • 1 Assignment
Timeline View
Assignment View
    ×
    ×