-
Notifications
You must be signed in to change notification settings - Fork 11
Content Items (1.1)
The Package accepts as its input an array of contentItems. Each Content Item is essentially an array with content, userid, sourceid and so on.
Below is a list of fields that a contentItem supports:
A unique identifier for this content item.
A maximum of 20 MB of content to be analyzed.
A unique identifier for the author of this content.
An identifier for the source of this content; for example, blog123 or twitter.
When was the content created, UNIX Timestamp.
When was the content updated, UNIX Timestamp.
The MIME type of the content: Defaults to text/plain
- text/plain
- text/html
The language of the content as a two-letter ISO 639-1 identifier: Defaults to en
- ar (Arabic)
- en (English, the default)
- es (Spanish)
- ja (Japanese)
Regional variants are treated as their parent language; for example, en-US is interpreted as en.
The unique ID of the parent content item for this item. Used to identify hierarchical relationships between posts/replies, messages/replies, and so on.
Indicates whether this content item is a reply to another content item.
Indicates whether this content item is a forwarded/copied version of another content item.
Here is an example of a contentItem peice:
$singleContentItem = [
"content" => "Wow, I liked @TheRock before , now I really SEE how special he is. The daughter story was IT for me. So great! #MasterClass",
"contenttype" => "text/plain",
"created" => 1447639154000,
"id" => "666073008692314113",
"language" => "en",
"sourceid" => "Twitter API",
"userid" => "@Oprah"
];
To add a single contentItem to the service use the addSingleContentItem()
method:
// Create the PI service.
$personalityInsights = $this->app->make('PersonalityInsights');
// Add single contentItem.
$personalityInsights->addSingleContentItem($singleContentItem);
To add an array of contentItem (which is what you would do in most cases), use the addContentItems()
methods, which accepts an array of contentItems:
// Create the PI service.
$personalityInsights = $this->app->make('PersonalityInsights');
// Add contentItems.
$personalityInsights->addContentItems($contentItems);