Skip to content

Commit 8c18722

Browse files
committed
updating readme with sample code for conversation
1 parent 2f6a007 commit 8c18722

File tree

2 files changed

+23
-2
lines changed

2 files changed

+23
-2
lines changed

README.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -210,6 +210,28 @@ You can use the Natural Language Classifier Editor to import and export classifi
210210
2. In the **Name** field, specify a name for the classifier.
211211
3. Click **Create**.
212212

213+
### Conversation
214+
<!-- conversation description here: Change link below -->
215+
216+
```cs
217+
private Conversation m_Conversation = new Conversation();
218+
private string m_WorkspaceID = "car_demo_1";
219+
private string m_Input = "Can you unlock the door?";
220+
221+
void Start () {
222+
Debug.Log("User: " + m_Input);
223+
m_Conversation.Message(m_WorkspaceID, m_Input, OnMessage);
224+
}
225+
226+
void OnMessage (DataModels.MessageResponse resp)
227+
{
228+
foreach(DataModels.MessageIntent mi in resp.intents)
229+
Debug.Log("intent: " + mi.intent + ", confidence: " + mi.confidence);
230+
231+
Debug.Log("response: " + resp.output.text);
232+
}
233+
```
234+
213235
## Developing a basic application in one minute
214236
You can quickly develop a basic application that uses the Speech to Text service and the Natural Language Classifier service by using the prefabs that come with the SDK. Ensure that you prepare the test data before you complete the the following steps:
215237
1. Create a new scene and drag the following prefabs from **Assets -> Watson -> Prefabs**, and drop them in the Hierarchy tab:
@@ -252,6 +274,7 @@ See [CONTRIBUTING.md](.github/CONTRIBUTING.md).
252274
[language_translation]: http://www.ibm.com/smarterplanet/us/en/ibmwatson/developercloud/doc/language-translation/
253275
[dialog]: http://www.ibm.com/smarterplanet/us/en/ibmwatson/developercloud/doc/dialog/
254276
[natural_language_classifier]: http://www.ibm.com/smarterplanet/us/en/ibmwatson/developercloud/doc/nl-classifier/
277+
[conversation]: http://www.ibm.com/smarterplanet/us/en/ibmwatson/developercloud/doc/dialog/
255278

256279
[alchemy_language]: http://www.alchemyapi.com/products/alchemylanguage
257280
[sentiment_analysis]: http://www.alchemyapi.com/products/alchemylanguage/sentiment-analysis

Scripts/Services/Conversation/Conversation.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,5 @@ public void GetServiceStatus(ServiceStatus callback)
136136
}
137137

138138
#endregion
139-
140-
141139
}
142140
}

0 commit comments

Comments
 (0)