Upgrade to PRO for Only $50/Year—Limited-Time Offer! 🔥
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
文字列照合に基づく全文検索について
Search
masaya82
January 23, 2018
0
210
文字列照合に基づく全文検索について
masaya82
January 23, 2018
Tweet
Share
More Decks by masaya82
See All by masaya82
文献紹介 : More is not always better: balancing sense distributions for all-words
masaya82
0
150
文献紹介:Enhancing Modern Supervised Word Sense Disambiguation Models
masaya82
0
160
文献紹介:The Word Sense Disambiguation Test Suite at WMT18
masaya82
0
110
文献紹介:Preposition Sense Disambiguation and Representation
masaya82
0
130
文献紹介:Word Sense Disambiguation Based on Word Similarity Calculation Using Word Vector Representation from a Knowledge-based Graph
masaya82
0
160
Distributional Lesk: Effective Knowledge-Based Word Sense Disambiguation
masaya82
0
110
Japanese all-words WSD system using the Kyoto Text Analysis ToolKit
masaya82
0
130
Improving Word Sense Disambiguation in Neural Machine Translation with Sense Embeddings
masaya82
0
150
Learning_to_Identify_the_Best_Contexts_for_Knowledge-based_WSD
masaya82
0
130
Featured
See All Featured
Visualization
eitanlees
150
16k
How To Stay Up To Date on Web Technology
chriscoyier
791
250k
Performance Is Good for Brains [We Love Speed 2024]
tammyeverts
12
1.3k
Mobile First: as difficult as doing things right
swwweet
225
10k
Dealing with People You Can't Stand - Big Design 2015
cassininazir
367
27k
Fantastic passwords and where to find them - at NoRuKo
philnash
52
3.5k
Building a Modern Day E-commerce SEO Strategy
aleyda
45
8.3k
ピンチをチャンスに:未来をつくるプロダクトロードマップ #pmconf2020
aki_iinuma
128
54k
ラッコキーワード サービス紹介資料
rakko
0
1.7M
Agile that works and the tools we love
rasmusluckow
331
21k
Music & Morning Musume
bryan
46
7k
Testing 201, or: Great Expectations
jmmastey
46
7.8k
Transcript
文字列照合に基づく 全文検索について 自然言語処理研究室 B3 福嶋 真也
参考文献 北 研二、津田 和彦、獅々堀 正幹 著 「情報検索アルゴリズム」 2002年 共立出版株式会社 平田
富夫 著 「アルゴリズムとデータ構造」 1990年 森北出版会社
全文検索とは 与えられたキーワードに対して、文書中からキーワードと完全 に一致する部分を探し出す技術 テキストエディタの検索コマンドやテキストデータベースの検索、 スペリング検査、テキスト編集などに利用 大きく分けて2つの方法が存在 ・文字列照合を用いる方法 ・索引を用いる方法 今回は文字列照合を用いる方法について紹介
文字列照合に用いられるアルゴリズム 単一のキーワードに対して用いられるアルゴリズム ・ Knuth-Morris-Pratt法(KMP法) ・Boyer-Moore法(BM法) 複数のキーワードに対して用いられるアルゴリズム ・Aho-Corasick法(AC法)
SimpleSearch もっとも単純な文字列照合アルゴリズム キーワード(長さn)に対して検索対象となる文字列(テキストス トリング)の1文字目からn文字目まで一致しているか確認 2文字目からn+1文字まで一致しているか確認 テキストストリングの文字列の末尾まで繰り返す ・ ・ ・
SimpleSearch 例 キーワード abcaba テキストストリング abcabcababcab 位置 1 2 3
4 5 6 7 8 9 10 11 12 13 text a b c a b c a b a b c a b 照合 状況 〇 〇 〇 〇 〇 × × × 〇 〇 〇 〇 〇 ◎ × × 〇 〇 × ×
KMP法 SimpleSearchでは1文字ずつずらす ずらす量を変えることができれば試行回数は少なくなる 失敗関数を用いてずらす量を計算 失敗関数 f(i)=1+max{u|0≦u<i-1,1 2 … = −
−+1 … −1}
KMP法 例 キーワード abcaba テキストストリング abcabcaba 位置 1 2 3
4 5 6 7 8 9 text a b c a b c a b a 照合状況 〇 〇 〇 〇 〇 × 〇 〇 〇 ◎
KMP法 失敗関数 位置 1 2 3 4 5 6 7
キー ワード a b c a b a a b c a b a a b c a b a f(i) 0 1 1 0 1 3 2
BM法 キーワードの末尾から照合をしていくことでずらせる量を増やす 方法 例 キーワード abcaba テキストストリング abcabcaba 位置 1
2 3 4 5 6 7 8 9 text a b c a b c a b a 照合状況 × ◎ 〇 〇 〇 〇 〇
BM法 skip関数 キーワードの末尾から何文字目に目的の文字が存在するかを 示す関数 (もしキーワード内に目的の文字がなければキーワードの長さ がskip関数の値となる) 例:abcaba 文字 Skip関数 a
2 b 1 c 3 その他の文字 6
AC法 マシンACと呼ばれる一種の有限オートマトンを複数のキーワー ドから構成し、これに入力としてテキストストリングを与えること で文字列照合を行う手法 ※有限オートマトン 有限個の状態の遷移と動作の組み合わせからなる「ふるまい のモデル」 現在状態から遷移しうる状態、遷移のきっかけとなる条件を列 挙することで定義される
AC法 マシンAC goto関数、failure関数、output関数からなる goto関数 入力によってどのような状態に遷移するかを示す状態遷移図 failure関数 goto関数で遷移が失敗したときにどの状態になるかを表す関 数 output関数 ある状態になったとき検出されるキーワードを表す関数
AC法 例1:{”ab”,”bc”,”bab”,”d”,”abcde”}のキーワードからなるマシン AC s f(s) 1 0 2 3 3
0 4 0 5 1 6 2 7 0 8 4 9 7 10 0 s output(s) 2 {“ab”} 4 {“bc”} 6 {“bab”,”ab”} 7 {“d”} 8 {“bc”} 9 {“d”} 10 {“abcde”} (a)goto関数 (b)failure関数 (c)output関数
AC法 例2:テキストストリング”xbabcdexを例1の入力として入れた時 の遷移 0 0 3 5 6 8 9
10 0 goto関数による 遷移 failure関数による 遷移 2 0 x b x b a c d e
本日の発表内容 全文検索 ・SimpleSearch ・KMP法 ・BM法 ・AC法