|
4 | 4 |
|
5 | 5 | alchemy_language = AlchemyLanguageV1(api_key='YOUR API KEY') |
6 | 6 |
|
7 | | -url = 'https://developer.ibm.com/watson/blog/2015/11/03/price-reduction-for-watson-personality-insights/' |
| 7 | +url = 'https://developer.ibm.com/watson/blog/2015/11/03/price-reduction-for' \ |
| 8 | + '-watson-personality-insights/' |
8 | 9 |
|
9 | | -print(json.dumps(alchemy_language.targeted_sentiment(text='I love cats! Dogs are smelly.', |
10 | | - targets=['cats', 'dogs'], language='english'), indent=2)) |
11 | | -# print(json.dumps(alchemy_language.targeted_emotion(text='I love apples. I hate bananas', |
12 | | -# targets=['apples', 'bananas'], language='english'), indent=2)) |
| 10 | +print(json.dumps( |
| 11 | + alchemy_language.targeted_sentiment(text='I love cats! Dogs are smelly.', |
| 12 | + targets=['cats', 'dogs'], |
| 13 | + language='english'), indent=2)) |
| 14 | +# print(json.dumps(alchemy_language.targeted_emotion(text='I love apples. I |
| 15 | +# hate bananas', |
| 16 | +# targets=['apples', |
| 17 | +# 'bananas'], language='english'), indent=2)) |
13 | 18 |
|
14 | 19 | # print(json.dumps(alchemy_language.author(url=url), indent=2)) |
15 | 20 | # print(json.dumps(alchemy_language.concepts(max_items=2, url=url), indent=2)) |
16 | | -# print(json.dumps(alchemy_language.dates(url=url, anchor_date='2016-03-22 00:00:00'), indent=2)) |
| 21 | +# print(json.dumps(alchemy_language.dates(url=url, anchor_date='2016-03-22 |
| 22 | +# 00:00:00'), indent=2)) |
17 | 23 | # print(json.dumps(alchemy_language.emotion(url=url), indent=2)) |
18 | 24 | # print(json.dumps(alchemy_language.entities(url=url), indent=2)) |
19 | 25 | # print(json.dumps(alchemy_language.keywords(max_items=5, url=url), indent=2)) |
|
25 | 31 | # print(json.dumps(alchemy_language.raw_text(url=url), indent=2)) |
26 | 32 | # print(json.dumps(alchemy_language.title(url=url), indent=2)) |
27 | 33 | # print(json.dumps(alchemy_language.feeds(url=url), indent=2)) |
28 | | -# print(json.dumps(alchemy_language.microformats(url='http://microformats.org/wiki/hcard-examples'), indent=2)) |
| 34 | +# print(json.dumps(alchemy_language.microformats( |
| 35 | +# url='http://microformats.org/wiki/hcard-examples'), indent=2)) |
29 | 36 | # print(json.dumps(alchemy_language.publication_date(url=url), indent=2)) |
30 | 37 | # print(json.dumps(alchemy_language.taxonomy(url=url), indent=2)) |
31 | | -combined_operations = ['page-image', 'entity', 'keyword', 'title', 'author', 'taxonomy', 'concept', 'doc-emotion'] |
32 | | -print(json.dumps(alchemy_language.combined(url=url, extract=combined_operations), indent=2)) |
| 38 | +combined_operations = ['page-image', 'entity', 'keyword', 'title', 'author', |
| 39 | + 'taxonomy', 'concept', 'doc-emotion'] |
| 40 | +print( |
| 41 | +json.dumps(alchemy_language.combined(url=url, extract=combined_operations), |
| 42 | + indent=2)) |
33 | 43 |
|
34 | 44 | # Get sentiment and emotion information results for detected entities/keywords: |
35 | | -# print(json.dumps(alchemy_language.entities(url=url, sentiment=True, emotion=True), indent=2)) |
36 | | -# print(json.dumps(alchemy_language.keywords(max_items=5, url=url, sentiment=True, emotion=True), indent=2)) |
| 45 | +# print(json.dumps(alchemy_language.entities(url=url, sentiment=True, |
| 46 | +# emotion=True), indent=2)) |
| 47 | +# print(json.dumps(alchemy_language.keywords(max_items=5, url=url, |
| 48 | +# sentiment=True, emotion=True), |
| 49 | +# indent=2)) |
0 commit comments