@@ -123,9 +123,16 @@ public class RosetteEntity : IEquatable<RosetteEntity>
123
123
/// <summary>
124
124
/// Gets or sets the dbpediaType of the extracted entity
125
125
/// </summary>
126
+ [ Obsolete ( "Use dbPediaTypes instead." ) ]
126
127
[ JsonProperty ( "dbpediaType" , NullValueHandling = NullValueHandling . Ignore ) ]
127
128
public String DBpediaType { get ; set ; }
128
129
130
+ /// <summary>
131
+ /// Gets or sets the dbpediaTypes of the extracted entity
132
+ /// </summary>
133
+ [ JsonProperty ( "dbpediaTypes" , NullValueHandling = NullValueHandling . Ignore ) ]
134
+ public List < String > DBpediaTypes { get ; set ; }
135
+
129
136
/// <summary>
130
137
/// Gets or sets the offsets of the extracted entity
131
138
/// </summary>
@@ -144,6 +151,12 @@ public class RosetteEntity : IEquatable<RosetteEntity>
144
151
[ JsonProperty ( "salience" , NullValueHandling = NullValueHandling . Ignore ) ]
145
152
public Nullable < double > Salience { get ; set ; }
146
153
154
+ /// <summary>
155
+ /// Gets or sets the permId of the extracted entity
156
+ /// </summary>
157
+ [ JsonProperty ( "permId" , NullValueHandling = NullValueHandling . Ignore ) ]
158
+ public String PermID { get ; set ; }
159
+
147
160
/// <summary>
148
161
/// Creates an entity
149
162
/// </summary>
@@ -154,12 +167,14 @@ public class RosetteEntity : IEquatable<RosetteEntity>
154
167
/// <param name="count">The number of times this entity appeared in the input to the API</param>
155
168
/// <param name="confidence">The confidence of this entity appeared in the input to the API</param>
156
169
/// <param name="dbpediaType">The DBpedia type of the entity</param>
170
+ /// <param name="dbpediaTypes">A list of DBpedia types of the entitiy</param>
157
171
/// <param name="mentionOffsets">The mention offsets of the entity</param>
158
172
/// <param name="linkingConfidence">The linking confidence of the entity</param>
159
173
/// <param name="salience">The salience of the entity</param>
174
+ /// <param name="permId">The Thomson Reuters Permanent Identifier of the entity</param>
160
175
public RosetteEntity ( string mention , string normalizedMention , EntityID id , string entityType , int ? count ,
161
- double ? confidence , string dbpediaType , List < MentionOffset > mentionOffsets , double ? linkingConfidence ,
162
- double ? salience )
176
+ double ? confidence , string dbpediaType , List < String > dbpediaTypes , List < MentionOffset > mentionOffsets ,
177
+ double ? linkingConfidence , double ? salience , string permId )
163
178
{
164
179
this . Mention = mention ;
165
180
this . NormalizedMention = normalizedMention ;
@@ -168,9 +183,25 @@ public RosetteEntity(string mention, string normalizedMention, EntityID id, stri
168
183
this . EntityType = entityType ;
169
184
this . Confidence = confidence ;
170
185
this . DBpediaType = dbpediaType ;
186
+ this . DBpediaTypes = dbpediaTypes ;
171
187
this . MentionOffsets = mentionOffsets ;
172
188
this . LinkingConfidence = linkingConfidence ;
173
189
this . Salience = salience ;
190
+ this . PermID = permId ;
191
+ }
192
+
193
+ /// <summary>
194
+ /// Method to compare Lists of Strings. SequenceEqual throws an exception
195
+ /// if either argument is null.
196
+ /// </summary>
197
+ /// <param name="list1">List<String></param>
198
+ /// <param name="list2">List<String></param>
199
+ /// <returns>True if equal or both null</returns>
200
+ private bool StringListsAreEqual ( List < String > list1 , List < String > list2 )
201
+ {
202
+ if ( list1 == null && list2 == null ) { return true ; }
203
+ if ( list1 == null || list2 == null ) { return false ; } // only one is null
204
+ return list1 . SequenceEqual ( list2 ) ;
174
205
}
175
206
176
207
/// <summary>
@@ -187,9 +218,11 @@ public bool Equals(RosetteEntity other)
187
218
&& Count == other . Count
188
219
&& Confidence . Equals ( other . Confidence )
189
220
&& string . Equals ( DBpediaType , other . DBpediaType )
221
+ && StringListsAreEqual ( DBpediaTypes , other . DBpediaTypes )
190
222
&& MentionOffsets . SequenceEqual ( other . MentionOffsets )
191
223
&& LinkingConfidence . Equals ( other . LinkingConfidence )
192
- && Salience . Equals ( other . Salience ) ;
224
+ && Salience . Equals ( other . Salience )
225
+ && string . Equals ( PermID , other . PermID ) ;
193
226
}
194
227
195
228
/// <summary>
@@ -220,9 +253,11 @@ public override int GetHashCode()
220
253
hashCode = ( hashCode * 397 ) ^ Count . GetHashCode ( ) ;
221
254
hashCode = ( hashCode * 397 ) ^ Confidence . GetHashCode ( ) ;
222
255
hashCode = ( hashCode * 397 ) ^ ( DBpediaType != null ? DBpediaType . GetHashCode ( ) : 0 ) ;
256
+ hashCode = ( hashCode * 397 ) ^ ( DBpediaTypes != null ? DBpediaTypes . GetHashCode ( ) : 0 ) ;
223
257
hashCode = ( hashCode * 397 ) ^ ( MentionOffsets != null ? MentionOffsets . GetHashCode ( ) : 0 ) ;
224
258
hashCode = ( hashCode * 397 ) ^ ( LinkingConfidence != null ? LinkingConfidence . GetHashCode ( ) : 0 ) ;
225
259
hashCode = ( hashCode * 397 ) ^ ( Salience != null ? Salience . GetHashCode ( ) : 0 ) ;
260
+ hashCode = ( hashCode * 397 ) ^ ( PermID != null ? PermID . GetHashCode ( ) : 0 ) ;
226
261
return hashCode ;
227
262
}
228
263
}
0 commit comments