Google 的越南语情绪分析
Vietnamese Sentiment Analysis With Google
我创建了受情绪分析支持的越南人。
当我尝试他们提到的教程但使用越南语句子时,它只检测到越南语但没有显示 'sentence' 和 'score'.
我的代码:
credentials = ServiceAccountCredentials.from_json_keyfile_name(settings.GOOGLE['nlp_client_secrets'],scopes=settings.GOOGLE['nlp_scope'])
http = Http()
http = credentials.authorize(http)
service = discovery.build("language", "v1", http=http, discoveryServiceUrl=DISCOVERY_URL)
service_request = service.documents().analyzeSentiment(
body={
'document': {
'type': 'PLAIN_TEXT',
'content': 'món ăn này rất tệ.'
},
'encoding_type': 'UTF8'
})
response = service_request.execute()
然后,我在控制台上显示响应:
{u'documentSentiment': {u'magnitude': 0, u'score': 0}, u'language': u'vi', u'sentences': []}}
谁能告诉我为什么 Google 没有为我的词组打分?
谢谢
你是对的,Google 的 NLP 支持越南语进行情绪分析,如他们的 supported languages docs 中所列。
我测试了他们的 NLP API demo and tried plugging in test sentences from each of their supported languages and they all worked except for Vietnamese. My guess is that it isn't an issue with your sentence, but rather a bug on Google's part. Good find! You can report the issue to GCP here。
我创建了受情绪分析支持的越南人。 当我尝试他们提到的教程但使用越南语句子时,它只检测到越南语但没有显示 'sentence' 和 'score'.
我的代码:
credentials = ServiceAccountCredentials.from_json_keyfile_name(settings.GOOGLE['nlp_client_secrets'],scopes=settings.GOOGLE['nlp_scope'])
http = Http()
http = credentials.authorize(http)
service = discovery.build("language", "v1", http=http, discoveryServiceUrl=DISCOVERY_URL)
service_request = service.documents().analyzeSentiment(
body={
'document': {
'type': 'PLAIN_TEXT',
'content': 'món ăn này rất tệ.'
},
'encoding_type': 'UTF8'
})
response = service_request.execute()
然后,我在控制台上显示响应:
{u'documentSentiment': {u'magnitude': 0, u'score': 0}, u'language': u'vi', u'sentences': []}}
谁能告诉我为什么 Google 没有为我的词组打分? 谢谢
你是对的,Google 的 NLP 支持越南语进行情绪分析,如他们的 supported languages docs 中所列。
我测试了他们的 NLP API demo and tried plugging in test sentences from each of their supported languages and they all worked except for Vietnamese. My guess is that it isn't an issue with your sentence, but rather a bug on Google's part. Good find! You can report the issue to GCP here。