watson_developer_cloud.personality_insights_v3 module¶
The IBM Watson™ Personality Insights service enables applications to derive insights from social media, enterprise data, or other digital communications. The service uses linguistic analytics to infer individuals’ intrinsic personality characteristics, including Big Five, Needs, and Values, from digital communications such as email, text messages, tweets, and forum posts. The service can automatically infer, from potentially noisy social media, portraits of individuals that reflect their personality characteristics. The service can infer consumption preferences based on the results of its analysis and, for JSON content that is timestamped, can report temporal behavior. * For information about the meaning of the models that the service uses to describe personality characteristics, see [Personality models](https://cloud.ibm.com/docs/services/personality-insights/models.html). * For information about the meaning of the consumption preferences, see [Consumption preferences](https://cloud.ibm.com/docs/services/personality-insights/preferences.html). Note: Request logging is disabled for the Personality Insights service. Regardless of whether you set the X-Watson-Learning-Opt-Out request header, the service does not log or retain data from requests and responses.
-
class
Behavior
(trait_id, name, category, percentage)[source]¶ Bases:
object
Behavior.
- Attr str trait_id
The unique, non-localized identifier of the characteristic to
which the results pertain. IDs have the form behavior_{value}. :attr str name: The user-visible, localized name of the characteristic. :attr str category: The category of the characteristic: behavior for temporal data. :attr float percentage: For JSON content that is timestamped, the percentage of timestamped input data that occurred during that day of the week or hour of the day. The range is 0 to 1.
-
class
ConsumptionPreferences
(consumption_preference_id, name, score)[source]¶ Bases:
object
ConsumptionPreferences.
- Attr str consumption_preference_id
The unique, non-localized identifier of the
consumption preference to which the results pertain. IDs have the form consumption_preferences_{preference}. :attr str name: The user-visible, localized name of the consumption preference. :attr float score: The score for the consumption preference: * 0.0: Unlikely * 0.5: Neutral * 1.0: Likely The scores for some preferences are binary and do not allow a neutral value. The score is an indication of preference based on the results inferred from the input text, not a normalized percentile.
-
class
ConsumptionPreferencesCategory
(consumption_preference_category_id, name, consumption_preferences)[source]¶ Bases:
object
ConsumptionPreferencesCategory.
- Attr str consumption_preference_category_id
The unique, non-localized identifier of
the consumption preferences category to which the results pertain. IDs have the form consumption_preferences_{category}. :attr str name: The user-visible name of the consumption preferences category. :attr list[ConsumptionPreferences] consumption_preferences: Detailed results inferred from the input text for the individual preferences of the category.
-
class
Content
(content_items)[source]¶ Bases:
object
Content.
- Attr list[ContentItem] content_items
An array of ContentItem objects that provides
the text that is to be analyzed.
-
class
ContentItem
(content, id=None, created=None, updated=None, contenttype=None, language=None, parentid=None, reply=None, forward=None)[source]¶ Bases:
object
ContentItem.
- Attr str content
The content that is to be analyzed. The service supports up to 20
MB of content for all ContentItem objects combined. :attr str id: (optional) A unique identifier for this content item. :attr int created: (optional) A timestamp that identifies when this content was created. Specify a value in milliseconds since the UNIX Epoch (January 1, 1970, at 0:00 UTC). Required only for results that include temporal behavior data. :attr int updated: (optional) A timestamp that identifies when this content was last updated. Specify a value in milliseconds since the UNIX Epoch (January 1, 1970, at 0:00 UTC). Required only for results that include temporal behavior data. :attr str contenttype: (optional) The MIME type of the content. The default is plain text. The tags are stripped from HTML content before it is analyzed; plain text is processed as submitted. :attr str language: (optional) The language identifier (two-letter ISO 639-1 identifier) for the language of the content item. The default is en (English). Regional variants are treated as their parent language; for example, en-US is interpreted as en. A language specified with the Content-Type parameter overrides the value of this parameter; any content items that specify a different language are ignored. Omit the Content-Type parameter to base the language on the most prevalent specification among the content items; again, content items that specify a different language are ignored. You can specify any combination of languages for the input and response content. :attr str parentid: (optional) The unique ID of the parent content item for this item. Used to identify hierarchical relationships between posts/replies, messages/replies, and so on. :attr bool reply: (optional) Indicates whether this content item is a reply to another content item. :attr bool forward: (optional) Indicates whether this content item is a forwarded/copied version of another content item.
-
class
Profile
(processed_language, word_count, personality, needs, values, warnings, word_count_message=None, behavior=None, consumption_preferences=None)[source]¶ Bases:
object
Profile.
- Attr str processed_language
The language model that was used to process the input.
- Attr int word_count
The number of words from the input that were used to produce the
profile. :attr str word_count_message: (optional) When guidance is appropriate, a string that provides a message that indicates the number of words found and where that value falls in the range of required or suggested number of words. :attr list[Trait] personality: A recursive array of Trait objects that provides detailed results for the Big Five personality characteristics (dimensions and facets) inferred from the input text. :attr list[Trait] needs: Detailed results for the Needs characteristics inferred from the input text. :attr list[Trait] values: Detailed results for the Values characteristics inferred from the input text. :attr list[Behavior] behavior: (optional) For JSON content that is timestamped, detailed results about the social behavior disclosed by the input in terms of temporal characteristics. The results include information about the distribution of the content over the days of the week and the hours of the day. :attr list[ConsumptionPreferencesCategory] consumption_preferences: (optional) If the consumption_preferences parameter is true, detailed results for each category of consumption preferences. Each element of the array provides information inferred from the input text for the individual preferences of that category. :attr list[Warning] warnings: Warning messages associated with the input text submitted with the request. The array is empty if the input generated no warnings.
-
class
Trait
(trait_id, name, category, percentile, raw_score=None, significant=None, children=None)[source]¶ Bases:
object
Trait.
- Attr str trait_id
The unique, non-localized identifier of the characteristic to
which the results pertain. IDs have the form * big5_{characteristic} for Big Five personality dimensions * facet_{characteristic} for Big Five personality facets * need_{characteristic} for Needs
*value_{characteristic} for Values.
- Attr str name
The user-visible, localized name of the characteristic.
- Attr str category
The category of the characteristic: personality for Big Five
personality characteristics, needs for Needs, and values for Values. :attr float percentile: The normalized percentile score for the characteristic. The range is 0 to 1. For example, if the percentage for Openness is 0.60, the author scored in the 60th percentile; the author is more open than 59 percent of the population and less open than 39 percent of the population. :attr float raw_score: (optional) The raw score for the characteristic. The range is 0 to 1. A higher score generally indicates a greater likelihood that the author has that characteristic, but raw scores must be considered in aggregate: The range of values in practice might be much smaller than 0 to 1, so an individual score must be considered in the context of the overall scores and their range. The raw score is computed based on the input and the service model; it is not normalized or compared with a sample population. The raw score enables comparison of the results against a different sampling population and with a custom normalization approach. :attr bool significant: (optional) `2017-10-13`: Indicates whether the characteristic is meaningful for the input language. The field is always true for all characteristics of English, Spanish, and Japanese input. The field is false for the subset of characteristics of Arabic and Korean input for which the service’s models are unable to generate meaningful results. `2016-10-19`: Not returned. :attr list[Trait] children: (optional) For personality (Big Five) dimensions, more detailed results for the facets of each dimension as inferred from the input text.
-
class
Warning
(warning_id, message)[source]¶ Bases:
object
Warning.
- Attr str warning_id
The identifier of the warning message.
- Attr str message
The message associated with the warning_id:
WORD_COUNT_MESSAGE: “There were {number} words in the input. We need a minimum of
600, preferably 1,200 or more, to compute statistically significant estimates.” * JSON_AS_TEXT: “Request input was processed as text/plain as indicated, however detected a JSON input. Did you mean application/json?” * CONTENT_TRUNCATED: “For maximum accuracy while also optimizing processing time, only the first 250KB of input text (excluding markup) was analyzed. Accuracy levels off at approximately 3,000 words so this did not affect the accuracy of the profile.” * PARTIAL_TEXT_USED, “The text provided to compute the profile was trimmed for performance reasons. This action does not affect the accuracy of the output, as not all of the input text was required.” Applies only when Arabic input text exceeds a threshold at which additional words do not contribute to the accuracy of the profile.