狠狠撸

狠狠撸Share a Scribd company logo
全文検索 完全に理解した
n-gram?転置インデックス? はいはい、知ってる知ってる
@segavvy
?2020 segavvy 2020/6/25 完全に理解した人達の完全に理解したTalk #6 1
このお話のゴール
全文検索 の仕組みが なんとなくわかる
…… よろしければ 自然言語処理 にも興味をもっていただく
3章に分けて お話します
?2020 segavvy 2020/6/25 完全に理解した人達の完全に理解したTalk #6 2
第1章
全文検索とは
そもそも「全文」ってなんだ?
?2020 segavvy 2020/6/25 完全に理解した人達の完全に理解したTalk #6 3
全文とは?
ぜん ぶん 【全文】
文章の始めから終わりまで(三省堂 大辞林 第三版)
?2020 segavvy 2020/6/25 完全に理解した人達の完全に理解したTalk #6 4
全文検索とは?
文章の始めから終わりまでを 検索すること
フルテキスト検索、full-text search
文章の検索は普通にできる
? アプリの検索機能
テキストエディタ、Microsoft Office、統合開発環境、etc.
? コマンド
Linux の grep 、Windows の find 、etc.
? プログラミング言語
str.indexOf()、str.Contains()、strstr() 、etc.
? データベース
SELECT * FROM user WHERE bio LIKE “%GAFA勤務%";
?2020 segavvy 2020/6/25 完全に理解した人達の完全に理解したTalk #6 5
ただし データが大量にあると苦しい
?2020 segavvy 2020/6/25 完全に理解した人達の完全に理解したTalk #6 6
? PCの中やファイルサーバーのファイルを検索しても
なかなか結果が返ってこない
? プログラムで 巨大なログファイルを検索したいけど
検索以前に 読み込みが遅くて困る
? SQLのLikeで 中間一致検索すると
インデックスを作ってても遅い
全文検索が速いサービスもたくさんある
Google、Yahoo!、Bing などのネット検索
Twitter の検索
Dropbox、Evernote、box などの検索 etc.
?2020 segavvy 2020/6/25 完全に理解した人達の完全に理解したTalk #6 7
「全文検索 専用の仕組み」が動いている!
第2章へつづく
(休憩)自己紹介
?2020 segavvy 2020/6/25 完全に理解した人達の完全に理解したTalk #6 8
@segavvy
IT企業で企画?マーケを担当している元エンジニア
C|C#|VBA|Python|全文検索|自然言語処理|機械学習|
企画|マーケ|ドラクエ好き|嫁さんはディズニー教|
写真は丸まってたペンギン
セガビ
第2章
全文検索の仕組み
大量のテキストデータを 高速に検索する仕組み
?2020 segavvy 2020/6/25 完全に理解した人達の完全に理解したTalk #6 9
百科事典の索引 索引
【あ】
あご 3巻 13
足 4巻 239
頭 2巻 192
【い】
胃 2巻 28
【う】
腕 4巻 32
うなじ 2巻 129
?2020 segavvy 2020/6/25 完全に理解した人達の完全に理解したTalk #6 10
百科事典は 索引を見れば
目的の巻とページが すぐわかる
「足」については 4巻の239ページ!
全文検索するための索引を
あらかじめ作っておく!
ネット検索の例 言葉 言葉の出現場所
完全 ページA(5、15文字目) ページF(...
理解 ページA(8、18文字目) ページG(…
する ページA(3、20文字目) ページB(…
人達 ページA(12文字目) ページD(…
?2020 segavvy 2020/6/25 完全に理解した人達の完全に理解したTalk #6 11
索引
データ
インターネット サイトのデータ 全文検索プログラム 検索の利用者
各サイトから
データを収集
索引に載せる
言葉の抽出
“理解”で
ネットを検索
ページAとGが
見つかりました!
索引データのイメージ
事前の索引作成の流れ
検索時の流れ
索引に載せる言葉は どう選ぶのか?
索引にない言葉では 検索できない
?2020 segavvy 2020/6/25 完全に理解した人達の完全に理解したTalk #6 12
どんな条件でも検索できるように 索引を作る必要がある
代表的な 2つの方法を ご紹介
○ ”理解” は検索できる
× “Talk” は索引にないので
検索できない
言葉 単語の出現場所
完全 サイトA(5、15文字目) サイトF(...
理解 サイトA(8、18文字目) サイトG(…
する サイトA(3、20文字目) サイトB(…
人達 サイトA(12文字目) サイトD(…
索引の作成時
1.用語辞書(品詞や原形)を使い分解
2.助詞などの不要なものを除去
3.変化しているものを 原形へ戻す
索引の抽出方法 ①日本語解析
?2020 segavvy 2020/6/25 完全に理解した人達の完全に理解したTalk #6 13
完全に理解した人達
完全 理解 する 人達
検索時
検索条件の文字に対して
同様の処理を実施してから
索引を調べる
索引を見て これらが
すべてあるものを探す
完全 に 理解 し た 人達
完全 理解 し 人達
完全に理解
完全 理解
完全に理解した人達
完全に理解した人達
完全に理解した人達
完全に理解した人達
完全に理解した人達
完全に理解した人達
完全に理解した人達
完全に理解した人達
索引の抽出方法 ②単純に切り刻む
?2020 segavvy 2020/6/25 完全に理解した人達の完全に理解したTalk #6 14
完全に理解した人達 検索時
検索条件の文字に対して
同じ文字数で切り出す
最後の半端は前の文字で
文字数を合わせる※
索引を見て これらが
すべてあるものを探す
索引の作成時
1文字ずつ
ずらしながら
固定の文字数で
切り出していく
完全に理解
完全 に理 理解
※
切り出し
文字数が2の場合
②単純に切り刻む:言葉の途中が該当
東京都府中市 は 東京 京都 都府 府中 中市 に分解
“京都” や “中市” で検索されてしまう
索引抽出の課題
①日本語解析:解析ミス
Honda Cars 東京都 は Honda Cars 東京 都 に分解
“京都” で検索できない “東京” で検索されてしまう
?2020 segavvy 2020/6/25 完全に理解した人達の完全に理解したTalk #6 15
解析部分を調整したり 後処理で不要なものを除いたり
両方の方式を組み合わせたり etc.
正しくは ひがしきょうと
Honda Cars 東京都
表記のゆれに対応する仕組み
?2020 segavvy 2020/6/25 完全に理解した人達の完全に理解したTalk #6 16
ゆれを統一する表や 同義語辞書などを用意して処理
1 全半角 ABC = ABC アイウ = ???
2 大小文字 ABC = abc ABC = abc
3 ひらがな?カタカナ りんご = リンゴ みかん = ミカン
4 数字 123 = 一二三 = 百二十三 = ⅠⅡⅢ
5 異体字?新旧字体 高 = 髙 斉 = 齊 辺 = 邊
6 送り仮名 引っ越し = 引越し = 引越
7 同義語 アメリカ = 米国 = 合衆国 = USA
8 記号 ー = ? = - = - = ― = ‐
第2章のまとめ
?2020 segavvy 2020/6/25 完全に理解した人達の完全に理解したTalk #6 17
全文検索の仕組み 専門用語
1 事前に索引を作ること?その索引 インデキシング?インデックス
2 索引データ(言葉と出現位置の対応表) 転置インデックス、転置ファイル
3 索引作成のために 対象のデータを集めること クローリング、クロールする
4 日本語の解析処理により 言葉を切り出すこと 形態素解析、分かち書き
5 検索で不要な 助詞などの言葉を 索引から除くこと ストップワードの除去
6 文章を一定の文字数で単純に切り刻む方式 n-gram(エヌ?グラム)
7 文章の分割ミスなどにより 検索に該当しないこと 検索もれ
8 文章の分割ミスなどにより 間違って該当したデータ 検索ノイズ
9 表記ゆれを統一したり 辞書を使って対応する処理 単語の正規化、辞書展開
(休憩)全文検索アプリのご紹介
?2020 segavvy 2020/6/25 完全に理解した人達の完全に理解したTalk #6 18
某弊社で Windows PC 内の
ファイルを全文検索するアプリを
無償配布中
全文検索に ご興味がありましたら
ぜひお試しください!
https://www.info-brdg.co.jp/savvy/desktop-search/index.html
デスクトップ検索SAVVY
第3章
ヒトはなぜ全文検索するのか
全文検索の先にあるもの
?2020 segavvy 2020/6/25 完全に理解した人達の完全に理解したTalk #6 19
実は 全文検索したかった訳ではない
役立つ情報が
欲しい!
?2020 segavvy 2020/6/25 完全に理解した人達の完全に理解したTalk #6 20
そのために
全文検索する
いかに
条件に合う結果を
返せるか
いかに
役に立つ情報を
返せるか
昔
今
全文検索で 役立つ情報を返す工夫
1. カテゴライズ?自動分類
見つけやすいように 情報を自動で分類する
2. スコアリング?ランキング
検索結果の中で 役立ちそうな情報を 優先して返す
3. レコメンド
検索結果に限らず 役立ちそうな情報を返す etc.
?2020 segavvy 2020/6/25 完全に理解した人達の完全に理解したTalk #6 21
情報だけでは 満足しなくなってきた
見つかった情報の 分析もして欲しい
情報を解釈して 判断までして欲しい
質問するから 答えを教えて欲しい
持っている情報から 役立つ何かを取り出して
etc.
?2020 segavvy 2020/6/25 完全に理解した人達の完全に理解したTalk #6 22
狙いはその先!
これからは 検索対象の理解が必要
?2020 segavvy 2020/6/25 完全に理解した人達の完全に理解したTalk #6 23
全文検索の対象である 自然言語(人が使う言葉) は
複雑すぎて コンピューターでは 処理しにくかった
AI(機械学習?ディープラーニング)の進歩で
高度な 自然言語処理 の実用化が進んでいます
文章の理解、要約、翻訳、対話、作文、etc.
第3章のまとめ
ヒトは 全文検索 よりも その先の 答え を求め始めています
もし 全文検索 を勉強してみようかなと
思われた方が いらっしゃいましたら
「自然言語処理」から始めることをお勧めします
?2020 segavvy 2020/6/25 完全に理解した人達の完全に理解したTalk #6 24
おわりに
全文検索 の仕組みが なんとなくわかる
そして 自然言語処理 にも興味をもっていただく
これがゴールでした
このお話が 全文検索 や 自然言語処理 に
興味を持っていただく きっかけになれば幸いです
ありがとうございました
?2020 segavvy 2020/6/25 完全に理解した人達の完全に理解したTalk #6 25
参考文献?参考サイト
? 全文検索 - フリー百科事典『ウィキペディア(Wikipedia)』(最終閲覧日:2020/6/20)
https://ja.wikipedia.org/wiki/%E5%85%A8%E6%96%87%E6%A4%9C%E7%B4%A2
? 転置インデックス - フリー百科事典『ウィキペディア(Wikipedia)』(最終閲覧日:2020/6/20)
https://ja.wikipedia.org/wiki/%E8%BB%A2%E7%BD%AE%E3%82%A4%E3%83%B3%E3%83%87%E3%83%83
%E3%82%AF%E3%82%B9
? 自然言語処理 - フリー百科事典『ウィキペディア(Wikipedia)』(最終閲覧日:2020/6/20)
https://ja.wikipedia.org/wiki/%E8%87%AA%E7%84%B6%E8%A8%80%E8%AA%9E%E5%87%A6%E7%90%86
? かわいいフリー素材集『いらすとや』
https://www.irasutoya.com/
?2020 segavvy 2020/6/25 完全に理解した人達の完全に理解したTalk #6 26

More Related Content

Featured (20)

How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthHow Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental Health
ThinkNow
?
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfAI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
marketingartwork
?
Skeleton Culture Code
Skeleton Culture CodeSkeleton Culture Code
Skeleton Culture Code
Skeleton Technologies
?
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024
Neil Kimberley
?
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)
contently
?
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024
Albert Qian
?
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
Kurio // The Social Media Age(ncy)
?
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024
Search Engine Journal
?
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary
SpeakerHub
?
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd
Clark Boyd
?
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next
Tessa Mero
?
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Lily Ray
?
How to have difficult conversations
How to have difficult conversations How to have difficult conversations
How to have difficult conversations
Rajiv Jayarajah, MAppComm, ACC
?
Introduction to Data Science
Introduction to Data ScienceIntroduction to Data Science
Introduction to Data Science
Christy Abraham Joy
?
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best Practices
Vit Horky
?
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project management
MindGenius
?
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
RachelPearson36
?
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Applitools
?
12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work
GetSmarter
?
ChatGPT webinar slides
ChatGPT webinar slidesChatGPT webinar slides
ChatGPT webinar slides
Alireza Esmikhani
?
How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthHow Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental Health
ThinkNow
?
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfAI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
marketingartwork
?
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024
Neil Kimberley
?
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)
contently
?
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024
Albert Qian
?
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024
Search Engine Journal
?
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary
SpeakerHub
?
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd
Clark Boyd
?
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next
Tessa Mero
?
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Lily Ray
?
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best Practices
Vit Horky
?
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project management
MindGenius
?
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
RachelPearson36
?
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Applitools
?
12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work
GetSmarter
?

全文検索 完全に理解した