[go: up one dir, main page]

JP2002312364A - Character string retrieval method and character string retrieval device - Google Patents

Character string retrieval method and character string retrieval device

Info

Publication number
JP2002312364A
JP2002312364A JP2001115322A JP2001115322A JP2002312364A JP 2002312364 A JP2002312364 A JP 2002312364A JP 2001115322 A JP2001115322 A JP 2001115322A JP 2001115322 A JP2001115322 A JP 2001115322A JP 2002312364 A JP2002312364 A JP 2002312364A
Authority
JP
Japan
Prior art keywords
register
character string
data
character
result
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.)
Withdrawn
Application number
JP2001115322A
Other languages
Japanese (ja)
Inventor
Hiroshi Ataka
央 安宅
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.)
Oki Electric Industry Co Ltd
Original Assignee
Oki Electric Industry 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 Oki Electric Industry Co Ltd filed Critical Oki Electric Industry Co Ltd
Priority to JP2001115322A priority Critical patent/JP2002312364A/en
Publication of JP2002312364A publication Critical patent/JP2002312364A/en
Withdrawn legal-status Critical Current

Links

Landscapes

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

Abstract

PROBLEM TO BE SOLVED: To provide a character string retrieval method and a device therefor capable of reducing a processing time of character string retrieval. SOLUTION: This character string retrieval device 10 holds a longer data length of a collating character string and a collated character string in a register 102, holds shorter data in a register 104 such that the shorter data can be shifted, holds data on a first character of the character string held by the register 104 by the character string held by the register 102 once in a register 106, and holds a calculation result of the exclusive OR of the data on the character strings held by the registers 102, 106. The device 10 shifts the character string of the register 104 by the calculation result and holds the calculation result of the exclusive OR of the data held by the registers 102, 104 in a register 108. A decision circuit 116 decides propriety of a retrieval output or propriety of a further shift on the basis of the calculation result of the register 108 and a shift position of the character string of the register 104, and supplies the decision result to a data control circuit 100 or a shift control circuit 114.

Description

【発明の詳細な説明】DETAILED DESCRIPTION OF THE INVENTION

【0001】[0001]

【発明が属する技術の分野】本発明は、文字列検索方法
および文字列検索装置に係り、特に、たとえば、照合す
るデータと照合されるデータが多数存在する場合に用い
て好適な文字列検索方法および文字列検索装置に関する
ものである。
BACKGROUND OF THE INVENTION 1. Field of the Invention The present invention relates to a character string search method and a character string search apparatus, and more particularly, to a character string search method suitable for use, for example, when there are a large number of data to be matched and data to be matched. And a character string search device.

【0002】[0002]

【従来の技術】文字列検索は、たとえば、インターネッ
トなどの検索エンジン、銀行の預金者照会、座席予約等
いろいろな場面において活用されている。また、それら
の対象データは膨大であった。その際、たとえば図11に
示す逐次探索と、図12に示す2分検索などの手法が用い
られていた。
2. Description of the Related Art A character string search is utilized in various scenes such as a search engine on the Internet or the like, a depositor inquiry at a bank, and a seat reservation. In addition, the target data was enormous. At that time, for example, techniques such as the sequential search shown in FIG. 11 and the binary search shown in FIG. 12 have been used.

【0003】図11に示す逐次検索は、配列の端の要素か
ら順次検索していく手法であり、データの並びに規則性
がない場合に用いられる。また、図12に示す2分検索
は、データの並びが特定の項目(キー)により、昇順あ
るいは降順に並んでいるときに用いられ、そのほぼ中央
に位置するデータのキーと条件を比較することで探索範
囲を2分することができ、2回目、3回目、・・・とそ
の探索範囲を狭めて所望のデータを検索するものであっ
た。
The sequential search shown in FIG. 11 is a method of sequentially searching from the end element of an array, and is used when there is no regularity of data. The binary search shown in FIG. 12 is used when the data is arranged in ascending or descending order according to a specific item (key), and compares the condition with the key of the data located substantially at the center. , The search range can be divided into two, and the second search, the third search,... Narrow the search range and search for desired data.

【0004】[0004]

【発明が解決しようとする課題】しかしながら、上述し
た従来の技術では、それぞれの要素毎の比較に用いられ
る基本的な文字列の照合は、それぞれの文字毎に行なわ
れるため、時間がかかり、いまだ非効率的な部分が残さ
れているという問題があった。たとえば、照合する文字
列の長さをn、照合される文字列の長さをm、その個数
をsとすると、逐次検索では、最大n×m×sの処理時
間が必要であった。2分検索では、個数tが(t<s/
2)と検索を半分にしながら処理し、キー条件を工夫す
ることにより、平均してn×m×tとなり、文字列毎の
照合数を減少させることができる。すなわち、従来の技
術では、検索条件などによる探索手法のソフトウェア処
理により、全体的な処理時間を減少させていた。しか
し、いずれの場合にもそれぞれの文字列毎にn×mの処
理時間が必要となり、検索される側に所望の文字列が存
在しない場合には、結局n×m×sの処理時間がかかっ
ていた。また、検索する文字列が多数ある場合には、さ
らに処理時間がかかっていた。
However, in the above-mentioned prior art, since the basic character string collation used for the comparison of each element is performed for each character, it takes time, and it is still time consuming. There was a problem that an inefficient part was left. For example, assuming that the length of a character string to be collated is n, the length of a character string to be collated is m, and the number thereof is s, the sequential search requires a processing time of at most n × m × s. In the binary search, the number t is (t <s /
2) and processing is performed while halving the search, and by devising the key conditions, the average is n × m × t, and the number of collation for each character string can be reduced. That is, in the related art, the overall processing time is reduced by software processing of a search method based on search conditions or the like. However, in each case, n × m processing time is required for each character string, and if the desired character string does not exist on the searched side, n × m × s processing time is eventually required. I was Further, when there are a large number of character strings to be searched, it takes more processing time.

【0005】本発明は、このような従来の技術の課題を
解決して、文字列毎の照合を高速かつ能率よく実行する
ことができ、したがって、検索する文字列または検索さ
れる文字列が多数ある場合においてもその処理時間を短
縮することができる文字列検索方法および文字列検索装
置を提供することを目的とする。
[0005] The present invention solves the above-mentioned problems of the prior art, and can perform the collation for each character string at high speed and efficiently. It is an object of the present invention to provide a character string search method and a character string search device that can reduce the processing time even in a certain case.

【0006】[0006]

【課題を解決するための手段】本発明による文字列検索
方法は、上記課題を解決するために、所定の文字列が複
数記憶されたデータファイルの中から所望の文字列を検
索する文字列検索方法において、データファイルからの
文字列またはこれと照合する文字列のうちデータ長の長
い文字列のデータを第1のレジスタに保持し、短い文字
列のデータを第2のレジスタに保持する第1の工程と、
第1の工程により第2のレジスタに保持した文字列の先
頭の文字を表わすデータを第1のレジスタに保持した文
字列のデータ長分第3のレジスタに保持する第2の工程
と、第1のレジスタに保持したデータと第3のレジスタ
に保持したデータとの排他的論理和を演算して、その結
果を第3のレジスタに保持する第3の工程と、第3の工
程により第3のレジスタに保持した値が零となる文字の
位置に第2のレジスタに保持した文字列のデータをシフ
トする第4の工程と、第4の工程によりシフトした第2
のレジスタのデータと第1のレジスタのデータとの排他
的論理和を演算して、その結果を第4のレジスタに保持
する第5の工程と、第5の工程により第4のレジスタに
保持した値が第2のレジスタの文字列分零になっている
か否かを判定する第6の工程と、第6の工程の判定結果
が否となった場合に第4ないし第6の工程を繰り返し
て、その結果、第6の工程の判定結果が正となった場合
にその文字列を出力する第7の工程と、第1ないし第7
の工程をデータファイルのそれぞれの文字列について繰
り返して、所望の文字列を検索する第8の工程とを含む
ことを特徴とする。
According to the present invention, there is provided a character string search method for searching for a desired character string from a data file in which a plurality of predetermined character strings are stored. In the method, of a character string from a data file or a character string to be matched with the data file, data of a character string having a long data length is stored in a first register, and data of a short character string is stored in a second register. Process and
A second step of storing data representing the first character of the character string held in the second register in the third register by the data length of the character string held in the first register in the first register; A third step of calculating an exclusive OR of the data held in the third register and the data held in the third register, and holding the result in the third register; A fourth step of shifting the data of the character string held in the second register to the position of the character at which the value held in the register becomes zero, and a second step shifted by the fourth step.
A fifth step of calculating an exclusive OR of the data of the first register and the data of the first register and storing the result in the fourth register, and storing the result in the fourth register by the fifth step A sixth step of determining whether or not the value is zero for the character string in the second register, and the fourth to sixth steps are repeated when the determination result of the sixth step is negative. A seventh step of outputting the character string when the result of the determination in the sixth step is positive;
And repeating the above step for each character string in the data file to search for a desired character string.

【0007】さらに、本発明による文字列検索方法は、
照合する複数の文字列をあらかじめ第2のデータファイ
ルとして記憶して、第2のデータファイルのそれぞれの
文字列について第1ないし第7の工程を繰り返して、さ
らに第8の工程を繰り返してそれぞれの文字列を検索す
ることを特徴とする。
Further, a character string search method according to the present invention
A plurality of character strings to be collated are stored in advance as a second data file, and the first to seventh steps are repeated for each of the character strings in the second data file. It is characterized by searching for a character string.

【0008】一方、本発明による文字列検索装置は、所
定の文字列が複数記憶されたデータファイルの中から所
望の文字列を検索する文字列検索装置において、データ
ファイルからの文字列またはこれと照合する文字列のう
ち一方のデータが保持される第1のレジスタと、データ
ファイルからの文字列またはこれと照合する文字列のう
ち他方のデータが保持される第2のレジスタであって、
保持されたデータをシフト自在に蓄積する第2のレジス
タと、第2のレジスタに保持された文字列の先頭の文字
のデータが第1のレジスタに保持された文字数分蓄積さ
れ、その蓄積された文字列と第1のレジスタの文字列の
データとの排他的論理和の結果が保持される第3のレジ
スタと、第1のレジスタに保持された文字列と第2のレ
ジスタに保持された文字列のそれぞれのデータの排他的
論理和の結果が保持される第4のレジスタと、第1のレ
ジスタの文字列と第3のレジスタの文字列のそれぞれの
データを対応する文字毎に排他的論理をとって、その結
果を第3のレジスタに供給する第1の演算手段と、第1
のレジスタの文字列と第2のレジスタの文字列のそれぞ
れのデータを対応する文字毎に排他的論理和をとって、
その結果を第4のレジスタに供給する第2の演算手段
と、第1ないし第3のレジスタにそれぞれのデータを設
定するデータ制御手段と、第2のレジスタに保持された
文字列のデータを第3のレジスタに保持された排他的論
理和の結果に基づいてシフトするシフト制御手段と、シ
フト制御手段での第2のレジスタのデータのシフト位置
およびその際の第4のレジスタの排他的論理和の演算結
果に基づいて検索結果の出力を判定する判定手段とを含
み、データ制御手段は、データファイルからの文字列と
照合する文字列のデータの長さを比較して長い文字列の
データを第1のレジスタに設定し、短い文字列のデータ
を第2のレジスタに設定し、さらに第2のレジスタに設
定した文字列の先頭の文字のデータを第1のレジスタに
設定した文字数分第3のレジスタに設定することを特徴
とする。
On the other hand, a character string search apparatus according to the present invention is a character string search apparatus for searching for a desired character string from a data file in which a plurality of predetermined character strings are stored. A first register for holding one data of a character string to be collated, and a second register for holding the other data of a character string from a data file or a character string to be collated therewith,
A second register for storing the held data in a freely shiftable manner, and the data of the first character of the character string held in the second register are stored for the number of characters held in the first register; A third register in which the result of the exclusive OR of the character string and the data of the character string in the first register is held; a character string held in the first register and a character held in the second register A fourth register in which the result of the exclusive OR of the respective data of the columns is held, and an exclusive logical sum of the data of the character string of the first register and the character string of the third register for each corresponding character. And a first operation means for supplying the result to a third register;
The exclusive OR of the data of the character string of the register and the data of the character string of the second register is calculated for each corresponding character,
Second operation means for supplying the result to the fourth register, data control means for setting respective data in the first to third registers, and data of the character string held in the second register to the fourth register. Shift control means for shifting based on the result of the exclusive OR held in the third register, the shift position of the data in the second register by the shift control means, and the exclusive OR of the fourth register at that time. Determining means for determining the output of the search result based on the operation result of the data file, wherein the data control means compares the length of the character string data to be matched with the character string from the data file to determine the long character string data. The first register is set, the short character string data is set in the second register, and the first character data of the character string set in the second register is stored in the first register for the number of characters set in the first register. And sets the register.

【0009】この場合、シフト制御手段は、第3のレジ
スタに保持された排他的論理和の結果が零となる位置に
第2のレジスタの文字列のデータを順次シフトして、判
定手段は、それぞれシフトした位置において第4のレジ
スタに保持された排他的論理和の結果が第2のレジスタ
の文字数分零となったか否かを判定し、その判定結果が
正となった場合にデータ制御手段に検索結果の出力を指
示し、判定結果が否となった場合にシフト制御手段に第
2のレジスタのデータのシフトを指示するとよい。
In this case, the shift control means sequentially shifts the data of the character string in the second register to a position where the result of the exclusive OR held in the third register becomes zero. It is determined whether or not the result of the exclusive OR held in the fourth register at each shifted position has become zero for the number of characters in the second register. If the determination result is positive, the data control means May be instructed to output the search result, and when the result of the determination is negative, the shift control means may be instructed to shift the data of the second register.

【0010】また、シフト制御手段は、第2のレジスタ
のデータをシフトした際にその位置における第3のレジ
スタの排他的論理和の結果を"1"に書き替え、判定手段
は第3のレジスタに零があるか否かを判定して、零があ
る場合にシフト手段にシフトを指示し、零がない場合に
データ制御手段にそのデータの検索終了を指示し、デー
タ制御手段は、判定手段から検索結果の出力の指示また
は検索結果の終了の指示を受けて次の文字列をそれぞれ
のレジスタに設定して、さらに検索するとよい。
When the data in the second register is shifted, the shift control means rewrites the result of the exclusive OR of the third register at that position with "1", and the judgment means makes a decision on the third register. It is determined whether or not there is a zero. If there is a zero, the shift means is instructed to shift, and if there is no zero, the data control means is instructed to end the search for the data. In response to an instruction to output the search result or an instruction to end the search result, the next character string is set in each register, and the search may be further performed.

【0011】[0011]

【発明の実施の形態】次に、添付図面を参照して本発明
による文字列検索方法および文字列検索装置の一実施例
を詳細に説明する。図1には、本発明による文字列検索
方法が適用された文字列検索装置の一実施例が示されて
いる。本実施例における文字列検索装置10は、あらかじ
め所定の文字列が記憶されたデータファイルP (12)とデ
ータファイルT (14)との類似する文字列を検索して、そ
の検索結果を出力ファイルO (16)に出力する処理装置で
あり、たとえば本実施例では、データファイルP (12)に
電子部品等の正式名称を表わす複数の文字列があらかじ
め記憶され、データファイルT (14)にデータファイルP
(12)の中から所望の電子部品名を検索する際に外部入力
した複数の文字列が記憶されて、たとえば電子部品の在
庫等を調べる際に適用した場合を例に挙げて説明する。
特に、本実施例では、それぞれの文字列を照合する際
に、レジスタ102 〜108 を用意して、これらを用いたハ
ードウェア処理により検索処理の主要部分を実行する点
が主な特徴点である。なお、図1には、本発明に直接関
係ある部分のみが示されており、本発明に直接関係のな
い入力装置などの部位はその図示および説明を省略す
る。
DETAILED DESCRIPTION OF THE PREFERRED EMBODIMENTS Next, an embodiment of a character string search method and a character string search device according to the present invention will be described in detail with reference to the accompanying drawings. FIG. 1 shows an embodiment of a character string search apparatus to which a character string search method according to the present invention is applied. The character string search device 10 in the present embodiment searches for a similar character string between the data file P (12) and the data file T (14) in which a predetermined character string is stored in advance, and outputs the search result to an output file. O (16), for example, in this embodiment, a plurality of character strings representing the formal names of electronic components and the like are stored in advance in the data file P (12), and the data file T (14) File P
A description will be given of an example in which a plurality of character strings input externally when searching for a desired electronic component name from (12) are stored and applied to, for example, checking the inventory of electronic components.
In particular, the main feature of the present embodiment is that when matching each character string, registers 102 to 108 are prepared and the main part of the search processing is executed by hardware processing using these registers. . FIG. 1 shows only parts directly related to the present invention, and illustration and description of parts such as an input device not directly related to the present invention are omitted.

【0012】詳しくは、本実施例における文字列検索装
置10は、図1に示すように、データ制御回路100 と、レ
ジスタ102 〜108 と、演算回路110, 112と、シフト制御
回路114 と、判定回路116 とを含む。
More specifically, as shown in FIG. 1, a character string search apparatus 10 according to this embodiment includes a data control circuit 100, registers 102 to 108, arithmetic circuits 110 and 112, a shift control circuit 114, Circuit 116.

【0013】データ制御回路100 は、データファイルP
(12)およびデータファイルT (14)から読み出した文字列
のデータ120, 140をレジスタ102, 104にそれぞれ設定す
るデータ設定回路であり、クレーム中の第1および第2
のレジスタにそれぞれ対応している。本実施例では、デ
ータファイルP (12)からの文字列とデータファイルT(1
4)からの文字列をそのデータ長を比較する比較機能を有
し、長い文字列のデータ100aをレジスタ102 に設定し、
短い文字列のデータ100bをレジスタ104 に設定する。さ
らに、本実施例では、レジスタ104 に設定した短い文字
列の先頭の文字のデータを検出してレジスタ102 に設定
した長い文字列の文字数分のデータ100cをレジスタ106
(第3のレジスタ)に設定する設定機能と、判定回路11
6 からの判定結果に基づいて供給される出力指示信号11
6aにより検索結果100dを出力ファイルO (16)に出力する
出力機能を含む。
The data control circuit 100 includes a data file P
(12) and a data setting circuit for setting the character string data 120, 140 read from the data file T (14) in the registers 102, 104, respectively.
, Respectively. In this embodiment, the character string from the data file P (12) and the data file T (1
4) has a comparison function of comparing the data length of the character string from (4), and sets the long character string data 100a in the register 102;
The short character string data 100b is set in the register 104. Further, in this embodiment, the data of the first character of the short character string set in the register 104 is detected, and the data 100c for the number of characters of the long character string set in the register 102 is stored in the register 106.
(Third register) setting function and determination circuit 11
Output instruction signal 11 supplied based on the judgment result from 6
An output function for outputting the search result 100d to the output file O (16) by 6a is included.

【0014】レジスタ102 は、データ制御回路100 を介
して供給されたデータファイルP (12)またはデータファ
イルT (14)の文字列のうち長い文字列のデータ100aを保
持するデータ保持回路であり、本実施例では、たとえば
100 文字程度の文字列のデータ100aを保持可能なレジス
タである。ここで、データファイルP, Tからの文字列の
データは、それぞれの文字がたとえば、16ビットのコー
ドにて表わされ、本実施例では、4つのレジスタ102 〜
108 は、それぞれ1500〜1600ビットのデータを保持可能
なレジスタである。
The register 102 is a data holding circuit for holding data 100a of a long character string among the character strings of the data file P (12) or the data file T (14) supplied through the data control circuit 100. In this embodiment, for example,
This register can hold character string data 100a of about 100 characters. Here, in the character string data from the data files P and T, each character is represented by, for example, a 16-bit code.
108 is a register capable of holding 1500 to 1600 bits of data.

【0015】レジスタ104 は、レジスタ102 に保持され
たデータファイルP またはデータファイルT の文字列の
データのうち短い文字列のデータ100bが保持されるレジ
スタであり、本実施例では、保持したデータ100bをシフ
ト自在に保持するシフトレジスタが有効に適用されてい
る。レジスタ104 には、シフトを自在に制御するシフト
制御信号114aがシフト制御部114から供給されている。
The register 104 is a register for holding short character string data 100b among the character string data of the data file P or the data file T held in the register 102. In the present embodiment, the held data 100b Has been effectively applied. The register 104 is supplied with a shift control signal 114a from the shift control unit 114 for freely controlling the shift.

【0016】レジスタ106 は、データ制御回路100 から
レジスタ104 に供給された文字列の先頭の文字のデータ
がレジスタ102 に供給された文字数分のデータ100cが供
給されて、これを一旦保持するデータ保持回路であり、
本実施例では、その保持したデータ18とレジスタ102 に
保持したデータ20とを演算回路110 により演算した結果
22がその後保持される第3のレジスタである。本実施例
では、後に保持した演算回路110 からのデータ22がデー
タ24としてシフト制御回路114 に供給される。
The register 106 is supplied with data 100c corresponding to the number of characters supplied from the data control circuit 100 to the register 104 to the first character of the character string supplied to the register 104, and temporarily retains the data 100c. Circuit
In the present embodiment, the result of calculating the held data 18 and the data 20 held in the register 102 by the arithmetic circuit 110
Reference numeral 22 denotes a third register that is held thereafter. In this embodiment, the data 22 from the arithmetic circuit 110 which is stored later is supplied to the shift control circuit 114 as data 24.

【0017】レジスタ108 は、レジスタ102 に保持した
データ20とレジスタ104 に保持したデータ26とを演算回
路112 により演算した結果28を保持するレジスタであ
り、第4のレジスタに相当している。本実施例でレジス
タ108 は、その結果28をデータ30として判定回路116 に
供給している。
The register 108 is a register for holding a result 28 obtained by calculating the data 20 held in the register 102 and the data 26 held in the register 104 by the arithmetic circuit 112, and corresponds to a fourth register. In this embodiment, the register 108 supplies the result 28 as data 30 to the decision circuit 116.

【0018】演算回路110 は、レジスタ102 に保持した
文字列のデータ20とレジスタ106 に始めに保持した文字
列のデータ18とをそれぞれ対応した位置の文字毎に排他
的論理和をとる演算素子であり、第1の演算回路に対応
し、その結果22は、一致する文字が"0"、不一致の文字
が"1" として演算し、レジスタ106 に供給している。
The arithmetic circuit 110 is an arithmetic element that performs an exclusive OR operation on the character string data 20 held in the register 102 and the character string data 18 initially held in the register 106 for each character at a corresponding position. The result 22 corresponds to the first arithmetic circuit, and the result 22 is calculated as "0" for a matching character and "1" for a non-matching character, and is supplied to the register 106.

【0019】演算回路112 は、レジスタ102 に保持した
文字列のデータ20とレジスタ104 に保持した文字列のデ
ータ26とをそれぞれ対応した位置の文字毎に排他的論理
和をとる演算素子であり、第2の演算回路に対応し、そ
の結果28は、演算回路110 と同様に一致する文字が"0"
、不一致の文字が"1" とするデータ28をレジスタ108に
供給している。
The arithmetic circuit 112 is an arithmetic element that performs an exclusive OR operation on the character string data 20 held in the register 102 and the character string data 26 held in the register 104 for each character at a corresponding position. Corresponding to the second arithmetic circuit, the result 28 is the same as the arithmetic circuit 110, and the matching character is "0".
Is supplied to the register 108 with the unmatched character being "1".

【0020】シフト制御回路114 は、レジスタ106 に保
持した演算回路110 の演算結果22に基づいてレジスタ10
4 に保持した文字列のデータ100bをシフトさせる制御回
路であり、本実施例でシフト制御回路114 は、判定回路
116 からのシフト指示信号116bによりレジスタ106 の"
0" を表わすビットの位置と同じ位置にレジスタ104 に
保持した文字列のデータをシフトさせるシフト制御信号
114aを生成し、供給する。その際、シフト制御回路114
は、レジスタ106 でのすでに照合した位置における"0"
のビットをそれぞれ"1" に置き換える制御信号114bを生
成してレジスタ106 に供給する機能も有している。
The shift control circuit 114 stores the data in the register 10 based on the operation result 22 of the operation circuit 110 held in the register 106.
4 is a control circuit for shifting the data 100b of the character string held in FIG.
The shift instruction signal 116b from the
A shift control signal for shifting the character string data held in the register 104 to the same position as the bit position representing 0 "
Generate and supply 114a. At that time, the shift control circuit 114
Is "0" at the position already matched in register 106
It also has a function of generating a control signal 114b for replacing each of these bits with “1” and supplying it to the register 106.

【0021】判定回路116 は、レジスタ108 に保持した
データ28の値を受けて出力されるデータ30に基づいて検
索結果を出力するか否かを判定する判定回路である。本
実施例の判定回路116 は、シフト制御回路114 から供給
されたシフト制御信号114aによりシフトしたレジスタ10
4 での文字列の位置に対応する、レジスタ108 のビット
がすべて"0" の場合出力指示信号116aをデータ制御回路
100 に供給して出力を指示する。
The judgment circuit 116 is a judgment circuit for judging whether or not to output a search result based on the data 30 output in response to the value of the data 28 held in the register 108. The determination circuit 116 of the present embodiment stores the register 10 shifted by the shift control signal 114a supplied from the shift control circuit 114.
When all bits of register 108 corresponding to the character string position in step 4 are "0", output instruction signal 116a is output to data control circuit.
Feed to 100 to indicate output.

【0022】また、本実施例での判定回路116 は、レジ
スタ106 に保持したデータに"0" があり、レジスタ108
の対応のビットのいずれかが1である場合には、シフト
制御回路114 にシフト指示信号116bを供給し、レジスタ
106 に保持したデータに"0"がない場合にはデータ制御
回路100 にそのデータの照合終了指示信号116c をする
指示回路である。
Also, the judgment circuit 116 in this embodiment determines that the data held in the register 106 has "0",
If any of the bits corresponding to the above is 1, a shift instruction signal 116b is supplied to the shift control circuit 114, and the register
When there is no "0" in the data held in 106, this is an instruction circuit for issuing a data collation end instruction signal 116c to the data control circuit 100.

【0023】次に、図2ないし図10を参照して本実施例
による文字列検索方法を上記文字列検索装置10の動作と
ともに説明すると、まず、図2に示すように、データ制
御回路100 はデータファイルPおよびデータファイルTか
ら照合するそれぞれの文字列のデータを読み出す(ステ
ップS10, S12)。次に、読み出した文字列のデータ長を
比較して、いずれの文字列が長いか否かを判定する(ス
テップS14 )。たとえば、データファイルPからの文字
列がデータファイルTからの文字列より長い場合には、
たとえば図4に示すようにその"ABCDEFG" の文字列のデ
ータ100aをレジスタ102 にセットする(ステップS16
)。
Next, the character string search method according to the present embodiment will be described with reference to FIGS. 2 to 10 together with the operation of the character string search device 10. First, as shown in FIG. The data of each character string to be collated is read from the data file P and the data file T (steps S10, S12). Next, the data length of the read character string is compared to determine which character string is longer (step S14). For example, if the string from data file P is longer than the string from data file T,
For example, as shown in FIG. 4, the character string data 100a of "ABCDEFG" is set in the register 102 (step S16).
).

【0024】次に、データファイルP からの短い文字
列、たとえば図4に示すようにその"BEF" の文字列のデ
ータ100bをレジスタ104 にセットする(ステップS18
)。次に、データ制御回路100 は、ステップS20 にお
いて、たとえば図5に示すように、レジスタ104 にセッ
トした文字列の先頭の文字"B" を表わすデータ100cをレ
ジスタ102 にセットした文字数分をレジスタ106 にセッ
トする(ステップS20 )。
Next, a short character string from the data file P, for example, the data 100b of the character string "BEF" as shown in FIG. 4 is set in the register 104 (step S18).
). Next, in step S20, the data control circuit 100 stores, in the register 106, the number of characters 100c representing the first character "B" of the character string set in the register 104 in the register 102, as shown in FIG. (Step S20).

【0025】レジスタ106 にレジスタ104の文字列の先
頭の文字"B" がそれぞれセットされると、演算回路110
では、レジスタ102 に保持した文字列のデータ100aとレ
ジスタ106 に保持した文字列とのそれぞれ対応する文字
のデータ100cの排他的論理和を演算して、その結果をレ
ジスタ106 に供給する(ステップS22 )。これにより、
レジスタ106 には、図6に示すように、レジスタ104 の
先頭の文字"B" に一致するレジスタ102 の文字"B" の位
置に対応して"0" が保持され、その他の文字の位置に"
1" が保持される(ステップS24 )。
When the first character "B" of the character string in the register 104 is set in the register 106, the arithmetic circuit 110
Then, the exclusive OR of the character data 100c corresponding to the character string data 100a held in the register 102 and the character string held in the register 106 is calculated, and the result is supplied to the register 106 (step S22). ). This allows
As shown in FIG. 6, "0" is held in the register 106 in correspondence with the position of the character "B" of the register 102 that matches the character "B" at the head of the register 104, and the position of the other characters is stored. "
1 "is held (step S24).

【0026】保持した演算結果22はレジスタ106 から出
力データ24としてシフト制御回路114 および判定回路11
6 に供給され、判定回路116 は出力データ24、換言する
とレジスタ106 に"0" が含まれるか否かを判定する(ス
テップS26 )。この場合、レジスタ106 の第2および第
5の文字に相当するデータ位置に"0" があるので、判定
回路116 はシフト制御回路114 にシフト指示信号116bを
通知する。判定回路116 ではレジスタ106 に"0" が含ま
れていないとき(NO)、接続子A を介して図3のステッ
プS36 に進む。
The held operation result 22 is output from the register 106 as output data 24 by the shift control circuit 114 and the decision circuit 11.
The determination circuit 116 determines whether the output data 24, that is, the register 106, contains "0" (step S26). In this case, since there is "0" in the data position corresponding to the second and fifth characters in the register 106, the determination circuit 116 notifies the shift control circuit 114 of the shift instruction signal 116b. In the judgment circuit 116, when "0" is not included in the register 106 (NO), the flow proceeds to step S36 in FIG.

【0027】次に、シフト指示信号116bを受けたシフト
制御回路114 は、レジスタ104 に保持した文字列のデー
タ100bを図7に示すように、レジスタ106 の第2の文字
に相当する"0" のデータ位置にシフトする(ステップS2
8 )。その際、シフト制御回路114 は、制御信号114bを
レジスタ106 に供給してレジスタ106 におけるレジスタ
104 にて文字列のデータ100bをシフトした位置の"0" の
値を"1" に書き替える。この後、接続子B を介して図3
に進む。レジスタ106 の文字列がシフトされると、演算
回路112 では、レジスタ102 に保持した文字列のデータ
とレジスタ106にてシフトして保持したデータとのそれ
ぞれ対応の位置での排他的論理和を演算して、その結果
をレジスタ108 に供給する(ステップS30 )。これによ
り、レジスタ108 には、図8に示すように、その演算結
果28が保持される。
Next, upon receiving the shift instruction signal 116b, the shift control circuit 114 converts the character string data 100b held in the register 104 to "0" corresponding to the second character of the register 106 as shown in FIG. Is shifted to the data position (step S2
8). At that time, the shift control circuit 114 supplies the control signal 114b to the register 106 to
At 104, the value of "0" at the position where the character string data 100b is shifted is rewritten to "1". After this, the connection shown in FIG.
Proceed to. When the character string in the register 106 is shifted, the arithmetic circuit 112 calculates the exclusive OR at the corresponding position between the data of the character string held in the register 102 and the data shifted and held in the register 106. Then, the result is supplied to the register 108 (step S30). As a result, the operation result 28 is held in the register 108 as shown in FIG.

【0028】次に、ステップS32 に進み、判定回路116
はレジスタ108 に保持された演算結果28とレジスタ104
での文字列のデータ100bのシフト位置に基づいてレジス
タ102 に保持した文字列とレジスタ104 に保持した文字
列が一致するか否かを判定する。この場合、図8に示す
ようにレジスタ108 におけるレジスタ104 の文字列の位
置に"1" が含まれるので、判定回路116 は否と判定して
接続子C を介して図2のステップS26 に戻り、再びレジ
スタ106 に"0" があるか否かを判定する。その結果、第
5の文字の位置に"0" があるので、判定回路116 は再び
シフト制御回路114 にシフト指示信号116bを通知する。
これにより、シフト制御回路114 はステップS28 におい
てレジスタ104 の文字列のデータ100bをシフト制御信号
114aに応じて、図10に示すように、第5の文字の位置に
シフトさせる。
Next, the operation proceeds to step S32, where the judgment circuit 116
Is the operation result 28 held in the register 108 and the register 104
Then, it is determined whether or not the character string held in the register 102 and the character string held in the register 104 match based on the shift position of the character string data 100b. In this case, as shown in FIG. 8, "1" is included in the position of the character string of the register 104 in the register 108, so that the determination circuit 116 makes a determination of no and returns to the step S26 in FIG. It is determined again whether or not "0" is present in the register 106. As a result, since "0" is at the position of the fifth character, the determination circuit 116 notifies the shift control circuit 114 of the shift instruction signal 116b again.
As a result, the shift control circuit 114 converts the character string data 100b of the register 104 into the shift control signal in step S28.
In accordance with 114a, as shown in FIG. 10, the character is shifted to the position of the fifth character.

【0029】次いで、再びステップS30 において演算回
路110 はレジスタ102 に保持した文字列のデータ100aと
シフトしたレジスタ104 の文字列のデータ100bとの排他
的論理和を演算する。その結果28は、図10に示すように
レジスタ108 に供給されて保持される。
Next, again in step S30, the arithmetic circuit 110 calculates the exclusive OR of the character string data 100a held in the register 102 and the shifted character string data 100b in the register 104. The result 28 is supplied to the register 108 and held as shown in FIG.

【0030】次に、上記と同様に、判定回路116 はステ
ップS32 においてレジスタ108 のデータ値を受けて、そ
の結果にレジスタ106 でのシフトした文字列の位置に対
応する文字数分"0" があるか否かを判定する。この場
合、図10に示すように、それぞれの文字に対応するデー
タ値が"0" となっているので、判定回路116 はデータ制
御回路100 に検索出力を出力するように出力指示信号11
6aを通知する(ステップS34 )。この結果、データ制御
回路100 は、レジスタ102 に供給したデータ(文字列)
100aとレジスタ104 に供給したデータ(文字列)100bの
部分一致を検出して、その結果を出力ファイルO (16)に
出力する。
Next, in the same manner as described above, the decision circuit 116 receives the data value of the register 108 in step S32, and as a result, there is "0" for the number of characters corresponding to the position of the shifted character string in the register 106. It is determined whether or not. In this case, as shown in FIG. 10, since the data value corresponding to each character is "0", the determination circuit 116 outputs the search instruction signal to the data control circuit 100 so as to output the search output.
6a is notified (step S34). As a result, the data control circuit 100 outputs the data (character string) supplied to the register 102.
A partial match between 100a and the data (character string) 100b supplied to the register 104 is detected, and the result is output to an output file O (16).

【0031】ちなみに、ステップS32 において再びレジ
スタ108 の対応のデータ値に"1" が含まれ、さらにステ
ップS26 においてレジスタ106 に"0" がないと判定され
ると、判定回路116 はデータ制御回路100 にその文字列
の照合終了を示す照合終了指示信号116cを通知する。こ
れにより、データ制御回路100 は、検索出力を出力せず
にステップS36 に進む。
Incidentally, if it is determined in step S32 that the corresponding data value of the register 108 contains "1" again, and further in step S26 it is determined that there is no "0" in the register 106, the determination circuit 116 sets the data control circuit 100 Is notified of a collation end instruction signal 116c indicating the end of collation of the character string. Accordingly, the data control circuit 100 proceeds to step S36 without outputting the search output.

【0032】次に、データ制御回路100 は、ステップS3
6 においてデータファイルT に検索する文字列があるか
否かを判定して、検索する文字列がある場合は接続子D
を介して再び図2のステップS12に戻り、データファイ
ルTから次の検索する文字列を読み出す。以下、上記と
同様に、ステップS14 〜ステップS20 が繰り返されて、
レジスタ102 に長い文字列のデータがセットされ、レジ
スタ104 に短い文字列のデータがセットされ、さらにレ
ジスタ106 にレジスタ104 にセットされた文字列の先頭
の文字のデータがレジスタ102 にセットされた文字数分
セットされる。次いで、上記と同様にステップS22 にお
いてレジスタ102 のデータとレジスタ106のデータとの
排他的論理和が演算されて、その結果が上記と同様にス
テップS24においてレジスタ106 に保持される。さら
に、上記と同様にステップS26 〜ステップS30 が繰り返
され、レジスタ104 に保持された文字列のデータがその
先頭文字がレジスタ102 に保持された文字と一致するよ
うにシフトされて、そのシフトした文字列とレジスタ10
2 に保持した文字列のデータとの排他的論理和が演算さ
れ、その結果がレジスタ108 に保持される。
Next, the data control circuit 100 proceeds to step S3
In step 6, it is determined whether or not the data file T has a character string to be searched.
The process returns to step S12 of FIG. 2 again, and the next character string to be searched is read from the data file T. Hereinafter, similarly to the above, Steps S14 to S20 are repeated,
The long character string data is set to register 102, the short character string data is set to register 104, and the first character data of the character string set to register 104 is set to register 106. Set for a minute. Next, the exclusive OR of the data in the register 102 and the data in the register 106 is calculated in step S22 as described above, and the result is stored in the register 106 in step S24 as described above. Further, steps S26 to S30 are repeated in the same manner as described above, and the data of the character string held in the register 104 is shifted so that the first character thereof matches the character held in the register 102, and the shifted character Columns and registers 10
The exclusive OR with the character string data held in 2 is calculated, and the result is held in the register 108.

【0033】次に、ステップS32 において、上記と同様
にレジスタ108 の値とシフトした文字列の位置に基づい
てレジスタ102 に保持した文字列とレジスタ104 に保持
した文字列とが一致するか否かが判定される。一致しな
ければ前述と同様に接続子Cを介してステップS26 〜ス
テップS32 の処理がレジスタ106 に保持された"0" がな
くなるまで繰り返されて、レジスタ104 のシフトおよび
そのシフトしたデータとレジスタ102 に保持したデータ
との排他的論理和の演算が繰り返される。その結果、ス
テップS32 において文字列の一致が判定されると、ステ
ップS34 において検索出力が得られる。さらに、ステッ
プS36 から接続子D を介してステップS12 に戻り、ステ
ップS12 〜ステップS36 がデータファイルT に記憶され
た検索文字列すべてについて繰り返される。
Next, in step S32, it is determined whether the character string held in the register 102 matches the character string held in the register 104 based on the value of the register 108 and the position of the shifted character string in the same manner as described above. Is determined. If they do not match, the processing of steps S26 to S32 is repeated via the connector C until the "0" held in the register 106 is exhausted, and the shift of the register 104 and the shifted data and the register 102 are repeated. The operation of exclusive OR with the data held in is repeated. As a result, if it is determined in step S32 that the character strings match, a search output is obtained in step S34. Further, the process returns from the step S36 to the step S12 via the connector D, and the steps S12 to S36 are repeated for all the search character strings stored in the data file T.

【0034】次いで、ステップS36 においてデータファ
イルT の検索文字列のすべてについてデータファイルP
の第1の文字列との照合が終了すると、データファイル
P に次の照合される文字列があるか否かが判定される
(ステップS38 )。照合される文字列がある場合は、接
続子E を介してステップS10 に戻り、再びステップS12
〜ステップS36 が上記と同様に繰り返されて、データフ
ァイルP の次の照合される文字列についてデータファイ
ルT からの文字列での検索が実行される。以下同様に、
データファイルP のすべての文字列についてデータファ
イルT からの文字列での検索が実行されて、ステップS3
8 にてデータファイルP に照合される文字列がなくなる
と、すべての検索を終了する。
Next, in step S36, the data file P is searched for all the search character strings in the data file T.
When matching with the first character string of
It is determined whether or not P has the next character string to be collated (step S38). If there is a character string to be collated, the process returns to step S10 via the connector E, and then returns to step S12.
Steps S36 to S36 are repeated in the same manner as described above, and the next matching character string of the data file P is searched by the character string from the data file T. Similarly,
The search for the character strings from the data file T is performed for all the character strings in the data file P, and a step S3
When there are no more character strings to be matched in the data file P in 8, all the search is terminated.

【0035】以上のように本実施例の文字列検索方法お
よび文字列検索装置によれば、レジスタ102 〜108 を用
意して、これらにより検索処理の相当部分をハードウェ
ア処理により実行するので、ソフトウェアにより検索処
理する場合と比較して高速かつ能率的に検索することが
できる。特に、レジスタ106 にレジスタ104 に保持した
文字列の先頭の文字のデータをレジスタ102 に保持した
文字数分一旦保持し、そのデータとレジスタ102 に保持
した文字列のデータとを演算回路110 により排他的論理
和をとった値をレジスタ106 に蓄積して、そのデータ値
の"0" となる位置にレジスタ104 に保持した文字列のデ
ータをシフトして、レジスタ102 の文字列のデータとの
一致不一致を求めるので、それぞれの文字毎に一致不一
致を求めて照合処理する場合と比較して、無駄な照合処
理を省いて数回の照合により、能率よく、かつ高速に処
理を実行することができる。つまり、照合する文字数n
と照合される文字数mとした場合でもn×mの照合処理
をすることなく、数回多くても十数回にて照合処理を実
行することができる。
As described above, according to the character string search method and the character string search apparatus of the present embodiment, the registers 102 to 108 are prepared, and a substantial part of the search processing is executed by hardware processing. Thus, the search can be performed faster and more efficiently than in the case of performing the search processing. In particular, the first character data of the character string held in the register 104 is temporarily held in the register 106 for the number of characters held in the register 102, and the data and the character string data held in the register 102 are exclusively processed by the arithmetic circuit 110. The ORed value is stored in the register 106, the character string data held in the register 104 is shifted to a position where the data value becomes "0", and the data does not match with the character string data in the register 102. Therefore, compared with the case where the matching process is performed for each character, a useless matching process is omitted, and the process can be executed efficiently and at high speed by performing the matching several times. That is, the number of characters to be collated n
Even if the number of characters to be matched is m, the matching process can be executed several times at most and dozens of times without performing the n × m matching process.

【0036】また、その際、演算回路110, 112による排
他的論理和により高速に演算することができ、その照合
結果をレジスタ108 に保持して、レジスタ106 のシフト
位置に基づいて有効に判定することができる。
At this time, high-speed operation can be performed by the exclusive OR of the operation circuits 110 and 112. The comparison result is held in the register 108, and the effective judgment is made based on the shift position of the register 106. be able to.

【0037】さらに、レジスタ102 〜108 として1500〜
1600ビットのレジスタを用いて、100 文字程度の文字列
まで一括して処理することができるので、たとえば、32
ビットCPU などによりその内部レジスタにて1文字(16
ビット)または2文字(32ビット)毎に処理する場合と
比較して、格段に処理時間を短縮することができる。
Further, as registers 102 to 108, 1500 to
Using a 1600-bit register, it is possible to process up to about 100 character strings at once.
One character (16
The processing time can be remarkably reduced as compared with the case where the processing is performed for each bit) or every two characters (32 bits).

【0038】なお、上記実施例では、電子部品等の文字
列の検索に適用した場合を例に挙げて説明したが、本発
明ではもちろん他の文字列、たとえば銀行の預金者照
会、座席予約等に用いる検索あるいはインターネットの
検索エンジンなどに適用してもよい。
In the above embodiment, the case where the present invention is applied to a search for a character string of an electronic component or the like has been described as an example. However, in the present invention, other character strings, such as a depositor inquiry at a bank, a seat reservation, etc. The search may be applied to a search or an Internet search engine.

【0039】[0039]

【発明の効果】以上説明したように本発明の文字列検索
方法および文字列検索装置によれば、第1〜第4のレジ
スタを用意して、これらにより検索処理の相当部分をハ
ードウェア処理により実行するので、ソフトウェアによ
り検索処理する場合と比較して高速かつ能率的に検索す
ることができる。特に、第3のレジスタにより、第2の
レジスタに保持した文字列の先頭の文字と一致する第1
のレジスタに保持した文字列の文字の位置を示す排他的
論理和の演算結果を保持して、その位置に第2のレジス
タの文字列をシフトして、第1のレジスタの文字列とシ
フトした第2のレジスタの文字列との排他的論理和をと
って一致不一致を求めるので、文字毎の照合をする場合
と比較して、より効率的に、かつ高速に照合することで
きる。
As described above, according to the character string search method and the character string search apparatus of the present invention, the first to fourth registers are prepared, and the substantial part of the search processing is performed by hardware processing. Since the search is executed, the search can be performed faster and more efficiently than in the case where the search processing is performed by software. In particular, the first register that matches the first character of the character string held in the second register is set by the third register.
Holds the result of the exclusive OR operation indicating the position of the character in the character string held in the register, shifts the character string in the second register to that position, and shifts the character string in the first register. Since exclusive OR is obtained with the character string in the second register to determine the match or non-match, the comparison can be performed more efficiently and at a higher speed than in the case where the comparison is performed for each character.

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

【図1】本発明による文字列検索装置の一実施例を示す
ブロック図である。
FIG. 1 is a block diagram showing an embodiment of a character string search device according to the present invention.

【図2】図1の実施例における文字列検索装置を適用し
た文字列検索方法を説明するためのフローチャートであ
る。
FIG. 2 is a flowchart for explaining a character string search method to which the character string search device in the embodiment of FIG. 1 is applied.

【図3】図1の文字列検索装置を適用した文字列検索方
法を説明する図2に続く手順を示すフローチャートであ
る。
FIG. 3 is a flowchart illustrating a procedure following FIG. 2 for explaining a character string search method to which the character string search device of FIG. 1 is applied.

【図4】図1の実施例における文字列検索装置の動作を
説明するためのそれぞれのレジスタの内容を示す図であ
る。
FIG. 4 is a diagram showing the contents of respective registers for explaining the operation of the character string search device in the embodiment of FIG. 1;

【図5】図1の実施例における文字列検索装置の動作を
説明するためのそれぞれのレジスタの内容を示す図であ
る。
FIG. 5 is a diagram showing the contents of respective registers for explaining the operation of the character string search device in the embodiment of FIG. 1;

【図6】図1の実施例における文字列検索装置の動作を
説明するためのそれぞれのレジスタの内容を示す図であ
る。
FIG. 6 is a diagram showing the contents of respective registers for explaining the operation of the character string search device in the embodiment of FIG. 1;

【図7】図1の実施例における文字列検索装置の動作を
説明するためのそれぞれのレジスタの内容を示す図であ
る。
FIG. 7 is a diagram showing the contents of respective registers for explaining the operation of the character string search device in the embodiment of FIG. 1;

【図8】図1の実施例における文字列検索装置の動作を
説明するためのそれぞれのレジスタの内容を示す図であ
る。
FIG. 8 is a diagram showing the contents of respective registers for explaining the operation of the character string search device in the embodiment of FIG. 1;

【図9】図1の実施例における文字列検索装置の動作を
説明するためのそれぞれのレジスタの内容を示す図であ
る。
FIG. 9 is a diagram showing the contents of respective registers for explaining the operation of the character string search device in the embodiment of FIG. 1;

【図10】図1の実施例における文字列検索装置の動作
を説明するためのそれぞれのレジスタの内容を示す図で
ある。
FIG. 10 is a diagram showing the contents of respective registers for explaining the operation of the character string search device in the embodiment of FIG. 1;

【図11】従来のソフトウェア処理による逐次検索法を
示す図である。
FIG. 11 is a diagram showing a conventional sequential search method by software processing.

【図12】従来のソフトウェア処理による2分検索法を
示す図である。
FIG. 12 is a diagram showing a conventional binary search method using software processing.

【符号の説明】[Explanation of symbols]

10 文字列検索装置 102 〜108 レジスタ 110, 112 演算回路(XOR回路) 114 データ制御回路 116 シフト制御回路 118 判定回路 10 Character string search device 102 to 108 Register 110, 112 Operation circuit (XOR circuit) 114 Data control circuit 116 Shift control circuit 118 Judgment circuit

Claims (5)

【特許請求の範囲】[Claims] 【請求項1】 所定の文字列が複数記憶されたデータフ
ァイルの中から所望の文字列を検索する文字列検索方法
において、該方法は、 前記データファイルからの文字列またはこれと照合する
文字列のうちデータ長の長い文字列のデータを第1のレ
ジスタに保持し、短い文字列のデータを第2のレジスタ
に保持する第1の工程と、 第1の工程により前記第2のレジスタに保持した文字列
の先頭の文字を表わすデータを第1のレジスタに保持し
た文字列のデータ長分第3のレジスタに保持する第2の
工程と、 第1のレジスタに保持したデータと第3のレジスタに保
持したデータとの排他的論理和を演算して、その結果を
第3のレジスタに保持する第3の工程と、 第3の工程により第3のレジスタに保持した値が零とな
る文字の位置に第2のレジスタに保持した文字列のデー
タをシフトする第4の工程と、 第4の工程によりシフトした第2のレジスタのデータと
第1のレジスタのデータとの排他的論理和を演算して、
その結果を第4のレジスタに保持する第5の工程と、 第5の工程により前記第4のレジスタに保持した値が第
2のレジスタの文字列分零になっているか否かを判定す
る第6の工程と、 第6の工程の判定結果が否となった場合に第4ないし第
6の工程を繰り返して、その結果、第6の工程の判定結
果が正となった場合にその文字列を出力する第7の工程
と、 第1ないし第7の工程を前記データファイルのそれぞれ
の文字列について繰り返して、所望の文字列を検索する
第8の工程とを含むことを特徴とする文字列検索方法。
1. A character string search method for searching for a desired character string from a data file in which a plurality of predetermined character strings are stored, the method comprising: a character string from the data file or a character string to be collated with the character string A first step of holding data of a character string having a long data length in a first register and holding data of a short character string in a second register; and holding the data of the short string in the second register by the first step. A second step of storing data representing the first character of the converted character string in the third register by the data length of the character string stored in the first register; and a method of storing the data stored in the first register and the third register. A third step of calculating an exclusive OR with the data held in the third register, and holding the result in the third register; and a third step in which the value held in the third register by the third step becomes zero. Second cashier in position A fourth step of shifting the data string held in the data, the exclusive OR of the fourth of the second register is shifted by step data and the data of the first register by calculating,
A fifth step of holding the result in the fourth register; and a fifth step of determining whether the value held in the fourth register in the fifth step is zero for the character string in the second register. Step 6 and the fourth to sixth steps are repeated when the result of the determination in the sixth step is negative. When the result of the determination in the sixth step is positive, the character string And a seventh step of repeating the first to seventh steps for each character string in the data file to search for a desired character string. retrieval method.
【請求項2】 請求項1に記載の方法において、該方法
は、照合する複数の文字列をあらかじめ第2のデータフ
ァイルとして記憶して、該第2のデータファイルのそれ
ぞれの文字列について第1ないし第7の工程を繰り返し
て、さらに第8の工程を繰り返して、それぞれの文字列
を検索することを特徴とする文字列検索方法。
2. The method according to claim 1, wherein the plurality of character strings to be collated are stored in advance as a second data file, and a first character string is stored for each character string in the second data file. A character string search method comprising repeating the seventh to seventh steps and further repeating the eighth step to search for respective character strings.
【請求項3】 所定の文字列が複数記憶されたデータフ
ァイルの中から所望の文字列を検索する文字列検索装置
において、該装置は、 前記データファイルからの文字列またはこれと照合する
文字列のうち一方のデータが保持される第1のレジスタ
と、 前記データファイルからの文字列またはこれと照合する
文字列のうち他方のデータが保持される第2のレジスタ
であって、保持されたデータをシフト自在に蓄積する第
2のレジスタと、 第2のレジスタに保持された文字列の先頭の文字のデー
タが第1のレジスタに保持された文字数分蓄積され、そ
の蓄積された文字列と第1のレジスタの文字列のデータ
との排他的論理和の結果が保持される第3のレジスタ
と、 第1のレジスタに保持された文字列と第2のレジスタに
保持された文字列のそれぞれのデータの排他的論理和の
結果が保持される第4のレジスタと、 第1のレジスタの文字列と第3のレジスタの文字列のそ
れぞれのデータを対応する文字毎に排他的論理をとっ
て、その結果を第3のレジスタに供給する第1の演算手
段と、 第1のレジスタの文字列と第2のレジスタの文字列のそ
れぞれのデータを対応する文字毎に排他的論理和をとっ
て、その結果を第4のレジスタに供給する第2の演算手
段と、 第1ないし第3のレジスタにそれぞれのデータを設定す
るデータ制御手段と、 第2のレジスタに保持された文字列のデータを第3のレ
ジスタに保持された排他的論理和の結果に基づいてシフ
トするシフト制御手段と、 該シフト制御手段での第2のレジスタのデータのシフト
位置およびその際の第4のレジスタの排他的論理和の演
算結果に基づいて検索結果の出力を判定する判定手段と
を含み、 前記データ制御手段は、前記データファイルからの文字
列と照合する文字列のデータの長さを比較して長い文字
列のデータを第1のレジスタに設定し、短い文字列のデ
ータを第2のレジスタに設定し、さらに第2のレジスタ
に設定した文字列の先頭の文字のデータを第1のレジス
タに設定した文字数分第3のレジスタに設定することを
特徴とする文字列検索装置。
3. A character string search device for searching for a desired character string from a data file storing a plurality of predetermined character strings, the device comprising: a character string from the data file or a character string to be collated with the character string. A first register holding one of the data, and a second register holding the other data of a character string from the data file or a character string to be matched with the first data, A second register for storing the character string in a shiftable manner, and data of the first character of the character string held in the second register are stored for the number of characters held in the first register. A third register in which the result of the exclusive OR with the data of the character string in the first register is held, and a character string held in the first register and a character string held in the second register And a fourth register that holds the result of the exclusive OR of these data, and the exclusive logic of each character of the character string of the first register and the character string of the third register for each corresponding character. A first operation means for supplying the result to a third register; and an exclusive OR of the data of the character string of the first register and the data of the character string of the second register for each corresponding character. Second operation means for supplying the result to a fourth register; data control means for setting respective data in the first to third registers; and character string data held in the second register. , Based on the result of the exclusive OR held in the third register, and the shift position of the data in the second register and the exclusion of the fourth register at that time. Logical disjunction Determination means for determining the output of the search result based on the calculation result, wherein the data control means compares the length of the character string data to be matched with the character string from the data file, and the data of the long character string Is set in the first register, the short character string data is set in the second register, and the first character data of the character string set in the second register is stored in the first register for the number of characters set in the first register. 3. A character string search device, wherein the character string search device is set in a register of No. 3.
【請求項4】 請求項3に記載の装置において、前記シ
フト制御手段は、第3のレジスタに保持された排他的論
理和の結果が零となる位置に第2のレジスタの文字列の
データを順次シフトして、前記判定手段は、それぞれシ
フトした位置において第4のレジスタに保持された排他
的論理和の結果が第2のレジスタの文字数分零となった
か否かを判定し、その判定結果が正となった場合に前記
データ制御手段に検索結果の出力を指示し、判定結果が
否となった場合に前記シフト制御手段に第2のレジスタ
のデータのシフトを指示することを特徴とする文字列検
索装置。
4. The apparatus according to claim 3, wherein the shift control means stores the character string data of the second register at a position where the result of the exclusive OR held in the third register becomes zero. Sequentially shifting, and the determination means determines whether or not the result of the exclusive OR held in the fourth register at each shifted position is zero by the number of characters in the second register. When the result is positive, the data control means is instructed to output a search result, and when the determination result is negative, the shift control means is instructed to shift the data of the second register. String search device.
【請求項5】 請求項4に記載の装置において、前記シ
フト制御手段は、第2のレジスタのデータをシフトした
際にその位置における第3のレジスタの排他的論理和の
結果を"1"に書き替え、前記判定手段は、第3のレジス
タに零があるか否かを判定して、零がある場合に前記シ
フト手段にシフトを指示し、零がない場合に前記データ
制御手段にそのデータの検索終了を指示し、前記データ
制御手段は、前記判定手段から検索結果の出力の指示ま
たは検索結果の終了の指示を受けて次の文字列をそれぞ
れのレジスタに設定することを特徴とする文字列検索装
置。
5. The apparatus according to claim 4, wherein the shift control means sets the result of the exclusive OR of the third register at the position when the data of the second register is shifted to “1”. Rewriting, the determining means determines whether or not the third register has zero, and instructs the shift means to shift when there is zero, and instructs the data control means to shift the data when there is no zero. The data control means sets the next character string in each register in response to an instruction to output a search result or an instruction to end the search result from the determination means. Column search device.
JP2001115322A 2001-04-13 2001-04-13 Character string retrieval method and character string retrieval device Withdrawn JP2002312364A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2001115322A JP2002312364A (en) 2001-04-13 2001-04-13 Character string retrieval method and character string retrieval device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2001115322A JP2002312364A (en) 2001-04-13 2001-04-13 Character string retrieval method and character string retrieval device

Publications (1)

Publication Number Publication Date
JP2002312364A true JP2002312364A (en) 2002-10-25

Family

ID=18966244

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2001115322A Withdrawn JP2002312364A (en) 2001-04-13 2001-04-13 Character string retrieval method and character string retrieval device

Country Status (1)

Country Link
JP (1) JP2002312364A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2014235454A (en) * 2013-05-30 2014-12-15 富士通株式会社 Character string search method, device, and program

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2014235454A (en) * 2013-05-30 2014-12-15 富士通株式会社 Character string search method, device, and program
US9645828B2 (en) 2013-05-30 2017-05-09 Fujitsu Limited Method of searching character string, character string searching device, and recording medium

Similar Documents

Publication Publication Date Title
US9043272B2 (en) System and method for determining the start of a match of a regular expression
US5060143A (en) System for string searching including parallel comparison of candidate data block-by-block
JP3672242B2 (en) PATTERN SEARCH METHOD, PATTERN SEARCH DEVICE, COMPUTER PROGRAM, AND STORAGE MEDIUM
US8095526B2 (en) Efficient retrieval of variable-length character string data
JPH07297728A (en) Method and system for searching coincidence of patterns
JPH08255176A (en) Method and system for comparison of table of database
JP4120888B2 (en) Data retrieval apparatus and method
US20020152352A1 (en) High-speed information retrieval system
US20070027867A1 (en) Pattern matching apparatus and method
EP0575192B1 (en) Finite state automaton text search apparatus having two-level memory structure
TWI631509B (en) Methods for accelerating compression and apparatuses using the same
EP0953919B1 (en) Hashing method and apparatus
JPH07177005A (en) Bit pattern detector circuit and bit pattern detecting method
EP1290542B1 (en) Determination of a minimum or maximum value in a set of data
JPS61210478A (en) Vector processing device
JP2002312364A (en) Character string retrieval method and character string retrieval device
US4839799A (en) Buffer control method for quickly determining whether a required data block is in the buffer
JP4347086B2 (en) Pattern matching apparatus and method, and program
JPH06274701A (en) Word collating device
JP2722684B2 (en) File system search device
US20030187843A1 (en) Method and system for searching for a list of values matching a user defined search expression
JPH06162096A (en) Record retrieval method
JPH01276237A (en) Selector for candidate term to be unified
JPH04245375A (en) Control system of symbol string collating device
JPH04326120A (en) information processing equipment

Legal Events

Date Code Title Description
A300 Application deemed to be withdrawn because no request for examination was validly filed

Free format text: JAPANESE INTERMEDIATE CODE: A300

Effective date: 20080701