diff --git a/CHANGELOG.md b/CHANGELOG.md index d879a3f00..913125a8e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,12 @@ _2016-07-15_ ## Version 0.5.0 +_2016-06-24_ + +* New: Added `AlchemyData News` abstraction + +## Version 0.5.0 + _2016-06-24_ * New: Added `Alchemy Language` abstraction diff --git a/Config.json.enc b/Config.json.enc index 1e8854907..f9b1ec435 100644 Binary files a/Config.json.enc and b/Config.json.enc differ diff --git a/Examples/ServiceExamples/Scripts/ExampleAlchemyDataNews.cs b/Examples/ServiceExamples/Scripts/ExampleAlchemyDataNews.cs new file mode 100755 index 000000000..834e451d3 --- /dev/null +++ b/Examples/ServiceExamples/Scripts/ExampleAlchemyDataNews.cs @@ -0,0 +1,45 @@ +/** +* Copyright 2015 IBM Corp. All Rights Reserved. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +*/ + +using UnityEngine; +using System.Collections; +using System.Collections.Generic; +using IBM.Watson.DeveloperCloud.Services.AlchemyAPI.v1; +using IBM.Watson.DeveloperCloud.Logging; +using System; + +public class ExampleAlchemyDataNews : MonoBehaviour { + private AlchemyAPI m_AlchemyAPI = new AlchemyAPI(); + + void Start () { + LogSystem.InstallDefaultReactors(); + + string[] returnFields = {Fields.ENRICHED_URL_ENTITIES, Fields.ENRICHED_URL_KEYWORDS}; + Dictionary queryFields = new Dictionary(); + queryFields.Add(Fields.ENRICHED_URL_RELATIONS_RELATION_SUBJECT_TEXT, "Obama"); + queryFields.Add(Fields.ENRICHED_URL_CLEANEDTITLE, "Washington"); + + if (!m_AlchemyAPI.GetNews(OnGetNews, returnFields, queryFields)) + Log.Debug("ExampleAlchemyData", "Failed to get news!"); + } + + private void OnGetNews(NewsResponse newsData, string data) + { + if(newsData != null) + Log.Debug("ExampleAlchemyData", "status: {0}", newsData.status); + } +} diff --git a/Examples/ServiceExamples/Scripts/ExampleAlchemyDataNews.cs.meta b/Examples/ServiceExamples/Scripts/ExampleAlchemyDataNews.cs.meta new file mode 100755 index 000000000..8c7554726 --- /dev/null +++ b/Examples/ServiceExamples/Scripts/ExampleAlchemyDataNews.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: c46efb6361e73cf47b69febdae951658 +timeCreated: 1467407987 +licenseType: Pro +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Examples/ServiceExamples/Scripts/ExampleAlchemyLanguage.cs b/Examples/ServiceExamples/Scripts/ExampleAlchemyLanguage.cs old mode 100644 new mode 100755 index 63c300c22..b71c5e707 --- a/Examples/ServiceExamples/Scripts/ExampleAlchemyLanguage.cs +++ b/Examples/ServiceExamples/Scripts/ExampleAlchemyLanguage.cs @@ -17,220 +17,222 @@ using UnityEngine; using System.Collections; -using IBM.Watson.DeveloperCloud.Services.AlchemyLanguage.v1; +using IBM.Watson.DeveloperCloud.Services.AlchemyAPI.v1; using IBM.Watson.DeveloperCloud.Logging; -public class ExampleAlchemyLanguage : MonoBehaviour { - private AlchemyLanguage m_AlchemyLanguage = new AlchemyLanguage(); +public class ExampleAlchemyLanguage : MonoBehaviour +{ + private AlchemyAPI m_AlchemyAPI = new AlchemyAPI(); private string m_ExampleURL_unitySDK = "https://developer.ibm.com/open/2016/01/21/introducing-watson-unity-sdk/"; private string m_ExampleURL_watsonJeopardy = "http://www.nytimes.com/2011/02/17/science/17jeopardy-watson.html"; private string m_ExampleURL_microformats = "http://microformats.org/wiki/hcard"; private string m_ExampleText_unitySDK = "Game on! Introducing Watson Unity SDK, \nRICHARD LYLE / JANUARY 21, 2016 \nAfter several months of work we are happy to present the Watson Unity SDK, an SDK to enable the Unity community to access the Watson Developer Cloud and build a cognitive application in Unity.\n\nI’ve been involved in the game industry for 22+ years now, but I can tell you in all honestly working in the Watson Innovation Labs and on this project has been the highlight of my career. This SDK really represents the first phase in what we plan to bring to the community, which in the end will be a framework for building a full cognitive application.\n\nYou as a developer will find very simple C# service abstractions for accessing Dialog, Speech To Text, Text to Speech, Language Translation, and Natural Language Classification services. Additionally, we’ve implemented something we are calling a Widget, which has inputs and outputs and performs some basic function.\n\nThese widgets can be connected together to form a graph for the data that’s routed for a given cognitive application. The widgets will attempt to automatically connect to each other, or you as a developer can override that behavior and manually take control of the process. We’ve implemented widgets for all of the basic services and provide a couple of example applications showing how they can work together.\n\nWe plan to continue to expand and build on the Watson Unity SDK. We invite you to join us in contributing to and using the SDK, or by simply giving us your feedback. We’d love to have you on board for this ride!"; private string m_ExampleText_watsonJeopardy = "Computer Wins on 'Jeopardy!': Trivial, It's Not\nBy JOHN MARKOFF\nYORKTOWN HEIGHTS, N.Y. — In the end, the humans on \"Jeopardy!\" surrendered meekly.\n\nFacing 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.\"\n\nThis article has been revised to reflect the following correction:\n\nCorrection: February 24, 2011\n\n\nAn article last Thursday about the I.B.M. computer Watson misidentified the academic field vindicated by Watson's besting of two human opponents on \"Jeopardy!\" It is artificial intelligence — not computer science, a broader field that includes artificial intelligence."; - void Start () { + void Start() + { LogSystem.InstallDefaultReactors(); string unitySDK_release_html = Application.dataPath + "/Watson/Examples/ServiceExamples/TestData/unitySDK_release.html"; string watson_beats_jeopardy_html = Application.dataPath + "/Watson/Examples/ServiceExamples/TestData/watson_beats_jeopardy.html"; string microformats_html = Application.dataPath + "/Watson/Examples/ServiceExamples/TestData/microformats.html"; string ycombinator_html = Application.dataPath + "/Watson/Examples/ServiceExamples/TestData/ycombinator_news.html"; - // Get Author URL POST -// if(!m_AlchemyLanguage.GetAuthors(OnGetAuthors, m_ExampleURL_watsonJeopardy)) -// Log.Debug("ExampleAlchemyLanguage", "Failed to get authors URL POST!"); + //// Get Author URL POST + //if (!m_AlchemyAPI.GetAuthors(OnGetAuthors, m_ExampleURL_watsonJeopardy)) + // Log.Debug("ExampleAlchemyLanguage", "Failed to get authors URL POST!"); + + ////Get Author HTML POST + //if (!m_AlchemyAPI.GetAuthors(OnGetAuthors, watson_beats_jeopardy_html)) + // Log.Debug("ExampleAlchemyLanguage", "Failed to get authors HTML POST!"); + + ////Get Concepts Text POST + if (!m_AlchemyAPI.GetRankedConcepts(OnGetConcepts, m_ExampleText_watsonJeopardy)) + Log.Debug("ExampleAlchemyLanguage", "Failed to get concepts Text POST!"); + + ////Get Concepts HTML POST + //if (!m_AlchemyAPI.GetRankedConcepts(OnGetConcepts, watson_beats_jeopardy_html)) + // Log.Debug("ExampleAlchemyLanguage", "Failed to get concepts HTML POST!"); + + ////Get Concepts URL POST + //if (!m_AlchemyAPI.GetRankedConcepts(OnGetConcepts, m_ExampleURL_watsonJeopardy)) + // Log.Debug("ExampleAlchemyLanguage", "Failed to get concepts HTML POST!"); - // Get Author HTML POST -// if(!m_AlchemyLanguage.GetAuthors(OnGetAuthors, watson_beats_jeopardy_html)) -// Log.Debug("ExampleAlchemyLanguage", "Failed to get authors HTML POST!"); + ////Get Date URL POST + //if (!m_AlchemyAPI.GetDates(OnGetDates, m_ExampleURL_watsonJeopardy)) + // Log.Debug("ExampleAlchemyLanguage", "Failed to get dates by URL POST"); - // Get Concepts Text POST -// if(!m_AlchemyLanguage.GetRankedConcepts(OnGetConcepts, m_ExampleText_unitySDK)) -// Log.Debug("ExampleAlchemyLanguage", "Failed to get concepts Text POST!"); + ////Get Date Text POST + //if (!m_AlchemyAPI.GetDates(OnGetDates, m_ExampleText_watsonJeopardy)) + // Log.Debug("ExampleAlchemyLanguage", "Failed to get dates by text POST"); - // Get Concepts HTML POST -// if(!m_AlchemyLanguage.GetRankedConcepts(OnGetConcepts, watson_beats_jeopardy_html)) -// Log.Debug("ExampleAlchemyLanguage", "Failed to get concepts HTML POST!"); + ////Get Date HTML POST + //if (!m_AlchemyAPI.GetDates(OnGetDates, watson_beats_jeopardy_html)) + // Log.Debug("ExampleAlchemyLanguage", "Failed to get dates by HTML POST"); - // Get Concepts URL POST -// if(!m_AlchemyLanguage.GetRankedConcepts(OnGetConcepts, m_ExampleURL_watsonJeopardy)) -// Log.Debug("ExampleAlchemyLanguage", "Failed to get concepts HTML POST!"); + ////Get Emotions URL POST + //if (!m_AlchemyAPI.GetEmotions(OnGetEmotions, m_ExampleURL_watsonJeopardy, true)) + // Log.Debug("ExampleAlchemyLanguage", "Failed to get emotions by URL POST"); - // Get Date URL POST -// if(!m_AlchemyLanguage.GetDates(OnGetDates, m_ExampleURL_watsonJeopardy)) -// Log.Debug("ExampleAlchemyLanguage", "Failed to get dates by URL POST"); + ////Get Emotions Text POST + //if (!m_AlchemyAPI.GetEmotions(OnGetEmotions, m_ExampleText_watsonJeopardy, true)) + // Log.Debug("ExampleAlchemyLanguage", "Failed to get emotions by text POST"); - // Get Date Text POST -// if(!m_AlchemyLanguage.GetDates(OnGetDates, m_ExampleText_watsonJeopardy)) -// Log.Debug("ExampleAlchemyLanguage", "Failed to get dates by text POST"); + ////Get Emotions HTML POST + //if (!m_AlchemyAPI.GetEmotions(OnGetEmotions, watson_beats_jeopardy_html, true)) + // Log.Debug("ExampleAlchemyLanguage", "Failed to get emotions by HTML POST"); - // Get Date HTML POST -// if(!m_AlchemyLanguage.GetDates(OnGetDates, watson_beats_jeopardy_html)) -// Log.Debug("ExampleAlchemyLanguage", "Failed to get dates by HTML POST"); + ////Extract Entities URL POST + //if (!m_AlchemyAPI.ExtractEntities(OnExtractEntities, m_ExampleURL_watsonJeopardy)) + // Log.Debug("ExampleAlchemyLanguage", "Failed to get entities by URL POST"); - // Get Emotions URL POST -// if(!m_AlchemyLanguage.GetEmotions(OnGetEmotions, m_ExampleURL_watsonJeopardy, true)) -// Log.Debug("ExampleAlchemyLanguage", "Failed to get emotions by URL POST"); + ////Extract Entities Text POST + //if (!m_AlchemyAPI.ExtractEntities(OnExtractEntities, m_ExampleText_watsonJeopardy)) + // Log.Debug("ExampleAlchemyLanguage", "Failed to get entities by text POST"); - // Get Emotions Text POST -// if(!m_AlchemyLanguage.GetEmotions(OnGetEmotions, m_ExampleText_watsonJeopardy, true)) -// Log.Debug("ExampleAlchemyLanguage", "Failed to get emotions by text POST"); + ////Extract Entities HTML POST + //if (!m_AlchemyAPI.ExtractEntities(OnExtractEntities, watson_beats_jeopardy_html)) + // Log.Debug("ExampleAlchemyLanguage", "Failed to get entities by HTML POST"); - // Get Emotions HTML POST -// if(!m_AlchemyLanguage.GetEmotions(OnGetEmotions, watson_beats_jeopardy_html, true)) -// Log.Debug("ExampleAlchemyLanguage", "Failed to get emotions by HTML POST"); + ////Detect Feeds URL POST + //if (!m_AlchemyAPI.DetectFeeds(OnDetectFeeds, "http://time.com/newsfeed/")) + // Log.Debug("ExampleAlchemyLanguage", "Failed to get feeds by URL POST"); - // Extract Entities URL POST -// if(!m_AlchemyLanguage.ExtractEntities(OnExtractEntities, m_ExampleURL_watsonJeopardy)) -// Log.Debug("ExampleAlchemyLanguage", "Failed to get entities by URL POST"); + ////Detect Feeds HTML POST + ////if (!m_AlchemyAPI.DetectFeeds(OnDetectFeeds, ycombinator_html)) + //// Log.Debug("ExampleAlchemyLanguage", "Failed to get feeds by URL POST"); - // Extract Entities Text POST -// if(!m_AlchemyLanguage.ExtractEntities(OnExtractEntities, m_ExampleText_watsonJeopardy)) -// Log.Debug("ExampleAlchemyLanguage", "Failed to get entities by text POST"); + ////Extract Keywords URL POST + //if (!m_AlchemyAPI.ExtractKeywords(OnExtractKeywords, m_ExampleURL_watsonJeopardy)) + // Log.Debug("ExampleAlchemyLanguage", "Failed to get keywords by URL POST"); - // Extract Entities HTML POST -// if(!m_AlchemyLanguage.ExtractEntities(OnExtractEntities, watson_beats_jeopardy_html)) -// Log.Debug("ExampleAlchemyLanguage", "Failed to get entities by HTML POST"); + ////Extract Keywords Text POST + //if (!m_AlchemyAPI.ExtractKeywords(OnExtractKeywords, m_ExampleText_watsonJeopardy)) + // Log.Debug("ExampleAlchemyLanguage", "Failed to get keywords by text POST"); - // Detect Feeds URL POST -// if(!m_AlchemyLanguage.DetectFeeds(OnDetectFeeds, "http://time.com/newsfeed/")) -// Log.Debug("ExampleAlchemyLanguage", "Failed to get feeds by URL POST"); + ////Extract Keywords HTML POST + //if (!m_AlchemyAPI.ExtractKeywords(OnExtractKeywords, watson_beats_jeopardy_html)) + // Log.Debug("ExampleAlchemyLanguage", "Failed to get keywords by HTML POST"); - // Detect Feeds HTML POST -// if(!m_AlchemyLanguage.DetectFeeds(OnDetectFeeds, ycombinator_html)) -// Log.Debug("ExampleAlchemyLanguage", "Failed to get feeds by URL POST"); + ////Extract Languages URL POST + //if (!m_AlchemyAPI.GetLanguages(OnGetLanguages, m_ExampleURL_watsonJeopardy)) + // Log.Debug("ExampleAlchemyLanguage", "Failed to get languages by text POST"); - // Extract Keywords URL POST -// if(!m_AlchemyLanguage.ExtractKeywords(OnExtractKeywords, m_ExampleURL_watsonJeopardy)) -// Log.Debug("ExampleAlchemyLanguage", "Failed to get keywords by URL POST"); + ////Extract Languages Text POST + //if (!m_AlchemyAPI.GetLanguages(OnGetLanguages, m_ExampleText_watsonJeopardy)) + // Log.Debug("ExampleAlchemyLanguage", "Failed to get languages by text POST"); - // Extract Keywords Text POST -// if(!m_AlchemyLanguage.ExtractKeywords(OnExtractKeywords, m_ExampleText_watsonJeopardy)) -// Log.Debug("ExampleAlchemyLanguage", "Failed to get keywords by text POST"); + ////Extract Languages HTML POST + //if (!m_AlchemyAPI.GetLanguages(OnGetLanguages, watson_beats_jeopardy_html)) + // Log.Debug("ExampleAlchemyLanguage", "Failed to get languages by HTML POST"); - // Extract Keywords HTML POST -// if(!m_AlchemyLanguage.ExtractKeywords(OnExtractKeywords, watson_beats_jeopardy_html)) -// Log.Debug("ExampleAlchemyLanguage", "Failed to get keywords by HTML POST"); + ////Get Microformats URL POST + //if (!m_AlchemyAPI.GetMicroformats(OnGetMicroformats, m_ExampleURL_microformats)) + // Log.Debug("ExampleAlchemyLanguage", "Failed to get microformats by text POST"); - // Extract Languages URL POST -// if(!m_AlchemyLanguage.GetLanguages(OnGetLanguages, m_ExampleURL_watsonJeopardy)) -// Log.Debug("ExampleAlchemyLanguage", "Failed to get languages by text POST"); + ////Get Microformats HTML POST + ////if (!m_AlchemyAPI.GetMicroformats(OnGetMicroformats, microformats_html)) + //// Log.Debug("ExampleAlchemyLanguage", "Failed to get microformats by text POST"); - // Extract Languages Text POST -// if(!m_AlchemyLanguage.GetLanguages(OnGetLanguages, m_ExampleText_watsonJeopardy)) -// Log.Debug("ExampleAlchemyLanguage", "Failed to get languages by text POST"); + ////Get PublicationDate URL POST + //if (!m_AlchemyAPI.GetPublicationDate(OnGetPublicationDate, m_ExampleURL_watsonJeopardy)) + // Log.Debug("ExampleAlchemyLanguage", "Failed to get publication dates by url POST"); - // Extract Languages HTML POST -// if(!m_AlchemyLanguage.GetLanguages(OnGetLanguages, watson_beats_jeopardy_html)) -// Log.Debug("ExampleAlchemyLanguage", "Failed to get languages by HTML POST"); - - // Get Microformats URL POST -// if(!m_AlchemyLanguage.GetMicroformats(OnGetMicroformats, m_ExampleURL_microformats)) -// Log.Debug("ExampleAlchemyLanguage", "Failed to get microformats by text POST"); - - // Get Microformats HTML POST -// if(!m_AlchemyLanguage.GetMicroformats(OnGetMicroformats, microformats_html)) -// Log.Debug("ExampleAlchemyLanguage", "Failed to get microformats by text POST"); - - // Get PublicationDate URL POST -// if(!m_AlchemyLanguage.GetPublicationDate(OnGetPublicationDate, m_ExampleURL_watsonJeopardy)) -// Log.Debug("ExampleAlchemyLanguage", "Failed to get publication dates by url POST"); - - // Get PublicationDate HTML POST -// if(!m_AlchemyLanguage.GetPublicationDate(OnGetPublicationDate, watson_beats_jeopardy_html)) -// Log.Debug("ExampleAlchemyLanguage", "Failed to get publication dates by html POST"); + ////Get PublicationDate HTML POST + //if (!m_AlchemyAPI.GetPublicationDate(OnGetPublicationDate, watson_beats_jeopardy_html)) + // Log.Debug("ExampleAlchemyLanguage", "Failed to get publication dates by html POST"); - // Get Relations URL POST -// if(!m_AlchemyLanguage.GetRelations(OnGetRelations, m_ExampleURL_watsonJeopardy)) -// Log.Debug("ExampleAlchemyLanguage", "Failed to get relations by text POST"); + ////Get Relations URL POST + //if (!m_AlchemyAPI.GetRelations(OnGetRelations, m_ExampleURL_watsonJeopardy)) + // Log.Debug("ExampleAlchemyLanguage", "Failed to get relations by text POST"); - // Get Relations Text POST -// if(!m_AlchemyLanguage.GetRelations(OnGetRelations, m_ExampleText_watsonJeopardy)) -// Log.Debug("ExampleAlchemyLanguage", "Failed to get relations by text POST"); + ////Get Relations Text POST + //if (!m_AlchemyAPI.GetRelations(OnGetRelations, m_ExampleText_watsonJeopardy)) + // Log.Debug("ExampleAlchemyLanguage", "Failed to get relations by text POST"); - // Get Relations HTML POST -// if(!m_AlchemyLanguage.GetRelations(OnGetRelations, watson_beats_jeopardy_html)) -// Log.Debug("ExampleAlchemyLanguage", "Failed to get relations by HTML POST"); + ////Get Relations HTML POST + //if (!m_AlchemyAPI.GetRelations(OnGetRelations, watson_beats_jeopardy_html)) + // Log.Debug("ExampleAlchemyLanguage", "Failed to get relations by HTML POST"); - // Get Sentiment URL POST -// if(!m_AlchemyLanguage.GetTextSentiment(OnGetTextSentiment, m_ExampleURL_watsonJeopardy)) -// Log.Debug("ExampleAlchemyLanguage", "Failed to get sentiment by text POST"); + ////Get Sentiment URL POST + //if (!m_AlchemyAPI.GetTextSentiment(OnGetTextSentiment, m_ExampleURL_watsonJeopardy)) + // Log.Debug("ExampleAlchemyLanguage", "Failed to get sentiment by text POST"); - // Get Sentiment Text POST -// if(!m_AlchemyLanguage.GetTextSentiment(OnGetTextSentiment, m_ExampleText_watsonJeopardy)) -// Log.Debug("ExampleAlchemyLanguage", "Failed to get sentiment by text POST"); + ////Get Sentiment Text POST + //if (!m_AlchemyAPI.GetTextSentiment(OnGetTextSentiment, m_ExampleText_watsonJeopardy)) + // Log.Debug("ExampleAlchemyLanguage", "Failed to get sentiment by text POST"); - // Get Sentiment HTML POST -// if(!m_AlchemyLanguage.GetTextSentiment(OnGetTextSentiment, watson_beats_jeopardy_html)) -// Log.Debug("ExampleAlchemyLanguage", "Failed to get sentiment by HTML POST"); + ////Get Sentiment HTML POST + //if (!m_AlchemyAPI.GetTextSentiment(OnGetTextSentiment, watson_beats_jeopardy_html)) + // Log.Debug("ExampleAlchemyLanguage", "Failed to get sentiment by HTML POST"); - // Get Targeted Sentiment URL POST -// if(!m_AlchemyLanguage.GetTargetedSentiment(OnGetTargetedSentiment, m_ExampleURL_watsonJeopardy, "Jeopardy|Jennings|Watson")) -// Log.Debug("ExampleAlchemyLanguage", "Failed to get targeted sentiment by text POST"); + ////Get Targeted Sentiment URL POST + //if (!m_AlchemyAPI.GetTargetedSentiment(OnGetTargetedSentiment, m_ExampleURL_watsonJeopardy, "Jeopardy|Jennings|Watson")) + // Log.Debug("ExampleAlchemyLanguage", "Failed to get targeted sentiment by text POST"); - // Get Targeted Sentiment Text POST -// if(!m_AlchemyLanguage.GetTargetedSentiment(OnGetTargetedSentiment, m_ExampleText_watsonJeopardy, "Jeopardy|Jennings|Watson")) -// Log.Debug("ExampleAlchemyLanguage", "Failed to get targeted sentiment by text POST"); + ////Get Targeted Sentiment Text POST + //if (!m_AlchemyAPI.GetTargetedSentiment(OnGetTargetedSentiment, m_ExampleText_watsonJeopardy, "Jeopardy|Jennings|Watson")) + // Log.Debug("ExampleAlchemyLanguage", "Failed to get targeted sentiment by text POST"); - // Get Targeted Sentiment HTML POST -// if(!m_AlchemyLanguage.GetTargetedSentiment(OnGetTargetedSentiment, watson_beats_jeopardy_html, "Jeopardy|Jennings|Watson")) -// Log.Debug("ExampleAlchemyLanguage", "Failed to get targeted sentiment by HTML POST"); + ////Get Targeted Sentiment HTML POST + //if (!m_AlchemyAPI.GetTargetedSentiment(OnGetTargetedSentiment, watson_beats_jeopardy_html, "Jeopardy|Jennings|Watson")) + // Log.Debug("ExampleAlchemyLanguage", "Failed to get targeted sentiment by HTML POST"); - // Get Taxonomy URL POST -// if(!m_AlchemyLanguage.GetRankedTaxonomy(OnGetRankedTaxonomy, m_ExampleURL_watsonJeopardy)) -// Log.Debug("ExampleAlchemyLanguage", "Failed to get ranked taxonomy by text POST"); + ////Get Taxonomy URL POST + //if (!m_AlchemyAPI.GetRankedTaxonomy(OnGetRankedTaxonomy, m_ExampleURL_watsonJeopardy)) + // Log.Debug("ExampleAlchemyLanguage", "Failed to get ranked taxonomy by text POST"); - // Get Taxonomy Text POST -// if(!m_AlchemyLanguage.GetRankedTaxonomy(OnGetRankedTaxonomy, m_ExampleText_watsonJeopardy)) -// Log.Debug("ExampleAlchemyLanguage", "Failed to get ranked taxonomy by text POST"); + ////Get Taxonomy Text POST + //if (!m_AlchemyAPI.GetRankedTaxonomy(OnGetRankedTaxonomy, m_ExampleText_watsonJeopardy)) + // Log.Debug("ExampleAlchemyLanguage", "Failed to get ranked taxonomy by text POST"); - // Get Taxonomy HTML POST -// if(!m_AlchemyLanguage.GetRankedTaxonomy(OnGetRankedTaxonomy, watson_beats_jeopardy_html)) -// Log.Debug("ExampleAlchemyLanguage", "Failed to get ranked taxonomy by HTML POST"); + ////Get Taxonomy HTML POST + //if (!m_AlchemyAPI.GetRankedTaxonomy(OnGetRankedTaxonomy, watson_beats_jeopardy_html)) + // Log.Debug("ExampleAlchemyLanguage", "Failed to get ranked taxonomy by HTML POST"); - // Get Text HTML POST -// if(!m_AlchemyLanguage.GetText(OnGetText, watson_beats_jeopardy_html)) -// Log.Debug("ExampleAlchemyLanguage", "Failed to get text by text POST"); + ////Get Text HTML POST + //if (!m_AlchemyAPI.GetText(OnGetText, watson_beats_jeopardy_html)) + // Log.Debug("ExampleAlchemyLanguage", "Failed to get text by text POST"); - // Get Text URL POST -// if(!m_AlchemyLanguage.GetText(OnGetText, m_ExampleURL_watsonJeopardy)) -// Log.Debug("ExampleAlchemyLanguage", "Failed to get text by text POST"); + ////Get Text URL POST + //if (!m_AlchemyAPI.GetText(OnGetText, m_ExampleURL_watsonJeopardy)) + // Log.Debug("ExampleAlchemyLanguage", "Failed to get text by text POST"); - // Get Raw Text HTML POST -// if(!m_AlchemyLanguage.GetRawText(OnGetText, watson_beats_jeopardy_html)) -// Log.Debug("ExampleAlchemyLanguage", "Failed to get raw text by text POST"); + ////Get Raw Text HTML POST + //if (!m_AlchemyAPI.GetRawText(OnGetText, watson_beats_jeopardy_html)) + // Log.Debug("ExampleAlchemyLanguage", "Failed to get raw text by text POST"); - // Get Raw Text URL POST -// if(!m_AlchemyLanguage.GetRawText(OnGetText, m_ExampleURL_watsonJeopardy)) -// Log.Debug("ExampleAlchemyLanguage", "Failed to get raw text by text POST"); + ////Get Raw Text URL POST + //if (!m_AlchemyAPI.GetRawText(OnGetText, m_ExampleURL_watsonJeopardy)) + // Log.Debug("ExampleAlchemyLanguage", "Failed to get raw text by text POST"); - // Get Title HTML POST -// if(!m_AlchemyLanguage.GetTitle(OnGetTitle, watson_beats_jeopardy_html)) -// Log.Debug("ExampleAlchemyLanguage", "Failed to get title by text POST"); + ////Get Title HTML POST + //if (!m_AlchemyAPI.GetTitle(OnGetTitle, watson_beats_jeopardy_html)) + // Log.Debug("ExampleAlchemyLanguage", "Failed to get title by text POST"); - // Get Title URL POST -// if(!m_AlchemyLanguage.GetTitle(OnGetTitle, m_ExampleURL_watsonJeopardy)) -// Log.Debug("ExampleAlchemyLanguage", "Failed to get title by text POST"); + ////Get Title URL POST + //if (!m_AlchemyAPI.GetTitle(OnGetTitle, m_ExampleURL_watsonJeopardy)) + // Log.Debug("ExampleAlchemyLanguage", "Failed to get title by text POST"); - // Get Combined Data URL POST -// if(!m_AlchemyLanguage.GetCombinedData(OnGetCombinedData, m_ExampleURL_watsonJeopardy, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true)) -// Log.Debug("ExampleAlchemyLanguage", "Failed to get combined data by text POST"); + //// Get Combined Data URL POST + //if (!m_AlchemyAPI.GetCombinedData(OnGetCombinedData, m_ExampleURL_watsonJeopardy, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true)) + // Log.Debug("ExampleAlchemyLanguage", "Failed to get combined data by text POST"); - // Get Combined Data Text POST -// if(!m_AlchemyLanguage.GetCombinedData(OnGetCombinedData, m_ExampleText_watsonJeopardy, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true)) -// Log.Debug("ExampleAlchemyLanguage", "Failed to get combined data by text POST"); + ////Get Combined Data Text POST + //if (!m_AlchemyAPI.GetCombinedData(OnGetCombinedData, m_ExampleText_watsonJeopardy, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true)) + // Log.Debug("ExampleAlchemyLanguage", "Failed to get combined data by text POST"); + + ////Get Combined Data HTML POST + //if (!m_AlchemyAPI.GetCombinedData(OnGetCombinedData, watson_beats_jeopardy_html, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true)) + // Log.Debug("ExampleAlchemyLanguage", "Failed to get combined data by HTML POST"); + } - // Get Combined Data HTML POST -// if(!m_AlchemyLanguage.GetCombinedData(OnGetCombinedData, watson_beats_jeopardy_html, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true)) -// Log.Debug("ExampleAlchemyLanguage", "Failed to get combined data by HTML POST"); - } - private void OnGetAuthors(AuthorsData authors, string data) { - if(authors != null) + if (authors != null) { Log.Debug("ExampleAlchemyLanguage", "data: {0}", data); - if(authors.authors.names.Length == 0) + if (authors.authors.names.Length == 0) Log.Debug("ExampleAlchemyLanguage", "No authors found!"); - foreach(string name in authors.authors.names) + foreach (string name in authors.authors.names) Log.Debug("ExampleAlchemyLanguage", "Author " + name + " found!"); } else @@ -241,15 +243,15 @@ private void OnGetAuthors(AuthorsData authors, string data) private void OnGetConcepts(ConceptsData concepts, string data) { - if(concepts != null) + if (concepts != null) { Log.Debug("ExampleAlchemyLanguage", "status: {0}", concepts.status); Log.Debug("ExampleAlchemyLanguage", "url: {0}", concepts.url); Log.Debug("ExampleAlchemyLanguage", "language: {0}", concepts.language); - if(concepts.concepts.Length == 0) + if (concepts.concepts.Length == 0) Log.Debug("ExampleAlchemyLanguage", "No concepts found!"); - foreach(Concept concept in concepts.concepts) + foreach (Concept concept in concepts.concepts) Log.Debug("ExampleAlchemyLanguage", "Concept: {0}, Relevance: {1}", concept.text, concept.relevance); } else @@ -260,15 +262,15 @@ private void OnGetConcepts(ConceptsData concepts, string data) private void OnGetDates(DateData dates, string data) { - if(dates != null) + if (dates != null) { Log.Debug("ExampleAlchemyLanguage", "status: {0}", dates.status); Log.Debug("ExampleAlchemyLanguage", "language: {0}", dates.language); Log.Debug("ExampleAlchemyLanguage", "url: {0}", dates.url); - if(dates.dates == null || dates.dates.Length == 0) + if (dates.dates == null || dates.dates.Length == 0) Log.Debug("ExampleAlchemyLanguage", "No dates found!"); else - foreach(Date date in dates.dates) + foreach (Date date in dates.dates) Log.Debug("ExampleAlchemyLanguage", "Text: {0}, Date: {1}", date.text, date.date); } else @@ -279,13 +281,13 @@ private void OnGetDates(DateData dates, string data) private void OnGetEmotions(EmotionData emotions, string data) { - if(emotions != null) + if (emotions != null) { Log.Debug("ExampleAlchemyLanguage", "status: {0}", emotions.status); Log.Debug("ExampleAlchemyLanguage", "url: {0}", emotions.url); Log.Debug("ExampleAlchemyLanguage", "language: {0}", emotions.language); Log.Debug("ExampleAlchemyLanguage", "text: {0}", emotions.text); - if(emotions.docEmotions == null) + if (emotions.docEmotions == null) Log.Debug("ExampleAlchemyLanguage", "No emotions found!"); else { @@ -304,16 +306,16 @@ private void OnGetEmotions(EmotionData emotions, string data) private void OnExtractEntities(EntityData entityData, string data) { - if(entityData != null) + if (entityData != null) { Log.Debug("ExampleAlchemyLanguage", "status: {0}", entityData.status); Log.Debug("ExampleAlchemyLanguage", "url: {0}", entityData.url); Log.Debug("ExampleAlchemyLanguage", "language: {0}", entityData.language); Log.Debug("ExampleAlchemyLanguage", "text: {0}", entityData.text); - if(entityData == null || entityData.entities.Length == 0) + if (entityData == null || entityData.entities.Length == 0) Log.Debug("ExampleAlchemyLanguage", "No entities found!"); else - foreach(Entity entity in entityData.entities) + foreach (Entity entity in entityData.entities) Log.Debug("ExampleAlchemyLanguage", "text: {0}, type: {1}", entity.text, entity.type); } else @@ -324,13 +326,13 @@ private void OnExtractEntities(EntityData entityData, string data) private void OnDetectFeeds(FeedData feedData, string data) { - if(feedData != null) + if (feedData != null) { Log.Debug("ExampleAlchemyLanguage", "status: {0}", feedData.status); - if(feedData == null || feedData.feeds.Length == 0) + if (feedData == null || feedData.feeds.Length == 0) Log.Debug("ExampleAlchemyLanguage", "No feeds found!"); else - foreach(Feed feed in feedData.feeds) + foreach (Feed feed in feedData.feeds) Log.Debug("ExampleAlchemyLanguage", "text: {0}", feed.feed); } else @@ -341,16 +343,16 @@ private void OnDetectFeeds(FeedData feedData, string data) private void OnExtractKeywords(KeywordData keywordData, string data) { - if(keywordData != null) + if (keywordData != null) { Log.Debug("ExampleAlchemyLanguage", "status: {0}", keywordData.status); Log.Debug("ExampleAlchemyLanguage", "url: {0}", keywordData.url); Log.Debug("ExampleAlchemyLanguage", "language: {0}", keywordData.language); Log.Debug("ExampleAlchemyLanguage", "text: {0}", keywordData.text); - if(keywordData == null || keywordData.keywords.Length == 0) + if (keywordData == null || keywordData.keywords.Length == 0) Log.Debug("ExampleAlchemyLanguage", "No keywords found!"); else - foreach(Keyword keyword in keywordData.keywords) + foreach (Keyword keyword in keywordData.keywords) Log.Debug("ExampleAlchemyLanguage", "text: {0}, relevance: {1}", keyword.text, keyword.relevance); } else @@ -361,9 +363,9 @@ private void OnExtractKeywords(KeywordData keywordData, string data) private void OnGetLanguages(LanguageData languages, string data) { - if(languages != null) + if (languages != null) { - if(string.IsNullOrEmpty(languages.language)) + if (string.IsNullOrEmpty(languages.language)) Log.Debug("ExampleAlchemyLanguage", "No languages detected!"); else { @@ -386,15 +388,15 @@ private void OnGetLanguages(LanguageData languages, string data) private void OnGetMicroformats(MicroformatData microformats, string data) { - if(microformats != null) + if (microformats != null) { Log.Debug("ExampleAlchemyLanguage", "status: {0}", microformats.status); Log.Debug("ExampleAlchemyLanguage", "url: {0}", microformats.url); - if(microformats.microformats.Length == 0) + if (microformats.microformats.Length == 0) Log.Warning("ExampleAlchemyLanguage", "No microformats found!"); else { - foreach(Microformat microformat in microformats.microformats) + foreach (Microformat microformat in microformats.microformats) Log.Debug("ExampleAlchemyLanguage", "field: {0}, data: {1}.", microformat.field, microformat.data); } } @@ -406,12 +408,12 @@ private void OnGetMicroformats(MicroformatData microformats, string data) private void OnGetPublicationDate(PubDateData pubDates, string data) { - if(pubDates != null) + if (pubDates != null) { Log.Debug("ExampleAlchemyLanguage", "status: {0}", pubDates.status); Log.Debug("ExampleAlchemyLanguage", "url: {0}", pubDates.url); Log.Debug("ExampleAlchemyLanguage", "language: {0}", pubDates.language); - if(pubDates.publicationDate != null) + if (pubDates.publicationDate != null) Log.Debug("ExampleAlchemyLanguage", "date: {0}, confident: {1}", pubDates.publicationDate.date, pubDates.publicationDate.confident); else Log.Debug("ExampleAlchemyLanguage", "Failed to find Publication Dates!"); @@ -424,17 +426,17 @@ private void OnGetPublicationDate(PubDateData pubDates, string data) private void OnGetRelations(RelationsData relationsData, string data) { - if(relationsData != null) + if (relationsData != null) { Log.Debug("ExampleAlchemyLanguage", "status: {0}", relationsData.status); Log.Debug("ExampleAlchemyLanguage", "url: {0}", relationsData.url); Log.Debug("ExampleAlchemyLanguage", "language: {0}", relationsData.language); Log.Debug("ExampleAlchemyLanguage", "text: {0}", relationsData.text); - if(relationsData.relations == null || relationsData.relations.Length == 0) + if (relationsData.relations == null || relationsData.relations.Length == 0) Log.Debug("ExampleAlchemyLanguage", "No relations found!"); else - foreach(Relation relation in relationsData.relations) - if(relation.subject != null && !string.IsNullOrEmpty(relation.subject.text)) + foreach (Relation relation in relationsData.relations) + if (relation.subject != null && !string.IsNullOrEmpty(relation.subject.text)) Log.Debug("ExampleAlchemyLanguage", "Text: {0}, Date: {1}", relation.sentence, relation.subject.text); } else @@ -445,17 +447,17 @@ private void OnGetRelations(RelationsData relationsData, string data) private void OnGetTextSentiment(SentimentData sentimentData, string data) { - if(sentimentData != null) + if (sentimentData != null) { Log.Debug("ExampleAlchemyLanguage", "status: {0}", sentimentData.status); Log.Debug("ExampleAlchemyLanguage", "url: {0}", sentimentData.url); Log.Debug("ExampleAlchemyLanguage", "language: {0}", sentimentData.language); Log.Debug("ExampleAlchemyLanguage", "text: {0}", sentimentData.text); - if(sentimentData.docSentiment == null) + if (sentimentData.docSentiment == null) Log.Debug("ExampleAlchemyLanguage", "No sentiment found!"); else - if(sentimentData.docSentiment != null && !string.IsNullOrEmpty(sentimentData.docSentiment.type)) - Log.Debug("ExampleAlchemyLanguage", "Sentiment: {0}, Score: {1}", sentimentData.docSentiment.type, sentimentData.docSentiment.score); + if (sentimentData.docSentiment != null && !string.IsNullOrEmpty(sentimentData.docSentiment.type)) + Log.Debug("ExampleAlchemyLanguage", "Sentiment: {0}, Score: {1}", sentimentData.docSentiment.type, sentimentData.docSentiment.score); } else { @@ -465,20 +467,20 @@ private void OnGetTextSentiment(SentimentData sentimentData, string data) private void OnGetTargetedSentiment(TargetedSentimentData sentimentData, string data) { - if(sentimentData != null) + if (sentimentData != null) { Log.Debug("ExampleAlchemyLanguage", "status: {0}", sentimentData.status); Log.Debug("ExampleAlchemyLanguage", "url: {0}", sentimentData.url); Log.Debug("ExampleAlchemyLanguage", "language: {0}", sentimentData.language); Log.Debug("ExampleAlchemyLanguage", "text: {0}", sentimentData.text); - if(sentimentData.results == null) + if (sentimentData.results == null) Log.Debug("ExampleAlchemyLanguage", "No sentiment found!"); else - if(sentimentData.results == null || sentimentData.results.Length == 0) - Log.Warning("ExampleAlchemyLanguage", "No sentiment results!"); - else - foreach(TargetedSentiment result in sentimentData.results) - Log.Debug("ExampleAlchemyLanguage", "text: {0}, sentiment: {1}, score: {2}", result.text, result.sentiment.score, result.sentiment.type); + if (sentimentData.results == null || sentimentData.results.Length == 0) + Log.Warning("ExampleAlchemyLanguage", "No sentiment results!"); + else + foreach (TargetedSentiment result in sentimentData.results) + Log.Debug("ExampleAlchemyLanguage", "text: {0}, sentiment: {1}, score: {2}", result.text, result.sentiment.score, result.sentiment.type); } else { @@ -488,20 +490,20 @@ private void OnGetTargetedSentiment(TargetedSentimentData sentimentData, string private void OnGetRankedTaxonomy(TaxonomyData taxonomyData, string data) { - if(taxonomyData != null) + if (taxonomyData != null) { Log.Debug("ExampleAlchemyLanguage", "status: {0}", taxonomyData.status); Log.Debug("ExampleAlchemyLanguage", "url: {0}", taxonomyData.url); Log.Debug("ExampleAlchemyLanguage", "language: {0}", taxonomyData.language); Log.Debug("ExampleAlchemyLanguage", "text: {0}", taxonomyData.text); - if(taxonomyData.taxonomy == null) + if (taxonomyData.taxonomy == null) Log.Debug("ExampleAlchemyLanguage", "No taxonomy found!"); else - if(taxonomyData.taxonomy == null || taxonomyData.taxonomy.Length == 0) - Log.Warning("ExampleAlchemyLanguage", "No taxonomy results!"); - else - foreach(Taxonomy taxonomy in taxonomyData.taxonomy) - Log.Debug("ExampleAlchemyLanguage", "label: {0}, score: {1}", taxonomy.label, taxonomy.score); + if (taxonomyData.taxonomy == null || taxonomyData.taxonomy.Length == 0) + Log.Warning("ExampleAlchemyLanguage", "No taxonomy results!"); + else + foreach (Taxonomy taxonomy in taxonomyData.taxonomy) + Log.Debug("ExampleAlchemyLanguage", "label: {0}, score: {1}", taxonomy.label, taxonomy.score); } else { @@ -511,7 +513,7 @@ private void OnGetRankedTaxonomy(TaxonomyData taxonomyData, string data) private void OnGetText(TextData textData, string data) { - if(textData != null) + if (textData != null) { Log.Debug("ExampleAlchemyLanuguage", "status: {0}", textData.status); Log.Debug("ExampleAlchemyLanuguage", "url: {0}", textData.url); @@ -521,12 +523,12 @@ private void OnGetText(TextData textData, string data) { Log.Debug("ExampleAlchemyLanguage", "Failed to find text!"); } - + } private void OnGetTitle(Title titleData, string data) { - if(titleData != null) + if (titleData != null) { Log.Debug("ExampleAlchemyLanuguage", "status: {0}", titleData.status); Log.Debug("ExampleAlchemyLanuguage", "url: {0}", titleData.url); @@ -541,7 +543,7 @@ private void OnGetTitle(Title titleData, string data) private void OnGetCombinedData(CombinedCallData combinedData, string data) { - if(combinedData != null) + if (combinedData != null) { Log.Debug("ExampleAlchemyLanguage", "status: {0}", combinedData.status); Log.Debug("ExampleAlchemyLanguage", "url: {0}", combinedData.url); @@ -549,50 +551,50 @@ private void OnGetCombinedData(CombinedCallData combinedData, string data) Log.Debug("ExampleAlchemyLanguage", "text: {0}", combinedData.text); Log.Debug("ExampleAlchemyLanguage", "image: {0}", combinedData.image); - if(combinedData.imageKeywords != null && combinedData.imageKeywords.Length > 0) - foreach(ImageKeyword imageKeyword in combinedData.imageKeywords) + if (combinedData.imageKeywords != null && combinedData.imageKeywords.Length > 0) + foreach (ImageKeyword imageKeyword in combinedData.imageKeywords) Log.Debug("ExampleAlchemyLanguage", "ImageKeyword: {0}, Score: {1}", imageKeyword.text, imageKeyword.score); - if(combinedData.publicationDate != null) + if (combinedData.publicationDate != null) Log.Debug("ExampleAlchemyLanguage", "publicationDate: {0}, Score: {1}", combinedData.publicationDate.date, combinedData.publicationDate.confident); - if(combinedData.authors != null && combinedData.authors.names.Length > 0) - foreach(string authors in combinedData.authors.names) + if (combinedData.authors != null && combinedData.authors.names.Length > 0) + foreach (string authors in combinedData.authors.names) Log.Debug("ExampleAlchemyLanguage", "Authors: {0}", authors); - if(combinedData.docSentiment != null) + if (combinedData.docSentiment != null) Log.Debug("ExampleAlchemyLanguage", "DocSentiment: {0}, Score: {1}, Mixed: {2}", combinedData.docSentiment.type, combinedData.docSentiment.score, combinedData.docSentiment.mixed); - if(combinedData.feeds != null && combinedData.feeds.Length > 0) - foreach(Feed feed in combinedData.feeds) + if (combinedData.feeds != null && combinedData.feeds.Length > 0) + foreach (Feed feed in combinedData.feeds) Log.Debug("ExampleAlchemyLanguage", "Feeds: {0}", feed.feed); - if(combinedData.keywords != null && combinedData.keywords.Length > 0) - foreach(Keyword keyword in combinedData.keywords) + if (combinedData.keywords != null && combinedData.keywords.Length > 0) + foreach (Keyword keyword in combinedData.keywords) Log.Debug("ExampleAlchemyLanguage", "Keyword: {0}, relevance: {1}", keyword.text, keyword.relevance); - if(combinedData.concepts != null && combinedData.concepts.Length > 0) - foreach(Concept concept in combinedData.concepts) + if (combinedData.concepts != null && combinedData.concepts.Length > 0) + foreach (Concept concept in combinedData.concepts) Log.Debug("ExampleAlchemyLanguage", "Concept: {0}, Relevance: {1}", concept.text, concept.relevance); - if(combinedData.entities != null && combinedData.entities.Length > 0) - foreach(Entity entity in combinedData.entities) + if (combinedData.entities != null && combinedData.entities.Length > 0) + foreach (Entity entity in combinedData.entities) Log.Debug("ExampleAlchemyLanguage", "Entity: {0}, Type: {1}, Relevance: {2}", entity.text, entity.type, entity.relevance); - if(combinedData.relations != null && combinedData.relations.Length > 0) - foreach(Relation relation in combinedData.relations) + if (combinedData.relations != null && combinedData.relations.Length > 0) + foreach (Relation relation in combinedData.relations) Log.Debug("ExampleAlchemyLanguage", "Relations: {0}", relation.subject.text); - if(combinedData.taxonomy != null && combinedData.taxonomy.Length > 0) - foreach(Taxonomy taxonomy in combinedData.taxonomy) - Log.Debug("ExampleAlchemyLanguage", "Taxonomy: {0}, Score: {1}, Confident: {2}" ,taxonomy.label, taxonomy.score, taxonomy.confident); + if (combinedData.taxonomy != null && combinedData.taxonomy.Length > 0) + foreach (Taxonomy taxonomy in combinedData.taxonomy) + Log.Debug("ExampleAlchemyLanguage", "Taxonomy: {0}, Score: {1}, Confident: {2}", taxonomy.label, taxonomy.score, taxonomy.confident); - if(combinedData.dates != null && combinedData.dates.Length > 0) - foreach(Date date in combinedData.dates) + if (combinedData.dates != null && combinedData.dates.Length > 0) + foreach (Date date in combinedData.dates) Log.Debug("ExampleAlchemyLanguage", "Dates", date.text, date.date); - if(combinedData.docEmotions != null && combinedData.docEmotions.Length > 0) - foreach(DocEmotions emotions in combinedData.docEmotions) + if (combinedData.docEmotions != null && combinedData.docEmotions.Length > 0) + foreach (DocEmotions emotions in combinedData.docEmotions) Log.Debug("ExampleAlchemyLanguage", "Doc Emotions: anger: {0}, disgust: {1}, fear: {2}, joy: {3}, sadness: {4}", emotions.anger, emotions.disgust, emotions.fear, emotions.joy, emotions.sadness); } else diff --git a/Examples/ServiceExamples/Scripts/ExampleVisualRecognition.cs b/Examples/ServiceExamples/Scripts/ExampleVisualRecognition.cs old mode 100644 new mode 100755 index e6a0f7345..432f51c79 --- a/Examples/ServiceExamples/Scripts/ExampleVisualRecognition.cs +++ b/Examples/ServiceExamples/Scripts/ExampleVisualRecognition.cs @@ -21,77 +21,78 @@ using IBM.Watson.DeveloperCloud.Logging; using IBM.Watson.DeveloperCloud.Utilities; -public class ExampleVisualRecognition : MonoBehaviour { +public class ExampleVisualRecognition : MonoBehaviour +{ private VisualRecognition m_VisualRecognition = new VisualRecognition(); private string m_classifierName = "Apples_OptionalParams"; private string m_classifierID = "ApplesClassifierNameWithSpaces_73100404"; private string m_classifierToDelete = "unitytestclassifier2b_37849361"; private string m_imageURL = "https://upload.wikimedia.org/wikipedia/commons/e/e9/Official_portrait_of_Barack_Obama.jpg"; private string m_imageTextURL = "http://i.stack.imgur.com/ZS6nH.png"; - - void Start () + + void Start() { LogSystem.InstallDefaultReactors(); -// Get all classifiers - if(!m_VisualRecognition.GetClassifiers(OnGetClassifiers)) + // Get all classifiers + if (!m_VisualRecognition.GetClassifiers(OnGetClassifiers)) Log.Debug("ExampleVisualRecognition", "Getting classifiers failed!"); -// -// Find classifier by name + // + // Find classifier by name m_VisualRecognition.FindClassifier(m_classifierName, OnFindClassifier); -// Find classifier by ID - if(!m_VisualRecognition.GetClassifier(m_classifierID, OnGetClassifier)) + // Find classifier by ID + if (!m_VisualRecognition.GetClassifier(m_classifierID, OnGetClassifier)) Log.Debug("ExampleVisualRecognition", "Getting classifier failed!"); -// Delete classifier by ID - if(!m_VisualRecognition.DeleteClassifier(m_classifierToDelete, OnDeleteClassifier)) + // Delete classifier by ID + if (!m_VisualRecognition.DeleteClassifier(m_classifierToDelete, OnDeleteClassifier)) Log.Debug("ExampleVisualRecognition", "Deleting classifier failed!"); -// Train classifier + // Train classifier string m_positiveExamplesPath = Application.dataPath + "/Watson/Examples/ServiceExamples/TestData/visual-recognition-classifiers/giraffe_positive_examples.zip"; string m_negativeExamplesPath = Application.dataPath + "/Watson/Examples/ServiceExamples/TestData/visual-recognition-classifiers/negative_examples.zip"; - if(!m_VisualRecognition.TrainClassifier("unity-test-classifier5", "giraffe", m_positiveExamplesPath, m_negativeExamplesPath, OnTrainClassifier)) + if (!m_VisualRecognition.TrainClassifier("unity-test-classifier5", "giraffe", m_positiveExamplesPath, m_negativeExamplesPath, OnTrainClassifier)) Log.Debug("ExampleVisualRecognition", "Train classifier failed!"); -// Classify get - if(!m_VisualRecognition.Classify(m_imageURL, OnClassify)) + // Classify get + if (!m_VisualRecognition.Classify(m_imageURL, OnClassify)) Log.Debug("ExampleVisualRecognition", "Classify image failed!"); -// Classify post image + // Classify post image string m_imagesPath = Application.dataPath + "/Watson/Examples/ServiceExamples/TestData/visual-recognition-classifiers/obama.jpg"; - string[] m_owners = {"IBM", "me"}; - string[] m_classifierIDs = {"default"}; - if(!m_VisualRecognition.Classify(OnClassify, m_imagesPath, m_owners, m_classifierIDs, 0.5f)) + string[] m_owners = { "IBM", "me" }; + string[] m_classifierIDs = { "default" }; + if (!m_VisualRecognition.Classify(OnClassify, m_imagesPath, m_owners, m_classifierIDs, 0.5f)) Log.Debug("ExampleVisualRecognition", "Classify image failed!"); -// Detect faces get - if(!m_VisualRecognition.DetectFaces(m_imageURL, OnDetectFaces)) + // Detect faces get + if (!m_VisualRecognition.DetectFaces(m_imageURL, OnDetectFaces)) Log.Debug("ExampleVisualRecogntiion", "Detect faces failed!"); -// Detect faces post image + // Detect faces post image string m_faceExamplePath = Application.dataPath + "/Watson/Examples/ServiceExamples/TestData/visual-recognition-classifiers/obama.jpg"; - if(!m_VisualRecognition.DetectFaces(OnDetectFaces, m_faceExamplePath)) + if (!m_VisualRecognition.DetectFaces(OnDetectFaces, m_faceExamplePath)) Log.Debug("ExampleVisualRecognition", "Detect faces failed!"); -// Recognize text get - if(!m_VisualRecognition.RecognizeText(m_imageTextURL, OnRecognizeText)) + // Recognize text get + if (!m_VisualRecognition.RecognizeText(m_imageTextURL, OnRecognizeText)) Log.Debug("ExampleVisualRecognition", "Recognize text failed!"); -// Recognize text post image + // Recognize text post image string m_textExamplePath = Application.dataPath + "/Watson/Examples/ServiceExamples/TestData/visual-recognition-classifiers/from_platos_apology.png"; - if(!m_VisualRecognition.RecognizeText(OnRecognizeText, m_textExamplePath)) + if (!m_VisualRecognition.RecognizeText(OnRecognizeText, m_textExamplePath)) Log.Debug("ExampleVisualRecognition", "Recognize text failed!"); - } + } - private void OnGetClassifiers (GetClassifiersTopLevelBrief classifiers) + private void OnGetClassifiers(GetClassifiersTopLevelBrief classifiers) { - if(classifiers != null && classifiers.classifiers.Length > 0) + if (classifiers != null && classifiers.classifiers.Length > 0) { - foreach(GetClassifiersPerClassifierBrief classifier in classifiers.classifiers) + foreach (GetClassifiersPerClassifierBrief classifier in classifiers.classifiers) { Log.Debug("ExampleVisualRecognition", "Classifier: " + classifier.name + ", " + classifier.classifier_id); } @@ -104,7 +105,7 @@ private void OnGetClassifiers (GetClassifiersTopLevelBrief classifiers) private void OnFindClassifier(GetClassifiersPerClassifierVerbose classifier) { - if(classifier != null) + if (classifier != null) { Log.Debug("ExampleVisualRecognition", "Classifier " + m_classifierName + " found! ClassifierID: " + classifier.classifier_id); } @@ -116,7 +117,7 @@ private void OnFindClassifier(GetClassifiersPerClassifierVerbose classifier) private void OnGetClassifier(GetClassifiersPerClassifierVerbose classifier) { - if(classifier != null) + if (classifier != null) { Log.Debug("ExampleVisualRecognition", "Classifier " + m_classifierID + " found! Classifier name: " + classifier.name); } @@ -128,7 +129,7 @@ private void OnGetClassifier(GetClassifiersPerClassifierVerbose classifier) private void OnDeleteClassifier(bool success) { - if(success) + if (success) { Log.Debug("ExampleVisualRecognition", "Deleted classifier " + m_classifierToDelete); } @@ -137,10 +138,10 @@ private void OnDeleteClassifier(bool success) Log.Debug("ExampleVisualRecognition", "Failed to delete classifier by ID!"); } } - + private void OnTrainClassifier(GetClassifiersPerClassifierVerbose classifier) { - if(classifier != null) + if (classifier != null) { Log.Debug("ExampleVisualRecognition", "Classifier is training! " + classifier); } @@ -152,16 +153,16 @@ private void OnTrainClassifier(GetClassifiersPerClassifierVerbose classifier) private void OnClassify(ClassifyTopLevelMultiple classify) { - if(classify != null) + if (classify != null) { Log.Debug("ExampleVisualRecognition", "images processed: " + classify.images_processed); - foreach(ClassifyTopLevelSingle image in classify.images) + foreach (ClassifyTopLevelSingle image in classify.images) { Log.Debug("ExampleVisualRecognition", "\tsource_url: " + image.source_url + ", resolved_url: " + image.resolved_url); - foreach(ClassifyPerClassifier classifier in image.classifiers) + foreach (ClassifyPerClassifier classifier in image.classifiers) { Log.Debug("ExampleVisualRecognition", "\t\tclassifier_id: " + classifier.classifier_id + ", name: " + classifier.name); - foreach(ClassResult classResult in classifier.classes) + foreach (ClassResult classResult in classifier.classes) Log.Debug("ExampleVisualRecognition", "\t\t\tclass: " + classResult.m_class + ", score: " + classResult.score + ", type_hierarchy: " + classResult.type_hierarchy); } } @@ -174,13 +175,13 @@ private void OnClassify(ClassifyTopLevelMultiple classify) private void OnDetectFaces(FacesTopLevelMultiple multipleImages) { - if(multipleImages != null) + if (multipleImages != null) { Log.Debug("ExampleVisualRecognition", "images processed: {0}", multipleImages.images_processed); - foreach(FacesTopLevelSingle faces in multipleImages.images) + foreach (FacesTopLevelSingle faces in multipleImages.images) { Log.Debug("ExampleVisualRecognition", "\tsource_url: {0}, resolved_url: {1}", faces.source_url, faces.resolved_url); - foreach(OneFaceResult face in faces.faces) + foreach (OneFaceResult face in faces.faces) { Log.Debug("ExampleVisulaRecognition", "\t\tFace location: {0}, {1}, {2}, {3}", face.face_location.left, face.face_location.top, face.face_location.width, face.face_location.height); Log.Debug("ExampleVisulaRecognition", "\t\tGender: {0}, Score: {1}", face.gender.gender, face.gender.score); @@ -197,14 +198,14 @@ private void OnDetectFaces(FacesTopLevelMultiple multipleImages) private void OnRecognizeText(TextRecogTopLevelMultiple multipleImages) { - if(multipleImages != null) + if (multipleImages != null) { Log.Debug("ExampleVisualRecognition", "images processed: {0}", multipleImages.images_processed); - foreach(TextRecogTopLevelSingle texts in multipleImages.images) + foreach (TextRecogTopLevelSingle texts in multipleImages.images) { Log.Debug("ExampleVisualRecognition", "\tsource_url: {0}, resolved_url: {1}", texts.source_url, texts.resolved_url); Log.Debug("ExampleVisualRecognition", "\ttext: {0}", texts.text); - foreach(TextRecogOneWord text in texts.words) + foreach (TextRecogOneWord text in texts.words) { Log.Debug("ExampleVisulaRecognition", "\t\ttext location: {0}, {1}, {2}, {3}", text.location.left, text.location.top, text.location.width, text.location.height); Log.Debug("ExampleVisulaRecognition", "\t\tLine number: {0}", text.line_number); diff --git a/Examples/ServiceExamples/ServiceExamples.unity b/Examples/ServiceExamples/ServiceExamples.unity index c5005487e..fa780a9ba 100755 --- a/Examples/ServiceExamples/ServiceExamples.unity +++ b/Examples/ServiceExamples/ServiceExamples.unity @@ -493,6 +493,46 @@ Transform: m_Children: [] m_Father: {fileID: 0} m_RootOrder: 4 +--- !u!1 &1310649318 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + serializedVersion: 4 + m_Component: + - 4: {fileID: 1310649320} + - 114: {fileID: 1310649319} + m_Layer: 0 + m_Name: ExampleAlchemyDataNews + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!114 &1310649319 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1310649318} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: c46efb6361e73cf47b69febdae951658, type: 3} + m_Name: + m_EditorClassIdentifier: +--- !u!4 &1310649320 +Transform: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1310649318} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_Children: [] + m_Father: {fileID: 0} + m_RootOrder: 12 --- !u!1 &1713392457 GameObject: m_ObjectHideFlags: 0 diff --git a/README.md b/README.md index 715fc7316..dd0f47af3 100644 --- a/README.md +++ b/README.md @@ -19,6 +19,7 @@ Use this SDK to build Watson-powered applications in Unity. It comes with a set * [Conversation](#conversation) * [Visual Recognition](#visual-recognition) * [Alchemy Language](#alchemy-language) + * [AlchemyData News](#alchemy-data-news) * [Personality Insights](#personality-insights) * [Document Conversion](#document-conversion) * [Developing a basic application in one minute](#developing-a-basic-application-in-one-minute) @@ -1365,6 +1366,7 @@ The IBM Watson™ [Document conversion][document_conversion] service converts a #### Converting Documents Convert a single document + ```cs private DocumentConversion m_DocumentConversion = new DocumentConversion(); @@ -1413,6 +1415,34 @@ private DocumentConversion m_DocumentConversion = new DocumentConversion(); } ``` +### AlchemyData News +Use the [AlchemyData News][alchemyData_news] service to provide news and blog content enriched with natural language processing to allow for highly targeted search and trend analysis. Now you can query the world's news sources and blogs like a database. + +#### Getting News +AlchemyData News indexes 250k to 300k English language news and blog articles every day with historical search available for the past 60 days. You can query the News API directly with no need to acquire, enrich and store the data yourself - enabling you to go beyond simple keyword-based searches. You can request which fields to return and filter fields by string. All available fields can be accessed using Fields constants in the AlchemyData News Data Model. + +``` +private AlchemyAPI m_AlchemyAPI = new AlchemyAPI(); + +void Start() +{ + string[] returnFields = {Fields.ENRICHED_URL_ENTITIES, Fields.ENRICHED_URL_KEYWORDS}; + Dictionary queryFields = new Dictionary(); + queryFields.Add(Fields.ENRICHED_URL_RELATIONS_RELATION_SUBJECT_TEXT, "Obama"); + queryFields.Add(Fields.ENRICHED_URL_CLEANEDTITLE, "Washington"); + + if (!m_AlchemyAPI.GetNews(OnGetNews, returnFields, queryFields)) + Log.Debug("ExampleAlchemyData", "Failed to get news!"); +} + +void OnGetNews(NewsResponse newsData, string data) +{ + // Access requested fields + if(newsData != null) + Log.Debug("ExampleAlchemyData", "status: {0}", newsData.status); +} +``` + ## Developing a basic application in one minute 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: @@ -1460,6 +1490,7 @@ See [CONTRIBUTING.md](.github/CONTRIBUTING.md). [natural_language_classifier]: http://www.ibm.com/smarterplanet/us/en/ibmwatson/developercloud/doc/nl-classifier/ [alchemy_language]: http://www.alchemyapi.com/products/alchemylanguage +[alchemyData_news]: http://www.ibm.com/smarterplanet/us/en/ibmwatson/developercloud/alchemy-data-news.html [sentiment_analysis]: http://www.alchemyapi.com/products/alchemylanguage/sentiment-analysis [tone_analyzer]: http://www.ibm.com/smarterplanet/us/en/ibmwatson/developercloud/doc/tone-analyzer/ [tradeoff_analytics]: http://www.ibm.com/smarterplanet/us/en/ibmwatson/developercloud/doc/tradeoff-analytics/ diff --git a/Scripts/Editor/ConfigEditor.cs b/Scripts/Editor/ConfigEditor.cs index 383038c07..9b7fdb9f2 100755 --- a/Scripts/Editor/ConfigEditor.cs +++ b/Scripts/Editor/ConfigEditor.cs @@ -66,12 +66,12 @@ private class ServiceSetup URL ="https://console.ng.bluemix.net/catalog/services/personality-insights/", ServiceID="PersonalityInsightsV2" }, new ServiceSetup() { ServiceName = "Conversation", ServiceAPI = "conversation-experimental/api", URL ="https://console.ng.bluemix.net/catalog/services/conversation/", ServiceID="ConversationV1" }, - new ServiceSetup() { ServiceName = "Document Conversion", ServiceAPI = "document-conversion/api", - URL ="https://console.ng.bluemix.net/catalog/services/document-conversion/", ServiceID="DocumentConversionV1" }, - new ServiceSetup() { ServiceName = "Alchemy Language", ServiceAPI = "gateway-a.watsonplatform.net/calls", - URL ="https://console.ng.bluemix.net/catalog/services/alchemyapi/", ServiceID="AlchemyLanguageV1" }, + new ServiceSetup() { ServiceName = "Alchemy API", ServiceAPI = "gateway-a.watsonplatform.net/calls", + URL ="https://console.ng.bluemix.net/catalog/services/alchemyapi/", ServiceID="AlchemyAPIV1" }, new ServiceSetup() { ServiceName = "Visual Recognition", ServiceAPI = "visual-recognition/api", - URL ="https://console.ng.bluemix.net/catalog/services/visual-recognition/", ServiceID="VisualRecognitionV3" } + URL ="https://console.ng.bluemix.net/catalog/services/visual-recognition/", ServiceID="VisualRecognitionV3" }, + new ServiceSetup() { ServiceName = "Document Conversion", ServiceAPI = "document-conversion/api", + URL ="https://console.ng.bluemix.net/catalog/services/document-conversion/", ServiceID="DocumentConversionV1" } }; private const string TITLE = "Watson Unity SDK"; @@ -98,7 +98,7 @@ private static void OnScriptsReloaded() } } } - + private void OnEnable() { #if UNITY_5 @@ -247,7 +247,7 @@ private void OnGUI() GUILayout.Label( m_StatusUnknown, GUILayout.Width( 20 ) ); GUIStyle labelStyle = new GUIStyle(GUI.skin.label); - labelStyle.normal.textColor = bValid ? Color.green : Color.grey; + labelStyle.normal.textColor = bValid ? Color.green : Color.grey; GUILayout.Label( string.Format( "Service {0} {1}.", setup.ServiceName, bValid ? "CONFIGURED" : "NOT CONFIGURED" ), labelStyle ); @@ -261,7 +261,7 @@ private void OnGUI() GUILayout.Label( "PASTE CREDENTIALS BELOW:" ); m_PastedCredentials = EditorGUILayout.TextArea( m_PastedCredentials ); - + GUI.SetNextControlName("Apply"); if ( GUILayout.Button( "Apply Credentials" ) ) { @@ -283,7 +283,7 @@ private void OnGUI() { bAdd = false; - if ( EditorUtility.DisplayDialog( "Confirm", + if ( EditorUtility.DisplayDialog( "Confirm", string.Format("Replace existing service credentials for {0}?", setup.ServiceName), YES, NO ) ) { @@ -303,7 +303,7 @@ private void OnGUI() if ( bParsed ) { m_CheckServicesNow = true; - + EditorUtility.DisplayDialog( "Complete", "Credentials applied.", OK ); m_PastedCredentials = "\n\n\n\n\n\n\n"; GUI.FocusControl("Apply"); @@ -322,7 +322,7 @@ private void OnGUI() m_WizardMode = false; PlayerPrefs.SetInt( "WizardMode", 0 ); } - } + } else { cfg.ClassifierDirectory = EditorGUILayout.TextField("Classifier Directory", cfg.ClassifierDirectory ); diff --git a/Scripts/Services/AlchemyAPI/AlchemyLanguage.cs b/Scripts/Services/AlchemyAPI/AlchemyAPI.cs old mode 100644 new mode 100755 similarity index 81% rename from Scripts/Services/AlchemyAPI/AlchemyLanguage.cs rename to Scripts/Services/AlchemyAPI/AlchemyAPI.cs index 3d9280e99..ac3edb999 --- a/Scripts/Services/AlchemyAPI/AlchemyLanguage.cs +++ b/Scripts/Services/AlchemyAPI/AlchemyAPI.cs @@ -27,16 +27,16 @@ using System.IO; using UnityEngine; -namespace IBM.Watson.DeveloperCloud.Services.AlchemyLanguage.v1 +namespace IBM.Watson.DeveloperCloud.Services.AlchemyAPI.v1 { /// /// Service integration for Alchemy API /// - public class AlchemyLanguage : IWatsonService + public class AlchemyAPI : IWatsonService { #region Private Data - private const string SERVICE_ID = "AlchemyLanguageV1"; + private const string SERVICE_ID = "AlchemyAPIV1"; private static string mp_ApiKey = null; private static fsSerializer sm_Serializer = new fsSerializer(); @@ -48,7 +48,7 @@ private void SetCredentials() mp_ApiKey = Config.Instance.GetAPIKey(SERVICE_ID); if (string.IsNullOrEmpty(mp_ApiKey)) - throw new WatsonException("ALCHEMY_API_KEY needs to be defined in config.json"); + throw new WatsonException("Alchemy API Key required in config.json"); } #endregion @@ -70,9 +70,9 @@ private void SetCredentials() /// Custom data. public bool GetAuthors(OnGetAuthors callback, string source, string customData = default(string)) { - if(callback == null) + if (callback == null) throw new ArgumentNullException("callback"); - if(string.IsNullOrEmpty(source)) + if (string.IsNullOrEmpty(source)) throw new ArgumentNullException("Please provide a source for GetAuthors."); if (string.IsNullOrEmpty(mp_ApiKey)) SetCredentials(); @@ -89,17 +89,22 @@ private void SetCredentials() string service; string normalizedSource = source.Trim().ToLower(); - if(normalizedSource.StartsWith("http://") || normalizedSource.StartsWith("https://")) + if (normalizedSource.StartsWith("http://") || normalizedSource.StartsWith("https://")) { service = SERVICE_GET_AUTHORS_URL; req.Forms["url"] = new RESTConnector.Form(source); } - else if(Path.GetExtension(normalizedSource).EndsWith(".html") && !normalizedSource.StartsWith("http://") && !normalizedSource.StartsWith("https://")) + else if (source.StartsWith(Application.dataPath) && !normalizedSource.StartsWith("http://") && !normalizedSource.StartsWith("https://")) { - service = SERVICE_GET_AUTHORS_HTML; - string htmlData = default(string); - htmlData = File.ReadAllText(source); - req.Forms["html"] = new RESTConnector.Form(htmlData); + if (Path.GetExtension(normalizedSource).EndsWith(".html")) + { + service = SERVICE_GET_AUTHORS_HTML; + string htmlData = default(string); + htmlData = File.ReadAllText(source); + req.Forms["html"] = new RESTConnector.Form(htmlData); + } + else + throw new WatsonException("An HTML source is needed for GetAuthors"); } else { @@ -108,7 +113,7 @@ private void SetCredentials() } RESTConnector connector = RESTConnector.GetConnector(SERVICE_ID, service); - if(connector == null) + if (connector == null) return false; req.OnResponse = OnGetAuthorsResponse; @@ -175,10 +180,10 @@ private void OnGetAuthorsResponse(RESTConnector.Request req, RESTConnector.Respo /// If set to true include source text. /// Custom data. public bool GetRankedConcepts(OnGetRankedConcepts callback, string source, - int maxRetrieve = 8, - bool includeKnowledgeGraph = false, - bool includeLinkedData = true, - bool includeSourceText = false, + int maxRetrieve = 8, + bool includeKnowledgeGraph = false, + bool includeLinkedData = true, + bool includeSourceText = false, string customData = default(string)) { if (callback == null) @@ -204,17 +209,22 @@ public bool GetRankedConcepts(OnGetRankedConcepts callback, string source, string service; string normalizedSource = source.Trim().ToLower(); - if(normalizedSource.StartsWith("http://") || normalizedSource.StartsWith("https://")) + if (normalizedSource.StartsWith("http://") || normalizedSource.StartsWith("https://")) { service = SERVICE_GET_RANKED_CONCEPTS_URL; req.Forms["url"] = new RESTConnector.Form(source); } - else if(Path.GetExtension(normalizedSource).EndsWith(".html") && !normalizedSource.StartsWith("http://") && !normalizedSource.StartsWith("https://")) + else if (!normalizedSource.StartsWith("http://") && !normalizedSource.StartsWith("https://") && source.StartsWith(Application.dataPath)) { - service = SERVICE_GET_RANKED_CONCEPTS_HTML; - string htmlData = default(string); - htmlData = File.ReadAllText(source); - req.Forms["html"] = new RESTConnector.Form(htmlData); + if (Path.GetExtension(normalizedSource).EndsWith(".html")) + { + service = SERVICE_GET_RANKED_CONCEPTS_HTML; + string htmlData = default(string); + htmlData = File.ReadAllText(source); + req.Forms["html"] = new RESTConnector.Form(htmlData); + } + else + throw new WatsonException("An HTML source is needed for GetRankedConcepts"); } else { @@ -223,7 +233,7 @@ public bool GetRankedConcepts(OnGetRankedConcepts callback, string source, } RESTConnector connector = RESTConnector.GetConnector(SERVICE_ID, service); - if(connector == null) + if (connector == null) return false; req.OnResponse = OnGetRankedConceptsResponse; @@ -295,7 +305,7 @@ private void OnGetRankedConceptsResponse(RESTConnector.Request req, RESTConnecto throw new WatsonException("Please provide a source for GetAuthors."); if (string.IsNullOrEmpty(mp_ApiKey)) SetCredentials(); - if(string.IsNullOrEmpty(anchorDate)) + if (string.IsNullOrEmpty(anchorDate)) anchorDate = GetCurrentDatetime(); GetDatesRequest req = new GetDatesRequest(); @@ -312,17 +322,22 @@ private void OnGetRankedConceptsResponse(RESTConnector.Request req, RESTConnecto string service; string normalizedSource = source.Trim().ToLower(); - if(normalizedSource.StartsWith("http://") || normalizedSource.StartsWith("https://")) + if (normalizedSource.StartsWith("http://") || normalizedSource.StartsWith("https://")) { service = SERVICE_GET_DATES_URL; req.Forms["url"] = new RESTConnector.Form(source); } - else if(Path.GetExtension(normalizedSource).EndsWith(".html") && !normalizedSource.StartsWith("http://") && !normalizedSource.StartsWith("https://")) + else if (source.StartsWith(Application.dataPath) && !normalizedSource.StartsWith("http://") && !normalizedSource.StartsWith("https://")) { - service = SERVICE_GET_DATES_HTML; - string htmlData = default(string); - htmlData = File.ReadAllText(source); - req.Forms["html"] = new RESTConnector.Form(htmlData); + if (Path.GetExtension(normalizedSource).EndsWith(".html")) + { + service = SERVICE_GET_DATES_HTML; + string htmlData = default(string); + htmlData = File.ReadAllText(source); + req.Forms["html"] = new RESTConnector.Form(htmlData); + } + else + throw new WatsonException("An HTML source is needed for ExtractDates!"); } else { @@ -331,7 +346,7 @@ private void OnGetRankedConceptsResponse(RESTConnector.Request req, RESTConnecto } RESTConnector connector = RESTConnector.GetConnector(SERVICE_ID, service); - if(connector == null) + if (connector == null) return false; req.OnResponse = OnGetDatesResponse; @@ -423,17 +438,22 @@ private string GetCurrentDatetime() string service; string normalizedSource = source.Trim().ToLower(); - if(normalizedSource.StartsWith("http://") || normalizedSource.StartsWith("https://")) + if (normalizedSource.StartsWith("http://") || normalizedSource.StartsWith("https://")) { service = SERVICE_GET_EMOTION_URL; req.Forms["url"] = new RESTConnector.Form(source); } - else if(Path.GetExtension(normalizedSource).EndsWith(".html") && !normalizedSource.StartsWith("http://") && !normalizedSource.StartsWith("https://")) + else if (source.StartsWith(Application.dataPath) && !normalizedSource.StartsWith("http://") && !normalizedSource.StartsWith("https://")) { - service = SERVICE_GET_EMOTION_HTML; - string htmlData = default(string); - htmlData = File.ReadAllText(source); - req.Forms["html"] = new RESTConnector.Form(htmlData); + if (Path.GetExtension(normalizedSource).EndsWith(".html")) + { + service = SERVICE_GET_EMOTION_HTML; + string htmlData = default(string); + htmlData = File.ReadAllText(source); + req.Forms["html"] = new RESTConnector.Form(htmlData); + } + else + throw new WatsonException("An HTML source is needed for GetEmotions!"); } else { @@ -442,7 +462,7 @@ private string GetCurrentDatetime() } RESTConnector connector = RESTConnector.GetConnector(SERVICE_ID, service); - if(connector == null) + if (connector == null) return false; req.OnResponse = OnGetEmotionsResponse; @@ -513,9 +533,9 @@ private void OnGetEmotionsResponse(RESTConnector.Request req, RESTConnector.Resp /// If set to true include source text. /// If set to true extract structured entities. /// Custom data. - public bool ExtractEntities(OnGetEntities callback, string source, - int maxRetrieve = 50, - bool resolveCoreference = true, + public bool ExtractEntities(OnGetEntities callback, string source, + int maxRetrieve = 50, + bool resolveCoreference = true, bool disambiguate = true, bool includeKnowledgeGraph = false, bool includeLinkedData = true, @@ -553,17 +573,22 @@ public bool ExtractEntities(OnGetEntities callback, string source, string service; string normalizedSource = source.Trim().ToLower(); - if(normalizedSource.StartsWith("http://") || normalizedSource.StartsWith("https://")) + if (normalizedSource.StartsWith("http://") || normalizedSource.StartsWith("https://")) { service = SERVICE_GET_ENTITY_EXTRACTION_URL; req.Forms["url"] = new RESTConnector.Form(source); } - else if(Path.GetExtension(normalizedSource).EndsWith(".html") && !normalizedSource.StartsWith("http://") && !normalizedSource.StartsWith("https://")) + else if (source.StartsWith(Application.dataPath) && !normalizedSource.StartsWith("http://") && !normalizedSource.StartsWith("https://")) { - service = SERVICE_GET_ENTITY_EXTRACTION_HTML; - string htmlData = default(string); - htmlData = File.ReadAllText(source); - req.Forms["html"] = new RESTConnector.Form(htmlData); + if (Path.GetExtension(normalizedSource).EndsWith(".html")) + { + service = SERVICE_GET_ENTITY_EXTRACTION_HTML; + string htmlData = default(string); + htmlData = File.ReadAllText(source); + req.Forms["html"] = new RESTConnector.Form(htmlData); + } + else + throw new WatsonException("An HTML source is needed for ExtractEntities!"); } else { @@ -572,7 +597,7 @@ public bool ExtractEntities(OnGetEntities callback, string source, } RESTConnector connector = RESTConnector.GetConnector(SERVICE_ID, service); - if(connector == null) + if (connector == null) return false; req.OnResponse = OnGetEntitiesResponse; @@ -654,19 +679,19 @@ private void OnGetEntitiesResponse(RESTConnector.Request req, RESTConnector.Resp string service; string normalizedSource = source.Trim().ToLower(); - if(normalizedSource.StartsWith("http://") || normalizedSource.StartsWith("https://")) + if (normalizedSource.StartsWith("http://") || normalizedSource.StartsWith("https://")) { service = SERVICE_DETECT_FEEDS_URL; req.Forms["url"] = new RESTConnector.Form(source); } - else if(Path.GetExtension(normalizedSource).EndsWith(".html") && !normalizedSource.StartsWith("http://") && !normalizedSource.StartsWith("https://")) + else if (source.StartsWith(Application.dataPath) && !normalizedSource.StartsWith("http://") && !normalizedSource.StartsWith("https://")) { Log.Error("Alchemy Language", "A URL source is required for DetectFeeds!"); return false; -// service = SERVICE_DETECT_FEEDS_HTML; -// string htmlData = default(string); -// htmlData = File.ReadAllText(source); -// req.Forms["html"] = new RESTConnector.Form(htmlData); + // service = SERVICE_DETECT_FEEDS_HTML; + // string htmlData = default(string); + // htmlData = File.ReadAllText(source); + // req.Forms["html"] = new RESTConnector.Form(htmlData); } else { @@ -675,7 +700,7 @@ private void OnGetEntitiesResponse(RESTConnector.Request req, RESTConnector.Resp } RESTConnector connector = RESTConnector.GetConnector(SERVICE_ID, service); - if(connector == null) + if (connector == null) return false; req.OnResponse = OnDetectFeedsResponse; @@ -741,8 +766,8 @@ private void OnDetectFeedsResponse(RESTConnector.Request req, RESTConnector.Resp /// If set to true analyze sentiment. /// If set to true include source text. /// Custom data. - public bool ExtractKeywords(OnGetKeywords callback, string source, - int maxRetrieve = 50, + public bool ExtractKeywords(OnGetKeywords callback, string source, + int maxRetrieve = 50, bool includeKnowledgeGraph = false, bool analyzeSentiment = false, bool includeSourceText = false, @@ -772,17 +797,22 @@ public bool ExtractKeywords(OnGetKeywords callback, string source, string service; string normalizedSource = source.Trim().ToLower(); - if(normalizedSource.StartsWith("http://") || normalizedSource.StartsWith("https://")) + if (normalizedSource.StartsWith("http://") || normalizedSource.StartsWith("https://")) { service = SERVICE_GET_KEYWORD_EXTRACTION_URL; req.Forms["url"] = new RESTConnector.Form(source); } - else if(Path.GetExtension(normalizedSource).EndsWith(".html") && !normalizedSource.StartsWith("http://") && !normalizedSource.StartsWith("https://")) + else if (source.StartsWith(Application.dataPath) && !normalizedSource.StartsWith("http://") && !normalizedSource.StartsWith("https://")) { - service = SERVICE_GET_KEYWORD_EXTRACTION_HTML; - string htmlData = default(string); - htmlData = File.ReadAllText(source); - req.Forms["html"] = new RESTConnector.Form(htmlData); + if (Path.GetExtension(normalizedSource).EndsWith(".html")) + { + service = SERVICE_GET_KEYWORD_EXTRACTION_HTML; + string htmlData = default(string); + htmlData = File.ReadAllText(source); + req.Forms["html"] = new RESTConnector.Form(htmlData); + } + else + throw new WatsonException("An HTML source is needed for Getkeywords!"); } else { @@ -791,7 +821,7 @@ public bool ExtractKeywords(OnGetKeywords callback, string source, } RESTConnector connector = RESTConnector.GetConnector(SERVICE_ID, service); - if(connector == null) + if (connector == null) return false; req.OnResponse = OnGetKeywordsResponse; @@ -876,17 +906,22 @@ private void OnGetKeywordsResponse(RESTConnector.Request req, RESTConnector.Resp string service; string normalizedSource = source.Trim().ToLower(); - if(normalizedSource.StartsWith("http://") || normalizedSource.StartsWith("https://")) + if (normalizedSource.StartsWith("http://") || normalizedSource.StartsWith("https://")) { service = SERVICE_GET_LANGUAGE_URL; req.Forms["url"] = new RESTConnector.Form(source); } - else if(Path.GetExtension(normalizedSource).EndsWith(".html") && !normalizedSource.StartsWith("http://") && !normalizedSource.StartsWith("https://")) + else if (source.StartsWith(Application.dataPath) && !normalizedSource.StartsWith("http://") && !normalizedSource.StartsWith("https://")) { - service = SERVICE_GET_LANGUAGE_HTML; - string htmlData = default(string); - htmlData = File.ReadAllText(source); - req.Forms["html"] = new RESTConnector.Form(htmlData); + if (Path.GetExtension(normalizedSource).EndsWith(".html")) + { + service = SERVICE_GET_LANGUAGE_HTML; + string htmlData = default(string); + htmlData = File.ReadAllText(source); + req.Forms["html"] = new RESTConnector.Form(htmlData); + } + else + throw new WatsonException("An HTML source is needed for GetLanguages!"); } else { @@ -895,7 +930,7 @@ private void OnGetKeywordsResponse(RESTConnector.Request req, RESTConnector.Resp } RESTConnector connector = RESTConnector.GetConnector(SERVICE_ID, service); - if(connector == null) + if (connector == null) return false; req.OnResponse = OnGetLanguagesResponse; @@ -937,7 +972,7 @@ private void OnGetLanguagesResponse(RESTConnector.Request req, RESTConnector.Res if (((GetLanguagesRequest)req).Callback != null) ((GetLanguagesRequest)req).Callback(resp.Success ? languageData : null, ((GetLanguagesRequest)req).Data); - } + } #endregion #region GetMicroformat @@ -977,19 +1012,19 @@ private void OnGetLanguagesResponse(RESTConnector.Request req, RESTConnector.Res string service = ""; string normalizedSource = source.Trim().ToLower(); - if(normalizedSource.StartsWith("http://") || normalizedSource.StartsWith("https://")) + if (normalizedSource.StartsWith("http://") || normalizedSource.StartsWith("https://")) { service = SERVICE_GET_MICROFORMAT_URL; req.Forms["url"] = new RESTConnector.Form(source); } - else if(Path.GetExtension(normalizedSource).EndsWith(".html") && !normalizedSource.StartsWith("http://") && !normalizedSource.StartsWith("https://")) + else if (source.StartsWith(Application.dataPath) && !normalizedSource.StartsWith("http://") && !normalizedSource.StartsWith("https://")) { Log.Error("Alchemy Language", "A URL source is required for GetMicroformats!"); return false; -// service = SERVICE_GET_MICROFORMAT_HTML; -// string htmlData = default(string); -// htmlData = File.ReadAllText(source); -// req.Forms["html"] = new RESTConnector.Form(htmlData); + // service = SERVICE_GET_MICROFORMAT_HTML; + // string htmlData = default(string); + // htmlData = File.ReadAllText(source); + // req.Forms["html"] = new RESTConnector.Form(htmlData); } else { @@ -998,7 +1033,7 @@ private void OnGetLanguagesResponse(RESTConnector.Request req, RESTConnector.Res } RESTConnector connector = RESTConnector.GetConnector(SERVICE_ID, service); - if(connector == null) + if (connector == null) return false; req.OnResponse = OnGetMicroformatsResponse; @@ -1080,17 +1115,22 @@ private void OnGetMicroformatsResponse(RESTConnector.Request req, RESTConnector. string service = ""; string normalizedSource = source.Trim().ToLower(); - if(normalizedSource.StartsWith("http://") || normalizedSource.StartsWith("https://")) + if (normalizedSource.StartsWith("http://") || normalizedSource.StartsWith("https://")) { service = SERVICE_GET_PUBLICATION_DATE_URL; req.Forms["url"] = new RESTConnector.Form(source); } - else if(Path.GetExtension(normalizedSource).EndsWith(".html") && !normalizedSource.StartsWith("http://") && !normalizedSource.StartsWith("https://")) + else if (source.StartsWith(Application.dataPath) && !normalizedSource.StartsWith("http://") && !normalizedSource.StartsWith("https://")) { - service = SERVICE_GET_PUBLICATION_DATE_HTML; - string htmlData = default(string); - htmlData = File.ReadAllText(source); - req.Forms["html"] = new RESTConnector.Form(htmlData); + if (Path.GetExtension(normalizedSource).EndsWith(".html")) + { + service = SERVICE_GET_PUBLICATION_DATE_HTML; + string htmlData = default(string); + htmlData = File.ReadAllText(source); + req.Forms["html"] = new RESTConnector.Form(htmlData); + } + else + throw new WatsonException("An HTML source is needed for GetPubicationDate!"); } else { @@ -1099,7 +1139,7 @@ private void OnGetMicroformatsResponse(RESTConnector.Request req, RESTConnector. } RESTConnector connector = RESTConnector.GetConnector(SERVICE_ID, service); - if(connector == null) + if (connector == null) return false; req.OnResponse = OnGetPublicationDateResponse; @@ -1172,8 +1212,8 @@ private void OnGetPublicationDateResponse(RESTConnector.Request req, RESTConnect /// If set to true exclude entities in sentiment. /// If set to true include source text. /// Custom data. - public bool GetRelations(OnGetRelations callback, string source, - int maxRetrieve = 50, + public bool GetRelations(OnGetRelations callback, string source, + int maxRetrieve = 50, bool includeKeywords = false, bool includeEntities = false, bool requireEntities = false, @@ -1183,7 +1223,7 @@ public bool GetRelations(OnGetRelations callback, string source, bool includeLinkedData = true, bool analyzeSentiment = false, bool excludeEntitiesInSentiment = false, - bool includeSourceText = false, + bool includeSourceText = false, string customData = default(string)) { if (callback == null) @@ -1217,17 +1257,22 @@ public bool GetRelations(OnGetRelations callback, string source, string service; string normalizedSource = source.Trim().ToLower(); - if(normalizedSource.StartsWith("http://") || normalizedSource.StartsWith("https://")) + if (normalizedSource.StartsWith("http://") || normalizedSource.StartsWith("https://")) { service = SERVICE_GET_RELATIONS_URL; req.Forms["url"] = new RESTConnector.Form(source); } - else if(Path.GetExtension(normalizedSource).EndsWith(".html") && !normalizedSource.StartsWith("http://") && !normalizedSource.StartsWith("https://")) + else if (source.StartsWith(Application.dataPath) && !normalizedSource.StartsWith("http://") && !normalizedSource.StartsWith("https://")) { - service = SERVICE_GET_RELATIONS_HTML; - string htmlData = default(string); - htmlData = File.ReadAllText(source); - req.Forms["html"] = new RESTConnector.Form(htmlData); + if (Path.GetExtension(normalizedSource).EndsWith(".html")) + { + service = SERVICE_GET_RELATIONS_HTML; + string htmlData = default(string); + htmlData = File.ReadAllText(source); + req.Forms["html"] = new RESTConnector.Form(htmlData); + } + else + throw new WatsonException("An HTML source is needed for GetRelations!"); } else { @@ -1236,7 +1281,7 @@ public bool GetRelations(OnGetRelations callback, string source, } RESTConnector connector = RESTConnector.GetConnector(SERVICE_ID, service); - if(connector == null) + if (connector == null) return false; req.OnResponse = OnGetRelationsResponse; @@ -1321,17 +1366,22 @@ private void OnGetRelationsResponse(RESTConnector.Request req, RESTConnector.Res string service; string normalizedSource = source.Trim().ToLower(); - if(normalizedSource.StartsWith("http://") || normalizedSource.StartsWith("https://")) + if (normalizedSource.StartsWith("http://") || normalizedSource.StartsWith("https://")) { service = SERVICE_GET_TEXT_SENTIMENT_URL; req.Forms["url"] = new RESTConnector.Form(source); } - else if(Path.GetExtension(normalizedSource).EndsWith(".html") && !normalizedSource.StartsWith("http://") && !normalizedSource.StartsWith("https://")) + else if (source.StartsWith(Application.dataPath) && !normalizedSource.StartsWith("http://") && !normalizedSource.StartsWith("https://")) { - service = SERVICE_GET_TEXT_SENTIMENT_HTML; - string htmlData = default(string); - htmlData = File.ReadAllText(source); - req.Forms["html"] = new RESTConnector.Form(htmlData); + if (Path.GetExtension(normalizedSource).EndsWith(".html")) + { + service = SERVICE_GET_TEXT_SENTIMENT_HTML; + string htmlData = default(string); + htmlData = File.ReadAllText(source); + req.Forms["html"] = new RESTConnector.Form(htmlData); + } + else + throw new WatsonException("An HTML source is needed for GetTextSentiment!"); } else { @@ -1340,7 +1390,7 @@ private void OnGetRelationsResponse(RESTConnector.Request req, RESTConnector.Res } RESTConnector connector = RESTConnector.GetConnector(SERVICE_ID, service); - if(connector == null) + if (connector == null) return false; req.OnResponse = OnGetTextSentimentResponse; @@ -1410,7 +1460,7 @@ private void OnGetTextSentimentResponse(RESTConnector.Request req, RESTConnector throw new ArgumentNullException("callback"); if (string.IsNullOrEmpty(source)) throw new WatsonException("Please provide a source for GetTargetedSentiment."); - if(string.IsNullOrEmpty(targets)) + if (string.IsNullOrEmpty(targets)) throw new WatsonException("Please provide a target for GetTargetedSentiment."); if (string.IsNullOrEmpty(mp_ApiKey)) SetCredentials(); @@ -1429,17 +1479,22 @@ private void OnGetTextSentimentResponse(RESTConnector.Request req, RESTConnector string service; string normalizedSource = source.Trim().ToLower(); - if(normalizedSource.StartsWith("http://") || normalizedSource.StartsWith("https://")) + if (normalizedSource.StartsWith("http://") || normalizedSource.StartsWith("https://")) { service = SERVICE_GET_TARGETED_SENTIMENT_URL; req.Forms["url"] = new RESTConnector.Form(source); } - else if(Path.GetExtension(normalizedSource).EndsWith(".html") && !normalizedSource.StartsWith("http://") && !normalizedSource.StartsWith("https://")) + else if (source.StartsWith(Application.dataPath) && !normalizedSource.StartsWith("http://") && !normalizedSource.StartsWith("https://")) { - service = SERVICE_GET_TARGETED_SENTIMENT_HTML; - string htmlData = default(string); - htmlData = File.ReadAllText(source); - req.Forms["html"] = new RESTConnector.Form(htmlData); + if (Path.GetExtension(normalizedSource).EndsWith(".html")) + { + service = SERVICE_GET_TARGETED_SENTIMENT_HTML; + string htmlData = default(string); + htmlData = File.ReadAllText(source); + req.Forms["html"] = new RESTConnector.Form(htmlData); + } + else + throw new WatsonException("An HTML source is needed for GetTargetedSentiment!"); } else { @@ -1448,7 +1503,7 @@ private void OnGetTextSentimentResponse(RESTConnector.Request req, RESTConnector } RESTConnector connector = RESTConnector.GetConnector(SERVICE_ID, service); - if(connector == null) + if (connector == null) return false; req.OnResponse = OnGetTargetedSentimentResponse; @@ -1533,17 +1588,22 @@ private void OnGetTargetedSentimentResponse(RESTConnector.Request req, RESTConne string service; string normalizedSource = source.Trim().ToLower(); - if(normalizedSource.StartsWith("http://") || normalizedSource.StartsWith("https://")) + if (normalizedSource.StartsWith("http://") || normalizedSource.StartsWith("https://")) { service = SERVICE_GET_RANKED_TAXONOMY_URL; req.Forms["url"] = new RESTConnector.Form(source); } - else if(Path.GetExtension(normalizedSource).EndsWith(".html") && !normalizedSource.StartsWith("http://") && !normalizedSource.StartsWith("https://")) + else if (source.StartsWith(Application.dataPath) && !normalizedSource.StartsWith("http://") && !normalizedSource.StartsWith("https://")) { - service = SERVICE_GET_RANKED_TAXONOMY_HTML; - string htmlData = default(string); - htmlData = File.ReadAllText(source); - req.Forms["html"] = new RESTConnector.Form(htmlData); + if (Path.GetExtension(normalizedSource).EndsWith(".html")) + { + service = SERVICE_GET_RANKED_TAXONOMY_HTML; + string htmlData = default(string); + htmlData = File.ReadAllText(source); + req.Forms["html"] = new RESTConnector.Form(htmlData); + } + else + throw new WatsonException("An HTML source is needed for GetRankedTaxonomy!"); } else { @@ -1552,7 +1612,7 @@ private void OnGetTargetedSentimentResponse(RESTConnector.Request req, RESTConne } RESTConnector connector = RESTConnector.GetConnector(SERVICE_ID, service); - if(connector == null) + if (connector == null) return false; req.OnResponse = OnGetRankedTaxonomyResponse; @@ -1638,17 +1698,22 @@ private void OnGetRankedTaxonomyResponse(RESTConnector.Request req, RESTConnecto string service = ""; string normalizedSource = source.Trim().ToLower(); - if(normalizedSource.StartsWith("http://") || normalizedSource.StartsWith("https://")) + if (normalizedSource.StartsWith("http://") || normalizedSource.StartsWith("https://")) { service = SERVICE_GET_TEXT_URL; req.Forms["url"] = new RESTConnector.Form(source); } - else if(Path.GetExtension(normalizedSource).EndsWith(".html") && !normalizedSource.StartsWith("http://") && !normalizedSource.StartsWith("https://")) + else if (source.StartsWith(Application.dataPath) && !normalizedSource.StartsWith("http://") && !normalizedSource.StartsWith("https://")) { - service = SERVICE_GET_TEXT_HTML; - string htmlData = default(string); - htmlData = File.ReadAllText(source); - req.Forms["html"] = new RESTConnector.Form(htmlData); + if (Path.GetExtension(normalizedSource).EndsWith(".html")) + { + service = SERVICE_GET_TEXT_HTML; + string htmlData = default(string); + htmlData = File.ReadAllText(source); + req.Forms["html"] = new RESTConnector.Form(htmlData); + } + else + throw new WatsonException("An HTML source is needed for GetText!"); } else { @@ -1657,7 +1722,7 @@ private void OnGetRankedTaxonomyResponse(RESTConnector.Request req, RESTConnecto } RESTConnector connector = RESTConnector.GetConnector(SERVICE_ID, service); - if(connector == null) + if (connector == null) return false; req.OnResponse = OnGetTextResponse; @@ -1734,26 +1799,31 @@ private void OnGetTextResponse(RESTConnector.Request req, RESTConnector.Response string service = ""; string normalizedSource = source.Trim().ToLower(); - if(normalizedSource.StartsWith("http://") || normalizedSource.StartsWith("https://")) + if (normalizedSource.StartsWith("http://") || normalizedSource.StartsWith("https://")) { service = SERVICE_GET_TEXT_URL; req.Forms["url"] = new RESTConnector.Form(source); } - else if(Path.GetExtension(normalizedSource).EndsWith(".html") && !normalizedSource.StartsWith("http://") && !normalizedSource.StartsWith("https://")) + else if (source.StartsWith(Application.dataPath) && !normalizedSource.StartsWith("http://") && !normalizedSource.StartsWith("https://")) { - service = SERVICE_GET_TEXT_HTML; - string htmlData = default(string); - htmlData = File.ReadAllText(source); - req.Forms["html"] = new RESTConnector.Form(htmlData); + if (Path.GetExtension(normalizedSource).EndsWith(".html")) + { + service = SERVICE_GET_TEXT_HTML; + string htmlData = default(string); + htmlData = File.ReadAllText(source); + req.Forms["html"] = new RESTConnector.Form(htmlData); + } + else + throw new WatsonException("An HTML source is needed for GetRawText!"); } else { - Log.Error("Alchemy Language", "Either a URL or a html page source is required for GetText!"); + Log.Error("Alchemy Language", "Either a URL or a html page source is required for GetRawText!"); return false; } RESTConnector connector = RESTConnector.GetConnector(SERVICE_ID, service); - if(connector == null) + if (connector == null) return false; req.OnResponse = OnGetTextResponse; @@ -1800,17 +1870,22 @@ private void OnGetTextResponse(RESTConnector.Request req, RESTConnector.Response string service = ""; string normalizedSource = source.Trim().ToLower(); - if(normalizedSource.StartsWith("http://") || normalizedSource.StartsWith("https://")) + if (normalizedSource.StartsWith("http://") || normalizedSource.StartsWith("https://")) { service = SERVICE_GET_TITLE_URL; req.Forms["url"] = new RESTConnector.Form(source); } - else if(Path.GetExtension(normalizedSource).EndsWith(".html") && !normalizedSource.StartsWith("http://") && !normalizedSource.StartsWith("https://")) + else if (source.StartsWith(Application.dataPath) && !normalizedSource.StartsWith("http://") && !normalizedSource.StartsWith("https://")) { - service = SERVICE_GET_TITLE_HTML; - string htmlData = default(string); - htmlData = File.ReadAllText(source); - req.Forms["html"] = new RESTConnector.Form(htmlData); + if (Path.GetExtension(normalizedSource).EndsWith(".html")) + { + service = SERVICE_GET_TITLE_HTML; + string htmlData = default(string); + htmlData = File.ReadAllText(source); + req.Forms["html"] = new RESTConnector.Form(htmlData); + } + else + throw new WatsonException("An HTML source is needed for GetTitle!"); } else { @@ -1819,7 +1894,7 @@ private void OnGetTextResponse(RESTConnector.Request req, RESTConnector.Response } RESTConnector connector = RESTConnector.GetConnector(SERVICE_ID, service); - if(connector == null) + if (connector == null) return false; req.OnResponse = OnGetTitleResponse; @@ -1896,7 +1971,7 @@ private void OnGetTitleResponse(RESTConnector.Request req, RESTConnector.Respons /// If set to true extract page image. /// If set to true extract image keywords. /// Custom data. - public bool GetCombinedData(OnGetCombinedData callback, string source, + public bool GetCombinedData(OnGetCombinedData callback, string source, bool includeSourceText = false, bool extractAuthors = false, bool extractConcepts = true, @@ -1945,33 +2020,33 @@ public bool GetCombinedData(OnGetCombinedData callback, string source, req.Parameters["showSourceText"] = Convert.ToInt32(includeSourceText).ToString(); List requestServices = new List(); - if(extractAuthors) + if (extractAuthors) requestServices.Add("authors"); - if(extractConcepts) + if (extractConcepts) requestServices.Add("concepts"); - if(extractDates) + if (extractDates) requestServices.Add("dates"); - if(extractDocEmotion) + if (extractDocEmotion) requestServices.Add("doc-emotion"); - if(extractEntities) + if (extractEntities) requestServices.Add("entities"); - if(extractFeeds) + if (extractFeeds) requestServices.Add("feeds"); - if(extractKeywords) + if (extractKeywords) requestServices.Add("keywords"); - if(extractPubDate) + if (extractPubDate) requestServices.Add("pub-date"); - if(extractRelations) + if (extractRelations) requestServices.Add("relations"); - if(extractDocSentiment) + if (extractDocSentiment) requestServices.Add("doc-sentiment"); - if(extractTaxonomy) + if (extractTaxonomy) requestServices.Add("taxonomy"); - if(extractTitle) + if (extractTitle) requestServices.Add("title"); - if(extractPageImage) + if (extractPageImage) requestServices.Add("page-image"); - if(extractImageKeywords) + if (extractImageKeywords) requestServices.Add("image-kw"); req.Parameters["extract"] = string.Join(",", requestServices.ToArray()); @@ -1980,17 +2055,22 @@ public bool GetCombinedData(OnGetCombinedData callback, string source, string service; string normalizedSource = source.Trim().ToLower(); - if(normalizedSource.StartsWith("http://") || normalizedSource.StartsWith("https://")) + if (normalizedSource.StartsWith("http://") || normalizedSource.StartsWith("https://")) { service = SERVICE_COMBINED_CALL_URL; req.Forms["url"] = new RESTConnector.Form(source); } - else if(Path.GetExtension(normalizedSource).EndsWith(".html") && !normalizedSource.StartsWith("http://") && !normalizedSource.StartsWith("https://")) + else if (source.StartsWith(Application.dataPath) && !normalizedSource.StartsWith("http://") && !normalizedSource.StartsWith("https://")) { - service = SERVICE_COMBINED_CALL_HTML; - string htmlData = default(string); - htmlData = File.ReadAllText(source); - req.Forms["html"] = new RESTConnector.Form(htmlData); + if (Path.GetExtension(normalizedSource).EndsWith(".html")) + { + service = SERVICE_COMBINED_CALL_HTML; + string htmlData = default(string); + htmlData = File.ReadAllText(source); + req.Forms["html"] = new RESTConnector.Form(htmlData); + } + else + throw new WatsonException("An HTML source is needed for GetCombinedData!"); } else { @@ -1999,7 +2079,7 @@ public bool GetCombinedData(OnGetCombinedData callback, string source, } RESTConnector connector = RESTConnector.GetConnector(SERVICE_ID, service); - if(connector == null) + if (connector == null) return false; req.OnResponse = OnCombinedCallResponse; @@ -2044,6 +2124,104 @@ private void OnCombinedCallResponse(RESTConnector.Request req, RESTConnector.Res } #endregion + #region GetNews + private const string SERVICE_GET_NEWS = "/data/GetNews"; + + /// + /// On get news delegate. + /// + public delegate void OnGetNews(NewsResponse newsData, string data); + + /// + /// Gets news. + /// + /// true, if news was gotten, false otherwise. + /// Callback. + /// Fields returned. + /// Values for each field. + /// Date to start the query. + /// Date to end the query. + /// Maximum number of results. + /// the duration (in seconds) of each time slice. a human readable duration is also acceptable e.g. '1d', '4h', '1M', etc. + /// If set, this parameter causes the query engine to return a time series representing the count in each slice of time. If omitted, the query engine returns the total count over the time duration. + /// Custom data. + public bool GetNews(OnGetNews callback, + string[] returnFields = default(string[]), + Dictionary queryFields = null, + string startDate = "now-1d", + string endDate = "now", + int maxResults = 10, + string timeSlice = default(string), + string customData = default(string)) + { + if (callback == null) + throw new ArgumentNullException("callback"); + if (string.IsNullOrEmpty(mp_ApiKey)) + SetCredentials(); + + GetNewsRequest req = new GetNewsRequest(); + req.Callback = callback; + req.Data = customData; + + req.Parameters["apikey"] = mp_ApiKey; + req.Parameters["outputMode"] = "json"; + req.Parameters["start"] = startDate; + req.Parameters["end"] = endDate; + req.Parameters["maxResults"] = maxResults; + if (timeSlice != default(string)) + req.Parameters["timeSlice"] = timeSlice; + if (returnFields != default(string[])) + req.Parameters["return"] = string.Join(",", returnFields); + if (queryFields != null) + foreach (KeyValuePair entry in queryFields) + req.Parameters[entry.Key] = "q." + entry.Value; + + RESTConnector connector = RESTConnector.GetConnector(SERVICE_ID, SERVICE_GET_NEWS); + if (connector == null) + return false; + + req.OnResponse = OnGetNewsResponse; + return connector.Send(req); + } + + /// + /// Get News request. + /// + public class GetNewsRequest : RESTConnector.Request + { + public string Data { get; set; } + public OnGetNews Callback { get; set; } + } + + private void OnGetNewsResponse(RESTConnector.Request req, RESTConnector.Response resp) + { + NewsResponse newsData = new NewsResponse(); + if (resp.Success) + { + try + { + fsData data = null; + fsResult r = fsJsonParser.Parse(Encoding.UTF8.GetString(resp.Data), out data); + if (!r.Succeeded) + throw new WatsonException(r.FormattedMessages); + + object obj = newsData; + r = sm_Serializer.TryDeserialize(data, obj.GetType(), ref obj); + if (!r.Succeeded) + throw new WatsonException(r.FormattedMessages); + } + catch (Exception e) + { + Log.Error("AlchemyDataNews", "OnGetNewsResponse Exception: {0}", e.ToString()); + resp.Success = false; + } + } + + if (((GetNewsRequest)req).Callback != null) + ((GetNewsRequest)req).Callback(resp.Success ? newsData : null, ((GetNewsRequest)req).Data); + } + #endregion + #region IWatsonService interface /// public string GetServiceID() @@ -2062,10 +2240,10 @@ public void GetServiceStatus(ServiceStatus callback) private class CheckServiceStatus { - private AlchemyLanguage m_Service = null; + private AlchemyAPI m_Service = null; private ServiceStatus m_Callback = null; - public CheckServiceStatus(AlchemyLanguage service, ServiceStatus callback) + public CheckServiceStatus(AlchemyAPI service, ServiceStatus callback) { m_Service = service; m_Callback = callback; diff --git a/Scripts/Services/AlchemyAPI/AlchemyLanguage.cs.meta b/Scripts/Services/AlchemyAPI/AlchemyAPI.cs.meta similarity index 100% rename from Scripts/Services/AlchemyAPI/AlchemyLanguage.cs.meta rename to Scripts/Services/AlchemyAPI/AlchemyAPI.cs.meta diff --git a/Scripts/Services/AlchemyAPI/DataModels.cs b/Scripts/Services/AlchemyAPI/DataModels.cs old mode 100644 new mode 100755 index 1dcbbc983..26de84276 --- a/Scripts/Services/AlchemyAPI/DataModels.cs +++ b/Scripts/Services/AlchemyAPI/DataModels.cs @@ -19,7 +19,7 @@ using System.Text; using System.Collections.Generic; -namespace IBM.Watson.DeveloperCloud.Services.AlchemyLanguage.v1 +namespace IBM.Watson.DeveloperCloud.Services.AlchemyAPI.v1 { #region Combined Call /// @@ -675,9 +675,9 @@ public PositionOnMap GeoLocation } /// - /// Returns a that represents the current . + /// Returns a that represents the current . /// - /// A that represents the current . + /// A that represents the current . public override string ToString() { StringBuilder stringBuilder = new StringBuilder(); @@ -769,9 +769,9 @@ public EntityPrimaryType EntityType } /// - /// Returns a that represents the current . + /// Returns a that represents the current . /// - /// A that represents the current . + /// A that represents the current . public override string ToString() { StringBuilder stringBuilder = new StringBuilder(); @@ -871,7 +871,7 @@ public class PositionOnMap /// /// Initializes a new instance of the - /// class. + /// class. /// /// Latitude. /// Longitude. @@ -883,7 +883,7 @@ public PositionOnMap(double latitude, double longitude) /// /// Initializes a new instance of the - /// class. + /// class. /// /// Latitude. /// Longitude. @@ -896,9 +896,9 @@ public PositionOnMap(double latitude, double longitude, string positionName) } /// - /// Returns a that represents the current . + /// Returns a that represents the current . /// - /// A that represents the current . + /// A that represents the current . public override string ToString() { return string.Format("[PositionOnMap: Name: {0}, Latitude:{1}, Longitude:{2}]", PositionName, Latitude.ToString(), Longitude.ToString()); @@ -1493,9 +1493,9 @@ public bool HasData } /// - /// Returns a that represents the current . + /// Returns a that represents the current . /// - /// A that represents the current . + /// A that represents the current . public override string ToString() { StringBuilder stringBuilder = new StringBuilder(); @@ -1934,9 +1934,9 @@ public class KnowledgeGraph public string typeHierarchy { get; set; } /// - /// Returns a that represents the current . + /// Returns a that represents the current . /// - /// A that represents the current . + /// A that represents the current . public override string ToString() { return string.Format("[KnowledgeGraph: typeHierarchy={0}]", typeHierarchy); @@ -2034,9 +2034,9 @@ public class Disambiguated public string crunchbase { get; set; } /// - /// Returns a that represents the current . + /// Returns a that represents the current . /// - /// A that represents the current . + /// A that represents the current . public override string ToString() { return string.Format("[Disambiguated: name={0}, subType={1}, website={2}, geo={3}, dbpedia={4}, yago={5}, opencyc={6}, umbel={7}, freebase={8}, ciaFactbook={9}, census={10}, geonames={11}, musicBrainz={12}, crunchbase={13}]", name, subType, website, geo, dbpedia, yago, opencyc, umbel, freebase, ciaFactbook, census, geonames, musicBrainz, crunchbase); @@ -2057,9 +2057,9 @@ public class Quotation public string quotation { get; set; } /// - /// Returns a that represents the current . + /// Returns a that represents the current . /// - /// A that represents the current . + /// A that represents the current . public override string ToString() { return string.Format("[Quotation: quotation={0}]", quotation); @@ -2112,9 +2112,9 @@ public double Score } /// - /// Returns a that represents the current . + /// Returns a that represents the current . /// - /// A that represents the current . + /// A that represents the current . public override string ToString() { return string.Format("[Sentiment: type={0}, score={1}, mixed={2}]", type, score, mixed); @@ -2174,8 +2174,13 @@ public class Relation /// /// The location. public Location location { get; set; } - } + /// + /// Gets or sets the temporal. + /// + public Temporal temporal { get; set; } + } + /// /// Subject. /// @@ -2331,5 +2336,580 @@ public class Location /// The entities. public Entity[] entities { get; set; } } + + /// + /// Temporal. + /// + [fsObject] + public class Temporal + { + /// + /// Gets or sets the text + /// + public string text { get; set; } + /// + /// Gets or sets the decoded values + /// + public Decoded decoded { get; set; } + } + + /// + /// Decoded values. + /// + [fsObject] + public class Decoded + { + /// + /// Gets or sets the type. + /// + public string type { get; set; } + /// + /// Gets or sets the value. + /// + public string value { get; set; } + /// + /// Gets or sets the start time. + /// + public string start { get; set; } + /// + /// Gets or sets the end time. + /// + public string end { get; set; } + } + #endregion + + #region GetNews + /// + /// The NewsResponse. + /// + [fsObject] + public class NewsResponse + { + /// + /// THe status of the request. + /// + public string status { get; set; } + /// + /// The results. + /// + public Result result { get; set; } + } + + /// + /// The Result data. + /// + [fsObject] + public class Result + { + /// + /// The next string. + /// + public string next { get; set; } + /// + /// The request status. + /// + public string status { get; set; } + /// + /// The docs data. + /// + public Docs[] docs { get; set; } + } + #endregion + + #region Docs + /// + /// The Docs data. + /// + [fsObject] + public class Docs + { + /// + /// The request ID. + /// + public string id { get; set; } + /// + /// The source data. + /// + public Source source { get; set; } + /// + /// Timestamp of the request. + /// + public string timestamp { get; set; } + } + #endregion + + #region Source + /// + /// The Source data. + /// + [fsObject] + public class Source + { + /// + /// Original data. + /// + public Original original { get; set; } + /// + /// The enriched data. + /// + /// The enriched. + public Enriched enriched { get; set; } + } + #endregion + + #region Originial + /// + /// The Original data. + /// + [fsObject] + public class Original + { + /// + /// The URL. + /// + public string url { get; set; } + } + #endregion + + #region Enriched + /// + /// The Enriched data. + /// + [fsObject] + public class Enriched + { + /// + /// The URL. + /// + public URL url { get; set; } + } + #endregion + + #region URL + /// + /// The URL data. + /// + [fsObject] + public class URL + { + /// + /// The image data. + /// + public string image { get; set; } + /// + /// The image keywords. + /// + public ImageKeyword[] imageKeywords { get; set; } + /// + /// The RSS Feed data. + /// + public Feed[] feeds { get; set; } + /// + /// The URL. + /// + public string url { get; set; } + /// + /// The raw title. + /// + public string title { get; set; } + /// + /// The cleaned title. + /// + public string cleanedTitle { get; set; } + /// + /// Detected language. + /// + public string language { get; set; } + /// + /// The PublicationDate data. + /// + public PublicationDate publicationDate { get; set; } + /// + /// Text data. + /// + public string text { get; set; } + /// + /// /The Author data. + /// + public string author { get; set; } + /// + /// Keyword Extraction data. + /// + public Keyword[] keywords { get; set; } + /// + /// Entity extraction data. + /// + public Entity[] entities { get; set; } + /// + /// The concept data. + /// + public Concept[] concepts { get; set; } + /// + /// The relations data. + /// + public Relation relations { get; set; } + /// + /// The DocSentiment. + /// + public DocSentiment docSentiment { get; set; } + /// + /// The taxonomy data. + /// + public Taxonomy taxonomy { get; set; } + /// + /// The enriched title data. + /// + public EnrichedTitle[] enrichedTitle { get; set; } + } + #endregion + + #region EnrichedTitle + /// + /// The EnrichedTitle data. + /// + [fsObject] + public class EnrichedTitle + { + /// + /// Keyword extraction data. + /// + public Keyword[] keywords { get; set; } + /// + /// Entity extraction data. + /// + public Entity[] entities { get; set; } + /// + /// The Concepts data. + /// + public Concept[] concepts { get; set; } + /// + /// Relations data. + /// + public Relation[] relations { get; set; } + /// + /// The DocSentiment. + /// + public DocSentiment docSentiment { get; set; } + /// + /// Taxonomy data. + /// + public Taxonomy[] taxonomy { get; set; } + } + #endregion + + #region AlchemyData News Fields + /// + /// All fields for querying and receiving data. + /// + public class Fields + { + public const string ORIGINAL_URL = "original.url"; + public const string ENRICHED_URL_IMAGE = "enriched.url.image"; + public const string ENRICHED_URL_IMAGEKEYWORDS = "enriched.url.imageKeywords"; + public const string ENRICHED_URL_IMAGEKEYWORDS_IMAGEKEYWORD_TEXT = "enriched.url.imageKeywords.imageKeyword.text"; + public const string ENRICHED_URL_IMAGEKEYWORDS_IMAGEKEYWORD_SCORE = "enriched.url.imageKeywords.imageKeyword.score"; + public const string ENRICHED_URL_FEEDS = "enriched.url.feeds"; + public const string ENRICHED_URL_FEEDS_FEED_FEED = "enriched.url.feeds.feed.feed"; + public const string ENRICHED_URL_URL = "enriched.url.url"; + public const string ENRICHED_URL_TITLE = "enriched.url.title"; + public const string ENRICHED_URL_CLEANEDTITLE = "enriched.url.cleanedTitle"; + public const string ENRICHED_URL_LANGUAGE = "enriched.url.language"; + public const string ENRICHED_URL_PUBLICATIONDATE_DATE = "enriched.url.publicationDate.date"; + public const string ENRICHED_URL_PUBLICATIONDATE_CONFIDENT = "enriched.url.publicationDate.confident"; + public const string ENRICHED_URL_TEXT = "enriched.url.text"; + public const string ENRICHED_URL_AUTHOR = "enriched.url.author"; + public const string ENRICHED_URL_KEYWORDS = "enriched.url.keywords"; + public const string ENRICHED_URL_KEYWORDS_KEYWORD_TEXT = "enriched.url.keywords.keyword.text"; + public const string ENRICHED_URL_KEYWORDS_KEYWORD_RELEVANCE = "enriched.url.keywords.keyword.relevance"; + public const string ENRICHED_URL_KEYWORDS_KEYWORD_SENTIMENT_TYPE = "enriched.url.keywords.keyword.sentiment.type"; + public const string ENRICHED_URL_KEYWORDS_KEYWORD_SENTIMENT_SCORE = "enriched.url.keywords.keyword.sentiment.score"; + public const string ENRICHED_URL_KEYWORDS_KEYWORD_SENTIMENT_MIXED = "enriched.url.keywords.keyword.sentiment.mixed"; + public const string ENRICHED_URL_KEYWORDS_KEYWORD_KNOWLEDGEGRAPH_TYPEHIERARCHY = "enriched.url.keywords.keyword.knowledgeGraph.typeHierarchy"; + public const string ENRICHED_URL_ENTITIES = "enriched.url.entities"; + public const string ENRICHED_URL_ENTITIES_ENTITY_TEXT = "enriched.url.entities.entity.text"; + public const string ENRICHED_URL_ENTITIES_ENTITY_TYPE = "enriched.url.entities.entity.type"; + public const string ENRICHED_URL_ENTITIES_ENTITY_KNOWLEDGEGRAPH_TYPEHIERARCHY = "enriched.url.entities.entity.knowledgeGraph.typeHierarchy"; + public const string ENRICHED_URL_ENTITIES_ENTITY_COUNT = "enriched.url.entities.entity.count"; + public const string ENRICHED_URL_ENTITIES_ENTITY_RELEVANCE = "enriched.url.entities.entity.relevance"; + public const string ENRICHED_URL_ENTITIES_ENTITY_SENTIMENT_TYPE = "enriched.url.entities.entity.sentiment.type"; + public const string ENRICHED_URL_ENTITIES_ENTITY_SENTIMENT_SCORE = "enriched.url.entities.entity.sentiment.score"; + public const string ENRICHED_URL_ENTITIES_ENTITY_SENTIMENT_MIXED = "enriched.url.entities.entity.sentiment.mixed"; + public const string ENRICHED_URL_ENTITIES_ENTITY_DISAMBIGUATED_NAME = "enriched.url.entities.entity.disambiguated.name"; + public const string ENRICHED_URL_ENTITIES_ENTITY_DISAMBIGUATED_GEO = "enriched.url.entities.entity.disambiguated.geo"; + public const string ENRICHED_URL_ENTITIES_ENTITY_DISAMBIGUATED_DBPEDIA = "enriched.url.entities.entity.disambiguated.dbpedia"; + public const string ENRICHED_URL_ENTITIES_ENTITY_DISAMBIGUATED_WEBSITE = "enriched.url.entities.entity.disambiguated.website"; + public const string ENRICHED_URL_ENTITIES_ENTITY_DISAMBIGUATED_SUBTYPE = "enriched.url.entities.entity.disambiguated.subType"; + public const string ENRICHED_URL_ENTITIES_ENTITY_DISAMBIGUATED_SUBTYPE_SUBTYPE_ = "enriched.url.entities.entity.disambiguated.subType.subType_"; + public const string ENRICHED_URL_ENTITIES_ENTITY_QUOTATIONS = "enriched.url.entities.entity.quotations"; + public const string ENRICHED_URL_ENTITIES_ENTITY_QUOTATIONS_QUOTATION__QUOTATION = "enriched.url.entities.entity.quotations.quotation_.quotation"; + public const string ENRICHED_URL_ENTITIES_ENTITY_QUOTATIONS_QUOTATION__SENTIMENT_TYPE = "enriched.url.entities.entity.quotations.quotation_.sentiment.type"; + public const string ENRICHED_URL_ENTITIES_ENTITY_QUOTATIONS_QUOTATION__SENTIMENT_SCORE = "enriched.url.entities.entity.quotations.quotation_.sentiment.score"; + public const string ENRICHED_URL_ENTITIES_ENTITY_QUOTATIONS_QUOTATION__SENTIMENT_MIXED = "enriched.url.entities.entity.quotations.quotation_.sentiment.mixed"; + public const string ENRICHED_URL_CONCEPTS = "enriched.url.concepts"; + public const string ENRICHED_URL_CONCEPTS_CONCEPT_TEXT = "enriched.url.concepts.concept.text"; + public const string ENRICHED_URL_CONCEPTS_CONCEPT_RELEVANCE = "enriched.url.concepts.concept.relevance"; + public const string ENRICHED_URL_CONCEPTS_CONCEPT_KNOWLEDGEGRAPH_TYPEHIERARCHY = "enriched.url.concepts.concept.knowledgeGraph.typeHierarchy"; + public const string ENRICHED_URL_RELATIONS = "enriched.url.relations"; + public const string ENRICHED_URL_RELATIONS_RELATION_SENTENCE = "enriched.url.relations.relation.sentence"; + public const string ENRICHED_URL_RELATIONS_RELATION_SUBJECT_TEXT = "enriched.url.relations.relation.subject.text"; + public const string ENRICHED_URL_RELATIONS_RELATION_SUBJECT_ENTITIES = "enriched.url.relations.relation.subject.entities"; + public const string ENRICHED_URL_RELATIONS_RELATION_SUBJECT_ENTITIES_ENTITY_TEXT = "enriched.url.relations.relation.subject.entities.entity.text"; + public const string ENRICHED_URL_RELATIONS_RELATION_SUBJECT_ENTITIES_ENTITY_TYPE = "enriched.url.relations.relation.subject.entities.entity.type"; + public const string ENRICHED_URL_RELATIONS_RELATION_SUBJECT_ENTITIES_ENTITY_KNOWLEDGEGRAPH_TYPEHIERARCHY = "enriched.url.relations.relation.subject.entities.entity.knowledgeGraph.typeHierarchy"; + public const string ENRICHED_URL_RELATIONS_RELATION_SUBJECT_ENTITIES_ENTITY_COUNT = "enriched.url.relations.relation.subject.entities.entity.count"; + public const string ENRICHED_URL_RELATIONS_RELATION_SUBJECT_ENTITIES_ENTITY_RELEVANCE = "enriched.url.relations.relation.subject.entities.entity.relevance"; + public const string ENRICHED_URL_RELATIONS_RELATION_SUBJECT_ENTITIES_ENTITY_SENTIMENT_TYPE = "enriched.url.relations.relation.subject.entities.entity.sentiment.type"; + public const string ENRICHED_URL_RELATIONS_RELATION_SUBJECT_ENTITIES_ENTITY_SENTIMENT_SCORE = "enriched.url.relations.relation.subject.entities.entity.sentiment.score"; + public const string ENRICHED_URL_RELATIONS_RELATION_SUBJECT_ENTITIES_ENTITY_SENTIMENT_MIXED = "enriched.url.relations.relation.subject.entities.entity.sentiment.mixed"; + public const string ENRICHED_URL_RELATIONS_RELATION_SUBJECT_ENTITIES_ENTITY_DISAMBIGUATED_NAME = "enriched.url.relations.relation.subject.entities.entity.disambiguated.name"; + public const string ENRICHED_URL_RELATIONS_RELATION_SUBJECT_ENTITIES_ENTITY_DISAMBIGUATED_GEO = "enriched.url.relations.relation.subject.entities.entity.disambiguated.geo"; + public const string ENRICHED_URL_RELATIONS_RELATION_SUBJECT_ENTITIES_ENTITY_DISAMBIGUATED_DBPEDIA = "enriched.url.relations.relation.subject.entities.entity.disambiguated.dbpedia"; + public const string ENRICHED_URL_RELATIONS_RELATION_SUBJECT_ENTITIES_ENTITY_DISAMBIGUATED_WEBSITE = "enriched.url.relations.relation.subject.entities.entity.disambiguated.website"; + public const string ENRICHED_URL_RELATIONS_RELATION_SUBJECT_ENTITIES_ENTITY_DISAMBIGUATED_SUBTYPE = "enriched.url.relations.relation.subject.entities.entity.disambiguated.subType"; + public const string ENRICHED_URL_RELATIONS_RELATION_SUBJECT_ENTITIES_ENTITY_DISAMBIGUATED_SUBTYPE_SUBTYPE_ = "enriched.url.relations.relation.subject.entities.entity.disambiguated.subType.subType_"; + public const string ENRICHED_URL_RELATIONS_RELATION_SUBJECT_ENTITIES_ENTITY_QUOTATIONS = "enriched.url.relations.relation.subject.entities.entity.quotations"; + public const string ENRICHED_URL_RELATIONS_RELATION_SUBJECT_ENTITIES_ENTITY_QUOTATIONS_QUOTATION__QUOTATION = "enriched.url.relations.relation.subject.entities.entity.quotations.quotation_.quotation"; + public const string ENRICHED_URL_RELATIONS_RELATION_SUBJECT_ENTITIES_ENTITY_QUOTATIONS_QUOTATION__SENTIMENT_TYPE = "enriched.url.relations.relation.subject.entities.entity.quotations.quotation_.sentiment.type"; + public const string ENRICHED_URL_RELATIONS_RELATION_SUBJECT_ENTITIES_ENTITY_QUOTATIONS_QUOTATION__SENTIMENT_SCORE = "enriched.url.relations.relation.subject.entities.entity.quotations.quotation_.sentiment.score"; + public const string ENRICHED_URL_RELATIONS_RELATION_SUBJECT_ENTITIES_ENTITY_QUOTATIONS_QUOTATION__SENTIMENT_MIXED = "enriched.url.relations.relation.subject.entities.entity.quotations.quotation_.sentiment.mixed"; + public const string ENRICHED_URL_RELATIONS_RELATION_SUBJECT_KEYWORDS = "enriched.url.relations.relation.subject.keywords"; + public const string ENRICHED_URL_RELATIONS_RELATION_SUBJECT_KEYWORDS_KEYWORD_TEXT = "enriched.url.relations.relation.subject.keywords.keyword.text"; + public const string ENRICHED_URL_RELATIONS_RELATION_SUBJECT_KEYWORDS_KEYWORD_RELEVANCE = "enriched.url.relations.relation.subject.keywords.keyword.relevance"; + public const string ENRICHED_URL_RELATIONS_RELATION_SUBJECT_KEYWORDS_KEYWORD_SENTIMENT_TYPE = "enriched.url.relations.relation.subject.keywords.keyword.sentiment.type"; + public const string ENRICHED_URL_RELATIONS_RELATION_SUBJECT_KEYWORDS_KEYWORD_SENTIMENT_SCORE = "enriched.url.relations.relation.subject.keywords.keyword.sentiment.score"; + public const string ENRICHED_URL_RELATIONS_RELATION_SUBJECT_KEYWORDS_KEYWORD_SENTIMENT_MIXED = "enriched.url.relations.relation.subject.keywords.keyword.sentiment.mixed"; + public const string ENRICHED_URL_RELATIONS_RELATION_SUBJECT_KEYWORDS_KEYWORD_KNOWLEDGEGRAPH_TYPEHIERARCHY = "enriched.url.relations.relation.subject.keywords.keyword.knowledgeGraph.typeHierarchy"; + public const string ENRICHED_URL_RELATIONS_RELATION_SUBJECT_SENTIMENT_TYPE = "enriched.url.relations.relation.subject.sentiment.type"; + public const string ENRICHED_URL_RELATIONS_RELATION_SUBJECT_SENTIMENT_SCORE = "enriched.url.relations.relation.subject.sentiment.score"; + public const string ENRICHED_URL_RELATIONS_RELATION_SUBJECT_SENTIMENT_MIXED = "enriched.url.relations.relation.subject.sentiment.mixed"; + public const string ENRICHED_URL_RELATIONS_RELATION_ACTION_TEXT = "enriched.url.relations.relation.action.text"; + public const string ENRICHED_URL_RELATIONS_RELATION_ACTION_LEMMATIZED = "enriched.url.relations.relation.action.lemmatized"; + public const string ENRICHED_URL_RELATIONS_RELATION_ACTION_VERB_TEXT = "enriched.url.relations.relation.action.verb.text"; + public const string ENRICHED_URL_RELATIONS_RELATION_ACTION_VERB_TENSE = "enriched.url.relations.relation.action.verb.tense"; + public const string ENRICHED_URL_RELATIONS_RELATION_ACTION_VERB_NEGATED = "enriched.url.relations.relation.action.verb.negated"; + public const string ENRICHED_URL_RELATIONS_RELATION_OBJECT_TEXT = "enriched.url.relations.relation.object.text"; + public const string ENRICHED_URL_RELATIONS_RELATION_OBJECT_ENTITIES = "enriched.url.relations.relation.object.entities"; + public const string ENRICHED_URL_RELATIONS_RELATION_OBJECT_ENTITIES_ENTITY_TEXT = "enriched.url.relations.relation.object.entities.entity.text"; + public const string ENRICHED_URL_RELATIONS_RELATION_OBJECT_ENTITIES_ENTITY_TYPE = "enriched.url.relations.relation.object.entities.entity.type"; + public const string ENRICHED_URL_RELATIONS_RELATION_OBJECT_ENTITIES_ENTITY_KNOWLEDGEGRAPH_TYPEHIERARCHY = "enriched.url.relations.relation.object.entities.entity.knowledgeGraph.typeHierarchy"; + public const string ENRICHED_URL_RELATIONS_RELATION_OBJECT_ENTITIES_ENTITY_COUNT = "enriched.url.relations.relation.object.entities.entity.count"; + public const string ENRICHED_URL_RELATIONS_RELATION_OBJECT_ENTITIES_ENTITY_RELEVANCE = "enriched.url.relations.relation.object.entities.entity.relevance"; + public const string ENRICHED_URL_RELATIONS_RELATION_OBJECT_ENTITIES_ENTITY_SENTIMENT_TYPE = "enriched.url.relations.relation.object.entities.entity.sentiment.type"; + public const string ENRICHED_URL_RELATIONS_RELATION_OBJECT_ENTITIES_ENTITY_SENTIMENT_SCORE = "enriched.url.relations.relation.object.entities.entity.sentiment.score"; + public const string ENRICHED_URL_RELATIONS_RELATION_OBJECT_ENTITIES_ENTITY_SENTIMENT_MIXED = "enriched.url.relations.relation.object.entities.entity.sentiment.mixed"; + public const string ENRICHED_URL_RELATIONS_RELATION_OBJECT_ENTITIES_ENTITY_DISAMBIGUATED_NAME = "enriched.url.relations.relation.object.entities.entity.disambiguated.name"; + public const string ENRICHED_URL_RELATIONS_RELATION_OBJECT_ENTITIES_ENTITY_DISAMBIGUATED_GEO = "enriched.url.relations.relation.object.entities.entity.disambiguated.geo"; + public const string ENRICHED_URL_RELATIONS_RELATION_OBJECT_ENTITIES_ENTITY_DISAMBIGUATED_DBPEDIA = "enriched.url.relations.relation.object.entities.entity.disambiguated.dbpedia"; + public const string ENRICHED_URL_RELATIONS_RELATION_OBJECT_ENTITIES_ENTITY_DISAMBIGUATED_WEBSITE = "enriched.url.relations.relation.object.entities.entity.disambiguated.website"; + public const string ENRICHED_URL_RELATIONS_RELATION_OBJECT_ENTITIES_ENTITY_DISAMBIGUATED_SUBTYPE = "enriched.url.relations.relation.object.entities.entity.disambiguated.subType"; + public const string ENRICHED_URL_RELATIONS_RELATION_OBJECT_ENTITIES_ENTITY_DISAMBIGUATED_SUBTYPE_SUBTYPE_ = "enriched.url.relations.relation.object.entities.entity.disambiguated.subType.subType_"; + public const string ENRICHED_URL_RELATIONS_RELATION_OBJECT_ENTITIES_ENTITY_QUOTATIONS = "enriched.url.relations.relation.object.entities.entity.quotations"; + public const string ENRICHED_URL_RELATIONS_RELATION_OBJECT_ENTITIES_ENTITY_QUOTATIONS_QUOTATION__QUOTATION = "enriched.url.relations.relation.object.entities.entity.quotations.quotation_.quotation"; + public const string ENRICHED_URL_RELATIONS_RELATION_OBJECT_ENTITIES_ENTITY_QUOTATIONS_QUOTATION__SENTIMENT_TYPE = "enriched.url.relations.relation.object.entities.entity.quotations.quotation_.sentiment.type"; + public const string ENRICHED_URL_RELATIONS_RELATION_OBJECT_ENTITIES_ENTITY_QUOTATIONS_QUOTATION__SENTIMENT_SCORE = "enriched.url.relations.relation.object.entities.entity.quotations.quotation_.sentiment.score"; + public const string ENRICHED_URL_RELATIONS_RELATION_OBJECT_ENTITIES_ENTITY_QUOTATIONS_QUOTATION__SENTIMENT_MIXED = "enriched.url.relations.relation.object.entities.entity.quotations.quotation_.sentiment.mixed"; + public const string ENRICHED_URL_RELATIONS_RELATION_OBJECT_KEYWORDS = "enriched.url.relations.relation.object.keywords"; + public const string ENRICHED_URL_RELATIONS_RELATION_OBJECT_KEYWORDS_KEYWORD_TEXT = "enriched.url.relations.relation.object.keywords.keyword.text"; + public const string ENRICHED_URL_RELATIONS_RELATION_OBJECT_KEYWORDS_KEYWORD_RELEVANCE = "enriched.url.relations.relation.object.keywords.keyword.relevance"; + public const string ENRICHED_URL_RELATIONS_RELATION_OBJECT_KEYWORDS_KEYWORD_SENTIMENT_TYPE = "enriched.url.relations.relation.object.keywords.keyword.sentiment.type"; + public const string ENRICHED_URL_RELATIONS_RELATION_OBJECT_KEYWORDS_KEYWORD_SENTIMENT_SCORE = "enriched.url.relations.relation.object.keywords.keyword.sentiment.score"; + public const string ENRICHED_URL_RELATIONS_RELATION_OBJECT_KEYWORDS_KEYWORD_SENTIMENT_MIXED = "enriched.url.relations.relation.object.keywords.keyword.sentiment.mixed"; + public const string ENRICHED_URL_RELATIONS_RELATION_OBJECT_KEYWORDS_KEYWORD_KNOWLEDGEGRAPH_TYPEHIERARCHY = "enriched.url.relations.relation.object.keywords.keyword.knowledgeGraph.typeHierarchy"; + public const string ENRICHED_URL_RELATIONS_RELATION_OBJECT_SENTIMENT_TYPE = "enriched.url.relations.relation.object.sentiment.type"; + public const string ENRICHED_URL_RELATIONS_RELATION_OBJECT_SENTIMENT_SCORE = "enriched.url.relations.relation.object.sentiment.score"; + public const string ENRICHED_URL_RELATIONS_RELATION_OBJECT_SENTIMENT_MIXED = "enriched.url.relations.relation.object.sentiment.mixed"; + public const string ENRICHED_URL_RELATIONS_RELATION_OBJECT_SENTIMENTFROMSUBJECT_TYPE = "enriched.url.relations.relation.object.sentimentFromSubject.type"; + public const string ENRICHED_URL_RELATIONS_RELATION_OBJECT_SENTIMENTFROMSUBJECT_SCORE = "enriched.url.relations.relation.object.sentimentFromSubject.score"; + public const string ENRICHED_URL_RELATIONS_RELATION_OBJECT_SENTIMENTFROMSUBJECT_MIXED = "enriched.url.relations.relation.object.sentimentFromSubject.mixed"; + public const string ENRICHED_URL_RELATIONS_RELATION_LOCATION_TEXT = "enriched.url.relations.relation.location.text"; + public const string ENRICHED_URL_RELATIONS_RELATION_LOCATION_SENTIMENT_TYPE = "enriched.url.relations.relation.location.sentiment.type"; + public const string ENRICHED_URL_RELATIONS_RELATION_LOCATION_SENTIMENT_SCORE = "enriched.url.relations.relation.location.sentiment.score"; + public const string ENRICHED_URL_RELATIONS_RELATION_LOCATION_SENTIMENT_MIXED = "enriched.url.relations.relation.location.sentiment.mixed"; + public const string ENRICHED_URL_RELATIONS_RELATION_LOCATION_ENTITIES = "enriched.url.relations.relation.location.entities"; + public const string ENRICHED_URL_RELATIONS_RELATION_LOCATION_ENTITIES_ENTITY_TEXT = "enriched.url.relations.relation.location.entities.entity.text"; + public const string ENRICHED_URL_RELATIONS_RELATION_LOCATION_ENTITIES_ENTITY_TYPE = "enriched.url.relations.relation.location.entities.entity.type"; + public const string ENRICHED_URL_RELATIONS_RELATION_LOCATION_ENTITIES_ENTITY_KNOWLEDGEGRAPH_TYPEHIERARCHY = "enriched.url.relations.relation.location.entities.entity.knowledgeGraph.typeHierarchy"; + public const string ENRICHED_URL_RELATIONS_RELATION_LOCATION_ENTITIES_ENTITY_COUNT = "enriched.url.relations.relation.location.entities.entity.count"; + public const string ENRICHED_URL_RELATIONS_RELATION_LOCATION_ENTITIES_ENTITY_RELEVANCE = "enriched.url.relations.relation.location.entities.entity.relevance"; + public const string ENRICHED_URL_RELATIONS_RELATION_LOCATION_ENTITIES_ENTITY_SENTIMENT_TYPE = "enriched.url.relations.relation.location.entities.entity.sentiment.type"; + public const string ENRICHED_URL_RELATIONS_RELATION_LOCATION_ENTITIES_ENTITY_SENTIMENT_SCORE = "enriched.url.relations.relation.location.entities.entity.sentiment.score"; + public const string ENRICHED_URL_RELATIONS_RELATION_LOCATION_ENTITIES_ENTITY_SENTIMENT_MIXED = "enriched.url.relations.relation.location.entities.entity.sentiment.mixed"; + public const string ENRICHED_URL_RELATIONS_RELATION_LOCATION_ENTITIES_ENTITY_DISAMBIGUATED_NAME = "enriched.url.relations.relation.location.entities.entity.disambiguated.name"; + public const string ENRICHED_URL_RELATIONS_RELATION_LOCATION_ENTITIES_ENTITY_DISAMBIGUATED_GEO = "enriched.url.relations.relation.location.entities.entity.disambiguated.geo"; + public const string ENRICHED_URL_RELATIONS_RELATION_LOCATION_ENTITIES_ENTITY_DISAMBIGUATED_DBPEDIA = "enriched.url.relations.relation.location.entities.entity.disambiguated.dbpedia"; + public const string ENRICHED_URL_RELATIONS_RELATION_LOCATION_ENTITIES_ENTITY_DISAMBIGUATED_WEBSITE = "enriched.url.relations.relation.location.entities.entity.disambiguated.website"; + public const string ENRICHED_URL_RELATIONS_RELATION_LOCATION_ENTITIES_ENTITY_DISAMBIGUATED_SUBTYPE = "enriched.url.relations.relation.location.entities.entity.disambiguated.subType"; + public const string ENRICHED_URL_RELATIONS_RELATION_LOCATION_ENTITIES_ENTITY_DISAMBIGUATED_SUBTYPE_SUBTYPE_ = "enriched.url.relations.relation.location.entities.entity.disambiguated.subType.subType_"; + public const string ENRICHED_URL_RELATIONS_RELATION_LOCATION_ENTITIES_ENTITY_QUOTATIONS = "enriched.url.relations.relation.location.entities.entity.quotations"; + public const string ENRICHED_URL_RELATIONS_RELATION_LOCATION_ENTITIES_ENTITY_QUOTATIONS_QUOTATION__QUOTATION = "enriched.url.relations.relation.location.entities.entity.quotations.quotation_.quotation"; + public const string ENRICHED_URL_RELATIONS_RELATION_LOCATION_ENTITIES_ENTITY_QUOTATIONS_QUOTATION__SENTIMENT_TYPE = "enriched.url.relations.relation.location.entities.entity.quotations.quotation_.sentiment.type"; + public const string ENRICHED_URL_RELATIONS_RELATION_LOCATION_ENTITIES_ENTITY_QUOTATIONS_QUOTATION__SENTIMENT_SCORE = "enriched.url.relations.relation.location.entities.entity.quotations.quotation_.sentiment.score"; + public const string ENRICHED_URL_RELATIONS_RELATION_LOCATION_ENTITIES_ENTITY_QUOTATIONS_QUOTATION__SENTIMENT_MIXED = "enriched.url.relations.relation.location.entities.entity.quotations.quotation_.sentiment.mixed"; + public const string ENRICHED_URL_RELATIONS_RELATION_LOCATION_KEYWORDS = "enriched.url.relations.relation.location.keywords"; + public const string ENRICHED_URL_RELATIONS_RELATION_LOCATION_KEYWORDS_KEYWORD_TEXT = "enriched.url.relations.relation.location.keywords.keyword.text"; + public const string ENRICHED_URL_RELATIONS_RELATION_LOCATION_KEYWORDS_KEYWORD_RELEVANCE = "enriched.url.relations.relation.location.keywords.keyword.relevance"; + public const string ENRICHED_URL_RELATIONS_RELATION_LOCATION_KEYWORDS_KEYWORD_SENTIMENT_TYPE = "enriched.url.relations.relation.location.keywords.keyword.sentiment.type"; + public const string ENRICHED_URL_RELATIONS_RELATION_LOCATION_KEYWORDS_KEYWORD_SENTIMENT_SCORE = "enriched.url.relations.relation.location.keywords.keyword.sentiment.score"; + public const string ENRICHED_URL_RELATIONS_RELATION_LOCATION_KEYWORDS_KEYWORD_SENTIMENT_MIXED = "enriched.url.relations.relation.location.keywords.keyword.sentiment.mixed"; + public const string ENRICHED_URL_RELATIONS_RELATION_LOCATION_KEYWORDS_KEYWORD_KNOWLEDGEGRAPH_TYPEHIERARCHY = "enriched.url.relations.relation.location.keywords.keyword.knowledgeGraph.typeHierarchy"; + public const string ENRICHED_URL_RELATIONS_RELATION_TEMPORAL_TEXT = "enriched.url.relations.relation.temporal.text"; + public const string ENRICHED_URL_RELATIONS_RELATION_TEMPORAL_DECODED_TYPE = "enriched.url.relations.relation.temporal.decoded.type"; + public const string ENRICHED_URL_RELATIONS_RELATION_TEMPORAL_DECODED_VALUE = "enriched.url.relations.relation.temporal.decoded.value"; + public const string ENRICHED_URL_RELATIONS_RELATION_TEMPORAL_DECODED_START = "enriched.url.relations.relation.temporal.decoded.start"; + public const string ENRICHED_URL_RELATIONS_RELATION_TEMPORAL_DECODED_END = "enriched.url.relations.relation.temporal.decoded.end"; + public const string ENRICHED_URL_DOCSENTIMENT_TYPE = "enriched.url.docSentiment.type"; + public const string ENRICHED_URL_DOCSENTIMENT_SCORE = "enriched.url.docSentiment.score"; + public const string ENRICHED_URL_DOCSENTIMENT_MIXED = "enriched.url.docSentiment.mixed"; + public const string ENRICHED_URL_TAXONOMY = "enriched.url.taxonomy"; + public const string ENRICHED_URL_TAXONOMY_TAXONOMY__LABEL = "enriched.url.taxonomy.taxonomy_.label"; + public const string ENRICHED_URL_TAXONOMY_TAXONOMY__SCORE = "enriched.url.taxonomy.taxonomy_.score"; + public const string ENRICHED_URL_TAXONOMY_TAXONOMY__CONFIDENT = "enriched.url.taxonomy.taxonomy_.confident"; + public const string ENRICHED_URL_ENRICHEDTITLE_KEYWORDS = "enriched.url.enrichedTitle.keywords"; + public const string ENRICHED_URL_ENRICHEDTITLE_KEYWORDS_KEYWORD_TEXT = "enriched.url.enrichedTitle.keywords.keyword.text"; + public const string ENRICHED_URL_ENRICHEDTITLE_KEYWORDS_KEYWORD_RELEVANCE = "enriched.url.enrichedTitle.keywords.keyword.relevance"; + public const string ENRICHED_URL_ENRICHEDTITLE_KEYWORDS_KEYWORD_SENTIMENT_TYPE = "enriched.url.enrichedTitle.keywords.keyword.sentiment.type"; + public const string ENRICHED_URL_ENRICHEDTITLE_KEYWORDS_KEYWORD_SENTIMENT_SCORE = "enriched.url.enrichedTitle.keywords.keyword.sentiment.score"; + public const string ENRICHED_URL_ENRICHEDTITLE_KEYWORDS_KEYWORD_SENTIMENT_MIXED = "enriched.url.enrichedTitle.keywords.keyword.sentiment.mixed"; + public const string ENRICHED_URL_ENRICHEDTITLE_KEYWORDS_KEYWORD_KNOWLEDGEGRAPH_TYPEHIERARCHY = "enriched.url.enrichedTitle.keywords.keyword.knowledgeGraph.typeHierarchy"; + public const string ENRICHED_URL_ENRICHEDTITLE_ENTITIES = "enriched.url.enrichedTitle.entities"; + public const string ENRICHED_URL_ENRICHEDTITLE_ENTITIES_ENTITY_TEXT = "enriched.url.enrichedTitle.entities.entity.text"; + public const string ENRICHED_URL_ENRICHEDTITLE_ENTITIES_ENTITY_TYPE = "enriched.url.enrichedTitle.entities.entity.type"; + public const string ENRICHED_URL_ENRICHEDTITLE_ENTITIES_ENTITY_KNOWLEDGEGRAPH_TYPEHIERARCHY = "enriched.url.enrichedTitle.entities.entity.knowledgeGraph.typeHierarchy"; + public const string ENRICHED_URL_ENRICHEDTITLE_ENTITIES_ENTITY_COUNT = "enriched.url.enrichedTitle.entities.entity.count"; + public const string ENRICHED_URL_ENRICHEDTITLE_ENTITIES_ENTITY_RELEVANCE = "enriched.url.enrichedTitle.entities.entity.relevance"; + public const string ENRICHED_URL_ENRICHEDTITLE_ENTITIES_ENTITY_SENTIMENT_TYPE = "enriched.url.enrichedTitle.entities.entity.sentiment.type"; + public const string ENRICHED_URL_ENRICHEDTITLE_ENTITIES_ENTITY_SENTIMENT_SCORE = "enriched.url.enrichedTitle.entities.entity.sentiment.score"; + public const string ENRICHED_URL_ENRICHEDTITLE_ENTITIES_ENTITY_SENTIMENT_MIXED = "enriched.url.enrichedTitle.entities.entity.sentiment.mixed"; + public const string ENRICHED_URL_ENRICHEDTITLE_ENTITIES_ENTITY_DISAMBIGUATED_NAME = "enriched.url.enrichedTitle.entities.entity.disambiguated.name"; + public const string ENRICHED_URL_ENRICHEDTITLE_ENTITIES_ENTITY_DISAMBIGUATED_GEO = "enriched.url.enrichedTitle.entities.entity.disambiguated.geo"; + public const string ENRICHED_URL_ENRICHEDTITLE_ENTITIES_ENTITY_DISAMBIGUATED_DBPEDIA = "enriched.url.enrichedTitle.entities.entity.disambiguated.dbpedia"; + public const string ENRICHED_URL_ENRICHEDTITLE_ENTITIES_ENTITY_DISAMBIGUATED_WEBSITE = "enriched.url.enrichedTitle.entities.entity.disambiguated.website"; + public const string ENRICHED_URL_ENRICHEDTITLE_ENTITIES_ENTITY_DISAMBIGUATED_SUBTYPE = "enriched.url.enrichedTitle.entities.entity.disambiguated.subType"; + public const string ENRICHED_URL_ENRICHEDTITLE_ENTITIES_ENTITY_DISAMBIGUATED_SUBTYPE_SUBTYPE_ = "enriched.url.enrichedTitle.entities.entity.disambiguated.subType.subType_"; + public const string ENRICHED_URL_ENRICHEDTITLE_ENTITIES_ENTITY_QUOTATIONS = "enriched.url.enrichedTitle.entities.entity.quotations"; + public const string ENRICHED_URL_ENRICHEDTITLE_ENTITIES_ENTITY_QUOTATIONS_QUOTATION__QUOTATION = "enriched.url.enrichedTitle.entities.entity.quotations.quotation_.quotation"; + public const string ENRICHED_URL_ENRICHEDTITLE_ENTITIES_ENTITY_QUOTATIONS_QUOTATION__SENTIMENT_TYPE = "enriched.url.enrichedTitle.entities.entity.quotations.quotation_.sentiment.type"; + public const string ENRICHED_URL_ENRICHEDTITLE_ENTITIES_ENTITY_QUOTATIONS_QUOTATION__SENTIMENT_SCORE = "enriched.url.enrichedTitle.entities.entity.quotations.quotation_.sentiment.score"; + public const string ENRICHED_URL_ENRICHEDTITLE_ENTITIES_ENTITY_QUOTATIONS_QUOTATION__SENTIMENT_MIXED = "enriched.url.enrichedTitle.entities.entity.quotations.quotation_.sentiment.mixed"; + public const string ENRICHED_URL_ENRICHEDTITLE_CONCEPTS = "enriched.url.enrichedTitle.concepts"; + public const string ENRICHED_URL_ENRICHEDTITLE_CONCEPTS_CONCEPT_TEXT = "enriched.url.enrichedTitle.concepts.concept.text"; + public const string ENRICHED_URL_ENRICHEDTITLE_CONCEPTS_CONCEPT_RELEVANCE = "enriched.url.enrichedTitle.concepts.concept.relevance"; + public const string ENRICHED_URL_ENRICHEDTITLE_CONCEPTS_CONCEPT_KNOWLEDGEGRAPH_TYPEHIERARCHY = "enriched.url.enrichedTitle.concepts.concept.knowledgeGraph.typeHierarchy"; + public const string ENRICHED_URL_ENRICHEDTITLE_RELATIONS = "enriched.url.enrichedTitle.relations"; + public const string ENRICHED_URL_ENRICHEDTITLE_RELATIONS_RELATION_SENTENCE = "enriched.url.enrichedTitle.relations.relation.sentence"; + public const string ENRICHED_URL_ENRICHEDTITLE_RELATIONS_RELATION_SUBJECT_TEXT = "enriched.url.enrichedTitle.relations.relation.subject.text"; + public const string ENRICHED_URL_ENRICHEDTITLE_RELATIONS_RELATION_SUBJECT_ENTITIES = "enriched.url.enrichedTitle.relations.relation.subject.entities"; + public const string ENRICHED_URL_ENRICHEDTITLE_RELATIONS_RELATION_SUBJECT_ENTITIES_ENTITY_TEXT = "enriched.url.enrichedTitle.relations.relation.subject.entities.entity.text"; + public const string ENRICHED_URL_ENRICHEDTITLE_RELATIONS_RELATION_SUBJECT_ENTITIES_ENTITY_TYPE = "enriched.url.enrichedTitle.relations.relation.subject.entities.entity.type"; + public const string ENRICHED_URL_ENRICHEDTITLE_RELATIONS_RELATION_SUBJECT_ENTITIES_ENTITY_KNOWLEDGEGRAPH_TYPEHIERARCHY = "enriched.url.enrichedTitle.relations.relation.subject.entities.entity.knowledgeGraph.typeHierarchy"; + public const string ENRICHED_URL_ENRICHEDTITLE_RELATIONS_RELATION_SUBJECT_ENTITIES_ENTITY_COUNT = "enriched.url.enrichedTitle.relations.relation.subject.entities.entity.count"; + public const string ENRICHED_URL_ENRICHEDTITLE_RELATIONS_RELATION_SUBJECT_ENTITIES_ENTITY_RELEVANCE = "enriched.url.enrichedTitle.relations.relation.subject.entities.entity.relevance"; + public const string ENRICHED_URL_ENRICHEDTITLE_RELATIONS_RELATION_SUBJECT_ENTITIES_ENTITY_SENTIMENT_TYPE = "enriched.url.enrichedTitle.relations.relation.subject.entities.entity.sentiment.type"; + public const string ENRICHED_URL_ENRICHEDTITLE_RELATIONS_RELATION_SUBJECT_ENTITIES_ENTITY_SENTIMENT_SCORE = "enriched.url.enrichedTitle.relations.relation.subject.entities.entity.sentiment.score"; + public const string ENRICHED_URL_ENRICHEDTITLE_RELATIONS_RELATION_SUBJECT_ENTITIES_ENTITY_SENTIMENT_MIXED = "enriched.url.enrichedTitle.relations.relation.subject.entities.entity.sentiment.mixed"; + public const string ENRICHED_URL_ENRICHEDTITLE_RELATIONS_RELATION_SUBJECT_ENTITIES_ENTITY_DISAMBIGUATED_NAME = "enriched.url.enrichedTitle.relations.relation.subject.entities.entity.disambiguated.name"; + public const string ENRICHED_URL_ENRICHEDTITLE_RELATIONS_RELATION_SUBJECT_ENTITIES_ENTITY_DISAMBIGUATED_GEO = "enriched.url.enrichedTitle.relations.relation.subject.entities.entity.disambiguated.geo"; + public const string ENRICHED_URL_ENRICHEDTITLE_RELATIONS_RELATION_SUBJECT_ENTITIES_ENTITY_DISAMBIGUATED_DBPEDIA = "enriched.url.enrichedTitle.relations.relation.subject.entities.entity.disambiguated.dbpedia"; + public const string ENRICHED_URL_ENRICHEDTITLE_RELATIONS_RELATION_SUBJECT_ENTITIES_ENTITY_DISAMBIGUATED_WEBSITE = "enriched.url.enrichedTitle.relations.relation.subject.entities.entity.disambiguated.website"; + public const string ENRICHED_URL_ENRICHEDTITLE_RELATIONS_RELATION_SUBJECT_ENTITIES_ENTITY_DISAMBIGUATED_SUBTYPE = "enriched.url.enrichedTitle.relations.relation.subject.entities.entity.disambiguated.subType"; + public const string ENRICHED_URL_ENRICHEDTITLE_RELATIONS_RELATION_SUBJECT_ENTITIES_ENTITY_DISAMBIGUATED_SUBTYPE_SUBTYPE_ = "enriched.url.enrichedTitle.relations.relation.subject.entities.entity.disambiguated.subType.subType_"; + public const string ENRICHED_URL_ENRICHEDTITLE_RELATIONS_RELATION_SUBJECT_ENTITIES_ENTITY_QUOTATIONS = "enriched.url.enrichedTitle.relations.relation.subject.entities.entity.quotations"; + public const string ENRICHED_URL_ENRICHEDTITLE_RELATIONS_RELATION_SUBJECT_ENTITIES_ENTITY_QUOTATIONS_QUOTATION__QUOTATION = "enriched.url.enrichedTitle.relations.relation.subject.entities.entity.quotations.quotation_.quotation"; + public const string ENRICHED_URL_ENRICHEDTITLE_RELATIONS_RELATION_SUBJECT_ENTITIES_ENTITY_QUOTATIONS_QUOTATION__SENTIMENT_TYPE = "enriched.url.enrichedTitle.relations.relation.subject.entities.entity.quotations.quotation_.sentiment.type"; + public const string ENRICHED_URL_ENRICHEDTITLE_RELATIONS_RELATION_SUBJECT_ENTITIES_ENTITY_QUOTATIONS_QUOTATION__SENTIMENT_SCORE = "enriched.url.enrichedTitle.relations.relation.subject.entities.entity.quotations.quotation_.sentiment.score"; + public const string ENRICHED_URL_ENRICHEDTITLE_RELATIONS_RELATION_SUBJECT_ENTITIES_ENTITY_QUOTATIONS_QUOTATION__SENTIMENT_MIXED = "enriched.url.enrichedTitle.relations.relation.subject.entities.entity.quotations.quotation_.sentiment.mixed"; + public const string ENRICHED_URL_ENRICHEDTITLE_RELATIONS_RELATION_SUBJECT_KEYWORDS = "enriched.url.enrichedTitle.relations.relation.subject.keywords"; + public const string ENRICHED_URL_ENRICHEDTITLE_RELATIONS_RELATION_SUBJECT_KEYWORDS_KEYWORD_TEXT = "enriched.url.enrichedTitle.relations.relation.subject.keywords.keyword.text"; + public const string ENRICHED_URL_ENRICHEDTITLE_RELATIONS_RELATION_SUBJECT_KEYWORDS_KEYWORD_RELEVANCE = "enriched.url.enrichedTitle.relations.relation.subject.keywords.keyword.relevance"; + public const string ENRICHED_URL_ENRICHEDTITLE_RELATIONS_RELATION_SUBJECT_KEYWORDS_KEYWORD_SENTIMENT_TYPE = "enriched.url.enrichedTitle.relations.relation.subject.keywords.keyword.sentiment.type"; + public const string ENRICHED_URL_ENRICHEDTITLE_RELATIONS_RELATION_SUBJECT_KEYWORDS_KEYWORD_SENTIMENT_SCORE = "enriched.url.enrichedTitle.relations.relation.subject.keywords.keyword.sentiment.score"; + public const string ENRICHED_URL_ENRICHEDTITLE_RELATIONS_RELATION_SUBJECT_KEYWORDS_KEYWORD_SENTIMENT_MIXED = "enriched.url.enrichedTitle.relations.relation.subject.keywords.keyword.sentiment.mixed"; + public const string ENRICHED_URL_ENRICHEDTITLE_RELATIONS_RELATION_SUBJECT_KEYWORDS_KEYWORD_KNOWLEDGEGRAPH_TYPEHIERARCHY = "enriched.url.enrichedTitle.relations.relation.subject.keywords.keyword.knowledgeGraph.typeHierarchy"; + public const string ENRICHED_URL_ENRICHEDTITLE_RELATIONS_RELATION_SUBJECT_SENTIMENT_TYPE = "enriched.url.enrichedTitle.relations.relation.subject.sentiment.type"; + public const string ENRICHED_URL_ENRICHEDTITLE_RELATIONS_RELATION_SUBJECT_SENTIMENT_SCORE = "enriched.url.enrichedTitle.relations.relation.subject.sentiment.score"; + public const string ENRICHED_URL_ENRICHEDTITLE_RELATIONS_RELATION_SUBJECT_SENTIMENT_MIXED = "enriched.url.enrichedTitle.relations.relation.subject.sentiment.mixed"; + public const string ENRICHED_URL_ENRICHEDTITLE_RELATIONS_RELATION_ACTION_TEXT = "enriched.url.enrichedTitle.relations.relation.action.text"; + public const string ENRICHED_URL_ENRICHEDTITLE_RELATIONS_RELATION_ACTION_LEMMATIZED = "enriched.url.enrichedTitle.relations.relation.action.lemmatized"; + public const string ENRICHED_URL_ENRICHEDTITLE_RELATIONS_RELATION_ACTION_VERB_TEXT = "enriched.url.enrichedTitle.relations.relation.action.verb.text"; + public const string ENRICHED_URL_ENRICHEDTITLE_RELATIONS_RELATION_ACTION_VERB_TENSE = "enriched.url.enrichedTitle.relations.relation.action.verb.tense"; + public const string ENRICHED_URL_ENRICHEDTITLE_RELATIONS_RELATION_ACTION_VERB_NEGATED = "enriched.url.enrichedTitle.relations.relation.action.verb.negated"; + public const string ENRICHED_URL_ENRICHEDTITLE_RELATIONS_RELATION_OBJECT_TEXT = "enriched.url.enrichedTitle.relations.relation.object.text"; + public const string ENRICHED_URL_ENRICHEDTITLE_RELATIONS_RELATION_OBJECT_ENTITIES = "enriched.url.enrichedTitle.relations.relation.object.entities"; + public const string ENRICHED_URL_ENRICHEDTITLE_RELATIONS_RELATION_OBJECT_ENTITIES_ENTITY_TEXT = "enriched.url.enrichedTitle.relations.relation.object.entities.entity.text"; + public const string ENRICHED_URL_ENRICHEDTITLE_RELATIONS_RELATION_OBJECT_ENTITIES_ENTITY_TYPE = "enriched.url.enrichedTitle.relations.relation.object.entities.entity.type"; + public const string ENRICHED_URL_ENRICHEDTITLE_RELATIONS_RELATION_OBJECT_ENTITIES_ENTITY_KNOWLEDGEGRAPH_TYPEHIERARCHY = "enriched.url.enrichedTitle.relations.relation.object.entities.entity.knowledgeGraph.typeHierarchy"; + public const string ENRICHED_URL_ENRICHEDTITLE_RELATIONS_RELATION_OBJECT_ENTITIES_ENTITY_COUNT = "enriched.url.enrichedTitle.relations.relation.object.entities.entity.count"; + public const string ENRICHED_URL_ENRICHEDTITLE_RELATIONS_RELATION_OBJECT_ENTITIES_ENTITY_RELEVANCE = "enriched.url.enrichedTitle.relations.relation.object.entities.entity.relevance"; + public const string ENRICHED_URL_ENRICHEDTITLE_RELATIONS_RELATION_OBJECT_ENTITIES_ENTITY_SENTIMENT_TYPE = "enriched.url.enrichedTitle.relations.relation.object.entities.entity.sentiment.type"; + public const string ENRICHED_URL_ENRICHEDTITLE_RELATIONS_RELATION_OBJECT_ENTITIES_ENTITY_SENTIMENT_SCORE = "enriched.url.enrichedTitle.relations.relation.object.entities.entity.sentiment.score"; + public const string ENRICHED_URL_ENRICHEDTITLE_RELATIONS_RELATION_OBJECT_ENTITIES_ENTITY_SENTIMENT_MIXED = "enriched.url.enrichedTitle.relations.relation.object.entities.entity.sentiment.mixed"; + public const string ENRICHED_URL_ENRICHEDTITLE_RELATIONS_RELATION_OBJECT_ENTITIES_ENTITY_DISAMBIGUATED_NAME = "enriched.url.enrichedTitle.relations.relation.object.entities.entity.disambiguated.name"; + public const string ENRICHED_URL_ENRICHEDTITLE_RELATIONS_RELATION_OBJECT_ENTITIES_ENTITY_DISAMBIGUATED_GEO = "enriched.url.enrichedTitle.relations.relation.object.entities.entity.disambiguated.geo"; + public const string ENRICHED_URL_ENRICHEDTITLE_RELATIONS_RELATION_OBJECT_ENTITIES_ENTITY_DISAMBIGUATED_DBPEDIA = "enriched.url.enrichedTitle.relations.relation.object.entities.entity.disambiguated.dbpedia"; + public const string ENRICHED_URL_ENRICHEDTITLE_RELATIONS_RELATION_OBJECT_ENTITIES_ENTITY_DISAMBIGUATED_WEBSITE = "enriched.url.enrichedTitle.relations.relation.object.entities.entity.disambiguated.website"; + public const string ENRICHED_URL_ENRICHEDTITLE_RELATIONS_RELATION_OBJECT_ENTITIES_ENTITY_DISAMBIGUATED_SUBTYPE = "enriched.url.enrichedTitle.relations.relation.object.entities.entity.disambiguated.subType"; + public const string ENRICHED_URL_ENRICHEDTITLE_RELATIONS_RELATION_OBJECT_ENTITIES_ENTITY_DISAMBIGUATED_SUBTYPE_SUBTYPE_ = "enriched.url.enrichedTitle.relations.relation.object.entities.entity.disambiguated.subType.subType_"; + public const string ENRICHED_URL_ENRICHEDTITLE_RELATIONS_RELATION_OBJECT_ENTITIES_ENTITY_QUOTATIONS = "enriched.url.enrichedTitle.relations.relation.object.entities.entity.quotations"; + public const string ENRICHED_URL_ENRICHEDTITLE_RELATIONS_RELATION_OBJECT_ENTITIES_ENTITY_QUOTATIONS_QUOTATION__QUOTATION = "enriched.url.enrichedTitle.relations.relation.object.entities.entity.quotations.quotation_.quotation"; + public const string ENRICHED_URL_ENRICHEDTITLE_RELATIONS_RELATION_OBJECT_ENTITIES_ENTITY_QUOTATIONS_QUOTATION__SENTIMENT_TYPE = "enriched.url.enrichedTitle.relations.relation.object.entities.entity.quotations.quotation_.sentiment.type"; + public const string ENRICHED_URL_ENRICHEDTITLE_RELATIONS_RELATION_OBJECT_ENTITIES_ENTITY_QUOTATIONS_QUOTATION__SENTIMENT_SCORE = "enriched.url.enrichedTitle.relations.relation.object.entities.entity.quotations.quotation_.sentiment.score"; + public const string ENRICHED_URL_ENRICHEDTITLE_RELATIONS_RELATION_OBJECT_ENTITIES_ENTITY_QUOTATIONS_QUOTATION__SENTIMENT_MIXED = "enriched.url.enrichedTitle.relations.relation.object.entities.entity.quotations.quotation_.sentiment.mixed"; + public const string ENRICHED_URL_ENRICHEDTITLE_RELATIONS_RELATION_OBJECT_KEYWORDS = "enriched.url.enrichedTitle.relations.relation.object.keywords"; + public const string ENRICHED_URL_ENRICHEDTITLE_RELATIONS_RELATION_OBJECT_KEYWORDS_KEYWORD_TEXT = "enriched.url.enrichedTitle.relations.relation.object.keywords.keyword.text"; + public const string ENRICHED_URL_ENRICHEDTITLE_RELATIONS_RELATION_OBJECT_KEYWORDS_KEYWORD_RELEVANCE = "enriched.url.enrichedTitle.relations.relation.object.keywords.keyword.relevance"; + public const string ENRICHED_URL_ENRICHEDTITLE_RELATIONS_RELATION_OBJECT_KEYWORDS_KEYWORD_SENTIMENT_TYPE = "enriched.url.enrichedTitle.relations.relation.object.keywords.keyword.sentiment.type"; + public const string ENRICHED_URL_ENRICHEDTITLE_RELATIONS_RELATION_OBJECT_KEYWORDS_KEYWORD_SENTIMENT_SCORE = "enriched.url.enrichedTitle.relations.relation.object.keywords.keyword.sentiment.score"; + public const string ENRICHED_URL_ENRICHEDTITLE_RELATIONS_RELATION_OBJECT_KEYWORDS_KEYWORD_SENTIMENT_MIXED = "enriched.url.enrichedTitle.relations.relation.object.keywords.keyword.sentiment.mixed"; + public const string ENRICHED_URL_ENRICHEDTITLE_RELATIONS_RELATION_OBJECT_KEYWORDS_KEYWORD_KNOWLEDGEGRAPH_TYPEHIERARCHY = "enriched.url.enrichedTitle.relations.relation.object.keywords.keyword.knowledgeGraph.typeHierarchy"; + public const string ENRICHED_URL_ENRICHEDTITLE_RELATIONS_RELATION_OBJECT_SENTIMENT_TYPE = "enriched.url.enrichedTitle.relations.relation.object.sentiment.type"; + public const string ENRICHED_URL_ENRICHEDTITLE_RELATIONS_RELATION_OBJECT_SENTIMENT_SCORE = "enriched.url.enrichedTitle.relations.relation.object.sentiment.score"; + public const string ENRICHED_URL_ENRICHEDTITLE_RELATIONS_RELATION_OBJECT_SENTIMENT_MIXED = "enriched.url.enrichedTitle.relations.relation.object.sentiment.mixed"; + public const string ENRICHED_URL_ENRICHEDTITLE_RELATIONS_RELATION_OBJECT_SENTIMENTFROMSUBJECT_TYPE = "enriched.url.enrichedTitle.relations.relation.object.sentimentFromSubject.type"; + public const string ENRICHED_URL_ENRICHEDTITLE_RELATIONS_RELATION_OBJECT_SENTIMENTFROMSUBJECT_SCORE = "enriched.url.enrichedTitle.relations.relation.object.sentimentFromSubject.score"; + public const string ENRICHED_URL_ENRICHEDTITLE_RELATIONS_RELATION_OBJECT_SENTIMENTFROMSUBJECT_MIXED = "enriched.url.enrichedTitle.relations.relation.object.sentimentFromSubject.mixed"; + public const string ENRICHED_URL_ENRICHEDTITLE_RELATIONS_RELATION_LOCATION_TEXT = "enriched.url.enrichedTitle.relations.relation.location.text"; + public const string ENRICHED_URL_ENRICHEDTITLE_RELATIONS_RELATION_LOCATION_SENTIMENT_TYPE = "enriched.url.enrichedTitle.relations.relation.location.sentiment.type"; + public const string ENRICHED_URL_ENRICHEDTITLE_RELATIONS_RELATION_LOCATION_SENTIMENT_SCORE = "enriched.url.enrichedTitle.relations.relation.location.sentiment.score"; + public const string ENRICHED_URL_ENRICHEDTITLE_RELATIONS_RELATION_LOCATION_SENTIMENT_MIXED = "enriched.url.enrichedTitle.relations.relation.location.sentiment.mixed"; + public const string ENRICHED_URL_ENRICHEDTITLE_RELATIONS_RELATION_LOCATION_ENTITIES = "enriched.url.enrichedTitle.relations.relation.location.entities"; + public const string ENRICHED_URL_ENRICHEDTITLE_RELATIONS_RELATION_LOCATION_ENTITIES_ENTITY_TEXT = "enriched.url.enrichedTitle.relations.relation.location.entities.entity.text"; + public const string ENRICHED_URL_ENRICHEDTITLE_RELATIONS_RELATION_LOCATION_ENTITIES_ENTITY_TYPE = "enriched.url.enrichedTitle.relations.relation.location.entities.entity.type"; + public const string ENRICHED_URL_ENRICHEDTITLE_RELATIONS_RELATION_LOCATION_ENTITIES_ENTITY_KNOWLEDGEGRAPH_TYPEHIERARCHY = "enriched.url.enrichedTitle.relations.relation.location.entities.entity.knowledgeGraph.typeHierarchy"; + public const string ENRICHED_URL_ENRICHEDTITLE_RELATIONS_RELATION_LOCATION_ENTITIES_ENTITY_COUNT = "enriched.url.enrichedTitle.relations.relation.location.entities.entity.count"; + public const string ENRICHED_URL_ENRICHEDTITLE_RELATIONS_RELATION_LOCATION_ENTITIES_ENTITY_RELEVANCE = "enriched.url.enrichedTitle.relations.relation.location.entities.entity.relevance"; + public const string ENRICHED_URL_ENRICHEDTITLE_RELATIONS_RELATION_LOCATION_ENTITIES_ENTITY_SENTIMENT_TYPE = "enriched.url.enrichedTitle.relations.relation.location.entities.entity.sentiment.type"; + public const string ENRICHED_URL_ENRICHEDTITLE_RELATIONS_RELATION_LOCATION_ENTITIES_ENTITY_SENTIMENT_SCORE = "enriched.url.enrichedTitle.relations.relation.location.entities.entity.sentiment.score"; + public const string ENRICHED_URL_ENRICHEDTITLE_RELATIONS_RELATION_LOCATION_ENTITIES_ENTITY_SENTIMENT_MIXED = "enriched.url.enrichedTitle.relations.relation.location.entities.entity.sentiment.mixed"; + public const string ENRICHED_URL_ENRICHEDTITLE_RELATIONS_RELATION_LOCATION_ENTITIES_ENTITY_DISAMBIGUATED_NAME = "enriched.url.enrichedTitle.relations.relation.location.entities.entity.disambiguated.name"; + public const string ENRICHED_URL_ENRICHEDTITLE_RELATIONS_RELATION_LOCATION_ENTITIES_ENTITY_DISAMBIGUATED_GEO = "enriched.url.enrichedTitle.relations.relation.location.entities.entity.disambiguated.geo"; + public const string ENRICHED_URL_ENRICHEDTITLE_RELATIONS_RELATION_LOCATION_ENTITIES_ENTITY_DISAMBIGUATED_DBPEDIA = "enriched.url.enrichedTitle.relations.relation.location.entities.entity.disambiguated.dbpedia"; + public const string ENRICHED_URL_ENRICHEDTITLE_RELATIONS_RELATION_LOCATION_ENTITIES_ENTITY_DISAMBIGUATED_WEBSITE = "enriched.url.enrichedTitle.relations.relation.location.entities.entity.disambiguated.website"; + public const string ENRICHED_URL_ENRICHEDTITLE_RELATIONS_RELATION_LOCATION_ENTITIES_ENTITY_DISAMBIGUATED_SUBTYPE = "enriched.url.enrichedTitle.relations.relation.location.entities.entity.disambiguated.subType"; + public const string ENRICHED_URL_ENRICHEDTITLE_RELATIONS_RELATION_LOCATION_ENTITIES_ENTITY_DISAMBIGUATED_SUBTYPE_SUBTYPE_ = "enriched.url.enrichedTitle.relations.relation.location.entities.entity.disambiguated.subType.subType_"; + public const string ENRICHED_URL_ENRICHEDTITLE_RELATIONS_RELATION_LOCATION_ENTITIES_ENTITY_QUOTATIONS = "enriched.url.enrichedTitle.relations.relation.location.entities.entity.quotations"; + public const string ENRICHED_URL_ENRICHEDTITLE_RELATIONS_RELATION_LOCATION_ENTITIES_ENTITY_QUOTATIONS_QUOTATION__QUOTATION = "enriched.url.enrichedTitle.relations.relation.location.entities.entity.quotations.quotation_.quotation"; + public const string ENRICHED_URL_ENRICHEDTITLE_RELATIONS_RELATION_LOCATION_ENTITIES_ENTITY_QUOTATIONS_QUOTATION__SENTIMENT_TYPE = "enriched.url.enrichedTitle.relations.relation.location.entities.entity.quotations.quotation_.sentiment.type"; + public const string ENRICHED_URL_ENRICHEDTITLE_RELATIONS_RELATION_LOCATION_ENTITIES_ENTITY_QUOTATIONS_QUOTATION__SENTIMENT_SCORE = "enriched.url.enrichedTitle.relations.relation.location.entities.entity.quotations.quotation_.sentiment.score"; + public const string ENRICHED_URL_ENRICHEDTITLE_RELATIONS_RELATION_LOCATION_ENTITIES_ENTITY_QUOTATIONS_QUOTATION__SENTIMENT_MIXED = "enriched.url.enrichedTitle.relations.relation.location.entities.entity.quotations.quotation_.sentiment.mixed"; + public const string ENRICHED_URL_ENRICHEDTITLE_RELATIONS_RELATION_LOCATION_KEYWORDS = "enriched.url.enrichedTitle.relations.relation.location.keywords"; + public const string ENRICHED_URL_ENRICHEDTITLE_RELATIONS_RELATION_LOCATION_KEYWORDS_KEYWORD_TEXT = "enriched.url.enrichedTitle.relations.relation.location.keywords.keyword.text"; + public const string ENRICHED_URL_ENRICHEDTITLE_RELATIONS_RELATION_LOCATION_KEYWORDS_KEYWORD_RELEVANCE = "enriched.url.enrichedTitle.relations.relation.location.keywords.keyword.relevance"; + public const string ENRICHED_URL_ENRICHEDTITLE_RELATIONS_RELATION_LOCATION_KEYWORDS_KEYWORD_SENTIMENT_TYPE = "enriched.url.enrichedTitle.relations.relation.location.keywords.keyword.sentiment.type"; + public const string ENRICHED_URL_ENRICHEDTITLE_RELATIONS_RELATION_LOCATION_KEYWORDS_KEYWORD_SENTIMENT_SCORE = "enriched.url.enrichedTitle.relations.relation.location.keywords.keyword.sentiment.score"; + public const string ENRICHED_URL_ENRICHEDTITLE_RELATIONS_RELATION_LOCATION_KEYWORDS_KEYWORD_SENTIMENT_MIXED = "enriched.url.enrichedTitle.relations.relation.location.keywords.keyword.sentiment.mixed"; + public const string ENRICHED_URL_ENRICHEDTITLE_RELATIONS_RELATION_LOCATION_KEYWORDS_KEYWORD_KNOWLEDGEGRAPH_TYPEHIERARCHY = "enriched.url.enrichedTitle.relations.relation.location.keywords.keyword.knowledgeGraph.typeHierarchy"; + public const string ENRICHED_URL_ENRICHEDTITLE_RELATIONS_RELATION_TEMPORAL_TEXT = "enriched.url.enrichedTitle.relations.relation.temporal.text"; + public const string ENRICHED_URL_ENRICHEDTITLE_RELATIONS_RELATION_TEMPORAL_DECODED_TYPE = "enriched.url.enrichedTitle.relations.relation.temporal.decoded.type"; + public const string ENRICHED_URL_ENRICHEDTITLE_RELATIONS_RELATION_TEMPORAL_DECODED_VALUE = "enriched.url.enrichedTitle.relations.relation.temporal.decoded.value"; + public const string ENRICHED_URL_ENRICHEDTITLE_RELATIONS_RELATION_TEMPORAL_DECODED_START = "enriched.url.enrichedTitle.relations.relation.temporal.decoded.start"; + public const string ENRICHED_URL_ENRICHEDTITLE_RELATIONS_RELATION_TEMPORAL_DECODED_END = "enriched.url.enrichedTitle.relations.relation.temporal.decoded.end"; + public const string ENRICHED_URL_ENRICHEDTITLE_DOCSENTIMENT_TYPE = "enriched.url.enrichedTitle.docSentiment.type"; + public const string ENRICHED_URL_ENRICHEDTITLE_DOCSENTIMENT_SCORE = "enriched.url.enrichedTitle.docSentiment.score"; + public const string ENRICHED_URL_ENRICHEDTITLE_DOCSENTIMENT_MIXED = "enriched.url.enrichedTitle.docSentiment.mixed"; + public const string ENRICHED_URL_ENRICHEDTITLE_TAXONOMY = "enriched.url.enrichedTitle.taxonomy"; + public const string ENRICHED_URL_ENRICHEDTITLE_TAXONOMY_TAXONOMY__LABEL = "enriched.url.enrichedTitle.taxonomy.taxonomy_.label"; + public const string ENRICHED_URL_ENRICHEDTITLE_TAXONOMY_TAXONOMY__SCORE = "enriched.url.enrichedTitle.taxonomy.taxonomy_.score"; + public const string ENRICHED_URL_ENRICHEDTITLE_TAXONOMY_TAXONOMY__CONFIDENT = "enriched.url.enrichedTitle.taxonomy.taxonomy_.confident"; + } #endregion } diff --git a/Scripts/Services/DocumentConversion.meta b/Scripts/Services/DocumentConversion.meta index 003f4560f..f2c558fcb 100755 --- a/Scripts/Services/DocumentConversion.meta +++ b/Scripts/Services/DocumentConversion.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 -guid: 540f0d489cd19dc47a80e72b084c0c6a +guid: 57d5be47562a9c1498e3a8bf681f07f3 folderAsset: yes -timeCreated: 1467139350 +timeCreated: 1468592113 licenseType: Pro DefaultImporter: userData: diff --git a/Scripts/UnitTests/TestAlchemyLanguage.cs b/Scripts/UnitTests/TestAlchemyLanguage.cs old mode 100644 new mode 100755 index 1ae9a41c9..11727c404 --- a/Scripts/UnitTests/TestAlchemyLanguage.cs +++ b/Scripts/UnitTests/TestAlchemyLanguage.cs @@ -16,16 +16,17 @@ */ using System.Collections; -using IBM.Watson.DeveloperCloud.Services.AlchemyLanguage.v1; +using IBM.Watson.DeveloperCloud.Services.AlchemyAPI.v1; using IBM.Watson.DeveloperCloud.Logging; using IBM.Watson.DeveloperCloud.Utilities; using UnityEngine; +using System.Collections.Generic; namespace IBM.Watson.DeveloperCloud.UnitTests { - public class TestAlchemyLanguage : UnitTest + public class TestAlchemyAPI : UnitTest { - AlchemyLanguage m_AlchemyLanguage = new AlchemyLanguage(); + AlchemyAPI m_AlchemyAPI = new AlchemyAPI(); bool m_GetAuthorsURLTested = false; bool m_GetAuthorsHTMLTested = false; @@ -91,6 +92,8 @@ public class TestAlchemyLanguage : UnitTest bool m_GetCombinedDataURLTested = false; bool m_GetCombinedDataTextTested = false; + bool m_GetNewsTested = false; + private string m_ExampleURL_article = "http://www.nytimes.com/2011/02/17/science/17jeopardy-watson.html"; private string m_ExampleURL_microformats = "http://microformats.org/wiki/hcard"; private string m_ExampleURL_feed = "https://news.ycombinator.com/"; @@ -102,264 +105,274 @@ public override IEnumerator RunTest() string example_microformats_html = Application.dataPath + "/Watson/Examples/ServiceExamples/TestData/microformats.html"; string example_feed_html = Application.dataPath + "/Watson/Examples/ServiceExamples/TestData/ycombinator_news.html"; - Log.Debug("TestAlchemyLanguage", "Attempting GetAuthors URL"); - m_AlchemyLanguage.GetAuthors(OnGetAuthorsURL, m_ExampleURL_article, "OnGetAuthorsURL"); - while(!m_GetAuthorsURLTested) + Log.Debug("TestAlchemyAPI", "Attempting GetAuthors URL"); + m_AlchemyAPI.GetAuthors(OnGetAuthorsURL, m_ExampleURL_article, "OnGetAuthorsURL"); + while (!m_GetAuthorsURLTested) yield return null; - Log.Debug("TestAlchemyLanguage", "Attempting GetAuthors HTML"); - m_AlchemyLanguage.GetAuthors(OnGetAuthorsHTML, example_article_html, "OnGetAuthorsHTML"); - while(!m_GetAuthorsHTMLTested) + Log.Debug("TestAlchemyAPI", "Attempting GetAuthors HTML"); + m_AlchemyAPI.GetAuthors(OnGetAuthorsHTML, example_article_html, "OnGetAuthorsHTML"); + while (!m_GetAuthorsHTMLTested) yield return null; - Log.Debug("TestAlchemyLanguage", "Attempting GetRankedConcepts HTML"); - m_AlchemyLanguage.GetRankedConcepts(OnGetRankedConceptsHTML, example_article_html, 8, true, true, true, "OnGetRankedConceptsHTML"); - while(!m_GetRankedConceptsHTMLTested) + Log.Debug("TestAlchemyAPI", "Attempting GetRankedConcepts HTML"); + m_AlchemyAPI.GetRankedConcepts(OnGetRankedConceptsHTML, example_article_html, 8, true, true, true, "OnGetRankedConceptsHTML"); + while (!m_GetRankedConceptsHTMLTested) yield return null; - Log.Debug("TestAlchemyLanguage", "Attempting GetRankedConcepts URL"); - m_AlchemyLanguage.GetRankedConcepts(OnGetRankedConceptsURL, m_ExampleURL_article, 8, true, true, true, "OnGetRankedConceptsURL"); - while(!m_GetRankedConceptsHTMLTested) + Log.Debug("TestAlchemyAPI", "Attempting GetRankedConcepts URL"); + m_AlchemyAPI.GetRankedConcepts(OnGetRankedConceptsURL, m_ExampleURL_article, 8, true, true, true, "OnGetRankedConceptsURL"); + while (!m_GetRankedConceptsHTMLTested) yield return null; - Log.Debug("TestAlchemyLanguage", "Attempting GetRankedConcepts Text"); - m_AlchemyLanguage.GetRankedConcepts(OnGetRankedConceptsText, m_ExampleText_article, 8, true, true, true, "OnGetRankedConceptsText"); - while(!m_GetRankedConceptsHTMLTested) + Log.Debug("TestAlchemyAPI", "Attempting GetRankedConcepts Text"); + m_AlchemyAPI.GetRankedConcepts(OnGetRankedConceptsText, m_ExampleText_article, 8, true, true, true, "OnGetRankedConceptsText"); + while (!m_GetRankedConceptsHTMLTested) yield return null; - Log.Debug("TestAlchemyLanguage", "Attempting GetDates URL"); - m_AlchemyLanguage.GetDates(OnGetDatesURL, m_ExampleURL_article, null, true, "OnGetDatesURL"); - while(!m_GetDatesURLTested) + Log.Debug("TestAlchemyAPI", "Attempting GetDates URL"); + m_AlchemyAPI.GetDates(OnGetDatesURL, m_ExampleURL_article, null, true, "OnGetDatesURL"); + while (!m_GetDatesURLTested) yield return null; - Log.Debug("TestAlchemyLanguage", "Attempting GetDates Text"); - m_AlchemyLanguage.GetDates(OnGetDatesText, m_ExampleText_article, null, true, "OnGetDatesText"); - while(!m_GetDatesTextTested) + Log.Debug("TestAlchemyAPI", "Attempting GetDates Text"); + m_AlchemyAPI.GetDates(OnGetDatesText, m_ExampleText_article, null, true, "OnGetDatesText"); + while (!m_GetDatesTextTested) yield return null; - Log.Debug("TestAlchemyLanguage", "Attempting GetDates HTML"); - m_AlchemyLanguage.GetDates(OnGetDatesHTML, example_article_html, null, true, "OnGetDatesHTML"); - while(!m_GetDatesHTMLTested) + Log.Debug("TestAlchemyAPI", "Attempting GetDates HTML"); + m_AlchemyAPI.GetDates(OnGetDatesHTML, example_article_html, null, true, "OnGetDatesHTML"); + while (!m_GetDatesHTMLTested) yield return null; - Log.Debug("TestAlchemyLanguage", "Attempting GetDates URL"); - m_AlchemyLanguage.GetEmotions(OnGetEmotionsURL, m_ExampleURL_article, true, "OnGetEmotionsURL"); - while(!m_GetEmotionURLTested) + Log.Debug("TestAlchemyAPI", "Attempting GetDates URL"); + m_AlchemyAPI.GetEmotions(OnGetEmotionsURL, m_ExampleURL_article, true, "OnGetEmotionsURL"); + while (!m_GetEmotionURLTested) yield return null; - Log.Debug("TestAlchemyLanguage", "Attempting GetDates Text"); - m_AlchemyLanguage.GetEmotions(OnGetEmotionsText, m_ExampleText_article, true, "OnGetEmotionsText"); - while(!m_GetEmotionTextTested) + Log.Debug("TestAlchemyAPI", "Attempting GetDates Text"); + m_AlchemyAPI.GetEmotions(OnGetEmotionsText, m_ExampleText_article, true, "OnGetEmotionsText"); + while (!m_GetEmotionTextTested) yield return null; - Log.Debug("TestAlchemyLanguage", "Attempting GetDates HTML"); - m_AlchemyLanguage.GetEmotions(OnGetEmotionsHTML, example_article_html, true, "OnGetEmotionsHTML"); - while(!m_GetEmotionHTMLTested) + Log.Debug("TestAlchemyAPI", "Attempting GetDates HTML"); + m_AlchemyAPI.GetEmotions(OnGetEmotionsHTML, example_article_html, true, "OnGetEmotionsHTML"); + while (!m_GetEmotionHTMLTested) yield return null; - Log.Debug("TestAlchemyLanguage", "Attempting ExtractEntities URL"); - m_AlchemyLanguage.ExtractEntities(OnExtractEntitiesURL, m_ExampleURL_article); - while(!m_GetEntityExtractionURLTested) + Log.Debug("TestAlchemyAPI", "Attempting ExtractEntities URL"); + m_AlchemyAPI.ExtractEntities(OnExtractEntitiesURL, m_ExampleURL_article); + while (!m_GetEntityExtractionURLTested) yield return null; - Log.Debug("TestAlchemyLanguage", "Attempting ExtractEntities Text"); - m_AlchemyLanguage.ExtractEntities(OnExtractEntitiesText, m_ExampleText_article, 50, true, true, true, true, true, true, true, true, "OnExtractEntitiesText"); - while(!m_GetEntityExtractionTextTested) + Log.Debug("TestAlchemyAPI", "Attempting ExtractEntities Text"); + m_AlchemyAPI.ExtractEntities(OnExtractEntitiesText, m_ExampleText_article, 50, true, true, true, true, true, true, true, true, "OnExtractEntitiesText"); + while (!m_GetEntityExtractionTextTested) yield return null; - Log.Debug("TestAlchemyLanguage", "Attempting ExtractEntities HTML"); - m_AlchemyLanguage.ExtractEntities(OnExtractEntitiesHTML, example_article_html, 50, true, true, true, true, true, true, true, true, "OnExtractEntitiesHTML"); - while(!m_GetEntityExtractionHTMLTested) + Log.Debug("TestAlchemyAPI", "Attempting ExtractEntities HTML"); + m_AlchemyAPI.ExtractEntities(OnExtractEntitiesHTML, example_article_html, 50, true, true, true, true, true, true, true, true, "OnExtractEntitiesHTML"); + while (!m_GetEntityExtractionHTMLTested) yield return null; - - Log.Debug("TestAlchemyLanguage", "Attempting DetectFeeds URL"); - m_AlchemyLanguage.DetectFeeds(OnDetectFeedsURL, m_ExampleURL_feed, "OnDetectFeedsURL"); - while(!m_DetectFeedsURLTested) + + Log.Debug("TestAlchemyAPI", "Attempting DetectFeeds URL"); + m_AlchemyAPI.DetectFeeds(OnDetectFeedsURL, m_ExampleURL_feed, "OnDetectFeedsURL"); + while (!m_DetectFeedsURLTested) yield return null; -// Log.Debug("TestAlchemyLanguage", "Attempting DetectFeeds HTML"); -// m_AlchemyLanguage.DetectFeeds(OnDetectFeedsHTML, example_feed_html, "OnDetectFeedsHTML"); -// while(!m_DetectFeedsHTMLTested) -// yield return null; - + // Log.Debug("TestAlchemyAPI", "Attempting DetectFeeds HTML"); + // m_AlchemyLanguage.DetectFeeds(OnDetectFeedsHTML, example_feed_html, "OnDetectFeedsHTML"); + // while(!m_DetectFeedsHTMLTested) + // yield return null; + - Log.Debug("TestAlchemyLanguage", "Attempting ExtractKeywords URL"); - m_AlchemyLanguage.ExtractKeywords(OnExtractKeywordsURL, m_ExampleURL_article, 50, true, true, true, "OnExtractKeywordsURL"); - while(!m_GetKeywordExtractionURLTested) + Log.Debug("TestAlchemyAPI", "Attempting ExtractKeywords URL"); + m_AlchemyAPI.ExtractKeywords(OnExtractKeywordsURL, m_ExampleURL_article, 50, true, true, true, "OnExtractKeywordsURL"); + while (!m_GetKeywordExtractionURLTested) yield return null; - Log.Debug("TestAlchemyLanguage", "Attempting ExtractKeywords Text"); - m_AlchemyLanguage.ExtractKeywords(OnExtractKeywordsText, m_ExampleText_article, 50, true, true, true, "OnExtractKeywordsText"); - while(!m_GetKeywordExtractionTextTested) + Log.Debug("TestAlchemyAPI", "Attempting ExtractKeywords Text"); + m_AlchemyAPI.ExtractKeywords(OnExtractKeywordsText, m_ExampleText_article, 50, true, true, true, "OnExtractKeywordsText"); + while (!m_GetKeywordExtractionTextTested) yield return null; - Log.Debug("TestAlchemyLanguage", "Attempting ExtractKeywords HTML"); - m_AlchemyLanguage.ExtractKeywords(OnExtractKeywordsHTML, example_article_html, 50, true, true, true, "OnExtractKeywordsHTML"); - while(!m_GetKeywordExtractionHTMLTested) + Log.Debug("TestAlchemyAPI", "Attempting ExtractKeywords HTML"); + m_AlchemyAPI.ExtractKeywords(OnExtractKeywordsHTML, example_article_html, 50, true, true, true, "OnExtractKeywordsHTML"); + while (!m_GetKeywordExtractionHTMLTested) yield return null; - - Log.Debug("TestAlchemyLanguage", "Attempting GetLanguages URL"); - m_AlchemyLanguage.GetLanguages(OnGetLanguagesURL, m_ExampleURL_article, true, "OnGetLanguagesURL"); - while(!m_GetLanguageURLTested) + + Log.Debug("TestAlchemyAPI", "Attempting GetLanguages URL"); + m_AlchemyAPI.GetLanguages(OnGetLanguagesURL, m_ExampleURL_article, true, "OnGetLanguagesURL"); + while (!m_GetLanguageURLTested) yield return null; - Log.Debug("TestAlchemyLanguage", "Attempting GetLanguages Text"); - m_AlchemyLanguage.GetLanguages(OnGetLanguagesText, m_ExampleText_article, true, "OnGetLanguagesText"); - while(!m_GetLanguageTextTested) + Log.Debug("TestAlchemyAPI", "Attempting GetLanguages Text"); + m_AlchemyAPI.GetLanguages(OnGetLanguagesText, m_ExampleText_article, true, "OnGetLanguagesText"); + while (!m_GetLanguageTextTested) yield return null; - Log.Debug("TestAlchemyLanguage", "Attempting GetLanguages HTML"); - m_AlchemyLanguage.GetLanguages(OnGetLanguagesHTML, example_article_html, true, "OnGetLanguagesHTML"); - while(!m_GetLanguageHTMLTested) + Log.Debug("TestAlchemyAPI", "Attempting GetLanguages HTML"); + m_AlchemyAPI.GetLanguages(OnGetLanguagesHTML, example_article_html, true, "OnGetLanguagesHTML"); + while (!m_GetLanguageHTMLTested) yield return null; - - Log.Debug("TestAlchemyLanguage", "Attempting GetMicroformats URL"); - m_AlchemyLanguage.GetMicroformats(OnGetMicroformatsURL, m_ExampleURL_microformats, "OnGetMicroformatsURL"); - while(!m_GetMicroformatURLTested) + + Log.Debug("TestAlchemyAPI", "Attempting GetMicroformats URL"); + m_AlchemyAPI.GetMicroformats(OnGetMicroformatsURL, m_ExampleURL_microformats, "OnGetMicroformatsURL"); + while (!m_GetMicroformatURLTested) yield return null; -// Log.Debug("TestAlchemyLanguage", "Attempting GetMicroformats HTML"); -// m_AlchemyLanguage.GetMicroformats(OnGetMicroformatsHTML, example_microformats_html, "OnGetMicroformatsHTML"); -// while(!m_GetMicroformatHTMLTested) -// yield return null; - - - Log.Debug("TestAlchemyLanguage", "Attempting GetPublicationDate URL"); - m_AlchemyLanguage.GetPublicationDate(OnGetPublicationDateURL, m_ExampleURL_article, "OnGetPublicationDateURL"); - while(!m_GetPubDateURLTested) + // Log.Debug("TestAlchemyAPI", "Attempting GetMicroformats HTML"); + // m_AlchemyLanguage.GetMicroformats(OnGetMicroformatsHTML, example_microformats_html, "OnGetMicroformatsHTML"); + // while(!m_GetMicroformatHTMLTested) + // yield return null; + + + Log.Debug("TestAlchemyAPI", "Attempting GetPublicationDate URL"); + m_AlchemyAPI.GetPublicationDate(OnGetPublicationDateURL, m_ExampleURL_article, "OnGetPublicationDateURL"); + while (!m_GetPubDateURLTested) yield return null; - Log.Debug("TestAlchemyLanguage", "Attempting GetPublicationDate HTML"); - m_AlchemyLanguage.GetPublicationDate(OnGetPublicationDateHTML, example_article_html, "OnGetPublicationDateHTML"); - while(!m_GetPubldateHTMLTested) + Log.Debug("TestAlchemyAPI", "Attempting GetPublicationDate HTML"); + m_AlchemyAPI.GetPublicationDate(OnGetPublicationDateHTML, example_article_html, "OnGetPublicationDateHTML"); + while (!m_GetPubldateHTMLTested) yield return null; - - Log.Debug("TestAlchemyLanguage", "Attempting GetRelations URL"); - m_AlchemyLanguage.GetRelations(OnGetRelationsURL, m_ExampleURL_article, 50, true, true, true, true, true, true, true, true, true, true, "OnGetRelationsURL"); - while(!m_GetRelationsURLTested) + + Log.Debug("TestAlchemyAPI", "Attempting GetRelations URL"); + m_AlchemyAPI.GetRelations(OnGetRelationsURL, m_ExampleURL_article, 50, true, true, true, true, true, true, true, true, true, true, "OnGetRelationsURL"); + while (!m_GetRelationsURLTested) yield return null; - Log.Debug("TestAlchemyLanguage", "Attempting GetRelations Text"); - m_AlchemyLanguage.GetRelations(OnGetRelationsText, m_ExampleText_article, 50, true, true, true, true, true, true, true, true, true, true, "OnGetRelationsText"); - while(!m_GetRelationsTextTested) + Log.Debug("TestAlchemyAPI", "Attempting GetRelations Text"); + m_AlchemyAPI.GetRelations(OnGetRelationsText, m_ExampleText_article, 50, true, true, true, true, true, true, true, true, true, true, "OnGetRelationsText"); + while (!m_GetRelationsTextTested) yield return null; - Log.Debug("TestAlchemyLanguage", "Attempting GetRelations HTML"); - m_AlchemyLanguage.GetRelations(OnGetRelationsHTML, example_article_html, 50, true, true, true, true, true, true, true, true, true, true, "OnGetRelationsHTML"); - while(!m_GetRelationsHTMLTested) + Log.Debug("TestAlchemyAPI", "Attempting GetRelations HTML"); + m_AlchemyAPI.GetRelations(OnGetRelationsHTML, example_article_html, 50, true, true, true, true, true, true, true, true, true, true, "OnGetRelationsHTML"); + while (!m_GetRelationsHTMLTested) yield return null; - - Log.Debug("TestAlchemyLanguage", "Attempting GetTextSentiment URL"); - m_AlchemyLanguage.GetTextSentiment(OnGetTextSentimentURL, m_ExampleURL_article, true, "OnGetTextSentimentURL"); - while(!m_GetTextSentimentURLTested) + + Log.Debug("TestAlchemyAPI", "Attempting GetTextSentiment URL"); + m_AlchemyAPI.GetTextSentiment(OnGetTextSentimentURL, m_ExampleURL_article, true, "OnGetTextSentimentURL"); + while (!m_GetTextSentimentURLTested) yield return null; - Log.Debug("TestAlchemyLanguage", "Attempting GetTextSentiment Text"); - m_AlchemyLanguage.GetTextSentiment(OnGetTextSentimentText, m_ExampleText_article, true, "OnGetTextSentimentText"); - while(!m_GetTextSentimentTextTested) + Log.Debug("TestAlchemyAPI", "Attempting GetTextSentiment Text"); + m_AlchemyAPI.GetTextSentiment(OnGetTextSentimentText, m_ExampleText_article, true, "OnGetTextSentimentText"); + while (!m_GetTextSentimentTextTested) yield return null; - Log.Debug("TestAlchemyLanguage", "Attempting GetTextSentiment HTML"); - m_AlchemyLanguage.GetTextSentiment(OnGetTextSentimentHTML, example_article_html, true, "OnGetTextSentimentHTML"); - while(!m_GetTextSentimentHTMLTested) + Log.Debug("TestAlchemyAPI", "Attempting GetTextSentiment HTML"); + m_AlchemyAPI.GetTextSentiment(OnGetTextSentimentHTML, example_article_html, true, "OnGetTextSentimentHTML"); + while (!m_GetTextSentimentHTMLTested) yield return null; - - Log.Debug("TestAlchemyLanguage", "Attempting GetTargetedSentiment URL"); - m_AlchemyLanguage.GetTargetedSentiment(OnGetTargetedSentimentURL, m_ExampleURL_article, "Jeopardy|Jennings|Watson", true, "OnGetTargetedSentimentURL"); - while(!m_GetTargetedSentimentURLTested) + + Log.Debug("TestAlchemyAPI", "Attempting GetTargetedSentiment URL"); + m_AlchemyAPI.GetTargetedSentiment(OnGetTargetedSentimentURL, m_ExampleURL_article, "Jeopardy|Jennings|Watson", true, "OnGetTargetedSentimentURL"); + while (!m_GetTargetedSentimentURLTested) yield return null; - Log.Debug("TestAlchemyLanguage", "Attempting GetTargetedSentiment Text"); - m_AlchemyLanguage.GetTargetedSentiment(OnGetTargetedSentimentText, m_ExampleText_article, "Jeopardy|Jennings|Watson", true, "OnGetTargetedSentimentText"); - while(!m_GetTargetedSentimentTextTested) + Log.Debug("TestAlchemyAPI", "Attempting GetTargetedSentiment Text"); + m_AlchemyAPI.GetTargetedSentiment(OnGetTargetedSentimentText, m_ExampleText_article, "Jeopardy|Jennings|Watson", true, "OnGetTargetedSentimentText"); + while (!m_GetTargetedSentimentTextTested) yield return null; - Log.Debug("TestAlchemyLanguage", "Attempting GetTargetedSentiment HTML"); - m_AlchemyLanguage.GetTargetedSentiment(OnGetTargetedSentimentHTML, example_article_html, "Jeopardy|Jennings|Watson", true, "OnGetTargetedSentimentHTML"); - while(!m_GetTargetedSentimentHTMLTested) + Log.Debug("TestAlchemyAPI", "Attempting GetTargetedSentiment HTML"); + m_AlchemyAPI.GetTargetedSentiment(OnGetTargetedSentimentHTML, example_article_html, "Jeopardy|Jennings|Watson", true, "OnGetTargetedSentimentHTML"); + while (!m_GetTargetedSentimentHTMLTested) yield return null; - - Log.Debug("TestAlchemyLanguage", "Attempting GetRankedTaxonomy URL"); - m_AlchemyLanguage.GetRankedTaxonomy(OnGetRankedTaxonomyURL, m_ExampleURL_article, true, "OnGetRankedTaxonomyURL"); - while(!m_GetRankedTaxonomyURLTested) + + Log.Debug("TestAlchemyAPI", "Attempting GetRankedTaxonomy URL"); + m_AlchemyAPI.GetRankedTaxonomy(OnGetRankedTaxonomyURL, m_ExampleURL_article, true, "OnGetRankedTaxonomyURL"); + while (!m_GetRankedTaxonomyURLTested) yield return null; - Log.Debug("TestAlchemyLanguage", "Attempting GetRankedTaxonomy Text"); - m_AlchemyLanguage.GetRankedTaxonomy(OnGetRankedTaxonomyText, m_ExampleText_article, true, "OnGetRankedTaxonomyText"); - while(!m_GetRankedTaxonomyTextTested) + Log.Debug("TestAlchemyAPI", "Attempting GetRankedTaxonomy Text"); + m_AlchemyAPI.GetRankedTaxonomy(OnGetRankedTaxonomyText, m_ExampleText_article, true, "OnGetRankedTaxonomyText"); + while (!m_GetRankedTaxonomyTextTested) yield return null; - Log.Debug("TestAlchemyLanguage", "Attempting GetRankedTaxonomy HTML"); - m_AlchemyLanguage.GetRankedTaxonomy(OnGetRankedTaxonomyHTML, example_article_html, true, "OnGetRankedTaxonomyHTML"); - while(!m_GetRankedTaxonomyHTMLTested) + Log.Debug("TestAlchemyAPI", "Attempting GetRankedTaxonomy HTML"); + m_AlchemyAPI.GetRankedTaxonomy(OnGetRankedTaxonomyHTML, example_article_html, true, "OnGetRankedTaxonomyHTML"); + while (!m_GetRankedTaxonomyHTMLTested) yield return null; - Log.Debug("TestAlchemyLanguage", "Attempting GetText HTML"); - m_AlchemyLanguage.GetText(OnGetTextHTML, example_article_html, true, true, "OnGetTextHTML"); - while(!m_GetTextHTMLTested) + Log.Debug("TestAlchemyAPI", "Attempting GetText HTML"); + m_AlchemyAPI.GetText(OnGetTextHTML, example_article_html, true, true, "OnGetTextHTML"); + while (!m_GetTextHTMLTested) yield return null; - Log.Debug("TestAlchemyLanguage", "Attempting GetText URL"); - m_AlchemyLanguage.GetText(OnGetTextURL, m_ExampleURL_article, true, true, "OnGetTextURL"); - while(!m_GetTextURLTested) + Log.Debug("TestAlchemyAPI", "Attempting GetText URL"); + m_AlchemyAPI.GetText(OnGetTextURL, m_ExampleURL_article, true, true, "OnGetTextURL"); + while (!m_GetTextURLTested) yield return null; - - Log.Debug("TestAlchemyLanguage", "Attempting GetRawText HTML"); - m_AlchemyLanguage.GetRawText(OnGetRawTextHTML, example_article_html, "OnGetTextHTML"); - while(!m_GetRawTextHTMLTested) + + Log.Debug("TestAlchemyAPI", "Attempting GetRawText HTML"); + m_AlchemyAPI.GetRawText(OnGetRawTextHTML, example_article_html, "OnGetTextHTML"); + while (!m_GetRawTextHTMLTested) yield return null; - Log.Debug("TestAlchemyLanguage", "Attempting GetRawText URL"); - m_AlchemyLanguage.GetRawText(OnGetRawTextURL, m_ExampleURL_article, "OnGetTextURL"); - while(!m_GetRawTextURLTested) + Log.Debug("TestAlchemyAPI", "Attempting GetRawText URL"); + m_AlchemyAPI.GetRawText(OnGetRawTextURL, m_ExampleURL_article, "OnGetTextURL"); + while (!m_GetRawTextURLTested) yield return null; - Log.Debug("TestAlchemyLanguage", "Attempting GetTitle HTML"); - m_AlchemyLanguage.GetTitle(OnGetTitleHTML, example_article_html, true, "OnGetTitleHTML"); - while(!m_GetTitleHTMLTested) + Log.Debug("TestAlchemyAPI", "Attempting GetTitle HTML"); + m_AlchemyAPI.GetTitle(OnGetTitleHTML, example_article_html, true, "OnGetTitleHTML"); + while (!m_GetTitleHTMLTested) yield return null; - Log.Debug("TestAlchemyLanguage", "Attempting GetTitle URL"); - m_AlchemyLanguage.GetTitle(OnGetTitleURL, m_ExampleURL_article, true, "OnGetTitleURL"); - while(!m_GetTitleURLTested) + Log.Debug("TestAlchemyAPI", "Attempting GetTitle URL"); + m_AlchemyAPI.GetTitle(OnGetTitleURL, m_ExampleURL_article, true, "OnGetTitleURL"); + while (!m_GetTitleURLTested) yield return null; - Log.Debug("TestAlchemyLanguage", "Attempting GetCombinedData URL"); - m_AlchemyLanguage.GetCombinedData(OnGetCombinedDataURL, m_ExampleURL_article, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, "OnGetCombinedDataURL"); - while(!m_GetCombinedDataURLTested) + Log.Debug("TestAlchemyAPI", "Attempting GetCombinedData URL"); + m_AlchemyAPI.GetCombinedData(OnGetCombinedDataURL, m_ExampleURL_article, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, "OnGetCombinedDataURL"); + while (!m_GetCombinedDataURLTested) yield return null; - Log.Debug("TestAlchemyLanguage", "Attempting GetCombinedData Text"); - m_AlchemyLanguage.GetCombinedData(OnGetCombinedDataText, m_ExampleText_article, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, "OnGetCombinedDataText"); - while(!m_GetCombinedDataTextTested) + Log.Debug("TestAlchemyAPI", "Attempting GetCombinedData Text"); + m_AlchemyAPI.GetCombinedData(OnGetCombinedDataText, m_ExampleText_article, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, "OnGetCombinedDataText"); + while (!m_GetCombinedDataTextTested) yield return null; - Log.Debug("TestAlchemyLanguage", "Attempting GetCombinedData HTML"); - m_AlchemyLanguage.GetCombinedData(OnGetCombinedDataHTML, example_article_html, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, "OnGetCombinedDataHTML"); - while(!m_GetCombinedDataHTMLTested) + Log.Debug("TestAlchemyAPI", "Attempting GetCombinedData HTML"); + m_AlchemyAPI.GetCombinedData(OnGetCombinedDataHTML, example_article_html, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, "OnGetCombinedDataHTML"); + while (!m_GetCombinedDataHTMLTested) yield return null; + + Log.Debug("TestAlchemyAPI", "Attempting to GetNews"); + string[] returnFields = {Fields.ENRICHED_URL_ENTITIES, Fields.ENRICHED_URL_KEYWORDS}; + Dictionary queryFields = new Dictionary(); + queryFields.Add(Fields.ENRICHED_URL_RELATIONS_RELATION_SUBJECT_TEXT, "Obama"); + queryFields.Add(Fields.ENRICHED_URL_CLEANEDTITLE, "Washington"); + + m_AlchemyAPI.GetNews(OnGetNews, returnFields, queryFields); + while(!m_GetNewsTested) + yield return null; } #region GetAuthors private void OnGetAuthorsURL(AuthorsData authors, string data) { Test(authors.status == "OK"); - if(authors != null) + if (authors != null) { m_GetAuthorsURLTested = true; LogAuthorsData(authors, data); @@ -369,7 +382,7 @@ private void OnGetAuthorsURL(AuthorsData authors, string data) private void OnGetAuthorsHTML(AuthorsData authors, string data) { Test(authors.status == "OK"); - if(authors != null) + if (authors != null) { m_GetAuthorsHTMLTested = true; LogAuthorsData(authors, data); @@ -378,18 +391,18 @@ private void OnGetAuthorsHTML(AuthorsData authors, string data) private void LogAuthorsData(AuthorsData authors, string data) { - Log.Debug("TestAlchemyLanguage", "data: {0}", data); - if(authors != null) + Log.Debug("TestAlchemyAPI", "data: {0}", data); + if (authors != null) { - if(authors.authors.names.Length == 0) - Log.Debug("TestAlchemyLanguage", "No authors found!"); + if (authors.authors.names.Length == 0) + Log.Debug("TestAlchemyAPI", "No authors found!"); - foreach(string name in authors.authors.names) - Log.Debug("TestAlchemyLanguage", "Author " + name + " found!"); + foreach (string name in authors.authors.names) + Log.Debug("TestAlchemyAPI", "Author " + name + " found!"); } else { - Log.Debug("TestAlchemyLanguage", "Failed to find Author!"); + Log.Debug("TestAlchemyAPI", "Failed to find Author!"); } } #endregion @@ -398,7 +411,7 @@ private void LogAuthorsData(AuthorsData authors, string data) private void OnGetRankedConceptsURL(ConceptsData concepts, string data) { Test(concepts.status == "OK"); - if(concepts != null) + if (concepts != null) { m_GetRankedConceptsURLTested = true; LogConceptsData(concepts, data); @@ -408,7 +421,7 @@ private void OnGetRankedConceptsURL(ConceptsData concepts, string data) private void OnGetRankedConceptsHTML(ConceptsData concepts, string data) { Test(concepts.status == "OK"); - if(concepts != null) + if (concepts != null) { m_GetRankedConceptsHTMLTested = true; LogConceptsData(concepts, data); @@ -418,7 +431,7 @@ private void OnGetRankedConceptsHTML(ConceptsData concepts, string data) private void OnGetRankedConceptsText(ConceptsData concepts, string data) { Test(concepts.status == "OK"); - if(concepts != null) + if (concepts != null) { m_GetRankedConceptsTextTested = true; LogConceptsData(concepts, data); @@ -427,30 +440,30 @@ private void OnGetRankedConceptsText(ConceptsData concepts, string data) private void LogConceptsData(ConceptsData concepts, string data) { - Log.Debug("TestAlchemyLanguage", "data: {0}", data); - if(concepts != null) + Log.Debug("TestAlchemyAPI", "data: {0}", data); + if (concepts != null) { - Log.Debug("TestAlchemyLanguage", "status: {0}", concepts.status); - Log.Debug("TestAlchemyLanguage", "url: {0}", concepts.url); - Log.Debug("TestAlchemyLanguage", "language: {0}", concepts.language); - if(concepts.concepts.Length == 0) - Log.Debug("TestAlchemyLanguage", "No concepts found!"); + Log.Debug("TestAlchemyAPI", "status: {0}", concepts.status); + Log.Debug("TestAlchemyAPI", "url: {0}", concepts.url); + Log.Debug("TestAlchemyAPI", "language: {0}", concepts.language); + if (concepts.concepts.Length == 0) + Log.Debug("TestAlchemyAPI", "No concepts found!"); - foreach(Concept concept in concepts.concepts) - Log.Debug("TestAlchemyLanguage", "Concept: {0}, Relevance: {1}", concept.text, concept.relevance); + foreach (Concept concept in concepts.concepts) + Log.Debug("TestAlchemyAPI", "Concept: {0}, Relevance: {1}", concept.text, concept.relevance); } else { - Log.Debug("TestAlchemyLanguage", "Failed to find Concepts!"); + Log.Debug("TestAlchemyAPI", "Failed to find Concepts!"); } } #endregion - + #region GetDates private void OnGetDatesURL(DateData dates, string data) { Test(dates.status == "OK"); - if(dates != null) + if (dates != null) { m_GetDatesURLTested = true; LogDatesData(dates, data); @@ -460,7 +473,7 @@ private void OnGetDatesURL(DateData dates, string data) private void OnGetDatesHTML(DateData dates, string data) { Test(dates.status == "OK"); - if(dates != null) + if (dates != null) { m_GetDatesHTMLTested = true; LogDatesData(dates, data); @@ -470,7 +483,7 @@ private void OnGetDatesHTML(DateData dates, string data) private void OnGetDatesText(DateData dates, string data) { Test(dates.status == "OK"); - if(dates != null) + if (dates != null) { m_GetDatesTextTested = true; LogDatesData(dates, data); @@ -479,21 +492,21 @@ private void OnGetDatesText(DateData dates, string data) private void LogDatesData(DateData dates, string data) { - Log.Debug("TestAlchemyLanguage", "data: {0}", data); - if(dates != null) + Log.Debug("TestAlchemyAPI", "data: {0}", data); + if (dates != null) { - Log.Debug("TestAlchemyLanguage", "status: {0}", dates.status); - Log.Debug("TestAlchemyLanguage", "language: {0}", dates.language); - Log.Debug("TestAlchemyLanguage", "url: {0}", dates.url); - if(dates.dates == null || dates.dates.Length == 0) - Log.Debug("TestAlchemyLanguage", "No dates found!"); + Log.Debug("TestAlchemyAPI", "status: {0}", dates.status); + Log.Debug("TestAlchemyAPI", "language: {0}", dates.language); + Log.Debug("TestAlchemyAPI", "url: {0}", dates.url); + if (dates.dates == null || dates.dates.Length == 0) + Log.Debug("TestAlchemyAPI", "No dates found!"); else - foreach(Date date in dates.dates) - Log.Debug("TestAlchemyLanguage", "Text: {0}, Date: {1}", date.text, date.date); + foreach (Date date in dates.dates) + Log.Debug("TestAlchemyAPI", "Text: {0}, Date: {1}", date.text, date.date); } else { - Log.Debug("TestAlchemyLanguage", "Failed to find Dates!"); + Log.Debug("TestAlchemyAPI", "Failed to find Dates!"); } } #endregion @@ -502,7 +515,7 @@ private void LogDatesData(DateData dates, string data) private void OnGetEmotionsURL(EmotionData emotions, string data) { Test(emotions.status == "OK"); - if(emotions != null) + if (emotions != null) { m_GetEmotionURLTested = true; LogEmotionsData(emotions, data); @@ -512,7 +525,7 @@ private void OnGetEmotionsURL(EmotionData emotions, string data) private void OnGetEmotionsHTML(EmotionData emotions, string data) { Test(emotions.status == "OK"); - if(emotions != null) + if (emotions != null) { m_GetEmotionHTMLTested = true; LogEmotionsData(emotions, data); @@ -522,7 +535,7 @@ private void OnGetEmotionsHTML(EmotionData emotions, string data) private void OnGetEmotionsText(EmotionData emotions, string data) { Test(emotions.status == "OK"); - if(emotions != null) + if (emotions != null) { m_GetEmotionTextTested = true; LogEmotionsData(emotions, data); @@ -531,27 +544,27 @@ private void OnGetEmotionsText(EmotionData emotions, string data) private void LogEmotionsData(EmotionData emotions, string data) { - Log.Debug("TestAlchemyLanguage", "data: {0}", data); - if(emotions != null) + Log.Debug("TestAlchemyAPI", "data: {0}", data); + if (emotions != null) { - Log.Debug("TestAlchemyLanguage", "status: {0}", emotions.status); - Log.Debug("TestAlchemyLanguage", "url: {0}", emotions.url); - Log.Debug("TestAlchemyLanguage", "language: {0}", emotions.language); - Log.Debug("TestAlchemyLanguage", "text: {0}", emotions.text); - if(emotions.docEmotions == null) - Log.Debug("TestAlchemyLanguage", "No emotions found!"); + Log.Debug("TestAlchemyAPI", "status: {0}", emotions.status); + Log.Debug("TestAlchemyAPI", "url: {0}", emotions.url); + Log.Debug("TestAlchemyAPI", "language: {0}", emotions.language); + Log.Debug("TestAlchemyAPI", "text: {0}", emotions.text); + if (emotions.docEmotions == null) + Log.Debug("TestAlchemyAPI", "No emotions found!"); else { - Log.Debug("TestAlchemyLanguage", "anger: {0}", emotions.docEmotions.anger); - Log.Debug("TestAlchemyLanguage", "disgust: {0}", emotions.docEmotions.disgust); - Log.Debug("TestAlchemyLanguage", "fear: {0}", emotions.docEmotions.fear); - Log.Debug("TestAlchemyLanguage", "joy: {0}", emotions.docEmotions.joy); - Log.Debug("TestAlchemyLanguage", "sadness: {0}", emotions.docEmotions.sadness); + Log.Debug("TestAlchemyAPI", "anger: {0}", emotions.docEmotions.anger); + Log.Debug("TestAlchemyAPI", "disgust: {0}", emotions.docEmotions.disgust); + Log.Debug("TestAlchemyAPI", "fear: {0}", emotions.docEmotions.fear); + Log.Debug("TestAlchemyAPI", "joy: {0}", emotions.docEmotions.joy); + Log.Debug("TestAlchemyAPI", "sadness: {0}", emotions.docEmotions.sadness); } } else { - Log.Debug("TestAlchemyLanguage", "Failed to find Emotions!"); + Log.Debug("TestAlchemyAPI", "Failed to find Emotions!"); } } #endregion @@ -560,7 +573,7 @@ private void LogEmotionsData(EmotionData emotions, string data) private void OnExtractEntitiesURL(EntityData entityData, string data) { Test(entityData.status == "OK"); - if(entityData != null) + if (entityData != null) { m_GetEntityExtractionURLTested = true; LogEntityData(entityData, data); @@ -570,7 +583,7 @@ private void OnExtractEntitiesURL(EntityData entityData, string data) private void OnExtractEntitiesHTML(EntityData entityData, string data) { Test(entityData.status == "OK"); - if(entityData != null) + if (entityData != null) { m_GetEntityExtractionHTMLTested = true; LogEntityData(entityData, data); @@ -580,7 +593,7 @@ private void OnExtractEntitiesHTML(EntityData entityData, string data) private void OnExtractEntitiesText(EntityData entityData, string data) { Test(entityData.status == "OK"); - if(entityData != null) + if (entityData != null) { m_GetEntityExtractionTextTested = true; LogEntityData(entityData, data); @@ -589,22 +602,22 @@ private void OnExtractEntitiesText(EntityData entityData, string data) private void LogEntityData(EntityData entityData, string data) { - Log.Debug("TestAlchemyLanguage", "data: {0}", data); - if(entityData != null) + Log.Debug("TestAlchemyAPI", "data: {0}", data); + if (entityData != null) { - Log.Debug("TestAlchemyLanguage", "status: {0}", entityData.status); - Log.Debug("TestAlchemyLanguage", "url: {0}", entityData.url); - Log.Debug("TestAlchemyLanguage", "language: {0}", entityData.language); - Log.Debug("TestAlchemyLanguage", "text: {0}", entityData.text); - if(entityData == null || entityData.entities.Length == 0) - Log.Debug("TestAlchemyLanguage", "No entities found!"); + Log.Debug("TestAlchemyAPI", "status: {0}", entityData.status); + Log.Debug("TestAlchemyAPI", "url: {0}", entityData.url); + Log.Debug("TestAlchemyAPI", "language: {0}", entityData.language); + Log.Debug("TestAlchemyAPI", "text: {0}", entityData.text); + if (entityData == null || entityData.entities.Length == 0) + Log.Debug("TestAlchemyAPI", "No entities found!"); else - foreach(Entity entity in entityData.entities) - Log.Debug("TestAlchemyLanguage", "text: {0}, type: {1}", entity.text, entity.type); + foreach (Entity entity in entityData.entities) + Log.Debug("TestAlchemyAPI", "text: {0}, type: {1}", entity.text, entity.type); } else { - Log.Debug("TestAlchemyLanguage", "Failed to find Emotions!"); + Log.Debug("TestAlchemyAPI", "Failed to find Emotions!"); } } #endregion @@ -613,7 +626,7 @@ private void LogEntityData(EntityData entityData, string data) private void OnDetectFeedsURL(FeedData feedData, string data) { Test(feedData.status == "OK"); - if(feedData != null) + if (feedData != null) { m_DetectFeedsURLTested = true; LogFeedData(feedData, data); @@ -623,7 +636,7 @@ private void OnDetectFeedsURL(FeedData feedData, string data) private void OnDetectFeedsHTML(FeedData feedData, string data) { Test(feedData.status == "OK"); - if(feedData != null) + if (feedData != null) { m_DetectFeedsHTMLTested = true; LogFeedData(feedData, data); @@ -632,19 +645,19 @@ private void OnDetectFeedsHTML(FeedData feedData, string data) private void LogFeedData(FeedData feedData, string data) { - Log.Debug("TestAlchemyLanguage", "data: {0}", data); - if(feedData != null) + Log.Debug("TestAlchemyAPI", "data: {0}", data); + if (feedData != null) { - Log.Debug("TestAlchemyLanguage", "status: {0}", feedData.status); - if(feedData == null || feedData.feeds.Length == 0) - Log.Debug("TestAlchemyLanguage", "No feeds found!"); + Log.Debug("TestAlchemyAPI", "status: {0}", feedData.status); + if (feedData == null || feedData.feeds.Length == 0) + Log.Debug("TestAlchemyAPI", "No feeds found!"); else - foreach(Feed feed in feedData.feeds) - Log.Debug("TestAlchemyLanguage", "text: {0}", feed.feed); + foreach (Feed feed in feedData.feeds) + Log.Debug("TestAlchemyAPI", "text: {0}", feed.feed); } else { - Log.Debug("TestAlchemyLanguage", "Failed to find Feeds!"); + Log.Debug("TestAlchemyAPI", "Failed to find Feeds!"); } } #endregion @@ -653,7 +666,7 @@ private void LogFeedData(FeedData feedData, string data) private void OnExtractKeywordsURL(KeywordData keywordData, string data) { Test(keywordData.status == "OK"); - if(keywordData != null) + if (keywordData != null) { m_GetKeywordExtractionURLTested = true; LogKeywordData(keywordData, data); @@ -663,7 +676,7 @@ private void OnExtractKeywordsURL(KeywordData keywordData, string data) private void OnExtractKeywordsHTML(KeywordData keywordData, string data) { Test(keywordData.status == "OK"); - if(keywordData != null) + if (keywordData != null) { m_GetKeywordExtractionHTMLTested = true; LogKeywordData(keywordData, data); @@ -673,7 +686,7 @@ private void OnExtractKeywordsHTML(KeywordData keywordData, string data) private void OnExtractKeywordsText(KeywordData keywordData, string data) { Test(keywordData.status == "OK"); - if(keywordData != null) + if (keywordData != null) { m_GetKeywordExtractionTextTested = true; LogKeywordData(keywordData, data); @@ -682,22 +695,22 @@ private void OnExtractKeywordsText(KeywordData keywordData, string data) private void LogKeywordData(KeywordData keywordData, string data) { - Log.Debug("TestAlchemyLanguage", "data: {0}", data); - if(keywordData != null) + Log.Debug("TestAlchemyAPI", "data: {0}", data); + if (keywordData != null) { - Log.Debug("TestAlchemyLanguage", "status: {0}", keywordData.status); - Log.Debug("TestAlchemyLanguage", "url: {0}", keywordData.url); - Log.Debug("TestAlchemyLanguage", "language: {0}", keywordData.language); - Log.Debug("TestAlchemyLanguage", "text: {0}", keywordData.text); - if(keywordData == null || keywordData.keywords.Length == 0) - Log.Debug("TestAlchemyLanguage", "No keywords found!"); + Log.Debug("TestAlchemyAPI", "status: {0}", keywordData.status); + Log.Debug("TestAlchemyAPI", "url: {0}", keywordData.url); + Log.Debug("TestAlchemyAPI", "language: {0}", keywordData.language); + Log.Debug("TestAlchemyAPI", "text: {0}", keywordData.text); + if (keywordData == null || keywordData.keywords.Length == 0) + Log.Debug("TestAlchemyAPI", "No keywords found!"); else - foreach(Keyword keyword in keywordData.keywords) - Log.Debug("TestAlchemyLanguage", "text: {0}, relevance: {1}", keyword.text, keyword.relevance); + foreach (Keyword keyword in keywordData.keywords) + Log.Debug("TestAlchemyAPI", "text: {0}, relevance: {1}", keyword.text, keyword.relevance); } else { - Log.Debug("TestAlchemyLanguage", "Failed to find Keywords!"); + Log.Debug("TestAlchemyAPI", "Failed to find Keywords!"); } } #endregion @@ -706,7 +719,7 @@ private void LogKeywordData(KeywordData keywordData, string data) private void OnGetLanguagesURL(LanguageData languages, string data) { Test(languages.status == "OK"); - if(languages != null) + if (languages != null) { m_GetLanguageURLTested = true; LogLanguagesData(languages, data); @@ -716,7 +729,7 @@ private void OnGetLanguagesURL(LanguageData languages, string data) private void OnGetLanguagesHTML(LanguageData languages, string data) { Test(languages.status == "OK"); - if(languages != null) + if (languages != null) { m_GetLanguageHTMLTested = true; LogLanguagesData(languages, data); @@ -726,7 +739,7 @@ private void OnGetLanguagesHTML(LanguageData languages, string data) private void OnGetLanguagesText(LanguageData languages, string data) { Test(languages.status == "OK"); - if(languages != null) + if (languages != null) { m_GetLanguageTextTested = true; LogLanguagesData(languages, data); @@ -735,27 +748,27 @@ private void OnGetLanguagesText(LanguageData languages, string data) private void LogLanguagesData(LanguageData languages, string data) { - Log.Debug("TestAlchemyLanguage", "data: {0}", data); - if(languages != null) + Log.Debug("TestAlchemyAPI", "data: {0}", data); + if (languages != null) { - if(string.IsNullOrEmpty(languages.language)) - Log.Debug("TestAlchemyLanguage", "No languages detected!"); + if (string.IsNullOrEmpty(languages.language)) + Log.Debug("TestAlchemyAPI", "No languages detected!"); else { - Log.Debug("TestAlchemyLanguage", "status: {0}", languages.status); - Log.Debug("TestAlchemyLanguage", "url: {0}", languages.url); - Log.Debug("TestAlchemyLanguage", "language: {0}", languages.language); - Log.Debug("TestAlchemyLanguage", "ethnologue: {0}", languages.ethnologue); - Log.Debug("TestAlchemyLanguage", "iso_639_1: {0}", languages.iso_639_1); - Log.Debug("TestAlchemyLanguage", "iso_639_2: {0}", languages.iso_639_2); - Log.Debug("TestAlchemyLanguage", "iso_639_3: {0}", languages.iso_639_3); - Log.Debug("TestAlchemyLanguage", "native_speakers: {0}", languages.native_speakers); - Log.Debug("TestAlchemyLanguage", "wikipedia: {0}", languages.wikipedia); + Log.Debug("TestAlchemyAPI", "status: {0}", languages.status); + Log.Debug("TestAlchemyAPI", "url: {0}", languages.url); + Log.Debug("TestAlchemyAPI", "language: {0}", languages.language); + Log.Debug("TestAlchemyAPI", "ethnologue: {0}", languages.ethnologue); + Log.Debug("TestAlchemyAPI", "iso_639_1: {0}", languages.iso_639_1); + Log.Debug("TestAlchemyAPI", "iso_639_2: {0}", languages.iso_639_2); + Log.Debug("TestAlchemyAPI", "iso_639_3: {0}", languages.iso_639_3); + Log.Debug("TestAlchemyAPI", "native_speakers: {0}", languages.native_speakers); + Log.Debug("TestAlchemyAPI", "wikipedia: {0}", languages.wikipedia); } } else { - Log.Debug("TestAlchemyLanguage", "Failed to find Dates!"); + Log.Debug("TestAlchemyAPI", "Failed to find Dates!"); } } #endregion @@ -764,7 +777,7 @@ private void LogLanguagesData(LanguageData languages, string data) private void OnGetMicroformatsURL(MicroformatData microformats, string data) { Test(microformats.status == "OK"); - if(microformats != null) + if (microformats != null) { m_GetMicroformatURLTested = true; LogMicroformatData(microformats, data); @@ -774,7 +787,7 @@ private void OnGetMicroformatsURL(MicroformatData microformats, string data) private void OnGetMicroformatsHTML(MicroformatData microformats, string data) { Test(microformats.status == "OK"); - if(microformats != null) + if (microformats != null) { m_GetMicroformatHTMLTested = true; LogMicroformatData(microformats, data); @@ -783,22 +796,22 @@ private void OnGetMicroformatsHTML(MicroformatData microformats, string data) private void LogMicroformatData(MicroformatData microformats, string data) { - Log.Debug("TestAlchemyLanguage", "data: {0}", data); - if(microformats != null) + Log.Debug("TestAlchemyAPI", "data: {0}", data); + if (microformats != null) { - Log.Debug("TestAlchemyLanguage", "status: {0}", microformats.status); - Log.Debug("TestAlchemyLanguage", "url: {0}", microformats.url); - if(microformats.microformats.Length == 0) - Log.Warning("TestAlchemyLanguage", "No microformats found!"); + Log.Debug("TestAlchemyAPI", "status: {0}", microformats.status); + Log.Debug("TestAlchemyAPI", "url: {0}", microformats.url); + if (microformats.microformats.Length == 0) + Log.Warning("TestAlchemyAPI", "No microformats found!"); else { - foreach(Microformat microformat in microformats.microformats) - Log.Debug("TestAlchemyLanguage", "field: {0}, data: {1}.", microformat.field, microformat.data); + foreach (Microformat microformat in microformats.microformats) + Log.Debug("TestAlchemyAPI", "field: {0}, data: {1}.", microformat.field, microformat.data); } } else { - Log.Debug("TestAlchemyLanguage", "Failed to find Microformats!"); + Log.Debug("TestAlchemyAPI", "Failed to find Microformats!"); } } #endregion @@ -807,7 +820,7 @@ private void LogMicroformatData(MicroformatData microformats, string data) private void OnGetPublicationDateURL(PubDateData pubDates, string data) { Test(pubDates.status == "OK"); - if(pubDates != null) + if (pubDates != null) { m_GetPubDateURLTested = true; LogPublicationDateData(pubDates, data); @@ -817,7 +830,7 @@ private void OnGetPublicationDateURL(PubDateData pubDates, string data) private void OnGetPublicationDateHTML(PubDateData pubDates, string data) { Test(pubDates.status == "OK"); - if(pubDates != null) + if (pubDates != null) { m_GetPubldateHTMLTested = true; LogPublicationDateData(pubDates, data); @@ -826,20 +839,20 @@ private void OnGetPublicationDateHTML(PubDateData pubDates, string data) private void LogPublicationDateData(PubDateData pubDates, string data) { - Log.Debug("TestAlchemyLanguage", "data: {0}", data); - if(pubDates != null) + Log.Debug("TestAlchemyAPI", "data: {0}", data); + if (pubDates != null) { - Log.Debug("TestAlchemyLanguage", "status: {0}", pubDates.status); - Log.Debug("TestAlchemyLanguage", "url: {0}", pubDates.url); - Log.Debug("TestAlchemyLanguage", "language: {0}", pubDates.language); - if(pubDates.publicationDate != null) - Log.Debug("TestAlchemyLanguage", "date: {0}, confident: {1}", pubDates.publicationDate.date, pubDates.publicationDate.confident); + Log.Debug("TestAlchemyAPI", "status: {0}", pubDates.status); + Log.Debug("TestAlchemyAPI", "url: {0}", pubDates.url); + Log.Debug("TestAlchemyAPI", "language: {0}", pubDates.language); + if (pubDates.publicationDate != null) + Log.Debug("TestAlchemyAPI", "date: {0}, confident: {1}", pubDates.publicationDate.date, pubDates.publicationDate.confident); else - Log.Debug("TestAlchemyLanguage", "Failed to find Publication Dates!"); + Log.Debug("TestAlchemyAPI", "Failed to find Publication Dates!"); } else { - Log.Debug("TestAlchemyLanguage", "Failed to find Publication Dates!"); + Log.Debug("TestAlchemyAPI", "Failed to find Publication Dates!"); } } #endregion @@ -848,7 +861,7 @@ private void LogPublicationDateData(PubDateData pubDates, string data) private void OnGetRelationsURL(RelationsData relationsData, string data) { Test(relationsData.status == "OK"); - if(relationsData != null) + if (relationsData != null) { m_GetRelationsURLTested = true; LogRelationsData(relationsData, data); @@ -858,7 +871,7 @@ private void OnGetRelationsURL(RelationsData relationsData, string data) private void OnGetRelationsHTML(RelationsData relationsData, string data) { Test(relationsData.status == "OK"); - if(relationsData != null) + if (relationsData != null) { m_GetRelationsHTMLTested = true; LogRelationsData(relationsData, data); @@ -868,7 +881,7 @@ private void OnGetRelationsHTML(RelationsData relationsData, string data) private void OnGetRelationsText(RelationsData relationsData, string data) { Test(relationsData.status == "OK"); - if(relationsData != null) + if (relationsData != null) { m_GetRelationsTextTested = true; LogRelationsData(relationsData, data); @@ -877,23 +890,23 @@ private void OnGetRelationsText(RelationsData relationsData, string data) private void LogRelationsData(RelationsData relationsData, string data) { - Log.Debug("TestAlchemyLanguage", "data: {0}", data); - if(relationsData != null) + Log.Debug("TestAlchemyAPI", "data: {0}", data); + if (relationsData != null) { - Log.Debug("TestAlchemyLanguage", "status: {0}", relationsData.status); - Log.Debug("TestAlchemyLanguage", "url: {0}", relationsData.url); - Log.Debug("TestAlchemyLanguage", "language: {0}", relationsData.language); - Log.Debug("TestAlchemyLanguage", "text: {0}", relationsData.text); - if(relationsData.relations == null || relationsData.relations.Length == 0) - Log.Debug("TestAlchemyLanguage", "No relations found!"); + Log.Debug("TestAlchemyAPI", "status: {0}", relationsData.status); + Log.Debug("TestAlchemyAPI", "url: {0}", relationsData.url); + Log.Debug("TestAlchemyAPI", "language: {0}", relationsData.language); + Log.Debug("TestAlchemyAPI", "text: {0}", relationsData.text); + if (relationsData.relations == null || relationsData.relations.Length == 0) + Log.Debug("TestAlchemyAPI", "No relations found!"); else - foreach(Relation relation in relationsData.relations) - if(relation.subject != null && !string.IsNullOrEmpty(relation.subject.text)) - Log.Debug("TestAlchemyLanguage", "Text: {0}, Date: {1}", relation.sentence, relation.subject.text); + foreach (Relation relation in relationsData.relations) + if (relation.subject != null && !string.IsNullOrEmpty(relation.subject.text)) + Log.Debug("TestAlchemyAPI", "Text: {0}, Date: {1}", relation.sentence, relation.subject.text); } else { - Log.Debug("TestAlchemyLanguage", "Failed to find Relations!"); + Log.Debug("TestAlchemyAPI", "Failed to find Relations!"); } } #endregion @@ -902,7 +915,7 @@ private void LogRelationsData(RelationsData relationsData, string data) private void OnGetTextSentimentURL(SentimentData sentimentData, string data) { Test(sentimentData.status == "OK"); - if(sentimentData != null) + if (sentimentData != null) { m_GetTextSentimentURLTested = true; LogTextSentiment(sentimentData, data); @@ -912,7 +925,7 @@ private void OnGetTextSentimentURL(SentimentData sentimentData, string data) private void OnGetTextSentimentHTML(SentimentData sentimentData, string data) { Test(sentimentData.status == "OK"); - if(sentimentData != null) + if (sentimentData != null) { m_GetTextSentimentHTMLTested = true; LogTextSentiment(sentimentData, data); @@ -922,7 +935,7 @@ private void OnGetTextSentimentHTML(SentimentData sentimentData, string data) private void OnGetTextSentimentText(SentimentData sentimentData, string data) { Test(sentimentData.status == "OK"); - if(sentimentData != null) + if (sentimentData != null) { m_GetTextSentimentTextTested = true; LogTextSentiment(sentimentData, data); @@ -931,22 +944,22 @@ private void OnGetTextSentimentText(SentimentData sentimentData, string data) private void LogTextSentiment(SentimentData sentimentData, string data) { - Log.Debug("TestAlchemyLanguage", "data: {0}", data); - if(sentimentData != null) + Log.Debug("TestAlchemyAPI", "data: {0}", data); + if (sentimentData != null) { - Log.Debug("TestAlchemyLanguage", "status: {0}", sentimentData.status); - Log.Debug("TestAlchemyLanguage", "url: {0}", sentimentData.url); - Log.Debug("TestAlchemyLanguage", "language: {0}", sentimentData.language); - Log.Debug("TestAlchemyLanguage", "text: {0}", sentimentData.text); - if(sentimentData.docSentiment == null) - Log.Debug("TestAlchemyLanguage", "No sentiment found!"); + Log.Debug("TestAlchemyAPI", "status: {0}", sentimentData.status); + Log.Debug("TestAlchemyAPI", "url: {0}", sentimentData.url); + Log.Debug("TestAlchemyAPI", "language: {0}", sentimentData.language); + Log.Debug("TestAlchemyAPI", "text: {0}", sentimentData.text); + if (sentimentData.docSentiment == null) + Log.Debug("TestAlchemyAPI", "No sentiment found!"); else - if(sentimentData.docSentiment != null && !string.IsNullOrEmpty(sentimentData.docSentiment.type)) - Log.Debug("TestAlchemyLanguage", "Sentiment: {0}, Score: {1}", sentimentData.docSentiment.type, sentimentData.docSentiment.score); + if (sentimentData.docSentiment != null && !string.IsNullOrEmpty(sentimentData.docSentiment.type)) + Log.Debug("TestAlchemyAPI", "Sentiment: {0}, Score: {1}", sentimentData.docSentiment.type, sentimentData.docSentiment.score); } else { - Log.Debug("TestAlchemyLanguage", "Failed to find Relations!"); + Log.Debug("TestAlchemyAPI", "Failed to find Relations!"); } } #endregion @@ -955,7 +968,7 @@ private void LogTextSentiment(SentimentData sentimentData, string data) private void OnGetTargetedSentimentURL(TargetedSentimentData sentimentData, string data) { Test(sentimentData.status == "OK"); - if(sentimentData != null) + if (sentimentData != null) { m_GetTargetedSentimentURLTested = true; LogTargetedSentiment(sentimentData, data); @@ -965,7 +978,7 @@ private void OnGetTargetedSentimentURL(TargetedSentimentData sentimentData, stri private void OnGetTargetedSentimentHTML(TargetedSentimentData sentimentData, string data) { Test(sentimentData.status == "OK"); - if(sentimentData != null) + if (sentimentData != null) { m_GetTargetedSentimentHTMLTested = true; LogTargetedSentiment(sentimentData, data); @@ -975,7 +988,7 @@ private void OnGetTargetedSentimentHTML(TargetedSentimentData sentimentData, str private void OnGetTargetedSentimentText(TargetedSentimentData sentimentData, string data) { Test(sentimentData.status == "OK"); - if(sentimentData != null) + if (sentimentData != null) { m_GetTargetedSentimentTextTested = true; LogTargetedSentiment(sentimentData, data); @@ -984,25 +997,25 @@ private void OnGetTargetedSentimentText(TargetedSentimentData sentimentData, str private void LogTargetedSentiment(TargetedSentimentData sentimentData, string data) { - Log.Debug("TestAlchemyLanguage", "data: {0}", data); - if(sentimentData != null) + Log.Debug("TestAlchemyAPI", "data: {0}", data); + if (sentimentData != null) { - Log.Debug("TestAlchemyLanguage", "status: {0}", sentimentData.status); - Log.Debug("TestAlchemyLanguage", "url: {0}", sentimentData.url); - Log.Debug("TestAlchemyLanguage", "language: {0}", sentimentData.language); - Log.Debug("TestAlchemyLanguage", "text: {0}", sentimentData.text); - if(sentimentData.results == null) - Log.Debug("TestAlchemyLanguage", "No sentiment found!"); + Log.Debug("TestAlchemyAPI", "status: {0}", sentimentData.status); + Log.Debug("TestAlchemyAPI", "url: {0}", sentimentData.url); + Log.Debug("TestAlchemyAPI", "language: {0}", sentimentData.language); + Log.Debug("TestAlchemyAPI", "text: {0}", sentimentData.text); + if (sentimentData.results == null) + Log.Debug("TestAlchemyAPI", "No sentiment found!"); + else + if (sentimentData.results == null || sentimentData.results.Length == 0) + Log.Warning("TestAlchemyAPI", "No sentiment results!"); else - if(sentimentData.results == null || sentimentData.results.Length == 0) - Log.Warning("TestAlchemyLanguage", "No sentiment results!"); - else - foreach(TargetedSentiment result in sentimentData.results) - Log.Debug("TestAlchemyLanguage", "text: {0}, sentiment: {1}, score: {2}", result.text, result.sentiment.score, result.sentiment.type); + foreach (TargetedSentiment result in sentimentData.results) + Log.Debug("TestAlchemyAPI", "text: {0}, sentiment: {1}, score: {2}", result.text, result.sentiment.score, result.sentiment.type); } else { - Log.Debug("TestAlchemyLanguage", "Failed to find Relations!"); + Log.Debug("TestAlchemyAPI", "Failed to find Relations!"); } } #endregion @@ -1011,7 +1024,7 @@ private void LogTargetedSentiment(TargetedSentimentData sentimentData, string da private void OnGetRankedTaxonomyURL(TaxonomyData taxonomyData, string data) { Test(taxonomyData.status == "OK"); - if(taxonomyData != null) + if (taxonomyData != null) { m_GetRankedTaxonomyURLTested = true; LogRankedTaxonomy(taxonomyData, data); @@ -1021,7 +1034,7 @@ private void OnGetRankedTaxonomyURL(TaxonomyData taxonomyData, string data) private void OnGetRankedTaxonomyHTML(TaxonomyData taxonomyData, string data) { Test(taxonomyData.status == "OK"); - if(taxonomyData != null) + if (taxonomyData != null) { m_GetRankedTaxonomyHTMLTested = true; LogRankedTaxonomy(taxonomyData, data); @@ -1031,7 +1044,7 @@ private void OnGetRankedTaxonomyHTML(TaxonomyData taxonomyData, string data) private void OnGetRankedTaxonomyText(TaxonomyData taxonomyData, string data) { Test(taxonomyData.status == "OK"); - if(taxonomyData != null) + if (taxonomyData != null) { m_GetRankedTaxonomyTextTested = true; LogRankedTaxonomy(taxonomyData, data); @@ -1040,25 +1053,25 @@ private void OnGetRankedTaxonomyText(TaxonomyData taxonomyData, string data) private void LogRankedTaxonomy(TaxonomyData taxonomyData, string data) { - Log.Debug("TestAlchemyLanguage", "data: {0}", data); - if(taxonomyData != null) + Log.Debug("TestAlchemyAPI", "data: {0}", data); + if (taxonomyData != null) { - Log.Debug("TestAlchemyLanguage", "status: {0}", taxonomyData.status); - Log.Debug("TestAlchemyLanguage", "url: {0}", taxonomyData.url); - Log.Debug("TestAlchemyLanguage", "language: {0}", taxonomyData.language); - Log.Debug("TestAlchemyLanguage", "text: {0}", taxonomyData.text); - if(taxonomyData.taxonomy == null) - Log.Debug("TestAlchemyLanguage", "No taxonomy found!"); + Log.Debug("TestAlchemyAPI", "status: {0}", taxonomyData.status); + Log.Debug("TestAlchemyAPI", "url: {0}", taxonomyData.url); + Log.Debug("TestAlchemyAPI", "language: {0}", taxonomyData.language); + Log.Debug("TestAlchemyAPI", "text: {0}", taxonomyData.text); + if (taxonomyData.taxonomy == null) + Log.Debug("TestAlchemyAPI", "No taxonomy found!"); else - if(taxonomyData.taxonomy == null || taxonomyData.taxonomy.Length == 0) - Log.Warning("TestAlchemyLanguage", "No taxonomy results!"); - else - foreach(Taxonomy taxonomy in taxonomyData.taxonomy) - Log.Debug("TestAlchemyLanguage", "label: {0}, score: {1}", taxonomy.label, taxonomy.score); + if (taxonomyData.taxonomy == null || taxonomyData.taxonomy.Length == 0) + Log.Warning("TestAlchemyAPI", "No taxonomy results!"); + else + foreach (Taxonomy taxonomy in taxonomyData.taxonomy) + Log.Debug("TestAlchemyAPI", "label: {0}, score: {1}", taxonomy.label, taxonomy.score); } else { - Log.Debug("TestAlchemyLanguage", "Failed to find Relations!"); + Log.Debug("TestAlchemyAPI", "Failed to find Relations!"); } } #endregion @@ -1067,7 +1080,7 @@ private void LogRankedTaxonomy(TaxonomyData taxonomyData, string data) private void OnGetTextURL(TextData textData, string data) { Test(textData.status == "OK"); - if(textData != null) + if (textData != null) { m_GetTextURLTested = true; LogTextData(textData, data); @@ -1077,7 +1090,7 @@ private void OnGetTextURL(TextData textData, string data) private void OnGetTextHTML(TextData textData, string data) { Test(textData.status == "OK"); - if(textData != null) + if (textData != null) { m_GetTextHTMLTested = true; LogTextData(textData, data); @@ -1086,16 +1099,16 @@ private void OnGetTextHTML(TextData textData, string data) private void LogTextData(TextData textData, string data) { - Log.Debug("TestAlchemyLanguage", "data: {0}", data); - if(textData != null) + Log.Debug("TestAlchemyAPI", "data: {0}", data); + if (textData != null) { - Log.Debug("TestAlchemyLanguage", "status: {0}", textData.status); - Log.Debug("TestAlchemyLanguage", "url: {0}", textData.url); - Log.Debug("TestAlchemyLanguage", "text: {0}", textData.text); + Log.Debug("TestAlchemyAPI", "status: {0}", textData.status); + Log.Debug("TestAlchemyAPI", "url: {0}", textData.url); + Log.Debug("TestAlchemyAPI", "text: {0}", textData.text); } else { - Log.Debug("TestAlchemyLanguage", "Failed to find text!"); + Log.Debug("TestAlchemyAPI", "Failed to find text!"); } } @@ -1105,7 +1118,7 @@ private void LogTextData(TextData textData, string data) private void OnGetRawTextURL(TextData textData, string data) { Test(textData.status == "OK"); - if(textData != null) + if (textData != null) { m_GetRawTextURLTested = true; LogRawTextData(textData, data); @@ -1115,7 +1128,7 @@ private void OnGetRawTextURL(TextData textData, string data) private void OnGetRawTextHTML(TextData textData, string data) { Test(textData.status == "OK"); - if(textData != null) + if (textData != null) { m_GetRawTextHTMLTested = true; LogRawTextData(textData, data); @@ -1124,16 +1137,16 @@ private void OnGetRawTextHTML(TextData textData, string data) private void LogRawTextData(TextData textData, string data) { - Log.Debug("TestAlchemyLanguage", "data: {0}", data); - if(textData != null) + Log.Debug("TestAlchemyAPI", "data: {0}", data); + if (textData != null) { - Log.Debug("TestAlchemyLanguage", "status: {0}", textData.status); - Log.Debug("TestAlchemyLanguage", "url: {0}", textData.url); - Log.Debug("TestAlchemyLanguage", "text: {0}", textData.text); + Log.Debug("TestAlchemyAPI", "status: {0}", textData.status); + Log.Debug("TestAlchemyAPI", "url: {0}", textData.url); + Log.Debug("TestAlchemyAPI", "text: {0}", textData.text); } else { - Log.Debug("TestAlchemyLanguage", "Failed to find text!"); + Log.Debug("TestAlchemyAPI", "Failed to find text!"); } } @@ -1143,7 +1156,7 @@ private void LogRawTextData(TextData textData, string data) private void OnGetTitleURL(Title titleData, string data) { Test(titleData.status == "OK"); - if(titleData != null) + if (titleData != null) { m_GetTitleURLTested = true; LogTitleData(titleData, data); @@ -1153,7 +1166,7 @@ private void OnGetTitleURL(Title titleData, string data) private void OnGetTitleHTML(Title titleData, string data) { Test(titleData.status == "OK"); - if(titleData != null) + if (titleData != null) { m_GetTitleHTMLTested = true; LogTitleData(titleData, data); @@ -1162,16 +1175,16 @@ private void OnGetTitleHTML(Title titleData, string data) private void LogTitleData(Title titleData, string data) { - Log.Debug("TestAlchemyLanguage", "data: {0}", data); - if(titleData != null) + Log.Debug("TestAlchemyAPI", "data: {0}", data); + if (titleData != null) { - Log.Debug("TestAlchemyLanguage", "status: {0}", titleData.status); - Log.Debug("TestAlchemyLanguage", "url: {0}", titleData.url); - Log.Debug("TestAlchemyLanguage", "text: {0}", titleData.title); + Log.Debug("TestAlchemyAPI", "status: {0}", titleData.status); + Log.Debug("TestAlchemyAPI", "url: {0}", titleData.url); + Log.Debug("TestAlchemyAPI", "text: {0}", titleData.title); } else { - Log.Debug("TestAlchemyLanguage", "Failed to find title!"); + Log.Debug("TestAlchemyAPI", "Failed to find title!"); } } @@ -1181,7 +1194,7 @@ private void LogTitleData(Title titleData, string data) private void OnGetCombinedDataURL(CombinedCallData combinedData, string data) { Test(combinedData.status == "OK"); - if(combinedData != null) + if (combinedData != null) { m_GetCombinedDataURLTested = true; LogCombinedData(combinedData, data); @@ -1191,7 +1204,7 @@ private void OnGetCombinedDataURL(CombinedCallData combinedData, string data) private void OnGetCombinedDataHTML(CombinedCallData combinedData, string data) { Test(combinedData.status == "OK"); - if(combinedData != null) + if (combinedData != null) { m_GetCombinedDataHTMLTested = true; LogCombinedData(combinedData, data); @@ -1201,7 +1214,7 @@ private void OnGetCombinedDataHTML(CombinedCallData combinedData, string data) private void OnGetCombinedDataText(CombinedCallData combinedData, string data) { Test(combinedData.status == "OK"); - if(combinedData != null) + if (combinedData != null) { m_GetCombinedDataTextTested = true; LogCombinedData(combinedData, data); @@ -1210,67 +1223,92 @@ private void OnGetCombinedDataText(CombinedCallData combinedData, string data) private void LogCombinedData(CombinedCallData combinedData, string data) { - Log.Debug("TestAlchemyLanguage", "data: {0}", data); - if(combinedData != null) + Log.Debug("TestAlchemyAPI", "data: {0}", data); + if (combinedData != null) { - Log.Debug("TestAlchemyLanguage", "status: {0}", combinedData.status); - Log.Debug("TestAlchemyLanguage", "url: {0}", combinedData.url); - Log.Debug("TestAlchemyLanguage", "language: {0}", combinedData.language); - Log.Debug("TestAlchemyLanguage", "text: {0}", combinedData.text); - Log.Debug("TestAlchemyLanguage", "image: {0}", combinedData.image); + Log.Debug("TestAlchemyAPI", "status: {0}", combinedData.status); + Log.Debug("TestAlchemyAPI", "url: {0}", combinedData.url); + Log.Debug("TestAlchemyAPI", "language: {0}", combinedData.language); + Log.Debug("TestAlchemyAPI", "text: {0}", combinedData.text); + Log.Debug("TestAlchemyAPI", "image: {0}", combinedData.image); - if(combinedData.imageKeywords != null && combinedData.imageKeywords.Length > 0) - foreach(ImageKeyword imageKeyword in combinedData.imageKeywords) - Log.Debug("TestAlchemyLanguage", "ImageKeyword: {0}, Score: {1}", imageKeyword.text, imageKeyword.score); + if (combinedData.imageKeywords != null && combinedData.imageKeywords.Length > 0) + foreach (ImageKeyword imageKeyword in combinedData.imageKeywords) + Log.Debug("TestAlchemyAPI", "ImageKeyword: {0}, Score: {1}", imageKeyword.text, imageKeyword.score); - if(combinedData.publicationDate != null) - Log.Debug("TestAlchemyLanguage", "publicationDate: {0}, Score: {1}", combinedData.publicationDate.date, combinedData.publicationDate.confident); + if (combinedData.publicationDate != null) + Log.Debug("TestAlchemyAPI", "publicationDate: {0}, Score: {1}", combinedData.publicationDate.date, combinedData.publicationDate.confident); - if(combinedData.authors != null && combinedData.authors.names.Length > 0) - foreach(string authors in combinedData.authors.names) - Log.Debug("TestAlchemyLanguage", "Authors: {0}", authors); + if (combinedData.authors != null && combinedData.authors.names.Length > 0) + foreach (string authors in combinedData.authors.names) + Log.Debug("TestAlchemyAPI", "Authors: {0}", authors); - if(combinedData.docSentiment != null) - Log.Debug("TestAlchemyLanguage", "DocSentiment: {0}, Score: {1}, Mixed: {2}", combinedData.docSentiment.type, combinedData.docSentiment.score, combinedData.docSentiment.mixed); + if (combinedData.docSentiment != null) + Log.Debug("TestAlchemyAPI", "DocSentiment: {0}, Score: {1}, Mixed: {2}", combinedData.docSentiment.type, combinedData.docSentiment.score, combinedData.docSentiment.mixed); - if(combinedData.feeds != null && combinedData.feeds.Length > 0) - foreach(Feed feed in combinedData.feeds) - Log.Debug("TestAlchemyLanguage", "Feeds: {0}", feed.feed); + if (combinedData.feeds != null && combinedData.feeds.Length > 0) + foreach (Feed feed in combinedData.feeds) + Log.Debug("TestAlchemyAPI", "Feeds: {0}", feed.feed); - if(combinedData.keywords != null && combinedData.keywords.Length > 0) - foreach(Keyword keyword in combinedData.keywords) - Log.Debug("TestAlchemyLanguage", "Keyword: {0}, relevance: {1}", keyword.text, keyword.relevance); + if (combinedData.keywords != null && combinedData.keywords.Length > 0) + foreach (Keyword keyword in combinedData.keywords) + Log.Debug("TestAlchemyAPI", "Keyword: {0}, relevance: {1}", keyword.text, keyword.relevance); - if(combinedData.concepts != null && combinedData.concepts.Length > 0) - foreach(Concept concept in combinedData.concepts) - Log.Debug("TestAlchemyLanguage", "Concept: {0}, Relevance: {1}", concept.text, concept.relevance); + if (combinedData.concepts != null && combinedData.concepts.Length > 0) + foreach (Concept concept in combinedData.concepts) + Log.Debug("TestAlchemyAPI", "Concept: {0}, Relevance: {1}", concept.text, concept.relevance); - if(combinedData.entities != null && combinedData.entities.Length > 0) - foreach(Entity entity in combinedData.entities) - Log.Debug("TestAlchemyLanguage", "Entity: {0}, Type: {1}, Relevance: {2}", entity.text, entity.type, entity.relevance); + if (combinedData.entities != null && combinedData.entities.Length > 0) + foreach (Entity entity in combinedData.entities) + Log.Debug("TestAlchemyAPI", "Entity: {0}, Type: {1}, Relevance: {2}", entity.text, entity.type, entity.relevance); - if(combinedData.relations != null && combinedData.relations.Length > 0) - foreach(Relation relation in combinedData.relations) - Log.Debug("TestAlchemyLanguage", "Relations: {0}", relation.subject.text); + if (combinedData.relations != null && combinedData.relations.Length > 0) + foreach (Relation relation in combinedData.relations) + Log.Debug("TestAlchemyAPI", "Relations: {0}", relation.subject.text); - if(combinedData.taxonomy != null && combinedData.taxonomy.Length > 0) - foreach(Taxonomy taxonomy in combinedData.taxonomy) - Log.Debug("TestAlchemyLanguage", "Taxonomy: {0}, Score: {1}, Confident: {2}" ,taxonomy.label, taxonomy.score, taxonomy.confident); + if (combinedData.taxonomy != null && combinedData.taxonomy.Length > 0) + foreach (Taxonomy taxonomy in combinedData.taxonomy) + Log.Debug("TestAlchemyAPI", "Taxonomy: {0}, Score: {1}, Confident: {2}", taxonomy.label, taxonomy.score, taxonomy.confident); - if(combinedData.dates != null && combinedData.dates.Length > 0) - foreach(Date date in combinedData.dates) - Log.Debug("TestAlchemyLanguage", "Dates", date.text, date.date); + if (combinedData.dates != null && combinedData.dates.Length > 0) + foreach (Date date in combinedData.dates) + Log.Debug("TestAlchemyAPI", "Dates", date.text, date.date); - if(combinedData.docEmotions != null && combinedData.docEmotions.Length > 0) - foreach(DocEmotions emotions in combinedData.docEmotions) - Log.Debug("TestAlchemyLanguage", "Doc Emotions: anger: {0}, disgust: {1}, fear: {2}, joy: {3}, sadness: {4}", emotions.anger, emotions.disgust, emotions.fear, emotions.joy, emotions.sadness); + if (combinedData.docEmotions != null && combinedData.docEmotions.Length > 0) + foreach (DocEmotions emotions in combinedData.docEmotions) + Log.Debug("TestAlchemyAPI", "Doc Emotions: anger: {0}, disgust: {1}, fear: {2}, joy: {3}, sadness: {4}", emotions.anger, emotions.disgust, emotions.fear, emotions.joy, emotions.sadness); } else { - Log.Debug("TestAlchemyLanguage", "Failed to get combined data!"); + Log.Debug("TestAlchemyAPI", "Failed to get combined data!"); } } #endregion + + #region GetNews + private void OnGetNews(NewsResponse newsData, string data) + { + Test(newsData.status == "OK"); + if (newsData != null) + { + m_GetNewsTested = true; + LogNewsData(newsData, data); + } + } + + private void LogNewsData(NewsResponse newsData, string data) + { + Log.Debug("TestAlchemyNews", "data: {0}", data); + if (newsData != null) + { + Log.Debug("TestAlchemyNews", "status: {0}", newsData.status); + + } + else + { + Log.Debug("TestAlchemyNews", "Failed to get news data!"); + } + } + #endregion } } - \ No newline at end of file