Appendix: Term Dictionary
Below is an outline of our term structure for querying the PeopleBrowsr Datamine. For any "term" below, a keyword or #hashtag may take its place. For some APIs, an @name can also be entered.
General
Sources: Twitter, Facebook, Blogs
Simple
Query | Description | Example | Explanation |
[term] | Finds the term | term=car | Finds the word car and also related words like cars |
"[term]" | Finds the exact term | term="car" | Finds the exact word car |
[term]* | Find words starting with term | term=car* | Finds any word starting with car, including car, cars, and carrot |
Complex
Query | Description | Example | Explanation |
[term1] [term2] | Find messages with both term1 and term2 | term=red car | Finds messages with both red and car, or related words, anywhere in the message |
[term1] [term2] [term3] | Find messages with either term1, term2, or term3 | term=red blue car | Finds messages with red or blue or car - for queries with three or more terms |
"[term1] [term2]" | Find messages with the exact two-word term | term="red car" | Finds messages with the exact phrase "red car" |
[term1] AND [term2] | Find messages with both term1 and term2 | red AND car | Finds messages with both red and car, or related words |
[term1] OR [term2] | Find messages with either term1 or term2 | term=red OR car | Finds messages with either red or car (or both) (or related words) |
[term1] NOT [term2] | Find messages with term1 but not term2 | term=red NOT car | Finds messages with red but not car |
[term1] XOR [term2] | Find messages with term1 or term2 but not both | term=red XOR car | Finds messages with red or car but not both |
[term1] NEAR [term2] | Find messages where term1 appears within 10 words of term2 | term=red NEAR car | Finds messages with red near (within 10 words of) car |
[term1] NEAR/3 [term2] | Find messages where term1 appears within 3 words of term2 | term=red NEAR/3 car | Finds messages with red near (within 3 words of) car |
[term1] ADJ [term2] | Find messages where term1 appears within 10 words of term2, in that order | term=red ADJ car | Finds messages with red near (within 10 words of) car, and appearing in that order |
[term1] ADJ/3 [term2] | Find messages where term1 appears within 3 words of term2, in that order | term=red ADJ/3 car | Finds messages with red near (within 3 words of) car, and appearing in that order |
+[term1] [term2] | Find messages with term1 and preferably term2 | term=+red car | Finds messages with red and preferably car (most useful when searching for best match) |
+[term1] -[term2] | Find messages with term1 and not term2 | term=+red -car | Finds messages with red and not car |
([term1] OR [term2]) AND [term3] | Find messages with either term1 or term2, and also term3 | term=(red OR blue) AND car | Finds messages with either red or blue, and car |
Advanced
Sources: Twitter, Facebook, Blogs
Query | Description | Example | Explanation |
name:[username]* | @[username] | Finds messages that user or refer to username | term=@jack |
from:[username]** | user:[username] | Find messages from a username | term=user:jack |
ref:[username]*** | Find messages referencing to a username | term=ref:kevinrose | |
tag:[hashtag] | #[hashtag] | Finds messages mentioning a hashtag | term=tag:sf |
stock:[stock] | $[stock] | Finds messages mentioning a stock | term=$GOOG |
rt:[term]* | Finds retweets mentioning a term | term=rt:(pie OR cake) | |
question:[term]* | Finds messages containing questions | term=?coffee | |
reply:[term]* | Finds replies | term=reply:"web site" | |
link:[term] | Finds messages with links | term=link:reddit | |
yt:[term]* | Finds messages containing YouTube videos | term=yt:chillwave | |
pic:[term]* | Finds messages containing Twitpic links | pic:(lolcat AND funny) | |
Source*= | *Twitter Only | ***Twitter + Facebook |
Location
Source: Twitter
Query | Description | Example |
cc:[country code] | Finds messages from a country (See Appendix 2: Locations for a list of country codes) | term=cc:AU |
country:[country name] | Find messages from a country using the full name. If multiple words within a name separate by using "_"; country:united_states is an example. | term=Pepsi country:canada |
state:[state] or area:[state] | Find messages from users within a state. See Appendix 2: Locations for reference state codes. | term=Pepsi state:CA |
county:[county name] or subarea:[county name] | Find messages from a county (works in US and UK) | county:cook |
city:[city name] or locality:[city name] | Finds messages from a city. Cities with two names are to be separated by "_" ex: new_york | city:chicago // city:new_york |
near:[city] | Finds messages near a city (defaults to .5 degree radius) | near:new_york |
within:[distance] | Find messages within a certain distance of the location specified by near (can use m for miles or km for kilometers) | within:10m, within:20km |
latitude:[x]..[y] | Finds messages between latitudes x (North) and y (North) (use negative numbers for South) | latitude30..40 |
longitude:[x]..[y] | Finds messages between latitudes x (East) and y (East) (use negative numbers for West) | latitude20..30 |
User Details
Source: Twitter
Query | Description | Example |
bio:[term] | Finds messages where the users bio contains the term | bio:surfer |
bio:[term] bio:[term} | Finds messages where the users bio contain one term and another term | bio:ucla bio:student // bio:ios bio:developer |
term1+bio:[term2] | Find messages containing term1 where the user’s bio contains the word term2 | pepsi+bio:surfer |
gender:[gender] | Find messages from male (m), female (f) or undetermined users (u) | gender:m, gender:f |
Sentiment
Sources: Twitter, Facebook, Blogs
Query | Shortcut | Description | Example |
sentiment:good | s+ | Find messages with positive sentiment pepsi | term=pepsi sentiment:good |
sentiment:neutral | s= | Find messages with neutral sentiment | term=pepsi s= |
sentiment:bad | s- | Find messages with negative sentiment | term=pepsi s- |
How to Structure Terms within the Argument
AND
expression AND expression matches documents which are matched by both of the subexpressions.
OR
expression OR expression matches documents which are matched by either of the subexpressions.
NOT
expression NOT expression matches documents which are matched by only the first subexpression. This can also be written as expression AND NOT expression.
NOT expression will match documents which don't match the subexpression.
XOR
expression XOR expression matches documents which are matched by one or other of the subexpressions, but not both. XOR is probably a bit esoteric.
Bracketed expressions
You can control the precedence of the boolean operators using brackets. In the query one OR two AND three the AND takes precedence, so this is the same as one OR (two AND three). You can override the precedence using (one OR two) AND three.
The default precedence from highest to lowest is:
+, - (equal)
AND, NOT (equal)
XOR
OR
'+' and '-'
A group of terms with some marked with + and - will match documents containing all of the + terms, but none of the - terms. Terms not marked with + or - contribute towards the document rankings. You can also use + and - on phrases and on bracketed expressions.
NEAR
one NEAR two NEAR three matches documents containing those words within 10 words of each other. You can set the threshold to n by using NEAR/n like so: one NEAR/6 two.
ADJ
ADJ is like NEAR but only matches if the words appear in the same order as in the query. So one ADJ two ADJ three matches documents containing those three words in that order and within 10 words of each other. You can set the threshold to n by using ADJ/n like so: one ADJ/6 two.
Phrase searches
A phrase surrounded with double quotes ("") matches documents containing that exact phrase. Hyphenated words are also treated as phrases, as are cases such as filenames and email addresses (e.g. "mom" instead of mom, moms, mommy, etc).