diff --git a/README.md b/README.md index dbe3109..ce3d70e 100644 --- a/README.md +++ b/README.md @@ -1,20 +1,37 @@ - -# Rosette by Babel Street + + + + + Babel Street Logo + + + +# Analytics by Babel Street --- [![NuGet version](https://badge.fury.io/nu/rosette_api.svg)](https://badge.fury.io/nu/rosette_api) -Rosette uses natural language processing, statistical modeling, and machine learning to analyze unstructured and semi-structured text across hundreds of language-script combinations, revealing valuable information and actionable data. Rosette provides endpoints for extracting entities and relationships, translating and comparing the similarity of names, categorizing and adding linguistic tags to text and more. Rosette Server is the on-premises installation of Rosette, with access to Rosette's functions as RESTful web service endpoints. This solves cloud security worries and allows customization (models/indexes) as needed for your business. +Our product is a full text processing pipeline from data preparation to extracting the most relevant information and +analysis utilizing precise, focused AI that has built-in human understanding. Text Analytics provides foundational +linguistic analysis for identifying languages and relating words. The result is enriched and normalized text for +high-speed search and processing without translation. + +Text Analytics extracts events and entities — people, organizations, and places — from unstructured text and adds the +structure of associating those entities into events that deliver only the necessary information for near real-time +decision making. Accompanying tools shorten the process of training AI models to recognize domain-specific events. +The product delivers a multitude of ways to sharpen and expand search results. Semantic similarity expands search +beyond keywords to words with the same meaning, even in other languages. Sentiment analysis and topic extraction help +filter results to what’s relevant. -## Rosette API Access -- Rosette Cloud [Sign Up](https://developer.rosette.com/signup) +## Analytics API Access +- Analytics Cloud [Sign Up](https://developer.babelstreet.com/signup) ## Quick Start #### Installation -If you use Nuget, you may use either Visual Studio's Nuget package manager or command line to install the Rosette API binding. +If you use Nuget, you may use either Visual Studio's Nuget package manager or command line to install the Analytics API binding. In Visual Studio: search for the [rosette_api package](https://www.nuget.org/packages/rosette_api/) in Nuget and follow the installation instructions. @@ -30,16 +47,24 @@ in the [examples](https://github.com/rosette-api/csharp/tree/develop/rosette_api #### Documentation & Support - [Binding API](https://rosette-api.github.io/csharp/) -- [Rosette Platform API](https://docs.babelstreet.com/API/en/index-en.html) +- [Analytics Platform API](https://docs.babelstreet.com/API/en/index-en.html) - [Binding Release Notes](https://github.com/rosette-api/csharp/wiki/Release-Notes) -- [Rosette Platform Release Notes](https://babelstreet.my.site.com/support/s/article/Rosette-Cloud-Release-Notes) +- [Analytics Platform Release Notes](https://docs.babelstreet.com/Release/en/rosette-cloud.html) - [Support](https://babelstreet.my.site.com/support/s/) - [Binding License: Apache 2.0](https://github.com/rosette-api/csharp/blob/develop/LICENSE.txt) ## Concurrency -The C# binding uses HttpClient to manage connectivity and concurrency. By default, .NET sets the default connection limit to 2, which is the same as the Rosette API default limit. For Rosette API plans that allow for higher concurrency, the internal HTTP client will adjust automatically to the higher number. If a user chooses to provide their own HTTP client, no adjustment will be made. In this case it is up to the user to set `ServicePointManager.DefaultConnectionLimit` to the Rosette API concurrency level prior to instantiating the CAPI object. - -For multithreaded operations, do not instantiate a new CAPI object for each thread. The objects will not share the connection limit and `429 too many requests` errors are likely to occur. Rather, so that the underlying HttpClient can manage the queueing of the requests across all threads, instantiate a CAPI object and pass it to each thread. If it is necessary to instantiate a CAPI object on each thread, first create an HttpClient object, either by retrieving it from an instance of CAPI via the `Client` property or by creating your own HTTP client and passing it into each thread for use by the CAPI constructor. +The C# binding uses HttpClient to manage connectivity and concurrency. By default, .NET sets the default connection +limit to 2, which is the same as the Analytics API default limit. For Analytics API plans that allow for higher +concurrency, the internal HTTP client will adjust automatically to the higher number. If a user chooses to provide +their own HTTP client, no adjustment will be made. In this case it is up to the user to set +`ServicePointManager.DefaultConnectionLimit` to the Analytics API concurrency level prior to instantiating the CAPI object. + +For multithreaded operations, do not instantiate a new CAPI object for each thread. The objects will not share the +connection limit and `429 too many requests` errors are likely to occur. Rather, so that the underlying HttpClient can +manage the queueing of the requests across all threads, instantiate a CAPI object and pass it to each thread. If it is +necessary to instantiate a CAPI object on each thread, first create an HttpClient object, either by retrieving it from +an instance of CAPI via the `Client` property or by creating your own HTTP client and passing it into each thread for use by the CAPI constructor. #### Example of using a common CAPI object for each thread: ``` diff --git a/recompile.sh b/recompile.sh index 60fd5b7..dd3b41f 100755 --- a/recompile.sh +++ b/recompile.sh @@ -23,7 +23,7 @@ do csc "${filename}.cs" /r:rosette_api.dll /r:System.Net.Http.dll /r:System.Web.Extensions.dll /r:Newtonsoft.Json.dll # if last command is empty then exit if [ $? -eq 0 ]; then - mono "${filename}.exe" + mono "${filename}.exe" $API_KEY $ALT_URL fi else echo "####> File ${filename}.cs not found in rosette_apiExamples directory" diff --git a/rosette_api/AddressSimilarityResponse.cs b/rosette_api/AddressSimilarityResponse.cs index 5f333c0..610b73f 100644 --- a/rosette_api/AddressSimilarityResponse.cs +++ b/rosette_api/AddressSimilarityResponse.cs @@ -6,7 +6,7 @@ namespace rosette_api { /// - /// A class to represnt the results from the Name Similarity endpoint of the Rosette API + /// A class to represent the results from the Address Similarity endpoint of the Analytics API /// [JsonObject(MemberSerialization.OptOut)] public class AddressSimilarityResponse : RosetteResponse diff --git a/rosette_api/CAPI.cs b/rosette_api/CAPI.cs index adb69ce..51ee81f 100644 --- a/rosette_api/CAPI.cs +++ b/rosette_api/CAPI.cs @@ -29,9 +29,9 @@ public enum MorphologyFeature hanReadings }; - /// C# Rosette API. + /// C# Babel Street Analytics API. /// - /// Primary class for interfacing with the Rosette API + /// Primary class for interfacing with the Analytics API /// @copyright 2014-2024 Basis Technology Corporation. /// Licensed under the Apache License, Version 2.0 (the "License"); you may not use file except in compliance /// with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 @@ -42,7 +42,8 @@ public enum MorphologyFeature /// public class CAPI { - private const string CONCURRENCY_HEADER = "X-RosetteAPI-Concurrency"; + private const string LEGACY_CONCURRENCY_HEADER = "X-RosetteAPI-Concurrency"; + private const string CONCURRENCY_HEADER = "X-BabelStreetAPI-Concurrency"; /// /// setupLock is used to ensure that the setup operation cannot be run @@ -97,21 +98,21 @@ public class CAPI private int _concurrentConnections = 1; /// C# API class - /// Rosette Python Client Binding API; representation of a Rosette server. - /// Instance methods of the C# API provide communication with specific Rosette server endpoints. + /// Babel Street Analytics Client Binding API; representation of an Analytics server. + /// Instance methods of the C# API provide communication with specific Analytics server endpoints. /// Requires user_key to start and has 3 additional parameters to be specified. - /// Will run a Version Check against the Rosette Server. If the version check fails, a + /// Will run a Version Check against the Analytics Server. If the version check fails, a /// RosetteException will be thrown. /// /// - /// string: API key required by the Rosette server to allow access to endpoints + /// string: API key required by the Analytics server to allow access to endpoints /// (string, optional): Base URL for the HttpClient requests. If none is given, will use the default API URI /// (int, optional): Maximum number of times to retry a request on HttpResponse error. Default is 3 times. /// (HttpClient, optional): Forces the API to use a custom HttpClient. - public CAPI(string user_key, string uristring = "https://api.rosette.com/rest/v1/", int maxRetry = 5, HttpClient client = null) + public CAPI(string user_key, string uristring = "https://analytics.babelstreet.com/rest/v1/", int maxRetry = 5, HttpClient client = null) { UserKey = user_key; - URIstring = uristring ?? "https://api.rosette.com/rest/v1/"; + URIstring = uristring ?? "https://analytics.babelstreet.com/rest/v1/"; if (!URIstring.EndsWith("/")) { URIstring = URIstring + "/"; @@ -129,7 +130,7 @@ public CAPI(string user_key, string uristring = "https://api.rosette.com/rest/v1 /// UserKey /// /// Getter, Setter for the UserKey - /// UserKey: API key required by the Rosette Server + /// UserKey: API key required by the Analytics Server /// Allows users to change their UserKey later (e.g. if instantiated class incorrectly) /// /// @@ -137,7 +138,7 @@ public CAPI(string user_key, string uristring = "https://api.rosette.com/rest/v1 /// URIstring /// - /// URIString returns the current URI of the rosette server + /// URIString returns the current URI of the Analytics server /// /// public string URIstring { get; private set; } @@ -160,7 +161,7 @@ public string UserAgent { get { - return string.Format("RosetteAPICsharp/{0}/{1}", Version, Environment.Version.ToString()); + return string.Format("Babel-Street-Analytics-API-Csharp/{0}/{1}", Version, Environment.Version.ToString()); } } /// MaxRetry @@ -182,7 +183,7 @@ public string UserAgent /// Client /// Returns the http client instance. For externally provided http clients, this will return the same - /// client with some added headers that are required by the Rosette API. For the default internal client + /// client with some added headers that are required by the Analytics API. For the default internal client /// it will return the current instance, which is maintained at the class level. /// public HttpClient Client @@ -191,7 +192,7 @@ public HttpClient Client } /// Concurrency - /// Returns the number of concurrent connections allowed by the current Rosette API plan. + /// Returns the number of concurrent connections allowed by the current Analytics API plan. /// For externally provided http clients, it is up to the user to update the connection limit within their own software. /// For the default internal http client, the concurrent connections will adjust to the maximum allowed. /// @@ -308,9 +309,9 @@ public void ClearOptions() /// custom header value public void SetCustomHeaders(string key, string value) { - if (!key.StartsWith("X-RosetteAPI-")) + if (!key.StartsWith("X-RosetteAPI-") && !key.StartsWith("X-BabelStreetAPI-")) { - throw new RosetteException("Custom header name must begin with \"X-RosetteAPI-\""); + throw new RosetteException("Custom header name must begin with \"X-RosetteAPI-\" or \"X-BabelStreetAPI-\""); } if (_customHeaders.ContainsKey(key) && value == null) { @@ -564,7 +565,7 @@ public EventsResponse Event(RosetteFile file) /// Info /// - /// (GET)Info Endpoint: Response is a JSON string with Rosette API information including buildNumber, name, version, and buildTime. + /// (GET)Info Endpoint: Response is a JSON string with Analytics API information including buildNumber, name, version, and buildTime. /// /// /// InfoResponse containing the results of the info GET. @@ -632,7 +633,7 @@ public LanguageIdentificationResponse Language(RosetteFile file) /// (string, optional): Language: ISO 639-3 code (ignored for the /language endpoint) /// (string, optional): not used at time /// (string, optional): URI to accessible content (content and contentUri are mutually exclusive) - /// (string, optional): Description of what morphology feature to request from the Rosette server + /// (string, optional): Description of what morphology feature to request from the Analytics server /// (string, optional): genre to categorize the input data /// MorphologyResponse containing the results of the request. /// The response may include lemmas, part of speech tags, compound word components, and Han readings. @@ -650,7 +651,7 @@ public MorphologyResponse Morphology(string content = null, string language = nu /// /// /// Dictionary<object, object>: Dictionary containing parameters as (key,value) pairs - /// (string, optional): Description of what morphology feature to request from the Rosette server + /// (string, optional): Description of what morphology feature to request from the Analytics server /// MorphologyResponse containing the results of the request. /// The response may include lemmas, part of speech tags, compound word components, and Han readings. /// Support for specific return types depends on language. @@ -815,14 +816,14 @@ public TransliterationResponse Transliteration(Dictionary dict) } /// Ping - /// (GET)Ping Endpoint: Pings Rosette API for a response indicting that the service is available + /// (GET)Ping Endpoint: Pings Analytics API for a response indicting that the service is available /// /// PingResponse containing the results of the info GET. /// The reponse contains a message and time. /// /// Ping - /// (GET)Ping Endpoint: Pings Rosette API for a response indicting that the service is available + /// (GET)Ping Endpoint: Pings Analytics API for a response indicting that the service is available /// /// PingResponse containing the results of the info GET. /// The reponse contains a message and time. @@ -850,7 +851,7 @@ public PingResponse Ping() /// Among other uses, a text embedding enables you to calculate the similarity between two documents or two words. /// The text embedding represents the relationships between words in your document in the semantic space. /// The semantic space is a multilingual network that maps the input based on the words and their context. - /// Words with similar meanings have similar contexts, and Rosette maps them close to each other + /// Words with similar meanings have similar contexts, and Analytics maps them close to each other /// public TextEmbeddingResponse TextEmbedding(string content = null, string language = null, string contentType = null, string contentUri = null, string genre = null) { @@ -870,7 +871,7 @@ public TextEmbeddingResponse TextEmbedding(string content = null, string languag /// Among other uses, a text embedding enables you to calculate the similarity between two documents or two words. /// The text embedding represents the relationships between words in your document in the semantic space. /// The semantic space is a multilingual network that maps the input based on the words and their context. - /// Words with similar meanings have similar contexts, and Rosette maps them close to each other + /// Words with similar meanings have similar contexts, and Analytics maps them close to each other /// public TextEmbeddingResponse TextEmbedding(Dictionary dict) { @@ -890,7 +891,7 @@ public TextEmbeddingResponse TextEmbedding(Dictionary dict) /// Among other uses, a text embedding enables you to calculate the similarity between two documents or two words. /// The text embedding represents the relationships between words in your document in the semantic space. /// The semantic space is a multilingual network that maps the input based on the words and their context. - /// Words with similar meanings have similar contexts, and Rosette maps them close to each other + /// Words with similar meanings have similar contexts, and Analytics maps them close to each other /// public TextEmbeddingResponse TextEmbedding(RosetteFile file) { @@ -914,7 +915,7 @@ public TextEmbeddingResponse TextEmbedding(RosetteFile file) /// Among other uses, a text embedding enables you to calculate the similarity between two documents or two words. /// The text embedding represents the relationships between words in your document in the semantic space. /// The semantic space is a multilingual network that maps the input based on the words and their context. - /// Words with similar meanings have similar contexts, and Rosette maps them close to each other + /// Words with similar meanings have similar contexts, and Analytics maps them close to each other /// public SemanticVectorsResponse SemanticVectors(string content = null, string language = null, string contentType = null, string contentUri = null, string genre = null) { @@ -934,7 +935,7 @@ public SemanticVectorsResponse SemanticVectors(string content = null, string lan /// Among other uses, a text embedding enables you to calculate the similarity between two documents or two words. /// The text embedding represents the relationships between words in your document in the semantic space. /// The semantic space is a multilingual network that maps the input based on the words and their context. - /// Words with similar meanings have similar contexts, and Rosette maps them close to each other + /// Words with similar meanings have similar contexts, and Analytics maps them close to each other /// public SemanticVectorsResponse SemanticVectors(Dictionary dict) { @@ -954,7 +955,7 @@ public SemanticVectorsResponse SemanticVectors(Dictionary dict) /// Among other uses, a text embedding enables you to calculate the similarity between two documents or two words. /// The text embedding represents the relationships between words in your document in the semantic space. /// The semantic space is a multilingual network that maps the input based on the words and their context. - /// Words with similar meanings have similar contexts, and Rosette maps them close to each other + /// Words with similar meanings have similar contexts, and Analytics maps them close to each other /// public SemanticVectorsResponse SemanticVectors(RosetteFile file) { @@ -1408,7 +1409,7 @@ private string ToQueryString(NameValueCollection urlParameters) /// getResponse /// - /// getResponse: Internal function to get the response from the Rosette API server using the request + /// getResponse: Internal function to get the response from the Analytics API server using the request /// /// /// (string, optional): Content to use as the request to the server with POST. If none given, assume an Info endpoint and use GET @@ -1474,6 +1475,14 @@ private void CheckCallConcurrency(RosetteResponse response) Concurrency = allowedConnections; } } + else if (response.Headers.ContainsKey(LEGACY_CONCURRENCY_HEADER)) + { + int allowedConnections; + if (int.TryParse(response.Headers[LEGACY_CONCURRENCY_HEADER], out allowedConnections)) + { + Concurrency = allowedConnections; + } + } } /// Process @@ -1481,7 +1490,7 @@ private void CheckCallConcurrency(RosetteResponse response) /// Process: Internal function to convert a RosetteFile into a dictionary to use for getResponse /// /// - /// RosetteFile: File being uploaded to use as a request to the Rosette server. + /// RosetteFile: File being uploaded to use as a request to the Analytics server. /// RosetteResponse derivative containing the results of the response from the server from the getResponse call. private T Process(RosetteFile file) where T : RosetteResponse { @@ -1556,14 +1565,17 @@ private void SetupClient(bool forceReset = false) if (Client.BaseAddress == null) { - Client.BaseAddress = new Uri(URIstring); // base address must be the rosette URI regardless of whether the client is external or internal + Client.BaseAddress = new Uri(URIstring); // base address must be the Analytics URI regardless of whether the client is external or internal } Timeout = _timeout; Debug = _debug; - // Standard headers, which are required for Rosette API - AddRequestHeader("X-RosetteAPI-Key", UserKey ?? "not-provided"); + // Standard headers, which are required for Analytics API + AddRequestHeader("X-BabelStreetAPI-Key", UserKey ?? "not-provided"); AddRequestHeader("User-Agent", UserAgent); + AddRequestHeader("X-BabelStreetAPI-Binding", "csharp"); + AddRequestHeader("X-BabelStreetAPI-Binding-Version", Version); + //todo remove in future release AddRequestHeader("X-RosetteAPI-Binding", "csharp"); AddRequestHeader("X-RosetteAPI-Binding-Version", Version); diff --git a/rosette_api/Gender.cs b/rosette_api/Gender.cs new file mode 100644 index 0000000..495fa56 --- /dev/null +++ b/rosette_api/Gender.cs @@ -0,0 +1,16 @@ +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; + +namespace rosette_api +{ + /// + /// Possible gender options for the Name objects + /// + [JsonConverter(typeof(StringEnumConverter))] + public enum Gender + { + Female, + NonBinary, + Male + } +} \ No newline at end of file diff --git a/rosette_api/InfoResponse.cs b/rosette_api/InfoResponse.cs index 0f113bf..7d4b4ca 100644 --- a/rosette_api/InfoResponse.cs +++ b/rosette_api/InfoResponse.cs @@ -9,7 +9,7 @@ namespace rosette_api { /// - /// A class to represent Rosette API responses when Info() is called + /// A class to represent Analytics API responses when Info() is called /// [JsonObject(MemberSerialization.OptOut)] public class InfoResponse : RosetteResponse diff --git a/rosette_api/LanguageIdentificationResponse.cs b/rosette_api/LanguageIdentificationResponse.cs index 83f9d73..b4c6282 100644 --- a/rosette_api/LanguageIdentificationResponse.cs +++ b/rosette_api/LanguageIdentificationResponse.cs @@ -11,7 +11,7 @@ namespace rosette_api { /// - /// A class to represent responses from the Language Identification endpoint of the Rosette API + /// A class to represent responses from the Language Identification endpoint of the Analytics API /// [JsonObject(MemberSerialization.OptOut)] public class LanguageIdentificationResponse : RosetteResponse diff --git a/rosette_api/MorphologyResponse.cs b/rosette_api/MorphologyResponse.cs index 61d7b65..338a3b9 100644 --- a/rosette_api/MorphologyResponse.cs +++ b/rosette_api/MorphologyResponse.cs @@ -24,7 +24,7 @@ public class MorphologyResponse : RosetteResponse private const string responseHeadersKey = "responseHeaders"; /// - /// Gets or sets the output of the Rosette API's morphology endpoint, grouped by tokens in order of appearance + /// Gets or sets the output of the Analytics API's morphology endpoint, grouped by tokens in order of appearance /// [JsonProperty("items")] public List Items { get; set; } @@ -140,7 +140,7 @@ public override string ContentToString() } /// - /// A class for representing responses from the Morphology endpoint of the Rosette API + /// A class for representing responses from the Morphology endpoint of the Analytics API /// [JsonObject(MemberSerialization.OptOut)] public class MorphologyItem diff --git a/rosette_api/Name.cs b/rosette_api/Name.cs index eccad8a..7515f40 100644 --- a/rosette_api/Name.cs +++ b/rosette_api/Name.cs @@ -17,12 +17,14 @@ public class Name /// (string, optional): Language: ISO 639-3 code (ignored for the /language endpoint) /// (string, optional): ISO 15924 code for the name's script /// (string, optional): Entity type of the name: PERSON, LOCATION, or ORGANIZATION - public Name(string Text = null, string Language = null, string Script = null, string EntityType = null) + /// (Gender, optional): gender: Gender of the name: Female, Male, NonBinary + public Name(string Text = null, string Language = null, string Script = null, string EntityType = null, Gender? Gender = null) { text = Text; language = Language; script = Script; entityType = EntityType; + gender = Gender; } /// text @@ -56,5 +58,14 @@ public Name(string Text = null, string Language = null, string Script = null, st /// /// public string entityType { get; set; } + + /// gender + /// + /// Getter, Setter for the gender + /// gender: Gender of the name + /// + /// + public Gender? gender { get; set; } + } } diff --git a/rosette_api/NameDeduplicationResponse.cs b/rosette_api/NameDeduplicationResponse.cs index eb27b6d..334e468 100644 --- a/rosette_api/NameDeduplicationResponse.cs +++ b/rosette_api/NameDeduplicationResponse.cs @@ -6,7 +6,7 @@ namespace rosette_api { /// - /// A class to represent the results from the Name Deduplication endpoint of the Rosette API + /// A class to represent the results from the Name Deduplication endpoint of the Analytics API /// [JsonObject(MemberSerialization.OptOut)] public class NameDeduplicationResponse : RosetteResponse { diff --git a/rosette_api/NameSimilarityResponse.cs b/rosette_api/NameSimilarityResponse.cs index 0e55339..4728309 100644 --- a/rosette_api/NameSimilarityResponse.cs +++ b/rosette_api/NameSimilarityResponse.cs @@ -6,7 +6,7 @@ namespace rosette_api { /// - /// A class to represent the results from the Name Similarity endpoint of the Rosette API + /// A class to represent the results from the Name Similarity endpoint of the Analytics API /// [JsonObject(MemberSerialization.OptOut)] public class NameSimilarityResponse : RosetteResponse diff --git a/rosette_api/PingResponse.cs b/rosette_api/PingResponse.cs index a86bed3..0473f4f 100644 --- a/rosette_api/PingResponse.cs +++ b/rosette_api/PingResponse.cs @@ -9,7 +9,7 @@ namespace rosette_api { /// - /// A class to represent Rosette API responses when Ping() is called + /// A class to represent Analytics API responses when Ping() is called /// [JsonObject(MemberSerialization.OptOut)] public class PingResponse : RosetteResponse diff --git a/rosette_api/Properties/AssemblyInfo.cs b/rosette_api/Properties/AssemblyInfo.cs index 296fb52..8d4f637 100644 --- a/rosette_api/Properties/AssemblyInfo.cs +++ b/rosette_api/Properties/AssemblyInfo.cs @@ -5,10 +5,10 @@ // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. -[assembly: AssemblyTitle("Rosette API C# Binding")] -[assembly: AssemblyDescription("Provides a C# interface to the Rosette API web service")] +[assembly: AssemblyTitle("Babel Street Analytics API C# Binding")] +[assembly: AssemblyDescription("Provides a C# interface to the Babel Street Analytics API web service")] [assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("Basis Technology")] +[assembly: AssemblyCompany("Babel Street")] [assembly: AssemblyProduct("CSharp Binding")] [assembly: AssemblyCopyright("Copyright © Basis Technology 2017")] [assembly: AssemblyTrademark("")] @@ -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.30.0.0")] -[assembly: AssemblyVersion("1.30.0.0")] -[assembly: AssemblyFileVersion("1.30.0.0")] +// [assembly: AssemblyVersion("1.31.0.0")] +[assembly: AssemblyVersion("1.31.0.0")] +[assembly: AssemblyFileVersion("1.31.0.0")] diff --git a/rosette_api/RecordSimilarityResponse.cs b/rosette_api/RecordSimilarityResponse.cs index d0b32da..6a1d9cf 100644 --- a/rosette_api/RecordSimilarityResponse.cs +++ b/rosette_api/RecordSimilarityResponse.cs @@ -9,7 +9,7 @@ namespace rosette_api { /// - /// A class to represent the results from the Record Similarity endpoint of the Rosette API + /// A class to represent the results from the Record Similarity endpoint of the Analytics API /// [JsonObject(MemberSerialization.OptOut)] public class RecordSimilarityResponse : RosetteResponse { @@ -128,7 +128,7 @@ public override int GetHashCode() } /// - /// A class to represent the results from the Record Similarity endpoint of the Rosette API + /// A class to represent the results from the Record Similarity endpoint of the Analytics API /// [JsonObject(MemberSerialization.OptOut)] public class RecordSimilarityResult { diff --git a/rosette_api/RelationshipsResponse.cs b/rosette_api/RelationshipsResponse.cs index 19f3f74..d1bf09b 100644 --- a/rosette_api/RelationshipsResponse.cs +++ b/rosette_api/RelationshipsResponse.cs @@ -14,7 +14,7 @@ namespace rosette_api { /// - /// A class to represent responses from the Relationships endpoint of the Rosette API + /// A class to represent responses from the Relationships endpoint of the Analytics API /// [JsonObject(MemberSerialization.OptOut)] public class RelationshipsResponse : RosetteResponse @@ -30,7 +30,7 @@ public class RelationshipsResponse : RosetteResponse internal const string MODALITIES = "modalities"; /// - /// Gets or sets the relationships extracted by the Rosette API + /// Gets or sets the relationships extracted by the Analytics API /// [JsonProperty(relationshipsKey)] public List Relationships { get; set; } @@ -65,7 +65,7 @@ public RelationshipsResponse(HttpResponseMessage apiResult) :base(apiResult) /// Creates a RelationshipsResponse from its components /// /// The relationships - /// The response headers returned from the Rosette API + /// The response headers returned from the Analytics API /// The content (the relationships) in dictionary form /// The content in JSON form public RelationshipsResponse(List relationships, Dictionary responseHeaders, Dictionary content, string contentAsJson) @@ -110,7 +110,7 @@ public override int GetHashCode() } /// - /// A class to represent a relationship as identified by the Rosette API + /// A class to represent a relationship as identified by the Analytics API /// [JsonConverter(typeof(RelationshipConverter))] [JsonObject(MemberSerialization=MemberSerialization.OptIn)] diff --git a/rosette_api/ResponseHeaders.cs b/rosette_api/ResponseHeaders.cs index 5c07d0b..2ea123f 100644 --- a/rosette_api/ResponseHeaders.cs +++ b/rosette_api/ResponseHeaders.cs @@ -11,7 +11,7 @@ namespace rosette_api { /// - /// A class to represent the response headers returned by the Rosette API + /// A class to represent the response headers returned by the Analytics API /// [JsonObject(MemberSerialization.OptOut)] [JsonConverter(typeof(ResponseHeadersConverter))] @@ -23,14 +23,16 @@ public class ResponseHeaders internal const string serverKey = "server"; internal const string strictTransportSecurityKey = "strict-transport-security"; internal const string xRosetteAPIAppIDKey = "x-rosetteapi-app-id"; + internal const string xBabelStreetAPIAppIDKey = "x-babelstreetapi-app-id"; internal const string xRosetteAPIConcurrencyKey = "x-rosetteapi-concurrency"; + internal const string xBabelStreetAPIConcurrencyKey = "x-babelstreetapi-concurrency"; internal const string xRosetteAPIProcessedLanguageKey = "x-rosetteapi-processedlanguage"; internal const string xRosetteAPIRequestIDKey = "x-rosetteapi-request-id"; internal const string contentLengthKey = "content-length"; internal const string connectionKey = "connection"; /// - /// The collection of all resposne headers returned by the Rosette API + /// The collection of all response headers returned by the Analytics API /// [JsonProperty("allResponseHeaders")] public IDictionary AllResponseHeaders; diff --git a/rosette_api/RosetteException.cs b/rosette_api/RosetteException.cs index b3bcc9b..4f57cab 100644 --- a/rosette_api/RosetteException.cs +++ b/rosette_api/RosetteException.cs @@ -3,14 +3,14 @@ namespace rosette_api { /// RosetteException Class /// - /// RosetteException: Custom exception to describe an exception from the Rosette API. + /// RosetteException: Custom exception to describe an exception from the Analytics API. /// /// [Serializable] public class RosetteException : Exception { /// RosetteException /// - /// RosetteException: Custom exception to describe an exception from the Rosette API. + /// RosetteException: Custom exception to describe an exception from the Analytics API. /// /// /// (string, optional): Message describing exception details diff --git a/rosette_api/RosetteExtensions.cs b/rosette_api/RosetteExtensions.cs index 8414df9..5a51749 100644 --- a/rosette_api/RosetteExtensions.cs +++ b/rosette_api/RosetteExtensions.cs @@ -7,7 +7,7 @@ namespace rosette_api { /// - /// Extension classes specific to the Rosette binding + /// Extension classes specific to the Analytics binding /// public static class RosetteExtensions { /// diff --git a/rosette_api/RosetteResponse.cs b/rosette_api/RosetteResponse.cs index 4e098ad..4e3b1fb 100755 --- a/rosette_api/RosetteResponse.cs +++ b/rosette_api/RosetteResponse.cs @@ -11,7 +11,7 @@ namespace rosette_api { /// - /// Encapsulates the response from RosetteAPI + /// Encapsulates the response from Analytics API /// [JsonObject(MemberSerialization=MemberSerialization.OptIn)] public class RosetteResponse { diff --git a/rosette_api/SentenceTaggingResponse.cs b/rosette_api/SentenceTaggingResponse.cs index 0ebe88c..a3f956f 100644 --- a/rosette_api/SentenceTaggingResponse.cs +++ b/rosette_api/SentenceTaggingResponse.cs @@ -11,7 +11,7 @@ namespace rosette_api { /// - /// A class to represent responses from the Sentence Tagging endpoint of the Rosette API + /// A class to represent responses from the Sentence Tagging endpoint of the Analytics API /// [JsonObject(MemberSerialization.OptOut)] public class SentenceTaggingResponse : RosetteResponse @@ -19,7 +19,7 @@ public class SentenceTaggingResponse : RosetteResponse private const string sentencesKey ="sentences"; /// - /// Gets or sets the sentences identified by the Rosette API + /// Gets or sets the sentences identified by the Analytics API /// [JsonProperty(sentencesKey)] public List Sentences { get; set; } diff --git a/rosette_api/SentimentResponse.cs b/rosette_api/SentimentResponse.cs index d92402e..78379d2 100644 --- a/rosette_api/SentimentResponse.cs +++ b/rosette_api/SentimentResponse.cs @@ -12,7 +12,7 @@ namespace rosette_api { /// - /// A class for representing responses from the sentiment analysis endpoint of the Rosette API + /// A class for representing responses from the sentiment analysis endpoint of the Analytics API /// [JsonObject(MemberSerialization.OptOut)] public class SentimentResponse : RosetteResponse, IEquatable @@ -35,12 +35,12 @@ public class SentimentResponse : RosetteResponse, IEquatable internal const String permIdKey = "permId"; /// - /// Gets or sets the document-level sentiment identified by the Rosette API + /// Gets or sets the document-level sentiment identified by the Analytics API /// [JsonProperty(docKey)] public RosetteSentiment DocSentiment { get; set; } /// - /// Gets or sets the entities identified by the Rosette API with sentiment + /// Gets or sets the entities identified by the Analytics API with sentiment /// [JsonProperty(entitiesKey)] public List EntitySentiments { get; set; } @@ -264,7 +264,7 @@ public override string ToString() } /// - /// A class to represent an entity returned by the Sentiment Analysis endpoint of the Rosette API + /// A class to represent an entity returned by the Sentiment Analysis endpoint of the Analytics API /// [JsonObject(MemberSerialization.OptOut)] public class RosetteSentimentEntity : RosetteEntity, IEquatable diff --git a/rosette_api/SyntaxDependenciesResponse.cs b/rosette_api/SyntaxDependenciesResponse.cs index 33630b0..03f5601 100644 --- a/rosette_api/SyntaxDependenciesResponse.cs +++ b/rosette_api/SyntaxDependenciesResponse.cs @@ -12,7 +12,7 @@ namespace rosette_api { /// - /// A class for representing responses from the syntax/dependencies endpoint of the Rosette API + /// A class for representing responses from the syntax/dependencies endpoint of the Analytics API /// [JsonObject(MemberSerialization.OptOut)] public class SyntaxDependenciesResponse : RosetteResponse @@ -27,13 +27,13 @@ public class SyntaxDependenciesResponse : RosetteResponse internal const string DEPENDENT_TOKEN_INDEX = "dependentTokenIndex"; /// - /// Gets or sets the syntactic dependencies identified by the Rosette API + /// Gets or sets the syntactic dependencies identified by the Analytics API /// [JsonProperty(SENTENCES)] public List Sentences { get; set; } /// - /// Gets or sets the tokens identified by the Rosette API + /// Gets or sets the tokens identified by the Analytics API /// [JsonProperty(TOKENS)] public List Tokens { get; set; } @@ -119,7 +119,7 @@ public override int GetHashCode() } /// - /// A class to represent a SentenceWithDependencies returned by the Syntax Dependencies endpoint of the Rosette API + /// A class to represent a SentenceWithDependencies returned by the Syntax Dependencies endpoint of the Analytics API /// [JsonObject(MemberSerialization.OptOut)] public class SentenceWithDependencies @@ -202,7 +202,7 @@ public override string ToString() } /// - /// A class to represent a dependency returned by the Syntax Dependencies endpoint of the Rosette API + /// A class to represent a dependency returned by the Syntax Dependencies endpoint of the Analytics API /// [JsonObject(MemberSerialization.OptOut)] public class Dependency diff --git a/rosette_api/TokenizationResponse.cs b/rosette_api/TokenizationResponse.cs index 39e3332..6704783 100644 --- a/rosette_api/TokenizationResponse.cs +++ b/rosette_api/TokenizationResponse.cs @@ -8,7 +8,7 @@ namespace rosette_api { /// - /// A class to represent responses from the Tokenization endpoint of the Rosette API + /// A class to represent responses from the Tokenization endpoint of the Analytics API /// [JsonObject(MemberSerialization.OptOut)] public class TokenizationResponse : RosetteResponse diff --git a/rosette_api/TopicsResponse.cs b/rosette_api/TopicsResponse.cs index 9a03fc1..d690035 100644 --- a/rosette_api/TopicsResponse.cs +++ b/rosette_api/TopicsResponse.cs @@ -7,7 +7,7 @@ namespace rosette_api { /// - /// A class to represent responses from the Tokenization endpoint of the Rosette API + /// A class to represent responses from the Topics endpoint of the Analytics API /// [JsonObject(MemberSerialization.OptOut)] public class TopicsResponse : RosetteResponse { diff --git a/rosette_api/TranslateNamesResponse.cs b/rosette_api/TranslateNamesResponse.cs index 0098e87..006ad1c 100644 --- a/rosette_api/TranslateNamesResponse.cs +++ b/rosette_api/TranslateNamesResponse.cs @@ -9,7 +9,7 @@ namespace rosette_api { /// - /// A class to represent responses from the TranslatedNames endpoint of the RosetteAPI + /// A class to represent responses from the TranslatedNames endpoint of the Analytics API /// [JsonObject(MemberSerialization.OptOut)] public class TranslateNamesResponse : RosetteResponse diff --git a/rosette_api/TransliterationResponse.cs b/rosette_api/TransliterationResponse.cs index 89f2007..e86fb3e 100644 --- a/rosette_api/TransliterationResponse.cs +++ b/rosette_api/TransliterationResponse.cs @@ -5,7 +5,7 @@ namespace rosette_api { /// - /// A class to represnt the results from the Name Deduplication endpoint of the Rosette API + /// A class to represent the results from the Transliteration endpoint of the Analytics API /// [JsonObject(MemberSerialization.OptOut)] public class TransliterationResponse : RosetteResponse { diff --git a/rosette_api/rosette_api.csproj b/rosette_api/rosette_api.csproj index 0974c02..38f84b3 100644 --- a/rosette_api/rosette_api.csproj +++ b/rosette_api/rosette_api.csproj @@ -61,6 +61,7 @@ + diff --git a/rosette_api/rosette_api.nuspec b/rosette_api/rosette_api.nuspec index 778497b..d56fa80 100644 --- a/rosette_api/rosette_api.nuspec +++ b/rosette_api/rosette_api.nuspec @@ -2,19 +2,19 @@ rosette_api - 1.30.0 - .Net (C#) Binding for Rosette API + 1.31.0 + .Net (C#) Binding for Babel Street Analytics API basistech Rosette by Babel Street - Copyright 2014-2023 Basis Technology Corp. + Copyright 2014-2024 Basis Technology Corp. https://www.babelstreet.com/rosette https://github.com/rosette-api/csharp/wiki/Release-Notes Apache-2.0 false - RosetteAPI address similarity analyze language babel street categories coreference entity extraction entity linking event extraction fuzzy matching language identification lemmatization match identity morphology name deduplication name similarity name translation ner nlp parts of speech record similarity relationships rosette semantic similarity semantic vectors sentiment analysis text analytics text embeddings tokenization + address similarity analyze language babel street categories coreference entity extraction entity linking event extraction fuzzy matching language identification lemmatization match identity morphology name deduplication name similarity name translation ner nlp parts of speech record similarity relationships rosette semantic similarity semantic vectors sentiment analysis text analytics text embeddings tokenization diff --git a/rosette_apiExamples/README.md b/rosette_apiExamples/README.md index a043090..d14801f 100644 --- a/rosette_apiExamples/README.md +++ b/rosette_apiExamples/README.md @@ -1,11 +1,11 @@ ## Endpoint Examples -These examples are scripts that can be run independently to demonstrate the Rosette API functionality. +These examples are scripts that can be run independently to demonstrate the Babel Street Analytics API functionality. -Each example file demonstrates one of the capabilities of the Rosette Platform. Each example, when run, prints its output to the console. +Each example file demonstrates one of the capabilities of the Analytics Platform. Each example, when run, prints its output to the console. Each example will also accept an optional, alternate url parameter for overriding the default URL. -A note on prerequisites. Rosette API only supports TLS 1.2 so ensure your toolchain also supports it. +A note on prerequisites. Analytics API only supports TLS 1.2 so ensure your toolchain also supports it. Here are some methods for running the examples. @@ -34,7 +34,7 @@ Here are some methods for running the examples. cd rosette_apiExamples csc language.cs /r:rosette_api.dll /r:System.Net.Http.dll /r:System.Web.Extensions.dll ``` -- Run the compiled example against Rosette Cloud. In this example, your Cloud API key is stored in the environment variable `$API_KEY`. +- Run the compiled example against Analytics Cloud. In this example, your Cloud API key is stored in the environment variable `$API_KEY`. ``` mono language.exe $API_KEY ``` @@ -76,7 +76,7 @@ Here are some methods for running the examples. cd rosette_apiExamples csc language.cs /r:rosette_api.dll /r:System.Net.Http.dll /r:System.Web.Extensions.dll ``` -- Run the compiled example against Rosette Cloud. In this example, your Cloud API key is stored in the environment variable `$API_KEY`. +- Run the compiled example against Analytics Cloud. In this example, your Cloud API key is stored in the environment variable `$API_KEY`. ``` mono language.exe $API_KEY ``` diff --git a/rosette_apiExamples/address_similarity.cs b/rosette_apiExamples/address_similarity.cs index eea5007..911add4 100644 --- a/rosette_apiExamples/address_similarity.cs +++ b/rosette_apiExamples/address_similarity.cs @@ -11,7 +11,7 @@ namespace rosette_apiExamples class address_similarity { /// - /// Example code to call Rosette API to get match score (similarity) for two addresses. + /// Example code to call Analytics API to get match score (similarity) for two addresses. /// Requires Nuget Package: /// rosette_api /// diff --git a/rosette_apiExamples/categories.cs b/rosette_apiExamples/categories.cs index d02df4e..484a9c8 100644 --- a/rosette_apiExamples/categories.cs +++ b/rosette_apiExamples/categories.cs @@ -11,7 +11,7 @@ namespace rosette_apiExamples class categories { /// - /// Example code to call Rosette API to get a document's (located at given URL) categories. + /// Example code to call Analytics API to get a document's (located at given URL) categories. /// Requires Nuget Package: /// rosette_api /// @@ -36,7 +36,7 @@ static void Main(string[] args) CategoriesResponse response = CategoriesCAPI.Categories(categories_text_data, null, null, null); Console.WriteLine(response.ContentAsJson); - //Rosette API also supports Dictionary inputs + //Analytics API also supports Dictionary inputs //Simply instantiate a new dictionary object with the fields options as keys and inputs as values response = CategoriesCAPI.Categories(new Dictionary() { diff --git a/rosette_apiExamples/entities.cs b/rosette_apiExamples/entities.cs index 77252dd..3d09afd 100644 --- a/rosette_apiExamples/entities.cs +++ b/rosette_apiExamples/entities.cs @@ -11,7 +11,7 @@ namespace rosette_apiExamples class entities { /// - /// Example code to call Rosette API to get entities from a piece of text. + /// Example code to call Analytics API to get entities from a piece of text. /// Requires Nuget Package: /// rosette_api /// diff --git a/rosette_apiExamples/events.cs b/rosette_apiExamples/events.cs index 7263cff..2c593a9 100644 --- a/rosette_apiExamples/events.cs +++ b/rosette_apiExamples/events.cs @@ -11,7 +11,7 @@ namespace rosette_apiExamples class events { /// - /// Example code to call Rosette API to get events from a piece of text. + /// Example code to call Analytics API to get events from a piece of text. /// Requires Nuget Package: /// rosette_api /// diff --git a/rosette_apiExamples/events_negation.cs b/rosette_apiExamples/events_negation.cs index c141be9..d51ee10 100644 --- a/rosette_apiExamples/events_negation.cs +++ b/rosette_apiExamples/events_negation.cs @@ -11,7 +11,7 @@ namespace rosette_apiExamples class events_negation { /// - /// Example code to call Rosette API to get events from a piece of text. + /// Example code to call Analytics API to get events from a piece of text. /// Requires Nuget Package: /// rosette_api /// diff --git a/rosette_apiExamples/info.cs b/rosette_apiExamples/info.cs index e7cb42d..ca589bb 100644 --- a/rosette_apiExamples/info.cs +++ b/rosette_apiExamples/info.cs @@ -11,7 +11,7 @@ namespace rosette_apiExamples class info { /// - /// Example code to call Rosette API to get information such as version and build. + /// Example code to call Analytics API to get information such as version and build. /// Requires Nuget Package: /// rosette_api /// diff --git a/rosette_apiExamples/language.cs b/rosette_apiExamples/language.cs index e790f98..f07e623 100644 --- a/rosette_apiExamples/language.cs +++ b/rosette_apiExamples/language.cs @@ -11,7 +11,7 @@ namespace rosette_apiExamples class language { /// - /// Example code to call Rosette API to detect possible languages for a piece of text. + /// Example code to call Analytics API to detect possible languages for a piece of text. /// Requires Nuget Package: /// rosette_api /// @@ -32,8 +32,8 @@ static void Main(string[] args) { CAPI LanguageCAPI = string.IsNullOrEmpty(alturl) ? new CAPI(apikey) : new CAPI(apikey, alturl); string language_data = @"Por favor Señorita, says the man."; + LanguageCAPI.SetCustomHeaders("X-BabelStreetAPI-App", "csharp-examples"); //The results of the API call will come back in the form of a Dictionary - LanguageCAPI.SetCustomHeaders("X-RosetteAPI-App", "csharp-app"); LanguageIdentificationResponse response = LanguageCAPI.Language(language_data); foreach (KeyValuePair h in response.Headers) { Console.WriteLine(string.Format("{0}:{1}", h.Key, h.Value)); diff --git a/rosette_apiExamples/language_multilingual.cs b/rosette_apiExamples/language_multilingual.cs index 15e7d89..26a7a83 100644 --- a/rosette_apiExamples/language_multilingual.cs +++ b/rosette_apiExamples/language_multilingual.cs @@ -11,7 +11,7 @@ namespace rosette_apiExamples class language { /// - /// Example code to call Rosette API to detect possible languages for a piece of text. + /// Example code to call Analytics API to detect possible languages for a piece of text. /// Requires Nuget Package: /// rosette_api /// @@ -33,7 +33,7 @@ static void Main(string[] args) CAPI LanguageCAPI = string.IsNullOrEmpty(alturl) ? new CAPI(apikey) : new CAPI(apikey, alturl); string language_multilingual_data = @"On Thursday, as protesters gathered in Washington D.C., the United States Federal Communications Commission under Chairman Ajit Pai voted 3-2 to overturn a 2015 decision, commonly called Net Neutrality, that forbade Internet service providers (ISPs) such as Verizon, Comcast, and AT&T from blocking individual websites or charging websites or customers more for faster load times. Quatre femmes ont été nommées au Conseil de rédaction de la loi du Qatar. Jeudi, le décret royal du Qatar a annoncé que 28 nouveaux membres ont été nommés pour le Conseil de la Choura du pays. ذكرت مصادر أمنية يونانية، أن 9 موقوفين من منظمة ""د هـ ك ب ج"" الذين كانت قد أوقفتهم الشرطة اليونانية في وقت سابق كانوا يخططون لاغتيال الرئيس التركي رجب طيب أردوغان."; - LanguageCAPI.SetCustomHeaders("X-RosetteAPI-App", "csharp-app"); + LanguageCAPI.SetCustomHeaders("X-BabelStreetAPI-App", "csharp-examples"); LanguageCAPI.SetOption("multilingual", "true"); //The results of the API call will come back in the form of a Dictionary diff --git a/rosette_apiExamples/morphology_complete.cs b/rosette_apiExamples/morphology_complete.cs index a3651e6..ed3f03b 100644 --- a/rosette_apiExamples/morphology_complete.cs +++ b/rosette_apiExamples/morphology_complete.cs @@ -11,7 +11,7 @@ namespace rosette_apiExamples class morphology_complete { /// - /// Example code to call Rosette API to get the complete set of morphological analysis results for a piece of text. + /// Example code to call Analytics API to get the complete set of morphological analysis results for a piece of text. /// Requires Nuget Package: /// rosette_api /// diff --git a/rosette_apiExamples/morphology_compound-components.cs b/rosette_apiExamples/morphology_compound-components.cs index 9d0c9ec..a42c67e 100644 --- a/rosette_apiExamples/morphology_compound-components.cs +++ b/rosette_apiExamples/morphology_compound-components.cs @@ -11,7 +11,7 @@ namespace rosette_apiExamples class morphology_compound_components { /// - /// Example code to call Rosette API to get de-compounded words from a piece of text. + /// Example code to call Analytics API to get de-compounded words from a piece of text. /// Requires Nuget Package: /// rosette_api /// diff --git a/rosette_apiExamples/morphology_han-readings.cs b/rosette_apiExamples/morphology_han-readings.cs index 96480f7..b350b1e 100644 --- a/rosette_apiExamples/morphology_han-readings.cs +++ b/rosette_apiExamples/morphology_han-readings.cs @@ -11,7 +11,7 @@ namespace rosette_apiExamples class morphology_han_readings { /// - /// Example code to call Rosette API to get Chinese readings for words in a piece of text. + /// Example code to call Analytics API to get Chinese readings for words in a piece of text. /// Requires Nuget Package: /// rosette_api /// diff --git a/rosette_apiExamples/morphology_lemmas.cs b/rosette_apiExamples/morphology_lemmas.cs index 4eb66ed..007e6fd 100644 --- a/rosette_apiExamples/morphology_lemmas.cs +++ b/rosette_apiExamples/morphology_lemmas.cs @@ -11,7 +11,7 @@ namespace rosette_apiExamples class morphology_lemmas { /// - /// Example code to call Rosette API to get lemmas for words in a piece of text. + /// Example code to call Analytics API to get lemmas for words in a piece of text. /// Requires Nuget Package: /// rosette_api /// diff --git a/rosette_apiExamples/morphology_parts-of-speech.cs b/rosette_apiExamples/morphology_parts-of-speech.cs index e2fcc35..050b5d5 100644 --- a/rosette_apiExamples/morphology_parts-of-speech.cs +++ b/rosette_apiExamples/morphology_parts-of-speech.cs @@ -11,7 +11,7 @@ namespace rosette_apiExamples class morphology_parts_of_speech { /// - /// Example code to call Rosette API to get part-of-speech tags for words a piece of text. + /// Example code to call Analytics API to get part-of-speech tags for words a piece of text. /// Requires Nuget Package: /// rosette_api /// diff --git a/rosette_apiExamples/name_deduplication.cs b/rosette_apiExamples/name_deduplication.cs index f0f9322..6cb9f7e 100644 --- a/rosette_apiExamples/name_deduplication.cs +++ b/rosette_apiExamples/name_deduplication.cs @@ -11,7 +11,7 @@ namespace rosette_apiExamples class name_deduplication { /// - /// Example code to call Rosette API to deduplication a list of names. + /// Example code to call Analytics API to deduplication a list of names. /// Requires Nuget Package: /// rosette_api /// diff --git a/rosette_apiExamples/name_similarity.cs b/rosette_apiExamples/name_similarity.cs index 84f88fa..295a7a6 100644 --- a/rosette_apiExamples/name_similarity.cs +++ b/rosette_apiExamples/name_similarity.cs @@ -11,7 +11,7 @@ namespace rosette_apiExamples class matched_name { /// - /// Example code to call Rosette API to get match score (similarity) for two names. + /// Example code to call Analytics API to get match score (similarity) for two names. /// Requires Nuget Package: /// rosette_api /// diff --git a/rosette_apiExamples/name_translation.cs b/rosette_apiExamples/name_translation.cs index 068cee8..cb151e9 100644 --- a/rosette_apiExamples/name_translation.cs +++ b/rosette_apiExamples/name_translation.cs @@ -11,7 +11,7 @@ namespace rosette_apiExamples class translated_name { /// - /// Example code to call Rosette API to translate a name from language to another. + /// Example code to call Analytics API to translate a name from language to another. /// Requires Nuget Package: /// rosette_api /// diff --git a/rosette_apiExamples/ping.cs b/rosette_apiExamples/ping.cs index 68f77ac..0536b69 100644 --- a/rosette_apiExamples/ping.cs +++ b/rosette_apiExamples/ping.cs @@ -11,7 +11,7 @@ namespace rosette_apiExamples class ping { /// - /// Example code to send Rosette API a ping to check its reachability. + /// Example code to send Analytics API a ping to check its reachability. /// Requires Nuget Package: /// rosette_api /// diff --git a/rosette_apiExamples/record_similarity.cs b/rosette_apiExamples/record_similarity.cs index f0e23f5..9b06666 100644 --- a/rosette_apiExamples/record_similarity.cs +++ b/rosette_apiExamples/record_similarity.cs @@ -8,7 +8,7 @@ namespace rosette_apiExamples class record_similarity { /// - /// Example code to call Rosette API to get record similarity scores between two list of records + /// Example code to call Analytics API to get record similarity scores between two list of records /// Requires Nuget Package: /// rosette_api /// diff --git a/rosette_apiExamples/relationships.cs b/rosette_apiExamples/relationships.cs index 08f0f3b..6dc27a5 100644 --- a/rosette_apiExamples/relationships.cs +++ b/rosette_apiExamples/relationships.cs @@ -11,7 +11,7 @@ namespace rosette_apiExamples class relationships { /// - /// Example code to call Rosette API to get sentences in a piece of text. + /// Example code to call Analytics API to get sentences in a piece of text. /// Requires Nuget Package: /// rosette_api /// diff --git a/rosette_apiExamples/semantic_vectors.cs b/rosette_apiExamples/semantic_vectors.cs index 34cbf53..d4fc25b 100644 --- a/rosette_apiExamples/semantic_vectors.cs +++ b/rosette_apiExamples/semantic_vectors.cs @@ -11,7 +11,7 @@ namespace rosette_apiExamples class semantic_vectors { /// - /// Example code to call Rosette API to get an input's text-vector. + /// Example code to call Analytics API to get an input's text-vector. /// Requires Nuget Package: /// rosette_api /// diff --git a/rosette_apiExamples/sentences.cs b/rosette_apiExamples/sentences.cs index 6dd3cd4..6f96d84 100644 --- a/rosette_apiExamples/sentences.cs +++ b/rosette_apiExamples/sentences.cs @@ -11,7 +11,7 @@ namespace rosette_apiExamples class sentences { /// - /// Example code to call Rosette API to get sentences in a piece of text. + /// Example code to call Analytics API to get sentences in a piece of text. /// Requires Nuget Package: /// rosette_api /// diff --git a/rosette_apiExamples/sentiment.cs b/rosette_apiExamples/sentiment.cs index 1a55698..8e3825d 100644 --- a/rosette_apiExamples/sentiment.cs +++ b/rosette_apiExamples/sentiment.cs @@ -12,7 +12,7 @@ namespace rosette_apiExamples class sentiment { /// - /// Example code to call Rosette API to get a document's sentiment + /// Example code to call Analytics API to get a document's sentiment /// Requires Nuget Package: /// rosette_api /// @@ -39,7 +39,7 @@ static void Main(string[] args) sw.WriteLine(sentiment_file_data); sw.Flush(); sw.Close(); - //Rosette API provides File upload options (shown here) + //Analytics API provides File upload options (shown here) //Simply create a new RosetteFile using the path to a file //The results of the API call will come back in the form of a Dictionary SentimentResponse response = SentimentCAPI.Sentiment(new RosetteFile(newFile, @"application/octet-stream", "{\"language\":\"eng\"}")); diff --git a/rosette_apiExamples/similar_terms.cs b/rosette_apiExamples/similar_terms.cs index 98f76f3..fcccae5 100644 --- a/rosette_apiExamples/similar_terms.cs +++ b/rosette_apiExamples/similar_terms.cs @@ -11,7 +11,7 @@ namespace rosette_apiExamples class similar_terms { /// - /// Example code to call Rosette API to get an input's similar terms. + /// Example code to call Analytics API to get an input's similar terms. /// Requires Nuget Package: /// rosette_api /// diff --git a/rosette_apiExamples/syntax_dependencies.cs b/rosette_apiExamples/syntax_dependencies.cs index 764d406..54fccc0 100644 --- a/rosette_apiExamples/syntax_dependencies.cs +++ b/rosette_apiExamples/syntax_dependencies.cs @@ -11,7 +11,7 @@ namespace rosette_apiExamples class entities { /// - /// Example code to call Rosette API to get syntax dependencies from a piece of text. + /// Example code to call Analytics API to get syntax dependencies from a piece of text. /// Requires Nuget Package: /// rosette_api /// diff --git a/rosette_apiExamples/tokens.cs b/rosette_apiExamples/tokens.cs index 6ab032a..7d73236 100644 --- a/rosette_apiExamples/tokens.cs +++ b/rosette_apiExamples/tokens.cs @@ -11,7 +11,7 @@ namespace rosette_apiExamples class tokens { /// - /// Example code to call Rosette API to get tokens (words) in a piece of text. + /// Example code to call Analytics API to get tokens (words) in a piece of text. /// Requires Nuget Package: /// rosette_api /// diff --git a/rosette_apiExamples/topics.cs b/rosette_apiExamples/topics.cs index 15fa007..16a6d97 100644 --- a/rosette_apiExamples/topics.cs +++ b/rosette_apiExamples/topics.cs @@ -11,7 +11,7 @@ namespace rosette_apiExamples class topics { /// - /// Example code to call Rosette API to get concepts and key phrases in a piece of text. + /// Example code to call Analytics API to get concepts and key phrases in a piece of text. /// Requires Nuget Package: /// rosette_api /// diff --git a/rosette_apiExamples/transliteration.cs b/rosette_apiExamples/transliteration.cs index 7d07357..20f117f 100644 --- a/rosette_apiExamples/transliteration.cs +++ b/rosette_apiExamples/transliteration.cs @@ -11,7 +11,7 @@ namespace rosette_apiExamples class transliteration { /// - /// Example code to call Rosette API to transliterate a name. + /// Example code to call Analytics API to transliterate a name. /// Requires Nuget Package: /// rosette_api /// diff --git a/rosette_apiUnitTests/rosette_apiUnitTests.cs b/rosette_apiUnitTests/rosette_apiUnitTests.cs index 367b2c6..940b528 100755 --- a/rosette_apiUnitTests/rosette_apiUnitTests.cs +++ b/rosette_apiUnitTests/rosette_apiUnitTests.cs @@ -165,7 +165,7 @@ protected virtual void Dispose(bool disposing) { private MockHttpMessageHandler _mockHttp; private CAPI _rosetteApi; - private string _testUrl = @"https://api.rosette.com/rest/v1/"; + private string _testUrl = @"https://analytics.babelstreet.com/rest/v1/"; [OneTimeSetUp] public void Init() { @@ -428,7 +428,7 @@ private static byte[] Decompress(byte[] gzip) { private MockHttpMessageHandler _mockHttp; private CAPI _rosetteApi; - private string _testUrl = @"https://api.rosette.com/rest/v1/"; + private string _testUrl = @"https://analytics.babelstreet.com/rest/v1/"; private string _tmpFile = null; [OneTimeSetUp] @@ -462,7 +462,7 @@ public void Cleanup() { //------------------------- User-Agent Test ---------------------------------------- [Test] public void UserAgentTest() { - string uaString = string.Format("RosetteAPICsharp/{0}/{1}", CAPI.Version, Environment.Version.ToString()); + string uaString = string.Format("Babel-Street-Analytics-API-Csharp/{0}/{1}", CAPI.Version, Environment.Version.ToString()); Assert.AreEqual(uaString, _rosetteApi.UserAgent); } @@ -494,7 +494,7 @@ public void ClearOptionsTest() { [Test] - public void CustomHeadersTest() { + public void CustomHeadersTestRosette() { KeyValuePair expected = new KeyValuePair("X-RosetteAPI-Test", "testValue"); _rosetteApi.SetCustomHeaders(expected.Key, expected.Value); @@ -502,6 +502,15 @@ public void CustomHeadersTest() { Assert.AreEqual(expected.Value, _rosetteApi.GetCustomHeaders()[expected.Key]); } + [Test] + public void CustomHeadersTestBabelStreet() { + KeyValuePair expected = new KeyValuePair("X-BabelStreetAPI-Test", "testValue"); + + _rosetteApi.SetCustomHeaders(expected.Key, expected.Value); + + Assert.AreEqual(expected.Value, _rosetteApi.GetCustomHeaders()[expected.Key]); + } + [Test] public void ClearHeadersTest() { _rosetteApi.SetCustomHeaders("X-RosetteAPI-Test", "testValue"); @@ -519,7 +528,7 @@ public void CheckInvalidCustomHeader() { _rosetteApi.SetCustomHeaders(expected.Key, expected.Value); } catch (RosetteException ex) { - Assert.AreEqual(ex.Message, "Custom header name must begin with \"X-RosetteAPI-\""); + Assert.AreEqual(ex.Message, "Custom header name must begin with \"X-RosetteAPI-\" or \"X-BabelStreetAPI-\""); return; } } @@ -1175,7 +1184,7 @@ public void NameSimilarityTestFull() String mockedContent = expected.ContentToString(); HttpResponseMessage mockedMessage = MakeMockedMessage(responseHeaders, HttpStatusCode.OK, mockedContent); _mockHttp.When(_testUrl + "name-similarity").Respond(req => mockedMessage); - NameSimilarityResponse response = _rosetteApi.NameSimilarity(new Name("Влади́мир Влади́мирович Пу́тин", "rus", null, "PERSON"), new Name("Vladmir Putin", "eng", null, "PERSON")); + NameSimilarityResponse response = _rosetteApi.NameSimilarity(new Name("Влади́мир Влади́мирович Пу́тин", "rus", null, "PERSON", Gender.Male), new Name("Vladmir Putin", "eng", null, "PERSON")); Assert.AreEqual(expected, response); } diff --git a/run_examples.sh b/run_examples.sh new file mode 100755 index 0000000..754a5e1 --- /dev/null +++ b/run_examples.sh @@ -0,0 +1,13 @@ +#!/bin/bash + +if [ $# -eq 0 ]; then + echo "Usage: $0 API_KEY [ALT_URL]" 1>&2 + exit 1 +fi + +filenames=$( ls rosette_apiExamples/*.cs | awk -F/ '{print $NF}' | awk -F. '{print $1}' ) + +export API_KEY=$1 +export ALT_URL=$2 + +bash recompile.sh $filenames