# Imports the Google Cloud client library
from google.cloud import language
from google.cloud.language import enums
from google.cloud.language import types

def sentiment_analyse(comment):
	# Instantiates a client
	client = language.LanguageServiceClient()

	# The text to analyze
	text = comment
	document = types.Document(
	    content=text,
	    type=enums.Document.Type.PLAIN_TEXT)

	# Detects the sentiment of the text
	sentiment = client.analyze_sentiment(document=document).document_sentiment

	print('Text: {}'.format(text))
	print('Sentiment: {}, {}'.format(sentiment.score, sentiment.magnitude))
	if sentiment.score < -0.5:
		return "NegativeComment"
	if sentiment.score > -0.5 and sentiment.score <0.5:
		return "NeutralComment"
	if sentiment.score > 0.5:
		return "PositiveComment"
