8000 Merge pull request #522 from manshreck/master · yogeshg/python-docs-samples@908fefb · GitHub
[go: up one dir, main page]

Skip to content

Commit 908fefb

Browse files
author
manshreck
authored
Merge pull request GoogleCloudPlatform#522 from manshreck/master
Add initial Sentiment Analysis Tutorial files for Cloud NL API
2 parents 349cdc8 + 965aff7 commit 908fefb

File tree

13 files changed

+175
-0
lines changed

13 files changed

+175
-0
lines changed

language/sentiment/README.txt

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# Introduction
2+
3+
This sample contains the code referenced in the
4+
[Sentiment Analysis Tutorial](http://cloud.google.com/natural-language/docs/sentiment-tutorial)
5+
within the Natural Language API Documentation. A full walkthrough of this sample
6+
is located within the documentation.
7+
8+
This sample is a simple illustration of how to construct a sentiment analysis
9+
request and process a response using the API.
10+
11+
## Download the Code
12+
13+
```
14+
git clone sso://python-dev-samples/language/sentiment/
15+
```
16+
17+
### Usage
18+
19+
This sample provides four sample movie reviews which you can
20+
provide to the sample on the command line. (You can also
21+
pass your own text files.)
22+
23+
```
24+
$ python sentiment_analysis.py textfile.txt
25+
Sentiment: polarity of -0.1 with magnitude of 6.7
26+
```
27+

language/sentiment/gcloud/.Python

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/Library/Frameworks/Python.framework/Versions/2.7/Python

language/sentiment/gcloud/bin/python

24.4 KB
Binary file not shown.

language/sentiment/gcloud/bin/python2

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
python
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
python
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7

language/sentiment/mixed.txt

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
I really wanted to love 'Bladerunner' but ultimately I couldn't get
2+
myself to appreciate it fully. However, you may like it if you're into
3+
science fiction, especially if you're interested in the philosophical
4+
exploration of what it means to be human or machine. Some of the gizmos
5+
like the flying cars and the Vouight-Kampff machine (which seemed very
6+
steampunk), were quite cool.
7+
8+
I did find the plot pretty slow and but the dialogue and action sequences
9+
were good. Unlike most science fiction films, this one was mostly quiet, and
10+
not all that much happened, except during the last 15 minutes. I didn't
11+
understand why a unicorn was in the movie. The visual effects were fantastic,
12+
however, and the musical score and overall mood was quite interesting.
13+
A futurist Los Angeles that was both highly polished and also falling apart
14+
reminded me of 'Outland.' Certainly, the style of the film made up for
15+
many of its pedantic plot holes.
16+
17+
If you want your sci-fi to be lasers and spaceships, 'Bladerunner' may
18+
disappoint you. But if you want it to make you think, this movie may
19+
be worth the money.
20+

language/sentiment/neg.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
What was Hollywood thinking 89E2 with this movie! I hated,
2+
hated, hated it. BORING! I went afterwards and demanded my money back.
3+
They refused.
4+

language/sentiment/neutral.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
I neither liked nor disliked this movie. Parts were interesting, but
2+
overall I was left wanting more. The acting was pretty good.
3+

language/sentiment/out

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
SSByZWFsbHkgd2FudGVkIHRvIGxvdmUgJ0JsYWRlcnVubmVyJyBidXQgdWx0aW1hdGVseSBJIGNvdWxkbid0IGdldApteXNlbGYgdG8gYXBwcmVjaWF0ZSBpdCBmdWxseS4gSG93ZXZlciwgeW91IG1heSBsaWtlIGl0IGlmIHlvdSdyZSBpbnRvCnNjaWVuY2UgZmljdGlvbiwgZXNwZWNpYWxseSBpZiB5b3UncmUgaW50ZXJlc3RlZCBpbiB0aGUgcGhpbG9zb3BoaWNhbApleHBsb3JhdG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