SlideShare uses cookies to improve functionality and performance, and to provide you with relevant advertising. If you continue browsing the site, you agree to the use of cookies on this website. See our User Agreement and Privacy Policy.
SlideShare uses cookies to improve functionality and performance, and to provide you with relevant advertising. If you continue browsing the site, you agree to the use of cookies on this website. See our Privacy Policy and User Agreement for details.
Successfully reported this slideshow.
Activate your 14 day free trial to unlock unlimited reading.
18.
実演
使い方
use HTML::ExtractContent;
my $extractor = HTML::ExtractContent->new;
my $content = $extractor->extract($html)->as_text;
# or ->as_html;
デモ
伊奈 林太郎 (id:tarao) HTML からの本文抽出
22.
アルゴリズム — ブロックのつながり判定
本文が 1 ブロックとは限らないので適度につなげる
• 高スコアのブロックが連続したらクラスタっぽい
• スコアの低いブロックがきたらクラスタの切れ目っぽい
(ただし直前のブロックのスコアの高さにも配慮)
例:
低 A
高 B
高 C
低 D
低 E
高 F
低 G ← 低いけれど F が超高スコアなので切れ目にしない
高 I
⇒ クラスタは {B, C}, {F, G, I}
伊奈 林太郎 (id:tarao) HTML からの本文抽出
23.
アルゴリズム — 傾斜配点
ブログなどで, コメントは本文より低い点にしたい
• 上にある方が本文っぽいということにする
• スコアは下にいくほど減衰
⇒ 下にいくほどクラスタの切れ目と見なされやすい
例:
低 A
高 B
高 C
低 D
低 E
低 F ← 減衰して低スコアに
低 G
低 I ← 減衰して低スコアに
⇒ クラスタは {B, C}
伊奈 林太郎 (id:tarao) HTML からの本文抽出