Let's start off with initializing a service instance. Just like the Tone Analyzer, there's no need for the Personality Insights service to have any tooling:
- We start by importing the API:
from ibm_watson import PersonalityInsightsV3
- Then, you simply feed in text after initializing the service:
personality_insights = PersonalityInsightsV3(version="2017-10-13",
iam_apikey="W73kz6O3XR1pkIQVn2RYbrrtIU2o0IvNYuqiMICwSwro")
- Next, create a file called personality.txt, a simple text file containing the text from which you wish to infer personality traits. Then, you load the contents of that file into the profile_text variable:
profile_text = open("personality.txt").read()
- You call the profile function on the personality_insights instance and call get_result() in order to get the JSON output of the service...