Skip to content

Commit 9b2372f

Browse files
Merge branch 'develop'
2 parents aeb9930 + db0a5ec commit 9b2372f

File tree

3 files changed

+19
-7
lines changed

3 files changed

+19
-7
lines changed

rosette_api/Properties/AssemblyInfo.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,6 @@
3131
//
3232
// You can specify all the values or you can default the Build and Revision Numbers
3333
// by using the '*' as shown below:
34-
// [assembly: AssemblyVersion("1.31.0.0")]
35-
[assembly: AssemblyVersion("1.31.0.0")]
36-
[assembly: AssemblyFileVersion("1.31.0.0")]
34+
// [assembly: AssemblyVersion("1.33.0.0")]
35+
[assembly: AssemblyVersion("1.33.0.0")]
36+
[assembly: AssemblyFileVersion("1.33.0.0")]

rosette_api/TranslateNamesResponse.cs

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
using System.Text;
55
using System.Threading.Tasks;
66
using Newtonsoft.Json;
7+
using Newtonsoft.Json.Linq;
78
using System.Net.Http;
89

910
namespace rosette_api
@@ -59,6 +60,11 @@ public class TranslateNamesResponse : RosetteResponse
5960
/// </summary>
6061
[JsonProperty(confidenceKey, NullValueHandling=NullValueHandling.Ignore)]
6162
public Nullable<double> Confidence { get; set; }
63+
/// <summary>
64+
/// Gets or sets the extended information about the translation
65+
/// </summary>
66+
[JsonProperty(extendedInformationKey, NullValueHandling=NullValueHandling.Ignore)]
67+
public Dictionary<string, object> ExtendedInformation { get; set; }
6268

6369
private const string sourceScriptKey = "sourceScript";
6470
private const string sourceLanguageOfOriginKey = "sourceLanguageOfOrigin";
@@ -69,6 +75,7 @@ public class TranslateNamesResponse : RosetteResponse
6975
private const string targetSchemeKey = "targetScheme";
7076
private const string entityTypeKey = "entityType";
7177
private const string confidenceKey = "confidence";
78+
private const string extendedInformationKey = "extendedInformation";
7279

7380
/// <summary>
7481
/// Creates a TranslateNamesResponse from the given apiResult
@@ -85,6 +92,7 @@ public TranslateNamesResponse(HttpResponseMessage apiResult) :base(apiResult)
8592
this.TargetScheme = this.ContentDictionary.ContainsKey(targetSchemeKey) ? this.ContentDictionary[targetSchemeKey] as string : null;
8693
this.EntityType = this.ContentDictionary.ContainsKey(entityTypeKey) ? this.ContentDictionary[entityTypeKey] as string : null;
8794
this.Confidence = this.ContentDictionary.ContainsKey(confidenceKey) ? this.ContentDictionary[confidenceKey] as double? : null;
95+
this.ExtendedInformation = this.ContentDictionary.ContainsKey(extendedInformationKey) ? (this.ContentDictionary[extendedInformationKey] as JObject).ToObject<Dictionary<string, object>>(): null;
8896
}
8997

9098
/// <summary>
@@ -103,7 +111,8 @@ public TranslateNamesResponse(HttpResponseMessage apiResult) :base(apiResult)
103111
/// <param name="content">The content in Dictionary form</param>
104112
/// <param name="contentAsJson">The content in JSON form</param>
105113
public TranslateNamesResponse(string translation, string targetLanguage, string targetScheme = null, string targetScript = null, string entityType = null, string sourceLanguageOfOrigin = null,
106-
string sourceLanguageOfUse = null, string sourceScript = null, double? confidence = null, Dictionary<string, string> responseHeaders = null, Dictionary<string, object> content = null, string contentAsJson = null) : base(responseHeaders, content, contentAsJson)
114+
string sourceLanguageOfUse = null, string sourceScript = null, double? confidence = null, Dictionary<string, object> extendedInformation = null,
115+
Dictionary<string, string> responseHeaders = null, Dictionary<string, object> content = null, string contentAsJson = null) : base(responseHeaders, content, contentAsJson)
107116
{
108117
this.SourceLanguageOfOrigin = sourceLanguageOfOrigin;
109118
this.SourceLanguageOfUse = sourceLanguageOfUse;
@@ -114,6 +123,7 @@ public TranslateNamesResponse(string translation, string targetLanguage, string
114123
this.TargetScript = targetScript;
115124
this.EntityType = entityType;
116125
this.Confidence = confidence;
126+
this.ExtendedInformation = extendedInformation;
117127
}
118128

119129
/// <summary>
@@ -137,7 +147,8 @@ public override bool Equals(object obj)
137147
this.TargetScript != null && other.TargetScript != null ? this.TargetScript.Equals(other.TargetScript) : this.TargetScript == other.TargetScript,
138148
this.EntityType != null && other.EntityType != null ? this.EntityType.Equals(other.EntityType) : this.EntityType == other.EntityType,
139149
this.Confidence == other.Confidence,
140-
this.GetHashCode() == other.GetHashCode()
150+
this.GetHashCode() == other.GetHashCode(),
151+
this.ExtendedInformation != null && other.ExtendedInformation != null ? Utilities.DictionaryEquals(this.ExtendedInformation, other.ExtendedInformation) : this.ExtendedInformation == other.ExtendedInformation,
141152
};
142153
return conditions.All(condition => condition);
143154
}
@@ -163,7 +174,8 @@ public override int GetHashCode()
163174
int h7 = this.TargetScript != null ? this.TargetScript.GetHashCode() : 1;
164175
int h8 = this.Translation != null ? this.Translation.GetHashCode() : 1;
165176
int h9 = this.Confidence != null ? this.Confidence.GetHashCode() : 1;
166-
return h0 ^ h1 ^ h2 ^ h3 ^ h4 ^ h5 ^ h6 ^ h7 ^ h8 ^ h9;
177+
int h10 = this.ExtendedInformation != null ? this.ExtendedInformation.GetHashCode() : 1;
178+
return h0 ^ h1 ^ h2 ^ h3 ^ h4 ^ h5 ^ h6 ^ h7 ^ h8 ^ h9 ^ h10;
167179
}
168180
}
169181
}

rosette_api/rosette_api.nuspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<package>
33
<metadata>
44
<id>rosette_api</id>
5-
<version>1.31.0</version>
5+
<version>1.33.0</version>
66
<description>.Net (C#) Binding for Babel Street Analytics API</description>
77
<!-- TODO update these once there is a user on Nuget -->
88
<authors>basistech</authors>

0 commit comments

Comments
 (0)