Block Logic
The block normally gets its input from the Microsoft-developed Twitter block, or other blocks with similar output structure. The Twitter block supports the following operations: getLatestPosts, getFriends and getLatestUserPosts. CPB can handle the output of all three operations.
These operations return an array of TwitterStatus instances. Each item holds information of a single post.
For each post, CPB operates the following logic:
- Examine the post's text found in the text and description members
- If text member is not defined try title instead, and set it to text
- Check if any non-English characters exist in the text
- If so - filter this post out
- Invoke the OpenCalais Web service on the post text and parse the results
- Optionally append a list of identified entities and events to the post text member
- Add two members, calaisText and calaisTree to the output. These members hold Calais-identified entities and events
The output of CPB is a TwitterStatusWithMetadata object, which is identical in structure to the TwitterStatus object, except for the additional two fields above.
For example, if the input is a TwitterStatus object with an empty description member and the text member set to the following:
NME Radio is now playing Half In Love
The output of the block is a TwitterStatusWithMetadata object with the following members and values:
-
text: NME Radio is now playing Half In Love (OpenCalais found: Company - NME Radio [once])
-
calaisText: OpenCalais found: Company - NME Radio [once]
-
calaisTree: tree with one entity
