WO2009097756A1 - 建立模式匹配状态机的方法及装置 - Google Patents

建立模式匹配状态机的方法及装置 Download PDF

Info

Publication number
WO2009097756A1
WO2009097756A1 PCT/CN2009/070076 CN2009070076W WO2009097756A1 WO 2009097756 A1 WO2009097756 A1 WO 2009097756A1 CN 2009070076 W CN2009070076 W CN 2009070076W WO 2009097756 A1 WO2009097756 A1 WO 2009097756A1
Authority
WO
WIPO (PCT)
Prior art keywords
state
input
failure
symbol
function
Prior art date
Application number
PCT/CN2009/070076
Other languages
English (en)
French (fr)
Inventor
Jian Chen
Qikun Wei
Guohai Chen
Original Assignee
Huawei Technologies Co., Ltd.
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Huawei Technologies Co., Ltd. filed Critical Huawei Technologies Co., Ltd.
Publication of WO2009097756A1 publication Critical patent/WO2009097756A1/zh
Priority to US12/781,650 priority Critical patent/US8583961B2/en

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/30Information retrieval; Database structures therefor; File system structures therefor of unstructured textual data
    • G06F16/33Querying
    • G06F16/3331Query processing

Definitions

  • the present invention relates to pattern matching techniques, and in particular to a method and apparatus for establishing a pattern matching state machine.
  • Pattern matching generally refers to searching for predefined keywords in text data.
  • Pattern matching problem is a basic problem in computer science. Its research content has important value in many fields such as information retrieval, pattern recognition, etc., in spell checking, language translation, data compression, search engine, intrusion detection, content filtering, computer virus. It plays an important role in applications such as signature matching and gene sequence comparison. For example, in some information acquisition and text editing applications, users specify some keywords and need to quickly locate the position of the keyword in the text.
  • the Aho-Corasick algorithm describes a simple and efficient algorithm that locates all positions of a finite number of keywords in arbitrary text.
  • the principle is: First define a finite state pattern matching machine based on this series of keywords, and then use the text as the input of the pattern matching machine. As long as it matches the keyword, it will notify the keyword that the match is successful.
  • the process of pattern matching using Aho-Corasick is as follows: Generate Goto function, Failure, Output function according to the keyword set ⁇ he, she, his, hers ⁇ , including two steps: First step to determine the state and Goto function, the second step is to calculate the Failure function.
  • the construction of the Output function begins in the first step and in the second step.
  • the Goto function is generated from the set of keywords (in the formula, g is the Goto function).
  • To build a Goto function construct a goto directed graph. The directed graph represents the initial state.
  • the vertex of 0 starts, then enter the keyword into the directed graph and add a path starting from the initial state.
  • a path starting from the initial state.
  • new vertices and edges are added to the directed graph, so starting from the initial state a path can spell out a complete keyword. This path terminates in a state that was added to the Output function.
  • the Failure function is built based on the Goto function.
  • the initial state has a depth of 0, states 1 and 3 have a depth of 1, states 2, 4, and 6 have a depth of 2, and so on.
  • the algorithm for calculating the failure function f of a state is as follows: First, calculate the Failure state of all states with a depth of 1, then calculate the Failure state of all states with a depth of 2, until the Failure state of all states is calculated, then this state The machine's Failure function is built.
  • the Output function is updated at the same time.
  • f(5) 2.
  • the output set ⁇ he ⁇ of state 2 is merged into state 5, resulting in a new output set ⁇ he, she ⁇ .
  • the final Output function is shown in Figure 1 (c).
  • the following example further illustrates the matching process of the state machine.
  • the inventor has found that the existing Aho-Corasick algorithm has at least the following problems: that is, sometimes after the Failure reaches a certain state, the Goto function still fails, and it is necessary to continue the Failure to jump to other states, that is, The existing Aho-Corasick algorithm is inefficient in the processing of the Failure chain, and there are many inefficient Failure chains.
  • Embodiments of the present invention provide a method and apparatus for establishing a mode matching state machine to reduce an inefficient chain of failures in a pattern matching process and improve mode matching processing efficiency.
  • An obtaining unit configured to obtain a predefined keyword set
  • a Goto function generating unit configured to generate a Goto function according to the keyword set
  • the failure function generating unit is configured to construct a failure function according to the generated Goto function, and make the acceptable input set of the state of each state not a subset of the acceptable input set of the state, the acceptable input set representation of the state When any symbol in the input symbol set is input in the state, the Goto function of the state does not fail;
  • the Output function generating unit is configured to generate an Output function according to the Goto function and the Failure function.
  • the method and apparatus for establishing a mode matching state machine determine whether an acceptable input set of a state of a state is an acceptable value when constructing a Failure function.
  • the state can accept a subset of the input set. If yes, the Failure state is not taken as the Failure state of the state, but the Failure state of the Failure state is continuously searched until a suitable state is found as the Failure state of the state. Therefore, the inefficient link chain in the mode matching state machine established according to the prior art is eliminated, and the processing efficiency of the pattern matching is improved.
  • FIG. 1 is a schematic diagram of constructing a Goto, Failure, and Output function according to keywords in the prior art
  • FIG. 2 is a schematic diagram of a finite state machine generating process in the prior art
  • FIG. 3 is a schematic diagram of a complex state machine in the prior art
  • FIG. 5 is a flowchart of a method for establishing a mode matching state machine according to an embodiment of the present invention
  • FIG. 6 is a flow chart of generating a Failure function in an embodiment of the present invention.
  • FIG. 7 is a schematic diagram of a Failure chain corresponding to FIG. 4 generated by a method according to an embodiment of the present invention
  • FIG. 8 is a schematic block diagram of an apparatus for establishing a mode matching state machine according to an embodiment of the present invention.
  • FIG. 5 shows a flow of a method for establishing a mode matching state machine according to an embodiment of the present invention, which includes the following steps:
  • Step 501 Obtain a predefined keyword set.
  • Step 502 Generate a Goto function according to the keyword set.
  • Step 503 Construct a Failure function according to the generated Goto function, and make the acceptable input set of the Failure state of each state not a subset of the acceptable input set of the state, and the acceptable input set of the state is represented in the state. When you enter any symbol in this symbol set, the Goto function of this state will not fail;
  • Step 504 Generate an Output function according to the Goto function and the Failure function.
  • the Failure state for the state of depth d can be derived from the non-fatal value of the Goto function with a depth of d-1.
  • step (b) it can be guaranteed that the acceptable input set of s' is not a subset of the acceptable input set of s, thus avoiding the generation of an inefficient Chain of Failure when constructing the Failure function.
  • the process of implementing the Failure function in a specific programming is described below.
  • the state set is calculated in a queue manner to calculate the failure state of each state one by one, and is completed by the process shown in FIG. 6, which mainly includes the following steps:
  • Step 601 define a state collection queue, and clear it.
  • Step 602 Traversing an input symbol set, the input symbol set includes all input symbols that can be used by the mode matching state machine.
  • the input symbol can be a symbol containing a single character or a symbol containing multiple characters.
  • Step 603 Loop through the state collection queue. If the queue is empty at this time, step 614 is performed; otherwise, step 604 is performed.
  • Step 604 Take the first state processing from the state collection queue, and delete the state from the state collection queue. Take the fetch state r as an example.
  • Step 607 Determine whether the Goto function is 0 when the symbol a is input in the state state; if yes, execute step 613; otherwise, execute step 608.
  • Step 608 Determine whether the Goto function fails when the symbol a is input in the state state.
  • step 611 the value of f(s) should be a meaningful state, not fail, so it is necessary to prejudge whether g(state, a) is fail. If it is fail, that is, the migration fails, step 611 is performed; otherwise, step 609 is performed.
  • Step 609 Determine whether the acceptable input set of the state s' is a subset of the acceptable input set of the state s; if yes, the migration of a certain symbol fails in the state s, and the migration also fails in the state s', so the state If s' cannot be the status of the state s, then step 610 is performed; otherwise, step 613 is performed.
  • Step 610 Determine whether the state state is 0; if yes, execute step 612; otherwise, execute step 611.
  • Step 611 if a state cannot be used as the Failure state of another state, it should jump to the Failure state of this state to continue the attempt, that is, try to use the state of the state as the new state state, and then return to step 607 to continue. Judge.
  • Step 613 the failure state of the state s is obtained, that is, f(s) - g(state, a); then returning to step 605, searching for other downlink states under the state r.
  • Step 614 the state set queue queue is empty, indicating that all states of the state machine have been processed. After that, the Failure function has been built.
  • the input symbol and b represent any one of the symbols in the input symbol set, and do not specifically refer to the symbol and b represented by itself.
  • the failure chain shown in Fig. 4 is taken as an example to compare the failure results generated by the prior art and the method of the present invention, and further illustrate the effect of reducing the inefficient failure chain by the method of the present invention.
  • Fig. 4 The Failure chain generated according to the prior art is shown in Fig. 4.
  • Fig. 7 the Failure chain generated by the method of the present invention is as shown in Fig. 7.
  • the process of implementing the Failure function has been described in detail by taking the symbol of a single character as an example.
  • the embodiment of the present invention is not limited to this case, and is equally applicable to the case of inputting a symbol composed of a plurality of characters.
  • An embodiment of the present invention further provides an apparatus for establishing a mode matching state machine.
  • the apparatus includes: an obtaining unit 81, a Goto function generating unit 82, a Failure function generating unit 83, and The output function generation unit 84.
  • the obtaining unit 81 is configured to acquire a predefined keyword set; the Goto function generating unit 82 is configured to generate a Goto function according to the keyword set; the Failure function generating unit 83 is configured to construct a failed Failure function according to the generated Goto function, and An acceptable input set for the status of each state is not a subset of the acceptable input set of the state, the acceptable input set of the state indicating that Goto of the state is entered when any symbol within the set of symbols is entered in the state The function does not fail; the Output function generation unit 84 is configured to generate an Output function based on the Goto function and the Failure function.
  • the Failure function generating unit 83 includes: a setting subunit 831, a state obtaining subunit 832, and a Failure state generating subunit 833.
  • the setting sub-unit 831 is configured to set the state of the state of all the depths to 1 to the initial state;
  • the state obtaining sub-unit 832 is configured to sequentially obtain the state of the state r of the previous depth d-1 as the current state state;
  • the generating sub-unit 833 is configured to traverse the input symbol set, determine whether the Goto function fails when the input symbol is input in the current state state, and the migration state obtained by the Goto function when the current state state inputs the input symbol Accepting whether the input set is a subset of the acceptable input set of state s; and the Goto function fails when the input symbol is input in the current state state, or the Goto function when the current state state inputs the input symbol
  • the acceptable input set of the migration state is a subset of the acceptable input set of the state s of the current
  • the Failure state generation sub-unit 833 can determine whether the acceptable input set of the migration state obtained by the Goto function when the current state is input to the input symbol is a subset of the acceptable input set of the state s as follows:
  • a first determining unit 85 is further configured to determine that when the Goto function is 0 when the current state is input to the input symbol, The current state state inputs the Goto function value when the input symbol is input as the Failure state of the state s with the depth d, and may further include a second determining unit 86 for determining the state input in the current state.
  • the Goto function is not a failure when the symbol is input, and the acceptable input set of the migration state obtained by the Goto function when the current state state is input to the input symbol is a subset of the acceptable input set of the state s, and the current When the state state is 0, the state of the state s whose depth is d is directly set to 0.
  • the inefficient chain of failure in the mode matching state machine can be eliminated, and the processing efficiency of the pattern matching is improved.

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Computational Linguistics (AREA)
  • Data Mining & Analysis (AREA)
  • Databases & Information Systems (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Testing And Monitoring For Control Systems (AREA)
  • Programmable Controllers (AREA)
  • Data Exchanges In Wide-Area Networks (AREA)

Description

建立模式匹配状态机的方法及装置
本申请要求于 2008 年 2 月 1 日提交中国专利局、 申请号为 200810006076.X,发明名称为"建立模式匹配状态机的方法及装置 "的中国专利 申请的优先权, 其全部内容通过引用结合在本申请中。
技术领域
本发明涉及模式匹配技术,具体涉及一种建立模式匹配状态机的方法及装 置。
背景技术
模式匹配一般是指在文本数据中搜索预定义的关键字。模式匹配问题是计 算机科学中的一个基本问题,其研究内容在信息检索、模式识别等众多领域均 有重要价值, 在拼写检查、 语言翻译、 数据压缩、 搜索引擎、 入侵检测、 内容 过滤、计算机病毒特征码匹配以及基因序列比较等应用中起着重要的作用。 比 如, 在一些信息获取、 文本编辑应用中, 用户会指定一些关键字, 需要在文本 中快速定位关键字的位置。
Aho-Corasick (阿霍 -克若思克) 算法描述了一种简单有效的算法, 能够 在任意的文本中定位有限数目的关键字的所有位置。其原理是: 首先根据这一 系列关键字定义一个有限状态模式匹配机, 然后把文本作为模式匹配机的输 入。 只要匹配到关键字, 就会通报本关键字匹配成功。
以用户指定关键字集合 {he, she, his, hers}为例, 用户希望在文本搜索中出 现任一个关键字, 就输出搜索结果, 通知用户。 如图 1所示, 利用 Aho-Corasick 进行模式匹配的过程如下: 根据关键字集合 {he, she, his, hers}生成 Goto函数、 Failure , Output 函数, 包括两个步骤: 第一步确定状态和 Goto函数, 第二步 计算 Failure函数。 Output函数的构建在第一步开始, 在第二步完成。
如图 1 ( a )所示, 根据关键字集合生成 Goto函数(在算式中以 g代表 Goto 函数)。
Goto函数 g根据当前状态和输入符号决定迁移状态。 例如, 在 0状态输入 h 会迁移到 1状态, 表示为 g(0, h)=l ; 在状态 3输入 h会迁移到状态 4, 表示为 g(3, h)=4。 如果在某状态输入某个符号无法迁移成功, 则意味着 Goto函数失败, 结 果以 fail表示, 如在状态 3输入 e导致 Goto函数失败, 则表示为 g(3, e)=fail。 Output函数表示在某状态匹配成功,可以输出的结果,如 Output(2) = "he,,。 为了构建 Goto函数, 要构建一个 goto有向图。 有向图以一个代表初始状态
0的顶点开始, 然后输入关键字到有向图中, 添加一个从初始状态开始的路径。 在添加路径的过程中,新的顶点和边被添加到了有向图中, 所以从初始状态开 始一条路径能拼出一个完整的关键字。这条路径在某个状态终止,这个状态被 添加到了 Output函数中。
假设 {he, she, his, hers}是关键字集合, 生成有限状态机的过程如图 2所示: 添加第一个关键字" he"到有向图中, 得到图 2 ( a )所示。 从状态 0到状态 2 拼出关键字" he"; 将输出 "he"关联到状态 2上, 即 0utput(2)={he}。
将第二个关键字" she"添加到有向图中, 得到图 2 ( b )所示。 将输出 "she" 关联到状态 5 , 即 0utput(5)={she}。
将第三个关键字" his"添加到有向图中, 得到如图 2 ( c )所示。
需要注意的是, 当添加关键字 "his"时, 已经有一个标记为 h的边, 从状态 0 到状态 1 ,所以不需要再添加其他标记 h的边从状态 0到状态 1。将输出 "his"关联 到状态 7 , 即 0utput(7)={his}。
添加最后一个关键字 "hers", 得到如图 2 ( d ) 所示。 输出" hers"关联到状 态 9, 即 0utput(9)={hers}。 在添加过程中, 可以使用已经存在的标记 h的边(从 状态 0到状态 1 )和标记 e的边(从状态 1到状态 2 )。
为了完成 Goto函数的构建,还需要添加一个循环,该循环从状态 0到状态 0, 对应于除了 h和 s外的其他输入符号。 得到结果如图 1 ( a ) 所示。
Failure函数(在算式中以 f 代表)表示在某个状态 Goto函数失败时, 应该 跳转到哪一个状态继续进行匹配。 如图 1 ( b ) 所示, 在状态 5 , 当输入一个 r 符号时, g(5, r)= fail, 就要调用 f(5)=2处理, 即先跳转到状态 2, 然后再调用 g(2, r) 处理。 因为 Failure函数代表着一个状态向另一个状态的迁移, 相当于增 加了一条链在两个状态之间,一般也可以将某状态 Failure函数的指向称为本状 态的 Failure链。
Failure函数基于 Goto函数构建。 首先定义一个状态 s在 goto有向图中的深 度, 即从初始状态到 s的最短路径的长度。 在图 1 ( a ), 初始状态的深度为 0 , 状态 1和 3的深度为 1 , 状态 2、 4、 6的深度为 2, 依此类推。 计算一个状态的 Failure函数 f的算法如下: 先计算所有深度为 1 的状态的 Failure状态, 然后是计算所有深度为 2的状态的 Failure状态, 一直到所有状态 的 Failure状态都被计算, 则本状态机的 Failure函数构建完成。
置所有深度为 1的状态的 Failure状态为 0 ,现在 H没已经计算出了深度小于 d的所有状态的 Failure状态, 则深度为 d的状态 s的 Failure状态可以由深度为 d-1 状态的 Goto函数的非 fail值推导出来, 具体过程如下:
首先, 考虑深度为 d-1的每个状态 r并执行以下处理:
1. 如果对所有的输入符号 a, 都是 g(r, a)=fail, 则结束状态 r的处理。
2. 否则, 对每个输入符号 a产生输出 8(1~, )=8的情况, 执行以下操作: (a)设置状态变量 state=f(r);
(b)执行算式 state— f(state) (即将 f(state)赋值给状态变量 state )零到多次, 直到 state的值满足 g(state, a)≠fail (因为 g(0, a)≠fail, 所以适合的 state值 总能被发现);
(c)设置 f(s)=g(state, a) 。
例如, 为了计算图 1 ( a ) 中的 Failure函数, 应该首先设置 f(l)=f(3)=0 , 因 为 1和 3是深度为 1的状态。 然后计算深度 2的状态 2、 4、 6的 Failure函数。
为了计算 f(2), 设置 state=f(l)=0; 因为 g(0, e)=0, 所以 f(2)=0。
为了计算 f(6), 设置 state=f(l)=0; 因为 g(0, i)=0, 所以 f(6)=0。
为了计算 f(4), 设置 state=f(3)=0; 因为 g(0, h)=l , 所以 f(4)=l。
依照这种思路计算, 就得到完整的 Failure函数, 如图 1 ( b ) 所示。
在 Failure函数的计算过程中, 同时更新 Output函数。 当确定 f(s)=s', 而状 态 s和 s'同时是 Output状态时, 则将 s'的输出集合并到 s的输出集中。 例如, 从图 1 ( a ) 中, 可以确定 f(5)=2。 在这个点上, 合并状态 2的输出集 {he}到状态 5 , 从而得到新的输出集 {he, she}。 最终的 Output函数如图 1 ( c )所示。
下面举例进一步说明状态机的匹配过程。
以输入文本" sshe"进行搜索为例, 当输入第一个 s时, g(0, s)=3 , 所以迁移 到状态 3;输入第二个 s, Goto函数失败, g(3, s)=fail,则调用 Failure函数, f(3)=0 表示跳转到状态 0 ,然后 g(0, s)=3 ,所以当前状态仍然是状态 3;输入 h, g(3, h)=4, 迁移到状态 4; 输入 e, g(4, e)=5 , 迁移到状态 5; 因为 Output(5)={she, he} , 所 以本次搜索发现了 {she, he}两个用户预定义关键字。
在实现本发明的过程中, 发明人发现, 现有的 Aho-Corasick算法至少存在 以下问题: 即有时 Failure到某一状态后, Goto函数仍然失败, 需要继续 Failure 跳转到其他状态, 也就是说, 现有的 Aho-Corasick算法在 Failure链处理方面效 率低, 存在很多低效的 Failure链。
以图 3所示的复杂状态机为例, 其中虚线代表 Failure链, q0表示初始状态。 如在 ql4状态下, g(ql4, e)=fail, 只得根据 f(ql4)=q27跳转到状态 q27; 但是到了 状态 q27 ,同样是 g(q27, e)=fail,只得跳转到 f(q27)=ql9;但仍然是 g(ql9, e)=fail, 只得跳转到 f(ql9)=q0,即经历了 g(ql4, e)->f(ql4)->g(q27, e)->f(q27)-> g(ql9; e)->f(ql9), 才跳转到 qO 状态。
再参照图 4所示的低效 Failure链, f(q6)=q0, f(q5)=q4, f(q4)=q3 , f(q3)=q2, f(q2)=ql , f(ql)=q0。如果在状态 q4下输入符号 c, g(q4, c)=fail,则按 f(q4)=q3 跳 转到状态 q3; 但仍然是 g(q3, c)=fail, 则按照 f(q3)=q2跳转到状态 q2; 但仍然是 g(q2, c)=fail , 则按照 f(q2)=ql, 跳转到状态 ql ; 但仍然是 g(ql, c)=fail, 则按 f(ql)=q0跳转到初始状态 qO , 至此才算 Failure链跳转结束, 即先后经过了 g(q4, £—> 93)—>8(93, 一> 92)—>8(92, 一> 91)一>8(91, 一>90,才跳转到 qO 状 态。
可见, Aho-Corasick算法在 Failure链处理方面是相当低效率的, 存在着 很多低效的 Failure链。
发明内容
本发明实施例提供一种建立模式匹配状态机的方法及装置,以减少模式匹 配过程中低效的 Failure链 , 提高模式匹配处理效率。
本发明实施例提供的一种建立模式匹配状态机的方法, 包括:
获取预定义的关键字集合;
Figure imgf000006_0001
根据生成的 Goto函数构建失败 Failure函数, 并使各状态的 Failure状态 的可接受输入集不是本状态的可接受输入集的子集,所述状态的可接受输入集 表示在所述状态下输入本符号集合内任意符号时, 该状态的 Goto函数不会失 败; 根据 Goto函数和 Failure函数生成输出 Output函数。
本发明实施例提供的一种建立模式匹配状态机的装置, 包括:
获取单元, 用于获取预定义的关键字集合;
Goto函数生成单元, 用于根据所述关键字集合生成 Goto函数;
Failure函数生成单元, 用于根据生成的 Goto函数构建失败 Failure函数, 并使各状态的 Failure状态的可接受输入集不是本状态的可接受输入集的子集, 所述状态的可接受输入集表示在所述状态下输入所述输入符号集内任意符号 时, 该状态的 Goto函数不会失败;
Output函数生成单元, 用于根据 Goto函数和 Failure函数生成 Output函 数。
由以上本发明实施例提供的技术方案可以看出,本发明实施例的建立模式 匹配状态机的方法及装置, 在构建 Failure函数时, 通过判断某状态的 Failure 状态的可接受输入集是否是本状态可接受输入集的子集, 如果是, 则不将该 Failure状态作为本状态的 Failure状态, 而是继续寻找该 Failure状态的 Failure 状态进行判断, 直到找到一个适合的状态作为本状态的 Failure状态, 从而消 除了依照现有技术建立的模式匹配状态机中低效的 Failure链, 提高了模式匹 配的处理效率。
附图说明
图 1是现有技术中根据关键字构建 Goto、 Failure, Output 函数示意图; 图 2是现有技术中有限状态机生成过程示意图;
图 3是现有技术中的复杂状态机示意图;
图 4是现有技术中的低效 Failure链示意图;
图 5是本发明实施例建立模式匹配状态机的方法的流程图;
图 6是本发明实施例中生成 Failure 函数的流程图;
图 7是根据本发明实施例的方法生成的对应于图 4的 Failure链示意图; 图 8是本发明实施例建立模式匹配状态机的装置的原理框图。
具体实施方式
为了使本技术领域的人员更好地理解本发明实施例的方案,下面结合附图 和实施方式对本发明实施例作进一步的详细说明。 参照图 5 , 图 5示出了本发明实施例建立模式匹配状态机的方法的流程, 包括以下步骤:
步骤 501 , 获取预定义的关键字集合;
步骤 502 , 根据所述关键字集合生成 Goto函数;
生成 Goto函数的过程与现有技术相同, 在此不再赘述;
步骤 503 , 根据生成的 Goto函数构建 Failure函数, 并使各状态的 Failure 状态的可接受输入集不是本状态的可接受输入集的子集,所述状态的可接受输 入集表示在所述状态下输入本符号集合内任意符号时, 该状态的 Goto函数不 会失败;
也就是说, 在构建 Failure函数时, 如果 f(s)=s', 但是状态 s'的可接受输 入集是状态 s可接受输入集的子集, 则状态 s'不能作为状态 s的 Failure状态, 应该继续寻找状态 s'的 Failure状态来做判断, 直到找到一个适合的状态作为 态 s的 Failure 态;
在具体实现时,要判断状态 s'的可接受输入集是否是状态 s的可接受输入 集的子集, 只要看是否存在一个符号 b , 能使得 g(s', b )≠ΐ \,但是 g(s, b)=fail。 如果存在符号 b, 则说明不是子集; 否则说明是子集;
步骤 504 , 根据 Goto函数和 Failure函数生成 Output函数;
生成 Goto函数的过程与现有技术相同, 在此不再赘述。
在具体实现时,可以按照以下过程根据生成的 Goto函数构建 Failure函数: 先直接设置所有深度为 1的状态的 Failure状态为初始状态 0 ,然后根据深 度为 1的状态的 Failure状态计算所有深度为 2的状态的 Failure状态, 接着根 据深度为 2的状态的 Failure状态计算深度为 3状态的 Failure状态,依此类推, 一直到所有状态的 Failure状态都被计算(除了初始状态 0的 Failure状态没有 定义), 则 Failure函数构建完成。
首先置所有深度为 1的状态的 Failure状态为 0。现在 H没已经计算出了深 度小于 d的所有状态的 Failure状态, 则深度为 d的状态的 Failure状态可以由 深度为 d-1状态的 Goto函数的非 fail值推导出来。
为了计算深度 d的状态 s的 Failure函数, 先考虑深度为 d-1的每个状态 r 并执行以下动作: 1. 如果对所有的输入符号 a, 都是 g(r, a)=fail, 则结束状态 r的处理。
2. 否则, 对每个输入符号 a产生输出 8(1~, )=8的情况, 执行以下操作:
(a)设置状态变量 state=f(r);
(b)执行算式 state— f(state)零到多次,直到 state的值满足以下两个条件 之一:
(i) s'=0 ( s'— g(state, a), 0代表初始状态);
(ii) s'^fail (因为 g(0, a)≠fail, 所以适合的 state值总能被发现), 并且 存在一个输入符号 b使得 g(s', b )≠ fail和 g(s, b) =fail (因为 g(0, b)≠fail, 所以 适合的 state值总能被发现); 或者 s'≠fail, state=0, 则直接设置 s' = 0;
(c)设置 f(s)= s', 即将 s'作为深度 d的状态 s的 Failure函数值。
通过上述步骤 (b),可以保证 s'的可接受输入集不是 s的可接受输入集的子 集, 从而在构建 Failure 函数时避免了产生低效的 Failure链。
下面以一个具体编程实现 Failure函数的过程来说明, 将状态集合以队列 的方式来逐个计算各状态的 Failure 状态, 通过图 6所示流程来完成, 主要包 括以下步骤:
步骤 601 , 定义一个状态集合 queue, 并将其清空。
步骤 602, 遍历输入符号集, 所述输入符号集包含本模式匹配状态机可以 使用的所有输入符号。该输入符号可以是包含单个字符的符号, 也可以是包含 多个字符的符号。为了便于清楚说明,本实施例以单个字符的符号为例。比如, 对于输入符号集中的一个符号 a,如果存在 g(0, a)=s≠0,则将此状态放入状态 集合 queue中, 并置状态 s的 Failure值为 0。 本步骤是一个循环的过程, 通过 遍历输入符号集, 可以将深度为 1的状态全部找出来,将它们全部放入状态集 合 queue中, 并将它们的 Failure状态都置为状态 0。
步骤 603 , 循环遍历状态集合 queue。 如果此时 queue为空, 则执行步骤 614; 否则执行步骤 604。
步骤 604, 从状态集合 queue中取出第一个状态处理, 并将此状态从状态 集合 queue中删除, 下面以取出状态 r为例。
步骤 605 , 遍历输入符号集来发现状态 r的下联状态, 如果输入符号集已 经对状态 r遍历完毕, 则返回步骤 603 ; 否则执行步骤 606。 步骤 606, 对于符号集中的一个符号 a, 如果存在 g(r, a)=s≠fail, 表明在状 态机中 r状态的下联状态为 s, 则将状态 s放入状态集合 queue中, 用于后续 处理状态 s的下联状态; 状态 r的 Failure状态在以前的处理中已经生成,用变 量 state来己录^ 态 r的 Failure 态。
步骤 607 , 判断在状态 state输入符号 a时 Goto函数是否为 0; 如果是, 则执行步骤 613; 否则, 执行步骤 608。
步骤 608, 判断在状态 state输入符号 a时 Goto函数是否失败。
因为 f(s)=g(state, a), f(s)的值应该是一个有意义的状态, 不能是 fail, 所 以要预先判断 g(state, a) 是否为 fail。 如果是 fail, 即迁移失败, 则执行步骤 611 ; 否则执行步骤 609。
步骤 609, 判断状态 s'的可接受输入集是否是状态 s的可接受输入集的子 集; 如果是, 则某符号在状态 s下迁移失败, 在状态 s'下迁移也肯定失败, 所 以状态 s'不能作为状态 s的 Failure状态, 则执行步骤 610; 否则, 执行步骤 613。
上述 s'= g(state, a), 可以按照以下方式判断状态 s'的可接受输入集是否是 状态 s的可接受输入集的子集:
遍历输入符号集, 看是否存在一个符号 b, W g(g (state, a), b )≠ fail, 但 是 g(s, b) =fail。 如果存在符号 b, 说明状态 s'的可接受输入集不是状态 s的可 接受输入集的子集, 否则说明子集存在。
步骤 610 , 判断状态 state是否为 0; 如果是, 则执行步骤 612; 否则, 执 行步骤 611。
步骤 611 ,如果某一状态不能作为另一状态的 Failure状态,应该跳转到这 一状态的 Failure状态继续尝试, 即以 state的 Failure状态作为新的 state状态 来做尝试, 然后返回步骤 607继续进行判断。
步骤 612 , 直接设置状态 s的 Failure状态为 0, 即 f(s)=0; 然后返回步骤
605 , 搜索状态 r下的其他下联状态。
步骤 613 , 得出状态 s的 Failure状态, 即 f(s) — g(state, a); 然后返回步 骤 605 , 搜索状态 r下的其他下联状态。
步骤 614, 状态集合 queue队列为空, 表明本状态机所有状态已经处理完 毕, Failure函数已经构建完成。
需要说明的是, 在上述流程中, 输入符号 、 b表示输入符号集中的任意 一个符号, 而不特指其本身所表示的符号 、 b。
本领域普通技术人员可以理解,实现上述实施例方法中的全部或部分步骤 是可以通过程序来指令相关的硬件来完成,所述的程序可以存储于一计算机可 读取存储介质中, 所述的存储介质, 如: ROM/RAM、 磁碟、 光盘等。
下面以图 4所示的 Failure链为例, 对利用现有技术及本发明方法生成的 Failure结果进行比较, 进一步说明利用本发明方法减少低效的 Failure链的效 果。
计算结果如下表 1所示:
步骤 原有算法 Failure 结果 本专利算法 Failure 结果
1.置所有深 f(ql)=q0 f(ql)=q0
度为 1 的状
态的 Failure
狀态为初始
状态
2.生成深度 state=f(ql)=qO, state=f(ql)=qO, s'=g(state, 为 2 的状态 f(q2) = g(q0, a) = ql。 a) =ql≠fail, 因为 ql和 q2的可接 的 Failure 状 受输入集都是 {a},所以不存在一 木 个 b使得 g(s', b)≠fail和 g(s, b) =fail, 而且 state=f(ql)=qO所以 直接设置 s'=q0 , 得到 f(q2)=q0。
3. 生成深度 state=f(q2)=ql , state=f(q2)=ql ,
为 3 的状态 f(q3)=g(ql, a)=q2。 不满足 (i)、 (ii)任意条件, 所以执 的 Failure 状 行 state— f(state)=f(ql)=qO。
木 从步骤 2 可以看出因为 ql满足 条件 (ii), 所以直接设置 s'=0, 得 到 f(q3)= s'=0。
4. 生成深度 state=f(q3)=q2, state=f(q3)=q2, 为 4 的状态 f(q4)=g(q2, a)=q3。 不满足 (i)、 (ii)任意条件, 所以执 的 Failure 状 行 state— f(state)=f(q2)=ql , 木 参考步骤 3 , 得出 f(q4)=q0。
5. 生成深度 state=f(q4)=q3 , state=f(q4)=q3 ,
为 5 的状态 f(q5)=g(q3, a)=q4。 s'=g(state, a)=q4≠fail, 存在输入 的 Failure 状 符号 a使得 g(q4, a)≠fail, 但是 木 g(q5, a)=fail, 满足条件 (ii), 所以 f(q5)=q4。
6. 生成深度 state=f(q5)=q4 , state=f(q5)=q4 ,
为 6 的状态 因为 g(q4, b)=fail,所以执行 因为 g(q4, b)=fail , 所以执行 的 Failure 状 state=f(state)=f(q4)=q3。 state=f(state)=f(q4)=q3。
木 因为 g(q3, b)=fail,所以执行 因为 g(q3, b)=fail, 所以执行
state=f(state)=f(q3 )=q2。 state=f(state)=f(q3 )=q2。
因为 g(q2, b)=fail,所以执行 因为 g(q2, b)=fail , 所以执行 state=f(state)=f(q2)=q 1。 state=f(state)=f(q2)=q 1。
因为 g(ql, b)=fail,所以执行 因为 g(ql , b)=fail , 所以执行 state=f(state)=f(q 1 )=q0。 state=f(state)=f(q 1 )=q0。
f(q6)=g(state, b)=g(qO, f(q6)=g(state, b)=g(q0, b)=q0。 b)=qO。
表 1
按照现有技术生成的 Failure链如图 4所示,对应于图 4 ,按照本发明方法 生成的 Failure链如图 7所示。
在上述实施例中, 以单个字符的符号为例详细说明了实现 Failure函数的 过程, 本发明实施例并不限于这种情况, 同样可以适用于输入多个字符组成的 符号的情况。
可见, 利用本发明实施例的方法建立模式匹配状态机时, 可以大大减少低 效的 Failure链, 提高模式匹配处理效率。
本发明实施例还提供了一种建立模式匹配状态机的装置,如图 8所示, 该 装置包括: 获取单元 81、 Goto函数生成单元 82、 Failure函数生成单元 83和 Output函数生成单元 84。 其中, 获取单元 81用于获取预定义的关键字集合; Goto函数生成单元 82用于根据所述关键字集合生成 Goto函数; Failure函数 生成单元 83用于根据生成的 Goto函数构建失败 Failure函数, 并使各状态的 Failure状态的可接受输入集不是本状态的可接受输入集的子集,所述状态的可 接受输入集表示在所述状态下输入本符号集合内任意符号时, 该状态的 Goto 函数不会失败; Output函数生成单元 84用于根据 Goto函数和 Failure函数生 成 Output函数。
如图 8所示, 在本发明的一种实施例中, Failure函数生成单元 83包括: 设置子单元 831、 状态获取子单元 832和 Failure状态生成子单元 833。 其中, 设置子单元 831用于设置所有深度为 1的状态的 Failure 状态为初始状态; 状 态获取子单元 832用于依次获取前一深度 d-1的状态 r的 Failure状态作为当前 状态 state; Failure状态生成子单元 833用于遍历输入符号集, 判断在所述当 前状态 state输入所述输入符号时 Goto函数是否失败, 和所述当前状态 state 输入所述输入符号时的 Goto函数得到的迁移状态的可接受输入集是否是状态 s的可接受输入集的子集; 并在所述当前状态 state输入所述输入符号时 Goto 函数失败,或者所述当前状态 state输入所述输入符号时的 Goto函数得到的迁 移状态的可接受输入集是当前深度 d的状态 s的可接受输入集的子集时,将所 述当前状态 state的 Failure状态作为新的所述当前状态继续上述判断; 在所述 当前状态 state输入所述输入符号时 Goto 函数不是失败, 并且所述当前状态 state输入所述输入符号时的 Goto函数得到的迁移状态的可接受输入集不是状 态 s的可接受输入集的子集时,将所述当前状态 state输入所述输入符号时 Goto 函数值作为深度为 d的状态 s的 Failure状态; 在状态 r输入所有的输入符号, Goto函数均为失败时, 结束对状态 r的处理。
Failure状态生成子单元 833可以按照以下过程判断所述当前状态 state输 入所述输入符号时的 Goto 函数得到的迁移状态的可接受输入集是否是状态 s 的可接受输入集的子集:
遍历输入符号集, 如果存在满足以下条件的符号 b: g(g (state, a), b )≠fail, 并且 g(s, b) = fail, 其中 a是在深度为 d-1的状态 r时的输入符号, 则确定所述 当前状态 state输入所述输入符号时的 Goto函数得到的迁移状态的可接受输入 集不是状态 s的可接受输入集的子集; 否则, 确定所述当前状态 state输入所 述输入符号时的 Goto函数得到的迁移状态的可接受输入集是状态 s的可接受 输入集的子集。
如图 8所示,在该实施例的建立模式匹配状态机的装置中,还可以包括第 一判断单元 85 ,用于判断所述当前状态 state输入所述输入符号时 Goto函数为 0时, 将所述当前状态 state输入所述输入符号时的 Goto函数值作为深度为 d 的状态 s的 Failure状态, 除此之外, 还可以包括第二判断单元 86, 用于判断 在所述当前状态 state输入所述输入符号时 Goto函数不是失败,并且所述当前 状态 state输入所述输入符号时的 Goto函数得到的迁移状态的可接受输入集是 状态 s的可接受输入集的子集, 并且所述当前状态 state为 0时, 直接设置深 度为 d的状态 s的 Failure状态为 0。
利用本发明实施例的装置建立模式匹配状态机的具体过程与前面对本发 明方法的描述类似, 在此不再赘述。
利用本发明实施例的装置建立的模式匹配状态机,可以消除模式匹配状态 机中低效的 Failure链, 提高模式匹配的处理效率。
以上对本发明实施例进行了详细介绍,本文中应用了具体实施方式对本发 明进行了阐述, 以上实施例的说明只是用于帮助理解本发明的装置及方法; 同 时, 对于本领域的一般技术人员, 依据本发明的思想, 在具体实施方式及应用 范围上均会有改变之处,综上所述,本说明书内容不应理解为对本发明的限制。

Claims

权 利 要 求
1、 一种建立模式匹配状态机的方法, 其特征在于, 包括:
获取预定义的关键字集合;
根据所述关键字集合生成迁移 Goto函数;
根据生成的 Goto函数构建失败 Failure函数, 并使各状态的 Failure状态 的可接受输入集不是本状态的可接受输入集的子集,所述状态的可接受输入集 表示在所述状态下输入本符号集合内任意符号时, 该状态的 Goto函数不会失 败;
根据 Goto函数和 Failure函数生成输出 Output函数。
2、 根据权利要求 1所述的方法, 其特征在于, 所述根据生成的 Goto函数 构建 Failure函数包括:
设置所有深度为 1的状态的 Failure 状态为初始状态, 并用状态 0表示所 述初始状态;
依次对深度为 d-1 的状态 r执行以下步骤, 以确定深度为 d的状态 s的 Failure状态:
获取深度为 d-1的状态 r的 Failure状态作为当前状态 state,并执行以下步 骤:
遍历输入符号集,判断在所述当前状态 state输入所述输入符号时 Goto函 数是否失败,和所述当前状态 state输入所述输入符号时的 Goto函数得到的迁 移状态的可接受输入集是否是状态 s的可接受输入集的子集,所述输入符号集 包含本模式匹配状态机可以使用的所有输入符号;
如果在所述当前状态 state输入所述输入符号时 Goto函数失败,或者所述 当前状态 state输入所述输入符号时的 Goto函数得到的迁移状态的可接受输入 集是状态 s的可接受输入集的子集, 则将所述当前状态 state的 Failure状态作 为新的所述当前状态继续上述判断步骤;
如果在所述当前状态 state输入所述输入符号时 Goto函数不是失败, 并且 所述当前状态 state输入所述输入符号时的 Goto函数得到的迁移状态的可接受 输入集不是状态 s的可接受输入集的子集, 则将所述当前状态 state输入所述 输入符号时 Goto函数值作为深度为 d的状态 s的 Failure状态; 如果在状态 r输入所有的输入符号时, Goto函数均为失败, 则结束状态 r 的处理。
3、根据权利要求 2所述的方法,其特征在于,所述判断所述当前状态 state 输入所述输入符号时的 Goto函数得到的迁移状态的可接受输入集是否是状态 s的可接受输入集的子集的过程包括:
遍历所述输入符号集, 如果存在满足以下条件的符号 b: g(g (state, a), b )≠fail, 并且 g(s, b) = fail, 其中 a是在深度为 d-1的状态 r时的输入符号, 则 确定所述当前状态 state输入所述输入符号时的 Goto函数得到的迁移状态的可 接受输入集不是状态 s的可接受输入集的子集; 否则, 确定所述当前状态 state 输入所述输入符号时的 Goto函数得到的迁移状态的可接受输入集是状态 s的 可接受输入集的子集。
4、 根据权利要求 2或 3所述的方法, 其特征在于, 所述方法还包括: 如果在所述当前状态 state输入所述输入符号时 Goto函数值为 0 , 则将所 述当前状态 state输入所述输入符号时的 Goto函数值作为深度为 d的状态 s的 Failure状态。
5、 根据权利要求 2或 3所述的方法, 其特征在于, 所述方法还包括: 如果在所述当前状态 state输入所述输入符号时 Goto函数不是失败, 并且 所述当前状态 state输入所述输入符号时的 Goto函数得到的迁移状态的可接受 输入集是状态 s的可接受输入集的子集, 并且当前状态 state为 0, 则直接设置 深度为 d的状态 s的 Failure状态为 0。
6、 一种建立模式匹配状态机的装置, 其特征在于, 包括:
获取单元, 用于获取预定义的关键字集合;
Goto函数生成单元, 用于根据所述关键字集合生成 Goto函数;
Failure函数生成单元, 用于根据生成的 Goto函数构建失败 Failure函数, 并使各状态的 Failure状态的可接受输入集不是本状态的可接受输入集的子集, 所述状态的可接受输入集表示在所述状态下输入所述输入符号集内任意符号 时, 该状态的 Goto函数不会失败;
Output函数生成单元, 用于根据 Goto函数和 Failure函数生成 Output函 数。
7、 根据权利要求 6所述的装置, 其特征在于, 所述 Failure函数生成单元 包括:
设置子单元, 用于设置所有深度为 1的状态的 Failure 状态为初始状态; 状态获取子单元,用于依次获取前一深度 d-1的状态 r的 Failure状态作为 当前状态 state;
Failure状态生成子单元,用于遍历所述输入符号集,判断在所述当前状态 state输入所述输入符号时 Goto函数是否失败,和所述当前状态 state输入所述 输入符号时的 Goto函数得到的迁移状态的可接受输入集是否是状态 s的可接 受输入集的子集;并在所述当前状态 state输入所述输入符号时 Goto函数失败, 或者所述当前状态 state输入所述输入符号时的 Goto函数得到的迁移状态的可 接受输入集是当前深度 d的状态 s的可接受输入集的子集时,将所述当前状态 state的 Failure状态作为新的所述当前状态继续上述判断;在所述当前状态 state 输入所述输入符号时 Goto函数不是失败,并且所述当前状态 state输入所述输 入符号时的 Goto函数得到的迁移状态的可接受输入集不是状态 s的可接受输 入集的子集时,将所述当前状态 state输入所述输入符号时 Goto函数值作为深 度为 d的状态 s的 Failure状态; 在状态 r输入所有的输入符号, Goto函数均 为失败时, 结束对状态 r的处理。
8、 根据权利要求 7所述的装置, 其特征在于, 所述 Failure状态生成子单 元按照以下过程判断所述当前状态 state输入所述输入符号时的 Goto函数得到 的迁移状态的可接受输入集是否是状态 s的可接受输入集的子集:
遍历所述输入符号集号, 如果存在满足以下条件的符号 b: g(g (state, a), b )≠fail, 并且 g(s, b) = fail, 其中 a是在深度为 d-1的状态 r时的输入符号, 则 确定所述当前状态 state输入所述输入符号时的 Goto函数得到的迁移状态的可 接受输入集不是状态 s的可接受输入集的子集; 否则, 确定所述当前状态 state 输入所述输入符号时的 Goto函数得到的迁移状态的可接受输入集是状态 s的 可接受输入集的子集。
9、 根据权利要求 7或 8所述的装置, 其特征在于, 所述装置还包括: 第一判断单元, 用于判断所述当前状态 state输入所述输入符号时 Goto函 数为 0时,将所述当前状态 state输入所述输入符号时的 Goto函数值作为深度 为 d的状态 s的 Failure状态。
10、 根据权利要求 7或 8所述的装置, 其特征在于, 所述装置还包括: 第二判断单元, 用于判断在所述当前状态 state输入所述输入符号时 Goto 函数不是失败,并且所述当前状态 state输入所述输入符号时的 Goto函数得到 的迁移状态的可接受输入集不是状态 s的可接受输入集的子集,并且所述当前 状态 state为 0时, 直接设置深度为 d的状态 s的 Failure状态为 0。
PCT/CN2009/070076 2008-02-01 2009-01-08 建立模式匹配状态机的方法及装置 WO2009097756A1 (zh)

Priority Applications (1)

Application Number Priority Date Filing Date Title
US12/781,650 US8583961B2 (en) 2008-02-01 2010-05-17 Method and device for creating pattern matching state machine

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN200810006076.X 2008-02-01
CNA200810006076XA CN101499064A (zh) 2008-02-01 2008-02-01 建立模式匹配状态机的方法及装置

Related Child Applications (1)

Application Number Title Priority Date Filing Date
US12/781,650 Continuation US8583961B2 (en) 2008-02-01 2010-05-17 Method and device for creating pattern matching state machine

Publications (1)

Publication Number Publication Date
WO2009097756A1 true WO2009097756A1 (zh) 2009-08-13

Family

ID=40946139

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2009/070076 WO2009097756A1 (zh) 2008-02-01 2009-01-08 建立模式匹配状态机的方法及装置

Country Status (3)

Country Link
US (1) US8583961B2 (zh)
CN (1) CN101499064A (zh)
WO (1) WO2009097756A1 (zh)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101827095A (zh) * 2010-04-06 2010-09-08 北京网康科技有限公司 一种基于回车换行快速协议解析的方法及设备
CN111953544A (zh) * 2020-08-14 2020-11-17 山东英信计算机技术有限公司 一种服务器的故障检测方法、装置、设备及存储介质

Families Citing this family (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2013163812A1 (zh) * 2012-05-04 2013-11-07 华为技术有限公司 模式匹配方法和装置
CN103312703B (zh) * 2013-05-31 2017-03-15 西南大学 基于模式识别的网络入侵检测方法及系统
EP3087508A1 (en) * 2013-12-23 2016-11-02 British Telecommunications Public Limited Company Improved pattern matching machine
US10535010B2 (en) 2013-12-23 2020-01-14 British Telecommunications Plc Pattern matching machine for repeating symbols
EP3087509A1 (en) 2013-12-23 2016-11-02 British Telecommunications Public Limited Company Improved pattern matching machine with mapping table
US20180113951A1 (en) * 2016-10-20 2018-04-26 Micron Technology, Inc. Graph traversal using automata processor
US10552271B2 (en) * 2017-07-31 2020-02-04 International Business Machines Corporation Switching servers without interrupting a client command-response queue
US11763083B2 (en) * 2020-05-18 2023-09-19 Google Llc Inference methods for word or wordpiece tokenization

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1292568C (zh) * 2001-09-02 2006-12-27 中兴通讯股份有限公司 一种多队列数据分组连续转发的装置和方法
CN1980240A (zh) * 2006-12-08 2007-06-13 杭州华为三康技术有限公司 数据流的模式匹配方法及装置

Family Cites Families (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2004081761A2 (en) * 2003-03-12 2004-09-23 Sensory Networks Inc. Apparatus and method for memory efficient, programmable, pattern matching finite state machine hardware
US7602785B2 (en) * 2004-02-09 2009-10-13 Washington University Method and system for performing longest prefix matching for network address lookup using bloom filters
US7219319B2 (en) * 2004-03-12 2007-05-15 Sensory Networks, Inc. Apparatus and method for generating state transition rules for memory efficient programmable pattern matching finite state machine hardware
US7539681B2 (en) * 2004-07-26 2009-05-26 Sourcefire, Inc. Methods and systems for multi-pattern searching
WO2007103397A2 (en) * 2006-03-07 2007-09-13 The Regents Of The University Of California Pattern matching technique for high throughput network processing
GB2437560A (en) 2006-04-28 2007-10-31 Roke Manor Research Constructing Aho Corasick trees
CN101551803A (zh) * 2008-03-31 2009-10-07 华为技术有限公司 一种建立模式匹配状态机、模式识别的方法和装置
US8504510B2 (en) * 2010-01-07 2013-08-06 Interdisciplinary Center Herzliya State machine compression for scalable pattern matching

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1292568C (zh) * 2001-09-02 2006-12-27 中兴通讯股份有限公司 一种多队列数据分组连续转发的装置和方法
CN1980240A (zh) * 2006-12-08 2007-06-13 杭州华为三康技术有限公司 数据流的模式匹配方法及装置

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101827095A (zh) * 2010-04-06 2010-09-08 北京网康科技有限公司 一种基于回车换行快速协议解析的方法及设备
CN111953544A (zh) * 2020-08-14 2020-11-17 山东英信计算机技术有限公司 一种服务器的故障检测方法、装置、设备及存储介质

Also Published As

Publication number Publication date
CN101499064A (zh) 2009-08-05
US20100229040A1 (en) 2010-09-09
US8583961B2 (en) 2013-11-12

Similar Documents

Publication Publication Date Title
WO2009097756A1 (zh) 建立模式匹配状态机的方法及装置
US9195738B2 (en) Tokenization platform
US10705748B2 (en) Method and device for file name identification and file cleaning
CN104462085B (zh) 检索关键词纠错方法及装置
JP6160259B2 (ja) 文字列探索方法、文字列探索装置および文字列探索プログラム
CN103914444B (zh) 一种纠错方法及其装置
WO2017097075A1 (zh) 一种关键词模糊匹配的方法及装置
WO2013109330A2 (en) System and methods for analyzing and modifying passwords
JP2011516989A (ja) 編集距離および文書情報を使用する検索結果順位付け
WO2018149395A1 (zh) 视图文件的路由配置方法、存储介质、终端设备及装置
WO2014176959A1 (zh) 一种基于本地词库提供输入候选词条的方法与设备
WO2015021879A1 (zh) 一种数据正则表达式的挖掘方法及装置
WO2014000305A1 (zh) 内容匹配方法和装置
CN110414236A (zh) 一种恶意进程的检测方法及装置
WO2016041428A1 (zh) 一种英文的输入方法和装置
US10229267B2 (en) Method and device for virus identification, nonvolatile storage medium, and device
WO2015078383A1 (zh) 手写字符识别方法和系统
JP5619851B2 (ja) パターンマッチングエンジン及びこれを備えた端末装置並びにその方法
JP2013054640A (ja) 検索装置及びプログラム
JP2019148859A (ja) フローダイアグラムを用いたモデル開発環境におけるデザインパターンの発見を支援する装置および方法
Akarsha et al. Coarse-to-fine secure image deduplication with merkle-hash and image features for cloud storage
EP3985569A1 (en) Information processing program, information processing method, and information processing device
CN111159996B (zh) 基于文本指纹算法的短文本集合相似度比较方法及系统
US11496489B1 (en) Knowledge-aware detection of attacks on a client device conducted with dual-use tools
US11838322B2 (en) Phishing site detection device, phishing site detection method and phishing site detection program

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 09709055

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 09709055

Country of ref document: EP

Kind code of ref document: A1