From 8e5d7977b8a0b98e5f2b9a4c9ae9b797f3bf7130 Mon Sep 17 00:00:00 2001 From: Madison May Date: Thu, 18 Dec 2014 16:18:53 -0500 Subject: [PATCH] Documentation for optional arguments --- README | 22 +++++++++++++++++++--- README.md | 15 ++++++++++----- 2 files changed, 29 insertions(+), 8 deletions(-) diff --git a/README b/README index 76622a3..9cd838f 100644 --- a/README +++ b/README @@ -42,10 +42,18 @@ Examples >>> sentiment('Really enjoyed the movie.') {u'Sentiment': 0.8105182526856075} ->>> tag_dict = text_tags("Facebook blog posts about Android tech make better journalism than most news outlets.") +>>> test_text = "Facebook blog posts about Android tech make better journalism than most news outlets." ->>> sorted(tag_dict.keys(), key=lambda x: tag_dict[x], reverse=True)[:5] -[u'investing', u'startups', u'business', u'entrepreneur', u'humor'] +>>> tag_dict = text_tags(test_text) + +>>> sorted(tag_dict.keys(), key=lambda x: tag_dict[x], reverse=True)[:3] +[u'startups_and_entrepreneurship', u'investment', u'business'] + +>>> text_tags(test_text, threshold=0.1) # return only keys with value > 0.1 +{u'startups_and_entrepreneurship': 0.21888586688354486} + +>>> text_tags(test_text, top_n=1) # return only keys with top_n values +{u'startups_and_entrepreneurship': 0.21888586688354486} >>> tag_dict {u'fashion': 0.011450126534350728, u'art': 0.00358698972755963, u'energy': 0.005537894035625527, ...} @@ -74,6 +82,14 @@ If you have a local indico server running, simply import from `indicoio.local`. >>> from indicoio.local import political, sentiment, fer, facial_features, language ``` +If you'd like to use our batch api interface, please send an email to contact@indico.io. + +``` +>>> from indicio import batch_sentiment +batch_sentiment(['Text to analyze', 'More text'], auth=("example@example.com", "********")) +``` + + Installation ------------ ``` diff --git a/README.md b/README.md index 38cecde..08039a1 100644 --- a/README.md +++ b/README.md @@ -46,13 +46,18 @@ Examples >>> sentiment('Really enjoyed the movie.') {u'Sentiment': 0.8105182526856075} ->>> tag_dict = text_tags("Facebook blog posts about Android tech make better journalism than most news outlets.") +>>> test_text = "Facebook blog posts about Android tech make better journalism than most news outlets." ->>> sorted(tag_dict.keys(), key=lambda x: tag_dict[x], reverse=True)[:5] -[u'investing', u'startups', u'business', u'entrepreneur', u'humor'] +>>> tag_dict = text_tags(test_text) ->>> tag_dict -{u'fashion': 0.011450126534350728, u'art': 0.00358698972755963, u'energy': 0.005537894035625527, ...} +>>> sorted(tag_dict.keys(), key=lambda x: tag_dict[x], reverse=True)[:3] +[u'startups_and_entrepreneurship', u'investment', u'business'] + +>>> text_tags(test_text, threshold=0.1) # return only keys with value > 0.1 +{u'startups_and_entrepreneurship': 0.21888586688354486} + +>>> text_tags(test_text, top_n=1) # return only keys with top_n values +{u'startups_and_entrepreneurship': 0.21888586688354486} >>> test_face = np.linspace(0,50,48*48).reshape(48,48).tolist()