Skip to content

Commit 57016a1

Browse files
authored
Merge pull request #93 from watson-developer-cloud/develop
Merge v0.5.0 into master for release
2 parents ea4aba5 + 0974ca1 commit 57016a1

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+19152
-792
lines changed

CHANGELOG.md

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,26 @@
11
Change Log
22
==========
3+
## Version 0.5.0
4+
5+
_2016-06-24_
6+
7+
* New: Added `Alchemy Language` abstraction
8+
* New: Added `Personality Insights` abstraction
9+
* Fix: Added `Tone Analyzer` to the Configuration Editor
10+
* Fix: Added `Tradeoff Analytics` to the Configuration Editor
11+
* Fix: Added `Conversation` to the Configuration Editor
12+
* Fix: Added `Personality Insights` to the Configuration Editor
13+
* Fix: Added `Alchemy Language` to the Configuration Editor
14+
* Fix: Added `Visual Recognition` to the Configuration Editor
15+
316
## Version 0.4.0
417

518
_2016-06-09_
619

7-
* New: Added Tone Analyzer v3 abstraction
8-
* New: Added Tradeoff Analytics abstraction
9-
* New: Added Conversation abstraction
10-
* New: Added Visual Recognition v3 abstraction
20+
* New: Added `Tone Analyzer v3` abstraction
21+
* New: Added `Tradeoff Analytics` abstraction
22+
* New: Added `Conversation` abstraction
23+
* New: Added `Visual Recognition v3` abstraction
1124
* Fix: Creating test project dynamically for Travis CL integration
1225
* Fix: Refactored Language Translation to Language Translator
1326
* Fix: Widget examples sprite references were disconnected

Config.json.enc

1.02 KB
Binary file not shown.

Examples/ServiceExamples/Scripts/ExampleAlchemyLanguage.cs

Lines changed: 603 additions & 0 deletions
Large diffs are not rendered by default.

Scripts/Services/AlchemyAPI/AlchemyAPI.cs.meta renamed to Examples/ServiceExamples/Scripts/ExampleAlchemyLanguage.cs.meta

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

Examples/ServiceExamples/Scripts/ExampleConversation.cs

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
public class ExampleConversation : MonoBehaviour
2323
{
2424
private Conversation m_Conversation = new Conversation();
25-
private string m_WorkspaceID = "car_demo_1";
25+
private string m_WorkspaceID = "25dfa8a0-0263-471b-8980-317e68c30488";
2626
private string m_Input = "Can you unlock the door?";
2727

2828
void Start () {
@@ -32,9 +32,17 @@ void Start () {
3232

3333
void OnMessage (DataModels.MessageResponse resp)
3434
{
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);
35+
if(resp != null)
36+
{
37+
foreach(DataModels.MessageIntent mi in resp.intents)
38+
Debug.Log("intent: " + mi.intent + ", confidence: " + mi.confidence);
39+
40+
if(resp.output != null && !string.IsNullOrEmpty(resp.output.text))
41+
Debug.Log("response: " + resp.output.text);
42+
}
43+
else
44+
{
45+
Debug.Log("Failed to invoke Message();");
46+
}
3947
}
4048
}
Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
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.PersonalityInsights.v2;
21+
using IBM.Watson.DeveloperCloud.Logging;
22+
23+
public class ExamplePersonalityInsights : MonoBehaviour {
24+
PersonalityInsights m_personalityInsights = new PersonalityInsights();
25+
private string testString = "Facing certain defeat at the hands of a room-size I.B.M. computer on Wednesday evening, Ken Jennings, famous for winning 74 games in a row on the TV quiz show, acknowledged the obvious. \"I, for one, welcome our new computer overlords,\" he wrote on his video screen, borrowing a line from a \"Simpsons\" episode.\n\nFrom now on, if the answer is \"the computer champion on \"Jeopardy!,\" the question will be, \"What is Watson?\"\n\nFor I.B.M., the showdown was not merely a well-publicized stunt and a $1 million prize, but proof that the company has taken a big step toward a world in which intelligent machines will understand and respond to humans, and perhaps inevitably, replace some of them.\n\nWatson, specifically, is a \"question answering machine\" of a type that artificial intelligence researchers have struggled with for decades — a computer akin to the one on \"Star Trek\" that can understand questions posed in natural language and answer them.\n\nWatson showed itself to be imperfect, but researchers at I.B.M. and other companies are already developing uses for Watson's technologies that could have a significant impact on the way doctors practice and consumers buy products.\n\n\"Cast your mind back 20 years and who would have thought this was possible?\" said Edward Feigenbaum, a Stanford University computer scientist and a pioneer in the field.\n\nIn its \"Jeopardy!\" project, I.B.M. researchers were tackling a game that requires not only encyclopedic recall, but also the ability to untangle convoluted and often opaque statements, a modicum of luck, and quick, strategic button pressing.\n\nThe contest, which was taped in January here at the company's T. J. Watson Research Laboratory before an audience of I.B.M. executives and company clients, played out in three televised episodes concluding Wednesday. At the end of the first day, Watson was in a tie with Brad Rutter, another ace human player, at $5,000 each, with Mr. Jennings trailing with $2,000.\n\nBut on the second day, Watson went on a tear. By night's end, Watson had a commanding lead with a total of $35,734, compared with Mr. Rutter's $10,400 and Mr. Jennings's $4,800.\n\nVictory was not cemented until late in the third match, when Watson was in Nonfiction. \"Same category for $1,200,\" it said in a manufactured tenor, and lucked into a Daily Double. Mr. Jennings grimaced.\n\nEven later in the match, however, had Mr. Jennings won another key Daily Double it might have come down to Final Jeopardy, I.B.M. researchers acknowledged.\n\nThe final tally was $77,147 to Mr. Jennings's $24,000 and Mr. Rutter's $21,600.\n\nMore than anything, the contest was a vindication for the academic field of artificial intelligence, which began with great promise in the 1960s with the vision of creating a thinking machine and which became the laughingstock of Silicon Valley in the 1980s, when a series of heavily financed start-up companies went bankrupt.\n\nDespite its intellectual prowess, Watson was by no means omniscient. On Tuesday evening during Final Jeopardy, the category was U.S. Cities and the clue was: \"Its largest airport is named for a World War II hero; its second largest for a World War II battle.\"\n\nWatson drew guffaws from many in the television audience when it responded \"What is Toronto?????\"\n\nThe string of question marks indicated that the system had very low confidence in its response, I.B.M. researchers said, but because it was Final Jeopardy, it was forced to give a response. The machine did not suffer much damage. It had wagered just $947 on its result. (The correct answer is, \"What is Chicago?\")\n\n\"We failed to deeply understand what was going on there,\" said David Ferrucci, an I.B.M. researcher who led the development of Watson. \"The reality is that there's lots of data where the title is U.S. cities and the answers are countries, European cities, people, mayors. Even though it says U.S. cities, we had very little confidence that that's the distinguishing feature.\"\n\nThe researchers also acknowledged that the machine had benefited from the \"buzzer factor.\"\n\nBoth Mr. Jennings and Mr. Rutter are accomplished at anticipating the light that signals it is possible to \"buzz in,\" and can sometimes get in with virtually zero lag time. The danger is to buzz too early, in which case the contestant is penalized and \"locked out\" for roughly a quarter of a second.\n\nWatson, on the other hand, does not anticipate the light, but has a weighted scheme that allows it, when it is highly confident, to hit the buzzer in as little as 10 milliseconds, making it very hard for humans to beat. When it was less confident, it took longer to buzz in. In the second round, Watson beat the others to the buzzer in 24 out of 30 Double Jeopardy questions.\n\n\"It sort of wants to get beaten when it doesn't have high confidence,\" Dr. Ferrucci said. \"It doesn't want to look stupid.\"\n\nBoth human players said that Watson's button pushing skill was not necessarily an unfair advantage. \"I beat Watson a couple of times,\" Mr. Rutter said.\n\nWhen Watson did buzz in, it made the most of it. Showing the ability to parse language, it responded to, \"A recent best seller by Muriel Barbery is called 'This of the Hedgehog,' \" with \"What is Elegance?\"\n\nIt showed its facility with medical diagnosis. With the answer: \"You just need a nap. You don't have this sleep disorder that can make sufferers nod off while standing up,\" Watson replied, \"What is narcolepsy?\"\n\nThe coup de grâce came with the answer, \"William Wilkenson's 'An Account of the Principalities of Wallachia and Moldavia' inspired this author's most famous novel.\" Mr. Jennings wrote, correctly, Bram Stoker, but realized that he could not catch up with Watson's winnings and wrote out his surrender.\n\nBoth players took the contest and its outcome philosophically.\n\n\"I had a great time and I would do it again in a heartbeat,\" said Mr. Jennings. \"It's not about the results; this is about being part of the future.\"\n\nFor I.B.M., the future will happen very quickly, company executives said. On Thursday it plans to announce that it will collaborate with Columbia University and the University of Maryland to create a physician's assistant service that will allow doctors to query a cybernetic assistant. The company also plans to work with Nuance Communications Inc. to add voice recognition to the physician's assistant, possibly making the service available in as little as 18 months.\n\n\"I have been in medical education for 40 years and we're still a very memory-based curriculum,\" said Dr. Herbert Chase, a professor of clinical medicine at Columbia University who is working with I.B.M. on the physician's assistant. \"The power of Watson- like tools will cause us to reconsider what it is we want students to do.\"\n\nI.B.M. executives also said they are in discussions with a major consumer electronics retailer to develop a version of Watson, named after I.B.M.'s founder, Thomas J. Watson, that would be able to interact with consumers on a variety of subjects like buying decisions and technical support.\n\nDr. Ferrucci sees none of the fears that have been expressed by theorists and science fiction writers about the potential of computers to usurp humans.\n\n\"People ask me if this is HAL,\" he said, referring to the computer in \"2001: A Space Odyssey.\" \"HAL's not the focus; the focus is on the computer on 'Star Trek,' where you have this intelligent information seek dialogue, where you can ask follow-up questions and the computer can look at all the evidence and tries to ask follow-up questions. That's very cool.\"";
26+
27+
void Start ()
28+
{
29+
LogSystem.InstallDefaultReactors();
30+
string dataPath = Application.dataPath + "/Watson/Examples/ServiceExamples/TestData/personalityInsights.json";
31+
32+
if(!m_personalityInsights.GetProfile(OnGetProfile, dataPath, DataModels.ContentType.TEXT_PLAIN, DataModels.Language.ENGLISH))
33+
Log.Debug("ExamplePersonalityInsights", "Failed to get profile!");
34+
}
35+
36+
private void OnGetProfile(DataModels.Profile profile, string data)
37+
{
38+
Log.Debug("ExamplePersonalityInsights", "data: {0}", data);
39+
if(profile != null)
40+
{
41+
if(!string.IsNullOrEmpty(profile.id))
42+
Log.Debug("ExamplePersonalityInsights", "id: {0}", profile.id);
43+
if(!string.IsNullOrEmpty(profile.source))
44+
Log.Debug("ExamplePersonalityInsights", "source: {0}", profile.source);
45+
if(!string.IsNullOrEmpty(profile.processed_lang))
46+
Log.Debug("ExamplePersonalityInsights", "proccessed_lang: {0}", profile.processed_lang);
47+
if(!string.IsNullOrEmpty(profile.word_count))
48+
Log.Debug("ExamplePersonalityInsights", "word_count: {0}", profile.word_count);
49+
if(!string.IsNullOrEmpty(profile.word_count_message))
50+
Log.Debug("ExamplePersonalityInsights", "word_count_message: {0}", profile.word_count_message);
51+
52+
if(profile.tree != null)
53+
{
54+
LogTraitTree(profile.tree);
55+
}
56+
}
57+
else
58+
{
59+
Log.Debug("ExamplePersonalityInsights", "Failed to get profile!");
60+
}
61+
}
62+
63+
private void LogTraitTree(DataModels.TraitTreeNode traitTreeNode)
64+
{
65+
if(!string.IsNullOrEmpty(traitTreeNode.id))
66+
Log.Debug("ExamplePersonalityInsights", "id: {0}", traitTreeNode.id);
67+
if(!string.IsNullOrEmpty(traitTreeNode.name))
68+
Log.Debug("ExamplePersonalityInsights", "name: {0}", traitTreeNode.name);
69+
if(!string.IsNullOrEmpty(traitTreeNode.category))
70+
Log.Debug("ExamplePersonalityInsights", "category: {0}", traitTreeNode.category);
71+
if(!string.IsNullOrEmpty(traitTreeNode.percentage))
72+
Log.Debug("ExamplePersonalityInsights", "percentage: {0}", traitTreeNode.percentage);
73+
if(!string.IsNullOrEmpty(traitTreeNode.sampling_error))
74+
Log.Debug("ExamplePersonalityInsights", "sampling_error: {0}", traitTreeNode.sampling_error);
75+
if(!string.IsNullOrEmpty(traitTreeNode.raw_score))
76+
Log.Debug("ExamplePersonalityInsights", "raw_score: {0}", traitTreeNode.raw_score);
77+
if(!string.IsNullOrEmpty(traitTreeNode.raw_sampling_error))
78+
Log.Debug("ExamplePersonalityInsights", "raw_sampling_error: {0}", traitTreeNode.raw_sampling_error);
79+
if(traitTreeNode.children != null && traitTreeNode.children.Length > 0)
80+
foreach(DataModels.TraitTreeNode childNode in traitTreeNode.children)
81+
LogTraitTree(childNode);
82+
}
83+
}

Scripts/UnitTests/TestAlchemyAPI.cs.meta renamed to Examples/ServiceExamples/Scripts/ExamplePersonalityInsights.cs.meta

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

Examples/ServiceExamples/Scripts/ExampleVisualRecognition.cs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
public class ExampleVisualRecognition : MonoBehaviour {
2525
private VisualRecognition m_VisualRecognition = new VisualRecognition();
2626
private string m_classifierName = "Apples_OptionalParams";
27-
private string m_classifierID = "Apples_OptionalParams_1213405640";
27+
private string m_classifierID = "ApplesClassifierNameWithSpaces_73100404";
2828
private string m_classifierToDelete = "unitytestclassifier2b_37849361";
2929
private string m_imageURL = "https://upload.wikimedia.org/wikipedia/commons/e/e9/Official_portrait_of_Barack_Obama.jpg";
3030
private string m_imageTextURL = "http://i.stack.imgur.com/ZS6nH.png";
@@ -36,7 +36,7 @@ void Start ()
3636
// Get all classifiers
3737
if(!m_VisualRecognition.GetClassifiers(OnGetClassifiers))
3838
Log.Debug("ExampleVisualRecognition", "Getting classifiers failed!");
39-
39+
//
4040
// Find classifier by name
4141
m_VisualRecognition.FindClassifier(m_classifierName, OnFindClassifier);
4242

@@ -49,17 +49,17 @@ void Start ()
4949
Log.Debug("ExampleVisualRecognition", "Deleting classifier failed!");
5050

5151
// Train classifier
52-
string m_positiveExamplesPath = Application.dataPath + "/Watson/Examples/ServiceExamples/TestData/taj_positive_examples.zip";
53-
string m_negativeExamplesPath = Application.dataPath + "/Watson/Examples/ServiceExamples/TestData/negative_examples.zip";
54-
if(!m_VisualRecognition.TrainClassifier("unity-test-classifier5", "taj", m_positiveExamplesPath, m_negativeExamplesPath, OnTrainClassifier))
52+
string m_positiveExamplesPath = Application.dataPath + "/Watson/Examples/ServiceExamples/TestData/visual-recognition-classifiers/giraffe_positive_examples.zip";
53+
string m_negativeExamplesPath = Application.dataPath + "/Watson/Examples/ServiceExamples/TestData/visual-recognition-classifiers/negative_examples.zip";
54+
if(!m_VisualRecognition.TrainClassifier("unity-test-classifier5", "giraffe", m_positiveExamplesPath, m_negativeExamplesPath, OnTrainClassifier))
5555
Log.Debug("ExampleVisualRecognition", "Train classifier failed!");
5656

5757
// Classify get
5858
if(!m_VisualRecognition.Classify(m_imageURL, OnClassify))
5959
Log.Debug("ExampleVisualRecognition", "Classify image failed!");
6060

6161
// Classify post image
62-
string m_imagesPath = Application.dataPath + "/Watson/Examples/ServiceExamples/TestData/obama.jpg";
62+
string m_imagesPath = Application.dataPath + "/Watson/Examples/ServiceExamples/TestData/visual-recognition-classifiers/obama.jpg";
6363
string[] m_owners = {"IBM", "me"};
6464
string[] m_classifierIDs = {"default"};
6565
if(!m_VisualRecognition.Classify(OnClassify, m_imagesPath, m_owners, m_classifierIDs, 0.5f))
@@ -71,7 +71,7 @@ void Start ()
7171
Log.Debug("ExampleVisualRecogntiion", "Detect faces failed!");
7272

7373
// Detect faces post image
74-
string m_faceExamplePath = Application.dataPath + "/Watson/Examples/ServiceExamples/TestData/obama.jpg";
74+
string m_faceExamplePath = Application.dataPath + "/Watson/Examples/ServiceExamples/TestData/visual-recognition-classifiers/obama.jpg";
7575
if(!m_VisualRecognition.DetectFaces(OnDetectFaces, m_faceExamplePath))
7676
Log.Debug("ExampleVisualRecognition", "Detect faces failed!");
7777

@@ -82,7 +82,7 @@ void Start ()
8282
Log.Debug("ExampleVisualRecognition", "Recognize text failed!");
8383

8484
// Recognize text post image
85-
string m_textExamplePath = Application.dataPath + "/Watson/Examples/ServiceExamples/TestData/from_platos_apology.png";
85+
string m_textExamplePath = Application.dataPath + "/Watson/Examples/ServiceExamples/TestData/visual-recognition-classifiers/from_platos_apology.png";
8686
if(!m_VisualRecognition.RecognizeText(OnRecognizeText, m_textExamplePath))
8787
Log.Debug("ExampleVisualRecognition", "Recognize text failed!");
8888
}

0 commit comments

Comments
 (0)