JP2008026963A - Retrieval processor and program - Google Patents
Retrieval processor and program Download PDFInfo
- Publication number
- JP2008026963A JP2008026963A JP2006195773A JP2006195773A JP2008026963A JP 2008026963 A JP2008026963 A JP 2008026963A JP 2006195773 A JP2006195773 A JP 2006195773A JP 2006195773 A JP2006195773 A JP 2006195773A JP 2008026963 A JP2008026963 A JP 2008026963A
- Authority
- JP
- Japan
- Prior art keywords
- phrase
- index
- character string
- phrase index
- storage means
- 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
Images
Landscapes
- Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
Abstract
Description
本発明は、複数の構造化文書が格納された文書データベースから索引を利用して検索条件に合致するデータを検索するのに好適な検索処理装置及びプログラムに関する。 The present invention relates to a search processing apparatus and a program suitable for searching data matching a search condition using an index from a document database in which a plurality of structured documents are stored.
従来から、複数の構造化文書が格納された文書データベースから検索条件に合致するデータを検索するのに索引を利用する検索処理装置が開発されている。このような検索処理装置のデータベースにテキストデータを含む文書を登録する場合、登録対象となるデータに索引付けをするのが一般的である。このような索引付けの手法としてN−グラム(N-gram)手法が知られている。N−グラム手法とは、例えば特許文献1に背景技術として記載されているように、文書に含まれる全ての文字をある固定の長さNの連続する文字列(N−グラム)として扱い、索引登録と検索を行う手法である。
2. Description of the Related Art Conventionally, a search processing apparatus that uses an index to search for data that matches a search condition from a document database that stores a plurality of structured documents has been developed. When a document including text data is registered in the database of such a search processing apparatus, it is common to index the data to be registered. An N-gram method is known as such an indexing method. The N-gram method is, for example, as described in
N−グラム手法における索引登録(N−グラム索引登録)は、次のように行われる。まず、データベースに登録される文書の文頭から機械的に1文字ずつずらしながら、長さNの文字列(N−グラム)が順に切り出される。この長さNの文字列(N−グラム)を便宜的に「語彙」と呼ぶ。但し、一般に良く知られている語彙と異なり、N−グラム手法で切り出される「語彙」には、意味を持たない「語彙」も存在する。1文字ずつずらして長さNの文字列を切り出すことにより、文書に含まれる全ての部分文字列を網羅して取り出すことができる。このようにして切り出される語彙の全てが索引登録の対象となる。次に、データベース内での文書の位置及び当該文書中での各語彙の出現位置を含む位置情報が、その語彙に対応付けて登録される。長さNには、言語や文字の種類によって適切な値が選ばれる。検索の際は、例えば検索条件として与えられた検索語句(文字列)が語彙に分割される。この語彙毎に索引(N−グラム索引)が検索される。これにより、語彙に一致する索引に対応付けて登録されている位置情報(文書位置−語彙出現位置)を得ることができる。
上述したようにN−グラム手法を適用する検索処理装置においては、索引登録及び検索のアルゴリズムが単純であるため、データベースに登録される文書に含まれている語句を抜けがなく完全に検索できるという利点がある。その一方、N−グラム手法を適用する検索処理装置は、辞書を利用した単語索引(語句索引)を持つ検索処理装置に比べて、語彙単位の索引の取り出し負荷が増えるために、検索処理に時間かかかるという問題がある。このような問題は、XML(Extensible Markup Language)形式の文書(XML文書)のような構造化文書(つまり階層型データ)が登録されたデータベースを持つ検索処理装置においても同様である。 As described above, in the search processing apparatus to which the N-gram method is applied, since the index registration and search algorithms are simple, it is possible to completely search the words and phrases included in the document registered in the database without omission. There are advantages. On the other hand, the search processing apparatus to which the N-gram method is applied is more time consuming for the search process because the load for extracting the lexical unit index is larger than the search processing apparatus having a word index (phrase index) using a dictionary. There is a problem that it takes. Such a problem also applies to a search processing apparatus having a database in which structured documents (that is, hierarchical data) such as XML (Extensible Markup Language) format documents (XML documents) are registered.
本発明は上記事情を考慮してなされたものでその目的は、検索によく利用される語句の索引を自動的に生成することにより検索処理を高速化できる検索処理装置及び及びプログラムを提供することにある。 The present invention has been made in consideration of the above circumstances, and an object of the present invention is to provide a search processing apparatus and program capable of speeding up the search processing by automatically generating an index of words frequently used for search. It is in.
本発明の1つの観点によれば、複数の構造化文書が格納された文書データベースから、与えられた検索式の示す検索条件に合致する構造化文書を検索する検索処理装置が提供される。この検索処理装置は、前記文書データベースに格納されている構造化文書の各々をN−グラムの部分文字列に分割することによって生成されるN−グラム索引であって、当該部分文字列の位置を示す位置情報と対応付けられたN−グラム索引を格納するN−グラム索引格納手段と、語句の位置を示す位置情報と対応付けられた語句索引を格納する語句索引格納手段と、前記検索式が文字列を指定する文字列関数を含む場合、当該文字列関数で指定される文字列を語句とする語句索引が前記語句索引格納手段に存在するかを判定する判定手段と、前記文字列関数で指定される文字列を語句とする語句索引が存在しない場合、前記N−グラム索引を利用して当該文字列の位置情報を取得する第1の位置取得手段と、前記文字列関数で指定される文字列を語句とする語句索引が存在しない場合、当該文字列を語句とする語句索引を生成し、当該生成された語句索引を前記第1の位置取得手段によって取得された位置情報と対応付けて前記語句索引格納手段に格納する語句索引生成手段と、前記文字列関数で指定される文字列を語句とする語句索引が存在する場合、当該語句索引を利用して当該文字列の位置情報を取得する第2の位置取得手段と、
前記検索式の示す検索条件に合致する、前記文字列関数で指定される文字列を含む構造化文書を、前記第1または第2の位置取得手段によって取得された位置情報に基づいて前記文書データベースから検索する文書検索手段とを具備する。
According to one aspect of the present invention, there is provided a search processing device for searching a structured document that matches a search condition indicated by a given search expression from a document database storing a plurality of structured documents. The search processing device is an N-gram index generated by dividing each structured document stored in the document database into N-gram partial character strings, and the position of the partial character string is determined. N-gram index storage means for storing an N-gram index associated with position information to be indicated, phrase index storage means for storing a phrase index associated with position information indicating the position of a phrase, and the search expression In the case of including a character string function that specifies a character string, a determination unit that determines whether or not a phrase index having the character string specified by the character string function as a phrase exists in the phrase index storage unit; and When there is no phrase index that uses the specified character string as a phrase, the first position acquisition unit that acquires position information of the character string using the N-gram index is specified by the character string function. Sentence If there is no phrase index having a word as a string, a phrase index having the character string as a phrase is generated, and the generated phrase index is associated with the position information acquired by the first position acquisition unit. When there is a phrase index generating unit to be stored in the phrase index storing unit and a phrase index having a character string specified by the character string function as a phrase, the position information of the character string is acquired using the phrase index. Second position acquisition means;
Based on the position information acquired by the first or second position acquisition unit, a structured document including a character string specified by the character string function that matches a search condition indicated by the search expression is stored in the document database. And a document search means for searching from.
本発明によれば、検索によく利用される語句の索引が自動的に生成されるため、検索式が文字列を指定する文字列関数を含み、且つ当該文字列を語句とする語句索引が存在する場合には、当該語句索引を利用することによって検索処理を高速化できる。 According to the present invention, since an index of words frequently used for search is automatically generated, there is a phrase index in which the search expression includes a character string function that specifies a character string and the character string is a word. In this case, the search process can be speeded up by using the phrase index.
以下、本発明の実施の形態につき図面を参照して説明する。
図1は本発明の一実施形態に係る検索処理装置を含むクライアント−サーバシステムのハードウェア構成を示すブロック図である。クライアント−サーバシステムは、主として、データベースサーバ(データベースサーバコンピュータ)10と、複数のクライアント端末とから構成される。複数のクライアント端末はクライアント端末20を含む。クライアント端末20上では、データベースサーバ10を利用するクライアントソフトウェアが動作する。クライアントソフトウェアは例えばブラウザである。クライアント端末20を含む複数のクライアント端末は、ローカルエリアネットワーク(LAN)のようなネットワーク30を介してデータベースサーバ10と接続されている。なお、図1にはクライアント端末20以外のクライアント端末は省略されている。
Embodiments of the present invention will be described below with reference to the drawings.
FIG. 1 is a block diagram showing a hardware configuration of a client-server system including a search processing apparatus according to an embodiment of the present invention. The client-server system mainly includes a database server (database server computer) 10 and a plurality of client terminals. The plurality of client terminals include a
データベースサーバ10は、主メモリのようなメモリ11を含む。データベースサーバ10は、ハードディスクドライブのような外部記憶装置40と接続されている。この外部記憶装置40は、データベースサーバ10による検索処理に用いられる検索処理プログラム41を格納する。データベースサーバ10及び外部記憶装置40は検索処理装置50を構成する。
The
図2は検索処理装置50の主として機能構成を示すブロック図である。検索処理装置50は、インタフェース51、解析部52、構造検索部53、完全一致型検索部54、部分一致型検索部55、文書検索部56及び結果生成部57を含む。本実施形態において、これらの各部51乃至57は、図1のデータベースサーバ10が外部記憶装置40に格納されている検索処理プログラム41をメモリ11に読み込んで実行することにより実現される。このプログラム41は、コンピュータ読み取り可能な記憶媒体に予め格納して頒布可能である。また、このプログラム41が、ネットワーク30を介してデータベースサーバ10にダウンロードされても構わない。
FIG. 2 is a block diagram mainly showing a functional configuration of the
検索処理装置50はまた、メモリ11及び外部記憶装置40を含む。外部記憶装置40は、図1に示される検索処理プログラム41に加えて、文書データベース(文書DB)42及び辞書ファイル43を格納する。文書DB42は、文書部421及び索引部422を含む。文書部421は複数の構造化文書(構造化文書データ)、例えばXML文書(XML文書データ)を格納する。索引部422は、文書DB42に格納されている全てのXML文書に含まれる語彙(N−グラム)毎に、その語彙の索引(N−グラム索引)を格納する。各N−グラム索引(N−グラム索引データ)は、対応する語彙に関する位置情報とリンクされている。この位置情報は、当該位置情報に対応する語彙を含む全てのXML文書の文書DB42内での位置(文書位置)と、当該XML文書において当該語彙が出現する全ての位置(語彙出現位置)とを表す。また索引部422は、文書DB42に格納されている全てのXML文書に含まれる文書構造毎に、当該文書構造の索引(構造索引)を格納する。各構造索引(構造索引データ)は、対応する構造を持つノードの位置を表す情報(位置情報)とリンクされている。
The
辞書ファイル43は、文書DB42に格納されているXML文書に含まれる文字列であって、後述する文字列関数で指定された文字列が語句として登録されるエントリ(語句エントリ)を有する。各語句エントリは、語句(語句を構成する文字列)と当該語句に関する位置情報とを対応付けて格納する。この位置情報は、当該位置情報と対応付けられている語句の文書DB42内での位置(文書位置−語句出現位置)を示す。各語句エントリに登録される語句は、上述のように文字列関数で指定された文字列であることから、索引部422に格納されるN−グラム索引の語彙とは異なる。
The
メモリ11は辞書テーブル110を格納する。図3は辞書テーブル110のデータ構造例を示す。辞書テーブル110は、辞書ファイル43と同様に、文書DB42に格納されているXML文書に含まれる文字列であって、文字列関数で指定された文字列が語句として登録されるエントリ(語句エントリ)を有する。
The
各語句エントリは、語句と参照回数と位置情報とを対応付けて格納する。参照回数は、当該参照回数と対応付けられている語句が参照される回数を示す。位置情報は、当該位置情報と対応付けられている語句の文書DB42内での位置(文書位置−語句出現位置)を示す。各語句エントリは、索引部422に格納されているN−グラム索引に対して、語句索引であるといえる。なお、語句と対応付けられている参照回数及び位置情報は、当該語句から辿ることができるならば、当該語句が格納されている語句エントリに必ずしも格納されている必要はない。
Each word / phrase entry stores a word / phrase, the number of references, and position information in association with each other. The number of times of reference indicates the number of times that a word or phrase associated with the number of times of reference is referred to. The position information indicates the position (document position−phrase appearance position) in the
辞書ファイル43及び辞書テーブル110に語句として格納される文字列は、クライアント端末からの構造化文書問い合わせで実際に使用された検索式で指定される文字列に限られる。本実施形態では、このような検索式として、文字列取り出しを指定する文字列関数を含む検索式が該当する。
The character strings stored as words in the
再び図2を参照すると、インタフェース51は、クライアント端末20等のクライアント端末からの構造化文書問い合わせ(構造化文書問い合わせ命令)を受け付ける。インタフェース51はまた、この問い合わせに対する結果をクライアント端末に返す。本実施形態では、構造化文書問い合わせに、WWW(World Wide Web)コンソーシアムで策定されているXQueryと呼ばれる問い合わせ言語が用いられる。XQueryでは、XML文書の階層構造をパス指定で絞り、目的のデータを得るための演算式、関数などが用意されている。
Referring to FIG. 2 again, the
解析部52はインタフェース51によって受け付けられた構造化文書問い合わせで使用される検索式(XQueryの式)を解析し、その解析結果に応じて構造検索部53、完全一致型検索部54または部分一致型検索部55を動作させる。構造検索部53は、XML文書のノードの階層を上記構造化文書問い合わせで指定されたパスに従って辿り、そのパス以下のノードを特定する位置情報を索引部422内の構造索引から取得する。即ち構造検索部53は、指定されたパスの構造に基づき、検索されるべきデータを絞り込むための構造検索を実行する。
The
完全一致型検索部54は、特定のタグのテキスト要素や属性値が、上記構造化文書問い合わせで指定された値に一致するデータを取得するための完全一致型検索処理を実行する。この完全一致型検索処理では、予め定められた構造のデータ位置に対して比較処理が行われる。このため索引部422には、文字列一致比較のための文字列索引を設定する。
The exact match
部分一致型検索部55は、特定のタグのテキスト要素や属性値に上記構造化文書問い合わせで指定された値(指定文字列)を含むデータを取得するための部分一致型検索処理を実行する。図4は部分一致型検索部55の機能構成を示す。部分一致型検索部55は、判定部550、位置取得部(第1の位置取得部)551、位置取得部(第2の位置取得部)552、参照回数管理部553、エントリ生成部554及びロード部555を含む。
The partial match
判定部550は、指定文字列に対応する語句エントリ(指定文字列のエントリ)が辞書テーブル110及び辞書ファイル43のいずれに存在するかを判定する。判定部550は、この判定結果に応じて、位置取得部551及び552のいずれにより指定文字列の位置情報を取得させるかを決定する。判定部550は、指定文字列のエントリが辞書テーブル110及び辞書ファイル43のいずれにも存在しない場合、位置取得部551を動作させる。判定部550はまた、指定文字列のエントリが辞書テーブル110または辞書ファイル43に存在する場合、位置取得部552aを動作させる。
The
位置取得部551は、指定文字列のエントリが辞書テーブル110及び辞書ファイル43のいずれにも存在しない場合、当該指定文字列を含むデータの位置情報を索引部422(N−グラム索引)を用いて取得する。位置取得部552は、指定文字列のエントリが辞書テーブル110に存在する場合、当該指定文字列の位置情報を辞書テーブル110から取得する。位置取得部552はまた、指定文字列のエントリが辞書ファイル43のみに存在する場合、当該指定文字列の位置情報を辞書ファイル43から取得する。
When the entry of the designated character string does not exist in either the dictionary table 110 or the
参照回数管理部553は、辞書テーブル110内の語句エントリにおける参照回数を管理する。参照回数管理部553は、辞書テーブル110に基づいて指定文字列を含むデータの位置情報が取得される際に、その指定文字列に対応する語句エントリ(指定文字列のエントリ)中の参照回数を1インクリメントする。
The reference
エントリ生成部554は、辞書テーブル110内の指定文字列のエントリにおける参照回数が予め定められた閾値を超え、且つ辞書ファイル43内に指定文字列のエントリが存在しない場合に、当該指定文字列のエントリを生成して当該辞書ファイル43に追加する。ロード部555は、辞書ファイル43に存在する指定文字列のエントリの情報を辞書テーブル110にロードする。
When the number of references in the entry of the designated character string in the dictionary table 110 exceeds a predetermined threshold value and the entry of the designated character string does not exist in the
次に本実施形態の動作について、部分一致型検索部55によって実行される処理を例に、図5A及び図5Bのフローチャートを参照して説明する。
今、クライアント端末20から検索処理装置50に対し、構造化文書問い合わせがネットワーク30を介して与えられたものとする。検索処理装置50内のインタフェース51は、このクライアント端末20からの構造化文書問い合わせを受け付けると、当該問い合わせを解析部52に渡す。解析部52は、この問い合わせで使用される検索式を解析することにより、構造検索部53、完全一致型検索部54及び部分一致型検索部55のいずれを動作させるかを決定する。ここで、上記検索式が、XQueryの式であるものとする。XQueryの式に含まれる関数として、string(文字列)処理系と呼ばれる、文字列を扱う関数(つまり文字列関数)が知られている。文字列関数としては、指定の文字列から指定の条件に合致する部分文字列を取り出すためのsubstring関数や、指定の文字列の連結を指定するconcat関数などが定義されている。また、部分一致型検索に利用される文字列関数としては、contains関数、start−with関数、end−with関数などが定義されている。
Next, the operation of the present embodiment will be described with reference to the flowcharts of FIGS. 5A and 5B, taking as an example the processing executed by the partial
Assume that a structured document inquiry is given from the
本実施形態において、解析部52によって解析された検索式が、部分一致型検索に利用される文字列関数、例えば
/Catalog/Book[contains(./Name/text(),”ルネッサンス”)]
のような、contains関数「contains(./Name/text(),”ルネッサンス”)」を含むXQeryの式であるものとする。このcontains関数を含むXQeryの式は、「/Catalog/Book」と一致する構造のノード(Bookノード)のうち、その題目(Name)に「ルネッサンス」という文字列を含むノード(書籍)を検索することを指定する。
In the present embodiment, the search expression analyzed by the
/Catalog/Book[contains(./Name/text(),”Renaissance ”)]
It is assumed that the expression is an XQuery expression including the contains function “contains (./ Name / text (),“ Renaissance ”)”. The XQuery expression including this contains function searches for a node (book) that includes the character string “Renaissance” in its title (Name) among nodes (Book nodes) having a structure matching “/ Catalog / Book”. Specify that.
このように、部分一致型検索に利用される文字列関数(contains関数)を含む検索式(XQeryの式)の場合、解析部52は、部分一致型検索処理が必要であるとして、構造検索部53及び部分一致型検索部55を動作させる。なお、完全一致型検索処理が必要な場合、解析部52は構造検索部53及び完全一致型検索部54を動作させる。
In this way, in the case of a search expression (XQuery expression) including a character string function (contains function) used for partial match type search, the
構造検索部53は、解析部52によって解析された検索式(XQeryの式)の指定するパス「/Catalog/Book」に従って、そのパス以下のノードを特定する位置情報を索引部422内の構造索引から取得する。構造検索部53によって取得された位置情報は文書検索部56に渡される。
The
一方、部分一致型検索部55では、判定部550が、解析部52によって解析された検索式(XQeryの式)に、文字列取り出しを指定する文字列関数が含まれているか否かを判定する(ステップS1)。このステップS1での判定がYESの場合、判定部550はステップS2を実行する。このステップS2において、判定部550は、上記検索式(XQeryの式)に含まれている文字列関数によって指定される文字列(指定文字列)「ルネッサンス」で辞書テーブル110を参照する。そして判定部550は、この指定文字列に一致する語句が格納されているエントリ(指定文字列のエントリ)が辞書テーブル110に存在するか否かを判定する。
On the other hand, in the partial
もし、指定文字列のエントリが辞書テーブル110に存在する場合、判定部550は辞書テーブル110内の当該エントリの位置を位置取得部552及び参照回数管理部553に通知する。すると参照回数管理部553は、辞書テーブル110内の指定文字列のエントリに設定されている参照回数を1インクリメントする(ステップS3)。一方、エントリ生成部554は、辞書テーブル110内の指定文字列のエントリから、当該エントリに設定されている位置情報、つまり指定文字列の位置情報を取得する(ステップS4)。
If the entry of the designated character string exists in the dictionary table 110, the
明らかなように、上記ステップS4の処理、即ち辞書テーブル110を利用して指定文字列の位置情報を取得する処理は、当該指定文字列を構成する全ての語彙(N−グラム)毎に索引部422のN−グラム索引を検索して、当該語彙毎の位置情報を取得することにより、指定文字列の位置情報を取得する処理(後述するステップS12乃至S14の処理)に比べて高速に実行できる。なお、ステップS4がステップS3より先に実行されても構わない。 As will be apparent, the process of step S4, that is, the process of acquiring the position information of the designated character string using the dictionary table 110 is performed by the index unit for every vocabulary (N-gram) constituting the designated character string. By searching the N-gram index of 422 and acquiring the position information for each vocabulary, it can be executed at higher speed than the process of acquiring the position information of the designated character string (the processes of steps S12 to S14 described later). . Note that step S4 may be executed prior to step S3.
参照回数管理部553は、指定文字列のエントリに設定されている参照回数をインクリメントすると、そのインクリメント後の参照回数を閾値と比較することにより、当該参照回数が閾値(基準の回数)を超えているか否かを判定する(ステップS5)。もし、インクリメント後の参照回数が閾値を超えていないならば、部分一致型検索部55での処理は終了となる。このとき、位置取得部552によって取得された位置情報が、部分一致型検索部55から文書検索部56に渡される。
When the reference
文書検索部56は、構造検索部53及び部分一致型検索部55の各々から渡された位置情報をマージし、一致する位置情報の指定する文書を、インタフェース51によって受け付けられた構造化文書問い合わせで使用される検索式に合致する文書として、文書DB42から検索する。
The
一方、インクリメント後の参照回数が閾値を超えているならば、判定部550は今度は、指定文字列のエントリが辞書ファイル43に存在するか否かを判定する(ステップS6)。もし、指定文字列のエントリが辞書ファイル43に存在するならば、部分一致型検索部55での処理は終了となる。
On the other hand, if the incremented reference count exceeds the threshold, the
これに対し、指定文字列のエントリが辞書ファイル43に存在しないならば、判定部550はエントリ生成部554を起動する。するとエントリ生成部554は、辞書テーブル110内の指定文字列のエントリの参照頻度が高いものとして、当該指定文字列のエントリに基づき、辞書ファイル43内に指定文字列のエントリを追加する(ステップS7)。ここでは、辞書テーブル110内の指定文字列のエントリの情報のうち、参照回数を除く情報が設定されたエントリが生成されて、辞書ファイル43に追加される。
On the other hand, if the entry of the designated character string does not exist in the
上記ステップS7により、検索処理装置50が電源オフされてメモリ11に格納されている辞書テーブル110のエントリ情報が消失した場合に対処できる。即ち、後述するステップS10から明らかなように、検索処理装置50の再起動後に辞書ファイル43内のエントリの情報を辞書テーブル110にロードすることにより、当該エントリの情報(つまり参照頻度が高いエントリ情報)を再利用できる。ステップS7の処理が実行されると部分一致型検索部55での処理は終了となる。
By the step S7, it is possible to cope with the case where the entry information of the dictionary table 110 stored in the
次に、上記ステップS2において、指定文字列のエントリが辞書テーブル110に存在しないと判定された場合について説明する。このようにステップS2での判定がNOの場合、判定部550は指定文字列のエントリが辞書ファイル43に存在するか否かを判定する(ステップS8)。
Next, a case will be described in which it is determined in step S2 that the entry of the designated character string does not exist in the dictionary table 110. As described above, when the determination in step S2 is NO, the
もし、指定文字列のエントリが辞書ファイル43に存在する場合、判定部550は辞書ファイル43内の当該エントリの位置を位置取得部552及びロード部555に通知する。すると位置取得部552は、辞書ファイル43内の指定文字列のエントリから、当該エントリに設定されている位置情報、つまり指定文字列の位置情報を取得する(ステップS9)。明らかなように、この辞書ファイル43を利用して指定文字列の位置情報を取得する処理は、辞書テーブル110を利用して指定文字列の位置情報を取得する処理と同様に、索引部422のN−グラム索引を検索して指定文字列の位置情報を取得する処理に比べて高速に実行できる。
If the entry of the designated character string exists in the
一方、ロード部555は、辞書ファイル43内の指定文字列のエントリから指定文字列の位置情報が取得されると、辞書テーブル110に1つエントリを追加して、当該エントリに上記指定文字列のエントリの情報をロードする(ステップS10)。すると参照回数管理部553は、ロード部555によって追加された辞書テーブル110内のエントリ(指定文字列のエントリ)に、値が“1”の参照回数を追加設定する(ステップS11)。なお、ステップS9において、辞書ファイル43内の指定文字列のエントリから指定文字列の位置情報を取得することは、ロード部555によって追加された辞書テーブル110内のエントリから指定文字列の位置情報を取得することと等価である。
On the other hand, when the position information of the designated character string is acquired from the entry of the designated character string in the
次に、上記ステップS8において、指定文字列のエントリが辞書ファイル43に存在しないと判定された場合について説明する。この場合、判定部550はその旨を指定文字列と共に位置取得部551に通知する。すると位置取得部551は、指定文字列をN−グラム(語彙)に分割する(ステップS12)。位置取得部551は、分割されたN−グラム(語彙)毎に、索引部422内のN−グラム索引を検索することにより、N−グラム(語彙)毎に位置情報を取得する(ステップS13)。位置取得部551は、N−グラム(語彙)毎の位置情報をマージして、指定文字列を構成するN−グラム(語彙)の各々の相対位置に対応する語彙出現位置を示す位置情報の集合を検出することにより、当該指定文字列の位置情報を取得する(ステップS14)。
Next, the case where it is determined in step S8 that the entry of the designated character string does not exist in the
ステップS14において位置取得部551によって取得された指定文字列の位置情報は、指定文字列と共にエントリ生成部554に渡される。エントリ生成部554は、この指定文字列、当該指定文字列の位置情報及び値が1(初期値)の参照回数が設定されたエントリを辞書テーブル110に追加する(ステップS15)。このステップS15の処理が実行されると部分一致型検索部55での処理は終了となる。
The position information of the designated character string acquired by the
上述したように、本実施形態において自動生成されて辞書ファイル43に登録され、当該辞書ファイル43から辞書テーブル110にロードされる語句エントリの情報は、ユーザからの構造化文書問い合わせに基づく検索で頻繁に利用される語句の索引(語句索引)を構成している。このため、構造化文書問い合わせに基づく検索で語句索引を利用する確率を高めることができる。ここで、辞書ファイル43を予め用意することも考えられる。しかし、そのためには検索で頻繁に利用される語句を予測しなければならない。もし、この予測が外れると、構造化文書問い合わせに基づく検索で語句索引を利用する確率が低くなる。本実施形態では、ユーザからの構造化文書問い合わせに基づく検索で利用される語句の索引のみが自動生成されるため、このようなおそれは少ない。つまり、本発明によれば、使われない語句のために語句索引が生成されることはなく、語句索引の生成コスト(辞書生成コスト)を軽減できる。
As described above, the phrase entry information automatically generated in this embodiment and registered in the
上記実施形態では、説明の簡略化のために、辞書テーブル110のサイズ、或いは辞書テーブル110のエントリの数の上限について考慮されていない。もし、辞書テーブル110のサイズまたはエントリ数の上限が予め定められている場合には、当該辞書テーブル110を例えばLRU(Least Recently Used)法により管理すればよい。即ち、ステップS15において辞書テーブル110にエントリを追加することにより辞書テーブル110のサイズまたはエントリ数が上限を超える場合には、辞書テーブル110のエントリのうち、その時点で最も以前に参照されたエントリを削除すれば良い。この管理手法は、辞書ファイル43内の語句エントリにも適用可能である。また、上記閾値、辞書テーブル110のサイズまたはエントリ数の上限を、クライアント端末20から指定可能としても良い。
In the above embodiment, for simplification of description, the size of the dictionary table 110 or the upper limit of the number of entries in the dictionary table 110 is not considered. If the upper limit of the size of the dictionary table 110 or the number of entries is determined in advance, the dictionary table 110 may be managed by, for example, the LRU (Least Recently Used) method. That is, if the size or the number of entries of the dictionary table 110 exceeds the upper limit by adding an entry to the dictionary table 110 in step S15, the entry that was referenced most recently at that time among the entries in the dictionary table 110 is selected. Delete it. This management method can also be applied to a phrase entry in the
[変形例]
次に上記実施形態の変形例について説明する。
上記実施形態においては、辞書テーブル110を利用することにより、索引部422のN−グラム索引を利用する場合に比べて、指定文字列の位置情報を高速で取得できる。但し、この効果は、指定文字列を構成する文字数nが少ない場合には低くなる。そこで本変形例では、辞書テーブル110のエントリから辞書ファイル43に保存すべきエントリを決定する条件に、参照回数Nrだけでなく、文字数が加えられる。更に具体的に述べるならば、文字数nによって決まる重みwnであって、当該文字数nが少ないほど小さな値となる重みwnを参照回数Nrに乗じて得られる値Nr×wn(つまり重み付けされた参照回数Nr×wn)が、上記ステップS5において参照回数Nrに代えて用いられる。
[Modification]
Next, a modification of the above embodiment will be described.
In the above embodiment, by using the dictionary table 110, the position information of the designated character string can be acquired at a higher speed than when the N-gram index of the
なお、本発明は、上記実施形態またはその変形例そのままに限定されるものではなく、実施段階ではその要旨を逸脱しない範囲で構成要素を変形して具体化できる。また、上記実施形態またはその変形例に開示されている複数の構成要素の適宜な組み合せにより種々の発明を形成できる。例えば、実施形態またはその変形例に示される全構成要素から幾つかの構成要素を削除してもよい。 In addition, this invention is not limited to the said embodiment or its modification example as it is, A component can be deform | transformed and embodied in the range which does not deviate from the summary in an implementation stage. In addition, various inventions can be formed by appropriately combining a plurality of constituent elements disclosed in the embodiment or the modification thereof. For example, you may delete a some component from all the components shown by embodiment or its modification.
10…データベースサーバ、11…メモリ、20…クライアント端末、30…ネットワーク、40…外部記憶装置、41…検索処理プログラム、42…文書データベース(文書DB)、43…辞書ファイル(第2の語句索引格納手段)、51…インタフェース、52…解析部、53…構造検索部、54…完全一致型検索部、55…部分一致型検索部、56…文書検索部、57…結果生成部、110…辞書テーブル(第1の語句索引格納手段)、421…文書部、422…索引部(N−グラム索引格納手段)、550…判定部、551…位置取得部(第1の位置取得手段)、552…位置取得部(第2の位置取得手段)、553…参照回数管理部、554…エントリ生成部(語句索引生成手段)、555…ロード部。
DESCRIPTION OF
Claims (6)
前記文書データベースに格納されている構造化文書の各々をN−グラムの部分文字列に分割することによって生成されるN−グラム索引であって、当該部分文字列の位置を示す位置情報と対応付けられたN−グラム索引を格納するN−グラム索引格納手段と、
語句の位置を示す位置情報と対応付けられた語句索引を格納する語句索引格納手段と、
前記検索式が文字列を指定する文字列関数を含む場合、当該文字列関数で指定される文字列を語句とする語句索引が前記語句索引格納手段に存在するかを判定する判定手段と、
前記文字列関数で指定される文字列を語句とする語句索引が存在しない場合、前記N−グラム索引を利用して当該文字列の位置情報を取得する第1の位置取得手段と、
前記文字列関数で指定される文字列を語句とする語句索引が存在しない場合、当該文字列を語句とする語句索引を生成し、当該生成された語句索引を前記第1の位置取得手段によって取得された位置情報と対応付けて前記語句索引格納手段に格納する語句索引生成手段と、
前記文字列関数で指定される文字列を語句とする語句索引が存在する場合、当該語句索引を利用して当該文字列の位置情報を取得する第2の位置取得手段と、
前記検索式の示す検索条件に合致する、前記文字列関数で指定される文字列を含む構造化文書を、前記第1または第2の位置取得手段によって取得された位置情報に基づいて前記文書データベースから検索する文書検索手段と
を具備することを特徴とする文書検索処理装置。 In a search processing apparatus for searching for a structured document that matches a search condition indicated by a given search expression from a document database storing a plurality of structured documents,
An N-gram index generated by dividing each structured document stored in the document database into N-gram partial character strings, and is associated with position information indicating the position of the partial character string N-gram index storage means for storing the generated N-gram index;
A phrase index storage means for storing a phrase index associated with position information indicating the position of the phrase;
When the search expression includes a character string function that specifies a character string, a determination unit that determines whether or not a word index that includes the character string specified by the character string function is present in the word index storage unit;
First position acquisition means for acquiring position information of the character string using the N-gram index when there is no phrase index that uses the character string specified by the character string function as a phrase;
If there is no phrase index that uses the character string specified by the character string function as a word, a word index that uses the character string as a word is generated, and the generated word index is acquired by the first position acquisition unit. Phrase index generating means for storing in the phrase index storage means in association with the position information,
A second position acquisition unit that acquires position information of the character string using the word index when there is a word index that uses the character string specified by the character string function as a word;
Based on the position information acquired by the first or second position acquisition unit, a structured document including a character string specified by the character string function that matches a search condition indicated by the search expression is stored in the document database. A document search processing apparatus comprising: a document search means for searching from the document search means.
前記判定手段は、前記文字列関数で指定される文字列を語句とする語句索引が前記第1及び第2の語句索引格納手段のいずれに存在するかを判定し、
前記語句索引生成手段は、前記文字列関数で指定される文字列を語句とする語句索引が前記第1の語句索引格納手段のみに存在し、且つ当該語句索引と対応付けられている参照回数が予め定められた閾値を超えている場合に当該語句索引を前記第2の語句索引格納手段に追加し、
前記文字列関数で指定される文字列を語句とする語句索引が前記第1の語句索引格納手段に存在する場合、当該語句索引に対応付けられている前記参照回数をインクリメントする参照回数管理手段と、
前記文字列関数で指定される文字列を語句とする語句索引が前記第1の語句索引格納手段に存在しないが、前記第2の語句索引格納手段には存在する場合、当該語句索引を前記第2の語句索引格納手段から前記第1の語句索引格納手段にロードして、当該ロードされた語句索引に値が初期値の参照回数を対応付けるロード手段とを更に具備する
ことを特徴とする請求項1記載の検査処理装置。 The phrase index storage means is a volatile first phrase index storage means for storing the phrase index generated by the phrase index generation means in association with a reference count representing the number of times the phrase index is referenced, Non-volatile second phrase index storage means for reusably storing a phrase index selected from the phrase indexes stored in the first phrase index storage means;
The determination means determines in which of the first and second phrase index storage means a phrase index having a phrase specified by the string function as a phrase,
The phrase index generation means has a phrase index having a character string specified by the string function as a phrase only in the first phrase index storage means, and has a reference count associated with the phrase index. If the predetermined threshold is exceeded, the word index is added to the second word index storage means;
A reference number management means for incrementing the reference number associated with the phrase index when a phrase index having the phrase specified by the character string function as a phrase is present in the first phrase index storage means; ,
If a phrase index that uses a character string specified by the string function as a phrase does not exist in the first phrase index storage means, but does not exist in the second phrase index storage means, the phrase index is the first index. 2. Load means for loading from the two phrase index storage means into the first phrase index storage means and associating the loaded phrase index with the reference count of the initial value. The inspection processing apparatus according to 1.
前記検索式が文字列を指定する文字列関数を含むかを判定するステップと、
前記検索式が文字列を指定する文字列関数を含む場合、当該文字列を語句とする語句索引が語句索引格納手段に存在するかを判定するステップと、
前記文字列関数で指定される文字列を語句とする語句索引が存在しない場合、前記文書データベースに格納されている構造化文書の各々をN−グラムの部分文字列であるN−グラム文字列に分割することによって生成されてN−グラム索引格納手段に格納されているN−グラム索引であって、当該N−グラム文字列の位置を示す位置情報と対応付けられたN−グラム索引のうち、前記文字列関数で指定される文字列を構成するN−グラム文字列に対応するN−グラム索引を利用して当該文字列の位置情報を取得するステップと、
前記文字列関数で指定される文字列を語句とする語句索引が存在しない場合、当該文字列を語句とする語句索引を生成して、当該生成された語句索引を前記取得された位置情報と対応付けて前記語句索引格納手段に格納するステップと、
前記文字列関数で指定される文字列を語句とする語句索引が存在する場合、当該語句索引を利用して当該文字列の位置情報を取得するステップと、
前記検索式の示す検索条件に合致する、前記文字列関数で指定される文字列を含む構造化文書を、前記語句索引または前記N−グラム索引を利用して取得された位置情報に基づいて前記文書データベースから検索するステップと
を実行させるためのプログラム。 A program used by a computer to search for a structured document that matches a search condition indicated by a given search expression from a document database in which a plurality of structured documents are stored.
Determining whether the search expression includes a string function specifying a string;
When the search expression includes a character string function for designating a character string, determining whether a word index having the character string as a word exists in the word index storage means;
When there is no phrase index that uses a character string specified by the character string function as a word, each structured document stored in the document database is converted into an N-gram character string, which is an N-gram partial character string. An N-gram index generated by dividing and stored in the N-gram index storage means, wherein the N-gram index is associated with position information indicating the position of the N-gram character string. Obtaining position information of the character string using an N-gram index corresponding to an N-gram character string constituting the character string specified by the character string function;
If there is no phrase index that uses the character string specified by the character string function as a word, a word index that uses the character string as a word is generated, and the generated word index corresponds to the acquired position information. And storing it in the phrase index storage means;
If there is a phrase index that uses a character string specified by the character string function as a phrase, using the phrase index to obtain position information of the character string;
A structured document that includes a character string specified by the character string function that matches a search condition indicated by the search expression is obtained based on position information acquired using the phrase index or the N-gram index. A program for executing the steps of retrieving from a document database.
前記判定するステップは、前記文字列関数で指定される文字列を語句とする語句索引が前記第1の語句索引格納手段に存在するかを判定する第1の判定ステップと、存在しない場合に当該語句索引が前記第2の語句索引格納手段に存在するかを判定する第2の判定ステップとを含み、
前記コンピュータに実行させるための、
前記文字列関数で指定される文字列を語句とする語句索引が前記第1の語句索引格納手段に存在すると判定された場合、当該語句索引に対応付けられている前記参照回数をインクリメントするステップと、
前記インクリメント後の参照回数を予め定められた閾値と比較するステップと、
前記参照回数が前記閾値を超えている場合、前記文字列関数で指定される文字列を語句とする語句索引が前記第2の語句索引格納手段に存在するかを判定する第3の判定ステップと、
前記文字列関数で指定される文字列を語句とする語句索引が前記第2の語句索引格納手段に存在しないと前記第3のステップで判定された場合、前記第1の語句索引格納手段に存在すると前記第1のステップで判定された当該文字列を語句とする語句索引を前記第2の語句索引格納手段に追加するステップと、
前記文字列関数で指定される文字列を語句とする語句索引が前記第2の語句索引格納手段に存在すると前記第2のステップで判定された場合、当該語句索引を前記第2の語句索引格納手段から前記第1の語句索引格納手段にロードして、当該ロードされた語句索引に値が初期値の参照回数を対応付けるステップとを更に含む
ことを特徴とする請求項4記載のプログラム。 The phrase index storage means is a volatile first phrase index storage means for storing the phrase index generated by the phrase index generation means in association with a reference count representing the number of times the phrase index is referenced, Non-volatile second phrase index storage means for reusably storing a phrase index selected from the phrase indexes stored in the first phrase index storage means;
The determining step includes a first determining step for determining whether or not a phrase index having a character string specified by the character string function as a phrase exists in the first phrase index storage unit; A second determination step of determining whether a phrase index exists in the second phrase index storage means,
For causing the computer to execute,
Incrementing the reference count associated with the phrase index when it is determined that a phrase index having the phrase specified by the string function as a phrase exists in the first phrase index storage unit; ,
Comparing the incremented reference count with a predetermined threshold;
A third determination step of determining whether or not a phrase index having a character string specified by the character string function as a phrase exists in the second phrase index storage unit when the reference count exceeds the threshold; ,
If it is determined in the third step that the phrase index having the character string specified by the character string function does not exist in the second phrase index storage means, the phrase index exists in the first phrase index storage means Then, adding a phrase index having the character string determined in the first step as a phrase to the second phrase index storage unit;
If it is determined in the second step that a phrase index having a phrase specified by the string function as a phrase exists in the second phrase index storage means, the phrase index is stored in the second phrase index storage. 5. The program according to claim 4, further comprising the step of loading the first phrase index storage means from the means and associating the loaded phrase index with the reference count of the initial value.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
JP2006195773A JP4439496B2 (en) | 2006-07-18 | 2006-07-18 | Search processing apparatus and program |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
JP2006195773A JP4439496B2 (en) | 2006-07-18 | 2006-07-18 | Search processing apparatus and program |
Publications (2)
Publication Number | Publication Date |
---|---|
JP2008026963A true JP2008026963A (en) | 2008-02-07 |
JP4439496B2 JP4439496B2 (en) | 2010-03-24 |
Family
ID=39117562
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
JP2006195773A Expired - Fee Related JP4439496B2 (en) | 2006-07-18 | 2006-07-18 | Search processing apparatus and program |
Country Status (1)
Country | Link |
---|---|
JP (1) | JP4439496B2 (en) |
Cited By (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JP2010134720A (en) * | 2008-12-04 | 2010-06-17 | Nippon Telegr & Teleph Corp <Ntt> | Document search device and document search program |
JP2012014646A (en) * | 2010-07-05 | 2012-01-19 | Nec Corp | Document retrieval device, document retrieval method, and program |
US9110973B2 (en) | 2011-04-08 | 2015-08-18 | Samsung Electronics Co., Ltd. | Method and apparatus for processing a query |
CN105138637A (en) * | 2015-08-24 | 2015-12-09 | 浪潮软件股份有限公司 | Data processing method and device |
-
2006
- 2006-07-18 JP JP2006195773A patent/JP4439496B2/en not_active Expired - Fee Related
Cited By (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JP2010134720A (en) * | 2008-12-04 | 2010-06-17 | Nippon Telegr & Teleph Corp <Ntt> | Document search device and document search program |
JP2012014646A (en) * | 2010-07-05 | 2012-01-19 | Nec Corp | Document retrieval device, document retrieval method, and program |
US9110973B2 (en) | 2011-04-08 | 2015-08-18 | Samsung Electronics Co., Ltd. | Method and apparatus for processing a query |
CN105138637A (en) * | 2015-08-24 | 2015-12-09 | 浪潮软件股份有限公司 | Data processing method and device |
Also Published As
Publication number | Publication date |
---|---|
JP4439496B2 (en) | 2010-03-24 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
KR101522049B1 (en) | Coreference resolution in an ambiguity-sensitive natural language processing system | |
US8280721B2 (en) | Efficiently representing word sense probabilities | |
JP4237813B2 (en) | Structured document management system | |
JP2010224883A (en) | Structured document management apparatus and method | |
KR20100066919A (en) | Triple indexing and searching scheme for efficient information retrieval | |
US8229970B2 (en) | Efficient storage and retrieval of posting lists | |
US20220121637A1 (en) | Structured document indexing and searching | |
JP4439496B2 (en) | Search processing apparatus and program | |
US20110252313A1 (en) | Document information selection method and computer program product | |
WO2010119794A1 (en) | Information processing apparatus and information processing method | |
JP4439497B2 (en) | Search processing apparatus and program | |
JP2009277099A (en) | Similar document retrieval device, method and program, and computer readable recording medium | |
JP5260123B2 (en) | Search system, index creation device, search engine, index creation method, search method and program | |
JP4148247B2 (en) | Vocabulary acquisition method and apparatus, program, and computer-readable recording medium | |
JP4091586B2 (en) | Structured document management system, index construction method and program | |
JP4635585B2 (en) | Question answering system, question answering method, and question answering program | |
JP4489034B2 (en) | Structured document processing apparatus, structured document processing method, and structured document processing program | |
JP4304226B2 (en) | Structured document management system, structured document management method and program | |
JP4160627B2 (en) | Structured document management system and program | |
JP4543819B2 (en) | Information search system, information search method, and information search program | |
KR20010107113A (en) | Reduction of Natural Language Queries into Boolen and Vector Queries Using Syntactic Tree in a Natural Language Information Retrieval System | |
JP4206266B2 (en) | Full-text search device, processing method, processing program, and recording medium | |
JP2009251845A (en) | Retrieval result evaluation device and retrieval result evaluation method | |
JP4550876B2 (en) | Structured document retrieval system and program | |
JP2006163723A (en) | Document search method |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
A131 | Notification of reasons for refusal |
Free format text: JAPANESE INTERMEDIATE CODE: A131 Effective date: 20090728 |
|
A521 | Written amendment |
Free format text: JAPANESE INTERMEDIATE CODE: A523 Effective date: 20090925 |
|
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: 20091208 |
|
A01 | Written decision to grant a patent or to grant a registration (utility model) |
Free format text: JAPANESE INTERMEDIATE CODE: A01 |
|
A61 | First payment of annual fees (during grant procedure) |
Free format text: JAPANESE INTERMEDIATE CODE: A61 Effective date: 20100105 |
|
FPAY | Renewal fee payment (event date is renewal date of database) |
Free format text: PAYMENT UNTIL: 20130115 Year of fee payment: 3 |
|
R150 | Certificate of patent or registration of utility model |
Free format text: JAPANESE INTERMEDIATE CODE: R150 |
|
FPAY | Renewal fee payment (event date is renewal date of database) |
Free format text: PAYMENT UNTIL: 20140115 Year of fee payment: 4 |
|
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 |
|
LAPS | Cancellation because of no payment of annual fees |