2017-06-10 66 views
0

我想更好地瞭解IBM Bluemix自然語言理解如何工作。 docsIBM Bluemix,nl_understanding - 文檔在哪

我發現了下面的例子。

import sys 
import os 
sys.path.append(os.path.join(os.getcwd(),'..')) 
import watson_developer_cloud 
import watson_developer_cloud.natural_language_understanding.features.v1 as features 

nlu = watson_developer_cloud.NaturalLanguageUnderstandingV1(version='2017-02-27', 
                  username='some_username', 
                  password='some_password') 

nlu.analyze(text='this is my experimental text. Bruce Banner is the Hulk and Bruce Wayne is BATMAN! Superman fears not Banner, but Wayne.', 
      features=[features.Entities(), features.Keywords()]) 

它會生成以下的輸出:

{'entities': [{'count': 3, 
    'relevance': 0.915411, 
    'text': 'Bruce Banner', 
    'type': 'Person'}, 
    {'count': 1, 'relevance': 0.296395, 'text': 'Wayne', 'type': 'Person'}], 
'keywords': [{'relevance': 0.984789, 'text': 'Bruce Banner'}, 
    {'relevance': 0.958833, 'text': 'Bruce Wayne'}, 
    {'relevance': 0.853322, 'text': 'experimental text'}, 
    {'relevance': 0.627454, 'text': 'Hulk'}, 
    {'relevance': 0.619956, 'text': 'Superman'}, 
    {'relevance': 0.583188, 'text': 'BATMAN'}], 
'language': 'en'} 

什麼是在這個輸出relevance?它是如何計算的?我不需要詳細的計算,因爲它可能是專有的,但我希望有基本的理解。我也想知道keywords如何識別?是否有特定的語料庫用於關鍵字識別?

IBM網站上的文檔有限。

回答