SlideShare a Scribd company logo
MIT TWEEQL AND TWITINFO
報告人:政大資科碩一 蕭奕凱
VECK HSIAO
TWEEQL
一種類似SQL的語法
範例:
SELECT text
FROM twitter
WHERE text contains „obama‟
=> 語意:從 twitter 選擇 text 包含有 obama
=> 查詢結果:twitter 上含有字串 “obama” 的最新推文
TWEEQL
目的:提供通用的Tweet存取介面
• 多數的資料探勘或爬蟲程式都是因為專案需求而特別去開發的,致
存取介面無法統一
優點:
• 提供stream string和regular expression
• 用framework找出tweet分類
• 使用者可自訂方法(UDF)轉換非結構化內容
如地理位置轉換為經緯度:”台北 木柵“ => E34'00"24N59'00
• 可能範圍較小的 filter 優先選擇
(減少查詢資料數量)
如: 包含 “obama” 和 “NYC” 只有 100 筆
先查 “obama” 會抓到 1000 筆
先查 “NYC” 會抓到 2000 筆
TWEEQL SYNTAX
SELECT field1, field2
FROM streams
WHERE filter_conditions
GROUP BY field3, field4
WINDOW x seconds
FIELDS
<推文內容>
text: tweet text
location: user-defined location, like „Boston‟
<推文屬性>
lang: user-specified language
profile_image_url: the URL of the user‟s profile image
user_id: the user‟s Twitter userid
screen_name: the user‟s username
created_at: the time of the tweet
LANG
LANG
LANG
LANG
LOCATION
LOCATION
FUNCTIONS ABOUT
TWEETS
sentiment(val):取得推文的 “態度、情緒”
val 是前面提到的 text
情緒分為:positive、negative、neutral
FUNCTIONS ABOUT
TWEETS
tweetLatLng(“lat”)
tweetLatLng(“lng”)
取得推文的經度或緯度
LATITUDE AND
LONGITUDE
FUNCTIONS ABOUT
TWEETS
temperatureF(val)
取得推文中的華氏溫度敘述
也可以偵測到溫度敘述為攝氏者,但會自動轉換為對應的華氏溫度
TEMPERATURE
說明:
不是我只抓一筆就停止
我等待了一段時間才只有抓到這一筆
我在想可能原因是一般推文中會有 temperature 資訊的並不多
AGGREGATE
FUNCTION
AVG: average
COUNT: the number of tweets
SUM: summation
MIN: find the minimum
MAX: find the maximum
TWITINFO
一個利用 TweeQL 實作的查詢範例網站
http://twitinfo.csail.mit.edu/
TWITINFO
TWITINFO
TWITINFO
TWITINFO
在最近的一分鐘
內搜尋到的推文
TWITINFO
在一定歷史區間
內搜尋到的推文
TWITINFO
Flag:
用以對照右邊區
塊中的內容,表
是該尖峰(推文
最多)的時候
TWITINFO
對應左圖的 flags
所顯示的是該尖
峰最常被使用到
與 obama 有關的
keywords
TWITINFO
以地理資訊呈現
Tweets,有三種
顏色來呈現不同
sentiments
Red: negative
Blue: positive
White: neutral
TWITINFO
依時間前後排序
撈到的 tweets,
也有三種顏色
表示不同的
sentiments,
最上面的最靠
近搜尋時間
TWITINFO
轉貼最多的
三個links
TWITINFO
不同 sentiments
百分比的圓餅
示意圖
THANKS FOR ATTENTION!

More Related Content

Viewers also liked (6)

2011中正資管學術部講座 Java-Object
2011中正資管學術部講座 Java-Object2011中正資管學術部講座 Java-Object
2011中正資管學術部講座 Java-Object
 
CCU_Speech
CCU_SpeechCCU_Speech
CCU_Speech
 
Differential pressure control australia case study
Differential pressure control australia  case studyDifferential pressure control australia  case study
Differential pressure control australia case study
 
Sas ibac presentation
Sas  ibac presentationSas  ibac presentation
Sas ibac presentation
 
Ventilation guidelines for minnesota commercial kitchens
Ventilation guidelines for minnesota commercial kitchensVentilation guidelines for minnesota commercial kitchens
Ventilation guidelines for minnesota commercial kitchens
 
Speaking Activity
Speaking ActivitySpeaking Activity
Speaking Activity
 

Tweeql