Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Mining Interest Topics from Plurk by Using Python
Search
Ken Lee
May 24, 2013
Programming
7
280
Mining Interest Topics from Plurk by Using Python
Ken Lee
May 24, 2013
Tweet
Share
More Decks by Ken Lee
See All by Ken Lee
Mining Interest Topics from Plurk by Using Python - Taipei.py
echain
0
97
CitC: Chewing in the Cloud
echain
1
100
Mining Interest Topics from Plurk
echain
2
59
Other Decks in Programming
See All in Programming
童醫院敏捷轉型的實踐經驗
cclai999
0
210
WebViewの現在地 - SwiftUI時代のWebKit - / The Current State Of WebView
marcy731
0
110
iOS 26にアップデートすると実機でのHot Reloadができない?
umigishiaoi
0
120
XP, Testing and ninja testing
m_seki
3
230
Modern Angular with Signals and Signal Store:New Rules for Your Architecture @enterJS Advanced Angular Day 2025
manfredsteyer
PRO
0
200
プロダクト志向ってなんなんだろうね
righttouch
PRO
0
180
Systèmes distribués, pour le meilleur et pour le pire - BreizhCamp 2025 - Conférence
slecache
0
120
Select API from Kotlin Coroutine
jmatsu
1
230
地方に住むエンジニアの残酷な現実とキャリア論
ichimichi
5
1.5k
Railsアプリケーションと パフォーマンスチューニング ー 秒間5万リクエストの モバイルオーダーシステムを支える事例 ー Rubyセミナー 大阪
falcon8823
5
1.1k
GraphRAGの仕組みまるわかり
tosuri13
8
530
PostgreSQLのRow Level SecurityをPHPのORMで扱う Eloquent vs Doctrine #phpcon #track2
77web
2
500
Featured
See All Featured
We Have a Design System, Now What?
morganepeng
53
7.7k
For a Future-Friendly Web
brad_frost
179
9.8k
Intergalactic Javascript Robots from Outer Space
tanoku
271
27k
How to Think Like a Performance Engineer
csswizardry
24
1.7k
Side Projects
sachag
455
42k
The Art of Programming - Codeland 2020
erikaheidi
54
13k
Making the Leap to Tech Lead
cromwellryan
134
9.4k
The Straight Up "How To Draw Better" Workshop
denniskardys
234
140k
How To Stay Up To Date on Web Technology
chriscoyier
790
250k
The MySQL Ecosystem @ GitHub 2015
samlambert
251
13k
It's Worth the Effort
3n
185
28k
Imperfection Machines: The Place of Print at Facebook
scottboms
267
13k
Transcript
Mining Interest Topics from Plurk by Using Python
[email protected]
About Me * Ken Lee * @echain * Developer at
Synology Inc. * Worked for NCTU CSCC * Just graduated from NCTU
很久很久以前...
D-1268 #GoPlurk
None
>>> import Java Traceback (most recent call last): File "<stdin>",
line 1, in <module> ImportError: No module named Java
>>> import Java Traceback (most recent call last): File "<stdin>",
line 1, in <module> ImportError: No module named Java >>> >>> import PHP Traceback (most recent call last): File "<stdin>", line 1, in <module> ImportError: No module named PHP
D-848 NSC College Student Creative Research Award
None
D-701 #ECPlurk
>>> from multiprocessing import Process >>> import multiprocessing.connection >>> import
MySQLdb >>> import re >>> import urllib2
>>> from multiprocessing import Process >>> import multiprocessing.connection >>> import
MySQLdb >>> import re >>> import urllib2 >>> >>> import ecspy >>> from matplotlib import pyplot
None
None
D-270 Happy b-day to Taeyeon
None
None
None
None
None
None
None
None
None
None
None
D-260 Happy b-day to Emily
「開工!!! 先把資料撈回來。」 \(▔□▔")/
# pacman -S python2-pip # cd /usr/bin # ln -s
pip2 pip # pip install plurk-oauth $ python2 >>> from PlurkAPI import PlurkAPI
「嗚… 系工作站有資源 限制,multiprocessing 會用掉一堆記憶體。」 \(▔□▔")/
# pip install gevent $ python2 >>> from gevent import
monkey >>> from gevent.pool import Pool >>> from gevent.queue import Queue
「砍站的速度不太理想, 似乎是因為 oauth2 用 的 httplib 效能很差。」 \(▔□▔")/
# pip install urllib3 $ python2 >>> import urllib3 >>>
urllib3.connection_from_url()
D-230 Happy b-day to Jessica
「噗哈哈哈… 朋友和粉絲的關聯 終於重新爬完了。」 (・ω・。)
None
MariaDB [plurk]> SHOW TABLE STATUS; +---------+-----------+------------+ | Name | Data
| Index | +---------+-----------+------------+ | fans | 233720343 | 901548032 | | friends | 421496919 | 1625860096 | | users | 189420940 | 79509504 | +---------+-----------+------------+
「索引的大小比資料 還要肥是怎樣?」 ヾ(゚▽゚*)ノ
# pacman -S redis # pip install redis $ python2
>>> import redis >>> from retry import retry
「A Multi-Level Aggregation Method for optimizing modularity; Louvain method」 ヾ(゚▽゚*)ノ
「糟糕,用 CPython 跑 @jserv 的 test case 要七分半才跑得完。」 ヾ(゚▽゚*)ノ
# pacman -S pypy # pypy get-pip.py # pip install
networkx $ pypy >>> import networkx >>> import community
「讚,現在最慢三十秒就 可以人肉 @jserv 了。」 ヾ(゚▽゚*)ノ
D-188 Happy b-day to Yoona
「報告老師,實驗室的 儲存空間不夠了。」 ( ̄﹁ ̄)
老師說:「要有機器。」 就有了機器。 ( ̄﹁ ̄)
None
「現在有二十台機器可以 用,來玩玩看新的砍站 架構吧!」 ( ̄﹁ ̄)
# pacman -S zeromq # pip install pyzmq # pip
install msgpack-python $ python2 >>> import zmq >>> import msgpack
None
「呃… CPU 使用率怎麼會 這麼高? I/O bound 變 成 CPU bound
了 ?!」 ಠ_ಠ
$ free -h total used Mem: 15G 15G -/+ buffers/cache:
8.9G Swap: 251M 3.8M $ cat /proc/cpuinfo ... model name: Dual Core AMD Opteron(tm) Processor 270 ...
「骨董 CPU 不意外… 算 HMAC-SHA1 和解 JSON 花太多時間。」 (´・ω・`)
# pacman -S openssl # pip install ujson $ python2
>>> import hmac_sha1 >>> import ujson
D-159 Happy b-day to Seohyun
「用 MySQL 存噗文有 點不太直覺,來試試很 潮的 MongoDB。」 ( ̄﹁ ̄)
「20 = (1+9) * 2 = 兩隊少女時代 + 兩位經紀人」 \⊙▽⊙/
「那就把這些機器組成 Replicated Sharded MongoDB cluster 吧。」 ‧★,:*:‧\( ̄▽ ̄)/‧:*‧°★*
None
None
「噗文全部抓回來了, 可是內容夾雜了英文、 中文和火星文…」 ヾ(゚▽゚*)ノ
「CKIP 在學校的 mirror 被入侵關機中。」 \(▔□▔")/ 「而且 CKIP 看不懂英 文,只能斷中文詞。」
「自幹斷詞系統。」 ヾ(゚▽゚*)ノ
# pip install regex # pip install marisa-trie # pip
install sqlalchemy $ python2 >>> import regex >>> import marisa_trie >>> import sqlalchemy
D-120 Happy b-day to Helena
老師說:「系統的網頁 前端不要用 PHP 寫。」 Σヽ(゚Д ゚; )ノ
None
「現在放棄的話, 就要準備去當兵囉。」 _(:3」∠)_
# pacman -S mod_wsgi2 # pacman -S memcached # pip
install flask $ python2 >>> from gevent.wsgi \ import WSGIServer >>> import flask
老師說:「系統要能同 時讓多人連線使用,算 community 要夠快。」 Σヽ(゚Д ゚; )ノ
None
「我們實驗室的工作站 只有 16 核心可以用。」 ヾ(゚▽゚*)ノ
「團結就是力量。」 \⊙▽⊙/
$ yaourt -S rabbitmq # pip install celery $ python2
>>> import celery
None
None
D-55 National Day of Taiwan
「論文快寫完了,來幫這次 做的系統取個名字。」 ( ̄﹁ ̄)
「Social Networking Service Discovery (SNSD) system」 ヾ(゚▽゚*)ノ
「好巧!少女時代的簡寫 也是 SNSD 耶!」 \⊙▽⊙/
$ whois snsd.tw Domain Name: snsd.tw Contact: Ken Lee
[email protected]
Record expires on 2013-10-11 (YYYY-MM-DD) Record created on 2012-10-10 (YYYY-MM-DD) Registration Service Provider: APT
D-31 Happy b-day to Anne
None
None
None
None
None
None
D-7 Thesis oral presentation
None
None
None
D-Day Graduated!!!
None
None
結論
* 可嘗試使用 NoSQL 來解決問題 * 不夠快?寫 C-extension * 跟 C
不熟?那就交給 pypy 吧! * pypi 上的套件很多,多看多比較 * 要感謝的人太多了,就感謝 * 少女時代吧!