From 68436328526eb9e6e3cbf45f6353a07bddc170b8 Mon Sep 17 00:00:00 2001 From: Newmu Date: Fri, 7 Nov 2014 18:22:31 -0500 Subject: [PATCH] Updated readme to reflect new api --- README | 20 ++++++++++++++------ README.md | 48 +++++++++++++++++++++++------------------------- 2 files changed, 37 insertions(+), 31 deletions(-) diff --git a/README b/README index 4b76b3a..76622a3 100644 --- a/README +++ b/README @@ -24,6 +24,7 @@ Right now this wrapper supports the following apps: - Facial Emotion Recognition - Facial Feature Extraction - Language Detection +- Text Topic Tagging Examples -------- @@ -41,8 +42,13 @@ Examples >>> sentiment('Really enjoyed the movie.') {u'Sentiment': 0.8105182526856075} ->>> text_tags("On Monday, president Barack Obama will be...") -{u'fashion': 0.024739582352183764, u'art': 0.008637280256320275, u'energy': 0.013183388999943419, ...} +>>> tag_dict = text_tags("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 +{u'fashion': 0.011450126534350728, u'art': 0.00358698972755963, u'energy': 0.005537894035625527, ...} >>> test_face = np.linspace(0,50,48*48).reshape(48,48).tolist() @@ -53,11 +59,13 @@ Examples [0.0, -0.02568680526917187, 0.21645604230056517, -0.1519435786033145, -0.5648621854611555, 3.0607368045577226, 0.11434321880792693, -0.02163810928547493, -0.44224330594186484, 0.3024315632285246, -2.6068048934495276, 2.497798330306638, 3.040558335205844, 0.741045340525325, 0.37198135618478817, -0.33132377802172325, -0.9804190889833034, 0.5046575784709395, -0.5609132323152847, 1.679107064439151, 0.6825037853544341, -1.5977176226648016, 1.8959464303080562, -0.7812860715595836, -2.998394007543733, -0.22637273967347724, -0.9642457010679496, 1.4557274834236749, 2.412244419186633, 2.3151771738421965, 0.7881483386786367, 1.6622850935863422, 0.1304768990234367, 1.9344501393866649, 3.1271558035162914, -0.10250886439220543, 1.4921395116492966, 2.761645355670677, 1.6903473594991179, 1.009209807271491, 0.07273926986120445, -1.4941708135718021, -2.082786362439631, 1.0160924044870847, 2.5326580674673895, -0.8328208491083264, 2.0390177029762935, 3.0342637531932777] >>> language_dict = language('Quis custodiet ipsos custodes') ->>> language_dict -{u'Swedish': 0.00033330636691921914, u'Lithuanian': 0.007328693814717631, u'Vietnamese': 0.0002686116137658802, u'Romanian': 8.133913804076592e-06, u'Dutch': 0.09380619821813883, u'Korean': 0.00272046505489883, u'Danish': 0.0012556466207667206, u'Indonesian': 6.623391878530033e-07, u'Latin': 0.8230599921384231, u'Hungarian': 0.0012793617391960567, u'Persian (Farsi)': 0.0019848504383980473, u'Turkish': 0.0004606965429738638, u'French': 0.00016792646226101638, u'Norwegian': 0.0009179030069742254, u'Russian': 0.0002643396088456642, u'Thai': 7.746466749651003e-05, u'Finnish': 0.0026367338676522643, u'Spanish': 0.011844579596827902, u'Bulgarian': 3.746416283126873e-05, u'Greek': 0.027456554742563633, u'Tagalog': 0.0005143018200605518, u'English': 0.00013517846159760138, u'Esperanto': 0.0002599482830232367, u'Italian': 2.650711180999111e-06, u'Portuguese': 0.013193681336032896, u'Chinese': 0.008818957727120736, u'German': 0.00011732494215411359, u'Japanese': 0.0005885208894664065, u'Czech': 9.916434007248934e-05, u'Slovak': 8.869445598583308e-05, u'Hebrew': 3.70933525938127e-05, u'Polish': 9.900290296255447e-05, u'Arabic': 0.00013589586110619373} ->>> sorted(language_dict.keys(), key=lambda x: language_dict[x], reverse=True) -[u'Latin', u'Dutch', u'Greek', u'Portuguese', u'Spanish', u'Chinese', u'Lithuanian', u'Korean', u'Finnish', u'Persian (Farsi)', u'Hungarian', u'Danish', u'Norwegian', u'Japanese', u'Tagalog', u'Turkish', u'Swedish', u'Vietnamese', u'Russian', u'Esperanto', u'French', u'Arabic', u'English', u'German', u'Czech', u'Polish', u'Slovak', u'Thai', u'Bulgarian', u'Hebrew', u'Romanian', u'Italian', u'Indonesian'] +>>> sorted(language_dict.keys(), key=lambda x: language_dict[x], reverse=True)[:5] +[u'Latin', u'Dutch', u'Greek', u'Portuguese', u'Spanish'] + +>>> language_dict +{u'Swedish': 0.00033330636691921914, u'Lithuanian': 0.007328693814717631, u'Vietnamese': 0.0002686116137658802, u'Romanian': 8.133913804076592e-06, ...} + ``` If you have a local indico server running, simply import from `indicoio.local`. diff --git a/README.md b/README.md index 05aaa39..76622a3 100644 --- a/README.md +++ b/README.md @@ -24,16 +24,7 @@ Right now this wrapper supports the following apps: - Facial Emotion Recognition - Facial Feature Extraction - Language Detection - - -Installation ------------- -``` -pip install indicoio -``` - -Announcement: indico has partnered with Experfy, a data science consulting marketplace based in the Harvard Innovation Lab. Through Experfy, we are helping our data science community members find lucrative projects and advance their skills. Please signup for Experfy at https://www.experfy.com/ to get started. - +- Text Topic Tagging Examples -------- @@ -51,8 +42,13 @@ Examples >>> sentiment('Really enjoyed the movie.') {u'Sentiment': 0.8105182526856075} ->>> text_tags("On Monday, president Barack Obama will be...") -{u'fashion': 0.024739582352183764, u'art': 0.008637280256320275, u'energy': 0.013183388999943419, ...} +>>> tag_dict = text_tags("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 +{u'fashion': 0.011450126534350728, u'art': 0.00358698972755963, u'energy': 0.005537894035625527, ...} >>> test_face = np.linspace(0,50,48*48).reshape(48,48).tolist() @@ -63,23 +59,25 @@ Examples [0.0, -0.02568680526917187, 0.21645604230056517, -0.1519435786033145, -0.5648621854611555, 3.0607368045577226, 0.11434321880792693, -0.02163810928547493, -0.44224330594186484, 0.3024315632285246, -2.6068048934495276, 2.497798330306638, 3.040558335205844, 0.741045340525325, 0.37198135618478817, -0.33132377802172325, -0.9804190889833034, 0.5046575784709395, -0.5609132323152847, 1.679107064439151, 0.6825037853544341, -1.5977176226648016, 1.8959464303080562, -0.7812860715595836, -2.998394007543733, -0.22637273967347724, -0.9642457010679496, 1.4557274834236749, 2.412244419186633, 2.3151771738421965, 0.7881483386786367, 1.6622850935863422, 0.1304768990234367, 1.9344501393866649, 3.1271558035162914, -0.10250886439220543, 1.4921395116492966, 2.761645355670677, 1.6903473594991179, 1.009209807271491, 0.07273926986120445, -1.4941708135718021, -2.082786362439631, 1.0160924044870847, 2.5326580674673895, -0.8328208491083264, 2.0390177029762935, 3.0342637531932777] >>> language_dict = language('Quis custodiet ipsos custodes') + +>>> sorted(language_dict.keys(), key=lambda x: language_dict[x], reverse=True)[:5] +[u'Latin', u'Dutch', u'Greek', u'Portuguese', u'Spanish'] + >>> language_dict -{u'Swedish': 0.00033330636691921914, u'Lithuanian': 0.007328693814717631, u'Vietnamese': 0.0002686116137658802, u'Romanian': 8.133913804076592e-06, u'Dutch': 0.09380619821813883, u'Korean': 0.00272046505489883, u'Danish': 0.0012556466207667206, u'Indonesian': 6.623391878530033e-07, u'Latin': 0.8230599921384231, u'Hungarian': 0.0012793617391960567, u'Persian (Farsi)': 0.0019848504383980473, u'Turkish': 0.0004606965429738638, u'French': 0.00016792646226101638, u'Norwegian': 0.0009179030069742254, u'Russian': 0.0002643396088456642, u'Thai': 7.746466749651003e-05, u'Finnish': 0.0026367338676522643, u'Spanish': 0.011844579596827902, u'Bulgarian': 3.746416283126873e-05, u'Greek': 0.027456554742563633, u'Tagalog': 0.0005143018200605518, u'English': 0.00013517846159760138, u'Esperanto': 0.0002599482830232367, u'Italian': 2.650711180999111e-06, u'Portuguese': 0.013193681336032896, u'Chinese': 0.008818957727120736, u'German': 0.00011732494215411359, u'Japanese': 0.0005885208894664065, u'Czech': 9.916434007248934e-05, u'Slovak': 8.869445598583308e-05, u'Hebrew': 3.70933525938127e-05, u'Polish': 9.900290296255447e-05, u'Arabic': 0.00013589586110619373} - ->>> sorted(language_dict.keys(), key=lambda x: language_dict[x], reverse=True) -[u'Latin', u'Dutch', u'Greek', u'Portuguese', u'Spanish', u'Chinese', u'Lithuanian', u'Korean', u'Finnish', u'Persian (Farsi)', u'Hungarian', u'Danish', u'Norwegian', u'Japanese', u'Tagalog', u'Turkish', u'Swedish', u'Vietnamese', u'Russian', u'Esperanto', u'French', u'Arabic', u'English', u'German', u'Czech', u'Polish', u'Slovak', u'Thai', u'Bulgarian', u'Hebrew', u'Romanian', u'Italian', u'Indonesian'] +{u'Swedish': 0.00033330636691921914, u'Lithuanian': 0.007328693814717631, u'Vietnamese': 0.0002686116137658802, u'Romanian': 8.133913804076592e-06, ...} ``` -Local --------- -When using a local version of the api you must remember to import '.local', otherwise it functions the exact same as the remote api documented above. Local API versions are not yet available at this point in time. +If you have a local indico server running, simply import from `indicoio.local`. ``` ->>> from indicoio.local import sentiment - ->>> sentiment("I absolutely love this tool!") - -{u'Sentiment': 0.9547717584012009} - +>>> from indicoio.local import political, sentiment, fer, facial_features, language ``` + +Installation +------------ +``` +pip install indicoio +``` + +Announcement: Indico has partnered with Experfy, a data science consulting marketplace based in the Harvard Innovation Lab. Through Experfy, we are helping our data science community members find lucrative projects and advance their skills. Please signup for Experfy at https://www.experfy.com/ to get started. \ No newline at end of file