JPH0746362B2 - String matching method - Google Patents

String matching method

Info

Publication number
JPH0746362B2
JPH0746362B2 JP61020239A JP2023986A JPH0746362B2 JP H0746362 B2 JPH0746362 B2 JP H0746362B2 JP 61020239 A JP61020239 A JP 61020239A JP 2023986 A JP2023986 A JP 2023986A JP H0746362 B2 JPH0746362 B2 JP H0746362B2
Authority
JP
Japan
Prior art keywords
state
pattern
character
entry
memory
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
JP61020239A
Other languages
Japanese (ja)
Other versions
JPS62179083A (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 JP61020239A priority Critical patent/JPH0746362B2/en
Publication of JPS62179083A publication Critical patent/JPS62179083A/en
Publication of JPH0746362B2 publication Critical patent/JPH0746362B2/en
Anticipated expiration legal-status Critical
Expired - Lifetime legal-status Critical Current

Links

Description

【発明の詳細な説明】 (発明の属する技術分野) 本発明は、テキストと呼ばれる比較的長い文字列中に、
別途与えられたパタンと呼ばれる比較的短い文字列が、
部分列として存在するか否かを判定し、存在する場合
は、存在するパタン全てを抽出する文字列照合方法に関
するものである。
Description: TECHNICAL FIELD The present invention relates to a relatively long character string called text.
A relatively short character string called a pattern given separately,
The present invention relates to a character string collating method for determining whether or not a substring exists and, if it exists, extracting all existing patterns.

(従来の技術) データ処理システムの分野では、文章等の文字列データ
の集りの中から、パタンと呼ばれる特定の部分文字列を
含むもののみを検索したり、文字列データの中に含まれ
る全てのパタンを抽出することがしばしば必要となる。
(Prior Art) In the field of data processing systems, a collection of character string data such as sentences is searched for only those that include a specific sub-character string called a pattern, or all data included in character string data is searched. Often it is necessary to extract the pattern.

通常、1つの文字はnビットの固定長のコードで表現さ
れるため、文字列データはnビット単位のコードの系列
となる。
Usually, one character is expressed by a fixed-length code of n bits, so the character string data is a series of codes in n-bit units.

一般に文字列データは、磁気ディスク等の電子計算機の
外部記憶装置に格納されており、検索時に中央処理装置
へ1文字ずつ直列に転送される。従って、処理時間の短
縮のためには、データの転送と同時に検索を行うことが
必要となる。
Generally, character string data is stored in an external storage device of an electronic computer such as a magnetic disk, and is serially transferred character by character to a central processing unit at the time of retrieval. Therefore, in order to reduce the processing time, it is necessary to perform the search at the same time as the data transfer.

第3図は従来の文字列照合機構の説明図であり、1は文
字列データが格納された記憶装置、2は文字列の照合を
行う文字列照合装置、3は文字列データ転送路、4は検
索結果を出力する信号線である。
FIG. 3 is an explanatory view of a conventional character string collating mechanism, 1 is a storage device in which character string data is stored, 2 is a character string collating device for collating character strings, 3 is a character string data transfer path, 4 Is a signal line for outputting a search result.

文字列データは記憶装置1からデータ転送路3を経由し
て文字列照合装置2へ1文字ずつ直列に入力される。
The character string data is serially input character by character from the storage device 1 to the character string collating device 2 via the data transfer path 3.

文字列照合装置2では、予め記憶されているパタンとな
る部分文字列と入力されたデータを照合し、両者の一致
が検出された時点で信号線4に一致信号を出力する。
The character string collation device 2 collates a partial character string that is a pattern stored in advance with the input data, and outputs a coincidence signal to the signal line 4 when a coincidence between the two is detected.

文字列照合装置2において文字列の照合を行う方法とし
て、従来より有限オートマンを用いる方法が一般に知ら
れている。
As a method for collating character strings in the character string collating device 2, a method using a finite automan has been generally known.

(L.A.Hollaar“Hardwarae ystem for Text Informatio
n Retrieval"ACM SIGIR 6th Conference 1983) 第4図は有限オートマトンの状態遷移を表わした説明図
である。
(LAHollaar “Hardwarae ystem for Text Informatio
n Retrieval "ACM SIGIR 6th Conference 1983) FIG. 4 is an explanatory diagram showing the state transition of a finite automaton.

題4図において、5はオートマトンの状態、6は状態遷
移の方向を表わし、文字列データの中の“DOG"という3
文字のパタンを照合することができる。
In Fig.4, 5 is the state of the automaton, 6 is the direction of the state transition, and is called "DOG" in the character string data.
You can check the pattern of characters.

以下、この動作を説明する。This operation will be described below.

オートマトンの初期状態は状態(0)であり、入力文字
が“D"であると状態(1)へ遷移する。
The initial state of the automaton is state (0), and when the input character is "D", it transits to state (1).

第2図において“#”はその他の文字を表わし、状態
(0)における入力文字が“D"以外ならば引き続き状態
(0)に留まる。
In FIG. 2, "#" represents another character, and if the input character in the state (0) is other than "D", it remains in the state (0).

状態(1)についても同様であり、入力文字が“O"なら
ば状態(2)へ、“D"ならば再び状態(1)へ、それ以
外ならば状態(0)へ遷移する。
The same applies to the state (1). If the input character is "O", the state is changed to the state (2). If the input character is "D", the state is changed to the state (1). Otherwise, the state is changed to the state (0).

状態(2)において入力文字が“G"ならば状態(3)へ
遷移し、(DOG)というキーを検出したことになり、第
3図の信号線4から一致信号が出力される。
If the input character is "G" in the state (2), the state transits to the state (3), the key (DOG) is detected, and the coincidence signal is output from the signal line 4 in FIG.

第5図は8ビットのJISコードで表現された文字列デー
タを対象とする従来の決定性有限オートマトンの実現回
路構成の説明図である。
FIG. 5 is an explanatory diagram of a circuit configuration of a conventional deterministic finite automaton for character string data represented by 8-bit JIS code.

第5図において、3は文字列データ転送路、4は検出結
果を出力する信号線、7は16ビットのアドレシレジス
タ、8と20はそれぞれ64KB(256×28B)のランダムアク
セス・メモリ(RAMと略す)、9はアドレスデコーダ、1
0と21はそれぞれ8ビットのメモリレジスタ、12,14,24,
25は8ビット幅のデータ線、13は16ビット幅のアドレス
線、22は検出パタンの判別回路、23はアドレスデコーダ
出力線である。
In FIG. 5, 3 string data transfer channel, 4 denotes a signal line for outputting a detection result, 7 16-bit address shea register, random access memory 64KB respectively 8 and 20 (256 × 2 8 B) (Abbreviated as RAM), 9 is an address decoder, 1
0 and 21 are 8-bit memory registers, 12, 14, 24,
Reference numeral 25 is an 8-bit width data line, 13 is a 16-bit width address line, 22 is a detection pattern discrimination circuit, and 23 is an address decoder output line.

第6図は従来の状態遷移表の構成図であり、パタンが
“ABC"と“BCD"の場合の、第5図のランダムアクセス・
メモリ8に格納される従来の状態遷移表の内容の一例を
表わしたものであり、16は16進数表現の8ビットデータ
であり、次の状態番号を表わす。
FIG. 6 is a block diagram of a conventional state transition table. In the case of the patterns “ABC” and “BCD”, the random access of FIG.
16 shows an example of the contents of a conventional state transition table stored in the memory 8, 16 is 8-bit data in hexadecimal notation and represents the next state number.

17はメモリアドレスの上位8ビット、18はメモリアドレ
スの下位8ビットである。なお、論理的にはメモリの上
位アドレス17が状態番号、メモリの下位アドレス18が文
字コードに対応しており、19はメモリの下位アドレス18
のコードによって表現されるコード対応の文字である。
17 is the upper 8 bits of the memory address, and 18 is the lower 8 bits of the memory address. Logically, the upper address 17 of the memory corresponds to the state number, the lower address 18 of the memory corresponds to the character code, and 19 is the lower address 18 of the memory.
It is a character corresponding to the code expressed by the code.

第7図は従来のパタン検出判定表の構成図であり、同じ
くパタンが“ABC"と“BCD"の場合の、第5図のランダム
アクセス・メモリ20に格納される従来のパタン検出判定
表の内容を表わしたものであり、26は8ビットデータで
あり検出パタン符号を表わす。27はメモリアドレスの上
位8ビット、28はメモリアドレス下位8ビットであり、
構成としては第6図の状態遷移表と同一である。
FIG. 7 is a configuration diagram of a conventional pattern detection determination table. Similarly, when the patterns are “ABC” and “BCD”, the conventional pattern detection determination table stored in the random access memory 20 of FIG. 5 is shown. 26 represents 8-bit data and represents a detection pattern code. 27 is the upper 8 bits of the memory address, 28 is the lower 8 bits of the memory address,
The configuration is the same as the state transition table of FIG.

テキストの入力文字はデータ転送路3よりアドレスレジ
スタ7の下位8ビットにセットされる。アドレスレジス
タ7の上位8ビットには初期値としてオールゼロがセッ
トされており、アドレス線3を経由してアドレスデコー
ダ9に入力される。
The input character of the text is set in the lower 8 bits of the address register 7 through the data transfer path 3. All zeros are set in the upper 8 bits of the address register 7 as an initial value and input to the address decoder 9 via the address line 3.

アドレスデコーダ9の出力は出力線23によって2方向へ
分配され、ランダアクセス・メモリ8から当該アドレス
に格納されている8ビットのデータ16が読出され、デー
タ線14を経由してメモリレジスタ10へセットされると共
に、ランダムアクセス・メモリ20からも同一アドレスに
格納されている8ビットのデータ26が読出され、データ
線24を経由してメモリレジスタ21にセットされる。
The output of the address decoder 9 is distributed in two directions by the output line 23, and the 8-bit data 16 stored at the address is read from the random access memory 8 and set in the memory register 10 via the data line 14. At the same time, the 8-bit data 26 stored at the same address is read from the random access memory 20 and set in the memory register 21 via the data line 24.

メモリレジスタ10の内容は、テキストの次の入力文字が
アドレスレジスタ7の下位ビットにセットされる時に、
データ線12を経由してアドレスレジスタ7の上位ビット
にセットされる。
The contents of memory register 10 will contain the contents of the next input character of the text when the lower bit of address register 7 is set.
It is set in the upper bits of the address register 7 via the data line 12.

メモリレジスタ21の内容は、データ線25により判別回路
22に加えられ、値がオールゼロ以外なら信号線4に検出
信号およびメモリレジスタ21の内容が出力される。
The content of the memory register 21 is discriminated by the data line 25.
If the value is added to 22, and the value is not all zero, the detection signal and the contents of the memory register 21 are output to the signal line 4.

以上の動作をデータ転送路3から1文字入力される毎に
繰り返すことにより、テキストとパタンの照合処理が実
行される。
By repeating the above operation every time one character is input from the data transfer path 3, the collation process of the text and the pattern is executed.

以上説明した従来の方法では、各状態において、各入力
文字に対して1回のテーブル牽引動作で次の状態を決定
するために、即ち、決定性有限オートマトンにするため
に、文字コードの全てに対応するエントリが必要であっ
た。
In the conventional method described above, in each state, in order to determine the next state by one table pulling operation for each input character, that is, to make a deterministic finite automaton, all character codes are supported. Needed an entry to.

上記の説明例においては、各状態当り28=256エントリ
である。
In the example above, there are 2 8 = 256 entries for each state.

また文字が16ビットのコードで表現される場合は216=6
5536エントリである。しかし、上記説明例でも分かる様
に、256エントリの中で初期状態以外の有意な遷移情報
が記入されているのは数エントリである。他のエントリ
には初期状態への遷移情報が記入されている。
If the character is represented by a 16-bit code, 2 16 = 6
There are 5536 entries. However, as can be seen from the above-mentioned explanation example, among the 256 entries, significant transition information other than the initial state is entered in only a few entries. Transition information to the initial state is entered in the other entries.

この様に、従来方法では状態遷移表およびパタン検出判
定表を格納するRAMが有意な情報を格納するに必要な容
量以上になるという欠点があった。
As described above, the conventional method has a drawback that the RAM for storing the state transition table and the pattern detection judgment table has a capacity larger than that required for storing significant information.

(発明の目的) 本発明は、状態遷移表およびパタン検出判定表を格納す
るメモリが不必要に大きくなる点を解決した、有限オー
トマトンによる文字列照合方法を提供することにある。
(Object of the Invention) It is an object of the present invention to provide a character string collating method using a finite automaton, which solves the problem that the memory for storing the state transition table and the pattern detection judgment table becomes unnecessarily large.

(発明の構成) (発明の特徴と従来の技術との差異) 本発明は、状態遷移表および検出パタン判定表を格納す
るメモリとして、連想メモリ〔アドレス内蔵メモリ;Con
tent Address Memory(CAMと略す)とも呼ばれる〕を使
用することも最も主要の特徴とする。
(Structure of the Invention) (Differences between Features of the Invention and Conventional Techniques) The present invention relates to an associative memory (address built-in memory; Con) as a memory for storing a state transition table and a detection pattern determination table.
It is also called tent Address Memory (abbreviated as CAM)].

状態遷移表において、次の状態番号が初期以外のエント
リ、または、検出パタン判定表の内容がオールゼロ以外
のエントリを有意なエントリと呼び、このエントリに対
応する状態番号と文字コードとの組のみをCAMに格納
し、対応する次の状態番号とパタン検出符号をCAMに関
連付けられたRAMの対応する番地にそれぞれ格納する。
In the state transition table, an entry whose next state number is other than the initial one, or an entry whose detection pattern determination table has a content other than all zeros is called a significant entry, and only the combination of the state number and character code corresponding to this entry is called. The data is stored in the CAM, and the corresponding next state number and pattern detection code are stored in the corresponding addresses in the RAM associated with the CAM.

テキストから1文字入力される毎に、現在の状態番号と
入力文字の組として、CAMに対して一致検索する。
Every time one character is input from the text, the CAM is searched for a match as a set of the current state number and the input character.

一致エントリが有る場合は、当該エントリと関連付けら
れたRAMから、次の状態番号およびパタン検出符号を得
ることができる。
If there is a matching entry, the next state number and pattern detection code can be obtained from the RAM associated with the entry.

また、一致しなかった場合は、次の状態番号は初期値で
あることが分かり、別途回路でで初期状態番号を作成す
る。
If they do not match, the next state number is found to be the initial value, and a separate circuit creates the initial state number.

従来方法では、ランダムアクセスメモリのみを使用する
ために、有意なエントリ以外も格納する必要があった
が、本発明では有意なエントリのみを格納すればよい点
が異なる。
In the conventional method, since only the random access memory is used, it is necessary to store not only significant entries, but the present invention is different in that only significant entries need to be stored.

(実施例) 第1図は本発明を用いた決定性有限オートマトンの実現
回路の構成を示す一実施例のブロック図であり、8ビッ
トのコードで表現された文字列データを対象とした照合
方法の説明図である。
(Embodiment) FIG. 1 is a block diagram of an embodiment showing a configuration of an implementation circuit of a deterministic finite automaton using the present invention, which is a comparison method for character string data represented by an 8-bit code. FIG.

図において、30は1K語(1語は2B+1ビット)のCAM、3
1はCAMの一致エントリのアドレスを作成するエンコー
ダ、32はCAMに一致エントリが無かった場合に次の状態
番号として初期値を作成する初期状態発生回路、33はCA
Mに対して一致検索を行うデータをセットするCAMアクセ
スレジスタ、34は8ビットのデータ線の選択回路、35は
17ビットのデータ線、36はCAMの一致エントリが表示さ
れるエントリ対応の一致エントリ信号線、37はCAMの一
致エントリのアドレス線、38はCAMに一致エントリが無
かったことを表示する不一致エントリ信号線、40は1K語
(1語は2B)のRAM、41はアドレスデコーダ、42はメモ
リレジスタ、43はアドレスデコーダ出力線、44は16ビッ
トのデータ線、45,46,47は8ビットのデータ線、 301はCAMの有効エントリを表示する1ビットのデータを
格納するエントリ有効性表示ビット格納域、302は8ビ
ットの状態番号格納域、303は8ビットの文字コード格
納域、 401,402は8ビットのデータ格納域で、401は次の状態番
号格納域、402はパタン検出符号格納域である。
In the figure, 30 is a 1K word (1 word is 2B + 1 bit) CAM, 3
1 is an encoder that creates the address of the matching entry of CAM, 32 is an initial state generation circuit that creates an initial value as the next state number when there is no matching entry in CAM, 33 is CA
CAM access register for setting data for matching search for M, 34 for 8-bit data line selection circuit, 35 for
17-bit data line, 36 is a match entry signal line corresponding to an entry in which a match entry of CAM is displayed, 37 is an address line of a match entry of CAM, 38 is a mismatch entry signal indicating that there is no match entry in CAM Line, 40 is 1K word (1 word is 2B) RAM, 41 is address decoder, 42 is memory register, 43 is address decoder output line, 44 is 16-bit data line, 45, 46, 47 are 8-bit data Line, 301 is an entry validity indication bit storage area that stores 1-bit data indicating a valid entry of CAM, 302 is an 8-bit status number storage area, 303 is an 8-bit character code storage area, and 401 and 402 are 8-bit In the data storage area of, 401 is the next state number storage area, and 402 is the pattern detection code storage area.

第2図は第1図に対応する状態遷移表とパタン検出判定
表の構成図であり、与えられたパタンが“ABC"と“BCD"
である場合のCAMとRAMの内容の一例を表わしたものであ
る。
FIG. 2 is a configuration diagram of the state transition table and the pattern detection judgment table corresponding to FIG. 1, and the given patterns are “ABC” and “BCD”.
2 shows an example of the contents of CAM and RAM in the case of.

図において、311,312,313,411,412はそれぞれ301,302,3
03,401,402に格納される内容である。
In the figure, 311,312,313,411,412 are 301,302,3 respectively.
These are the contents stored in 03,401,402.

311は1ビットのデータであり、“1"の時に当該エント
リが有効であることを表わす。
311 is 1-bit data, and when it is "1", it indicates that the entry is valid.

312は16進数表現の8ビットのデータであり、現在の状
態番号を表わす。
312 is 8-bit data in hexadecimal notation and represents the current state number.

313は16進数表現の8ビットのデータであり、文字コー
ドを表わす。
313 is hexadecimal representation 8-bit data and represents a character code.

411は16進数表現の8ビットのデータであり、次の状態
番号を表わす。
411 is 8-bit data in hexadecimal notation and represents the next state number.

412は16審数表現の8ビットのデータであり、パタン検
出符号を表わす。
Reference numeral 412 is 8-bit data expressed in 16 trial numbers and represents a pattern detection code.

323は313のコードによって表現されるコード対応の文字
である。
323 is a character corresponding to the code expressed by the code of 313.

次に、第2図と、従来方法の第6図、第7図との対応関
係について説明する。
Next, the correspondence between FIG. 2 and FIGS. 6 and 7 of the conventional method will be described.

現在の状態番号312は、第6図の17および第7図の27に
対応する。
The current state number 312 corresponds to 17 in FIG. 6 and 27 in FIG.

文字コード313は、第6図の18、第7図の28に対応する
が、第2図の場合はパタン中にある文字コードのみが使
用されている。
The character code 313 corresponds to 18 in FIG. 6 and 28 in FIG. 7, but in the case of FIG. 2, only the character code in the pattern is used.

次の状態番号411は、第6図の16に対応するが、第2図
の場合は、初期状態番号(00)が入っているのはパタン
検出符号412が(00)以外の場合のみである。
The next state number 411 corresponds to 16 in FIG. 6, but in the case of FIG. 2, the initial state number (00) is included only when the pattern detection code 412 is other than (00). .

パタン検出符号412は第7図の26に対応する。The pattern detection code 412 corresponds to 26 in FIG.

次に、第1図の動作について説明する。Next, the operation of FIG. 1 will be described.

入力文字はデータ転送路3よりCAMアクセスレジスタ33
の下位8ビットにセットされる。
Input characters from the data transfer path 3 to CAM access register 33
Is set to the lower 8 bits of.

CAMアクセスレジスタ33の中間8ビットには初期値とし
て(00)がセットされており、CAMアクセスレジスタ33
の上位1ビットは常に“1"がセットされる。
(00) is set as an initial value in the middle 8 bits of the CAM access register 33.
The upper 1 bit of is always set to "1".

CAMアクセスレジスタの17ビットがデータ線35を経由し
てCAMに一致検索される。
The 17 bits of the CAM access register are searched for a match with the CAM via the data line 35.

一致エントリが有った場合は、アドレスエンコーダによ
り当語エントリのアドレスがデータ線37を経由してRAM
のアドレスデコーダ41に転送される。
If there is a matching entry, the address of the word entry is stored in RAM via the data line 37 by the address encoder.
Address decoder 41.

アドレスデコーダでデコードされ、CAMの一致エントリ
に対応する番地から、RAM40の内容411,412が、データ線
44を経由してメモリレジスタ42にセットされる。
The contents 411 and 412 of RAM40 are decoded by the address decoder and the contents corresponding to the matching entry of CAM are transferred to the data line.
It is set in the memory register 42 via 44.

本発明の場合、CAMの複数のエントリと一致することが
ないことは、CAMの内容から明白である。
In the case of the present invention, it is clear from the contents of the CAM that it does not match multiple entries in the CAM.

一致するエントリがない場合は、信号線36が全てゼロで
あることから判定され、不一致エントリ信号線38から不
一致信号が出力される。
If there is no matching entry, it is determined that the signal lines 36 are all zero, and a mismatch signal is output from the mismatch entry signal line 38.

不一致信号が初期状態発生回路32に加えられると、次の
状態番号として(00)が作成され、データ線46を経由し
て選択回路47へ転送される。
When the disagreement signal is applied to the initial state generation circuit 32, (00) is created as the next state number and transferred to the selection circuit 47 via the data line 46.

一致エントリ有りの場合は、メモリレジスタ42の上位8
ビットは、次の状態番号としてデータ線45を経由して選
択回路34へ転送される。
If there is a matching entry, the upper 8 bits of the memory register 42
The bit is transferred to the selection circuit 34 via the data line 45 as the next state number.

また、メモリレジスタ42の下位8ビットはパタン検索符
号として、データ線25を経由して判別回路22に加えら
れ、値が(00)以外なら、信号線4に、検出信号および
データ線25で転送された内容が出力される。
The lower 8 bits of the memory register 42 are added as a pattern search code to the discrimination circuit 22 via the data line 25. If the value is other than (00), the detection signal and the data line 25 are transferred to the signal line 4. The output contents are output.

選択回路34は一致エントリ有りの場合は、データ線45を
選択し、一致エントリ無しの場合は、データ線46を選択
し、データ線47に出力する。
The selection circuit 34 selects the data line 45 when there is a matching entry, and selects the data line 46 when there is no matching entry and outputs it to the data line 47.

データ線47を経由したデータは、次の状態番号としてCA
Mアクセスレジスタ33の中間8ビットにセットされる。
The data sent via the data line 47 is CA as the next status number.
It is set to the middle 8 bits of the M access register 33.

以上の動作をデータ転送路3から1文字入力される毎に
繰り返されることにより、テキストパタンの照合処理が
実行される。
By repeating the above operation every time one character is input from the data transfer path 3, the collation processing of the text pattern is executed.

以上の説明から明らかなように、状態遷移表と検出パタ
ン判定表の有意なエントリのみをCAMに格納すればよい
ので、メモリ容量の削減ができる。
As is clear from the above description, only the significant entries of the state transition table and the detected pattern judgment table need to be stored in the CAM, so the memory capacity can be reduced.

有意なエントリ以外の初期状態への遷移情報は、CAMに
一致するエントリが無かったことを判定することにより
作成している。
The transition information to the initial state other than the significant entries is created by determining that there is no entry that matches the CAM.

なお、上記説明では、初期状態番号として(00)を用い
ていたが、任意の番号を用いることも可能である。
Although (00) is used as the initial state number in the above description, any number can be used.

また、文字コードは8ビットに限らないことも明白であ
る。
It is also clear that the character code is not limited to 8 bits.

CAMに対して一致検索し、一致エントリがあった場合、
当該エントリのアドレスではなく、当該エントリの内容
を出力する機能を有するCAMも知られている。
If there is a matching entry in CAM,
A CAM having a function of outputting the contents of the entry instead of the address of the entry is also known.

この様なCAMを使用する場合は、前記実施例ではRAMに格
納している情報を、CAMの同一エントリの別格納域に格
納することにより、本発明を実施することも可能であ
る。
When such a CAM is used, the present invention can be implemented by storing the information stored in the RAM in the above-mentioned embodiment in another storage area of the same entry of the CAM.

(発明の効果) 以上説明したように、本発明は状態遷移表およびパタン
検出判定表の有意なエントリのみをメモリに格納するだ
けでよいので、次の利点がある。
(Effects of the Invention) As described above, the present invention has the following advantages because only the significant entries of the state transition table and the pattern detection judgment table need be stored in the memory.

一定容量のメモリに格納できるパタンの合計長の上限
が大きくなる。
The upper limit of the total length of patterns that can be stored in a fixed capacity memory becomes large.

一定容量のパタンの状態遷移表とパタン検出判定表を
メモリに格納する時間が短くなる。
The time required to store the state transition table and the pattern detection judgment table of patterns with a fixed capacity in the memory is shortened.

以上の利点は、特に文字コード長が長い場合は、従来方
法との差が著しくなる。
The above advantages are significantly different from the conventional method especially when the character code length is long.

【図面の簡単な説明】[Brief description of drawings]

第1図は本発明を用いた決定性有限オートマトンの表現
回路の構成を示す一実施例のブロック図、第2図は第1
図に対応する状態遷移表とパタン検出判定表の構成図、
第3図は従来の文字列照合機構の説明図、第4図は有限
オートマトンの状態遷移を表わした説明図、第5図は8
ビットのJISコードで表現された文字列データを対象と
する従来の決定性有限オートマトンの実現回路構成の説
明図、第6図は従来の状態遷移表の構成図、第7図は従
来のパタン検出判定表の構成図である。 1……記憶装置、2……文字列照合装置、 3……データ転送路、4……信号線、 5……オートマトンの状態、 6……状態遷移の方向、 7……アドレスレジスタ、 8,20,40……ランダムアクセス・メモリ、 9,41……アドレスデコーダ、 10,21,42……メモリレジスタ、 12,14,24,25,35,44,45,46,47……データ線、 13,37……アドレス線、 16,26……データ、 17,27……メモリの上位アドレス、 18,28……メモリの下位アドレス、 19,29,323……コード対応の文字、 22……判別回路、 23,43……アドレスデコーダ出力線、 30……連想メモリ(CAM)、 31……アドレスエンコーダ、 32……初期状態発生回路、 33……CAMアクセスレジスタ、 34……選択回路、 36……CAMの一致エントリ信号線、 37……CAMの一致エントリアドレス線、 38……CAMの不一致エントリ信号線、 301……エントリ有効性表示ビット格納域、 302……状態番号格納域、 303……文字コード格納域、 311……エントリ有効性表示ビット、 312……状態番号、313……文字コード、 401……次の状態番号格納域、 402……パタン検出符号格納域、 411……次の状態番号、 412……パタン検出符号。
FIG. 1 is a block diagram of an embodiment showing the configuration of an expression circuit of a deterministic finite automaton using the present invention, and FIG.
Configuration diagram of state transition table and pattern detection judgment table corresponding to the figure,
FIG. 3 is an explanatory diagram of a conventional character string collating mechanism, FIG. 4 is an explanatory diagram showing state transition of a finite state automaton, and FIG.
Fig. 6 is an explanatory diagram of a circuit configuration for realizing a conventional deterministic finite automaton for character string data expressed by JIS code of bits, Fig. 6 is a block diagram of a conventional state transition table, and Fig. 7 is a conventional pattern detection judgment. It is a block diagram of a table. 1 ... storage device, 2 ... character string collating device, 3 ... data transfer path, 4 ... signal line, 5 ... state of automaton, 6 ... direction of state transition, 7 ... address register, 8, 20,40 …… Random access memory, 9,41 …… Address decoder, 10,21,42 …… Memory register, 12,14,24,25,35,44,45,46,47 …… Data line, 13,37 …… Address line, 16,26 …… Data, 17,27 …… Memory upper address, 18,28 …… Memory lower address, 19,29,323 …… Code-corresponding characters, 22 …… Judgment circuit , 23,43 …… Address decoder output line, 30 …… Associative memory (CAM), 31 …… Address encoder, 32 …… Initial state generation circuit, 33 …… CAM access register, 34 …… Selection circuit, 36 …… CAM match entry signal line, 37 ... CAM match entry address line, 38 ... CAM non-match entry signal line, 301 ... Entry exists Effectiveness indication bit storage area, 302 ... Status number storage area, 303 ... Character code storage area, 311 ... Entry validity indication bit, 312 ... Status number, 313 ... Character code, 401 ... Next status Number storage area, 402 ... Pattern detection code storage area, 411 ... Next state number, 412 ... Pattern detection code.

Claims (1)

【特許請求の範囲】[Claims] 【請求項1】テキストと呼ばれる比較的長い文字列中
に、別途与えられたパタンと呼ばれる比較的短い文字列
が部分列として存在するか否かを判定するために、 状態番号とパタンを構成する各文字との組合せに対し
て、次の状態番号を記入した状態遷移表および状態番号
と、特にパタンの最終文字の組合せにおいては、当該パ
タン検出符号を記入したパタン検出判定表を予め作成し
ておき、 テキストの1文字を入力するたびに、上記状態遷移表に
従って状態遷移しながら、パタン検出判定表を参照して
パタンの存在を判定する決定性有限オートマトンに基づ
いたテキストサーチ法において、 前記状態遷移表の状態番号とパタンを構成する文字の組
合せを連想メモリに、当該組合せに対応する次の状態番
号とパタン検出符号と上記連想メモリと関連付けられた
ラダムアクセスメモリの対応する番地に、それぞれ格納
しておき、 テキストの1文字を入力するたびに、現在の状態番号
と、入力された1文字を組として連想メモリに対し一致
検索し、 一致エントリが有る場合は、関連付けられたランダムア
クセスから次の状態番号を得て、一致エントリが無い場
合は、次の状態番号は初期状態にリセットすることによ
り、状態遷移を行いながら、一致エントリに関連付けら
れたランダムアクセスメモリから得た当該パタン検出符
号によって、パタンの存在を判定することを特徴とする
文字列照合方法。
1. A state number and a pattern are configured to determine whether or not a relatively short character string called a pattern exists as a substring in a relatively long character string called text. For the combination with each character, the state transition table and the state number in which the following state numbers are entered, and especially in the combination of the final character of the pattern, a pattern detection judgment table in which the pattern detection code is entered is created in advance. Every time one character of the text is input, the state transition according to the above state transition table is performed, and in the text search method based on the deterministic finite automaton for determining the existence of the pattern by referring to the pattern detection determination table, the state transition The associative memory stores the combination of the state numbers in the table and the characters forming the pattern, and the next state number, pattern detection code, and the associative memory corresponding to the combination. It is stored in the corresponding address of the associated Radam access memory, and each time one character of the text is input, the current state number and the input one character are searched for a match in the associative memory, If there is a matching entry, the next state number is obtained from the associated random access, and if there is no matching entry, the next state number is reset to the initial state, and the state entry is changed to the matching entry. A character string collating method, wherein the presence of a pattern is determined by the pattern detection code obtained from the associated random access memory.
JP61020239A 1986-02-03 1986-02-03 String matching method Expired - Lifetime JPH0746362B2 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP61020239A JPH0746362B2 (en) 1986-02-03 1986-02-03 String matching method

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP61020239A JPH0746362B2 (en) 1986-02-03 1986-02-03 String matching method

Publications (2)

Publication Number Publication Date
JPS62179083A JPS62179083A (en) 1987-08-06
JPH0746362B2 true JPH0746362B2 (en) 1995-05-17

Family

ID=12021642

Family Applications (1)

Application Number Title Priority Date Filing Date
JP61020239A Expired - Lifetime JPH0746362B2 (en) 1986-02-03 1986-02-03 String matching method

Country Status (1)

Country Link
JP (1) JPH0746362B2 (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106210397A (en) * 2014-07-25 2016-12-07 滁州华尊电气科技有限公司 There is the cubbyhole capable of taking pictures flattening mechanism

Families Citing this family (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPH04348469A (en) * 1990-07-23 1992-12-03 Hitachi Ltd Character string retrieving device and its method
EP1579320A2 (en) * 2002-10-29 2005-09-28 Lockheed Martin Corporation Hardware parser accelerator
JP4120888B2 (en) 2004-01-30 2008-07-16 日本電気株式会社 Data retrieval apparatus and method
US7973954B2 (en) 2006-08-28 2011-07-05 Sharp Laboratories Of America, Inc. Method and apparatus for automatic language switching for an imaging device

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106210397A (en) * 2014-07-25 2016-12-07 滁州华尊电气科技有限公司 There is the cubbyhole capable of taking pictures flattening mechanism

Also Published As

Publication number Publication date
JPS62179083A (en) 1987-08-06

Similar Documents

Publication Publication Date Title
US5140644A (en) Character string retrieving system and method
US6000008A (en) Method and apparatus for matching data items of variable length in a content addressable memory
US5440753A (en) Variable length string matcher
US6009382A (en) Word storage table for natural language determination
US5319762A (en) Associative memory capable of matching a variable indicator in one string of characters with a portion of another string
EP0380294A1 (en) String matching
US5138669A (en) Range-conditional character string retrieving method and system
US4531201A (en) Text comparator
US4254476A (en) Associative processor
US6470334B1 (en) Document retrieval apparatus
JPH024026B2 (en)
JP2693914B2 (en) Search system
JPH0746362B2 (en) String matching method
JPH0315221B2 (en)
JP3027754B2 (en) Associative memory
JP3141428B2 (en) Numerical value search apparatus and method
EP0468402B1 (en) Character string retrieving system and method
JPH04308B2 (en)
JP2588261B2 (en) Address database search device by OCR
JPS6336031B2 (en)
JPH0664586B2 (en) String matching method
JPS63187334A (en) Character-string pattern matching device
JPH06139278A (en) Character string retrieving device quipped with character code converting function
JPH01224831A (en) Character string retrieving device
HU176348B (en) Associative store

Legal Events

Date Code Title Description
EXPY Cancellation because of completion of term