Skip to content

Commit 78aff18

Browse files
committed
Merge branch 'feature-29-conversationAbstraction' into develop
2 parents a26ca67 + ef1a68b commit 78aff18

18 files changed

+916
-7
lines changed

Config.json.enc

256 Bytes
Binary file not shown.
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
/**
2+
* Copyright 2015 IBM Corp. All Rights Reserved.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*
16+
*/
17+
18+
using UnityEngine;
19+
using System.Collections;
20+
using IBM.Watson.DeveloperCloud.Services.Conversation.v1;
21+
22+
public class ExampleConversation : MonoBehaviour
23+
{
24+
private Conversation m_Conversation = new Conversation();
25+
private string m_WorkspaceID = "car_demo_1";
26+
private string m_Input = "Can you unlock the door?";
27+
28+
void Start () {
29+
Debug.Log("User: " + m_Input);
30+
m_Conversation.Message(m_WorkspaceID, m_Input, OnMessage);
31+
}
32+
33+
void OnMessage (DataModels.MessageResponse resp)
34+
{
35+
foreach(DataModels.MessageIntent mi in resp.intents)
36+
Debug.Log("intent: " + mi.intent + ", confidence: " + mi.confidence);
37+
38+
Debug.Log("response: " + resp.output.text);
39+
}
40+
}

Examples/ServiceExamples/Scripts/ExampleConversation.cs.meta

Lines changed: 12 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Examples/ServiceExamples/Scripts/ExampleDIalog.cs

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,21 @@
1-
using UnityEngine;
1+
/**
2+
* Copyright 2015 IBM Corp. All Rights Reserved.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*
16+
*/
17+
18+
using UnityEngine;
219
using IBM.Watson.DeveloperCloud.Services.Dialog.v1;
320

421
public class ExampleDIalog : MonoBehaviour

Examples/ServiceExamples/Scripts/ExampleLanguageTranslation.cs

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,21 @@
1-
using UnityEngine;
1+
/**
2+
* Copyright 2015 IBM Corp. All Rights Reserved.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*
16+
*/
17+
18+
using UnityEngine;
219
using IBM.Watson.DeveloperCloud.Services.LanguageTranslation.v1;
320

421
public class ExampleLanguageTranslation : MonoBehaviour {

Examples/ServiceExamples/Scripts/ExampleNaturalLanguageClassifier.cs

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,21 @@
1-
using UnityEngine;
1+
/**
2+
* Copyright 2015 IBM Corp. All Rights Reserved.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*
16+
*/
17+
18+
using UnityEngine;
219
using IBM.Watson.DeveloperCloud.Services.NaturalLanguageClassifier.v1;
320

421
public class ExampleNaturalLanguageClassifier : MonoBehaviour

Examples/ServiceExamples/Scripts/ExampleSpeechToText.cs

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,21 @@
1-
using UnityEngine;
1+
/**
2+
* Copyright 2015 IBM Corp. All Rights Reserved.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*
16+
*/
17+
18+
using UnityEngine;
219
using IBM.Watson.DeveloperCloud.Services.SpeechToText.v1;
320

421
public class ExampleSpeechToText : MonoBehaviour

Examples/ServiceExamples/Scripts/ExampleTextToSpeech.cs

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,21 @@
1-
using UnityEngine;
1+
/**
2+
* Copyright 2015 IBM Corp. All Rights Reserved.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*
16+
*/
17+
18+
using UnityEngine;
219
using IBM.Watson.DeveloperCloud.Services.TextToSpeech.v1;
320

421
public class ExampleTextToSpeech : MonoBehaviour

Examples/ServiceExamples/ServiceExamples.unity

Lines changed: 40 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -209,6 +209,45 @@ Transform:
209209
m_LocalScale: {x: 1, y: 1, z: 1}
210210
m_Children: []
211211
m_Father: {fileID: 0}
212+
m_RootOrder: 6
213+
--- !u!1 &859102722
214+
GameObject:
215+
m_ObjectHideFlags: 0
216+
m_PrefabParentObject: {fileID: 0}
217+
m_PrefabInternal: {fileID: 0}
218+
serializedVersion: 4
219+
m_Component:
220+
- 4: {fileID: 859102724}
221+
- 114: {fileID: 859102723}
222+
m_Layer: 0
223+
m_Name: ExampleConversation
224+
m_TagString: Untagged
225+
m_Icon: {fileID: 0}
226+
m_NavMeshLayer: 0
227+
m_StaticEditorFlags: 0
228+
m_IsActive: 1
229+
--- !u!114 &859102723
230+
MonoBehaviour:
231+
m_ObjectHideFlags: 0
232+
m_PrefabParentObject: {fileID: 0}
233+
m_PrefabInternal: {fileID: 0}
234+
m_GameObject: {fileID: 859102722}
235+
m_Enabled: 1
236+
m_EditorHideFlags: 0
237+
m_Script: {fileID: 11500000, guid: db0d0fc567bc64a34a5c3e405a733f6b, type: 3}
238+
m_Name:
239+
m_EditorClassIdentifier:
240+
--- !u!4 &859102724
241+
Transform:
242+
m_ObjectHideFlags: 0
243+
m_PrefabParentObject: {fileID: 0}
244+
m_PrefabInternal: {fileID: 0}
245+
m_GameObject: {fileID: 859102722}
246+
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
247+
m_LocalPosition: {x: 0, y: 0, z: 0}
248+
m_LocalScale: {x: 1, y: 1, z: 1}
249+
m_Children: []
250+
m_Father: {fileID: 0}
212251
m_RootOrder: 5
213252
--- !u!1 &1160237478
214253
GameObject:
@@ -225,7 +264,7 @@ GameObject:
225264
m_Icon: {fileID: 0}
226265
m_NavMeshLayer: 0
227266
m_StaticEditorFlags: 0
228-
m_IsActive: 1
267+
m_IsActive: 0
229268
--- !u!114 &1160237479
230269
MonoBehaviour:
231270
m_ObjectHideFlags: 0

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

0 commit comments

Comments
 (0)