JP4347087B2 - Pattern matching apparatus and method, and program - Google Patents

Pattern matching apparatus and method, and program Download PDF

Info

Publication number
JP4347087B2
JP4347087B2 JP2004051680A JP2004051680A JP4347087B2 JP 4347087 B2 JP4347087 B2 JP 4347087B2 JP 2004051680 A JP2004051680 A JP 2004051680A JP 2004051680 A JP2004051680 A JP 2004051680A JP 4347087 B2 JP4347087 B2 JP 4347087B2
Authority
JP
Japan
Prior art keywords
automaton
pattern
text
divided
parts
Prior art date
Legal status (The legal status 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 status listed.)
Expired - Lifetime
Application number
JP2004051680A
Other languages
Japanese (ja)
Other versions
JP2005242672A (en
Inventor
亮介 榑林
勝 片山
直明 山中
公平 塩本
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Nippon Telegraph and Telephone Corp
Original Assignee
Nippon Telegraph and Telephone Corp
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 Nippon Telegraph and Telephone Corp filed Critical Nippon Telegraph and Telephone Corp
Priority to JP2004051680A priority Critical patent/JP4347087B2/en
Publication of JP2005242672A publication Critical patent/JP2005242672A/en
Application granted granted Critical
Publication of JP4347087B2 publication Critical patent/JP4347087B2/en
Anticipated expiration legal-status Critical
Expired - Lifetime legal-status Critical Current

Links

Images

Landscapes

  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Description

本発明は、与えられた入力文字列であるテキストから任意の複数種類の文字列であるパターンを検索するパターンマッチングを行うための手法および装置に関する。   The present invention relates to a technique and an apparatus for performing pattern matching for searching for patterns that are arbitrary plural types of character strings from text that is a given input character string.

与えられたテキストから任意の複数種類のパターンを検索するパターンマッチングは、ワープロソフト、データベースの検索等、多様な分野で応用されている。しかし、情報化社会の進展、そしてハードディスクといった記憶装置の大容量化、低コスト化によって、検索対象となる情報が膨大化している。したがって、パターンマッチングを高効率化するため、そのハードウェア化などの試みがなされている。   Pattern matching for searching for a plurality of arbitrary patterns from a given text is applied in various fields such as word processing software and database search. However, with the progress of the information society and the increase in capacity and cost of storage devices such as hard disks, the information to be searched for has become enormous. Therefore, in order to increase the efficiency of pattern matching, attempts have been made to implement hardware.

ここで、パターンマッチングについて定義する。長さnのテキストTと、長さmのテキストPを仮定する。ここで、パターンとテキストとはそれぞれ、共通した文字集合に属する文字を、テキストの場合はn文字、パターンの場合はm文字を、左から右に順番に並べることで構成される。すなわち、テキストT中の文字をtiと表すと、テキストTはt1…tnと表記できる。同様にパターンPはp1…pmと表記できる。パターンマッチングの目的はテキスト中にパターンが存在するか否かを特定することにある。すなわち、ts+1…ts+m=p1…pmとなる部分テキストを検出することにある。 Here, pattern matching is defined. Assume a text T having a length n and a text P having a length m. Here, the pattern and the text are configured by arranging characters belonging to a common character set in order from left to right, n characters in the case of text, and m characters in the case of a pattern. That is, if the character in the text T represents a t i, text T can be represented as t 1 ... t n. Similarly the pattern P can be represented as p 1 ... p m. The purpose of pattern matching is to specify whether or not a pattern exists in the text. That is to detect the partial text to be t s + 1 ... t s + m = p 1 ... p m.

パターンマッチングの方法として既に多くの手法が提案されている。パターンマッチングの方法は大きく以下の二つに分類できる。
1)テキストとパターンとの文字比較位置が関数的に変化する方法。
Many methods have already been proposed as pattern matching methods. Pattern matching methods can be broadly classified into the following two types.
1) A method in which the character comparison position between the text and the pattern changes functionally.

この種の方法では、テキストおよびパターンの双方の文字を比較し、それぞれの文字が一致しない場合は、比較中のテキストとパターンとの重なり位置(以下、ウィンドウと呼ぶ)をテキストに対して右方向に移動させ、ウィンドウ中のテキストとパターンとの比較を再開する。このとき、テキストとパターンとの文字比較回数を減少させるには、文字が一致しなかった際にウィンドウを移動させる幅を可能な限り大きくすることが重要となる。この種の代表的な方法として、BM(Boyer Moore),Reverse Factor,KMP(Knuth-Morris-Pratt)などがある(例えば、非特許文献1参照)。
2)テキストとパターンとの文字比較位置が一定に変化する方法。
In this type of method, both text and pattern characters are compared, and if the characters do not match, the overlapping position of the text being compared and the pattern (hereinafter referred to as the window) is directed to the right of the text. To resume the comparison of the text in the window with the pattern. At this time, in order to reduce the number of character comparisons between the text and the pattern, it is important to increase the width for moving the window as much as possible when the characters do not match. Typical examples of this type include BM (Boyer Moore), Reverse Factor, KMP (Knuth-Morris-Pratt), and the like (see, for example, Non-Patent Document 1).
2) A method in which the character comparison position between the text and the pattern changes constantly.

この種の方法では、どのようなテキストおよびパターンを用いても、テキストとパターンとの文字比較回数が常にテキスト長にのみ依存する特徴がある。この種の方法として、オートマトンを用いた方法およびShift ORアルゴリズムがある。   This type of method has a feature that the number of character comparisons between text and pattern always depends only on the text length, regardless of the text and pattern used. As this type of method, there are a method using an automaton and a Shift OR algorithm.

前者の方法では、一般的に文字比較回数の期待値が後者の方法より優れる。このため、特にソフトウェア上での実現では、前者の方法が広く用いられる。しかし、前者の方法では、複数パターンを同時に検索することができないという問題がある。さらに、そのハードウェア化に際して以下の問題が生じる。   In the former method, the expected value of the number of character comparisons is generally superior to the latter method. For this reason, the former method is widely used, particularly for implementation on software. However, the former method has a problem that a plurality of patterns cannot be searched simultaneously. Furthermore, the following problems occur when the hardware is implemented.

先の入力文字の比較結果に応じてどれだけウィンドウを右方向に移動できるかが決まる。このため、テキスト中の入力文字をパイプライン処理することができない。   How much the window can be moved to the right depends on the comparison result of the previous input characters. For this reason, input characters in the text cannot be pipelined.

テキストとパターンとの文字比較位置が関数的に変化するため、文字比較回数がテキストとパターンとに依存して変化する。このとき文字比較回数の最悪値は後者の方法より多くなる。文字比較回数の変化にともなうパターンマッチングのスループットの変化を吸収するため、入力テキストのバッファ機構が必要となる。バッファの容量を大きくとることによって、バッファが溢れる確率を小さくすることが可能であるが、完全にバッファが溢れないことを保障することは困難点である。また、バッファ中のテキストが枯渇した場合には、パイプラインがストールするなどの問題が生じる。
ChristianCharrs and ThierryLecroq“Handbook of Exact String Matching Algorithms”、[online]、[平成16年2月10日検索]、インターネット<URL:http://homepage.stts.edu/~aikawa/string.pdf> A.V.Aho and M.J.Corasick.Efficientstringmatching:an aid to bibliographic search.Comm.oftheACM.18(6):333-340,June 1975.
Since the character comparison position between the text and the pattern changes functionally, the number of character comparisons changes depending on the text and the pattern. At this time, the worst value of the number of character comparisons is larger than that of the latter method. A buffer mechanism for input text is required to absorb changes in pattern matching throughput that accompany changes in the number of character comparisons. Although it is possible to reduce the probability that the buffer overflows by increasing the buffer capacity, it is difficult to ensure that the buffer does not overflow completely. Also, when the text in the buffer is depleted, problems such as pipeline stalls occur.
ChristianCharrs and ThierryLecroq “Handbook of Exact String Matching Algorithms”, [online], [Search February 10, 2004], Internet <URL: http://homepage.stts.edu/~aikawa/string.pdf> AVAho and MJCorasick.Efficientstringmatching: an aid to bibliographic search.Com.oftheACM.18 (6): 333-340, June 1975.

従来技術によるパターンマッチングのハードウェア化では、主にオートマトンを用いた手法が用いられる。オートマトンの特徴としてまず、1)複数パターンを同時に検索することが可能であることが挙げられる。さらに、ハードウェア向きである特徴として、2−1)テキストとパターンとの文字比較位置が一定でありテキストをバッファする機構が必要でない。2−2)テキスト中の文字が入力されてから次の文字が入力されるまでの遅延が他の方法と比較して小さい、ことが挙げられる。その一方で、オートマトンによる方法では、メモリおよび論理回路の規模、スループットの点において幾つかの課題が存在する。   In the conventional pattern matching hardware implementation, a method using an automaton is mainly used. The features of automata are as follows: 1) It is possible to search a plurality of patterns simultaneously. Further, as a feature suitable for hardware, 2-1) the character comparison position between the text and the pattern is constant, and a mechanism for buffering the text is not necessary. 2-2) The delay between the input of a character in the text and the input of the next character is small compared to other methods. On the other hand, the automaton method has several problems in terms of the scale and throughput of the memory and logic circuit.

オートマトンを用いた手法では、まず、これまでに入力されたテキストのサフィックスに対するパターンの最長プリフィックスを状態として持つオートマトンを構成する。ここで、任意の文字列tii+1…ti+jのプリフィックスは、tii+1…ti+l(0≦l≦j)と定義される。一方、任意の文字列tii+1…ti+jのサフィックスはtll+1…ti+j(i≦l≦i+j)と定義される。複数のパターンが存在する場合には、個々のパターンに対するオートマトンを単一のオートマトンとして合成することが可能である。このような方法をAho−Corasickと呼ぶ(例えば、非特許文献2参照)。 In the method using the automaton, first, an automaton having the state with the longest prefix of the pattern with respect to the suffix of the text input so far is formed. Here, the prefix of an arbitrary character string t i t i + 1 ... T i + j is defined as t i t i + 1 ... t i + l (0 ≦ l ≦ j). On the other hand, the suffix of an arbitrary character string t i t i + 1 ... T i + j is defined as t l t l + 1 ... t i + j (i ≦ l ≦ i + j). When there are a plurality of patterns, the automaton for each pattern can be synthesized as a single automaton. Such a method is called Aho-Corasick (for example, refer nonpatent literature 2).

図9はAho−Corasickオートマトンを説明するための図であるが、図9は例としてパターンをcabcとcbacaの2つとした場合に生成されるオートマトンを示している。なお、いずれの状態においても、アーク上に明示されていない文字が入力された場合は状態0に戻る。次に、そのオートマトンに対して入力テキストの文字列を入力させ、入力された文字と現在のオートマトンの状態とから、オートマトンを次の状態に遷移させるという動作を繰り返す。このとき、オートマトンがパターン全体を表す状態(以下、最終状態)に遷移すると、テキスト中の文字列がパターンと一致したことを表す。図9の例では、状態4と状態8が最終状態である。   FIG. 9 is a diagram for explaining the Aho-Corasick automaton, but FIG. 9 shows an automaton generated when the patterns are cabc and cbaca as two examples. Note that, in any state, when a character that is not clearly indicated on the arc is input, the state returns to state 0. Next, the operation of inputting the character string of the input text to the automaton and changing the automaton to the next state from the input characters and the current automaton state is repeated. At this time, when the automaton transitions to a state representing the entire pattern (hereinafter, the final state), it represents that the character string in the text matches the pattern. In the example of FIG. 9, state 4 and state 8 are final states.

図10は従来のメモリを用いたオートマトンの実現例を示す図であり、図11は従来のオートマトンの回路展開例を示す図であるが、オートマトンのハードウェア実現に際しては、図10のように、オートマトンをメモリ上で表現する方法と、図11のようにオートマトンを直接的に回路化する方法とに分けられる。オートマトンをメモリ上で表現する方法として、新しく入力されたテキストの文字と現在のオートマトンの状態とを入力とし、次に遷移すべき状態を出力とする表が用いられる。しかし、オートマトンを表として実現する場合には、表のエントリ数がテキストの一文字あたりのビット幅に対して指数関数的に増加するという問題がある。   FIG. 10 is a diagram showing an implementation example of an automaton using a conventional memory, and FIG. 11 is a diagram showing an example of circuit development of the conventional automaton. In realizing the hardware of the automaton, as shown in FIG. It can be divided into a method of expressing an automaton on a memory and a method of directly forming an automaton as shown in FIG. As a method for expressing the automaton on the memory, a table is used in which newly input text characters and the current automaton state are input, and the next state to be transitioned is output. However, when the automaton is implemented as a table, there is a problem that the number of entries in the table increases exponentially with respect to the bit width per character of the text.

一方、オートマトンをバイナリツリー等を用いて表現することによって、エントリ数を削減する方法もある。しかし、この方法では、テキストの文字が入力されてから次の状態が決定されるまでの遅延が表と比較して大きくなる。この遅延の間、次のテキストの文字に対する照合処理ができないため、スループットが大きく制限される。一方、図11のオートマトンを直接布線論理化する方法では、オートマトンの状態毎に比較器が必要となる。また、状態間の配線遅延によってスループットが制限される。   On the other hand, there is a method of reducing the number of entries by expressing an automaton using a binary tree or the like. However, with this method, the delay between the input of text characters and the determination of the next state is greater than in the table. During this delay, the next text character cannot be collated, and the throughput is greatly limited. On the other hand, in the method of directly logicalizing the automaton in FIG. 11, a comparator is required for each automaton state. Also, throughput is limited by wiring delays between states.

本発明は、このような背景に行われたものであって、パターンマッチングをハードウェア処理した際の各種遅延の隠蔽およびスループットの向上を可能とすることができるパターンマッチング装置および方法を提供することを目的とする。   The present invention is made in such a background, and provides a pattern matching apparatus and method capable of concealing various delays and improving throughput when pattern matching is processed by hardware. With the goal.

本発明では、従来のオートマトンによるパターンマッチングに対し、以下の点を付加することに特徴がある。   The present invention is characterized in that the following points are added to the conventional pattern matching by the automaton.

個々のパターンの各文字を関数を用いて振り分けることによって、パターンを複数のパターンに分割し、これまでに入力されたテキストのサフィックスに対するパターンの最長プリフィックスを状態として持つオートマトンを分割パターンについて構成し、1つのパターンから生成された全ての分割パターンに対応するオートマトンの全てが最終状態になったか否かを判定することによって、パターンマッチングを行う。   By dividing each character of each pattern using a function, the pattern is divided into a plurality of patterns, and an automaton having the longest prefix of the pattern with respect to the text suffix input so far is configured for the divided pattern, Pattern matching is performed by determining whether or not all of the automatons corresponding to all the divided patterns generated from one pattern are in a final state.

個々のパターンから分割されたパターンに対応するオートマトン全てを単一のオートマトンとして合成し、パターンマッチングすることができる。   All the automatons corresponding to the patterns divided from the individual patterns can be synthesized as a single automaton and pattern matching can be performed.

生成されたオートマトンをパイプライン化して実現し、テキストと個々の分割パターンとに対する比較を時分割して行うことによって、単一テキスト中の文字単位でパイプライン処理することができる。   The generated automaton is realized as a pipeline, and the comparison between the text and each division pattern is performed in a time division manner, whereby pipeline processing can be performed for each character in a single text.

生成されたオートマトンを並列に配置し、テキスト中の文字を個々のオートマトンに振り分けて並列に入力することによって、単一テキスト中の文字単位で並列処理することができる。   By arranging the generated automata in parallel, distributing the characters in the text to the individual automata and inputting them in parallel, it is possible to perform parallel processing in units of characters in a single text.

すなわち、個々の分割パターンとテキストとの比較を互いに独立に行えるため、それらをパイプラインまたは並列処理することが可能である。すなわち、パターンをk個に分割する場合に、テキストもk個に分割する。本発明では、これらの分割テキストをそれぞれ独立に個々の分割パターンと比較させ、その結果を統合させている。   That is, since individual division patterns and text can be compared independently of each other, they can be pipelined or processed in parallel. That is, when the pattern is divided into k pieces, the text is also divided into k pieces. In the present invention, these divided texts are independently compared with individual division patterns, and the results are integrated.

この結果、分割パターンと分割テキストとの比較を並列処理することが可能となる。また、オートマトンによる比較処理を複数ステージに細分化し、独立な分割テキストを時分割に処理することによって、オートマトンのパイプライン処理を実現することができる。   As a result, the comparison between the division pattern and the division text can be performed in parallel. In addition, automaton pipeline processing can be realized by subdividing the automaton comparison processing into a plurality of stages and processing independent divided text in a time-sharing manner.

以上により、本発明の目的である、テキストを文字単位でパイプラインまたは並列処理することによる、パターンマッチングをハードウェア処理した際の配線遅延またはメモリアクセス遅延といった遅延隠蔽とスループット向上効果が得られる。   As described above, the delay concealment and the throughput improvement effect such as the wiring delay or the memory access delay when the pattern matching is hardware-processed by the pipeline or parallel processing of the text in units of characters, which is the object of the present invention, are obtained.

すなわち、本発明の第一の観点は、入力文字列であるテキストから任意文字列であるパターンを検索するパターンマッチング装置であって、前記パターンの各文字を先頭から順番にk−1(kは2以上の整数)文字置きに振り分けることによって一つのパターンをk個に分割した分割パターンについて、それぞれが互いに異なる前記分割パターンを保持し、これまでに入力されたテキストのサフィックスに対する前記保持している分割パターンの最長プリフィックスを状態として持つk個のオートマトン部を並列させて構成したオートマトン部の組をk組と、前記テキストの各文字を先頭から順番にk−1文字置きに振り分けることによって一つのテキストをk個の分割テキストに分割し、k組の前記オートマトン部の組のそれぞれに互いに異なる前記分割テキストを入力する手段と、k組の前記オートマトン部の組全てについて、該オートマトン部の組を構成するオートマトン部のいずれかが最終状態になり、かつ互いに異なる前記分割パターンを保持したk個のオートマトン部が該最終状態になったか否かを判定することによってパターンマッチングを行う手段とを備えたところにある。 Specifically, a first aspect of the present invention, the input string is a A pattern matching apparatus for searching a pattern is text or RaTsutomu meaning string, k-1 in order each character of the pattern from the top ( k for dividing pattern obtained by dividing one of the patterns in the k by that distributed to every integer of 2 or more) characters, it holds the division pattern is different from each other, wherein for text suffix input so far A set of automaton parts formed by arranging k automaton parts having the longest prefix of the divided pattern as a state in parallel is divided into k sets, and each character of the text is distributed in order of k-1 characters from the top. A text is divided into k pieces of divided text, and each of the k sets of the automaton parts is divided into each other. Means for inputting the divided text consisting, for a set all k sets of the automaton portion, k any of the automaton portion constituting a set of the automaton portion is the final state, and to hold the said different split pattern to each other Ru near the place where pieces of the automaton portion and means for performing pattern matching by determining whether or not it is the final state.

さらに、前記オートマトン部の組をパイプライン化して実現し、このパイプライン化された前記オートマトン部の組に対し、前記分割テキストと前記分割パターンとの比較を時分割して行うパイプライン処理手段を備えることができる。 Furthermore, a set of the automaton portion implemented by pipelining, the set of the automaton portion the pipelined hand, the divided text before Symbol dividing pattern and pipeline processing means for performing time-divided comparison of Ru can be provided with.

あるいは、前記オートマトン部の組のそれぞれを、互いに異なる前記分割パターンを保持したk個のオートマトンを合成した、互いに異なる前記分割パターンにそれぞれ対応したk個の最終状態を持つ単一のオートマトン部に置き換えることができる。 Alternatively, each of the set of automaton parts is combined with k automaton parts holding the different division patterns into a single automaton part having k final states respectively corresponding to the different division patterns. Ru can be replaced.

本発明の第二の観点は、パターンマッチング装置が、入力文字列であるテキストから任意文字列であるパターンを検索するパターンマッチング方法であって、前記パターンの各文字を先頭から順番にk−1(kは2以上の整数)文字置きに振り分けることによって一つのパターンをk個に分割した分割パターンについて、それぞれが互いに異なる前記分割パターンを保持し、これまでに入力されたテキストのサフィックスに対する前記保持している分割パターンの最長プリフィックスを状態として持つk個のオートマトン部を並列させて構成したオートマトン部の組をk組用い文字列入力手段が、入力文字列の前記テキストの各文字を先頭から順番にk−1文字置きに振り分けることによって一つのテキストをk個の分割テキストに分割し、k組の前記オートマトン部の組のそれぞれに互いに異なる前記分割テキストを入力するステップと、判定手段が、k組の前記オートマトン部の組全てについて、該オートマトン部の組を構成するオートマトン部のいずれかが最終状態になり、かつ互いに異なる前記分割パターンを保持したk個のオートマトン部が該最終状態になったか否かを判定することによってパターンマッチングを行うステップとを実行するところにある。 A second aspect of the invention, the pattern matching apparatus, a pattern matching method to find the text or RaTsutomu pattern is meaning string is the input character string, in order to each character of the pattern from the top k -1 (k is an integer of 2 or more) for the divided patterns obtained by dividing one of the patterns in the k by that distributed to every character, holds the division pattern is different from each other, it has been the text input so far Using k sets of automaton parts configured by arranging k automaton parts having the longest prefix of the held divided pattern as a state with respect to a suffix in parallel , a character string input means uses each of the text of the input character string Divide one text into k pieces of divided text by sorting the characters in order of k-1 characters from the top. inputting a different the divided text into each set of k sets of the automaton portion, determining means, for a set all k sets of the automaton portion, one of the automaton portion constituting a set of the automaton portion There will be a final state, and Ru near where k-number of the automaton portion holding the different said split patterns to each other and a step of performing pattern matching by determining whether or not it is the final state.

さらに、前記オートマトン部の組をパイプライン化して実現し、このパイプライン化された前記オートマトン部の組に対し、前記分割テキストと前記分割パターンとの比較を時分割して行うパイプライン処理ステップを実行することができる。 Furthermore, a set of the automaton portion implemented by pipelined, the pipelined set of automata parts per pipeline processing steps performed by the time the comparison division of the divided text before Symbol division pattern Ru can be run.

あるいは、前記オートマトン部の組のそれぞれを、互いに異なる前記分割パターンを保持したk個のオートマトンを合成した、互いに異なる前記分割パターンにそれぞれ対応したk個の最終状態を持つ単一のオートマトン部に置き換えることができる。 Alternatively, each of the set of automaton parts is combined with k automaton parts holding the different division patterns into a single automaton part having k final states respectively corresponding to the different division patterns. replaced by Ru can Rukoto.

本発明の第三の観点は、情報処理装置にインストールすることにより、その情報処理装置に、入力文字列であるテキストから任意文字列であるパターンを検索するパターンマッチング装置に相応する機能を実現させるプログラムであって、前記パターンの各文字を先頭から順番にk−1(kは2以上の整数)文字置きに振り分けることによって一つのパターンをk個に分割した分割パターンについて、それぞれが互いに異なる前記分割パターンを保持し、これまでに入力されたテキストのサフィックスに対する前記保持している分割パターンの最長プリフィックスを状態として持つk個のオートマトン部を並列させて構成したオートマトン部の組k組に相応する機能と、前記テキストの各文字を先頭から順番にk−1文字置きに振り分けることによって一つのテキストをk個の分割テキストに分割し、k組の前記オートマトン部の組のそれぞれに互いに異なる前記分割テキストを入力する機能と、k組の前記オートマトン部の組全てについて、該オートマトン部の組を構成するオートマトン部のいずれかが最終状態になり、かつ互いに異なる前記分割パターンを保持したk個のオートマトン部が該最終状態になったか否かを判定することによってパターンマッチングを行う機能とを実現させるところにある。 A third aspect of the present invention, by installing the information processing apparatus, to the information processing apparatus, the function corresponding to the pattern matching device to search for text or RaTsutomu pattern is meaning string is the input character string a program for realizing, for the divided patterns obtained by dividing one of the patterns by the be distributed in order to k-1 (k is an integer of 2 or more) placed characters each character from the beginning of the pattern into k, respectively Sets of automaton parts k each having different division patterns from each other and having k long automaton parts having the longest prefix of the held division pattern as a state with respect to the suffix of the text inputted so far. and the function corresponding to the set, this to distribute in order to each character of the text from the beginning every k-1 character A function of dividing one text into k divided texts and inputting different divided texts into each of k sets of the automaton parts, and for all of the k sets of automaton parts, the automaton part A function for performing pattern matching by determining whether any of the automaton parts constituting the set is in a final state and k automaton parts holding the different divided patterns are in the final state; Ru near the place to realize.

さらに、前記オートマトン部の組をパイプライン化して実現し、このパイプライン化された前記オートマトン部の組に対し、前記分割テキストと前記分割パターンとの比較を時分割して行うパイプライン処理機能を実現させることができる。 Furthermore, a set of the automaton portion implemented by pipelined, the pipelined set of automata portion to the divided text before Symbol division pattern and the divided pipeline processing function performed when the comparison of the Ru can be realized.

あるいは、前記オートマトン部の組のそれぞれを、互いに異なる前記分割パターンを保持したk個のオートマトン合成した、互いに異なる前記分割パターンにそれぞれ対応したk個の最終状態を持つ単一のオートマトン部に置き換えることができる。 Alternatively, each of the set of automaton parts is combined with k automaton parts holding the different division patterns into a single automaton part having k final states respectively corresponding to the different division patterns. replaced by Ru can Rukoto.

本発明の第四の観点は、本発明のプログラムが記録された前記情報処理装置読取可能な記録媒体である。本発明のプログラムは本発明の記録媒体に記録されることにより、前記情報処理装置は、この記録媒体を用いて本発明のプログラムをインストールすることができる。あるいは、本発明のプログラムを保持するサーバからネットワークを介して直接前記情報処理装置に本発明のプログラムをインストールすることもできる。 The fourth aspect of the present invention, Ru said information processing apparatus readable media der which the program is recorded of the present invention. By recording the program of the present invention on the recording medium of the present invention, the information processing apparatus can install the program of the present invention using this recording medium. Alternatively, the program of the present invention can be directly installed in the information processing apparatus via a network from a server holding the program of the present invention.

これにより、汎用の情報処理装置を用いて、各種遅延の隠蔽およびスループットの向上を可能とすることができるパターンマッチング装置を実現することができる。   As a result, it is possible to realize a pattern matching device capable of concealing various delays and improving throughput using a general-purpose information processing device.

本発明によれば、パターンマッチングをハードウェア処理した際の各種遅延の隠蔽およびスループットの向上を可能とすることができる。また、パターンマッチングを汎用の情報処理装置とプログラムとを用いて実現する際にも各種遅延の隠蔽およびスループットの向上を可能とすることができる。   According to the present invention, it is possible to conceal various delays and improve throughput when hardware processing is performed for pattern matching. Also, it is possible to conceal various delays and improve throughput when realizing pattern matching using a general-purpose information processing apparatus and a program.

本発明実施例のパターンマッチング装置および方法ならびにプログラムについて図1ないし図8を参照して説明する。図1は分割パターンを用いたパターンマッチング装置の構成図である。図2は分割パターンを用いたオートマトンによって文字単位の並列処理を行う実施例を示す図である。図3はメモリを用いたオートマトンによってパイプライン処理する構成を示す図である。図4は回路展開したオートマトンによってパイプライン処理する構成を示す図である。図5は分割パターンを合成したパターンマッチング装置の構成図である。図6は分割パターンを合成したパターンマッチングの実施例を示す図である。図7はメモリ表現した場合の最終状態判定部を示す図である。図8はオートマトンをメモリ表現した場合の実施例を示す図である。   A pattern matching apparatus, method, and program according to an embodiment of the present invention will be described with reference to FIGS. FIG. 1 is a configuration diagram of a pattern matching apparatus using divided patterns. FIG. 2 is a diagram showing an embodiment in which character unit parallel processing is performed by an automaton using a division pattern. FIG. 3 is a diagram showing a configuration in which pipeline processing is performed by an automaton using a memory. FIG. 4 is a diagram showing a configuration in which pipeline processing is performed by an automaton that has been developed. FIG. 5 is a configuration diagram of a pattern matching apparatus that combines divided patterns. FIG. 6 is a diagram showing an example of pattern matching in which divided patterns are synthesized. FIG. 7 is a diagram showing the final state determination unit in the case of memory representation. FIG. 8 is a diagram showing an embodiment when the automaton is expressed in memory.

本発明実施例は、図1に示すように、入力文字列であるテキストから複数種類の任意文字列であるパターンを検索するパターンマッチング装置であって、本発明の特徴とするところは、個々のパターンの各文字を関数に従って振り分けることによって個々の一つのパターンを複数のパターンに分割した分割パターンを保持し、これまでに入力されたテキストのサフィックスに対するパターンの最長プリフィックスを状態として持つオートマトンを前記分割パターンについてそれぞれ構成するオートマトン部1と、一つのパターンから分割された全ての前記分割パターンのそれぞれについて構成されたオートマトンの全てが最終状態になったか否かを判定することによってパターンマッチングを行う最終状態判定部2とを備えたところにある。 As shown in FIG. 1, the embodiment of the present invention is a pattern matching apparatus for searching for a pattern that is a plurality of types of arbitrary character strings from text that is an input character string. By dividing each character of the pattern according to a function, a divided pattern obtained by dividing each individual pattern into a plurality of patterns is retained, and the automaton having the longest pattern prefix for the text suffix input so far as the state is divided. The final state in which pattern matching is performed by determining whether or not all of the automatons configured for each of the divided patterns divided from one pattern are in a final state, and the automaton unit 1 configured for each pattern. Ru near the place that includes a determination unit 2.

さらに、図3に示すように、前記オートマトンをパイプライン化して実現し、このパイプライン化された前記オートマトンに対し、テキストと個々の前記分割パターンとの比較を時分割して行うパイプライン処理手段を備えることができる。 Furthermore, as shown in FIG. 3, the automaton is realized by making the automaton into a pipeline, and for the automaton that is made into a pipeline, a pipeline processing means for performing a time-division comparison of text and each of the division patterns. Ru can be provided with.

あるいは、図2に示すように、前記オートマトンを複数並列に配置し、この並列に配置された複数の前記オートマトンに対し、テキスト中の文字を個々のオートマトンに振り分けて並列に入力し、単一テキスト中の文字単位で並列処理する手段を備えることができる。 Alternatively, as shown in FIG. 2, a plurality of the automatons are arranged in parallel, and the characters in the text are divided into individual automatons and input in parallel to the plurality of automatons arranged in parallel. Ru can be provided with means for parallel processing in characters in.

あるいは、図8に示すように、前記オートマトンをパイプライン化して実現すると共に、このパイプライン化して実現したオートマトンを複数並列に配置し、この並列に配置された複数の前記オートマトンに対し、テキスト中の文字を個々のオートマトンに振り分けて並列に入力し、単一テキスト中の文字単位で並列処理すると共に、このパイプライン化された前記オートマトンに対し、前記テキスト中の文字と個々の前記分割パターンとの比較を時分割して行う並列パイプライン処理手段を備えることができる。 Alternatively, as shown in FIG. 8, the automaton is realized by pipelining, and a plurality of automatons realized by the pipelining are arranged in parallel, and the plurality of automatons arranged in parallel are Are distributed to each automaton and input in parallel, and are processed in parallel in units of characters in a single text, and for the pipelined automaton, the characters in the text and the individual division patterns Ru can be provided with a parallel and pipeline processing means for performing time-divided comparisons.

さらに、図5に示すように、全ての前記分割パターンのそれぞれについて構成されたオートマトンの全てを単一のオートマトンとして合成する合成済みオートマトン部3を備えることができる。 Furthermore, as shown in FIG. 5, Ru can be provided with a precomposed automaton unit 3 for synthesizing all of the automaton constructed for each of all of said divided patterns as a single automaton.

本実施例の入力文字列であるテキストから複数種類の任意文字列であるパターンを検索するパターンマッチング方法は、個々のパターンの各文字を関数に従って振り分けることによって個々の一つのパターンを複数のパターンに分割するステップと、これまでに入力されたテキストのサフィックスに対するパターンの最長プリフィックスを状態として持つオートマトンを前記分割するステップにより分割された分割パターンについてそれぞれ構成するステップと、一つのパターンから分割された全ての前記分割パターンのそれぞれについて構成されたオートマトンの全てが最終状態になったか否かを判定することによってパターンマッチングを行うステップとを実行することを特徴とする。 The pattern matching method for searching for a pattern that is a plurality of types of arbitrary character strings from the text that is the input character string of the present embodiment is that each character of each pattern is sorted according to a function to convert each one pattern into a plurality of patterns. A step of dividing, a step of configuring each of the divided patterns divided by the step of dividing the automaton having the longest prefix of the pattern with respect to the suffix of the text input so far, and all divided from one pattern all of the automaton constructed for each of the divided pattern you characterized by executing the steps of performing pattern matching by determining whether it is the final state.

さらに、前記オートマトンをパイプライン化して実現し、このパイプライン化された前記オートマトンに対し、テキストと個々の前記分割パターンとの比較を時分割して行うパイプライン処理ステップを実行することができる。 Moreover, the automaton implemented by pipelined, to the pipelined said automaton, Ru can perform pipeline processing step of performing time-divided compares the text and each of the divided pattern .

あるいは、前記オートマトンを複数並列に配置し、この並列に配置された複数の前記オートマトンに対し、テキスト中の文字を個々のオートマトンに振り分けて並列に入力し、単一テキスト中の文字単位で並列処理するステップを実行することができる。 Alternatively, a plurality of the automata are arranged in parallel, and the characters in the text are distributed to the individual automata and input in parallel to the plurality of the automata arranged in parallel, and are processed in units of characters in a single text. Ru can be a step to be executed.

あるいは、前記オートマトンをパイプライン化して実現すると共に、このパイプライン化して実現したオートマトンを複数並列に配置し、この並列に配置された複数の前記オートマトンに対し、テキスト中の文字を個々のオートマトンに振り分けて並列に入力し、単一テキスト中の文字単位で並列処理すると共に、このパイプライン化された前記オートマトンに対し、前記テキスト中の文字と個々の前記分割パターンとの比較を時分割して行う並列パイプライン処理ステップを実行することができる。 Alternatively, the automaton is realized by making the automaton into a pipeline, and a plurality of automatons realized by making the pipeline are arranged in parallel, and the characters in the text are assigned to individual automata for the plurality of automatons arranged in parallel. Sort and input in parallel, process in parallel in units of characters in a single text, and for the pipelined automaton, compare the characters in the text with the individual division patterns by time division Ru can run parallel pipeline processing step of performing.

さらに、全ての前記分割パターンのそれぞれについて構成されたオートマトンの全てを単一のオートマトンとして合成するステップを実行することができる。 Further, Ru can execute the step of combining all of the automaton constructed for each of all of said divided patterns as a single automaton.

本実施例は、汎用の情報処理装置にインストールすることにより、その情報処理装置に本実施例のパターンマッチング装置に相応する機能を実現させるプログラムとして実現することができる。このプログラムは、記録媒体に記録されて情報処理装置にインストールされ、あるいは通信回線を介して情報処理装置にインストールされることにより当該情報処理装置に、オートマトン部1、最終状態判定部2、合成済みオートマトン部3にそれぞれ相応する機能を実現させることができる。 This embodiment, by installing a general-purpose information processing apparatus, Ru can be realized as a program for realizing functions corresponding to the pattern matching apparatus of the present embodiment to the information processing apparatus. This program is recorded on a recording medium and installed in the information processing apparatus , or installed in the information processing apparatus via a communication line, so that the automaton unit 1, final state determination unit 2, synthesis is added to the information processing apparatus. A function corresponding to each of the completed automaton units 3 can be realized.

以下では、本発明実施例をさらに詳細に説明する。本発明では、まず、個々のパターンの各文字を一定の関数に基づいて振り分けることによってパターンを複数のパターンに分割する。関数の具体例として、パターンを先頭から順番に振り分ける場合に、分割前のパターンPをp12…pmとしてk分割すると、その分割パターンDPi(i=1,…,k)はpii+k…pi+(m/k-1)kと表記できる。例えば、パターンababcdから2つの分割パターンを生成する場合に、分割パターンDP1はaac、分割パターンDP2はbbdとなる。任意の部分テキストts+1s+2…ts+mがパターンと一致するか否かを判定する場合には、パターンと同様に部分テキストを分割し、個々の分割部分テキストが個々の分割パターンと一致するか否かを判定する。すなわち、i=1,…,kについて以下の式が成り立つか否かを判定する。 In the following, embodiments of the present invention will be described in more detail. In the present invention, first, a pattern is divided into a plurality of patterns by distributing each character of each pattern based on a certain function. Specific examples of the functions, when distributing sequentially the pattern from the beginning, when k divides the pattern P before division as p 1 p 2 ... p m, the division pattern DP i (i = 1, ... , k) is p i p i + k can be expressed as p i + (m / k−1) k . For example, when generating a two division patterns from the pattern Ababcd, division pattern DP 1 is aac, division pattern DP2 becomes bbd. When determining whether or not an arbitrary partial text t s + 1 t s + 2 ... t s + m matches the pattern, the partial text is divided in the same manner as the pattern, and each divided partial text is individually It is determined whether or not it matches the division pattern. That is, it is determined whether or not the following expression holds for i = 1,.

s+is+i+k…ts+i+(m/k-1)k=pii+k…pi+(m/k-1)k
次に、これまでに入力されたテキストのサフィックスに対するパターンの最長プリフィックスを状態として持つオートマトンを分割パターンについて構成する。図1に分割パターンを用いたオートマトンによってパターンマッチングを実施するための構成を示す。オートマトンによる検索では、関数に基づいてテキストt1…tnをk個のテキスト列として振り分ける。
t s + i t s + i + k ... t s + i + (m / k-1) k = p i p i + k ... p i + (m / k-1) k
Next, an automaton having the longest prefix of the pattern with respect to the suffix of the text input so far as a state is configured for the division pattern. FIG. 1 shows a configuration for performing pattern matching by an automaton using divided patterns. In the search by the automaton, the texts t 1 ... T n are sorted as k text strings based on the function.

関数の具体例として、テキストの先頭から順番に振り分ける場合には、分割後のテキストDTi(i=1,…,k)はtii+k…ti+(n/k-1)kと表記できる。そして、それぞれの分割テキストDTiを、各分割パターンに対応するオートマトンに入力する。 As a specific example of the function, when sorting in order from the beginning of the text, the divided text DT i (i = 1,..., K) is expressed as t i t i + k ... t i + (n / k−1) k Can be written. Then, each divided text DT i is input to the automaton corresponding to each divided pattern.

適切なタイミングで全ての分割パターンに対応するオートマトンが最終状態に遷移したか否かを判定することによって、パターン全体と一致したか否かを判定する。また、各オートマトンを並列に動作させることによって、テキストとパターンとのマッチングを文字単位で並列処理することが可能である。   By determining whether or not the automaton corresponding to all the divided patterns has transitioned to the final state at an appropriate timing, it is determined whether or not it matches the entire pattern. In addition, by matching each automaton in parallel, text and pattern matching can be processed in parallel on a character basis.

図2はababcdを分割パターンを用いたオートマトンによって文字単位の並列処理を行う場合を例示している。   FIG. 2 exemplifies a case where abbcd is subjected to character unit parallel processing by an automaton using a division pattern.

さらに並列化に加えて、オートマトンを図3、図4のように、オートマトンの各処理を複数ステージに細分化し、同じオートマトンに対して入力される異なる分割テキストを時分割して入力することによって、テキストとパターンとのマッチングを文字単位でパイプライン処理することができる。   Furthermore, in addition to parallelization, the automaton is divided into a plurality of stages as shown in FIGS. 3 and 4, and different divided texts inputted to the same automaton are input in a time-sharing manner. Matching between text and patterns can be pipelined in character units.

個々の分割パターンと分割テキストとの比較を個別のオートマトンを用いて行う場合に、そのオートマトン数は分割パターン数の二乗に比例する。例えば、図2では2つの分割パターンの比較に対し4つのオートマトンを必要としている。これを、Aho−Corasickに基づいて、オートマトンを合成することによって、オートマトン数を削減した構成を図5に示す。分割パターンを合成した場合には、パターンマッチングに必要なオートマトンの個数は分割パターンの数に比例する。図6はababcdを分割パターンし、そのオートマトンを合成することによって、パターンマッチングを行う場合を例示している。図2と比較すると必要なオートマトンの個数は半分になっている。   When the comparison between each divided pattern and divided text is performed using individual automata, the number of the automaton is proportional to the square of the number of divided patterns. For example, in FIG. 2, four automata are required for comparison of two division patterns. FIG. 5 shows a configuration in which the automaton number is reduced by synthesizing the automaton based on Aho-Corasick. When the divided patterns are synthesized, the number of automaton necessary for pattern matching is proportional to the number of divided patterns. FIG. 6 illustrates a case where pattern matching is performed by dividing ababcd into patterns and synthesizing the automaton. Compared to FIG. 2, the required number of automata is halved.

最終状態判定部2は、オートマトンの現在の状態が最終状態であるか否かを判定する。図7はオートマトンをメモリ表現した場合の最終状態判定部2の実装例を示す。オートマトンの状態を入力として、最終状態に遷移しているか否かを示す信号を出力する。一方、オートマトンを回路で表現する場合は、各最終状態を表す状態のレジスタの値を出力するのみでよい。   The final state determination unit 2 determines whether or not the current state of the automaton is the final state. FIG. 7 shows an implementation example of the final state determination unit 2 when the automaton is expressed in memory. Using the automaton state as an input, a signal indicating whether or not the state has transitioned to the final state is output. On the other hand, when expressing an automaton with a circuit, it is only necessary to output the value of a register in a state representing each final state.

図8は、オートマトンをメモリ表現し、パターンを4つに分割した場合を示している。図8では、テキストから生成される4つの分割テキストのうち、2つをパイプライン処理している。さらに、オートマトンを2つ並列に配置することによって、2つの文字を並列処理している。回路展開した場合も同様に、各状態を表現する回路を2つのステージに細分化したオートマトンを2つ並列に配置する。そして、図8と同様の方法で、テキストを分割してオートマトンに入力し、各分割パターンが最終状態に遷移したか否かを判定することでパターンマッチングが実施可能である。   FIG. 8 shows a case where the automaton is expressed in memory and the pattern is divided into four. In FIG. 8, two of the four divided texts generated from the text are pipeline processed. Furthermore, by arranging two automata in parallel, two characters are processed in parallel. Similarly, when the circuit is expanded, two automatons obtained by subdividing the circuit expressing each state into two stages are arranged in parallel. Then, the pattern matching can be performed by dividing the text and inputting it into the automaton by the same method as in FIG. 8, and determining whether each divided pattern has transitioned to the final state.

本発明によれば、パターンマッチングをハードウェア処理した際の各種遅延の隠蔽およびスループットの向上を可能とすることができるため、効率の高いパターンマッチング処理を行うことができるパターンマッチング装置を実現することができる。また、パターンマッチングを汎用の情報処理装置とプログラムとを用いて実現する際にも各種遅延の隠蔽およびスループットの向上を可能とすることができるため、効率の高いパターンマッチング処理を行うことができるパターンマッチング装置を実現することができる。   According to the present invention, since it is possible to conceal various delays and improve throughput when hardware processing is performed for pattern matching, it is possible to realize a pattern matching apparatus capable of performing highly efficient pattern matching processing. Can do. In addition, it is possible to conceal various delays and improve throughput even when realizing pattern matching using a general-purpose information processing device and program, so that pattern matching processing with high efficiency can be performed. A matching device can be realized.

分割パターンを用いたパターンマッチング装置の構成図。The block diagram of the pattern matching apparatus using a division | segmentation pattern. 分割パターンを用いたオートマトンによって文字単位の並列処理を行う実施例を示す図。The figure which shows the Example which performs the parallel processing of a character unit by the automaton using a division | segmentation pattern. メモリを用いたオートマトンによってパイプライン処理する構成を示す図。The figure which shows the structure which pipeline-processes by the automaton using memory. 回路展開したオートマトンによってパイプライン処理する構成を示す図。The figure which shows the structure which pipeline-processes by the automaton which expanded the circuit. 分割パターンを合成したパターンマッチング装置の構成図。The block diagram of the pattern matching apparatus which synthesize | combined the division | segmentation pattern. 分割パターンを合成したパターンマッチングの実施例を示す図。The figure which shows the Example of the pattern matching which synthesize | combined the division | segmentation pattern. メモリ表現した場合の最終状態判定部を示す図。The figure which shows the final state determination part at the time of memory expression. オートマトンをメモリ表現した場合の実施例を示す図。The figure which shows the Example at the time of expressing an automaton by memory. Aho−Corasickに基づいて生成されるオートマトンを示す図。The figure which shows the automaton produced | generated based on Aho-Corasick. メモリを用いたオートマトンの実現例を示す図。The figure which shows the implementation example of the automaton using memory. オートマトンの回路展開例を示す図。The figure which shows the circuit development example of an automaton.

1 オートマトン部
2 最終状態判定部
3 合成済みオートマトン部
1 Automaton part 2 Final state judgment part 3 Synthesized automaton part

Claims (10)

入力文字列であるテキストから任意文字列であるパターンを検索するパターンマッチング装置において、
前記パターンの各文字を先頭から順番にk−1(kは2以上の整数)文字置きに振り分けることによって一つのパターンをk個に分割した分割パターンについて、それぞれが互いに異なる前記分割パターンを保持し、これまでに入力されたテキストのサフィックスに対する前記保持している分割パターンの最長プリフィックスを状態として持つk個のオートマトン部を並列させて構成したオートマトン部の組をk組と、
前記テキストの各文字を先頭から順番にk−1文字置きに振り分けることによって一つのテキストをk個の分割テキストに分割し、k組の前記オートマトン部の組のそれぞれに互いに異なる前記分割テキストを入力する手段と、
k組の前記オートマトン部の組全てについて、該オートマトン部の組を構成するオートマトン部のいずれかが最終状態になり、かつ互いに異なる前記分割パターンを保持したk個のオートマトン部が該最終状態になったか否かを判定することによってパターンマッチングを行う手段と
を備えたことを特徴とするパターンマッチング装置。
In the pattern matching apparatus for searching for a pattern which is the input character text or RaTsutomu meaning string is a column,
The divided patterns by dividing each character k-1 from the beginning in order to (k is an integer of 2 or more) characters placed one pattern by that distributed to the pattern to the k, the division pattern is different from each other A set of k automaton parts configured by arranging k automaton parts having the longest prefix of the held division pattern as a state with respect to the suffix of the text inputted so far, and
By dividing each character of the text into k-1 characters in order from the top, one text is divided into k divided texts, and the different divided texts are input to each of the k sets of automaton parts. Means to
For all of the k sets of automaton parts, one of the automaton parts constituting the automaton part group is in a final state, and k automaton parts holding the different division patterns are in the final state. A pattern matching device comprising: means for performing pattern matching by determining whether or not the
前記オートマトン部の組をパイプライン化して実現し、このパイプライン化された前記オートマトン部の組に対し、前記分割テキストと前記分割パターンとの比較を時分割して行うパイプライン処理手段を備えた
ことを特徴とする請求項1記載のパターンマッチング装置。
A set of the automaton portion implemented by pipelined, the pipelined set of automata portion to include a pipeline processing unit for performing time-divided comparison with the divided text before Symbol division pattern The
The pattern matching apparatus according to claim 1.
前記オートマトン部の組のそれぞれを、互いに異なる前記分割パターンを保持したk個のオートマトンを合成した、互いに異なる前記分割パターンにそれぞれ対応したk個の最終状態を持つ単一のオートマトン部に置き換えた
ことを特徴とする請求項1または2に記載のパターンマッチング装置。
Each of the set of automaton parts is replaced with a single automaton part having k final states respectively corresponding to the different divided patterns , which is a combination of k automaton parts holding the different divided patterns .
The pattern matching apparatus according to claim 1, wherein:
パターンマッチング装置が、入力文字列であるテキストから任意文字列であるパターンを検索するパターンマッチング方法において、
前記パターンの各文字を先頭から順番にk−1(kは2以上の整数)文字置きに振り分けることによって一つのパターンをk個に分割した分割パターンについて、それぞれが互いに異なる前記分割パターンを保持し、これまでに入力されたテキストのサフィックスに対する前記保持している分割パターンの最長プリフィックスを状態として持つk個のオートマトン部を並列させて構成したオートマトン部の組をk組用い
文字列入力手段が、入力文字列の前記テキストの各文字を先頭から順番にk−1文字置きに振り分けることによって一つのテキストをk個の分割テキストに分割し、k組の前記オートマトン部の組のそれぞれに互いに異なる前記分割テキストを入力するステップと、
判定手段が、k組の前記オートマトン部の組全てについて、該オートマトン部の組を構成するオートマトン部のいずれかが最終状態になり、かつ互いに異なる前記分割パターンを保持したk個のオートマトン部が該最終状態になったか否かを判定することによってパターンマッチングを行うステップと
を実行することを特徴とするパターンマッチング方法。
Pattern matching apparatus, in the pattern matching method for searching for text or RaTsutomu pattern is meaning string is the input character string,
The divided patterns by dividing each character k-1 from the beginning in order to (k is an integer of 2 or more) characters placed one pattern by that distributed to the pattern to the k, the division pattern is different from each other Using k sets of automaton parts that are formed by paralleling k automaton parts having the longest prefix of the held division pattern with respect to the suffix of the text inputted so far,
The character string input means divides each text of the text of the input character string into k divided texts in order from the beginning in order of k-1 characters, and sets k sets of automaton parts. Inputting the divided text different from each other in each of
The determination means has, for all the k sets of the automaton parts, any one of the automaton parts constituting the set of the automaton parts is in a final state, and k automaton parts holding the division patterns different from each other are A pattern matching method comprising: performing pattern matching by determining whether or not a final state has been reached.
前記オートマトン部の組をパイプライン化して実現し、このパイプライン化された前記オートマトン部の組に対し、前記分割テキストと前記分割パターンとの比較を時分割して行うパイプライン処理ステップを実行する
ことを特徴とする請求項4記載のパターンマッチング方法。
A set of the automaton portion implemented by pipelined, the pipelined set of automata portion to the execution pipeline processing step of performing time-divided comparison with the divided text before Symbol division pattern Do
The pattern matching method according to claim 4, wherein:
前記オートマトン部の組のそれぞれを、互いに異なる前記分割パターンを保持したk個のオートマトンを合成した、互いに異なる前記分割パターンにそれぞれ対応したk個の最終状態を持つ単一のオートマトン部に置き換えた
ことを特徴とする請求項4または5記載のパターンマッチング方法。
Each of the set of automaton parts is replaced with a single automaton part having k final states respectively corresponding to the different divided patterns , which is a combination of k automaton parts holding the different divided patterns .
6. The pattern matching method according to claim 4 or 5, wherein:
情報処理装置にインストールすることにより、その情報処理装置に、
入力文字列であるテキストから任意文字列であるパターンを検索するパターンマッチング装置に相応する機能を実現させるプログラムにおいて、
前記パターンの各文字を先頭から順番にk−1(kは2以上の整数)文字置きに振り分けることによって一つのパターンをk個に分割した分割パターンについて、それぞれが互いに異なる前記分割パターンを保持し、これまでに入力されたテキストのサフィックスに対する前記保持している分割パターンの最長プリフィックスを状態として持つk個のオートマトン部を並列させて構成したオートマトン部の組k組に相応する機能と、
前記テキストの各文字を先頭から順番にk−1文字置きに振り分けることによって一つのテキストをk個の分割テキストに分割し、k組の前記オートマトン部の組のそれぞれに互いに異なる前記分割テキストを入力する機能と、
k組の前記オートマトン部の組全てについて、該オートマトン部の組を構成するオートマトン部のいずれかが最終状態になり、かつ互いに異なる前記分割パターンを保持したk個のオートマトン部が該最終状態になったか否かを判定することによってパターンマッチングを行う機能と
を実現させることを特徴とするプログラム。
By installing on an information processing device,
A program for realizing functions corresponding to the pattern matching apparatus for searching the input character is a text or RaTsutomu meaning string is the column pattern,
The divided patterns by dividing each character k-1 from the beginning in order to (k is an integer of 2 or more) characters placed one pattern by that distributed to the pattern to the k, the division pattern is different from each other A function corresponding to a set k of automaton parts configured by holding k automaton parts having the longest prefix of the held divided pattern as a state with respect to the suffix of the text input so far,
By dividing each character of the text into k-1 characters in order from the top, one text is divided into k divided texts, and the different divided texts are input to each of the k sets of automaton parts. Function to
For all of the k sets of automaton parts, one of the automaton parts constituting the automaton part group is in a final state, and k automaton parts holding the different division patterns are in the final state. A program that realizes the function of performing pattern matching by determining whether or not the
前記オートマトン部の組をパイプライン化して実現し、このパイプライン化された前記オートマトン部の組に対し、前記分割テキストと前記分割パターンとの比較を時分割して行うパイプライン処理機能を実現させる
ことを特徴とする請求項7記載のプログラム。
A set of the automaton portion implemented by pipelined, the pipelined set of automata portion to realize pipeline processing function for performing the divided text and by dividing the time compared with the previous SL division pattern Make
The program according to claim 7, wherein:
前記オートマトン部の組のそれぞれを、互いに異なる前記分割パターンを保持したk個のオートマトン合成した、互いに異なる前記分割パターンにそれぞれ対応したk個の最終状態を持つ単一のオートマトン部に置き換えた
ことを特徴とする請求項7または8のいずれかに記載のプログラム。
Each of the set of automaton parts is replaced with a single automaton part having k final states respectively corresponding to the different divided patterns , which is a combination of k automaton parts holding the different divided patterns .
The program according to any one of claims 7 and 8 , characterized in that:
請求項7ないし9のいずれかに記載のプログラムが記録されたことを特徴とする前記情報処理装置読み取り可能な記録媒体。 The information processing apparatus readable recording medium according to claim 7 to program according to any of the 9, characterized in that it is recorded.
JP2004051680A 2004-02-26 2004-02-26 Pattern matching apparatus and method, and program Expired - Lifetime JP4347087B2 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2004051680A JP4347087B2 (en) 2004-02-26 2004-02-26 Pattern matching apparatus and method, and program

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2004051680A JP4347087B2 (en) 2004-02-26 2004-02-26 Pattern matching apparatus and method, and program

Publications (2)

Publication Number Publication Date
JP2005242672A JP2005242672A (en) 2005-09-08
JP4347087B2 true JP4347087B2 (en) 2009-10-21

Family

ID=35024350

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2004051680A Expired - Lifetime JP4347087B2 (en) 2004-02-26 2004-02-26 Pattern matching apparatus and method, and program

Country Status (1)

Country Link
JP (1) JP4347087B2 (en)

Families Citing this family (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7702629B2 (en) * 2005-12-02 2010-04-20 Exegy Incorporated Method and device for high performance regular expression pattern matching
JP5120263B2 (en) 2007-01-12 2013-01-16 日本電気株式会社 Pattern matching apparatus and method
EP2056221A1 (en) * 2007-10-30 2009-05-06 Mitsubishi Electric Corporation Split state machines for matching
CN102084357B (en) 2008-07-01 2014-06-04 富士通株式会社 Search device and search method
JP5224953B2 (en) 2008-07-17 2013-07-03 インターナショナル・ビジネス・マシーンズ・コーポレーション Information processing apparatus, information processing method, and program
US8766666B2 (en) 2010-06-10 2014-07-01 Micron Technology, Inc. Programmable device, hierarchical parallel machines, and methods for providing state information
US8593175B2 (en) * 2011-12-15 2013-11-26 Micron Technology, Inc. Boolean logic in a state machine lattice
JP5904045B2 (en) * 2012-07-24 2016-04-13 住友電気工業株式会社 Information processing apparatus and information processing program

Also Published As

Publication number Publication date
JP2005242672A (en) 2005-09-08

Similar Documents

Publication Publication Date Title
CN107111623B (en) Parallel history search and encoding for dictionary-based compression
US20080086274A1 (en) Method and Apparatus for Protein Sequence Alignment Using FPGA Devices
US20140019486A1 (en) Logic Content Processing for Hardware Acceleration of Multi-Pattern Search
JP2009535747A5 (en)
CN103309893B (en) The comparative approach of a kind of character string and device
CN106778079A (en) A kind of DNA sequence dna k mer frequency statistics methods based on MapReduce
JP4347087B2 (en) Pattern matching apparatus and method, and program
US20050120017A1 (en) Efficient retrieval of variable-length character string data
JP2005242997A (en) Data retrieval device and method
Dandass et al. Accelerating string set matching in FPGA hardware for bioinformatics research
JP2010123000A (en) Web page group extraction method, device and program
Baker et al. Automatic synthesis of efficient intrusion detection systems on FPGAs
JP2007233554A (en) Search method of high-speed pattern matching device
JP4347086B2 (en) Pattern matching apparatus and method, and program
Dalkilic et al. A simple shuffle-based stable in-place merge algorithm
CN114827030B (en) Flow classification device based on folded SRAM and table entry compression method
JP5429164B2 (en) Finite automaton generation system
JP7172687B2 (en) Information processing device, information processing method, and program
WO2018012413A1 (en) Similar data search device, similar data search method, and recording medium
Bozdag et al. Parallel short sequence mapping for high throughput genome sequencing
Surendar et al. A parallel reconfigurable platform for efficient sequence alignment
Saha et al. An approach to enhance the design of protein sequence classifier using data mining
Bijoy et al. RBS: a new comparative and better solution of sorting algorithm for array
JPH04111064A (en) Parallel string search device
Öztekin et al. Using FPGA-based content-addressable memory for mnemonics instruction searching in assembler design

Legal Events

Date Code Title Description
A621 Written request for application examination

Free format text: JAPANESE INTERMEDIATE CODE: A621

Effective date: 20060407

A131 Notification of reasons for refusal

Free format text: JAPANESE INTERMEDIATE CODE: A131

Effective date: 20090414

RD01 Notification of change of attorney

Free format text: JAPANESE INTERMEDIATE CODE: A7426

Effective date: 20090605

RD02 Notification of acceptance of power of attorney

Free format text: JAPANESE INTERMEDIATE CODE: A7422

Effective date: 20090605

RD04 Notification of resignation of power of attorney

Free format text: JAPANESE INTERMEDIATE CODE: A7424

Effective date: 20090605

A521 Written amendment

Free format text: JAPANESE INTERMEDIATE CODE: A523

Effective date: 20090615

TRDD Decision of grant or rejection written
A01 Written decision to grant a patent or to grant a registration (utility model)

Free format text: JAPANESE INTERMEDIATE CODE: A01

Effective date: 20090714

A01 Written decision to grant a patent or to grant a registration (utility model)

Free format text: JAPANESE INTERMEDIATE CODE: A01

A61 First payment of annual fees (during grant procedure)

Free format text: JAPANESE INTERMEDIATE CODE: A61

Effective date: 20090715

R150 Certificate of patent or registration of utility model

Ref document number: 4347087

Country of ref document: JP

Free format text: JAPANESE INTERMEDIATE CODE: R150

Free format text: JAPANESE INTERMEDIATE CODE: R150

FPAY Renewal fee payment (event date is renewal date of database)

Free format text: PAYMENT UNTIL: 20120724

Year of fee payment: 3

FPAY Renewal fee payment (event date is renewal date of database)

Free format text: PAYMENT UNTIL: 20130724

Year of fee payment: 4

S531 Written request for registration of change of domicile

Free format text: JAPANESE INTERMEDIATE CODE: R313531

R350 Written notification of registration of transfer

Free format text: JAPANESE INTERMEDIATE CODE: R350