JPH1139344A - Character string retrieval method using two-dimensional array code - Google Patents
Character string retrieval method using two-dimensional array codeInfo
- Publication number
- JPH1139344A JPH1139344A JP9209932A JP20993297A JPH1139344A JP H1139344 A JPH1139344 A JP H1139344A JP 9209932 A JP9209932 A JP 9209932A JP 20993297 A JP20993297 A JP 20993297A JP H1139344 A JPH1139344 A JP H1139344A
- Authority
- JP
- Japan
- Prior art keywords
- character
- code
- condition
- character string
- type
- 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.)
- Granted
Links
- 238000000034 method Methods 0.000 title claims description 27
- 238000010586 diagram Methods 0.000 description 10
- 230000000694 effects Effects 0.000 description 3
- 238000003491 array Methods 0.000 description 2
- 238000007796 conventional method Methods 0.000 description 2
- 239000002699 waste material Substances 0.000 description 2
- 239000000470 constituent Substances 0.000 description 1
- 238000013500 data storage Methods 0.000 description 1
- 239000011159 matrix material Substances 0.000 description 1
- 230000000717 retained effect Effects 0.000 description 1
Landscapes
- Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
Abstract
Description
【0001】[0001]
【発明の属する技術分野】本発明は、文字列検索方法に
関し、特に、コンピュータを用いた文字列検索方法に関
する。BACKGROUND OF THE INVENTION 1. Field of the Invention The present invention relates to a character string search method, and more particularly to a character string search method using a computer.
【0002】[0002]
【従来の技術】ファイルに格納されている複数の文字列
データと条件文字列を比較する文字検索方法として、比
較対象文字列の先頭1文字と条件文字列の先頭1文字と
を比較し、合致した場合には、以降それぞれの文字列の
次の文字同士の比較を順次行い、条件文字列全体と一致
するか否かを判断する。条件文字列中の文字としては、
通常の文字のほかに、特殊な文字として、任意の1文字
を表すもの、任意の文字(または文字列)を表すもの、
さらに該当する文字の羅列や範囲を指定して複数の文字
を表すもの(この指定の仕方を「複数指定」という)な
どがある。2. Description of the Related Art As a character search method for comparing a plurality of character string data stored in a file with a condition character string, a first character of a comparison target character string is compared with a first character of the condition character string, and a match is made. In this case, the following characters in the respective character strings are compared sequentially, and it is determined whether or not the character string matches the entire condition character string. The characters in the condition string are
In addition to ordinary characters, special characters that represent any one character, characters that represent any character (or character string),
Further, there is a method of designating a plurality of characters by designating a list or range of corresponding characters (this designation method is referred to as “plural designation”).
【0003】この中で、複数指定による比較を行うため
には、その指定によって条件に該当する全ての文字
(「該当文字群」という)の情報を保持し、比較対象の
文字と個々に比較する必要がある。[0003] Among them, in order to perform a comparison by a plurality of designations, information of all characters (referred to as "corresponding character group") corresponding to a condition is retained by the designation and individually compared with characters to be compared. There is a need.
【0004】従来の文字検索方式について図10を参照
して以下に説明する。従来の方式では、条件文字列10
1に対してコード化処理102を行い、条件文字コード
103のように、該当文字群の情報を1文字ごとに配列
の1要素に格納しているため、比較対象文字列105と
の比較処理104では比較回数が増えてしまう。A conventional character search method will be described below with reference to FIG. In the conventional method, the condition string 10
1 is subjected to the encoding process 102, and as in the condition character code 103, the information of the corresponding character group is stored in one element of the array for each character. Then, the number of comparisons increases.
【0005】[0005]
【発明が解決しようとする課題】以上説明したように、
上記従来の文字検索方法は下記記載の問題点を有してい
る。As described above,
The above-described conventional character search method has the following problems.
【0006】第1の問題点は、複数指定をした際の性能
が著しく低下する、ということである。The first problem is that the performance when a plurality of designations are made is significantly reduced.
【0007】その理由は、複数指定部分での比較回数
は、指定該当文字数をnとすると、比較対象となる文字
列データごとに、比較対象文字が該当文字列にない場合
には、n回、該当文字列にある場合でも、平均して、
((1+n)/2)回になり、比較回数は、該当文字数
や、特に文字列データが増えるにしたがって増大するか
らである。[0007] The reason is that the number of comparisons in a plurality of designated portions is n for each character string data to be compared if the character to be compared is not in the corresponding character string, assuming that the number of designated characters is n. Even if it is in the string,
This is because the number of comparisons becomes ((1 + n) / 2), and the number of comparisons increases as the number of applicable characters, and in particular, the character string data increases.
【0008】第2の問題点は、複数指定時の該当文字群
の情報を格納するために必要な個々の文字を保持する配
列の大きさ(要素の個数)を決めるための適当な方法が
ない、ということである。The second problem is that there is no appropriate method for determining the size (number of elements) of an array holding individual characters necessary to store information on a corresponding character group when a plurality of characters are specified. ,That's what it means.
【0009】その理由は、上述の考え方では、複数指定
部分での該当文字群の情報を格納する配列の大ささは、
(条件文字数×許される文字数)個であるが、通常、複
数指定は、条件文字列中、せいぜい1〜2文字程度であ
り、また該当文字数も、平均すれば、使用可能な文字数
全体に比べ、かなりの割合であることが考えられるた
め、ほとんどが無駄な配列となる、可能性がある。The reason is that, in the above-described concept, the size of an array for storing information of a corresponding character group in a plurality of designated portions is:
(Condition number of characters x number of allowed characters), but usually multiple designations are at most about 1 to 2 characters in the condition character string, and the number of applicable characters is, on average, smaller than the total number of usable characters. It can be a significant percentage, so most could be wasted arrays.
【0010】しかし、この大きさよりも小さい配列を用
意すると、指定によっては、用意した配列の大きさ以上
の大きさが必要となり、いわゆる配列外参照を起こして
しまう可能性がある。However, if an array smaller than this size is prepared, a size larger than the size of the prepared array is required depending on the specification, and so-called out-of-array reference may be caused.
【0011】したがって、本発明は、複数指定がある場
合でも比較回数を減らし、検索性能を高速化する文字検
索方法を提供することにある。Accordingly, an object of the present invention is to provide a character search method that reduces the number of comparisons and speeds up search performance even when a plurality of designations are made.
【0012】また、本発明は、複数指定による該当文字
の情報を格納するために必要な配列の大きさについて、
さほど無駄にならず、かつ、一意に決まるようにする文
字検索方法を提供することにある。Further, according to the present invention, the size of an array necessary for storing information of a corresponding character by a plurality of designations is defined as follows.
An object of the present invention is to provide a character search method that does not waste much and is uniquely determined.
【0013】[0013]
【課題を解決するための手段】前記目的を達成するた
め、本発明は、その概要を述べれば、条件文字列を2次
元配列を用いてコード化するものである。本発明の文字
検索方法は、条件指定による文字列の検索において、条
件文字を文字種別と、該文字種別内該当文字フラグを表
す2次元の配列を用いてコード化し、前記コードと複数
指定条件文字を含む比較対象文字とを比較することを特
徴とする。In order to achieve the above-mentioned object, the present invention, in brief, is to code a conditional character string using a two-dimensional array. In a character search method according to the present invention, in a search for a character string by condition designation, a condition character is coded using a character type and a two-dimensional array representing a corresponding character flag in the character type, and the code and the plural designation condition character Is compared with the comparison target character including.
【0014】また、本発明は、条件種別を行方向と、文
字種別を列方向の添え字とする2次元配列を備え、列方
向添字の先頭には、対応する条件文字種別コードが格納
され、複数指定の場合、列方向の添え字の次の要素に、
順次、文字種別の該当フラグによりコード化し、比較対
象文字について該比較対象文字種別の該当フラグにより
コード値を前記2次元配列の前記文字種別に対応する添
字に格納されたコードと比較することにより、文字の検
索を行うことを特徴とする。Further, the present invention includes a two-dimensional array having a condition type as a subscript in the row direction and a character type as a subscript in the column direction. A corresponding condition character type code is stored at the head of the column direction subscript. In the case of multiple specifications, the next element of the subscript in the column direction is
By sequentially coding with a corresponding flag of the character type, and comparing the code value of the character to be compared with the code stored in the subscript corresponding to the character type in the two-dimensional array by the corresponding flag of the character type to be compared, Character search is performed.
【0015】本発明においては、条件コードは、条件文
字ごとに文字種別ごとの該当文字フラグの情報を格納す
る配列と、これらの配列を条件文字すべてについて管理
する配列からなっている。In the present invention, the condition code includes an array for storing information on the corresponding character flag for each character type for each condition character, and an array for managing these arrays for all the condition characters.
【0016】[0016]
【発明の実施の形態】次に、本発明の実施の形態につい
て図面を参照して説明する。Next, embodiments of the present invention will be described with reference to the drawings.
【0017】図1は、本発明の実施の形態を説明するた
めの図であり、文字列データ4の中から与えられた条件
文字1を満たす文字列を検索し、一致データファイル6
に格納するシステムである。このシステムでの比較処理
5にあたっては、条件文字1をコード処理(図1の2)
により得た条件文字コード3を使って比較を行ってい
る。FIG. 1 is a diagram for explaining an embodiment of the present invention. A character string satisfying a given condition character 1 is searched from character string data 4 and a matching data file 6 is searched.
System. In comparison processing 5 in this system, conditional character 1 is code-processed (2 in FIG. 1).
The comparison is performed using the conditional character code 3 obtained by the above.
【0018】次に、本発明の実施の形態における条件文
字コード3の詳細について、図2を参照して説明する。Next, details of the conditional character code 3 in the embodiment of the present invention will be described with reference to FIG.
【0019】コード化にあたっては、与えられた条件文
字列1を条件文字ごとに分け、配列の1次元目の格納番
号(「1次の添字」という)を与える。さらに、その文
字を条件種別にわけ、2次元目の格納番号(「2次の添
字」という)の先頭に種別番号を代入し、特に、複数指
定であった場合には、文字種別ごとに、該当データ群を
フラグとして、対応する2次の添字の要素に対応させて
格納し(図2の7)、条件文字コードコード3とする。In coding, the given condition character string 1 is divided for each condition character, and the storage number of the first dimension of the array (referred to as "primary subscript") is given. Further, the character is divided into condition types, and a type number is assigned to the head of a storage number in the second dimension (referred to as a “secondary subscript”). The corresponding data group is stored as a flag in association with the element of the corresponding secondary subscript (7 in FIG. 2), and the condition character code code 3 is set.
【0020】図3は、本発明の実施の形態の動作を説明
するためのフローチャートである。本発明の実施の形態
の動作について、図3を参照して説明する。FIG. 3 is a flowchart for explaining the operation of the embodiment of the present invention. The operation of the embodiment of the present invention will be described with reference to FIG.
【0021】ある与えられた条件文字列について、その
文字列を分類処理し(ステップSll)、文字列全体が
一意指定か前方一致であるかを判定する(ステップS1
2)。一意指定または前方一致の場合、処理が増えるた
め、標準関数等を用いて、比較する(ステップS1
4)。With respect to a given condition character string, the character string is classified (step S11), and it is determined whether the entire character string is uniquely specified or matches the beginning (step S1).
2). In the case of unique designation or prefix matching, the number of processes increases, so comparison is made using a standard function or the like (step S1).
4).
【0022】上記以外の場合には(ステップS12のN
o分岐)、構成する条件文字ごとに条件種別にわけ、複
数指定であった場合には文字種別ごとに該当データ群を
フラグ化し、各配列の要素に格納する(ステップS1
3)。In cases other than the above (N in step S12)
o), the condition type is divided for each constituent character, and if a plurality is specified, the data group is flagged for each character type and stored in an element of each array (step S1).
3).
【0023】次に、文字列データファイル4より比較対
象文字を取得し(ステップS15)、文字列データが終
了しているか否かの判断を行う(ステップS16)。Next, a character to be compared is obtained from the character string data file 4 (step S15), and it is determined whether or not the character string data is completed (step S16).
【0024】文字列データが終了していなければ、文字
ごとの比較処理を行い(ステップS17)、最終一致判
定処理を行い(ステップS18)、文字列が一致するか
どうかを判定し(ステップS19)、一致していれば、
一致文字列データを書き込んで(ステップS20)、次
の文字列データを読み込む(ステップS15)。ステッ
プS15〜S20の処理は、文字データファイル内のす
べての文字列データについて行われる。If the character string data is not completed, a comparison process is performed for each character (step S17), a final match determination process is performed (step S18), and it is determined whether or not the character strings match (step S19). , If they match,
The matching character string data is written (step S20), and the next character string data is read (step S15). The processing of steps S15 to S20 is performed for all character string data in the character data file.
【0025】図4は、図3のステップS17の文字ごと
の比較処理の処理フローを示すフローチャートである。
図4を参照して、比較対象文字列との比較処理について
説明する。FIG. 4 is a flowchart showing the processing flow of the comparison process for each character in step S17 in FIG.
With reference to FIG. 4, a description will be given of a comparison process with a comparison target character string.
【0026】比較対象文字列との比較おいては、対応す
る条件文字コードの2次の添え字について先頭の要素を
基に、複数指定文字かどうかを判断し(ステップS4
2)、複数指定文字以外の場合には、処理が増えるた
め、従来の条件種別に応じた比較処理を行う(ステップ
S44)。In comparison with the character string to be compared, it is determined whether or not the secondary subscript of the corresponding condition character code is a plurality of designated characters based on the first element (step S4).
2) In the case of a character other than a plurality of designated characters, a comparison process is performed according to the conventional condition type because the process is increased (step S44).
【0027】一方、複数指定の場合には、比較文字デー
タの(i+1)文字目について文字種別を判断し、該当
する文字種別についてのみコード化する(ステップS4
3)。On the other hand, when a plurality of characters are specified, the character type is determined for the (i + 1) th character of the comparison character data, and only the corresponding character type is encoded (step S4).
3).
【0028】次に、上記比較対象文字コードと対応する
条件文字コードの文字種別の要素(フラグ)で論理積を
とることにより比較を行う(ステップS45)。Next, a comparison is made by taking a logical product of the elements (flags) of the character type of the condition character code corresponding to the character code to be compared (step S45).
【0029】上記処理の比較結果からの文字が一致する
かどうかを判断する(ステップS46)。具体的には、
ステップS45での結果が0以外の場合には一致、0の
場合には不一致となる。It is determined whether or not the characters from the comparison result of the above processing match (step S46). In particular,
If the result in step S45 is other than 0, they match, and if they are 0, they do not match.
【0030】比較の結果一致しない場合には、次の文字
列データを読み込む(図1のステップS15)。If they do not match, the next character string data is read (step S15 in FIG. 1).
【0031】一致する場合には、比較対象を次の条件文
字、比較対象文字に移すためにカウンタ(i)を増やす
(ステップS47)。ここで、比較文字列が終了してい
た場合には最終一致判定処理へ移る(図1のステップS
18)。If they match, the counter (i) is increased to move the comparison target to the next condition character or comparison target character (step S47). Here, if the comparison character string has been completed, the process proceeds to the final match determination process (step S in FIG. 1).
18).
【0032】終了していない場合には、ステップS42
からS48までの処理を繰り返す。なお、上記各ステッ
プの処理は、コンピュータ上で実行されるプログラム制
御により実現することができる。If not completed, step S42
To S48 are repeated. The processing in each of the above steps can be realized by program control executed on a computer.
【0033】[0033]
【実施例】次に、本発明の一実施例について説明する。
使用する文字は以下のものとし、それぞれ以下のような
文字種別とする。Next, an embodiment of the present invention will be described.
The following characters are used, and the following character types are used.
【0034】 .(ピリオド) …文字種別1。. (Period) ... Character type 1.
【0035】 0〜9 …文字種別2。0-9: Character type 2
【0036】 A〜Z …文字種別3。AZ: Character type 3
【0037】また、条件文字の指定方法として以下の4
種類があるものとし、それぞれ以下のような条件種別番
号に対応するものとする。In addition, the following 4
It is assumed that there are types, and they correspond to the following condition type numbers, respectively.
【0038】 ・一意指定(条件種別0) …使用可能な文字の中
から1文字を指定する。-Unique designation (condition type 0) ... designates one character from available characters.
【0039】 ・任意1文字指定(条件種別1)…使用可能な文字の中
の任意の1文字を表す。Specifying an arbitrary one character (condition type 1): represents an arbitrary one of available characters.
【0040】 ・任意文字指定(条件種別2) …使用可能な文字また
は文字列を表す。-Arbitrary character designation (condition type 2): Indicates an available character or character string.
【0041】 ・複数指定(条件種別3) …複数個の使用可能な
文字を指定するもの(文字の羅列や範囲指定などがあ
る)。A plurality of designations (condition type 3)... Designation of a plurality of usable characters (such as a character string or range designation).
【0042】複数指定の例について簡単に説明する。An example of a plurality of designations will be briefly described.
【0043】 [ABC]→A,B,Cのいずれかを表す。[ABC] → A, B, or C is represented.
【0044】 [D−F]→D,E,Fのいずれかを表す。[DF] represents one of D, E, and F.
【0045】 [AC−E]→A,C,D,Eのいずれかを表す。[AC-E] represents one of A, C, D, and E.
【0046】また、文字種別間の範囲指定についても文
字種別の1から3の順に連続しているものとして指定が
可能であるものとする。It is also assumed that the range designation between the character types can be designated as being continuous in the order of 1 to 3 of the character types.
【0047】実際の条件文字の例として、条件文字列A
?*[5−CX]について考える。As an example of an actual condition character, a condition character string A
? * Consider [5-CX].
【0048】これは、先頭の文字がAで、最後の文字
が、5,6,7,8,9,A,B,C,Xである3文字
以上の文字列であることを表す。This means that the first character is A, and the last character is a character string of three or more characters of 5, 6, 7, 8, 9, A, B, C, and X.
【0049】この場合の条件種別は、4種類、条件文字
数は4文字であるので、文字コードは5×5の行列とな
る。In this case, since there are four types of condition and four condition characters, the character code is a 5 × 5 matrix.
【0050】次に、本発明の一実施例の動作について、
図5を参照して詳細に説明する。Next, the operation of one embodiment of the present invention will be described.
This will be described in detail with reference to FIG.
【0051】条件文字列51をコード化した際の条件コ
ードの配列の値は、条件コード52のように、2次の添
え字の先頭には、対応する条件文字種別コードが入り、
複数指定(D[n][0]=3)の場合、その1次の添
え字の次の要素(D[n][1],D[n][2],
…)に、順次、文字種別の該当フラグを格納する。な
お、条件コード52の他の要素のデータは、条件文字列
51に対しては使用しないが、D[0][0]=0は条
件種別0、D[1][0]=1は条件種別1、D[2]
[0]=2は条件種別2を示している。The value of the array of condition codes when the condition character string 51 is coded is, as in the case of the condition code 52, the head of the secondary subscript is filled with the corresponding condition character type code.
In the case of multiple designations (D [n] [0] = 3), the next element (D [n] [1], D [n] [2],
..) Are sequentially stored with corresponding flags of the character types. The data of the other elements of the condition code 52 are not used for the condition character string 51, but D [0] [0] = 0 is the condition type 0, and D [1] [0] = 1 is the condition type. Type 1, D [2]
[0] = 2 indicates the condition type 2.
【0052】次に、条件文字列52中の複数条件文字
[5−CX]のコード化について、図6を参照して説明
する。Next, encoding of a plurality of conditional characters [5-CX] in the conditional character string 52 will be described with reference to FIG.
【0053】複数条件文字のコード化では、対応する該
当文字について条件文字種別ごとの番号を付け、その番
号に対応する要素に文字があるかないかを0と1で表
す。以下各文字種別ごとに説明する。In the coding of a plurality of condition characters, a number is assigned to each corresponding character by the condition character type, and whether or not there is a character in an element corresponding to the number is represented by 0 or 1. The following describes each character type.
【0054】条件文字[5−CX]中には、文字種別1
であるピリオドは含まれていない。そこで、D[3]
[1]に0を格納する(図6の61)。In condition character [5-CX], character type 1
Is not included. Therefore, D [3]
0 is stored in [1] (61 in FIG. 6).
【0055】また、文字種別2の中では5から9が該当
するため、それらに該当する部分のフラグを1にし、こ
れを0から9まで順に並べたもの(図6の62)を2進
数と見なし、D[3][2]に格納する。なお、以降こ
の2進数を10進化して説明する。In addition, since the characters 5 to 9 correspond to the character type 2, the flag of the portion corresponding to them is set to 1, and those arranged in order from 0 to 9 (62 in FIG. 6) are expressed as a binary number. Considered and stored in D [3] [2]. In the following, this binary number will be described after being deciphered into ten.
【0056】同様に、文字種別3についても同様の処理
を行い(図6の63)、データをD[3][3]に格納
する。Similarly, the same processing is performed for the character type 3 (63 in FIG. 6), and the data is stored in D [3] [3].
【0057】次に実際の比較について、図7を参照して
詳細に説明する。なお、複数条件文字以外の比較処理に
ついては従来の処理で行うため、説明は複数条件文字と
の比較部分に絞って説明する(図4のステップS43と
ステップS45)。Next, the actual comparison will be described in detail with reference to FIG. Since comparison processing other than the multiple condition characters is performed by the conventional processing, the description will be limited to the comparison with the multiple condition characters (steps S43 and S45 in FIG. 4).
【0058】具体例の1として、上記条件文字[5−C
X]、比較の対象となる文字の例として”6”を考え
る。まず”6”の文字種別は2であり、”6”について
条件文字と同様の方法でコード化を行い、64を得る
(図7の71)。As one specific example, the condition character [5-C
X], and consider "6" as an example of a character to be compared. First, the character type of "6" is 2, and "6" is coded in the same manner as the conditional character to obtain 64 (71 in FIG. 7).
【0059】次に、このコードと条件文字コード72内
の対応するコード(D[3][2])との論理積をと
る。その結果として64となり、論理積が0でないこと
から一致するという結果を得る。Next, the logical product of this code and the corresponding code (D [3] [2]) in the conditional character code 72 is calculated. As a result, the result is 64, and the result that the logical product matches because the logical product is not 0 is obtained.
【0060】また、同じ複数条件文字に対して”E”と
の比較を行うと”E”の文字種別と順番から(図7の7
3)のようになり、条件文字コード72中の対応コード
(D[3][3])との論理積の結果である0、すなわ
ち不一致という結果を得る。When the same plural condition characters are compared with "E", the character type and the order of "E" are determined (see 7 in FIG. 7).
As shown in 3), 0 which is the result of the logical product with the corresponding code (D [3] [3]) in the conditional character code 72, that is, the result of mismatch is obtained.
【0061】次に、従来のコードとの違いについて図1
1を参照して詳細に説明する。Next, the difference from the conventional code is shown in FIG.
This will be described in detail with reference to FIG.
【0062】図11(A)の条件文字列51を、従来の
コードを使って表現すると、図11(B)の111のよ
うになる。ここで、1次の添え字3と13の括
弧([,])は複数条件の該当文字データの開始と終了
を表すものとする。When the conditional character string 51 of FIG. 11A is expressed using a conventional code, it becomes as shown by 111 in FIG. 11B. Here, the parentheses ([,]) of the primary suffixes 3 and 13 indicate the start and end of the character data corresponding to a plurality of conditions.
【0063】配列の大きさでは、従来のコードは、1
4、本実施例によるコードでは25と従来のコードの方
が少ないが、文字列データあたりの複数条件部分での比
較回数については、従来の9回(=該当文字数)に比
べ、本実施例によるコードでは1回と少ない。For the size of the array, the conventional code is 1
4. In the code according to the present embodiment, 25 is smaller in the conventional code than in the conventional code. However, the number of comparisons in a plurality of condition parts per character string data is smaller than that in the conventional 9 (= the number of applicable characters) according to the present embodiment. In code, it is only once.
【0064】さらに、図12に示すよう、に条件文字列
としてA?−*[5−X]を考えると、従来の条件コー
ドでは36となり、本実施例によるコードの25よりも
多くなる。また、文字列データあたりの複数指定部分の
比較回数は、従来のコードでの31回に比べて1回とか
なり少ない。このように、本実施例によるコードでは条
件文字数が同じであればどのような指定をしても配列の
要素数は変わらず、また、複数指定部分の比較は常に1
回になる。Further, as shown in FIG. 12, A? Considering − * [5-X], the condition code is 36 in the conventional condition code, which is more than 25 in the code according to the present embodiment. Also, the number of comparisons of a plurality of designated portions per character string data is one, which is considerably smaller than that of 31 in the conventional code. As described above, in the code according to the present embodiment, the number of elements of the array does not change regardless of the designation as long as the number of conditional characters is the same, and the comparison of a plurality of designated portions is always one.
Turns.
【0065】なお、従来のコードにおいて使用する要素
数は条件文字列によって変わるものの、配列外参照が起
こらないようにするために必要な配列の要素数は、条件
文字を4文字とした場合には、4×{(文字種別1の文
字数)+(文字種別2の文字数)+(文字種別3の文字
数)}=4×(1+10+26)=148となる。Although the number of elements used in the conventional code varies depending on the condition character string, the number of elements of the array required to prevent out-of-array reference is reduced when the condition character is four characters. , 4 × {(number of characters of character type 1) + (number of characters of character type 2) + (number of characters of character type 3)} = 4 × (1 + 10 + 26) = 148.
【0066】本発明の別の実施の形態について図8を参
照して説明する。入力ファイル81を記憶装置83に格
納する際に、予めデータ内のキーワードを基に、上位索
引ファイル87からデータ種別を分類し、そのキーワー
ドとデータファイル87へのポインタに関するデータを
データ種別ごとに格納する索引ファイル89で構成され
るシステムでの検索方式がある。Another embodiment of the present invention will be described with reference to FIG. When storing the input file 81 in the storage device 83, the data type is classified from the upper index file 87 based on the keywords in the data in advance, and the data relating to the keyword and the pointer to the data file 87 are stored for each data type. There is a search method in a system constituted by an index file 89 to be executed.
【0067】従来は、指定したキーワードの数だけリス
トデータの検索を行っていたが、本発明の実施の形態で
は、上位索引ファイル83内に、データ種別ごとに属す
るキーワードに番号を付けそれらを管理することで(図
9の91)、検索の際に、検索データ84を上位索引フ
ァイル83の情報を基に、データ種別ごとにフラグ化す
る。なお、図9において、上位検索ファイル91とデー
タ種別1との対応を92で示す。データ種別ごとの索引
ファイルとの比較においては、ファイル内の各データを
同様にフラグ化して入力条件コードの該当データ種別と
の論理積をとりその値で一致するかどうかで判断でき
る。Conventionally, list data has been searched for the number of specified keywords. In the embodiment of the present invention, keywords belonging to each data type are numbered in the upper index file 83 and managed. By doing so (91 in FIG. 9), at the time of search, the search data 84 is flagged for each data type based on the information of the upper index file 83. In FIG. 9, the correspondence between the upper search file 91 and the data type 1 is indicated by 92. In comparison with the index file for each data type, each data in the file is similarly flagged, and the logical product of the input condition code and the corresponding data type is obtained, and it can be determined whether or not the values match.
【0068】[0068]
【発明の効果】以上説明したように、本発明によれば下
記記載の効果を奏する。As described above, according to the present invention, the following effects can be obtained.
【0069】本発明の第1の効果は、従来方式で問題点
とされていた複数指定を使った際の検索性能の低下を解
消し、検索性能を高速化する、ということである。A first effect of the present invention is to solve the problem of the conventional method, that is, to reduce the search performance when using a plurality of designations, and to speed up the search performance.
【0070】その理由は、本発明においては、コード化
は複数条件文字部分のデータ化を検索処理の先頭で行う
ため、比較回数が文字列データごとに1回となる、ため
である。The reason is that, in the present invention, since the coding is performed at the beginning of the search processing by converting the data of a plurality of conditional character portions into data, the number of comparisons becomes one for each character string data.
【0071】本発明の第2の効果は、該当文字群の情報
を格納する配列についての無駄や配列外参照の発生の可
能性を回避することができる、ということである。A second effect of the present invention is that it is possible to avoid waste of the array storing the information of the corresponding character group and the possibility of occurrence of out-of-array reference.
【0072】その理由は、本発明においては、該当文字
群の情報を格納するために必要な配列の大きさを使用可
能文字数から文字種別数にすることで、各条件文字コー
ドごとに全情報を持たせても、さほど大きくならないか
らである。The reason is that, in the present invention, by changing the size of the array necessary for storing the information of the corresponding character group from the number of usable characters to the number of character types, all the information for each conditional character code is obtained. Even if you do, it will not be so large.
【図1】本発明の実施の形態を説明するための図であ
る。FIG. 1 is a diagram for describing an embodiment of the present invention.
【図2】本発明の実施の形態における2次元コードを説
明するための図である。FIG. 2 is a diagram for explaining a two-dimensional code according to the embodiment of the present invention.
【図3】本発明の実施の形態の処理フローを示すフロー
チャートである。FIG. 3 is a flowchart showing a processing flow according to the embodiment of the present invention.
【図4】本発明の実施の形態における文字ごとの比較の
処理フローを示すフローチャートである。FIG. 4 is a flowchart illustrating a comparison processing flow for each character according to the embodiment of the present invention.
【図5】本発明の一実施例を説明するための図であり、
条件文字全体のコードの例を示す図である。FIG. 5 is a diagram for explaining one embodiment of the present invention;
It is a figure showing the example of the code of the whole condition character.
【図6】本発明の一実施例を説明するための図であり、
複数指定文字部分についてのコードの例を示す図であ
る。FIG. 6 is a diagram for explaining one embodiment of the present invention;
It is a figure showing an example of a code about a plurality of designated character parts.
【図7】本発明の一実施例を説明するための図であり、
複数指定文字と比較対象文字との比較方法についての例
を示す図であるFIG. 7 is a diagram for explaining one embodiment of the present invention;
FIG. 6 is a diagram illustrating an example of a method of comparing a plurality of designated characters with a comparison target character;
【図8】本発明の別の実施の形態の構成を示す図であ
る。FIG. 8 is a diagram showing a configuration of another embodiment of the present invention.
【図9】本発明の別の実施の形態のコード化の適用例を
示す図である。FIG. 9 is a diagram showing an application example of coding according to another embodiment of the present invention.
【図10】従来の文字検索方式を説明するための図であ
る。FIG. 10 is a diagram for explaining a conventional character search method.
【図11】従来のコードによる条件文字列51のコード
である。FIG. 11 is a code of a condition character string 51 according to a conventional code.
【図12】条件文字列の他の例での従来と本実施例のコ
ードである。FIG. 12 shows codes of another example of a condition character string according to the related art and the present embodiment.
1 条件文字列 2 コード化処理 3 条件文字コード 4 文字列データ 5 条件文字列との比較処理 6 一致文字列データ 7 条件文字ごとの情報 51 条件文字列の例 52 条件文字列51に対応する条件コード 61 条件文字列51の文字種別1に関するコード表 62 条件文字列51の文字種別2に関するコード表 63 条件文字列51の文字種別3に関するコード表 71 比較対象文字”6”の文字種別2に関するコード
表 72 条件文字列51の条件コード中の複数指定データ
部 73 比較対象文字”E”の文字種別3に関するコード
表 81 入力ファイル 82 入力装置 83 記憶装置 84 検索データ 85 検索装置 86 一致データ格納ファイル 87 データファイル 88 上位検索ファイル 89 データ種別ごとの検索ファイル 91 上位検索ファイル88の一例 92 データ種別1に関するコード表の例 101 従来のコードによる条件文字列51のコード 111 条件文字列の例 112 従来のコードによる条件文字列111のコード 113 本発明のコードによる条件文字列111のコー
ドDESCRIPTION OF SYMBOLS 1 Condition character string 2 Encoding processing 3 Condition character code 4 Character string data 5 Comparison processing with a condition character string 6 Matching character string data 7 Information for each condition character 51 Example of a condition character string 52 Conditions corresponding to the condition character string 51 Code 61 Code table for character type 1 of condition character string 51 62 Code table for character type 2 of condition character string 51 63 Code table for character type 3 of condition character string 51 71 Code for character type 2 of comparison target character “6” Table 72 Multiple designation data part in condition code of condition character string 51 Code table for character type 3 of comparison target character "E" 81 Input file 82 Input device 83 Storage device 84 Search data 85 Search device 86 Matching data storage file 87 Data file 88 Top search file 89 Search file for each data type 91 Top search Example of search file 88 92 Example of code table relating to data type 101 101 Code of condition character string 51 by conventional code 111 Example of condition character string 112 Code of condition character string 111 by conventional code 113 Condition character by code of the present invention Code for column 111
Claims (3)
表す2次元の配列を用いてコード化し、 前記コードと複数指定条件文字を含む比較対象文字とを
比較することを特徴とする文字列検索方法。In a character string search by condition specification, a condition character is coded using a character type and a two-dimensional array representing a corresponding character flag in the character type, and a comparison including the code and a plurality of specified condition characters is performed. A character string search method characterized by comparing with a target character.
添え字とする2次元配列を備え、 列方向添字の先頭には、対応する条件文字種別コードが
格納され、 複数指定の場合、列方向の添え字の次の要素に、順次、
文字種別の該当フラグによりコード化し、 比較対象文字について該比較対象文字種別の該当フラグ
によりコード値を前記2次元配列の前記文字種別に対応
する添字に格納されたコードと比較することにより、文
字の検索を行うことを特徴とする文字列検索方法。2. A two-dimensional array having a condition type subscript in the row direction and a character type subscript in the column direction. A corresponding condition character type code is stored at the head of the column direction subscript. , The next element in the column index,
By encoding with a corresponding flag of the character type, and comparing the code value of the character to be compared with the code stored in the subscript corresponding to the character type in the two-dimensional array by the corresponding flag of the character type to be compared, A character string search method characterized by performing a search.
え字とする2次元配列の列方向添字の先頭には、対応す
る条件文字種別コードが格納され、複数指定の場合、列
方向の添え字の次の要素に、順次、文字種別の該当フラ
グによりコード化してなる前記2次元配列を参照して、
比較対象文字について該比較対象文字種別の該当フラグ
によりコード値を前記2次元配列の前記文字種別に対応
する添字に格納されたコードと比較することにより、文
字の検索を行う、処理をコンピュータ上で行うプログラ
ムを記録した記録媒体。3. A corresponding condition character type code is stored at the head of a column direction subscript of a two-dimensional array in which a condition type is a subscript in the row direction and a character type is a subscript in the column direction. With reference to the two-dimensional array, which is sequentially coded by the corresponding flag of the character type,
A character search is performed by comparing a code value of a character to be compared with a code stored in a subscript corresponding to the character type of the two-dimensional array by a corresponding flag of the character type to be compared. A recording medium on which a program to be executed is recorded.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
JP09209932A JP3129248B2 (en) | 1997-07-18 | 1997-07-18 | Character string search method using two-dimensional array code |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
JP09209932A JP3129248B2 (en) | 1997-07-18 | 1997-07-18 | Character string search method using two-dimensional array code |
Publications (2)
Publication Number | Publication Date |
---|---|
JPH1139344A true JPH1139344A (en) | 1999-02-12 |
JP3129248B2 JP3129248B2 (en) | 2001-01-29 |
Family
ID=16581052
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
JP09209932A Expired - Lifetime JP3129248B2 (en) | 1997-07-18 | 1997-07-18 | Character string search method using two-dimensional array code |
Country Status (1)
Country | Link |
---|---|
JP (1) | JP3129248B2 (en) |
Cited By (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JP2012234343A (en) * | 2011-04-28 | 2012-11-29 | Fujitsu Ltd | Similar character code group search supporting method, similar candidate extracting method, similar candidate extracting program, and similar candidate extracting apparatus |
CN102810088A (en) * | 2011-06-03 | 2012-12-05 | 银河联动信息技术(北京)有限公司 | Method for checking composite text code |
Families Citing this family (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JPH0891390A (en) * | 1994-09-26 | 1996-04-09 | Hanano Yamato:Kk | Handbag type packaging container |
US9043676B2 (en) * | 2010-12-28 | 2015-05-26 | International Business Machines Corporation | Parity error recovery method for string search CAM |
-
1997
- 1997-07-18 JP JP09209932A patent/JP3129248B2/en not_active Expired - Lifetime
Cited By (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JP2012234343A (en) * | 2011-04-28 | 2012-11-29 | Fujitsu Ltd | Similar character code group search supporting method, similar candidate extracting method, similar candidate extracting program, and similar candidate extracting apparatus |
US9442901B2 (en) | 2011-04-28 | 2016-09-13 | Fujitsu Limited | Resembling character data search supporting method, resembling candidate extracting method, and resembling candidate extracting apparatus |
CN102810088A (en) * | 2011-06-03 | 2012-12-05 | 银河联动信息技术(北京)有限公司 | Method for checking composite text code |
CN102810088B (en) * | 2011-06-03 | 2016-09-28 | 银河联动信息技术(北京)有限公司 | Compound document code check method |
Also Published As
Publication number | Publication date |
---|---|
JP3129248B2 (en) | 2001-01-29 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US4785400A (en) | Method for processing a data base | |
US6678687B2 (en) | Method for creating an index and method for searching an index | |
US5953723A (en) | System and method for compressing inverted index files in document search/retrieval system | |
US4064489A (en) | Apparatus for searching compressed data file | |
US5870756A (en) | Interchangeable storage medium containing program for processing data files thereupon to match a data file format to a computer system | |
CN1254424A (en) | Memory access protection | |
KR0147355B1 (en) | Graphics images data compression method | |
JP3129248B2 (en) | Character string search method using two-dimensional array code | |
JP2693914B2 (en) | Search system | |
US20010032073A1 (en) | Coding and storage of phonetical characteristics of strings | |
US6237002B1 (en) | Method for processing computerized date data which spans centuries | |
JP5041003B2 (en) | Search device and search method | |
JPH06215044A (en) | Information retrieval processor | |
JPS62287350A (en) | Index integrally updating system | |
JP2722684B2 (en) | File system search device | |
JPS6143338A (en) | How to search sparse databases using associative techniques | |
JP3456481B2 (en) | Information processing device | |
JP3722231B2 (en) | Product with a set of strings encoded and stored compactly | |
JP2827658B2 (en) | Figure analysis device and figure search device | |
CN119128042A (en) | AI large model Tensor indexing and storage method, system and application based on dictionary tree | |
JPH08272814A (en) | Character string retrieval device | |
JP2926803B2 (en) | Sorting method | |
EP0635796B1 (en) | Compactly encoded stored string set and its use | |
JPH04348469A (en) | String search device and method | |
JPH02206829A (en) | Method for sorting record group |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
A02 | Decision of refusal |
Free format text: JAPANESE INTERMEDIATE CODE: A02 Effective date: 20000620 |
|
A01 | Written decision to grant a patent or to grant a registration (utility model) |
Free format text: JAPANESE INTERMEDIATE CODE: A01 Effective date: 20001017 |
|
FPAY | Renewal fee payment (event date is renewal date of database) |
Free format text: PAYMENT UNTIL: 20071117 Year of fee payment: 7 |
|
FPAY | Renewal fee payment (event date is renewal date of database) |
Free format text: PAYMENT UNTIL: 20081117 Year of fee payment: 8 |
|
FPAY | Renewal fee payment (event date is renewal date of database) |
Free format text: PAYMENT UNTIL: 20081117 Year of fee payment: 8 |
|
FPAY | Renewal fee payment (event date is renewal date of database) |
Free format text: PAYMENT UNTIL: 20091117 Year of fee payment: 9 |
|
FPAY | Renewal fee payment (event date is renewal date of database) |
Free format text: PAYMENT UNTIL: 20091117 Year of fee payment: 9 |
|
FPAY | Renewal fee payment (event date is renewal date of database) |
Free format text: PAYMENT UNTIL: 20101117 Year of fee payment: 10 |
|
FPAY | Renewal fee payment (event date is renewal date of database) |
Free format text: PAYMENT UNTIL: 20111117 Year of fee payment: 11 |
|
FPAY | Renewal fee payment (event date is renewal date of database) |
Free format text: PAYMENT UNTIL: 20111117 Year of fee payment: 11 |
|
FPAY | Renewal fee payment (event date is renewal date of database) |
Free format text: PAYMENT UNTIL: 20121117 Year of fee payment: 12 |
|
FPAY | Renewal fee payment (event date is renewal date of database) |
Free format text: PAYMENT UNTIL: 20121117 Year of fee payment: 12 |
|
FPAY | Renewal fee payment (event date is renewal date of database) |
Free format text: PAYMENT UNTIL: 20131117 Year of fee payment: 13 |
|
EXPY | Cancellation because of completion of term |