From 6591470873492a62c6749848a5321b5592504c85 Mon Sep 17 00:00:00 2001 From: Alex Ellis Date: Sun, 23 Apr 2017 18:01:22 +0100 Subject: [PATCH] Create README.md --- sample-functions/SentimentAnalysis/README.md | 30 ++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 sample-functions/SentimentAnalysis/README.md diff --git a/sample-functions/SentimentAnalysis/README.md b/sample-functions/SentimentAnalysis/README.md new file mode 100644 index 00000000..a405b90a --- /dev/null +++ b/sample-functions/SentimentAnalysis/README.md @@ -0,0 +1,30 @@ +## SentimentAnalysis + +Python function provides a rating on sentiment positive/negative (polarity -1.0-1.0) and subjectivity to provided to each of the sentences sent in via the [TextBlob project](http://textblob.readthedocs.io/en/dev/). + +Example: + +Run in the function: + +``` +# curl -s --fail localhost:8080/system/functions -d \ +'{ + "service": "sentimentanalysis", + "image": "functions/sentimentanalysis", + "envProcess": "python ./handler.py", + "network": "func_functions" + }' +``` + +Now test the function: + +``` +# curl localhost:8080/function/sentimentanalysis -d "Personally I like functions to do one thing and only one thing well, it makes them more readable." +Polarity: 0.166666666667 Subjectivity: 0.6 + +# curl localhost:8080/function/sentimentanalysis -d "Functions are great and proven to be awesome" +Polarity: 0.9 Subjectivity: 0.875 + +# curl localhost:8080/function/sentimentanalysis -d "The hotel was clean, but the area was terrible"; echo +Polarity: -0.316666666667 Subjectivity: 0.85 +```