diff --git a/rosette_api/CAPI.cs b/rosette_api/CAPI.cs index c09d6cbe..32d5e761 100755 --- a/rosette_api/CAPI.cs +++ b/rosette_api/CAPI.cs @@ -277,56 +277,6 @@ public CategoriesResponse Categories(RosetteFile file) { return Process(file); } - /// deprecated - /// EntitiesLinked - /// - /// (POST)EntitiesLinked Endpoint: Links entities in the input to entities in the knowledge base. - /// - /// - /// (string, optional): Input to process (JSON string or base64 encoding of non-JSON string) - /// (string, optional): Language: ISO 639-3 code (ignored for the /language endpoint) - /// (string, optional): not used at this time - /// (string, optional): URI to accessible content (content and contentUri are mutually exclusive) - /// (string, optional): genre to categorize the input data - /// EntitiesResponse containing the results of the request. - /// - [Obsolete("Use Entity endpoint.")] - public EntitiesResponse EntitiesLinked(string content = null, string language = null, string contentType = null, string contentUri = null, string genre = null) - { - return Entity(content, language, contentType, contentUri, true, genre); - } - - /// deprecated - /// EntitiesLinked - /// - /// (POST)EntitiesLinked Endpoint: Links entities in the input to entities in the knowledge base. - /// - /// - /// Dictionary<object, object>: Dictionary containing parameters as (key,value) pairs - /// EntitiesResponse containing the results of the request. - /// - [Obsolete("Use Entity endpoint.")] - public EntitiesResponse EntitiesLinked(Dictionary dict) - { - return Entity(dict, true); - } - - /// deprecated - /// EntitiesLinked - /// - /// (POST)EntitiesLinked Endpoint: Links entities in the input to entities in the knowledge base. - /// - /// - /// RosetteFile: RosetteFile Object containing the file (and possibly options) to upload - /// EntitiesResponse containing the results of the request. - /// - [Obsolete("Use Entity endpoint.")] - public EntitiesResponse EntitiesLinked(RosetteFile file) - { - return Entity(file, true); - } - - /// Entity /// /// (POST)Entity Endpoint: Returns each entity extracted from the input. @@ -336,13 +286,12 @@ public EntitiesResponse EntitiesLinked(RosetteFile file) /// (string, optional): Language: ISO 639-3 code (ignored for the /language endpoint) /// (string, optional): not used at this time /// (string, optional): URI to accessible content (content and contentUri are mutually exclusive) - /// (string, optional): use /entities/linked as opposed to /entities /// (string, optional): genre to categorize the input data /// EntitiesResponse containing the results of the request. /// - public EntitiesResponse Entity(string content = null, string language = null, string contentType = null, string contentUri = null, bool resolveEntities = false, string genre = null) + public EntitiesResponse Entity(string content = null, string language = null, string contentType = null, string contentUri = null, string genre = null) { - _uri = resolveEntities ? "entities/linked" : "entities"; + _uri = "entities"; return Process(content, language, contentType, contentUri, genre); } @@ -352,12 +301,11 @@ public EntitiesResponse Entity(string content = null, string language = null, st /// /// /// Dictionary<object, object>: Dictionary containing parameters as (key,value) pairs - /// (string, optional): use /entities/linked as opposed to /entities /// EntitiesResponse containing the results of the request. /// - public EntitiesResponse Entity(Dictionary dict, bool resolveEntities = false) + public EntitiesResponse Entity(Dictionary dict) { - _uri = resolveEntities ? "entities/linked" : "entities"; + _uri = "entities"; return getResponse(SetupClient(), new JavaScriptSerializer().Serialize(appendOptions(dict))); } @@ -367,11 +315,10 @@ public EntitiesResponse Entity(Dictionary dict, bool resolveEnti /// /// /// RosetteFile: RosetteFile Object containing the file (and possibly options) to upload - /// (string, optional): use /entities/linked as opposed to /entities /// EntitiesResponse containing the results of the request. /// - public EntitiesResponse Entity(RosetteFile file, bool resolveEntities = false) { - _uri = resolveEntities ? "entities/linked" : "entities"; + public EntitiesResponse Entity(RosetteFile file) { + _uri = "entities"; return Process(file); } diff --git a/rosette_api/Properties/AssemblyInfo.cs b/rosette_api/Properties/AssemblyInfo.cs index 3750a404..b035a3ea 100644 --- a/rosette_api/Properties/AssemblyInfo.cs +++ b/rosette_api/Properties/AssemblyInfo.cs @@ -31,6 +31,6 @@ // // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: -// [assembly: AssemblyVersion("1.4.1.0")] -[assembly: AssemblyVersion("1.4.1.0")] -[assembly: AssemblyFileVersion("1.4.1.0")] +// [assembly: AssemblyVersion("1.5.0.0")] +[assembly: AssemblyVersion("1.5.0.0")] +[assembly: AssemblyFileVersion("1.5.0.0")] diff --git a/rosette_api/rosette_api.nuspec b/rosette_api/rosette_api.nuspec index 237dc98d..3ae19323 100644 --- a/rosette_api/rosette_api.nuspec +++ b/rosette_api/rosette_api.nuspec @@ -2,7 +2,7 @@ rosette_api - 1.4.1 + 1.5.0 basistech basistech http://www.apache.org/licenses/LICENSE-2.0 diff --git a/rosette_apiExamples/README.md b/rosette_apiExamples/README.md index 890ff896..52afbfab 100644 --- a/rosette_apiExamples/README.md +++ b/rosette_apiExamples/README.md @@ -30,7 +30,6 @@ Each example, when run, prints its output to the console. | ------------- |------------- | | categories.cs | Gets the category of a document at a URL | | entities.cs | Gets the entities from a piece of text | -| entities_linked.cs | Gets the linked (to Wikipedia) entities from a piece of text | | info.cs | Gets information about Rosette API | | language.cs | Gets the language of a piece of text | | matched-name.cs | Gets the similarity score of two names | diff --git a/rosette_apiExamples/entities.cs b/rosette_apiExamples/entities.cs index ad6ac5cc..ad60f955 100644 --- a/rosette_apiExamples/entities.cs +++ b/rosette_apiExamples/entities.cs @@ -33,7 +33,7 @@ static void Main(string[] args) CAPI EntitiesCAPI = string.IsNullOrEmpty(alturl) ? new CAPI(apikey) : new CAPI(apikey, alturl); string entities_text_data = @"Bill Murray will appear in new Ghostbusters film: Dr. Peter Venkman was spotted filming a cameo in Boston this… http://dlvr.it/BnsFfS"; //The results of the API call will come back in the form of a Dictionary - EntitiesResponse response = EntitiesCAPI.Entity(entities_text_data, null, null, null, false, "social-media"); + EntitiesResponse response = EntitiesCAPI.Entity(entities_text_data, null, null, null, "social-media"); foreach (KeyValuePair h in response.Headers) { Console.WriteLine(string.Format("{0}:{1}", h.Key, h.Value)); } diff --git a/rosette_apiExamples/entities_linked.cs b/rosette_apiExamples/entities_linked.cs deleted file mode 100644 index dd216ba0..00000000 --- a/rosette_apiExamples/entities_linked.cs +++ /dev/null @@ -1,48 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using System.Web.Script.Serialization; -using rosette_api; - -namespace rosette_apiExamples -{ - class entities_linked - { - /// - /// Example code to call Rosette API to get linked (against Wikipedia) entities from a piece of text. - /// Requires Nuget Package: - /// rosette_api - /// - static void Main(string[] args) - { - //To use the C# API, you must provide an API key - string apikey = "Your API key"; - string alturl = string.Empty; - - //You may set the API key via command line argument: - //entities_linked yourapikeyhere - if (args.Length != 0) - { - apikey = args[0]; - alturl = args.Length > 1 ? args[1] : string.Empty; - } - try - { - CAPI EntitiesLinkedCAPI = string.IsNullOrEmpty(alturl) ? new CAPI(apikey) : new CAPI(apikey, alturl); - string entities_linked_text_data = @"Last month director Paul Feig announced the movie will have an all-star female cast including Kristen Wiig, Melissa McCarthy, Leslie Jones and Kate McKinnon."; - //The results of the API call will come back in the form of a Dictionary - RosetteResponse response = EntitiesLinkedCAPI.Entity(entities_linked_text_data, null, null, null, true, "social-media"); - foreach (KeyValuePair h in response.Headers) { - Console.WriteLine(string.Format("{0}:{1}", h.Key, h.Value)); - } - Console.WriteLine(response.ContentAsJson); - } - catch (Exception e) - { - Console.WriteLine("Exception: " + e.Message); - } - } - } -} diff --git a/rosette_apiUnitTests/rosette_apiUnitTests.cs b/rosette_apiUnitTests/rosette_apiUnitTests.cs index 07aec1ef..a53df5b5 100755 --- a/rosette_apiUnitTests/rosette_apiUnitTests.cs +++ b/rosette_apiUnitTests/rosette_apiUnitTests.cs @@ -65,6 +65,21 @@ public void doTest() { } } + /// + /// Live test for Relationships. To run, uncomment [Test] + /// + [TestFixture] + public class liveRelationshipTest { + //[Test] + public void doTest() { + + CAPI rosetteApi = new CAPI("boguskey", "http://jugmaster.basistech.net:8181/rest/v1", 1); + RelationshipsResponse result = rosetteApi.Relationships(@"Bill Gates, Microsoft's former CEO, is a philanthropist."); + System.Diagnostics.Debug.WriteLine(result.ToString()); + + } + } + [TestFixture] public class rosetteResponseTests { private string _testHeaderKey; @@ -599,41 +614,6 @@ public void Categories_File_Test() { # pragma warning restore 618 } - //------------------------- Entities Linked ---------------------------------------- - - [Test] - public void EntitiesLinked_Content_Test() { - _mockHttp.When(_testUrl + "entities/linked") - .Respond(HttpStatusCode.OK, "application/json", "{'response': 'OK'}"); - - var response = _rosetteApi.Entity("content", null, null, null, true); -# pragma warning disable 618 - Assert.AreEqual(response.Content["response"], "OK"); -# pragma warning restore 618 - } - - [Test] - public void EntitiesLinked_Dict_Test() { - _mockHttp.When(_testUrl + "entities/linked") - .Respond(HttpStatusCode.OK, "application/json", "{'response': 'OK'}"); - - var response = _rosetteApi.Entity(new Dictionary() { { "contentUri", "contentUrl" } }, true); -# pragma warning disable 618 - Assert.AreEqual(response.Content["response"], "OK"); -# pragma warning restore 618 - } - - [Test] - public void EntitiesLinked_File_Test() { - _mockHttp.When(_testUrl + "entities/linked") - .Respond("application/json", "{'response': 'OK'}"); - - RosetteFile f = new RosetteFile(_tmpFile); - var response = _rosetteApi.Entity(f, true); -# pragma warning disable 618 - Assert.AreEqual(response.Content["response"], "OK"); -# pragma warning restore 618 - } //------------------------- Entity ---------------------------------------- [Test]