JP5771971B2 - Information processing apparatus, information processing method, and computer program - Google Patents
Information processing apparatus, information processing method, and computer program Download PDFInfo
- Publication number
- JP5771971B2 JP5771971B2 JP2010278634A JP2010278634A JP5771971B2 JP 5771971 B2 JP5771971 B2 JP 5771971B2 JP 2010278634 A JP2010278634 A JP 2010278634A JP 2010278634 A JP2010278634 A JP 2010278634A JP 5771971 B2 JP5771971 B2 JP 5771971B2
- Authority
- JP
- Japan
- Prior art keywords
- node
- array
- character
- keyword
- search
- 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
Links
- 230000010365 information processing Effects 0.000 title claims description 16
- 238000004590 computer program Methods 0.000 title claims description 6
- 238000003672 processing method Methods 0.000 title claims description 4
- 238000000034 method Methods 0.000 claims description 99
- 230000008569 process Effects 0.000 claims description 75
- 230000007704 transition Effects 0.000 claims description 35
- 230000006870 function Effects 0.000 description 14
- 238000010276 construction Methods 0.000 description 8
- 238000004364 calculation method Methods 0.000 description 6
- 238000006243 chemical reaction Methods 0.000 description 5
- 238000004891 communication Methods 0.000 description 5
- 206010048669 Terminal state Diseases 0.000 description 2
- 238000003491 array Methods 0.000 description 2
- 230000008859 change Effects 0.000 description 2
- 230000000694 effects Effects 0.000 description 2
- 238000005192 partition Methods 0.000 description 2
- KNMAVSAGTYIFJF-UHFFFAOYSA-N 1-[2-[(2-hydroxy-3-phenoxypropyl)amino]ethylamino]-3-phenoxypropan-2-ol;dihydrochloride Chemical compound Cl.Cl.C=1C=CC=CC=1OCC(O)CNCCNCC(O)COC1=CC=CC=C1 KNMAVSAGTYIFJF-UHFFFAOYSA-N 0.000 description 1
- 235000001630 Pyrus pyrifolia var culta Nutrition 0.000 description 1
- 240000002609 Pyrus pyrifolia var. culta Species 0.000 description 1
- 238000010586 diagram Methods 0.000 description 1
- 239000004973 liquid crystal related substance Substances 0.000 description 1
- 238000004519 manufacturing process Methods 0.000 description 1
- 230000004048 modification Effects 0.000 description 1
- 238000012986 modification Methods 0.000 description 1
- 238000010845 search algorithm Methods 0.000 description 1
- 230000003068 static effect Effects 0.000 description 1
Images
Landscapes
- Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
Description
本発明は、複数の文字列をデータ構造に効率良く格納し、当該データ構造へ文字列を追加して格納し、当該データ構造から文字列を検索するのに好適な技術に関する。 The present invention relates to a technique suitable for efficiently storing a plurality of character strings in a data structure, adding a character string to the data structure, storing the character string, and retrieving the character string from the data structure.
従来から、複数の文字列の集合に指定された文字列が存在するか否かを高速に判定するためのデータ構造として、トライ(trie)構造を用いた手法が提案されている。 Conventionally, a method using a trie structure has been proposed as a data structure for quickly determining whether or not a designated character string exists in a set of a plurality of character strings.
トライ構造は、複数の文字列集合における共通接頭辞を状態遷移構造として表現することで、重複した記憶領域を削減し、且つ検索処理における無駄な処理も削減する。 The trie structure expresses a common prefix in a plurality of character string sets as a state transition structure, thereby reducing duplicate storage areas and reducing unnecessary processing in search processing.
このトライ構造を効率的に実装し且つ高速に検索する方法として、ダブル配列法が開示されている(非特許文献1)。ダブル配列法は2つの整数型配列(以下、BASE配列及びCHECK配列)にトライ構造を効率的に格納し、トライ構造上における状態遷移を、BASE配列上の加算演算とCHECK配列上の比較演算で実現する非常に高速な検索手法を開示している。さらに接尾辞部分について、状態遷移の分岐が発生しない状態遷移を1つの文字列型配列(以下、TAIL配列)に集約して格納することで、状態遷移を表すBASE配列とCHECK配列の記憶領域を削減し且つ検索速度の向上を図っている。 A double array method is disclosed as a method for efficiently mounting this trie structure and performing a high-speed search (Non-Patent Document 1). In the double array method, the trie structure is efficiently stored in two integer type arrays (hereinafter referred to as the BASE array and the CHECK array), and the state transition on the trie structure is performed by an addition operation on the BASE array and a comparison operation on the CHECK array. A very fast search technique is disclosed. Furthermore, for the suffix part, state transitions that do not cause branching of state transitions are aggregated and stored in one character string type array (hereinafter referred to as TAIL array), so that the storage areas of the BASE array and the CHECK array representing the state transition are stored. To improve the search speed.
また、非特許文献2では前記ダブル配列法を改良し、よりコンパクトなダブル配列構造を実装する方法が開示されている。具体的には、前述したTAIL配列について、後方一致する共通接尾辞を併合することで、TAIL配列のさらなる圧縮を行っている。
Non-Patent
このようにダブル配列法は、トライ構造上の状態遷移において、分岐の発生しない部分をTAIL配列として実装することで、空間領域の削減と検索速度の向上を図っている。 As described above, in the double array method, a portion where no branch occurs in the state transition on the tri structure is mounted as a TAIL array, thereby reducing the space area and improving the search speed.
一方、トライ構造の空間効率を重視した実装方法として、簡潔木法が開示されている(非特許文献3)。簡潔木法はトライ構造上で幅優先探索を行い、トライ構造をビット列に変換する。このビット列構造とトライ構造上の状態遷移を表す文字集合を合わせて格納することで、非常にコンパクトなトライ構造の実装が実現できる。 On the other hand, a concise tree method is disclosed as a mounting method that places importance on the space efficiency of the trie structure (Non-Patent Document 3). The concise tree method performs a breadth-first search on the trie structure and converts the trie structure into a bit string. By storing the bit string structure and the character set representing the state transition on the trie structure together, a very compact trie structure can be implemented.
しかしながら、簡潔木法は、常にビット列構造を先頭からカウントする関数を用いて状態遷移を行う。具体的には、先頭からのビット1の数を返すrank1関数、及び先頭からn番目の0ビットの位置を返すselect0関数を利用する。これらの状態遷移関数は算出コストが高く、特にselect0関数は非常に算出コストが高い。従って、前述したビット列構造に対して、任意の大きさの区画ごとに当該ビット数を予め算出した索引を併用する実装が一般的である。
However, the simple tree method always performs state transition using a function that counts the bit string structure from the top. Specifically, a rank 1 function that returns the number of
ダブル配列法は、非常に高速な検索手法が特徴であるが、元になる文字列集合の大きさに対して、同等もしくは大きなサイズのデータ構造になる。また、簡潔木法は元になる文字列集合の大きさに対して、非常にコンパクトなデータ構造になるが、ビット列の探索において検索手法が高速にならない。 The double array method is characterized by a very high-speed search method. However, the double array method has a data structure having the same or larger size than the size of the original character string set. In addition, the concise tree method has a very compact data structure with respect to the size of the original character string set, but the search method is not accelerated in the search for bit strings.
本発明は上記の課題を解決するためになされたものであり、指定された文字列を用いて、データ構造として登録された文字列を検索する処理の効率化を図る技術を提供することを目的とする。 The present invention has been made to solve the above-described problem, and an object of the present invention is to provide a technique for improving the efficiency of processing for searching a character string registered as a data structure using a specified character string. And
上記した目的を達成するために、本発明の情報処理装置は、検索対象となる複数の第1のキーワードをデータとしてダブル配列へ登録する登録手段と、前記登録手段で登録されたダブル配列のデータを用いて幅優先探索を行うための簡潔木構造に登録するためのデータを作成する作成手段と、前記作成手段によって作成したデータを備えた簡潔木構造を記憶する記憶手段と、前記複数の第1のキーワードを検索するための検索キーワードである第2のキーワードの入力を受け付ける受付手段と、前記受付手段で受け付けた第2のキーワードが前記複数の第1のキーワードに含まれるか、を前記記憶手段によって記憶された前記簡潔木構造を用いて検索する検索手段と、を備え、前記作成手段は、前記ダブル配列のトライ構造を構成するノードに対するTAIL配列へのリンクを前記簡潔木構造のノードに対する前記TAIL配列へのリンクとしてデータを作成し、前記検索手段は、前記受付手段で受け付けた第2のキーワードの最初の文字を読み込み、前記簡潔木構造のルートノードを第1のノードに設定し、該第1のノードの子ノードに前記読み込んだ文字を示す子ノードがあるかを判定し、前記読み込んだ文字を示す子ノードがあると判定した場合には、当該子ノードを第1のノードに設定し、前記第2のキーワードの次の1文字を読み込み、変更後の第1のノードに該読み込んだ1文字を示す子ノードが存在するかを判定する処理を繰り返し、前記読み込んだ文字を示す子ノードがないと判定した場合には、前記子ノードから前記TAIL配列へのリンクを参照することで前記TAIL配列に遷移し、前記TAIL配列に残りの文字列が登録されているかを判定することにより、前記第2のキーワードが前記複数の第1のキーワードに含まれるかを検索することを備えることを特徴とする。 In order to achieve the above-described object, an information processing apparatus according to the present invention includes a registration unit that registers a plurality of first keywords to be searched as data in a double array, and a double-array data registered by the registration unit. Creating means for creating data to be registered in a concise tree structure for performing breadth-first search, storage means for storing a concise tree structure comprising data created by the creating means, and the plurality of first Receiving means for receiving an input of a second keyword which is a search keyword for searching for the keyword, and whether the second keyword received by the receiving means is included in the plurality of first keywords. Search means for searching using the concise tree structure stored by the node, wherein the creation means comprises nodes constituting the double array trie structure. The data is generated by using the link to the TAIL array as the link to the TAIL array for the node of the concise tree structure, and the search means reads the first character of the second keyword accepted by the accepting means, and The root node of the tree structure is set as the first node, it is determined whether there is a child node indicating the read character in the child node of the first node, and it is determined that there is a child node indicating the read character In this case, the child node is set as the first node, the next character after the second keyword is read, and the child node indicating the read one character exists in the changed first node. If it is determined that there is no child node indicating the read character, the previous node is referred to by referring to the link from the child node to the TAIL array. It transitions to TAIL sequence by determining whether the rest of the string is registered in the TAIL sequence that comprises searching whether the second keyword is included in the plurality of first keywords Features.
上記した目的を達成するために、本発明の情報処理方法は、データの検索処理を行う情報処理装置によって行われる情報処理方法であって、前記情報処理装置は、検索対象となる複数の第1のキーワードをデータとしてダブル配列へ登録する登録工程と、前記登録工程で登録されたダブル配列のデータを用いて幅優先探索を行うための簡潔木構造に登録するためのデータを作成する作成工程と、前記作成工程によって作成したデータを備えた簡潔木構造を記憶する記憶工程と、前記複数の第1のキーワードを検索するための検索キーワードである第2のキーワードの入力を受け付ける受付工程と、前記受付工程で受け付けた第2のキーワードが前記複数の第1のキーワードに含まれるか、を前記記憶工程によって記憶された前記簡潔木構造を用いて検索する検索工程と、を実行し、前記作成工程は、前記ダブル配列のトライ構造を構成するノードに対するTAIL配列へのリンクを前記簡潔木構造のノードに対する前記TAIL配列へのリンクとしてデータを作成し、前記検索工程は、前記受付手段で受け付けた第2のキーワードの最初の文字を読み込み、前記簡潔木構造のルートノードを第1のノードに設定し、該第1のノードの子ノードに前記読み込んだ文字を示す子ノードがあるかを判定し、前記読み込んだ文字を示す子ノードがあると判定した場合には、当該子ノードを第1のノードに設定し、前記第2のキーワードの次の1文字を読み込み、変更後の第1のノードに該読み込んだ1文字を示す子ノードが存在するかを判定する処理を繰り返し、前記読み込んだ文字を示す子ノードがないと判定した場合には、前記子ノードから前記TAIL配列へのリンクを参照することで前記TAIL配列に遷移し、前記TAIL配列に残りの文字列が登録されているかを判定することにより、前記第2のキーワードが前記複数の第1のキーワードに含まれるかを検索することを実行することを特徴とする。 In order to achieve the above object, an information processing method of the present invention is an information processing method performed by an information processing apparatus that performs data search processing, and the information processing apparatus includes a plurality of first information to be searched . A registration step of registering the keyword in the double array as data, and a creation step of creating data for registering in a simple tree structure for performing a breadth-first search using the double array data registered in the registration step; A storage step for storing a concise tree structure including data created by the creation step, a reception step for receiving input of a second keyword that is a search keyword for searching the plurality of first keywords, and the reception Whether the second keyword received in the step is included in the plurality of first keywords is the simple tree structure stored in the storage step. And a search step for searching, and the creation step creates data as a link to the TAIL array for the node constituting the tri-structure of the double array as a link to the TAIL array for the node of the concise tree structure The search step reads the first character of the second keyword accepted by the accepting means, sets the root node of the concise tree structure as the first node, and sets the child node of the first node as the child node. It is determined whether or not there is a child node indicating the read character. If it is determined that there is a child node indicating the read character, the child node is set as the first node, and the next keyword after the second keyword. The process of determining whether there is a child node indicating the read one character in the first node after the change is repeated to indicate the read character When it is determined that there is no node, the transition to the TAIL array is made by referring to the link from the child node to the TAIL array, and it is determined whether the remaining character string is registered in the TAIL array. , Searching whether the second keyword is included in the plurality of first keywords .
上記した目的を達成するために、本発明のコンピュータプログラムは、データの検索処理を行う情報処理装置において読取り実行可能なコンピュータプログラムであって、前記情報処理装置を、検索対象となる複数の第1のキーワードをデータとしてダブル配列へ登録する登録手段と、前記登録手段で登録されたダブル配列のデータを用いて幅優先探索を行うための簡潔木構造に登録するためのデータを作成する作成手段と、前記作成手段によって作成したデータを備えた簡潔木構造を記憶する記憶手段と、前記複数の第1のキーワードを検索するための検索キーワードである第2のキーワードの入力を受け付ける受付手段と、前記受付手段で受け付けた第2のキーワードが前記複数の第1のキーワードに含まれるか、を前記記憶手段によって記憶された前記簡潔木構造を用いて検索する検索手段と、して機能させ、前記作成手段は、前記ダブル配列のトライ構造を構成するノードに対するTAIL配列へのリンクを前記簡潔木構造のノードに対する前記TAIL配列へのリンクとしてデータを作成し、前記検索手段は、前記受付手段で受け付けた第2のキーワードの最初の文字を読み込み、前記簡潔木構造のルートノードを第1のノードに設定し、該第1のノードの子ノードに前記読み込んだ文字を示す子ノードがあるかを判定し、前記読み込んだ文字を示す子ノードがあると判定した場合には、当該子ノードを第1のノードに設定し、前記第2のキーワードの次の1文字を読み込み、変更後の第1のノードに該読み込んだ1文字を示す子ノードが存在するかを判定する処理を繰り返し、前記読み込んだ文字を示す子ノードがないと判定した場合には、前記子ノードから前記TAIL配列へのリンクを参照することで前記TAIL配列に遷移し、前記TAIL配列に残りの文字列が登録されているかを判定することにより、前記第2のキーワードが前記複数の第1のキーワードに含まれるかを検索することとして機能させるためのコンピュータプログラムである。 In order to achieve the above object, a computer program of the present invention is a computer program that can be read and executed by an information processing apparatus that performs data search processing, and the information processing apparatus is a plurality of first targets to be searched . Registering means for registering the keywords in the double array as data, creating means for creating data for registering in a concise tree structure for performing breadth-first search using the double array data registered by the registering means, Storage means for storing a concise tree structure having data created by the creating means, accepting means for accepting input of a second keyword which is a search keyword for retrieving the plurality of first keywords, and accepting the accepting Whether the second keyword received by the means is included in the plurality of first keywords is determined by the storage means. And a search means for searching using the stored simple tree structure, wherein the creating means sets a link to the TAIL array for the nodes constituting the double array trie structure for the nodes of the simple tree structure. Creating data as a link to the TAIL array, the search means reads the first character of the second keyword accepted by the acceptance means, sets the root node of the concise tree structure as the first node, It is determined whether there is a child node indicating the read character in the child node of the first node, and if it is determined that there is a child node indicating the read character, the child node is set as the first node. Setting, reading the next one character of the second keyword, and determining whether there is a child node indicating the read one character in the first node after the change. If it is determined that there is no child node indicating the read character, the transition to the TAIL array is made by referring to the link from the child node to the TAIL array, and the remaining character strings are stored in the TAIL array. It is a computer program for functioning as a search to determine whether the second keyword is included in the plurality of first keywords by determining whether the second keyword is registered .
本発明によれば、巨大な文字列集合を単体の計算機上で実現可能なサイズまでコンパクトに実装した辞書構造ファイルを実行できるシステムを提供でき、さらには、組み込み機器のような限られたリソースを持つ環境では、辞書をよりコンパクトに実装し且つ実用的に検索できる、等の効果を奏する。 According to the present invention, it is possible to provide a system capable of executing a dictionary structure file in which a large set of character strings is compactly implemented to a size that can be realized on a single computer, and further, limited resources such as embedded devices can be provided. In an environment that has a dictionary, it is possible to implement a dictionary more compactly and search practically.
以下、図面を参照して本発明の実施の形態の一例について説明する。 Hereinafter, an example of an embodiment of the present invention will be described with reference to the drawings.
図1は、本発明の実施形態における文字列登録検索装置の構成を示す図である。 FIG. 1 is a diagram showing a configuration of a character string registration / retrieval apparatus according to an embodiment of the present invention.
文字列登録検索装置100は、ダブル配列構築部102と、簡潔木構築部103と、簡潔木データ104と、検索結果表示部105と、簡潔木検索部106とを備える。尚、簡潔木データ104は後述する外部メモリ211等の記憶装置に記憶されている。
The character string registration /
ダブル配列構築部102は、キーワード集合101を入力としてダブル配列を構築する。構築されたダブル配列は簡潔木構築部103に送られて、簡潔木データ104を生成する。簡潔木検索部106は、検索キーワード107を入力として簡潔木データ104を検索し、検索結果を検索結果表示部105に表示する。これら一連のデータ登録処理及びデータ検索処理については、詳しく後述する。
The double
次に、図1の文字列登録検索装置100のハードウェア構成について、図2を用いて説明する。
Next, the hardware configuration of the character string registration /
図中、CPU201は、システムバス204に接続される後述の各デバイスやコントローラを統括的に制御する。また、ROM203あるいは外部メモリ211には、CPU201の制御プログラムであるBIOS(Basic Input / Output System)やオペレーティングシステムプログラム(以下、OS)や、文字列登録検索装置100に後述する各種の処理を実行させるために必要な各種プログラムやデータ等が記憶されている。RAM202は、CPU201の主メモリ、ワークエリア等として機能する。
In the figure, a
CPU201は、処理の実行に際して必要なプログラム等をRAM202にロードして、プログラムを実行することで後述する各種処理を実現するものである。また、入力コントローラ(入力C)205は、キーボードやポインティングデバイス等で構成される入力装置209からの入力を制御する。ビデオコントローラ(VC)206は、ディスプレイ装置210等の表示装置への表示を制御する。ディスプレイ装置210は、例えばCRTディスプレイや液晶ディスプレイ等で構成される。
The
メモリコントローラ(MC)207は、ブートプログラム、ブラウザソフトウエア、各種のアプリケーション、フォントデータ、ユーザファイル、編集ファイル、各種データ等を記憶するハードディスク(HD)やフロッピーディスク(登録商標 FD)或いはPCMCIAカードスロットにアダプタを介して接続されるコンパクトフラッシュメモリ等の外部メモリ211へのアクセスを制御する。
A memory controller (MC) 207 is a hard disk (HD), floppy disk (registered trademark FD) or PCMCIA card slot for storing boot programs, browser software, various applications, font data, user files, editing files, various data, and the like. Controls access to an
通信I/Fコントローラ(通信I/FC)208は、ネットワークを介して、外部機器と接続・通信するものであり、ネットワークでの通信制御処理を実行する。例えば、TCP/IPを用いたインターネット通信等が可能である。 A communication I / F controller (communication I / FC) 208 is connected to and communicates with an external device via a network, and executes communication control processing in the network. For example, Internet communication using TCP / IP is possible.
なお、CPU201は、例えばRAM202内の表示情報用領域へアウトラインフォントの展開(ラスタライズ)処理を実行することにより、ディスプレイ装置210上での表示を可能としている。また、CPU201は、ディスプレイ装置210上の不図示のマウスカーソル等でのユーザ指示を可能とする。以上が、文字列登録検索装置100のハードウェア構成の説明であるが、後述する各種の処理を実行可能であれば、必ずしも図2に記載のハードウェア構成を有していなくとも構わないことは言うまでもない。
Note that the
次に、文字列登録検索装置100における文字列登録処理について、図3から図9を用いて、詳しく説明する。
Next, the character string registration process in the character string registration /
図3は、文字列登録処理の全体フローチャートを示す図である。文字列登録処理では、CPU201は、キーワード集合101を読み込み、ダブル配列構造を構築してから簡潔木データ構造を作成する処理を行う。この文字列登録処理は、CPU201をダブル配列構築部102、簡潔木構築部103として機能させるためのプログラムによる制御に従って行われる処理である。文字列登録処理の説明の前に、この処理で扱うキーワード集合の一例を、図7を参照して説明する。
FIG. 3 is an overall flowchart of the character string registration process. In the character string registration process, the
図7は、キーワード集合101の一例である。キーワード701は、文字列「山形県」に対して数値「10」が定義されている。同様に、キーワード702は文字列「山梨県」に対して数値「20」が定義され、キーワード703は文字列「大阪府大阪市」に数値「30」が定義されている。キーワード704から706についても同様である。前記数値は、例えばID番号を示すものである、等であり、キーワード集合を利用するソフトウェア上において意味を持つ数値である(以下、OUTPUT値とする)。
FIG. 7 is an example of the
図3に戻って、ステップS301において、CPU201は、図7に示すキーワード集合を1行ずつ読み込む。このとき、行情報は所定の書式に従って文字列とOUTPUT値に分解され、ステップS302において、ダブル配列に追加される。本実施形態におけるダブル配列は、文字列による検索処理が成功すると、OUTPUT値が返される。
Returning to FIG. 3, in step S301, the
続いて、ステップS303において、CPU201は、すべてのキーワード集合について登録処理が完了したかどうかを判定し、未処理情報があると判定した場合には処理をステップS301に進める。すべてのキーワードをダブル配列へ登録完了したと判定した場合(ステップS303で「YES」の場合)は、ステップS304に進み、TAIL併合処理を実施する。
Subsequently, in step S303, the
TAIL併合処理は、非特許文献2で開示されている共通接尾辞を併合したTAIL配列のデータ構造について、ダブル配列への追加処理(ステップS302)の際に発生するTAIL配列内の未使用領域を削減しつつ当該データ構造を作成する処理を示す。この処理の詳細は図4を参照して説明する。
In the TAIL merge processing, an unused area in the TAIL sequence that is generated when the data structure of the TAIL sequence merged with the common suffix disclosed in
ここで、図4を参照して、図3のステップS304のTAIL併合処理の詳細について説明する。図4はTAIL併合処理の詳細を示すフローチャートである。TAIL併合処理では、TAIL配列内の未使用領域を回収するために、BASE配列からTAIL配列へのリンクが定義されているものを探索する。 Here, the details of the TAIL merging process in step S304 in FIG. 3 will be described with reference to FIG. FIG. 4 is a flowchart showing details of the TAIL merging process. In the TAIL merging process, in order to collect unused areas in the TAIL sequence, a search is made for those in which a link from the BASE sequence to the TAIL sequence is defined.
CPU201は、ステップS401で、当該リンクを登録するためのリストを初期化し、続くステップS402からBASE配列の探索を開始する。具体的には、BASE配列の値が負数になっているものがTAIL配列へのリンクを表現しており、その絶対値がTAIL配列の添字である。従って、有効なBASE配列の中から負値を持つものについて、そのリンク先となるTAIL配列に登録されたTAIL文字列を取得し(ステップS403)、取得したTAIL文字列を反転させた反転TAIL文字列とリンク元となるBASE配列の添字をセットにして前記リストに追加する(ステップS404)。
In step S401, the
すべてのTAIL文字列を追加した後、続くステップS405において、反転TAIL文字列をキーとして、前記リストを逆順ソートする。即ち、前記リストを順に辿ることで、反転TAIL文字列を逆辞書順に取得することができる。 After all the TAIL character strings have been added, in the subsequent step S405, the list is sorted in reverse order using the inverted TAIL character string as a key. That is, the inverted TAIL character string can be acquired in reverse dictionary order by tracing the list in order.
続くステップS406で、CPU201は新しくTAIL配列を格納する領域(以下、併合TAIL配列)を確保し、ステップS407で前記リストから先頭要素を取得する。続くステップS408で、ステップS406で確保した併合TAIL配列に、反転していない元の正TAIL文字列を登録する。元の正TAIL文字列は、反転TAIL文字列を反転させて得ることもできるし、ステップS404において、別要素にセットして前記リストに追加してもよい。続くステップS409で、BASE配列の更新を行う。前記反転TAIL文字列とセットで追加したBASE配列の添字を参照することで、当該BASE配列の値を併合TAIL配列への添字の負数に更新し、BASE配列から併合TAIL配列へのリンクを更新する。
In the subsequent step S406, the
具体例をあげて説明する。BASE[26]=−12であるとき、TAIL[12]から正TAIL文字列「ABC」が取得できたとする。このとき、ステップS404で前記リストに登録するセットは、(26、「CBA」)である。また、併合TAIL配列に登録した先がTAIL[1]の場合、ステップS409で、BASE[26]=−1に更新する。 A specific example will be described. When BASE [26] = − 12, it is assumed that the normal TAIL character string “ABC” can be acquired from TAIL [12]. At this time, the set to be registered in the list in step S404 is (26, “CBA”). Also, if the destination registered in the merged TAIL array is TAIL [1], it is updated to BASE [26] = − 1 in step S409.
その後、CPU201はステップS410で、BASE配列をすべて探索したかを判定し、すべての探索が終了したと判定した場合すれば(ステップS410で「YES」の場合)、TAIL併合処理を終了する。探索が終了していないと判定した場合には(ステップS410で「NO」の場合)、ステップS411に進める。
Thereafter, in step S410, the
CPU201は、ステップS411において、前記リストから次の要素セットを取得し、続くステップS412で、取得したセットの反転TAIL文字列と、前記ステップS407で取得したセットの反転TAIL文字列を比較する。このとき、ステップS411で取得した反転TAIL文字列がステップS407で取得した反転TAIL文字列に含まれていると判定した場合(共通接頭辞になっている場合、即ち、ステップS412で「YES」の場合)、ステップS409に戻り、BASE配列の更新のみを実施する。ステップS412で「NO」の場合、ステップS408に戻り、併合TAIL配列に正TAIL文字列に登録して、続くステップS409でBASE配列の更新を実施する。
In step S411, the
前述の具体例で説明する。先頭要素の反転TAIL文字列「CBA」である場合に、次要素のセットが(7、「CB」)である場合、ステップS412において、共通接頭辞であると判断し(「YES」の場合)、BASE[7]=−2とする。即ち、TAIL[1]で正TAIL文字列「ABC」を得ることができ、TAIL[2]で正TAIL文字列「BC」を得ることができる。また、次要素のセットが(7、「DA」)である場合は、ステップS412において「NO」となり、TAIL[5]=ADを登録し(ステップS408)、BASE[7]=−5となる(ステップS409)。 This will be described with reference to the above specific example. If it is the inverted TAIL character string “CBA” of the first element and the set of the next element is (7, “CB”), it is determined in step S412 that it is a common prefix (in the case of “YES”) , BASE [7] = − 2. That is, TAIL [1] can obtain a positive TAIL character string “ABC”, and TAIL [2] can obtain a positive TAIL character string “BC”. If the next element set is (7, “DA”), “NO” in step S412, TAIL [5] = AD is registered (step S408), and BASE [7] = − 5. (Step S409).
このように、前記リストに追加したすべての要素セットについて、BASE配列の更新処理と併合TAIL配列への登録処理を実施することで、非特許文献2で開示されているデータ構造を得ることができる。以上が、TAIL併合処理の詳細な説明である。
In this way, the data structure disclosed in
図8に、図7で示したキーワード集合700を入力にした、併合TAIL配列を用いたダブル配列構造の一例を示す。ダブル配列構造は、BASE配列部801、CHECK配列部802、併合TAIL配列部803、OUTPUT部(索引部804及び値部805)で構成される。変換表806は、ダブル配列構造に登録される文字列に対して、文字を数値に置き換えたものである。通常は文字コードを使用するが、本発明では以降の説明の簡略化のために、便宜的に定義した。
FIG. 8 shows an example of a double array structure using the merged TAIL array with the keyword set 700 shown in FIG. 7 as an input. The double array structure includes a
OUTPUT索引部804は、BASE配列部801において併合TAIL配列部803へのリンクが定義されているものについて1を定義し、その他は0となるビット列で表現される。即ち、当該OUTPUT値を得るためには、OUTPUT索引部804においてrank1関数を用いればよい。例えば、BASE[4]=−1であることから、BASE[4]はTAIL[1]へのリンクを意味している。このとき、OUTPUT索引部804において、BASE配列の添字4を引数にしてrank1(4)を求めると2であることから、OUTPUT[2]を参照し、OUTPUT値「20」を得る(図7におけるキーワード702の検索結果を意味する)。
The
図3の説明に戻る。CPU201は、TAIL併合処理(ステップS304)が終了すると、処理をステップS305に進め、前記併合TAIL配列を用いたダブル配列構造を入力として、簡潔木生成処理を実施する。この処理の詳細は図5を参照して説明する。
Returning to the description of FIG. When the TAIL merging process (step S304) ends, the
ここで、図5を参照して、図3のステップS305の簡潔木生成処理の詳細について説明する。図5は、簡潔木生成処理の詳細を示すフローチャートである。簡潔木生成処理では、ダブル配列構造を幅優先探索方式で辿ることにより簡潔木を生成する。 Here, with reference to FIG. 5, the details of the concise tree generation process in step S305 of FIG. 3 will be described. FIG. 5 is a flowchart showing details of the concise tree generation process. In the succinct tree generation process, a succinct tree is generated by tracing a double array structure using a breadth-first search method.
まずCPU201は、ステップS501で簡潔木構造における先頭ビット列「10」を追加する。そして、続くステップS502において、状態キューを初期化する。前記状態キューはダブル配列構造において幅優先探索を実現するために使用される。
First, in step S501, the
ステップS503では、状態sを1に初期化し、ステップS504で遷移可能集合追加処理を実施する。遷移可能集合追加処理では、状態sから遷移可能な文字を探索し、前記状態キューに追加する処理を実施する。この遷移可能集合追加処理の詳細については、図6を参照して説明することにする。 In step S503, the state s is initialized to 1, and a transitionable set addition process is performed in step S504. In the transitionable set addition process, a process for searching for a transitionable character from the state s and adding it to the state queue is performed. Details of this transitionable set addition processing will be described with reference to FIG.
ここで、図6を参照して、図5のステップS504(及びステップS511)の遷移可能集合追加処理の詳細について説明する。図6は遷移可能集合追加処理の詳細を示すフローチャートである。 Here, with reference to FIG. 6, the details of the transitionable set addition processing in step S504 (and step S511) in FIG. 5 will be described. FIG. 6 is a flowchart showing details of the transitionable set addition processing.
まずCPU201はステップS601で、遷移可能な文字を保持するためのリストを初期化する。続くステップS602からステップS603において、状態sから遷移可能なすべての文字を探索する。前述したように、ダブル配列構造はCHECK配列の値が遷移元の状態番号を示すことが開示されているため、有効な文字集合の範囲内で、CHECK配列の値がBASE配列添字になるものを探索すればよい。
First, in step S601, the
具体的には、例えば、有効な文字集合をアルファベット26文字とし且つAを1、Bを2・・・Zを26、と定義した場合において、BASE[1]=2のとき、BASE[1]+1からBASE[1]+26の範囲、即ち、CHECK[3]からCHECK[28]の範囲において、CHECK[s]=1であるsを満たす文字を探索する。 Specifically, for example, when a valid character set is 26 alphabets and A is defined as 1, B is defined as 2 ... Z is defined as 26, and BASE [1] = 2, BASE [1] In the range from +1 to BASE [1] +26, that is, in the range from CHECK [3] to CHECK [28], a character satisfying s where CHECK [s] = 1 is searched.
その後、CPU201はステップS604において、前記条件を満たす文字Ciを前記リストに追加する。
Thereafter, in step S604, the
続くステップS605以降の処理において、前記リストに追加されたすべての文字Ciについて、図5のステップS502で初期化した前記状態キューに追加する。 In subsequent processing in step S605, all the characters Ci added to the list are added to the state queue initialized in step S502 of FIG.
ここで、BASE[s]が正値の場合(ステップS606で「YES」の場合)、ダブル配列構造において分岐を持った遷移状態を意味しているので、ステップS607に進み、遷移先の状態番号を示すBASE[s]+Ciとペアにして、状態(BASE[s]+Ci、Ci)を前記状態キューに追加する。BASE[s]が正値でない場合(ステップS606で「NO」の場合)、BASE[s]はTAIL配列へのリンク、或いは後述する終端状態を示しているので、ステップS608に進み、状態(BASE[s]、Ci)を前記状態キューに追加する。 Here, if BASE [s] is a positive value (“YES” in step S606), this means a transition state having a branch in the double array structure, so the process proceeds to step S607, and the state number of the transition destination The state (BASE [s] + Ci, Ci) is added to the state queue. If BASE [s] is not a positive value (in the case of “NO” in step S606), since BASE [s] indicates a link to the TAIL array or a termination state described later, the process proceeds to step S608 and the state (BASE [S], Ci) is added to the state queue.
以上の遷移可能集合追加処理によって、状態sから遷移可能なすべての文字が遷移先の状態番号と共に、前記状態キューに追加されたことになる。続くステップS609において、状態sからの遷移探索が完了したことを意味する終端状態(0、0)を前記状態キューに追加する。以上が、遷移可能集合追加処理の詳細な説明である。 Through the above-described transitionable set addition process, all characters that can be transitioned from the state s are added to the state queue together with the state number of the transition destination. In the subsequent step S609, a terminal state (0, 0) indicating that the transition search from the state s is completed is added to the state queue. The above is the detailed description of the transitionable set addition process.
図5の説明に戻る。ステップS504の遷移可能集合追加処理終了後、CPU201は、ステップS505において、前記状態キューが空かどうかを判定する。空でないと判定した場合(ステップS505で「NO」の場合)、処理をステップS506に進め、前記状態キューから状態(s、c)をひとつ取得する。
Returning to the description of FIG. After completion of the transitionable set addition process in step S504, the
続くステップS507の判定処理において、CPU201が状態sを正値であると判定した場合(ステップS507で「YES」の場合)、ステップS508に進む。ここでBASE[s]が正数の場合(ステップS508で「NO」の場合)、ステップS506で取得した状態sは分岐を持った遷移状態であるので、ステップS511に進み、前述した遷移可能集合追加処理を再帰的に実施して、ステップS512に進む。このように前記状態キューを使用することで、ダブル配列構造において幅優先探索を実現している。
If the
また、ステップS508で「YES」とCPU201が判定した場合、即ち、BASE[s]が負数の場合は前記併合TAIL配列へのリンクを示す状態であるため、ステップS509に進み、新たに併合TAIL配列へのリンクを作成する。簡潔木構造では、状態sに対応するビット番号に対して併合TAIL配列へのリンクを設定する必要がある。従って、前述した図8におけるOUTPUT索引部804とOUTPUT値部805のように、rank1関数を用いた索引部とリンク部の構造を持つように併合TAIL配列へのリンクを設定する。当該リンク構造の詳細については、後述する。
If the
ステップS509の処理終了後、処理をステップS510に進め、状態sから分岐できる遷移は存在しないため(併合TAIL配列への分岐なし状態遷移のみ存在する)、前記状態キューに終端状態(0、0)を追加し、ステップS512に進む。 After the process of step S509 is completed, the process proceeds to step S510, and there is no transition that can branch from the state s (there is only a state transition without branching to the merged TAIL array). And proceeds to step S512.
ステップS507の判定処理で戻って「NO」と判定した場合、即ち、状態sが正値でない場合には、処理をステップS512に進める。 If it is determined as “NO” in the determination process in step S507, that is, if the state s is not a positive value, the process proceeds to step S512.
ステップS512では、ステップS506で取得した文字cをエッジ文字として簡潔木に登録する。文字cが0でない場合は、簡潔木のビット列に1を追加して、文字cをエッジ文字列に追加する。文字cが0の場合は(終端状態)、簡潔木のビット列に0を追加する。 In step S512, the character c acquired in step S506 is registered as an edge character in the concise tree. If the character c is not 0, 1 is added to the bit string of the concise tree, and the character c is added to the edge character string. If the character c is 0 (terminal state), 0 is added to the bit string of the concise tree.
ステップS512での文字cの登録処理が終了すると、処理をステップS505に進め、前記状態キューが空になるまで、前述した処理を繰り返す。 When the registration process of the character c in step S512 is completed, the process proceeds to step S505, and the above-described process is repeated until the state queue becomes empty.
前記状態キューが空になった場合(ステップS505で「YES」の場合)、ステップS513に進み、索引生成処理を実施する。索引生成処理は、ビット列におけるrank1関数やselect0関数の算出コストを削減するために、任意の大きさの区画ごとに当該ビット数を予め算出した索引を生成する処理である。 If the status queue is empty (in the case of “YES” in step S505), the process proceeds to step S513, and index generation processing is performed. The index generation process is a process of generating an index in which the number of bits is calculated in advance for each arbitrarily sized partition in order to reduce the calculation cost of the rank 1 function and the select 0 function in the bit string.
以上の処理により、ダブル配列構造において幅優先探索を実施し、簡潔木構造への変換が実現される。 Through the above processing, a breadth-first search is performed in the double array structure, and conversion to a simple tree structure is realized.
図9に、図8に示したダブル配列構造から生成した簡潔木構造を一例として示す。簡潔木構造は、トライ構造を表すビット配列901とエッジ文字列902、併合TAIL配列へのリンクを示すTAILビット配列903とTAILリンク配列904、OUTPUT値を保持するOUTPUT配列905、及び併合TAIL配列906から構成される。併合TAIL配列906は、図8における前記併合TAIL配列803と同等のものである。また、エッジ文字列902及び併合TAIL配列906内に保持されている文字は、図8の前記変換表806を用いて数値に置き換えている。
FIG. 9 shows a simple tree structure generated from the double array structure shown in FIG. 8 as an example. The concise tree structure includes a
ビット配列901及びTAILビット配列903はビット列で表現される。従って、前述したように、これらのデータにはrank1関数やselect0関数の算出コストを削減するための索引情報が付与されることになる。
The
図10に、前期簡潔木構造の検索方法のフローチャートを示す。なお、図9を合わせて用いることで、具体的に検索方法を説明する。 FIG. 10 shows a flowchart of the search method for the simple tree structure in the previous period. The search method will be specifically described with reference to FIG.
まず、CPU201は、ステップS1001で検索キーワードから文字cを取得する。文字cが取得できた場合(ステップS1002で「YES」の場合)、ステップS1003に進み、簡潔木構造における最初の子ノードを探索する。最初の子ノードの探索は、次の関数として非特許文献3に開示されている。
First, the
first-child (n) = select0(rank1(n))+1 first-child (n) = select 0 (rank 1 (n)) + 1
図9を用いて具体的に説明する。検索開始位置はビット配列901の1番目であり、rank1(1)=1である。従って、select0(1)=2となり、first-child (1)=3であるから、最初の子ノード番号が3とわかる。ここでビット配列901の3番目を見ると1であるため、子ノードが存在することがわかる。0や領域外の場合は、子ノードは存在しない。
This will be specifically described with reference to FIG. The search start position is the
続くステップS1004で、子ノードが存在するかどうかを確認する。子ノードが存在する場合(ステップS1004で「YES」の場合)、ステップS1005に進む。ステップS1005で当該子ノードに対応したエッジ文字を取得する。エッジ文字は図9におけるエッジ文字列902に登録されており、その算出式は以下のようになる。
In a succeeding step S1004, it is confirmed whether or not a child node exists. If there is a child node (“YES” in step S1004), the process proceeds to step S1005. In step S1005, an edge character corresponding to the child node is acquired. The edge character is registered in the
e = edge[rank1(n)−1] e = edge [rank 1 (n) -1]
図9の例で説明する。ビット配列901の3番目のエッジ文字は、rank1(3)=2であるため、edge[1]=1が選択される。文字コード「1」は、図8における変換表806において、文字「山」であることがわかる。従って、ビット配列901の3番目のエッジ文字は「山」となる。
This will be described with reference to the example of FIG. Since the third edge character of the
図10のステップS1005ではさらに、取得したエッジ文字eとステップS1001で取得した検索キーワードの文字cが一致するかを判定する。CPU201が一致したと判定した場合(ステップS1005で「YES」の場合)、状態遷移が成立したため、ステップS1001に戻り、検索キーワードにおける次の文字を取得し、その文字について、簡潔木構造上での状態遷移を確認する。
In step S1005 in FIG. 10, it is further determined whether the acquired edge character e matches the character c of the search keyword acquired in step S1001. If the
ステップS1005の判定処理で、取得したエッジ文字eとステップS1001で取得した検索キーワードの文字cが一致しないとCPU201が判定した場合(ステップS1005で「NO」の場合)、ステップS1006に進み、兄弟ノードの探索を実施する。簡潔木構造は幅優先探索を用いて作成されているため、兄弟ノードの探索は、当該ビット列において、隣接するビットが1であれば探索に成功する。図9のビット配列901の例では、子ノード番号3に隣接する子ノード番号4のビットが1であることから、子ノード番号4は子ノード番号3の兄弟ノードであるとわかる。
If the
ステップS1007で兄弟ノードが存在しないと判定した場合(ステップS1007で「NO」の場合)、当該検索キーワードを用いた簡潔木構造において、もはや状態遷移が成立し得ないため、検索失敗として簡潔木検索処理を終了する。 If it is determined in step S1007 that no sibling node exists (in the case of “NO” in step S1007), the state transition can no longer be established in the concise tree structure using the search keyword, and the concise tree search is determined as a search failure. The process ends.
一方、ステップS1007で、兄弟ノードが存在するとCPU201が判定した場合(ステップS1007で「YES」の場合)には、ステップS1005に戻り、当該ビット番号のエッジ文字と当該検索キーワードから取得した文字cとの比較を実施する。
On the other hand, if the
このように、当該検索キーワードを1文字ずつ簡潔木構造上で探索していくが、子ノードが存在しない場合(ステップS1004で「NO」の場合)、或いは、当該検索キーワードすべての文字を探索した場合(ステップS1002で「NO」の場合)、ステップS1008へ進む。 In this way, the search keyword is searched on the concise tree structure character by character, but when there is no child node (in the case of “NO” in step S1004), or all characters of the search keyword are searched. In the case ("NO" in step S1002), the process proceeds to step S1008.
ステップS1008以降では、ビット配列901上における状態遷移が終了し、遷移分岐のない併合TAIL配列906を用いた探索を実施する。ステップS1008において、併合TAIL配列906へのリンクを取得する。例えば、検索キーワードが「山形県」の場合、ビット配列901上を、1⇒3⇒6⇒13と遷移し bit[13]=0であることから、ビット番号6までの状態遷移が成立する。ここで、TAILビット配列903に対してrank1(6)を算出すると1であるので、TAILリンク配列904を参照して
併合TAIL配列906へのリンク値 tail_link [1] =1を得る。
In step S1008 and after, the state transition on the
続くステップS1009で、前記リンク値が取得できたかどうかを判定する。取得できなかったと判定した場合(ステップS1009で「NO」の場合)、併合TAIL配列へのリンクが存在しないため、検索失敗として簡潔木検索処理を終了する。取得できたと判定した場合(ステップS1009で「YES」の場合)は、ステップS1010に進む。 In a succeeding step S1009, it is determined whether or not the link value has been acquired. If it is determined that acquisition has failed (in the case of “NO” in step S1009), since there is no link to the merged TAIL array, the concise tree search process ends as a search failure. If it is determined that it has been acquired (in the case of “YES” in step S1009), the process proceeds to step S1010.
ステップS1010では、前記検索キーワードの未探索部分である接尾辞部と、併合TAIL配列906に格納された文字列が一致するかどうかを調べる。一致しなかった場合(ステップS1010で「NO」の場合)、前記検索キーワードが存在しないことから、検索失敗として簡潔木検索処理を終了する。
In step S1010, it is checked whether or not the suffix part, which is an unsearched part of the search keyword, matches the character string stored in the
前述の例では、検索キーワード「山形県」において、「山形」までがビット配列901上で確認されており、残りの接尾辞「県」が併合TAIL配列906との比較対象となる。前記TAILリンク配列904から得たリンク値が1であるため、併合TAIL配列906の1番目を先頭に文字列比較を実施する。Tail[1]=10であることから、変換表806を参照すると「県」であり、続くTail[2]=0で終端となる。従って、前記検索キーワードの接尾辞「県」と併合TAIL配列906に登録された文字列「県」が一致することがわかる。
In the above example, in the search keyword “Yamagata Prefecture”, up to “Yamagata” is confirmed on the
ステップS1010で「YES」と判定した場合、即ち、文字列比較が一致した場合はステップS1011に進む。ステップS1011では、OUTPUT値をOUTPUT配列905から取得する。取得する方法は、TAILリンク配列904と同様であり、TAILビット配列903を用いて取得する。
If “YES” is determined in the step S1010, that is, if the character string comparisons match, the process proceeds to a step S1011. In step S1011, the OUTPUT value is acquired from the
以上の処理をもって、検索キーワードの検索が成功し、簡潔木検索処理はOUTPUT値を返すことができる。 With the above processing, the search keyword search is successful, and the concise tree search processing can return an OUTPUT value.
以上説明したように、本実施形態によれば、ダブル配列構造を経由させて簡潔木構造を構築することによって、トライ構造をコンパクトに実装できる。また、簡潔木構造の検索において、その計算コストが大きいビット配列を使った状態遷移を最小限に留め、検索速度の向上に寄与している。 As described above, according to the present embodiment, the trie structure can be compactly implemented by constructing the simple tree structure via the double array structure. Further, in the search of a simple tree structure, state transition using a bit array having a high calculation cost is minimized, and the search speed is improved.
以上、実施形態例を詳述したが、本発明は、例えば、システム、装置、方法、プログラムもしくは記憶媒体等としての実施態様をとることが可能であり、具体的には、複数の機器から構成されるシステムに適用しても良いし、また、一つの機器からなる装置に適用しても良い。 Although the embodiments have been described in detail above, the present invention can take an embodiment as, for example, a system, an apparatus, a method, a program, or a storage medium, and specifically includes a plurality of devices. The present invention may be applied to a system that is configured, or may be applied to an apparatus that includes a single device.
なお、上述した各種データの構成及びその内容はこれに限定されるものではなく、用途や目的に応じて、様々な内容で構成されることは言うまでもない。 It should be noted that the configuration and contents of the various data described above are not limited to this, and it is needless to say that they are configured with various contents according to applications and purposes.
また、本発明は、システム或いは装置にプログラムを供給することにとって達成される場合にも適用できることは言うまでもない。この場合、本発明を達成するためのソフトウェアによって表されるプログラムを格納した記録媒体を該システム或いは装置に読み出すことによって、そのシステム或いは装置が、本発明の効果を享受することが可能となる。 Needless to say, the present invention can also be applied to a case where the present invention is achieved by supplying a program to a system or apparatus. In this case, by reading out a recording medium storing a program represented by software for achieving the present invention to the system or apparatus, the system or apparatus can enjoy the effects of the present invention.
さらに、本発明を達成するためのソフトウェアによって表されるプログラムをネットワーク上のサーバー、データーベース等から通信プログラムによりダウンロードして読み出すことによって、そのシステム或いは装置が、本発明の効果を享受することが可能となる。 Furthermore, by downloading and reading a program represented by software for achieving the present invention from a server, database, etc. on a network using a communication program, the system or apparatus can enjoy the effects of the present invention. It becomes possible.
なお、上述した各実施形態及びその変形例を組み合わせた構成もすべて本発明に含まれるものである。 In addition, all the structures which combined each embodiment mentioned above and its modification are also included in this invention.
100 文字列登録検索装置
101 キーワード集合
102 ダブル配列構築部
103 簡潔木構築部
104 簡潔木データ
105 検索結果表示部
106 簡潔木検索部
107 検索キーワード
201 CPU
202 RAM
203 ROM
204 システムバス
205 入力コントローラ
206 ビデオコントローラ
207 メモリコントローラ
208 通信I/F(インターフェース)コントローラ
209 キーボード
210 ディスプレイ装置
211 外部メモリ
DESCRIPTION OF
202 RAM
203 ROM
204
Claims (6)
前記登録手段で登録されたダブル配列のデータを用いて幅優先探索を行うための簡潔木構造に登録するためのデータを作成する作成手段と、
前記作成手段によって作成したデータを備えた簡潔木構造を記憶する記憶手段と、
前記複数の第1のキーワードを検索するための検索キーワードである第2のキーワードの入力を受け付ける受付手段と、
前記受付手段で受け付けた第2のキーワードが前記複数の第1のキーワードに含まれるか、を前記記憶手段によって記憶された前記簡潔木構造を用いて検索する検索手段と、
を備え、
前記作成手段は、前記ダブル配列のトライ構造を構成するノードに対するTAIL配列へのリンクを前記簡潔木構造のノードに対する前記TAIL配列へのリンクとしてデータを作成し、
前記検索手段は、前記受付手段で受け付けた第2のキーワードの最初の文字を読み込み、前記簡潔木構造のルートノードを第1のノードに設定し、該第1のノードの子ノードに前記読み込んだ文字を示す子ノードがあるかを判定し、
前記読み込んだ文字を示す子ノードがあると判定した場合には、当該子ノードを第1のノードに設定し、前記第2のキーワードの次の1文字を読み込み、変更後の第1のノードに該読み込んだ1文字を示す子ノードが存在するかを判定する処理を繰り返し、
前記読み込んだ文字を示す子ノードがないと判定した場合には、前記子ノードから前記TAIL配列へのリンクを参照することで前記TAIL配列に遷移し、前記TAIL配列に残りの文字列が登録されているかを判定することにより、前記第2のキーワードが前記複数の第1のキーワードに含まれるかを検索すること
を備えることを特徴とする情報処理装置。 Registration means for registering a plurality of first keywords to be searched as data in a double array;
Creating means for creating data for registration in a concise tree structure for performing breadth-first search using double array data registered by the registration means;
Storage means for storing a concise tree structure comprising data created by the creating means;
Receiving means for receiving an input of a second keyword that is a search keyword for searching for the plurality of first keywords;
Search means for searching whether the second keyword received by the receiving means is included in the plurality of first keywords using the simple tree structure stored by the storage means;
With
The creation means creates data as a link to the TAIL array for the node constituting the tri-structure of the double array as a link to the TAIL array for the node of the concise tree structure,
The search means reads the first character of the second keyword received by the reception means, sets the root node of the concise tree structure as the first node, and reads the read into the child node of the first node Determine if there is a child node indicating a character,
When it is determined that there is a child node indicating the read character, the child node is set as the first node, the next character after the second keyword is read, and the changed first node is set. Repeating the process of determining whether or not there is a child node indicating the read one character;
If it is determined that there is no child node indicating the read character, the transition to the TAIL array is made by referring to the link from the child node to the TAIL array, and the remaining character strings are registered in the TAIL array. And determining whether the second keyword is included in the plurality of first keywords by determining whether the second keyword is included.
前記情報処理装置は、
検索対象となる複数の第1のキーワードをデータとしてダブル配列へ登録する登録工程と、
前記登録工程で登録されたダブル配列のデータを用いて幅優先探索を行うための簡潔木構造に登録するためのデータを作成する作成工程と、
前記作成工程によって作成したデータを備えた簡潔木構造を記憶する記憶工程と、
前記複数の第1のキーワードを検索するための検索キーワードである第2のキーワードの入力を受け付ける受付工程と、
前記受付工程で受け付けた第2のキーワードが前記複数の第1のキーワードに含まれるか、を前記記憶工程によって記憶された前記簡潔木構造を用いて検索する検索工程と、
を実行し、
前記作成工程は、前記ダブル配列のトライ構造を構成するノードに対するTAIL配列へのリンクを前記簡潔木構造のノードに対する前記TAIL配列へのリンクとしてデータを作成し、
前記検索工程は、前記受付工程で受け付けた第2のキーワードの最初の文字を読み込み、前記簡潔木構造のルートノードを第1のノードに設定し、該第1のノードの子ノードに前記読み込んだ文字を示す子ノードがあるかを判定し、
前記読み込んだ文字を示す子ノードがあると判定した場合には、当該子ノードを第1のノードに設定し、前記第2のキーワードの次の1文字を読み込み、変更後の第1のノードに該読み込んだ1文字を示す子ノードが存在するかを判定する処理を繰り返し、
前記読み込んだ文字を示す子ノードがないと判定した場合には、前記子ノードから前記TAIL配列へのリンクを参照することで前記TAIL配列に遷移し、前記TAIL配列に残りの文字列が登録されているかを判定することにより、前記第2のキーワードが前記複数の第1のキーワードに含まれるかを検索すること
を実行することを特徴とする情報処理方法。 An information processing method performed by an information processing apparatus that performs data search processing,
The information processing apparatus includes:
A registration step of registering a plurality of first keywords to be searched as data in a double array;
A creation step of creating data for registering in a concise tree structure for performing a breadth-first search using double array data registered in the registration step;
A storage step of storing a concise tree structure comprising data created by the creation step;
An accepting step of receiving an input of a second keyword that is a search keyword for searching for the plurality of first keywords;
A search step for searching whether the second keyword received in the receiving step is included in the plurality of first keywords using the simple tree structure stored in the storage step;
Run
The creating step creates data as a link to a TAIL array for a node constituting the tri-structure of the double array as a link to the TAIL array for a node of the concise tree structure,
The search step reads the first character of the second keyword accepted in the acceptance step , sets the root node of the concise tree structure as the first node, and reads the child node of the first node Determine if there is a child node indicating a character,
When it is determined that there is a child node indicating the read character, the child node is set as the first node, the next character after the second keyword is read, and the changed first node is set. Repeating the process of determining whether or not there is a child node indicating the read one character;
If it is determined that there is no child node indicating the read character, the transition to the TAIL array is made by referring to the link from the child node to the TAIL array, and the remaining character strings are registered in the TAIL array. And determining whether or not the second keyword is included in the plurality of first keywords by determining whether the second keyword is included.
前記情報処理装置を、
検索対象となる複数の第1のキーワードをデータとしてダブル配列へ登録する登録手段と、
前記登録手段で登録されたダブル配列のデータを用いて幅優先探索を行うための簡潔木構造に登録するためのデータを作成する作成手段と、
前記作成手段によって作成したデータを備えた簡潔木構造を記憶する記憶手段と、
前記複数の第1のキーワードを検索するための検索キーワードである第2のキーワードの入力を受け付ける受付手段と、
前記受付手段で受け付けた第2のキーワードが前記複数の第1のキーワードに含まれるか、を前記記憶手段によって記憶された前記簡潔木構造を用いて検索する検索手段と、
して機能させ、
前記作成手段は、前記ダブル配列のトライ構造を構成するノードに対するTAIL配列へのリンクを前記簡潔木構造のノードに対する前記TAIL配列へのリンクとしてデータを作成し、
前記検索手段は、前記受付手段で受け付けた第2のキーワードの最初の文字を読み込み、前記簡潔木構造のルートノードを第1のノードに設定し、該第1のノードの子ノードに前記読み込んだ文字を示す子ノードがあるかを判定し、
前記読み込んだ文字を示す子ノードがあると判定した場合には、当該子ノードを第1のノードに設定し、前記第2のキーワードの次の1文字を読み込み、変更後の第1のノードに該読み込んだ1文字を示す子ノードが存在するかを判定する処理を繰り返し、
前記読み込んだ文字を示す子ノードがないと判定した場合には、前記子ノードから前記TAIL配列へのリンクを参照することで前記TAIL配列に遷移し、前記TAIL配列に残りの文字列が登録されているかを判定することにより、前記第2のキーワードが前記複数の第1のキーワードに含まれるかを検索すること
として機能させるためのコンピュータプログラム。 A computer program that can be read and executed in an information processing apparatus that performs data search processing,
The information processing apparatus;
Registration means for registering a plurality of first keywords to be searched as data in a double array;
Creating means for creating data for registration in a concise tree structure for performing breadth-first search using double array data registered by the registration means;
Storage means for storing a concise tree structure comprising data created by the creating means;
Receiving means for receiving an input of a second keyword that is a search keyword for searching for the plurality of first keywords;
Search means for searching whether the second keyword received by the receiving means is included in the plurality of first keywords using the simple tree structure stored by the storage means;
To function,
The creation means creates data as a link to the TAIL array for the node constituting the tri-structure of the double array as a link to the TAIL array for the node of the concise tree structure,
The search means reads the first character of the second keyword received by the reception means, sets the root node of the concise tree structure as the first node, and reads the read into the child node of the first node Determine if there is a child node indicating a character,
When it is determined that there is a child node indicating the read character, the child node is set as the first node, the next character after the second keyword is read, and the changed first node is set. Repeating the process of determining whether or not there is a child node indicating the read one character;
If it is determined that there is no child node indicating the read character, the transition to the TAIL array is made by referring to the link from the child node to the TAIL array, and the remaining character strings are registered in the TAIL array. A computer program for functioning as a search to determine whether the second keyword is included in the plurality of first keywords by determining whether the second keyword is included.
Priority Applications (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| JP2010278634A JP5771971B2 (en) | 2010-12-14 | 2010-12-14 | Information processing apparatus, information processing method, and computer program |
Applications Claiming Priority (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| JP2010278634A JP5771971B2 (en) | 2010-12-14 | 2010-12-14 | Information processing apparatus, information processing method, and computer program |
Publications (3)
| Publication Number | Publication Date |
|---|---|
| JP2012128603A JP2012128603A (en) | 2012-07-05 |
| JP2012128603A5 JP2012128603A5 (en) | 2014-05-22 |
| JP5771971B2 true JP5771971B2 (en) | 2015-09-02 |
Family
ID=46645564
Family Applications (1)
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| JP2010278634A Expired - Fee Related JP5771971B2 (en) | 2010-12-14 | 2010-12-14 | Information processing apparatus, information processing method, and computer program |
Country Status (1)
| Country | Link |
|---|---|
| JP (1) | JP5771971B2 (en) |
Families Citing this family (1)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| KR101881888B1 (en) * | 2017-03-28 | 2018-07-25 | 권요한 | Apparatus for registering and searching of contents using unique keyword |
Family Cites Families (2)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| JP2000029884A (en) * | 1998-07-09 | 2000-01-28 | Fujitsu Ltd | Character code registration search device and character code registration search method |
| JP5195149B2 (en) * | 2008-08-11 | 2013-05-08 | 富士通株式会社 | Authenticity judgment method |
-
2010
- 2010-12-14 JP JP2010278634A patent/JP5771971B2/en not_active Expired - Fee Related
Also Published As
| Publication number | Publication date |
|---|---|
| JP2012128603A (en) | 2012-07-05 |
Similar Documents
| Publication | Publication Date | Title |
|---|---|---|
| CN113760839B (en) | Log data compression processing method, device, electronic device and storage medium | |
| CN107590214B (en) | Recommendation method and device for search keywords and electronic equipment | |
| JP3672242B2 (en) | PATTERN SEARCH METHOD, PATTERN SEARCH DEVICE, COMPUTER PROGRAM, AND STORAGE MEDIUM | |
| CN103049709B (en) | Based on password recovery system and the restoration methods thereof of generator expansion rainbow table | |
| US20200183986A1 (en) | Method and system for document similarity analysis | |
| JP5437557B2 (en) | Search processing method and search system | |
| CN111095421B (en) | Context-aware incremental algorithm for genetic files | |
| JP6160259B2 (en) | Character string search method, character string search device, and character string search program | |
| CN115080039A (en) | Front-end code generation method, apparatus, computer equipment, storage medium and product | |
| CN113378091A (en) | Visual project generation method and device, electronic equipment and storage medium | |
| WO2023169215A1 (en) | Page display method and apparatus, storage medium and electronic device | |
| CN107038026A (en) | The automatic machine update method and system of a kind of increment type | |
| CN116569165A (en) | Page display method, device, storage medium and electronic equipment | |
| CN115455006A (en) | Data processing method, data processing device, electronic device and storage medium | |
| CN109492127A (en) | Data processing method, device, medium and calculating equipment | |
| JP2019534602A (en) | System level testing of entropy encoding | |
| US12056108B1 (en) | Systems and methods for generating and modifying a pattern for pattern matching utilizing a hierarchical structure that stores one or more values | |
| JP5771971B2 (en) | Information processing apparatus, information processing method, and computer program | |
| JP5194856B2 (en) | Efficient indexing using compact decision diagrams | |
| JP2011257877A (en) | Device and method for information retrieval, and program | |
| US20130067317A1 (en) | System and method for implementing intelligent java server faces (jsf) composite component generation | |
| Sanaullah et al. | RLBWT-Based LCP Computation in Compressed Space for Terabase-Scale Pangenome Analysis | |
| JP5736589B2 (en) | Sequence data search device, sequence data search method and program | |
| CN114443126A (en) | Multi-version image processing method, information pushing method and device and electronic equipment | |
| CN114443866B (en) | Data processing method, device, computing equipment and medium |
Legal Events
| Date | Code | Title | Description |
|---|---|---|---|
| RD03 | Notification of appointment of power of attorney |
Free format text: JAPANESE INTERMEDIATE CODE: A7423 Effective date: 20130531 |
|
| RD04 | Notification of resignation of power of attorney |
Free format text: JAPANESE INTERMEDIATE CODE: A7424 Effective date: 20130531 |
|
| A621 | Written request for application examination |
Free format text: JAPANESE INTERMEDIATE CODE: A621 Effective date: 20131210 |
|
| A521 | Request for written amendment filed |
Free format text: JAPANESE INTERMEDIATE CODE: A523 Effective date: 20140404 |
|
| A977 | Report on retrieval |
Free format text: JAPANESE INTERMEDIATE CODE: A971007 Effective date: 20140725 |
|
| A131 | Notification of reasons for refusal |
Free format text: JAPANESE INTERMEDIATE CODE: A131 Effective date: 20140819 |
|
| A131 | Notification of reasons for refusal |
Free format text: JAPANESE INTERMEDIATE CODE: A131 Effective date: 20150203 |
|
| A521 | Request for written amendment filed |
Free format text: JAPANESE INTERMEDIATE CODE: A523 Effective date: 20150330 |
|
| A711 | Notification of change in applicant |
Free format text: JAPANESE INTERMEDIATE CODE: A711 Effective date: 20150410 |
|
| TRDD | Decision of grant or rejection written | ||
| A01 | Written decision to grant a patent or to grant a registration (utility model) |
Free format text: JAPANESE INTERMEDIATE CODE: A01 Effective date: 20150602 |
|
| A61 | First payment of annual fees (during grant procedure) |
Free format text: JAPANESE INTERMEDIATE CODE: A61 Effective date: 20150615 |
|
| R150 | Certificate of patent or registration of utility model |
Ref document number: 5771971 Country of ref document: JP Free format text: JAPANESE INTERMEDIATE CODE: R150 |
|
| R250 | Receipt of annual fees |
Free format text: JAPANESE INTERMEDIATE CODE: R250 |
|
| R250 | Receipt of annual fees |
Free format text: JAPANESE INTERMEDIATE CODE: R250 |
|
| R250 | Receipt of annual fees |
Free format text: JAPANESE INTERMEDIATE CODE: R250 |
|
| S531 | Written request for registration of change of domicile |
Free format text: JAPANESE INTERMEDIATE CODE: R313531 |
|
| R350 | Written notification of registration of transfer |
Free format text: JAPANESE INTERMEDIATE CODE: R350 |
|
| R250 | Receipt of annual fees |
Free format text: JAPANESE INTERMEDIATE CODE: R250 |
|
| R250 | Receipt of annual fees |
Free format text: JAPANESE INTERMEDIATE CODE: R250 |
|
| R250 | Receipt of annual fees |
Free format text: JAPANESE INTERMEDIATE CODE: R250 |
|
| LAPS | Cancellation because of no payment of annual fees |