@@ -33,7 +33,7 @@ def authors(self, html=None, url=None, language=None):
3333 params = {'language' : language }
3434 return self ._alchemy_html_request ('GetAuthors' , html = html , url = url , params = params )
3535
36- def keywords (self , html = None , text = None , url = None , strict_extract_mode = False , sentiment = False ,
36+ def keywords (self , html = None , text = None , url = None , strict_extract_mode = False , sentiment = False , emotion = False ,
3737 show_source_text = False , max_items = None , language = None , max_keywords = 50 ):
3838 """
3939 :param html: HTML input
@@ -47,6 +47,7 @@ def keywords(self, html=None, text=None, url=None, strict_extract_mode=False, se
4747 max_items = max_keywords
4848 params = {'keywordExtractMode' : 'strict' if strict_extract_mode else 'normal' ,
4949 'sentiment' : sentiment ,
50+ 'emotion' : emotion ,
5051 'showSourceText' : show_source_text ,
5152 'maxRetrieve' : max_items ,
5253 'language' : language }
@@ -67,12 +68,13 @@ def dates(self, html=None, text=None, url=None, anchor_date=None, show_source_te
6768 return self ._alchemy_html_request ('ExtractDates' , html = html , text = text , url = url , params = params )
6869
6970 def entities (self , html = None , text = None , url = None , disambiguate = True , linked_data = True , coreference = True ,
70- quotations = False , sentiment = False , show_source_text = False , max_items = 50 , language = None , model = None ):
71+ quotations = False , sentiment = False , emotion = False , show_source_text = False , max_items = 50 , language = None , model = None ):
7172 params = {'disambiguate' : disambiguate ,
7273 'linkedData' : linked_data ,
7374 'coreference' : coreference ,
7475 'quotations' : quotations ,
7576 'sentiment' : sentiment ,
77+ 'emotion' : emotion ,
7678 'showSourceText' : show_source_text ,
7779 'maxRetrieve' : max_items ,
7880 'language' : language ,
@@ -88,8 +90,22 @@ def emotion(self, html=None, text=None, url=None, show_source_text=False, source
8890 'language' : language }
8991 return self ._alchemy_html_request ('GetEmotion' , html = html , text = text , url = url , params = params )
9092
91- def typed_relations (self , html = None , text = None , url = None , model = None ):
92- params = {'model' : model }
93+ def targeted_emotion (self , targets , html = None , text = None , url = None , language = None , constraint_query = None ,
94+ xpath_query = None , show_source_text = False , source_text_type = None ):
95+ if isinstance (targets , list ):
96+ targets = '|' .join (targets )
97+
98+ params = {'targets' : targets ,
99+ 'language' : language ,
100+ 'cquery' : constraint_query ,
101+ 'xpath' : xpath_query ,
102+ 'showSourceText' : show_source_text ,
103+ 'sourceText' : source_text_type }
104+ return self ._alchemy_html_request ('GetTargetedEmotion' , html = html , text = text , url = url , params = params )
105+
106+ def typed_relations (self , html = None , text = None , url = None , model = None , show_source_text = False ):
107+ params = {'model' : model ,
108+ 'showSourceText' : show_source_text }
93109 return self ._alchemy_html_request ('GetTypedRelations' , html = html , text = text , url = url , params = params )
94110
95111 def relations (self , html = None , text = None , url = None , sentiment = False , keywords = False , entities = False ,
@@ -164,7 +180,7 @@ def taxonomy(self, html=None, text=None, url=None, show_source_text=False, sourc
164180 'sourceText' : source_text_type ,
165181 'cquery' : constraint_query ,
166182 'xpath' : xpath_query ,
167- 'base_url ' : base_url ,
183+ 'baseUrl ' : base_url ,
168184 'language' : language }
169185 return self ._alchemy_html_request ('GetRankedTaxonomy' , html = html , text = text , url = url , params = params )
170186
@@ -236,9 +252,15 @@ def sentiment(self, html=None, text=None, url=None, language=None):
236252 params = {'language' : language }
237253 return self ._alchemy_html_request ('GetTextSentiment' , html = html , text = text , url = url , params = params )
238254
239- def targeted_sentiment (self , targets , html = None , text = None , url = None , language = None ):
255+ def targeted_sentiment (self , targets , html = None , text = None , url = None , language = None , constraint_query = None ,
256+ xpath_query = None , show_source_text = False , source_text_type = None ):
240257 if isinstance (targets , list ):
241258 targets = '|' .join (targets )
242259
243- params = {'targets' : targets , 'language' : language }
260+ params = {'targets' : targets ,
261+ 'language' : language ,
262+ 'cquery' : constraint_query ,
263+ 'xpath' : xpath_query ,
264+ 'showSourceText' : show_source_text ,
265+ 'sourceText' : source_text_type }
244266 return self ._alchemy_html_request ('GetTargetedSentiment' , html = html , text = text , url = url , params = params )
0 commit comments