mirror of
https://github.com/openfaas/faas.git
synced 2025-06-09 08:46:48 +00:00
18 lines
412 B
Python
18 lines
412 B
Python
import sys
|
|
from textblob import TextBlob
|
|
|
|
def get_stdin():
|
|
buf = ""
|
|
for line in sys.stdin:
|
|
buf = buf + line
|
|
return buf
|
|
|
|
if(__name__ == "__main__"):
|
|
st = get_stdin()
|
|
blob = TextBlob(st)
|
|
out =""
|
|
for sentence in blob.sentences:
|
|
out = out + "Polarity: " + str(sentence.sentiment.polarity) + " Subjectivity: " + str(sentence.sentiment.subjectivity) + "\n"
|
|
print(out)
|
|
|