I want to use the Watson Personality Insights API to analyze the personality traits of a particular Twitter user. This user has 1000 tweets. Do I have to call the Personality Insights API 1000 times in order to do this?
相关问题
- How to disable okhttp3.internal.platform.Platform
- How to extract current date in watson conversation
- Can I use IBM Watson services without Bluemix?
- IBM Cloud-Watson NLC - TypeError: __init__() got a
- How to pipe multiple readable streams, from multip
相关文章
- How to pipe multiple readable streams, from multip
- How to convert multiple documents using the Docume
- how to call IBM Watson services from javascript
- How to get exact answers instead of the whole docu
- 1006 Error code in IBM Watson speech-to-text API
- How do I play audio returned from an XMLHTTPReques
- Stream audio from mic to IBM Watson SpeechToText W
- IBM沃森助手:聊天机器人实体混淆了正则表达式(IBM Watson Assistant: Chat
Personality Insights can process multiple text elements in a single API call. To obtain a single result (the a meaningful output according to the service documentation) this needs to be written by an individual author.
Now assuming you obtained 1000s of tweets from an author, you can format them in one (big) JSON string and POST-it with
Content-Type: application/json
header in your request. See the specs (right under "JSON output for text with timestamps" title) for an example of this type of input, with multiple elements included.How many elements can fit in a single request? Currently the APIs limit the input payload to 20Mb. If you count the characters used by each of the
contentItems
in the JSON above, and assuming a 140-character limit per tweet, this gives about 350 characters used per tweet. So you can fit about 57,000 tweets in a single API call! At least, if this is English text (or rather: ASCII encoded text); the object size might perhaps double with utf-8 encoding special characters, but that will still leave plenty of room for many thousands of tweets.No you don't. You DO need to "bundle" the 1000 tweets in JSON and submit them with your SINGLE call to the profile method of the Personality Insights API. These tweets are each contained as individual content items in the JSON.
For details on the format of the JSON payload, and the response format, see the online documentation at http://www.ibm.com/smarterplanet/us/en/ibmwatson/developercloud/personality-insights/api/v2/?node#methods