语言理解 (LUIS) 是一种基于云的对话式 AI 服务,可在用户对话的自然语言文本中应用自定义机器学习智能,*以便预测整体含义并提炼出相关的详细信息*。 LUIS 通过其自定义门户、API 和 SDK 客户端库提供访问权限。找重点,会提炼出相关信息,换句话讲,就是把要表达的信息转化成机器或者说AI能够识别的信息。
# # This quickstart shows how to predict the intent of an utterance by using the LUIS REST APIs. # 导入模块 import requests
try: ########## # Values to modify. # YOUR-APP-ID: The App ID GUID found on the www.luis.ai Application Settings page. # 替换为自己的APP-ID appId = '949d3538-07df-4149-bee8-83dc7f4e11bd' # YOUR-PREDICTION-KEY: Your LUIS prediction key, 32 character value. prediction_key = '24440ef2829c45f0**61599ee00b496a' # YOUR-PREDICTION-ENDPOINT: Replace with your prediction endpoint. # For example, "https://westus.api.cognitive.microsoft.com/" prediction_endpoint = 'https://chatbot0.cognitiveservices.azure.cn/' # The utterance you want to use. # 你想和他说的话.. utterance = '一个人怎么生活?' ########## # The headers to use in this REST call. headers = { }
# The URL parameters to use in this REST call. params ={ 'query': utterance, 'timezoneOffset': '0', 'verbose': 'true', 'show-all-intents': 'true', 'spellCheck': 'false', 'staging': 'false', 'subscription-key': prediction_key }
# Make the REST call. response = requests.get(f'{prediction_endpoint}luis/prediction/v3.0/apps/{appId}/slots/production/predict', headers=headers, params=params)
# Display the results on the console. print(response.json())
except Exception as e: # Display the error string. print(f'{e}')
Using '/input'for reading models and other read-only data. Using '/output/luis/ff2a18ee78a1'for writing logs and other output data. Logging to console. Submitting metering to 'https://chatbot0.cognitiveservices.azure.cn/'. warn: Microsoft.AspNetCore.DataProtection.KeyManagement.XmlKeyManager[35] No XML encryptor configured. Key {d826e89b-febe-4b93-bad8-db07cb994012} may be persisted to storage in unencrypted form. warn: Microsoft.AspNetCore.Server.Kestrel[0] Overriding address(es) 'http://+:80'. Binding to endpoints defined in UseKestrel() instead. Hosting environment: Production Content root path: /app Now listening on: http://0.0.0.0:5000 Application started. Press Ctrl+C to shut down.
Using '/input'for reading models and other read-only data. Using '/output/luis/da43b9631f9d'for writing logs and other output data. Logging to console. Submitting metering to 'https://chatbot0.cognitiveservices.azure.cn/'. warn: Microsoft.AspNetCore.DataProtection.KeyManagement.XmlKeyManager[35] No XML encryptor configured. Key {886021ff-6bf5-423d-be12-ba9b52383b9e} may be persisted to storage in unencrypted form. warn: Microsoft.AspNetCore.Server.Kestrel[0] Overriding address(es) 'http://+:80'. Binding to endpoints defined in UseKestrel() instead. Hosting environment: Production Content root path: /app Now listening on: http://0.0.0.0:5000 Application started. Press Ctrl+C to shut down.
语言理解 (LUIS) 是一种基于云的对话式 AI 服务,可在用户对话的自然语言文本中应用自定义机器学习智能,*以便预测整体含义并提炼出相关的详细信息*。 LUIS 通过其自定义门户、API 和 SDK 客户端库提供访问权限。找重点,会提炼出相关信息,换句话讲,就是把要表达的信息转化成机器或者说AI能够识别的信息。
┌──[root@liruilongs.github.io]-[~/translateDemo] └─$ vim translateDemo.js ┌──[root@liruilongs.github.io]-[~/translateDemo] └─$ docker run -it --rm --name=translateDemo -v $PWD/translateDemo.js:/root/translateDemo.js node:latest /bin/bash root@35376c1c05d8:/# pwd / root@35376c1c05d8:/# cd root/;npm install axios uuid
added 3 packages, and audited 4 packages in 7s
1 package is looking for funding run `npm fund` for details
found 0 vulnerabilities root@35376c1c05d8:~# node translateDemo.js [ { "translations": [ { "text": "我徒然學會了抗拒熱鬧,卻還來不及透悟真正的冷清。 --------張大春", "to": "zh-Hant" }, { "text": "I learned in vain to resist the excitement, but it is too late to understand the real cold. -------- Zhang Dachun", "to": "en" } ] } ] root@35376c1c05d8:~#