Suche senden
Hochladen
PHP Source Code Search with PHP
•
3 gefällt mir
•
1,581 views
Sotaro Karasawa
Folgen
@PHP勉強会#46 ソース検索をPHPでつくる
Weniger lesen
Mehr lesen
Technologie
Melden
Teilen
Melden
Teilen
1 von 40
Jetzt herunterladen
Downloaden Sie, um offline zu lesen
Empfohlen
RubyもApache Arrowでデータ処理言語の仲間入り
RubyもApache Arrowでデータ処理言語の仲間入り
Kouhei Sutou
Apache ArrowのRubyバインディングをGObject Introspectionで
Apache ArrowのRubyバインディングをGObject Introspectionで
Kouhei Sutou
Hotel reservation system
Hotel reservation system
Manoj Malshan
Hotel Reservation System Project
Hotel Reservation System Project
raj_qn3
Online hotel booking application - Design Process
Online hotel booking application - Design Process
chayapathi sarath
Students report card for C++ project..
Students report card for C++ project..
Syed Muhammad Zeejah Hashmi
Hotel Management System Final Report
Hotel Management System Final Report
Charitha Gamage
Project Proposal document for Hotel Management System
Project Proposal document for Hotel Management System
Charitha Gamage
Empfohlen
RubyもApache Arrowでデータ処理言語の仲間入り
RubyもApache Arrowでデータ処理言語の仲間入り
Kouhei Sutou
Apache ArrowのRubyバインディングをGObject Introspectionで
Apache ArrowのRubyバインディングをGObject Introspectionで
Kouhei Sutou
Hotel reservation system
Hotel reservation system
Manoj Malshan
Hotel Reservation System Project
Hotel Reservation System Project
raj_qn3
Online hotel booking application - Design Process
Online hotel booking application - Design Process
chayapathi sarath
Students report card for C++ project..
Students report card for C++ project..
Syed Muhammad Zeejah Hashmi
Hotel Management System Final Report
Hotel Management System Final Report
Charitha Gamage
Project Proposal document for Hotel Management System
Project Proposal document for Hotel Management System
Charitha Gamage
PHPで並列処理する ライブラリを作った
PHPで並列処理する ライブラリを作った
Hironobu Saitoh
第67回PHP勉強会LT
第67回PHP勉強会LT
Hideyuki Shimooka
PEP8を読んでみよう
PEP8を読んでみよう
2bo 2bo
社内Chef勉強会
社内Chef勉強会
Masaaki Uchida
Smalltalk との比較で深まる Citrine の理解
Smalltalk との比較で深まる Citrine の理解
TAKANO Mitsuhiro
4時間耐久 PHP on Heroku
4時間耐久 PHP on Heroku
Yusuke Ando
LLプログラマ向けSwift ExtensionsとテストライブラリQuickの紹介
LLプログラマ向けSwift ExtensionsとテストライブラリQuickの紹介
Shoken Fujisaki
Oktavia全文検索エンジン - SphinxCon JP 2014
Oktavia全文検索エンジン - SphinxCon JP 2014
Yoshiki Shibukawa
PSR-3 Logger Interfaceの紹介
PSR-3 Logger Interfaceの紹介
Hiraku Nakano
第67回PHP勉強会LT(その2)
第67回PHP勉強会LT(その2)
Hideyuki Shimooka
anything-php-funcref-perl.el
anything-php-funcref-perl.el
Kenichirou Oyama
FukuokaPHP 3
FukuokaPHP 3
ichikaway
8時間耐久 PHP構築の教室
8時間耐久 PHP構築の教室
Yusuke Ando
「Python言語」はじめの一歩 / First step of Python
「Python言語」はじめの一歩 / First step of Python
Takanori Suzuki
composer-scriptsについて
composer-scriptsについて
Hiraku Nakano
PyScriptの紹介
PyScriptの紹介
2bo 2bo
私の好きなPython構文 vol.2 #nds46
私の好きなPython構文 vol.2 #nds46
civicpg
今時のオンプレなgithubクローン環境構築
今時のオンプレなgithubクローン環境構築
You&I
GiNZAで始める日本語依存構造解析 〜CaboCha, UDPipe, Stanford NLPとの比較〜
GiNZAで始める日本語依存構造解析 〜CaboCha, UDPipe, Stanford NLPとの比較〜
Megagon Labs
PHP buildpackでhackとphalconが動いた件について
PHP buildpackでhackとphalconが動いた件について
健治郎 安井
Ethna Updates
Ethna Updates
Sotaro Karasawa
Openpear Project の紹介
Openpear Project の紹介
Sotaro Karasawa
Weitere ähnliche Inhalte
Ähnlich wie PHP Source Code Search with PHP
PHPで並列処理する ライブラリを作った
PHPで並列処理する ライブラリを作った
Hironobu Saitoh
第67回PHP勉強会LT
第67回PHP勉強会LT
Hideyuki Shimooka
PEP8を読んでみよう
PEP8を読んでみよう
2bo 2bo
社内Chef勉強会
社内Chef勉強会
Masaaki Uchida
Smalltalk との比較で深まる Citrine の理解
Smalltalk との比較で深まる Citrine の理解
TAKANO Mitsuhiro
4時間耐久 PHP on Heroku
4時間耐久 PHP on Heroku
Yusuke Ando
LLプログラマ向けSwift ExtensionsとテストライブラリQuickの紹介
LLプログラマ向けSwift ExtensionsとテストライブラリQuickの紹介
Shoken Fujisaki
Oktavia全文検索エンジン - SphinxCon JP 2014
Oktavia全文検索エンジン - SphinxCon JP 2014
Yoshiki Shibukawa
PSR-3 Logger Interfaceの紹介
PSR-3 Logger Interfaceの紹介
Hiraku Nakano
第67回PHP勉強会LT(その2)
第67回PHP勉強会LT(その2)
Hideyuki Shimooka
anything-php-funcref-perl.el
anything-php-funcref-perl.el
Kenichirou Oyama
FukuokaPHP 3
FukuokaPHP 3
ichikaway
8時間耐久 PHP構築の教室
8時間耐久 PHP構築の教室
Yusuke Ando
「Python言語」はじめの一歩 / First step of Python
「Python言語」はじめの一歩 / First step of Python
Takanori Suzuki
composer-scriptsについて
composer-scriptsについて
Hiraku Nakano
PyScriptの紹介
PyScriptの紹介
2bo 2bo
私の好きなPython構文 vol.2 #nds46
私の好きなPython構文 vol.2 #nds46
civicpg
今時のオンプレなgithubクローン環境構築
今時のオンプレなgithubクローン環境構築
You&I
GiNZAで始める日本語依存構造解析 〜CaboCha, UDPipe, Stanford NLPとの比較〜
GiNZAで始める日本語依存構造解析 〜CaboCha, UDPipe, Stanford NLPとの比較〜
Megagon Labs
PHP buildpackでhackとphalconが動いた件について
PHP buildpackでhackとphalconが動いた件について
健治郎 安井
Ähnlich wie PHP Source Code Search with PHP
(20)
PHPで並列処理する ライブラリを作った
PHPで並列処理する ライブラリを作った
第67回PHP勉強会LT
第67回PHP勉強会LT
PEP8を読んでみよう
PEP8を読んでみよう
社内Chef勉強会
社内Chef勉強会
Smalltalk との比較で深まる Citrine の理解
Smalltalk との比較で深まる Citrine の理解
4時間耐久 PHP on Heroku
4時間耐久 PHP on Heroku
LLプログラマ向けSwift ExtensionsとテストライブラリQuickの紹介
LLプログラマ向けSwift ExtensionsとテストライブラリQuickの紹介
Oktavia全文検索エンジン - SphinxCon JP 2014
Oktavia全文検索エンジン - SphinxCon JP 2014
PSR-3 Logger Interfaceの紹介
PSR-3 Logger Interfaceの紹介
第67回PHP勉強会LT(その2)
第67回PHP勉強会LT(その2)
anything-php-funcref-perl.el
anything-php-funcref-perl.el
FukuokaPHP 3
FukuokaPHP 3
8時間耐久 PHP構築の教室
8時間耐久 PHP構築の教室
「Python言語」はじめの一歩 / First step of Python
「Python言語」はじめの一歩 / First step of Python
composer-scriptsについて
composer-scriptsについて
PyScriptの紹介
PyScriptの紹介
私の好きなPython構文 vol.2 #nds46
私の好きなPython構文 vol.2 #nds46
今時のオンプレなgithubクローン環境構築
今時のオンプレなgithubクローン環境構築
GiNZAで始める日本語依存構造解析 〜CaboCha, UDPipe, Stanford NLPとの比較〜
GiNZAで始める日本語依存構造解析 〜CaboCha, UDPipe, Stanford NLPとの比較〜
PHP buildpackでhackとphalconが動いた件について
PHP buildpackでhackとphalconが動いた件について
Mehr von Sotaro Karasawa
Ethna Updates
Ethna Updates
Sotaro Karasawa
Openpear Project の紹介
Openpear Project の紹介
Sotaro Karasawa
Modern PHP Programming @ PFI Seminar
Modern PHP Programming @ PFI Seminar
Sotaro Karasawa
Internship at PFI
Internship at PFI
Sotaro Karasawa
フレームワークxWordPress
フレームワークxWordPress
Sotaro Karasawa
新しくなったOpenpear by nequal
新しくなったOpenpear by nequal
Sotaro Karasawa
第42PHP勉強会Ethna 発表資料
第42PHP勉強会Ethna 発表資料
Sotaro Karasawa
Introduction of openpear
Introduction of openpear
Sotaro Karasawa
超個人的宣伝と2008年PHPのまとめ
超個人的宣伝と2008年PHPのまとめ
Sotaro Karasawa
openpearについて@楽天テクノロジーカンファレンス
openpearについて@楽天テクノロジーカンファレンス
Sotaro Karasawa
LT openpear@LL温泉
LT openpear@LL温泉
Sotaro Karasawa
PHP超入門@LL温泉
PHP超入門@LL温泉
Sotaro Karasawa
Mockingbirdの紹介LT@PHP勉強会
Mockingbirdの紹介LT@PHP勉強会
Sotaro Karasawa
Ethna的ActionとView@設計勉強会
Ethna的ActionとView@設計勉強会
Sotaro Karasawa
Mockingbirdイベントハンドリング@拡張機能勉強会
Mockingbirdイベントハンドリング@拡張機能勉強会
Sotaro Karasawa
Mockingbirdサーバサイド@拡張機能勉強会
Mockingbirdサーバサイド@拡張機能勉強会
Sotaro Karasawa
Mockingbird@拡張機能勉強会
Mockingbird@拡張機能勉強会
Sotaro Karasawa
Mockingbirdの実装@拡張機能勉強会
Mockingbirdの実装@拡張機能勉強会
Sotaro Karasawa
Mockingbirdのタブバーの実装@拡張機能勉強会
Mockingbirdのタブバーの実装@拡張機能勉強会
Sotaro Karasawa
第34回PHP勉強会発表資料 SimpleXML
第34回PHP勉強会発表資料 SimpleXML
Sotaro Karasawa
Mehr von Sotaro Karasawa
(20)
Ethna Updates
Ethna Updates
Openpear Project の紹介
Openpear Project の紹介
Modern PHP Programming @ PFI Seminar
Modern PHP Programming @ PFI Seminar
Internship at PFI
Internship at PFI
フレームワークxWordPress
フレームワークxWordPress
新しくなったOpenpear by nequal
新しくなったOpenpear by nequal
第42PHP勉強会Ethna 発表資料
第42PHP勉強会Ethna 発表資料
Introduction of openpear
Introduction of openpear
超個人的宣伝と2008年PHPのまとめ
超個人的宣伝と2008年PHPのまとめ
openpearについて@楽天テクノロジーカンファレンス
openpearについて@楽天テクノロジーカンファレンス
LT openpear@LL温泉
LT openpear@LL温泉
PHP超入門@LL温泉
PHP超入門@LL温泉
Mockingbirdの紹介LT@PHP勉強会
Mockingbirdの紹介LT@PHP勉強会
Ethna的ActionとView@設計勉強会
Ethna的ActionとView@設計勉強会
Mockingbirdイベントハンドリング@拡張機能勉強会
Mockingbirdイベントハンドリング@拡張機能勉強会
Mockingbirdサーバサイド@拡張機能勉強会
Mockingbirdサーバサイド@拡張機能勉強会
Mockingbird@拡張機能勉強会
Mockingbird@拡張機能勉強会
Mockingbirdの実装@拡張機能勉強会
Mockingbirdの実装@拡張機能勉強会
Mockingbirdのタブバーの実装@拡張機能勉強会
Mockingbirdのタブバーの実装@拡張機能勉強会
第34回PHP勉強会発表資料 SimpleXML
第34回PHP勉強会発表資料 SimpleXML
Kürzlich hochgeladen
Amazon SES を勉強してみる その22024/04/26の勉強会で発表されたものです。
Amazon SES を勉強してみる その22024/04/26の勉強会で発表されたものです。
iPride Co., Ltd.
Observabilityは従来型の監視と何が違うのか(キンドリルジャパン社内勉強会:2022年10月27日発表)
Observabilityは従来型の監視と何が違うのか(キンドリルジャパン社内勉強会:2022年10月27日発表)
Hiroshi Tomioka
論文紹介:Video-GroundingDINO: Towards Open-Vocabulary Spatio-Temporal Video Groun...
論文紹介:Video-GroundingDINO: Towards Open-Vocabulary Spatio-Temporal Video Groun...
Toru Tamaki
LoRaWAN スマート距離検出デバイスDS20L日本語マニュアル
LoRaWAN スマート距離検出デバイスDS20L日本語マニュアル
CRI Japan, Inc.
論文紹介: The Surprising Effectiveness of PPO in Cooperative Multi-Agent Games
論文紹介: The Surprising Effectiveness of PPO in Cooperative Multi-Agent Games
atsushi061452
Amazon SES を勉強してみる その32024/04/26の勉強会で発表されたものです。
Amazon SES を勉強してみる その32024/04/26の勉強会で発表されたものです。
iPride Co., Ltd.
Utilizing Ballerina for Cloud Native Integrations
Utilizing Ballerina for Cloud Native Integrations
WSO2
LoRaWANスマート距離検出センサー DS20L カタログ LiDARデバイス
LoRaWANスマート距離検出センサー DS20L カタログ LiDARデバイス
CRI Japan, Inc.
知識ゼロの営業マンでもできた!超速で初心者を脱する、悪魔的学習ステップ3選.pptx
知識ゼロの営業マンでもできた!超速で初心者を脱する、悪魔的学習ステップ3選.pptx
sn679259
新人研修 後半 2024/04/26の勉強会で発表されたものです。
新人研修 後半 2024/04/26の勉強会で発表されたものです。
iPride Co., Ltd.
論文紹介:Selective Structured State-Spaces for Long-Form Video Understanding
論文紹介:Selective Structured State-Spaces for Long-Form Video Understanding
Toru Tamaki
Kürzlich hochgeladen
(11)
Amazon SES を勉強してみる その22024/04/26の勉強会で発表されたものです。
Amazon SES を勉強してみる その22024/04/26の勉強会で発表されたものです。
Observabilityは従来型の監視と何が違うのか(キンドリルジャパン社内勉強会:2022年10月27日発表)
Observabilityは従来型の監視と何が違うのか(キンドリルジャパン社内勉強会:2022年10月27日発表)
論文紹介:Video-GroundingDINO: Towards Open-Vocabulary Spatio-Temporal Video Groun...
論文紹介:Video-GroundingDINO: Towards Open-Vocabulary Spatio-Temporal Video Groun...
LoRaWAN スマート距離検出デバイスDS20L日本語マニュアル
LoRaWAN スマート距離検出デバイスDS20L日本語マニュアル
論文紹介: The Surprising Effectiveness of PPO in Cooperative Multi-Agent Games
論文紹介: The Surprising Effectiveness of PPO in Cooperative Multi-Agent Games
Amazon SES を勉強してみる その32024/04/26の勉強会で発表されたものです。
Amazon SES を勉強してみる その32024/04/26の勉強会で発表されたものです。
Utilizing Ballerina for Cloud Native Integrations
Utilizing Ballerina for Cloud Native Integrations
LoRaWANスマート距離検出センサー DS20L カタログ LiDARデバイス
LoRaWANスマート距離検出センサー DS20L カタログ LiDARデバイス
知識ゼロの営業マンでもできた!超速で初心者を脱する、悪魔的学習ステップ3選.pptx
知識ゼロの営業マンでもできた!超速で初心者を脱する、悪魔的学習ステップ3選.pptx
新人研修 後半 2024/04/26の勉強会で発表されたものです。
新人研修 後半 2024/04/26の勉強会で発表されたものです。
論文紹介:Selective Structured State-Spaces for Long-Form Video Understanding
論文紹介:Selective Structured State-Spaces for Long-Form Video Understanding
PHP Source Code Search with PHP
1.
PHP Source Code
Search with PHP 柄沢聡太郎 (sotarok) http://nequal.jp/ twitter.com/sotarok
2.
始める前に
Copyright © nequal, Creative Commons Attribution- Noncommercial 2.1 @ PHP Study #46.
3.
今⽇はPHP勉強会
Copyright © nequal, Creative Commons Attribution- Noncommercial 2.1 @ PHP Study #46.
4.
なぜ 9/29 ではないのか
Copyright © nequal, Creative Commons Attribution- Noncommercial 2.1 @ PHP Study #46.
5.
懇親会はピザだって?
Copyright © nequal, Creative Commons Attribution- Noncommercial 2.1 @ PHP Study #46.
6.
⾁はどうしたんですか
Copyright © nequal, Creative Commons Attribution- Noncommercial 2.1 @ PHP Study #46.
7.
本来のPHP勉強会
Copyright © nequal, Creative Commons Attribution- Noncommercial 2.1 @ PHP Study #46.
8.
PHPerは ⾁の精神を忘れ てしまったか
Copyright © nequal, Creative Commons Attribution- Noncommercial 2.1 @ PHP Study #46.
9.
ごめんなさい冗談です gusagiさん幹事おつかれさまです
Copyright © nequal, Creative Commons Attribution- Noncommercial 2.1 @ PHP Study #46.
10.
じこしょうかい
11.
sotarok •
そうたろう(けー) • プリン • プリン • プリン • pudding • プリン • ⾁ • ごはん • 自転⾞ • 写真 – Sony α 300 • Ethna • nequal Copyright © nequal, Creative Commons Attribution- Noncommercial 2.1 @ PHP Study #46.
12.
宣伝 • WikiHub
– http://wikihub.org/ – Git で⽂書管理して,それを Wiki 形式で整形して 表⽰ – GitHub の Service Hook で簡単同期 • 制限つきOpenBeta – 100⼈まで Copyright © nequal, Creative Commons Attribution- Noncommercial 2.1 @ PHP Study #46.
13.
宣伝2
なぜか誰も 買ってこない • プリンが好きです Copyright © nequal, Creative Commons Attribution- Noncommercial 2.1 @ PHP Study #46.
14.
宣伝2
yuchimiriさんに RTまでされたのに • プリンが好きです Copyright © nequal, Creative Commons Attribution- Noncommercial 2.1 @ PHP Study #46.
15.
検索エンジンとか
つくってるとこ! Preferred Infrastructure (PFI) というところでインターンやってます だからか だからです Copyright © nequal, Creative Commons Attribution- Noncommercial 2.1 @ PHP Study #46.
16.
Agenda •
検索エンジン • 転置インデックス • クロールとキーワード抽出 • スコアリングと並び替え • デモ • 技術的な課題とか Copyright © nequal, Creative Commons Attribution- Noncommercial 2.1 @ PHP Study #46.
17.
検索エンジン • キーワードを⼊⼒ –
→ そのキーワードが含まれる(そして探したいと 思われる)⽂書が探せる • ソースコード検索 – grep – gtags (GNU GLOBAL) – trac + Hyper Estraier (BTS + Plugin) – Google Code Search Copyright © nequal, Creative Commons Attribution- Noncommercial 2.1 @ PHP Study #46.
18.
grep • 与えられたキーワードをファイルをたどり,⽂字
列⼀致で探す • 前処理が必要ない • どこにでも⼊ってる grepのデメリット • 大量の⽂書から探すのは時間がかかる – 同じキーワードで再検索するときもまた同じ処理 • ランキングづけができない Copyright © nequal, Creative Commons Attribution- Noncommercial 2.1 @ PHP Study #46.
19.
検索エンジンを作る • 既存のいろんなソフトウェアを使うのもいいけど • 「検索エンジン」
– そんな難しくない – PHPでもできる – カンタンだよ! • 今回の目標 – ローカルのPHPソースファイルからメソッドや関数 や変数を検索できるようにする – ディレクトリを指定して,再帰的にPHPファイルを 検索 – grep -rn 'substr' **/*.php Copyright © nequal, Creative Commons Attribution- Noncommercial 2.1 @ PHP Study #46.
20.
転置インデックス
21.
転置インデックス • キーワードから⽂書を逆引きできるようにあらか
じめつくっておくインデックス • 焼⾁ => – ⽜角 – Wikipedia – 焼⾁ – YAKINIQUEST - ヤキニクエスト – ... Copyright © nequal, Creative Commons Attribution- Noncommercial 2.1 @ PHP Study #46.
22.
※⽂書はフィクションです ⽂書1 I like Sushi,
Yakiniku and pudding ! ⽂書2 PHPer like Yakiniku. Maybe not like Sushi. ⽂書3 Dankogai is an enemy of PHPer. Copyright © nequal, Creative Commons Attribution- Noncommercial 2.1 @ PHP Study #46.
23.
※⽂書はフィクションです ⽂書1 I like Sushi
, Yakiniku and pudding ! ⽂書2 PHPer like Yakiniku. Maybe not like Sushi. ⽂書3 Dankogai is an enemy of PHPer. He also like Yakiniku. Copyright © nequal, Creative Commons Attribution- Noncommercial 2.1 @ PHP Study #46.
24.
Sushi
1 ⽂書1 I like Sushi, Yakiniku and pudding ! ⽂書2 PHPer like Yakiniku. Maybe not like ⽂書3 Sushi. Dankogai is an enemy of PHPer. He also like Yakiniku. Copyright © nequal, Creative Commons Attribution- Noncommercial 2.1 @ PHP Study #46.
25.
Sushi
1 Yakiniku 1 ⽂書1 I like Sushi, Yakiniku and pudding ! ⽂書2 PHPer like Yakiniku. Maybe not like ⽂書3 Sushi. Dankogai is an enemy of PHPer. He also like Yakiniku. Copyright © nequal, Creative Commons Attribution- Noncommercial 2.1 @ PHP Study #46.
26.
Sushi
1 Yakiniku 1 pudding 1 ⽂書1 I like Sushi, Yakiniku and pudding ! ⽂書2 PHPer like Yakiniku. Maybe not like ⽂書3 Sushi. Dankogai is an enemy of PHPer. He also like Yakiniku. Copyright © nequal, Creative Commons Attribution- Noncommercial 2.1 @ PHP Study #46.
27.
Sushi
1 Yakiniku 1 2 pudding 1 ⽂書1 I like Sushi, Yakiniku and pudding ! ⽂書2 PHPer like Yakiniku. Maybe not like ⽂書3 Sushi. Dankogai is an enemy of PHPer. He also like Yakiniku. Copyright © nequal, Creative Commons Attribution- Noncommercial 2.1 @ PHP Study #46.
28.
Sushi
1 2 Yakiniku 1 2 pudding 1 ⽂書1 I like Sushi, Yakiniku and pudding ! ⽂書2 PHPer like Yakiniku. Maybe not like ⽂書3 Sushi. Dankogai is an enemy of PHPer. He also like Yakiniku. Copyright © nequal, Creative Commons Attribution- Noncommercial 2.1 @ PHP Study #46.
29.
転置インデックスをPHPで • array
でしょJK $inverted_index = array( 'miyazaki' => array(1, 2, 6, 4 ...), 'aoi' => array(2, 6, 7, ...), 'sotarok' => array(...), ... ); 配列のキー: 配列の要素: 単語 ⽂書IDのリスト Copyright © nequal, Creative Commons Attribution- Noncommercial 2.1 @ PHP Study #46.
30.
クロールとキーワード抽出
31.
クロールとキーワード抽出 • 対象の⽂書からキーワードを拾い集める • クローラー
-> Google なら Google Bot とか • キーワード -> – 空⽩区切りの⽂字列(英語圏のひと) – 形態素解析(明⽇ は あめ だ) – n-gram • n⽂字区切りでキーワードにする • 2-gram(bi-gram) • 明⽇ ⽇は はあ あめ めだ Copyright © nequal, Creative Commons Attribution- Noncommercial 2.1 @ PHP Study #46.
32.
クロールとキーワード抽出をPHPで(1) •function crawl ($dirname)
• foreach(glob($dirname . "/*") as $file) • if is_dir($file): • $files += crawl ($file) • else: • if $file ~= /.+¥.php$/ • $files[] = $file • return $files Copyright © nequal, Creative Commons Attribution- Noncommercial 2.1 @ PHP Study #46.
33.
クロールとキーワード抽出をPHPで(2) • キーワードの抽出
– 関数名/メソッド名/クラス名/変数名 – tokenizer を使う • token_get_all • PHP • tokenize • http://php.net/tokenizer • T_STRING • T_VARIABLE Copyright © nequal, Creative Commons Attribution- Noncommercial 2.1 @ PHP Study #46.
34.
スコアリングと並び替え
35.
スコアリングと並び替え • なにかの基準で検索結果を並び替える • あてはまりの良い⽂書を上に出す •
普通の検索 なら – ページランク (Google のウェブ検索) – TF-IDF • ⽂書中の単語の出現頻度 • その単語の⽂書全体での珍しさ – ... Copyright © nequal, Creative Commons Attribution- Noncommercial 2.1 @ PHP Study #46.
36.
スコアリングと並び替えをPHPで • スコアはソースコード中のそのキーワードの出現
数 • 多い順に並び替え PHP 5.3 なら function($v1, $v2) uasort( でいける! $scored, create_function( '$v1, $v2', 'return $v1[¥'count¥'] < $v2[¥'count¥'];' ) ); Copyright © nequal, Creative Commons Attribution- Noncommercial 2.1 @ PHP Study #46.
37.
デモ Hyper Pudding http://gist.github.com/192879
38.
技術的な課題 • デモったやつは全部 on
memory – 大規模⽂書はイケない • symfony で 140MB くらい⾷うかな – ということで,転置インデックスを外部ファイル (Key-Value Store... まぁ,SQLite とかでもいい けど) に保持するといい • 並び替えの基準は出現頻度でいいの? – これはまあ難しいですね – 属性情報とかいろいろとればさらに • And/Or 検索 Copyright © nequal, Creative Commons Attribution- Noncommercial 2.1 @ PHP Study #46.
39.
まとめ • 簡単な検索エンジンはPHPでもつくれる –
それもお⼿軽に • インデックスをあらかじめつくっておけば検索は 瞬時にできる • 検索技術とか楽しい Copyright © nequal, Creative Commons Attribution- Noncommercial 2.1 @ PHP Study #46.
40.
ありがとうございました Question?
Jetzt herunterladen