在luis服务中发布了一个应用,希望将其与python一起以编程方式使用
from azure.cognitiveservices.language.luis.runtime import LUISRuntimeClient
from msrest.authentication import CognitiveServicesCredentials
// Create client with SubscriptionKey and Endpoint
client = LUISRuntimeClient(
'https://westus.api.cognitive.microsoft.com', # Change "westus" to your region if necessary
CognitiveServicesCredentials("[LUIS_SUBSCRIPTION_KEY]"), # Put your LUIS Subscription key
)
// Predict
df['utternace'].apply(lambda x: client.prediction.resolve('XXXXXXXXXXXXX',x))
(XXXXXXX是应用程序ID)
输出未按文档提供分数
{'additional_properties': {}, 'query': 'implication the entity may not be able to monitor details effectively ', 'altered_query': None, 'top_scoring_intent': **<azure.cognitiveservices.language.luis.runtime.models.intent_model_py3.IntentModel object at 0x000001FEBBC81588>**, 'intents': None, 'entities': [], 'composite_entities': None, 'sentiment_analysis': **<azure.cognitiveservices.language.luis.runtime.models.sentiment_py3.Sentiment object at 0x000001FEBBC810B8>}**
从文档输出中应该是这样
如何将LUIS结果提取到熊猫数据框