2424models](https://cloud.ibm.com/docs/natural-language-understanding?topic=natural-language-understanding-customizing)
2525with Watson Knowledge Studio to detect custom entities and relations in Natural Language
2626Understanding.
27- IBM is sunsetting Watson Natural Language Understanding Custom Sentiment (BETA). From
28- **June 3, 2023** onward, you will no longer be able to use the Custom Sentiment
29- feature.<br /><br />To ensure we continue providing our clients with robust and powerful
30- text classification capabilities, IBM recently announced the general availability of a new
31- [single-label text classification
32- capability](https://cloud.ibm.com/docs/natural-language-understanding?topic=natural-language-understanding-classifications).
33- This new feature includes extended language support and training data customizations
34- suited for building a custom sentiment classifier.<br /><br />If you would like more
35- information or further guidance, please contact IBM Cloud Support.{: deprecated}
3627
3728API Version: 1.0
3829See: https://cloud.ibm.com/docs/natural-language-understanding
@@ -122,7 +113,6 @@ def analyze(
122113 - Semantic roles
123114 - Sentiment
124115 - Syntax
125- - Summarization (Experimental)
126116 If a language for the input text is not specified with the `language` parameter,
127117 the service [automatically detects the
128118 language](https://cloud.ibm.com/docs/natural-language-understanding?topic=natural-language-understanding-detectable-languages).
@@ -312,7 +302,7 @@ def create_categories_model(
312302 language : str ,
313303 training_data : BinaryIO ,
314304 * ,
315- training_data_content_type : Optional [str ] = 'application/json' ,
305+ training_data_content_type : Optional [str ] = None ,
316306 name : Optional [str ] = None ,
317307 user_metadata : Optional [dict ] = None ,
318308 description : Optional [str ] = None ,
@@ -499,7 +489,7 @@ def update_categories_model(
499489 language : str ,
500490 training_data : BinaryIO ,
501491 * ,
502- training_data_content_type : Optional [str ] = 'application/json' ,
492+ training_data_content_type : Optional [str ] = None ,
503493 name : Optional [str ] = None ,
504494 user_metadata : Optional [dict ] = None ,
505495 description : Optional [str ] = None ,
@@ -653,7 +643,7 @@ def create_classifications_model(
653643 language : str ,
654644 training_data : BinaryIO ,
655645 * ,
656- training_data_content_type : Optional [str ] = 'application/json' ,
646+ training_data_content_type : Optional [str ] = None ,
657647 name : Optional [str ] = None ,
658648 user_metadata : Optional [dict ] = None ,
659649 description : Optional [str ] = None ,
@@ -849,7 +839,7 @@ def update_classifications_model(
849839 language : str ,
850840 training_data : BinaryIO ,
851841 * ,
852- training_data_content_type : Optional [str ] = 'application/json' ,
842+ training_data_content_type : Optional [str ] = None ,
853843 name : Optional [str ] = None ,
854844 user_metadata : Optional [dict ] = None ,
855845 description : Optional [str ] = None ,
@@ -3632,10 +3622,6 @@ class Features:
36323622 `keywords.sentiment`.
36333623 Supported languages: Arabic, English, French, German, Italian, Japanese,
36343624 Korean, Portuguese, Russian, Spanish.
3635- :param SummarizationOptions summarization: (optional) (Experimental) Returns a
3636- summary of content.
3637- Supported languages: English only.
3638- Supported regions: Dallas region only.
36393625 :param CategoriesOptions categories: (optional) Returns a hierarchical taxonomy
36403626 of the content. The top three categories are returned by default.
36413627 Supported languages: Arabic, English, French, German, Italian, Japanese, Korean,
@@ -3656,7 +3642,6 @@ def __init__(
36563642 relations : Optional ['RelationsOptions' ] = None ,
36573643 semantic_roles : Optional ['SemanticRolesOptions' ] = None ,
36583644 sentiment : Optional ['SentimentOptions' ] = None ,
3659- summarization : Optional ['SummarizationOptions' ] = None ,
36603645 categories : Optional ['CategoriesOptions' ] = None ,
36613646 syntax : Optional ['SyntaxOptions' ] = None ,
36623647 ) -> None :
@@ -3707,10 +3692,6 @@ def __init__(
37073692 and for keywords with `keywords.sentiment`.
37083693 Supported languages: Arabic, English, French, German, Italian, Japanese,
37093694 Korean, Portuguese, Russian, Spanish.
3710- :param SummarizationOptions summarization: (optional) (Experimental)
3711- Returns a summary of content.
3712- Supported languages: English only.
3713- Supported regions: Dallas region only.
37143695 :param CategoriesOptions categories: (optional) Returns a hierarchical
37153696 taxonomy of the content. The top three categories are returned by default.
37163697 Supported languages: Arabic, English, French, German, Italian, Japanese,
@@ -3727,7 +3708,6 @@ def __init__(
37273708 self .relations = relations
37283709 self .semantic_roles = semantic_roles
37293710 self .sentiment = sentiment
3730- self .summarization = summarization
37313711 self .categories = categories
37323712 self .syntax = syntax
37333713
@@ -3755,9 +3735,6 @@ def from_dict(cls, _dict: Dict) -> 'Features':
37553735 semantic_roles )
37563736 if (sentiment := _dict .get ('sentiment' )) is not None :
37573737 args ['sentiment' ] = SentimentOptions .from_dict (sentiment )
3758- if (summarization := _dict .get ('summarization' )) is not None :
3759- args ['summarization' ] = SummarizationOptions .from_dict (
3760- summarization )
37613738 if (categories := _dict .get ('categories' )) is not None :
37623739 args ['categories' ] = CategoriesOptions .from_dict (categories )
37633740 if (syntax := _dict .get ('syntax' )) is not None :
@@ -3815,11 +3792,6 @@ def to_dict(self) -> Dict:
38153792 _dict ['sentiment' ] = self .sentiment
38163793 else :
38173794 _dict ['sentiment' ] = self .sentiment .to_dict ()
3818- if hasattr (self , 'summarization' ) and self .summarization is not None :
3819- if isinstance (self .summarization , dict ):
3820- _dict ['summarization' ] = self .summarization
3821- else :
3822- _dict ['summarization' ] = self .summarization .to_dict ()
38233795 if hasattr (self , 'categories' ) and self .categories is not None :
38243796 if isinstance (self .categories , dict ):
38253797 _dict ['categories' ] = self .categories
@@ -5619,66 +5591,6 @@ def __ne__(self, other: 'SentimentResult') -> bool:
56195591 return not self == other
56205592
56215593
5622- class SummarizationOptions :
5623- """
5624- (Experimental) Returns a summary of content.
5625- Supported languages: English only.
5626- Supported regions: Dallas region only.
5627-
5628- :param int limit: (optional) Maximum number of summary sentences to return.
5629- """
5630-
5631- def __init__ (
5632- self ,
5633- * ,
5634- limit : Optional [int ] = None ,
5635- ) -> None :
5636- """
5637- Initialize a SummarizationOptions object.
5638-
5639- :param int limit: (optional) Maximum number of summary sentences to return.
5640- """
5641- self .limit = limit
5642-
5643- @classmethod
5644- def from_dict (cls , _dict : Dict ) -> 'SummarizationOptions' :
5645- """Initialize a SummarizationOptions object from a json dictionary."""
5646- args = {}
5647- if (limit := _dict .get ('limit' )) is not None :
5648- args ['limit' ] = limit
5649- return cls (** args )
5650-
5651- @classmethod
5652- def _from_dict (cls , _dict ):
5653- """Initialize a SummarizationOptions object from a json dictionary."""
5654- return cls .from_dict (_dict )
5655-
5656- def to_dict (self ) -> Dict :
5657- """Return a json dictionary representing this model."""
5658- _dict = {}
5659- if hasattr (self , 'limit' ) and self .limit is not None :
5660- _dict ['limit' ] = self .limit
5661- return _dict
5662-
5663- def _to_dict (self ):
5664- """Return a json dictionary representing this model."""
5665- return self .to_dict ()
5666-
5667- def __str__ (self ) -> str :
5668- """Return a `str` version of this SummarizationOptions object."""
5669- return json .dumps (self .to_dict (), indent = 2 )
5670-
5671- def __eq__ (self , other : 'SummarizationOptions' ) -> bool :
5672- """Return `true` when self and other are equal, false otherwise."""
5673- if not isinstance (other , self .__class__ ):
5674- return False
5675- return self .__dict__ == other .__dict__
5676-
5677- def __ne__ (self , other : 'SummarizationOptions' ) -> bool :
5678- """Return `true` when self and other are not equal, false otherwise."""
5679- return not self == other
5680-
5681-
56825594class SyntaxOptions :
56835595 """
56845596 Returns tokens and sentences from the input text.
0 commit comments