JP2835065B2 - String search method - Google Patents

String search method

Info

Publication number
JP2835065B2
JP2835065B2 JP1053689A JP5368989A JP2835065B2 JP 2835065 B2 JP2835065 B2 JP 2835065B2 JP 1053689 A JP1053689 A JP 1053689A JP 5368989 A JP5368989 A JP 5368989A JP 2835065 B2 JP2835065 B2 JP 2835065B2
Authority
JP
Japan
Prior art keywords
character string
search
searched
string
code
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Expired - Fee Related
Application number
JP1053689A
Other languages
Japanese (ja)
Other versions
JPH02234271A (en
Inventor
克昭 清水
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
SOKIA KK
Original Assignee
SOKIA KK
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 SOKIA KK filed Critical SOKIA KK
Priority to JP1053689A priority Critical patent/JP2835065B2/en
Publication of JPH02234271A publication Critical patent/JPH02234271A/en
Application granted granted Critical
Publication of JP2835065B2 publication Critical patent/JP2835065B2/en
Anticipated expiration legal-status Critical
Expired - Fee Related legal-status Critical Current

Links

Description

【発明の詳細な説明】 [産業上の利用分野] 本発明はコンピュータやワードプロセッサなどのデー
タ処理装置における文字列データの操作方法に係わり、
特にある文字列が含まれているか否か検索する方法に関
する。
The present invention relates to a method of operating character string data in a data processing device such as a computer or a word processor.
In particular, the present invention relates to a method for searching for a certain character string.

[従来の技術] 従来の検索方法は単純に検索文字列と被検索文字列を
1文字毎に比較して一致を検出していた。第5図にもと
づいて従来の技術を説明すると被検索文字列1があっ
て、この中に検索文字列2が含まれているか否かを判別
するには、検索文字列2(例えばX,Y,B)を被検索文字
列1の(A,B,C)の区間で各々対応する文字毎の一致が
調べられ不一致と判断されると次の区間である(B,C,
D)において同じように操作が行なわれる。このように
して被検索文字列1の区間(C,D,E)、(D,E,A)……と
言う具合に先頭から順に比較して、合致するか否かを判
断して検索を行なっている。
[Related Art] In a conventional search method, a search character string and a search target character string are simply compared for each character to detect a match. The prior art will be described with reference to FIG. 5. To determine whether or not a character string 1 to be searched is included in the character string 1 to be searched, a search character string 2 (for example, X, Y , B) in the section of (A, B, C) of the character string 1 to be searched for, and if it is determined that they do not match, the next section is (B, C, C).
The same operation is performed in D). In this way, the sections (C, D, E), (D, E, A),... Of the searched character string 1 are compared in order from the beginning, and whether or not they match is determined. I do.

[発明が解決しようとする課題] 従来技術で述べたような方法では被検索文字列1が膨
大な文字数からなり、特に検索文字列2が被検索文字列
1の最後の方に存在する場合には、一致、不一致の結論
を出すための検索時間は長くなり、高速度のデータ処理
ができないという問題点があった。
[Problems to be Solved by the Invention] According to the method described in the related art, the searched character string 1 is composed of a huge number of characters, and particularly when the searched character string 2 is located at the end of the searched character string 1. However, there is a problem that a search time for obtaining a conclusion of a match or a mismatch becomes long, and high-speed data processing cannot be performed.

本発明は操作が簡単でしかも短い時間で文字検索を行
なうことにより、日本文を編集するシステムや文書管理
システムの情報検索を高速度で行なうことのできる方法
を提供することを目的としている。
SUMMARY OF THE INVENTION It is an object of the present invention to provide a method capable of performing a character search in a short time with a simple operation, thereby enabling a high-speed information search of a system for editing Japanese sentences and a document management system.

[課題を解決するための手段] 上記目的を達成するために、本発明の文字列検索方法
においては検索文字列を構成する各文字のみからなる文
字列であって、被検索文字列と同じ文字数からなる文字
列(これを検索用文字列という)をつくり、この検索用
文字列のそれぞれを前記被検索文字列との論理和列をつ
くり、これら隣接論理和列を順に一文字相当ずつずらし
たものの論理和を求め、この結果から検索文字列の有
無、個数、位置を求めるようにしたものである。
[Means for Solving the Problems] In order to achieve the above object, in the character string search method of the present invention, a character string consisting of only the characters constituting the search character string, and having the same number of characters as the character string to be searched (This is referred to as a search character string), and each of the search character strings is formed into a logical OR sequence with the searched character string, and these adjacent logical OR sequences are sequentially shifted by one character. The logical sum is obtained, and the presence / absence, number, and position of the search character string are obtained from the result.

[作用] 上記のように構成された文字列検索方法は被検索文字
列とは異なり、検索文字列を構成する文字数に相当する
検索用文字列をつくり、被検索文字列とこの検索用文字
列との論理演算により処理するものであるが、検索用文
字列の数は被検索用文字列の構成文字数より遥かに少な
いので、被検索文字列の構成文字数だけ1回当りのアク
セス回数および時間を必要とする従来方法に比べて、ア
クセス回数および時間は少なくて済む。特に被検索文字
列が長ければ長い程、または複数存在する場合に、アク
セス回数および時間の差が大きく現われてくる。
[Operation] The character string search method configured as described above is different from the character string to be searched, and forms a search character string corresponding to the number of characters constituting the search character string, and the character string to be searched and this search character string However, since the number of search character strings is far less than the number of characters constituting the search target character string, the number of accesses and time per access is reduced by the number of characters constituting the search target character string. The number of accesses and the time can be reduced as compared with the required conventional method. In particular, the longer the search target character string or the case where a plurality of character strings are present, the greater the difference between the number of accesses and the time.

[実施例] 一実施例について図面を参照して説明すると、被検索
文字列と検索文字列の構成は第1図において、被検索文
字列11、検索文字列12で示したようになっている。ま
ず、第2図に示すように、検索文字列12を構成する各文
字X、Y、Z毎に被検索文字列11の有効文字数すなわ
ち、本実施例では16文字文の検索用文字列群13を作成す
る。そしてこの検索用文字列13の各々と被検索文字列11
とを論理演算(AND)処理し、第3図に示すようなコー
ド列群14(14a、14b、14c)を求める。次にこのコード
列群14の隣接コード列14a〜14cを順次1コードずつシフ
トさせる。すなわち、コード列14aを基準として、コー
ド列14bを先頭側に1コード分、コード列14cを先頭側に
2コード分それぞれずらして第4図に示されるように配
列する。このようにしてシフトされて配列された各コー
ド列14a〜14cを論理演算(AND)処理し、第4図の符号1
5で示されるようなコード列が最終的に得られる。
[Embodiment] An embodiment will be described with reference to the drawings. The structure of a character string to be searched and a search character string are as shown by a character string 11 to be searched and a character string 12 to be searched in FIG. . First, as shown in FIG. 2, the number of valid characters of the searched character string 11 for each of the characters X, Y, and Z constituting the search character string 12, that is, in this embodiment, the search character string group 13 of the 16-character sentence Create Then, each of the search character strings 13 and the search target character string 11
Are subjected to a logical operation (AND) to obtain a code string group 14 (14a, 14b, 14c) as shown in FIG. Next, the adjacent code strings 14a to 14c of the code string group 14 are sequentially shifted one code at a time. That is, with reference to the code sequence 14a, the code sequence 14b is shifted by one code toward the head and the code sequence 14c is shifted by two codes toward the head, and are arranged as shown in FIG. The code sequences 14a to 14c thus shifted and arranged are subjected to a logical operation (AND) process, and are denoted by reference numeral 1 in FIG.
The code sequence as shown by 5 is finally obtained.

そこで、このコード列15が0以外のコードである1を
含んでいるか否かを見る、本実施例のように含んでいる
場合には、検索文字列12が含まれていることがわかる。
また、このコード列15において、0以外のコード1の数
をカウントすることにより、含まれている検索文字列12
の数を知ることができる。さらにこのコード列15におい
て、0以外のコード1の位置から検索文字列12の位置が
わかる。すなわち、コード1が先頭からn番目に位置し
ている場合、(本実施例では第4図に示したように7番
目および15番目に位置している)には、nから検索文字
列12の構成文字数Nより1だけ少ない数を減算した位置
(第4図では、N=3だから、N−1=2だけ減算した
位置ということになる)、つまりn−(N−1)の位置
となる。したがって第4図では、7−(3−1)=5、
15−(3−1)=13の文字位置から検索文字列12がそれ
ぞれ始まっている。
Then, it is checked whether or not this code string 15 includes a code 1 other than 0. When the code string 15 includes the code string as in the present embodiment, it is understood that the search character string 12 is included.
Also, by counting the number of codes 1 other than 0 in this code string 15, the search string 12
You can know the number of. Further, in the code string 15, the position of the search character string 12 can be known from the position of the code 1 other than 0. That is, when the code 1 is located at the nth position from the beginning (in this embodiment, at the 7th and 15th positions as shown in FIG. 4), the search character string 12 A position obtained by subtracting one less than the number N of constituent characters (in FIG. 4, since N = 3, it is a position obtained by subtracting N-1 = 2), that is, a position of n- (N-1). . Therefore, in FIG. 4, 7− (3-1) = 5,
The search character string 12 starts from the character position of 15− (3-1) = 13.

[発明の効果] 本発明は、以上説明したように構成された方法である
ので、検索用文字列を作るための時間はかかるが、被検
索文字列が長い場合、または複数存在する場合にはCPU
へのアクセス時間に比べて僅かな時間であり、それだけ
検索時間が短縮される。また検索ための操作も検索用文
字列の作成と論理演算のための操作のみでよく、操作回
数も少なくすることが可能である。
[Effect of the Invention] Since the present invention is a method configured as described above, it takes time to create a search character string, but when the search target character string is long or when there are a plurality of search character strings, CPU
This is a short time compared to the access time to the URL, and the search time is shortened accordingly. In addition, the search operation only needs to be performed for the creation of the search character string and the logical operation, and the number of operations can be reduced.

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

第1図は本発明の検索文字列と被検索文字列の説明図、
第2図は検索文字列を検索用文字列群とする説明図、第
3図は検索用文字列群の各々と被検索文字列とを論理演
算処理してコード列群とする説明図、第4図はシフト配
列したコード列を論理演算処理し最終コード列とする説
明図、第5図は従来技術を説明するための図である。 11……被検索文字列、12……検索文字列、13……検索用
文字列、14……コード列群、15……コード列。
FIG. 1 is an explanatory diagram of a search character string and a search target character string according to the present invention;
FIG. 2 is an explanatory diagram showing a search character string as a search character string group, and FIG. 3 is an explanatory diagram showing a logical operation process of each of the search character string groups and a searched character string to form a code string group. FIG. 4 is an explanatory diagram of a logically processed code sequence that is shifted and arranged as a final code sequence, and FIG. 5 is a diagram for explaining the prior art. 11: Searched character string, 12: Search character string, 13: Search character string, 14: Code string group, 15: Code string

Claims (1)

(57)【特許請求の範囲】(57) [Claims] 【請求項1】被検索文字列の中に検索文字列が含まれて
いるか否かを検索する文字列検索方法に関し、検索文字
列を構成する各文字について、前記被検索文字列と同文
字数の検索用文字列をつくり、この検索用文字列のそれ
ぞれと前記被検索文字列との論理和列をつくり、これら
論理和列を順に一文字相当ずつずらしたものの論理和を
求め、この結果から検索文字列の有無、個数、位置を求
めることを特徴とする文字列検索方法。
1. A character string search method for searching whether a character string to be searched for includes a character string to be searched, wherein each character constituting the character string to be searched has the same number of characters as the character string to be searched. A search character string is formed, a logical OR sequence of each of the search character strings and the search target character string is formed, and a logical OR of the logical OR sequence sequentially shifted by one character is obtained. A character string search method characterized by determining the presence, number, and position of columns.
JP1053689A 1989-03-08 1989-03-08 String search method Expired - Fee Related JP2835065B2 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP1053689A JP2835065B2 (en) 1989-03-08 1989-03-08 String search method

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP1053689A JP2835065B2 (en) 1989-03-08 1989-03-08 String search method

Publications (2)

Publication Number Publication Date
JPH02234271A JPH02234271A (en) 1990-09-17
JP2835065B2 true JP2835065B2 (en) 1998-12-14

Family

ID=12949783

Family Applications (1)

Application Number Title Priority Date Filing Date
JP1053689A Expired - Fee Related JP2835065B2 (en) 1989-03-08 1989-03-08 String search method

Country Status (1)

Country Link
JP (1) JP2835065B2 (en)

Also Published As

Publication number Publication date
JPH02234271A (en) 1990-09-17

Similar Documents

Publication Publication Date Title
JP3672242B2 (en) PATTERN SEARCH METHOD, PATTERN SEARCH DEVICE, COMPUTER PROGRAM, AND STORAGE MEDIUM
KR940003700B1 (en) Method and apparatus for search
JP4114600B2 (en) Variable length character string search device, variable length character string search method and program
CN102867049A (en) Chinese PINYIN quick word segmentation method based on word search tree
JP2693914B2 (en) Search system
JP2835065B2 (en) String search method
JPH05101102A (en) Retrieval device
JPS617936A (en) Information retrieving system
JPH10162013A (en) Digital searching device
JP3115459B2 (en) Method of constructing and retrieving character recognition dictionary
JP6050165B2 (en) Full-text search device
JP2868127B2 (en) Blank reading device in lexical analysis
JP2772125B2 (en) Dictionary search method
JPH06274701A (en) Word collating device
JP2837494B2 (en) Source program search processor
JPH0612550B2 (en) Data retrieval method
JP3018579B2 (en) Name search processor
JPH03296164A (en) Text editor
JPH04315259A (en) Character string collation processing system
JPS63282835A (en) Information retrieving system
JPH0452967A (en) And operation processing system for set file
JPS62285189A (en) Character recognition post processing system
JPH04315260A (en) Character string collating system
JPH1185776A (en) Information processor, information processing method and storage medium
JPH01199263A (en) Key word extracting device

Legal Events

Date Code Title Description
LAPS Cancellation because of no payment of annual fees