Skip to content

Commit fc3bc8e

Browse files
committed
integration tests and documentation
1 parent 2e5b13b commit fc3bc8e

File tree

4 files changed

+162
-3
lines changed

4 files changed

+162
-3
lines changed

Examples/ServiceExamples/Scripts/ExamplePersonalityInsights.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222

2323
public class ExamplePersonalityInsights : MonoBehaviour {
2424
PersonalityInsights m_personalityInsights = new PersonalityInsights();
25-
private string testString = "Columbus, Ohio (CNN)Hillary Clinton is narrowing her choices for a running mate, intently focusing on a handful of potential candidates as her team closes in on the final weeks of vetting before she makes a decision in less than a month, several Democrats watching the process tell CNN.\n\nWith her long Democratic primary fight now over, Clinton has privately signaled she is less concerned about choosing someone who fills a specific liberal or progressive void, rather than selecting a partner who is fully prepared for the job and has a strong camaraderie with her.\nThe list of serious vice presidential candidates is believed to be smaller rather than larger, with Democrats close to the campaign placing it at no more than five contenders. But several aides acknowledged they were not sure, considering the secrecy imposed on the process by Clinton.\nClinton has not yet conducted formal interviews, but has devoted hours studying the records and backgrounds of several Democrats on a list that includes Sen. Tim Kaine of Virginia, Sen. Elizabeth Warren of Massachusetts and Housing and Urban Development Secretary Julian Castro of Texas.\nPlot Clinton's path to 270\nBut those three should not be seen as absolute finalists, several Democrats said, only as active contenders. The roster also may include Labor Secretary Tom Perez, Sen. Sherrod Brown of Ohio and Rep. Xavier Beccera of California.\nAsked about his prospects, Kaine smiled and winked Tuesday as he stepped into an elevator in the Capitol.\nIt does not include Sen. Bernie Sanders of Vermont, her primary rival who has yet to endorse her candidacy but has pledged to help defeat Donald Trump. He was not expecting to be considered, aides said, and her aides say he is not.\nJohn Podesta, chairman of the Clinton campaign and a trusted confidante, is leading the effort, according to Democrats who spoke on the condition of anonymity because they are not authorized to speak about the highly-secretive process. Cheryl Mills, Clinton's longtime adviser and lawyer, is also helping Clinton with the decision.\nBoth were seen leaving Clinton's home in Washington on June 10, hours after the former secretary of state met with Warren. The topic of the meeting was not the vice presidency, aides said, but it was an opportunity for the two whose relationship has not always been warm to have a face-to-face conversation about the direction of the party.\nTrump speech to attack Clinton amid campaign turmoil\nAs Clinton has repeatedly said in interviews, her top consideration is someone who would be able to step into the presidency should anything happen to her. And, by extension, someone who Republicans could not credibly cast as ill-prepared.\n\"I want to be sure that whoever I pick could be president immediately if something were to happen,\" Clinton told CNN earlier this month. \"That's the most important qualification.\"\nAnother top consideration for Clinton and her aides, Democrats said, is finding someone she actually wants to work with, not necessarily someone who checks regional or specific electorate boxes. She, perhaps more than most presumptive nominees in recent history, knows the inner-workings of the West Wing intimately.\nThis could bode well for several Democrats, who aides say Clinton enjoyed campaigning with this year, including Kaine, Perez, Castro and Sen. Cory Booker of New Jersey.\nFor all the calculations about who would make a better running mate, the list of actual candidates is believed to be fairly small. Clinton is not expected to make a decision before Trump reveals his choice at the Republican convention, but aides say she is almost certain to have her decision made privately by then.\nClinton to cast Trump as dangerous — this time, on the economy\n CNN Politics app\nEach Democrat being considered offers a variety of pros and cons that Podesta, Mills and other aides are currently weighing. A veteran Washington lawyer, James Hamilton, is also overseeing the vetting of the candidates.\nThe real scrutiny, though, comes through the work of Democratic lawyers and researchers who are assigned specific candidates and are walled-off from others. They start by studying public records, searching for anything embarrassing, distracting or otherwise problematic.\nOne area of inquiry, for instance, is a batch of legal files in Richmond, Virginia, where death penalty cases of a young civil rights lawyer named Tim Kaine are being reviewed. Kaine was vetted by the Obama campaign eight years ago and people close to that process say nothing was discovered that would disqualify him.\nKaine, a former governor and chairman of the Democratic National Committee, is one of the few prospects with executive experience. He also speaks fluent Spanish, often conducting interviews on the campaign trail or on Capitol Hill in his second language. He is not a progressive firebrand, but that may be less of a demand than once thought during the heat of the Clinton-Sanders fight.\nCastro is seen as young, vibrant and would further cement the Latino vote. But his experience is far less than anyone else on the list and some Democrats fear he could be cast as a lightweight.\nPoll: Clinton tops Trump, but neither prompts excitement\nPerez is seen as someone ready and willing to attack Trump and whose long history in labor politics could excite voters in labor strongholds like Ohio, Pennsylvania and Wisconsin. Yet he has spent most of his life as a political appointee, only successfully running for county council of Montgomery County, Maryland, in 2002.\nWhile Warren is being actively considered, several Democrats close to both women are skeptical she will be selected. She has aggressively attacked Trump in recent weeks -- much to the delight of the Clinton campaign -- but the two do not have a personal relationship and Warren has, at times, been outspoken against some of the Clinton White House's policies.\nLast week, Warren dropped by Clinton's headquarters and fired up the troops, leading one top Democrat to say: \"Never say never. She's good.\"";
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.\"";
2626

2727
void Start ()
2828
{

Scripts/Services/PersonalityInsights/PersonalityInsights.cs

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,25 @@ public class PersonalityInsights : IWatsonService
3636

3737
#region Profile
3838
private const string SERVICE_GET_PROFILE = "/v2/profile";
39+
40+
/// <summary>
41+
/// On get profile delegate.
42+
/// </summary>
3943
public delegate void OnGetProfile(DataModels.Profile profile, string data);
4044

45+
/// <summary>
46+
/// Uses Personality Insights to get the source profile.
47+
/// </summary>
48+
/// <returns><c>true</c>, if profile was gotten, <c>false</c> otherwise.</returns>
49+
/// <param name="callback">Callback.</param>
50+
/// <param name="source">Json or Text source. Json data must follow the ContentListContainer Model.</param>
51+
/// <param name="contentType">Content mime type.</param>
52+
/// <param name="contentLanguage">Content language.</param>
53+
/// <param name="accept">Accept mime type.</param>
54+
/// <param name="acceptLanguage">Accept language.</param>
55+
/// <param name="includeRaw">If set to <c>true</c> include raw.</param>
56+
/// <param name="headers">If set to <c>true</c> headers.</param>
57+
/// <param name="data">Data.</param>
4158
public bool GetProfile(OnGetProfile callback, string source,
4259
string contentType = DataModels.ContentType.TEXT_PLAIN,
4360
string contentLanguage = DataModels.Language.ENGLISH,
@@ -82,8 +99,11 @@ public bool GetProfile(OnGetProfile callback, string source,
8299

83100
return connector.Send(req);
84101
}
85-
86-
private class GetProfileRequest:RESTConnector.Request
102+
103+
/// <summary>
104+
/// Get profile request.
105+
/// </summary>
106+
public class GetProfileRequest:RESTConnector.Request
87107
{
88108
public string Data { get; set; }
89109
public OnGetProfile Callback { get; set; }

0 commit comments

Comments
 (0)