Package org.opensextant.data.social
Class Message
java.lang.Object
org.opensextant.data.social.Message
- Direct Known Subclasses:
Tweet
Micro Message is the basis for any sort microblog message, SMS, or tweet or
other social media post.
These attributes have some conventions:
- Author data (author* attributes) are synonmous with User Profile, Poster, etc. Otherwise the attribute is more related to the message itself.
- This structure represents data which maybe given or raw; or which may be processed or inferred. it is up to the developer to decide how to navigate the differences between such differences.
- Author:
- ubaldino
-
Field Summary
Modifier and TypeFieldDescriptionraw country codeAuthor's profile location -- If country and actual location is set, use Geocoding object, or opensextant.Place to capture the full metadata.Author ID is screen_name, user_id, user.name, etc.raw XY val, if present on author profile.raw location stringA plain language Name, display name, native language name for the authorthe numeric ID for a user/author profile.Date object for the message timestampOriginal text of the date, if givenMessage IDboolean
True if text is purely ASCIIboolean
isDST = is Daylight Savings Time = true if we think the message timestamp is in a period of DST recognized by the country of origin, or UTC offset.boolean
True if processing of text determines tweet is nearly all English.Language of the message; not usually given unless inferred by someone or something.Location Country Code if inferred or given.static final int
long
Character count of the message.optional Source ID fieldthe origination of the message -- Country from which the item was sent.protected String
The text of the message.protected String
The natural language version of the text.Timezone label of the timestamp, e.g., Europe/London, or just London or "Canada and Atlantic (EST)".static final int
Language declared by the user.int
UTC offset in seconds (as given by Twitter and other sources).int
utcOffset is in seconds, UTC offset hours is in hours. -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptiongetText()
get the message text.Get the natural language version of the raw text.final void
Set the text, if not null, isASCII and rawbytes length are calculated.void
void
setUTCOffset
(int utc) Set UTC and TZ after date is set.static final double
toUTCOffsetHours
(int o) UTC offset as hours.static final boolean
validateUTCOffset
(int o) static boolean
detect if Tweet has UTC offset or TZ
-
Field Details
-
authorID
Author ID is screen_name, user_id, user.name, etc. -
authorName
A plain language Name, display name, native language name for the author -
authorProfileID
the numeric ID for a user/author profile. As users are able to change display names at-will. -
authorCC
raw country code -
authorLocation
raw location string -
authorLatLonText
raw XY val, if present on author profile. -
locationCC
Location Country Code if inferred or given. -
authorGeo
Author's profile location -- If country and actual location is set, use Geocoding object, or opensextant.Place to capture the full metadata. -
statusGeo
the origination of the message -- Country from which the item was sent. If the location is set also as a coordinate use that. -
date
Date object for the message timestamp -
dateText
Original text of the date, if given -
timezone
Timezone label of the timestamp, e.g., Europe/London, or just London or "Canada and Atlantic (EST)". There are some standard labels, but these labels do not always line up with well-known TZ databases. -
UNSET_UTC_OFFSET
public static final int UNSET_UTC_OFFSET- See Also:
-
utcOffset
public int utcOffsetUTC offset in seconds (as given by Twitter and other sources). Default is UNSET_UTC_OFFSET -
isDST
public boolean isDSTisDST = is Daylight Savings Time = true if we think the message timestamp is in a period of DST recognized by the country of origin, or UTC offset. -
utcOffsetHours
public int utcOffsetHoursutcOffset is in seconds, UTC offset hours is in hours. Duh. Default is UNSET_UTC_OFFSET -
id
Message ID -
text
The text of the message. -
textNatural
The natural language version of the text. -
rawbytes
public long rawbytesCharacter count of the message. Or if you choose to store byte count.... -
userLang
Language declared by the user. -
lang
Language of the message; not usually given unless inferred by someone or something. -
isASCII
public boolean isASCIITrue if text is purely ASCII -
isEnglish
public boolean isEnglishTrue if processing of text determines tweet is nearly all English. -
sourceID
optional Source ID field -
OFFSET_HALF
public static final int OFFSET_HALF- See Also:
-
-
Constructor Details
-
Message
public Message()Trivial constructor. -
Message
A simple message with an ID, text and a timestamp.- Parameters:
_id
- IDtext
- messagetm
- timestamp
-
-
Method Details
-
setText
Set the text, if not null, isASCII and rawbytes length are calculated. -
getText
get the message text. -
getTextNatural
Get the natural language version of the raw text.- Returns:
-
setTextNatural
-
setUTCOffset
public void setUTCOffset(int utc) Set UTC and TZ after date is set.- Parameters:
utc
- UTC offset in SECONDS
-
validateUTCOffset
public static final boolean validateUTCOffset(int o) -
toUTCOffsetHours
public static final double toUTCOffsetHours(int o) UTC offset as hours. Convert from seconds- Parameters:
o
-- Returns:
-
validTZ
detect if Tweet has UTC offset or TZ- Parameters:
t
- tweet obj- Returns:
-