Intent Understanding
- Example request
//You are advised to construct and use the client in a singleton pattern to avoid frequent object creation. NluClient client = new NluClient (AuthMode.AKSK,authInfo); IntentReq req = new IntentReq(); req.setText("Text for analysis"); //Supported language of the text. zh indicates Chinese. Only Chinese is currently supported. req.setLang("zh"); try { IntentResp resp = client.getIntent(req); } catch (NlpException e) { //A failure is thrown as an exception. For details about exceptions, see section "Exceptions". The client automatically processes exceptions. }·
- Table 1 describes IntentReq parameters.
Table 1 IntentReq parameters Parameter
Mandatory
Type
Description
text
Yes
String
Text to be analyzed. The text is encoded using UTF-8 and the value contains a maximum of 400 characters. If the value exceeds 400 characters, only the first 400 characters are detected.
lang
No
String
Supported language type. Currently, only Chinese is supported. The default value is zh.
- Table 2 describes IntentResp parameters.
- Table 3 describes the data structure description of the IntentResult field.
Table 3 Data structure description of the IntentResult field Parameter
Type
Description
text
String
Text to be analyzed.
label
String
Intent label of the text to be analyzed. Labels are classified into the following types:
weather, time, news, joke, translation, notification, alarm, music, and others.
confidence
Float
Confidence level of a label
slots
List of Slot
Entity text list of the sentence to be analyzed. For details about the slot data structure, see Table 4.
Table 4 Data structure description of the Slot field Parameter
Type
Description
word
String
Entity text to be analyzed
tag
String
Entity type. Entity types supported by each intent category are:
weather: date, time, and location
time: location and timezone
news: genre
joke: genre
translation: content
notification: content, date, time, and singer
alarm: date and time
music: singer, song, and content
offset
Integer
Starting position of the entity text in the text to be analyzed
length
Integer
Entity text length
normalizedWord
String
Synonym or other normalized word. The default value is the original word text.
Last Article: Text Classification
Next Article: Accessing the Client via HTTP Proxies
Did this article solve your problem?
Thank you for your score!Your feedback would help us improve the website.