Upgrade to Pro — share decks privately, control downloads, hide ads and more …

転置ファイルを用いた全文検索について

Sponsored · Your Podcast. Everywhere. Effortlessly. Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.
Avatar for masaya82 masaya82
February 27, 2018
840

 転置ファイルを用いた全文検索について

Avatar for masaya82

masaya82

February 27, 2018
Tweet

More Decks by masaya82

Transcript

  1. 転置ファイル法 転置ファイルには他の形式も存在 ・文書番号の並びをビット列形式で表現する文書番号ベクトル(bitmap)を 用いて索引語が文書に入っているかどうかを表現 例:ある索引語 に対して : 1 2 3

    … :ビット値(0 or 1) :文書数 ・索引語の出現する文書に加えて、出現位置も格納 例:ある索引語 に対して : (1 ;11 , … , 11 ), (3 ;21 , … , 22 ), … ( ;1 , … , ) :文書 :出現位置 3
  2. 転置ファイルの構成法 文書番号ベクトルを用いる方法 例:以下の文書に対し転置ファイルを作成 5 行番号 索引語 文書 文書番号ベクトル 1 algorithm

    3, 4, 5 0 0 1 1 1 2 file 2 0 1 0 0 0 3 full 1 1 0 0 0 0 4 index 2, 4 0 1 0 1 0 5 information 5 0 0 0 0 1 6 inverted 2 0 1 0 0 0 7 retrieval 5 0 0 0 0 1 8 search 1, 3, 4 1 0 1 1 0 9 sequential 3 0 0 1 0 0 10 text 1 1 0 0 0 0 1=full text search 2=inverted index file 3=sequential search algorithm 4=index search algorithm 5=information retrieval algorithm ※文書の位置は先頭を0とし、 空白も1文字とカウントする
  3. 転置ファイルの構成法 文書及び出現位置を格納する方法 例:以下の文書に対し転置ファイルを作成 6 行番号 索引語 文書と出現位置 1 algorithm (3

    ; 18), (4 ; 13), (5 ; 22) 2 file (2 ; 15) 3 full (1 ; 0) 4 index (2 ; 9), (4 ; 0) 5 information (5 ; 0) 6 inverted (2 ; 0) 7 retrieval (5 ; 12) 8 search (1 ; 10) (3 ; 11) (4 ; 6) 9 sequential (3 ; 0) 10 text (1 ; 5) 1=full text search 2=inverted index file 3=sequential search algorithm 4=index search algorithm 5=information retrieval algorithm ※文書の位置は先頭を0とし、 空白も1文字とカウントする
  4. 転置ファイルによる検索法 文書番号ベクトルを用いた方法の場合 文書番号ベクトルに対し、ビットごとにAND検索なら論理積、 OR検索なら論理和、NOT検索なら論理否定を求める 例:クエリを「search AND algorithm」としたとき 論理積は 0 0

    1 1 0 →文書3、4が検索結果となる 10 行番号 索引語 文書 文書番号ベクトル 1 algorithm 3, 4, 5 0 0 1 1 1 2 file 2 0 1 0 0 0 3 full 1 1 0 0 0 0 4 index 2, 4 0 1 0 1 0 5 information 5 0 0 0 0 1 6 inverted 2 0 1 0 0 0 7 retrieval 5 0 0 0 0 1 8 search 1, 3, 4 1 0 1 1 0 9 sequential 3 0 0 1 0 0 10 text 1 1 0 0 0 0
  5. 転置ファイルによる検索法 索引語の出現する文書と出現位置を格納する方法の場合 検索単語が文書に存在するかどうかに加えて出現する順序も 指定可能 →複合語についても検索可能 例:クエリを「search AND algorithm」としたとき 右の表より文書3、4が該当 さらに出現位置を見ると

    searchの出現位置からsearchの文字数(6文字)+1(空白) =7バイト後にalgorithmが存在 →「search algorithm」という複合語となっている 11 索引語 文書と出現位置 algorithm (3 ; 18), (4 ; 13), (5 ; 22) search (1 ; 10) (3 ; 11) (4 ; 6)
  6. 転置ファイルによる検索法 Nグラム索引を用いた方法(日本語など) 続き 先頭から順に検索単語の位置情報と転置ファイルの位置情報 の照合を行う 13 索引語 出現位置 に 0,4,8,12

    わ 2,10,14 と 16 り 18 16 18 2 10 14 0 4 8 12 と り に わ 索引語 位置情報 →12バイト目から「にわとり」が あることが分かる +2 -4 -2 +◦、-◦:出現位置の差