-
Notifications
You must be signed in to change notification settings - Fork 17
AnalyzeModel
namespace WatsonSDK\Services\NaturalLanguageUnderstanding;
The class for parameters to be sent to Natural Language Understanding service.
class AnalyzeModel extends ServiceModel
Used to initialize a AnalyzeModel model from the parameters.
/**
* Constructor
*
* @param $content string
* @param $features array
* @param $type string
* @param $language string | NULL
* @param $clean boolean | NULL
* @param $fallback_to_raw boolean | NULL
* @param $return_analyzed_text boolean | NULL
* @param $version string
*/
function __construct($content, $features, $type = self::TYPE_TEXT, $language = NULL, $clean = NULL, $fallback_to_raw = NULL, $return_analyzed_text = NULL, $version = self::VERSION);
Parameter | Type | Description |
---|---|---|
text, html, or url | string | One of these is required. The "text" attribute accepts plain text. The "html" attribute accepts formatted HTML source code. The "url" attribute accepts URLs to public webpages - "url" is not supported in Bluemix Dedicated instances. |
features | array | Specify the features to analyze in the text, and the options to enable for each feature |
language | string | ISO 639-1 code indicating the language to use for the analysis. This code overrides the automatic language detection performed by the service. Valid codes are ar(Arabic), en(English), fr(French), de(German), it(Italian), pt(Portuguese), ru(Russian), es(Spanish), and sv(Swedish). For more information about which features are supported in each language, see this table. |
clean | boolean | Set to false to disable text cleaning. By default, the service cleans input to remove generally unwanted content, such as advertisements. |
fallback_to_raw | boolean | Whether to use raw HTML content if text cleaning fails. This defaults to false. |
return_analyzed_text | boolean | Set this to true to show the analyzed text in the response. |
version | string | The release date of the version of the API to use. Specify the date in “YYYY-MM-DD” format. |
Natural Language Understanding service URL.
const BASE_URL = 'https://gateway.watsonplatform.net/natural-language-understanding/api/v1';
Current Natural Language Understanding version.
const VERSION = '2017-02-27';
Supported features
const FEATURE_CONCEPTS = 'concepts';
const FEATURE_CAEGORIES = 'categories';
const FEATURE_EMOTION = 'emotion';
const FEATURE_ENTITIES = 'entities';
const FEATURE_KEYWORDS = 'keywords';
const FEATURE_METADATA = 'metadata';
const FEATURE_RELATIONS = 'relations';
const FEATURE_SEMANTIC_ROLES= 'semantic_roles';
const FEATURE_SENTIMENT = 'sentiment';
Get type of the content to be analyzed.
public function getContents();
Set type of the content to be analyzed.
public function setContents($key, $val);
Get features.
public function getFeatures();
Set features.
public function setFeatures($val);
Get ISO 639-1 code indicating the language to use for the analysis.
public function getLanguage();
Set ISO 639-1 code to indicate the language to use for the analysis.
public function setLanguage($val);
Check if the text clearning is enabled.
public function getClean();
Set text cleaning.
public function setClean($val);
Check whether to use raw HTML content if text cleaning fails.
public function getFallbackToRaw();
Set the flag using raw HTML content if text cleaning fails.
public function setFallbackToRaw($val);
Check if it is hiding the analyzed text in the response.
public function getReturnAnalyzedText();
Set flag for hiding the analyzed text in the response.
public function setReturnAnalyzedText($val);
Copyright 2017 GCG GBS CTO Office under the Apache 2.0 license.