-
Notifications
You must be signed in to change notification settings - Fork 3
NLP
For detailed explanation for Dialogflow, please click here.
The following only deals with the self-defined Dialogflow service using Kotlin.
You should put your access token into the app\src\main\res\values\string.xml
<string name="NLP_key">****</string>
This function call initService()
to initiate the service.
This function initiates service and configures the language as well as the connection between android application and the server.
- Parameters:
- intent(Intent): This intent consists of message and the receiver
of the message. For clarification,
contact
could be a cellphone number or a slack channel ID.//This is for sending message to the NLP service in other // activities or services val i = Intent(this, NaturalLanguageProcessService::class.java) i.putExtra("msg", msg) i.putExtra("phonenumber",channel) startService(i)
- intent(Intent): This intent consists of message and the receiver
of the message. For clarification,
This function sends the message to Dialogflow server.
- Parameters:
-
queryString(String)
: The message sent to Dialogflow. -
eventString(String)
: The event configured in Dialogflow. -
contextString(String)
: The context con figured in Dialogflow.
-
This listener retrieves the message from the server and convert the response to JSON before extracting and broadcasting needed information.
- Parameters:
-
response(AIResponse)
: The response received from the server.
-
This function clears all the recorded response parameter for fear of interference of next message request.
This function sends message to a certain Slack channel by starting Slack service.
- Parameters:
-
msg(String)
: The message to be sent to Slack -
channel(Sring):
Slack channel ID
-
This function broadcasts the processing result locally and Central Hub
will get notified of the result. This function is called in private fun onResult(response: AIResponse)
.