watson_developer_cloud.alchemy_language_v1 module

The AlchemyAPI Language service (https://www.ibm.com/watson/developercloud/alchemy-language.html)

class AlchemyLanguageV1(url=’https://gateway-a.watsonplatform.net/calls’, **kwargs)[source]

Bases: watson_developer_cloud.watson_developer_cloud_service.WatsonDeveloperCloudService

default_url = ‘https://gateway-a.watsonplatform.net/calls’
author(html=None, url=None, language=None)[source]
authors(html=None, url=None, language=None)[source]
keywords(html=None, text=None, url=None, strict_extract_mode=False, sentiment=False, emotion=False, show_source_text=False, max_items=None, language=None, max_keywords=50)[source]
Parameters:
  • html – HTML input
  • text – Text input
  • url – URL input
  • max_items – The number of results to return (default 50)
  • max_keywords – deprecated, use max_items instead
Returns:

A JSON object with extracted keywords from the source document

concepts(html=None, text=None, url=None, max_items=8, linked_data=True, show_source_text=False, language=None, knowledge_graph=False)[source]
dates(html=None, text=None, url=None, anchor_date=None, show_source_text=False, language=None)[source]
entities(html=None, text=None, url=None, disambiguate=True, linked_data=True, coreference=True, quotations=False, sentiment=False, emotion=False, show_source_text=False, max_items=50, language=None, model=None)[source]
emotion(html=None, text=None, url=None, show_source_text=False, source_text_type=None, constraint_query=None, xpath_query=None, language=None)[source]
targeted_emotion(targets, html=None, text=None, url=None, language=None, constraint_query=None, xpath_query=None, show_source_text=False, source_text_type=None)[source]
typed_relations(html=None, text=None, url=None, model=None, show_source_text=False)[source]
relations(html=None, text=None, url=None, sentiment=False, keywords=False, entities=False, require_entities=False, sentiment_excludes_entities=True, disambiguate=True, linked_data=True, coreference=True, show_source_text=False, max_items=50, language=None)[source]
language(html=None, text=None, url=None)[source]
text(html=None, url=None, use_metadata=True, extract_links=False)[source]
raw_text(html=None, url=None)[source]
category(html=None, text=None, url=None, show_source_text=False, language=None)[source]
title(html=None, url=None, use_metadata=True, language=None)[source]
feeds(html=None, url=None)[source]
microformats(html=None, url=None)[source]
publication_date(html=None, url=None)[source]
taxonomy(html=None, text=None, url=None, show_source_text=False, source_text_type=None, constraint_query=None, xpath_query=None, base_url=None, language=None)[source]
source_text_type ->

where to obtain the text that will be processed by this API call. AlchemyAPI supports multiple modes of text extraction:

web page cleaning (removes ads, navigation links, etc.), raw text extraction (processes all web page text, including ads / nav links), visual constraint queries, and XPath queries.
Possible values:

cleaned_or_raw : cleaning enabled, fallback to raw when cleaning produces no text (default) cleaned : operate on ‘cleaned’ web page text (web page cleaning enabled) raw : operate on raw web page text (web page cleaning disabled) cquery : operate on the results of a visual constraints query

Note: The ‘constraint_query’ argument must also be set to a valid visual constraints query.
xpath : operate on the results of an XPath query
Note: The ‘xpath’ http argument must also be set to a valid XPath query.
constraint_query ->
a visual constraints query to apply to the web page.
xpath ->
an XPath query to apply to the web page.
base_url ->
rel-tag output base http url (must be uri-argument encoded)
combined(html=None, text=None, url=None, extract=None, disambiguate=True, linked_data=True, coreference=True, quotations=False, sentiment=False, show_source_text=False, max_items=50, base_url=None, language=None)[source]

Combined call for page-image, entity, keyword, title, author, taxonomy, concept, doc-emotion. INPUT: extract ->

List or comma separated string Possible values: page-image, entity, keyword, title, author, taxonomy, concept default : entity, keyword, taxonomy, concept
disambiguate ->

disambiguate detected entities Possible values:

True : enabled (default) False : disabled
linked_data ->

include Linked Data content links with disambiguated entities Possible values :

True : enabled (default) False : disabled
coreference ->

resolve he/she/etc coreferences into detected entities Possible values:

True : enabled (default) False : disabled
quotations ->

enable quotations extraction Possible values:

True : enabled False : disabled (default)
sentiment ->

enable entity-level sentiment analysis Possible values:

True : enabled False : disabled (default)
show_source_text ->

include the original ‘source text’ the entities were extracted from within the API response Possible values:

True : enabled False : disabled (default)
max_items ->
maximum number of named entities to extract default : 50
base_url ->
rel-tag output base http url

OUTPUT: The response, already converted from JSON to a Python object.

sentiment(html=None, text=None, url=None, language=None)[source]
targeted_sentiment(targets, html=None, text=None, url=None, language=None, constraint_query=None, xpath_query=None, show_source_text=False, source_text_type=None)[source]